/* G2C Mando v1.0 · Sistema de diseño */
/* Created by Alan Davis · powered by g2c.com.mx */

:root {
  /* Branding G2C */
  --g2c-primary: #FF4F00;
  --g2c-secondary: #FF7A00;
  --g2c-dark: #0F1419;
  --g2c-dark-2: #14181F;
  --g2c-white: #F4F3EF;

  /* Texto */
  --text-primary: rgba(244,243,239,0.95);
  --text-secondary: rgba(244,243,239,0.7);
  --text-tertiary: rgba(244,243,239,0.5);
  --text-mute: rgba(244,243,239,0.4);
  --text-faint: rgba(244,243,239,0.25);

  /* Cyan tech (reemplaza morado) */
  --cyan: rgba(120,200,220,1);
  --cyan-light: rgba(150,210,230,1);
  --cyan-text: rgba(180,220,240,0.95);
  --cyan-bg-soft: rgba(120,200,220,0.04);
  --cyan-bg-mid: rgba(120,200,220,0.08);
  --cyan-bg-strong: rgba(120,200,220,0.15);
  --cyan-border-soft: rgba(120,200,220,0.2);
  --cyan-border: rgba(120,200,220,0.4);

  /* Status */
  --green: rgba(180,220,170,1);
  --green-text: rgba(200,230,200,0.95);
  --green-bg: rgba(180,220,170,0.08);
  --green-border: rgba(180,220,170,0.25);

  --yellow: rgba(244,213,128,1);
  --yellow-text: rgba(244,213,128,0.95);
  --yellow-bg: rgba(244,213,128,0.06);
  --yellow-border: rgba(244,213,128,0.3);

  --orange: rgba(255,150,80,1);
  --orange-text: rgba(255,170,110,0.95);
  --orange-bg: rgba(255,79,0,0.06);
  --orange-border: rgba(255,79,0,0.3);

  /* Personal vs Trabajo */
  --personal-bg: rgba(120,200,220,0.06);
  --personal-border: rgba(120,200,220,0.18);
  --trabajo-bg: rgba(255,79,0,0.05);
  --trabajo-border: rgba(255,79,0,0.18);

  /* Fondos */
  --bg-card: rgba(244,243,239,0.025);
  --bg-card-hover: rgba(244,243,239,0.04);
  --border-soft: rgba(244,243,239,0.05);
  --border-mid: rgba(244,243,239,0.1);

  /* Spacing system */
  --pad-side: 18px;
  --pad-bottom-nav: 90px;
  --gap-blocks: 14px;
  --gap-stack: 10px;
  --pad-card: 12px;
  --pad-card-lg: 14px;
  --radius-sm: 8px;
  --radius-md: 11px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-pill: 999px;
  --radius-input: 22px;

  /* Chat IA */
  --chat-margin-left: 26px;
  --chat-pad-y: 11px;
  --chat-pad-x: 14px;
  --chat-radius-ai: 16px 16px 16px 4px;
  --chat-radius-user: 16px 16px 4px 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  background: linear-gradient(180deg, var(--g2c-dark) 0%, var(--g2c-dark-2) 100%);
  color: var(--g2c-white);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  min-height: 100vh;
  overflow-x: hidden;
}

body {
  padding: 18px var(--pad-side) var(--pad-bottom-nav);
  position: relative;
}

/* === Status bar (mobile native feel) === */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px 12px;
  font-size: 11px;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
}
.status-bar .time { font-weight: 500; color: var(--text-secondary); }
.status-bar .battery {
  width: 16px; height: 9px;
  border: 0.5px solid rgba(244,243,239,0.5);
  border-radius: 2px;
  padding: 1px;
}
.status-bar .battery > div {
  width: 80%; height: 100%;
  background: rgba(244,243,239,0.7);
  border-radius: 1px;
}

/* === Header de módulo === */
.module-header {
  margin-bottom: 16px;
}
.module-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.module-eyebrow .dot {
  width: 5px; height: 5px;
  background: var(--g2c-primary);
  border-radius: 50%;
}
.module-eyebrow .label {
  font-size: 9px;
  color: rgba(255,150,80,0.85);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
}
.module-title {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.15;
}
.module-subtitle {
  font-size: 12px;
  color: rgba(244,243,239,0.55);
  margin-top: 4px;
  line-height: 1.45;
}

/* === Mando avatar (estrella G2C animada) === */
.mando-avatar {
  position: relative;
  width: 36px; height: 36px;
  flex-shrink: 0;
}
.mando-avatar .core {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,79,0,0.6), rgba(255,122,0,0.7));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.mando-avatar .ring-1 {
  position: absolute; inset: -3px;
  border: 1px solid rgba(255,79,0,0.25);
  border-radius: 50%;
  animation: pulse-ring 2.5s ease-out infinite;
}
.mando-avatar .ring-2 {
  position: absolute; inset: -7px;
  border: 0.5px solid rgba(255,79,0,0.12);
  border-radius: 50%;
  animation: pulse-ring 2.5s ease-out infinite 0.5s;
}
@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.15); opacity: 0; }
}

/* === Briefing card (hero) === */
.briefing-card {
  background: linear-gradient(135deg, rgba(255,79,0,0.06), rgba(255,122,0,0.02));
  border: 0.5px solid rgba(255,79,0,0.15);
  border-radius: var(--radius-xl);
  padding: 16px;
  margin-bottom: var(--gap-blocks);
  position: relative;
  overflow: hidden;
}
.briefing-card::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 100px; height: 100px;
  background: radial-gradient(circle, rgba(255,79,0,0.08), transparent 70%);
  pointer-events: none;
}
.briefing-card .greeting {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 8px;
}
.briefing-card .context {
  font-size: 13px;
  color: rgba(244,243,239,0.85);
  line-height: 1.55;
}

/* === Quick reply chips === */
.chip-row {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.chip {
  background: rgba(244,243,239,0.06);
  border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  font-size: 11px;
  color: rgba(244,243,239,0.85);
  cursor: pointer;
  transition: all 0.15s;
}
.chip:active, .chip:hover {
  background: rgba(255,79,0,0.12);
  border-color: var(--orange-border);
  color: var(--orange-text);
}
.chip.active {
  background: rgba(255,79,0,0.12);
  border-color: var(--orange-border);
  color: var(--orange-text);
  font-weight: 500;
}

/* === Tab bar (Finanzas) === */
.tab-bar {
  display: flex;
  gap: 5px;
  margin-bottom: var(--gap-blocks);
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab {
  background: rgba(244,243,239,0.04);
  border: 0.5px solid rgba(244,243,239,0.08);
  border-radius: var(--radius-pill);
  padding: 5px 11px;
  font-size: 11px;
  color: rgba(244,243,239,0.6);
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}
.tab.active {
  background: rgba(255,79,0,0.12);
  border-color: var(--orange-border);
  color: var(--orange-text);
  font-weight: 500;
}

/* === Section eyebrow === */
.section-eyebrow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.section-eyebrow .label {
  font-size: 9px;
  color: rgba(244,243,239,0.55);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 500;
}
.section-eyebrow .action {
  font-size: 11px;
  color: rgba(255,150,80,0.9);
  cursor: pointer;
}

/* === Stat cards grid === */
.stat-grid {
  display: grid;
  gap: 7px;
  margin-bottom: var(--gap-blocks);
}
.stat-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.stat-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.stat-grid.cols-4 { grid-template-columns: 1fr 1fr; }

.stat-card {
  background: var(--bg-card);
  border: 0.5px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  position: relative;
}
.stat-card .stat-label {
  font-size: 9px;
  color: var(--text-tertiary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.stat-card .stat-value {
  font-size: 18px;
  font-weight: 500;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.stat-card .stat-meta {
  font-size: 9px;
  color: var(--text-tertiary);
  margin-top: 1px;
}
.stat-card.alert {
  background: linear-gradient(135deg, rgba(255,79,0,0.06), rgba(255,79,0,0.01));
  border-color: rgba(255,79,0,0.2);
}
.stat-card.alert::before {
  content: '';
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  background: var(--g2c-primary);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255,79,0,0.7);
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.stat-card.green {
  background: linear-gradient(135deg, rgba(180,220,170,0.05), rgba(180,220,170,0.01));
  border-color: rgba(180,220,170,0.15);
}
.stat-card.cyan {
  background: linear-gradient(135deg, rgba(120,200,220,0.05), rgba(120,200,220,0.01));
  border-color: rgba(120,200,220,0.18);
}

/* === Decision cards (con barra lateral de color) === */
.decision-card {
  background: var(--bg-card);
  border: 0.5px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 13px 14px 14px;
  position: relative;
  overflow: hidden;
  margin-bottom: 8px;
}
.decision-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 3px;
}
.decision-card.cyan::before { background: linear-gradient(180deg, var(--cyan-light), rgba(120,200,220,0.3)); }
.decision-card.cyan { background: rgba(120,200,220,0.04); border-color: var(--cyan-border-soft); }

.decision-card.orange::before { background: linear-gradient(180deg, var(--orange), rgba(255,150,80,0.3)); }
.decision-card.orange { background: rgba(255,79,0,0.04); border-color: rgba(255,79,0,0.2); }

.decision-card.green::before { background: linear-gradient(180deg, var(--green), rgba(180,220,170,0.3)); }
.decision-card.green { background: rgba(180,220,170,0.04); border-color: rgba(180,220,170,0.2); }

.decision-card.yellow::before { background: linear-gradient(180deg, var(--yellow), rgba(244,213,128,0.3)); }
.decision-card.yellow { background: rgba(244,213,128,0.04); border-color: var(--yellow-border); }

.decision-eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.decision-eyebrow .label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}
.decision-card.cyan .decision-eyebrow .label { color: var(--cyan-light); }
.decision-card.orange .decision-eyebrow .label { color: var(--orange-text); }
.decision-card.green .decision-eyebrow .label { color: rgba(180,220,170,0.95); }
.decision-card.yellow .decision-eyebrow .label { color: var(--yellow-text); }

.decision-title {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.45;
  margin-bottom: 10px;
}
.decision-pivots {
  display: flex;
  gap: 8px;
  padding-top: 8px;
  border-top: 0.5px solid rgba(244,243,239,0.06);
  margin-bottom: 10px;
}
.decision-pivot { flex: 1; }
.decision-pivot .pivot-label {
  font-size: 9px;
  color: var(--text-tertiary);
  letter-spacing: 0.05em;
}
.decision-pivot .pivot-value {
  font-size: 10px;
  color: var(--text-primary);
  margin-top: 2px;
}

.decision-actions {
  display: flex;
  gap: 6px;
}
.btn {
  flex: 1;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  border: 0.5px solid;
  cursor: pointer;
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-mid);
  transition: all 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn.primary-cyan {
  background: rgba(120,200,220,0.18);
  border-color: var(--cyan-border);
  color: var(--cyan-text);
}
.btn.primary-orange {
  background: rgba(255,79,0,0.18);
  border-color: rgba(255,79,0,0.4);
  color: var(--orange-text);
}
.btn.primary-green {
  background: rgba(180,220,170,0.18);
  border-color: rgba(180,220,170,0.4);
  color: var(--green-text);
}
.btn.full { width: 100%; }

/* === Lista (clientes, pendientes, etc) === */
.list-card {
  background: var(--bg-card);
  border: 0.5px solid var(--border-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--gap-blocks);
}
.list-row {
  padding: 11px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 0.5px solid var(--border-soft);
  cursor: pointer;
}
.list-row:last-child { border-bottom: none; }
.list-row.alert {
  background: rgba(255,79,0,0.04);
  border-color: rgba(255,79,0,0.18);
}
.list-row .row-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.list-row .row-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.list-row .row-dot.green { background: var(--green); }
.list-row .row-dot.orange { background: var(--orange); }
.list-row .row-dot.yellow { background: var(--yellow); }
.list-row .row-content { min-width: 0; }
.list-row .row-title {
  font-size: 12px;
  font-weight: 500;
}
.list-row .row-sub {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 1px;
}
.list-row .row-value {
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
  flex-shrink: 0;
}
.list-row .row-meta {
  font-size: 9px;
  color: var(--text-tertiary);
}

/* === Pill (badges status) === */
.pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-size: 9px;
  font-weight: 500;
}
.pill.green { background: var(--green-bg); border: 0.5px solid var(--green-border); color: rgba(180,220,170,0.95); }
.pill.yellow { background: var(--yellow-bg); border: 0.5px solid var(--yellow-border); color: var(--yellow-text); }
.pill.orange { background: rgba(255,79,0,0.08); border: 0.5px solid var(--orange-border); color: var(--orange-text); }

/* === Chat IA messages === */
.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: var(--gap-blocks);
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}

/* Quick choices dock · botones flotantes arriba del chat input */
.quick-choices-dock {
  pointer-events: auto;
}
.quick-choices-dock button:active {
  opacity: 0.7;
  transform: scale(0.97);
}

/* Cuando hay dock activo, el thread necesita más espacio bottom */
body:has(.quick-choices-dock) .chat-thread {
  padding-bottom: calc(180px + env(safe-area-inset-bottom, 0px)) !important;
}

.msg-ai {
  align-self: flex-start;
  max-width: 86%;
}
.msg-ai .ai-eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  padding-left: 2px;
}
.msg-ai .ai-eyebrow .ai-dot {
  width: 18px; height: 18px;
  background: rgba(255,79,0,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.msg-ai .ai-eyebrow .ai-dot::after {
  content: '';
  width: 6px; height: 6px;
  background: var(--g2c-primary);
  transform: rotate(45deg);
  display: block;
}
.msg-ai .ai-eyebrow .ai-label {
  font-size: 9px;
  color: rgba(255,150,80,0.85);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.msg-ai .ai-bubble {
  background: rgba(36,42,52,0.98);
  border-radius: 16px 16px 16px 4px;
  padding: 10px 14px;
}
.msg-ai .ai-bubble .ai-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
}

/* Mensajes personales (cyan/cálido) */
.msg-ai.personal .ai-eyebrow .ai-dot { background: rgba(120,200,220,0.2); }
.msg-ai.personal .ai-eyebrow .ai-dot::after { background: var(--cyan-light); }
.msg-ai.personal .ai-eyebrow .ai-label { color: rgba(150,210,230,0.95); }
.msg-ai.personal .ai-bubble {
  background: var(--personal-bg);
  border: 0.5px solid var(--personal-border);
}

.msg-card {
  align-self: flex-start;
  max-width: 92%;
  margin-left: 0;
}

.msg-actions {
  align-self: flex-start;
  margin-left: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 92%;
}
.msg-actions .btn { padding: 10px 13px; font-size: 12px; text-align: left; }

.msg-user {
  align-self: flex-end;
  max-width: 86%;
}
.msg-user .user-bubble {
  background: rgba(255,79,0,0.18);
  border: 0.5px solid rgba(255,79,0,0.32);
  border-radius: 16px 16px 4px 16px;
  padding: 9px 14px;
}
.msg-user .user-bubble .user-text {
  font-size: 14px;
  color: rgba(255,210,180,0.98);
  line-height: 1.45;
}
.msg-user .user-meta {
  font-size: 9px;
  color: var(--text-mute);
  margin-top: 3px;
  text-align: right;
  padding-right: 4px;
}

/* === Typing indicator === */
.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}
.typing-dots .dot {
  width: 5px; height: 5px;
  background: rgba(255,150,80,0.6);
  border-radius: 50%;
  animation: typing 1.5s infinite;
}
.typing-dots .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dots .dot:nth-child(3) { animation-delay: 0.4s; }
.typing-dots .typing-label {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-left: 5px;
}
@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

/* === Input chat (3 estados) === */
.chat-input-wrap {
  position: fixed;
  bottom: var(--pad-bottom-nav);
  left: 0;
  right: 0;
  width: 100%;
  box-sizing: border-box;
  z-index: 50;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(15,20,25,0.98) 60%, rgba(15,20,25,0));
  transition: bottom 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}
.chat-input-wrap.keyboard-open {
  bottom: var(--keyboard-bottom, 0px) !important;
  padding-bottom: 8px;
}
.chat-input {
  background: rgba(28,33,40,0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 0.5px solid var(--border-mid);
  border-radius: 22px;
  padding: 8px 8px 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  width: 100%;
  box-sizing: border-box;
  min-height: 42px;
  max-width: 100%;
}
.chat-input.active {
  border-color: rgba(255,79,0,0.4);
  box-shadow: 0 0 0 3px rgba(255,79,0,0.08), 0 4px 16px rgba(0,0,0,0.3);
}
.chat-input input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 16px; /* CRÍTICO iOS: <16px hace zoom al focus */
}
.chat-input input::placeholder { color: var(--text-tertiary); }
.chat-input .icon-mic {
  width: 24px; height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}
.chat-input .send-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 0.5px solid rgba(244,243,239,0.08);
  background: rgba(244,243,239,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.chat-input.active .send-btn {
  background: linear-gradient(135deg, var(--g2c-primary), var(--g2c-secondary));
  border-color: rgba(255,79,0,0.6);
  box-shadow: 0 2px 8px rgba(255,79,0,0.3);
}

/* === Mini-player YouTube (persiste entre módulos) === */
.miniplayer {
  position: fixed;
  bottom: calc(var(--pad-bottom-nav) + 116px);
  left: var(--pad-side);
  right: var(--pad-side);
  background: rgba(15,20,25,0.98);
  backdrop-filter: blur(10px);
  border: 0.5px solid var(--cyan-border-soft);
  border-radius: var(--radius-md);
  padding: 9px 11px;
  display: none;
  align-items: center;
  gap: 10px;
  z-index: 49;
}
.miniplayer.active { display: flex; }
.miniplayer .yt-thumb {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #1f2d4e, #0a1a2e);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.miniplayer .yt-info {
  flex: 1; min-width: 0;
}
.miniplayer .yt-title {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.miniplayer .yt-progress {
  height: 2px;
  background: rgba(244,243,239,0.1);
  border-radius: 1px;
  margin-top: 5px;
}
.miniplayer .yt-progress > div {
  height: 100%;
  background: var(--cyan-light);
  border-radius: 1px;
  transition: width 0.5s;
}
.miniplayer .yt-controls {
  display: flex;
  gap: 6px;
}
.miniplayer .yt-controls svg { cursor: pointer; }

/* === Bottom nav === */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(15,20,25,0.95);
  backdrop-filter: blur(10px);
  border-top: 0.5px solid rgba(244,243,239,0.08);
  padding: 10px 6px calc(18px + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  z-index: 100;
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-mute);
  min-width: 0; /* Crítico: permite shrink en grid */
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item.active { color: var(--g2c-primary); font-weight: 500; }
.bottom-nav-item .nav-label {
  font-size: 9.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.bottom-nav-item svg {
  flex-shrink: 0;
}
@media (max-width: 360px) {
  .bottom-nav-item .nav-label { font-size: 8.5px; }
}

/* === Footer G2C (en cada módulo) === */
.module-footer {
  position: fixed;
  bottom: 64px;
  left: var(--pad-side);
  right: var(--pad-side);
  padding: 10px 0;
  border-top: 0.5px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(180deg, transparent, var(--g2c-dark) 40%);
  z-index: 48;
}
.module-footer .star-icon {
  flex-shrink: 0;
}
.module-footer .credits {
  font-size: 8px;
  color: var(--text-mute);
  letter-spacing: 0.05em;
}
.module-footer .credits .domain {
  color: rgba(255,150,80,0.7);
}

/* === Timeline (Mando) === */
.timeline {
  background: var(--bg-card);
  border: 0.5px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: var(--gap-blocks);
}
.timeline-track {
  position: relative;
  height: 56px;
  margin-bottom: 12px;
}
.timeline-line {
  position: absolute;
  left: 0; right: 0;
  top: 26px;
  height: 4px;
  background: rgba(244,243,239,0.04);
  border-radius: 2px;
}
.timeline-progress {
  position: absolute;
  left: 0;
  top: 26px;
  height: 4px;
  background: linear-gradient(90deg, rgba(180,220,170,0.6), rgba(180,220,170,0.3));
  border-radius: 2px;
}
.timeline-event {
  position: absolute;
  top: 18px;
  width: 16px; height: 16px;
  border-radius: 50%;
  cursor: pointer;
}
.timeline-event.done {
  background: rgba(180,220,170,0.4);
  border: 1.5px solid var(--green);
}
.timeline-event.now {
  width: 24px; height: 24px;
  top: 14px;
  background: rgba(255,79,0,0.2);
  border: 1.5px solid var(--g2c-primary);
  box-shadow: 0 0 0 4px rgba(255,79,0,0.1);
  animation: pulse-now 2s infinite;
}
.timeline-event.now::after {
  content: '';
  display: block;
  width: 8px; height: 8px;
  background: var(--g2c-primary);
  border-radius: 50%;
  margin: auto;
  margin-top: 6px;
}
@keyframes pulse-now {
  0%, 100% { box-shadow: 0 0 0 4px rgba(255,79,0,0.1); }
  50% { box-shadow: 0 0 0 8px rgba(255,79,0,0.06); }
}
.timeline-event.future {
  border: 1px solid rgba(244,213,128,0.6);
  background: rgba(244,243,239,0.04);
}
.timeline-time {
  position: absolute;
  top: 0;
  font-size: 9px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}
.timeline-label {
  position: absolute;
  top: 42px;
  font-size: 9px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.timeline-next {
  background: rgba(255,79,0,0.06);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border-left: 2px solid var(--g2c-primary);
}
.timeline-next .next-label {
  font-size: 10px;
  color: rgba(255,150,80,0.95);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 3px;
}
.timeline-next .next-text {
  font-size: 13px;
  color: var(--text-primary);
}

/* === Calendario grid === */
.cal-grid {
  background: rgba(244,243,239,0.02);
  border: 0.5px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 10px;
  margin-bottom: var(--gap-blocks);
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
}
.cal-weekday {
  font-size: 10px;
  color: var(--text-mute);
  text-align: center;
  padding: 4px 0;
  font-weight: 500;
}
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-day {
  aspect-ratio: 1;
  padding: 5px;
  background: var(--bg-card);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all 0.15s;
}
.cal-day .day-num {
  font-size: 13px;
  font-weight: 500;
}
.cal-day .day-dots {
  display: flex;
  gap: 2px;
  margin-top: auto;
}
.cal-day .day-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
}
.cal-day.today {
  background: rgba(255,79,0,0.15);
  border: 0.5px solid rgba(255,79,0,0.5);
}
.cal-day.today .day-num { color: rgba(255,170,110,1); }
.cal-day.empty { opacity: 0.25; cursor: default; }
.cal-day.viaje {
  background: rgba(120,200,220,0.1);
  border: 0.5px dashed rgba(120,200,220,0.45);
}
.cal-day.viaje .day-num { color: var(--cyan-light); }

.cal-legend {
  display: flex;
  gap: 12px;
  margin-bottom: var(--gap-blocks);
  flex-wrap: wrap;
}
.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--text-secondary);
}
.cal-legend-item .legend-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
}

/* === Forms === */
.form-field {
  margin-bottom: 11px;
}
.form-field .field-label {
  font-size: 10px;
  color: rgba(244,243,239,0.55);
  margin-bottom: 5px;
  letter-spacing: 0.05em;
}
.form-field .field-input,
.form-field .field-select {
  background: var(--bg-card-hover);
  border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-primary);
  width: 100%;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color 0.15s;
}
.form-field .field-input:focus {
  border-color: rgba(255,79,0,0.4);
}
.form-field .field-input.auto-filled {
  background: rgba(180,220,170,0.05);
  border-color: rgba(180,220,170,0.2);
}
.form-field .field-textarea {
  min-height: 50px;
  resize: vertical;
}

.field-chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 5px;
}
.field-chip {
  background: rgba(244,243,239,0.04);
  border: 0.5px solid rgba(244,243,239,0.08);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 10px;
  color: rgba(244,243,239,0.6);
  cursor: pointer;
}
.field-chip.active {
  background: rgba(120,200,220,0.15);
  border-color: var(--cyan-border);
  color: var(--cyan-text);
}

/* === Set list (música) === */
.setlist-progress {
  display: flex;
  gap: 4px;
  margin-bottom: 9px;
}
.setlist-segment {
  flex: 1;
  text-align: center;
}
.setlist-segment .seg-bar {
  height: 5px;
  border-radius: 2px;
  background: rgba(244,243,239,0.08);
  overflow: hidden;
}
.setlist-segment .seg-bar > div {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width 0.3s;
}
.setlist-segment .seg-label {
  font-size: 8px;
  color: var(--green);
  margin-top: 3px;
}

.setlist-stats {
  background: rgba(15,20,25,0.4);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.setlist-stat .stat-mini-label {
  font-size: 8px;
  color: var(--text-tertiary);
  letter-spacing: 0.05em;
}
.setlist-stat .stat-mini-value {
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}
.setlist-stat .stat-mini-value.cantas { color: rgba(150,220,200,0.95); }
.setlist-stat .stat-mini-value.descansas { color: var(--yellow-text); }

.setlist-divider {
  width: 1px;
  height: 28px;
  background: rgba(244,243,239,0.1);
}

/* === Modo escena (música) === */
.escena-mode {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 200;
  padding: 18px;
  display: flex;
  flex-direction: column;
}
.escena-header {
  background: rgba(120,200,220,0.08);
  border: 0.5px solid var(--cyan-border-soft);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 14px;
}
.escena-progress {
  display: flex;
  gap: 3px;
}
.escena-progress > div {
  flex: 1;
  height: 2px;
  background: rgba(244,243,239,0.15);
  border-radius: 1px;
}
.escena-progress > div.done { background: var(--green); }

.escena-letras {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 0 4px;
}
.escena-verso .verso-label {
  font-size: 10px;
  color: rgba(120,200,220,0.7);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.escena-verso .verso-line {
  font-size: 22px;
  line-height: 1.5;
  font-weight: 500;
  color: rgba(244,243,239,0.5);
  margin-top: 4px;
}
.escena-verso .verso-line.current { color: rgba(244,243,239,1); }
.escena-verso .verso-line.next { color: rgba(244,243,239,0.4); }

.escena-controls {
  padding: 14px 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.escena-nav-btn {
  width: 48px; height: 48px;
  background: rgba(244,243,239,0.06);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.escena-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 36px; height: 36px;
  background: rgba(244,243,239,0.08);
  border: 0.5px solid var(--border-mid);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* === YouTube embed === */
.yt-embed {
  background: linear-gradient(135deg, #0a0a0a, #0a1a1f);
  border: 0.5px solid var(--cyan-border-soft);
  border-radius: var(--radius-lg);
  margin-bottom: var(--gap-blocks);
  overflow: hidden;
}
.yt-embed .yt-frame-wrap {
  position: relative;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #0a1a2e, #1f2d4e);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.yt-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}
.yt-embed .yt-info {
  padding: 10px 12px;
}
.yt-embed .yt-info .yt-info-title {
  font-size: 14px;
  font-weight: 500;
}
.yt-embed .yt-info .yt-info-meta {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* === Toggle switch === */
.switch {
  width: 36px;
  height: 20px;
  background: rgba(244,243,239,0.1);
  border-radius: var(--radius-pill);
  padding: 2px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  justify-content: flex-start;
  flex-shrink: 0;
}
.switch.on {
  background: rgba(255,79,0,0.6);
  justify-content: flex-end;
}
.switch > div {
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

/* === Loading state === */
.loader-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.loader {
  width: 24px; height: 24px;
  border: 2px solid rgba(244,243,239,0.1);
  border-top-color: var(--g2c-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Login screen === */
.login-wrap {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, var(--g2c-dark), var(--g2c-dark-2));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.login-wrap .login-star {
  margin-bottom: 24px;
}
.login-wrap h1 {
  font-size: 24px;
  font-weight: 500;
  margin-bottom: 8px;
}
.login-wrap p {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 24px;
}
.login-wrap input {
  width: 100%;
  max-width: 280px;
  background: var(--bg-card-hover);
  border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-input);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-primary);
  text-align: center;
  font-family: inherit;
  outline: none;
  margin-bottom: 12px;
}
.login-wrap input:focus { border-color: var(--g2c-primary); }

/* === Utility === */
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-14 { margin-bottom: var(--gap-blocks); }
.mt-10 { margin-top: 10px; }
.text-center { text-align: center; }
.tabular { font-variant-numeric: tabular-nums; }

/* Hide scrollbar */
::-webkit-scrollbar { width: 0; background: transparent; }

/* Safe area iOS */
@supports (padding: max(0px)) {
  body { padding-bottom: max(var(--pad-bottom-nav), env(safe-area-inset-bottom) + 90px); }
  .bottom-nav { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
}

/* ============================================================
 * v1.1 PATCHES · iOS fixes + modal G2C + SAT calendar
 * ============================================================ */

/* Anti-zoom en iOS: inputs MUST be 16px+ font-size */
input,
textarea,
select,
button {
  font-size: 16px !important;
}

/* Pero visualmente mostrar más pequeño con scale */
.field-input,
.field-select,
.field-textarea,
.conn-input {
  font-size: 16px !important;
  -webkit-text-size-adjust: 100%;
  -webkit-appearance: none;
  appearance: none;
}

/* Status bar oscura como overlay (refuerzo visual) */
html, body {
  background-color: #0F1419 !important;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* Anti-pull-to-refresh y anti-bounce */
body {
  overscroll-behavior-y: contain;
  touch-action: pan-x pan-y;
}

/* Focus visual sin zoom · solo borde naranja */
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(255,79,0,0.4) !important;
  box-shadow: 0 0 0 2px rgba(255,79,0,0.08);
}

/* Modal G2C branded · usado por pendientes, attachments, fiscal */
.g2c-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8,13,26,0.85);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.g2c-modal-backdrop.active {
  display: flex;
  animation: backdropFade 0.2s ease-out;
}
@keyframes backdropFade { from { opacity: 0; } to { opacity: 1; } }

.g2c-modal {
  background: linear-gradient(180deg, var(--g2c-dark-2), var(--g2c-dark));
  border: 0.5px solid var(--border-mid);
  border-radius: 18px 18px 0 0;
  padding: 16px 18px 28px;
  width: 100%;
  max-width: 420px;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  animation: modalSlideUp 0.25s ease-out;
}
@keyframes modalSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.g2c-modal-handle {
  width: 36px; height: 4px;
  background: rgba(244,243,239,0.25);
  border-radius: 2px;
  margin: 0 auto 14px;
}

.g2c-modal-eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
}
.g2c-modal-eyebrow .dot {
  width: 5px; height: 5px;
  background: var(--g2c-primary);
  border-radius: 50%;
}
.g2c-modal-eyebrow .label {
  font-size: 9px;
  color: rgba(255,150,80,0.85);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
}

.g2c-modal-title {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}

.g2c-quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
}

.g2c-quick-btn {
  background: rgba(244,243,239,0.04);
  border: 0.5px solid var(--border-mid);
  border-radius: 9px;
  padding: 10px 11px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.g2c-quick-btn:active {
  transform: scale(0.97);
  background: rgba(255,79,0,0.08);
  border-color: rgba(255,79,0,0.3);
}
.g2c-quick-btn.active {
  background: rgba(255,79,0,0.12);
  border-color: rgba(255,79,0,0.4);
}
.g2c-quick-btn .qb-label {
  font-size: 9px;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.g2c-quick-btn .qb-value {
  font-size: 12px;
  font-weight: 500;
  margin-top: 3px;
}

.g2c-modal-actions {
  display: flex;
  gap: 7px;
  margin-top: 14px;
}
.g2c-modal-actions .btn {
  flex: 1;
  padding: 12px;
  font-size: 13px;
}

/* SAT calendar item */
.sat-event {
  background: rgba(244,243,239,0.025);
  border: 0.5px solid var(--border-soft);
  border-radius: 10px;
  padding: 11px 13px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 11px;
}
.sat-event.alert {
  background: rgba(255,79,0,0.05);
  border-color: rgba(255,79,0,0.25);
}
.sat-event.upcoming {
  background: rgba(244,213,128,0.04);
  border-color: rgba(244,213,128,0.22);
}
.sat-event-date {
  width: 38px;
  text-align: center;
  flex-shrink: 0;
}
.sat-event-day {
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
}
.sat-event-month {
  font-size: 9px;
  color: var(--text-tertiary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 2px;
}
.sat-event-info { flex: 1; min-width: 0; }
.sat-event-title { font-size: 11px; font-weight: 500; }
.sat-event-sub { font-size: 9px; color: var(--text-tertiary); margin-top: 2px; }
.sat-event-pill {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  flex-shrink: 0;
}
