/* ============================================================================
 * SUPRA · Sistema Bienestar Social · global.css v3.1
 * VANGUARD 2026 — Oro #D4AF37 + Ámbar #FF8C42 + Deep Blue #060912
 * Mobile-first · Optimizado para móvil · Sin descuadres
 * ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Sora:wght@500;600;700;800;900&family=JetBrains+Mono:wght@500;600;700&family=Playfair+Display:wght@600;700;800&display=swap');

/* =====================================================================
   VARIABLES
   ===================================================================== */
:root {
  /* Paleta */
  --gold:        #D4AF37;
  --gold-soft:   #E8C766;
  --gold-deep:   #B8941F;
  --amber:       #FF8C42;
  --amber-soft:  #FFA869;

  /* Fondos */
  --bg-1:        #060912;
  --bg-2:        #0d1426;
  --bg-3:        #14203b;
  --bg-card:     rgba(255, 255, 255, 0.04);
  --bg-elev:     rgba(255, 255, 255, 0.07);

  /* Tinta */
  --ink:         #F5F1E8;
  --ink-soft:    rgba(245, 241, 232, 0.80);
  --ink-mute:    rgba(245, 241, 232, 0.58);
  --ink-dim:     rgba(245, 241, 232, 0.35);

  /* Bordes */
  --line:        rgba(212, 175, 55, 0.20);
  --line-strong: rgba(212, 175, 55, 0.38);
  --line-soft:   rgba(255, 255, 255, 0.09);

  /* Estados */
  --success:     #22c55e;
  --success-bg:  rgba(34, 197, 94, 0.13);
  --warn:        #f59e0b;
  --warn-bg:     rgba(245, 158, 11, 0.13);
  --danger:      #ef4444;
  --danger-bg:   rgba(239, 68, 68, 0.13);
  --info:        #3b82f6;
  --info-bg:     rgba(59, 130, 246, 0.13);

  /* Gradientes */
  --grad-gold:   linear-gradient(135deg, #D4AF37 0%, #E8C766 50%, #FF8C42 100%);
  --grad-amber:  linear-gradient(135deg, #FF8C42 0%, #FFA869 100%);
  --grad-dark:   linear-gradient(135deg, #14203b 0%, #060912 100%);
  --grad-card:   linear-gradient(135deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.02) 100%);
  --grad-hero:   linear-gradient(135deg, #14203b 0%, #1a2548 50%, #0d1426 100%);

  /* Tipografía clamp() */
  --fs-display: clamp(2rem, 7vw, 4rem);
  --fs-h1:      clamp(1.65rem, 5.5vw, 2.8rem);
  --fs-h2:      clamp(1.35rem, 4.5vw, 2rem);
  --fs-h3:      clamp(1.15rem, 3.6vw, 1.5rem);
  --fs-h4:      clamp(1rem, 2.9vw, 1.2rem);
  --fs-lead:    clamp(0.98rem, 2.7vw, 1.15rem);
  --fs-body:    clamp(0.95rem, 2.4vw, 1.02rem);
  --fs-small:   clamp(0.82rem, 2vw, 0.9rem);
  --fs-mini:    clamp(0.7rem, 1.7vw, 0.78rem);

  /* Radios */
  --r-xs: 8px;
  --r-sm: 12px;
  --r:    16px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-full: 9999px;

  /* Sombras */
  --sh-sm:   0 4px 12px -2px rgba(0, 0, 0, 0.4);
  --sh:      0 12px 28px -8px rgba(0, 0, 0, 0.5);
  --sh-lg:   0 24px 48px -14px rgba(0, 0, 0, 0.65);
  --sh-gold: 0 12px 32px -10px rgba(212, 175, 55, 0.45);
  --sh-amber:0 12px 32px -10px rgba(255, 140, 66, 0.45);

  /* Transiciones */
  --t-fast: 0.18s cubic-bezier(.4,0,.2,1);
  --t:      0.28s cubic-bezier(.4,0,.2,1);
  --t-slow: 0.5s cubic-bezier(.4,0,.2,1);

  /* Espaciado de página — mobile-first compacto */
  --pad-x: clamp(0.85rem, 4vw, 1.5rem);
  --pad-y: clamp(1rem, 3vw, 1.5rem);
}

/* Tema claro */
[data-theme="light"] {
  --bg-1: #faf6ed;
  --bg-2: #ffffff;
  --bg-3: #f5ecd4;
  --bg-card: rgba(13, 20, 38, 0.04);
  --bg-elev: rgba(13, 20, 38, 0.06);
  --ink: #0d1426;
  --ink-soft: rgba(13, 20, 38, 0.78);
  --ink-mute: rgba(13, 20, 38, 0.58);
  --ink-dim: rgba(13, 20, 38, 0.32);
  --line: rgba(184, 148, 31, 0.28);
  --line-strong: rgba(184, 148, 31, 0.5);
  --line-soft: rgba(0, 0, 0, 0.1);
  --grad-card: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(255,255,255,0.6));
  --grad-hero: linear-gradient(135deg, #ffffff 0%, #faf6ed 50%, #f5ecd4 100%);
}

[data-font="modern"]  { --font-display: 'Sora'; --font-body: 'Inter'; }
[data-font="elegant"] { --font-display: 'Playfair Display'; --font-body: 'Inter'; }
[data-font="techno"]  { --font-display: 'JetBrains Mono'; --font-body: 'JetBrains Mono'; }

/* =====================================================================
   RESET + BASE
   ===================================================================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
@media (min-width: 768px)  { html { font-size: 16.5px; } }
@media (min-width: 1200px) { html { font-size: 17px;   } }

body {
  font-family: var(--font-body, 'Inter'), -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg-1);
  background-image:
    radial-gradient(ellipse at top, var(--bg-3) 0%, transparent 70%),
    radial-gradient(ellipse 80% 60% at 70% 100%, rgba(212,175,55,0.06), transparent 60%),
    radial-gradient(ellipse 60% 50% at 30% 0%,  rgba(255,140,66,0.04), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Espacio para nav inferior móvil */
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
@media (min-width: 920px) {
  body { padding-bottom: 0; }
}

img, svg { display: block; max-width: 100%; height: auto; }
button, input, select, textarea {
  font-family: inherit;
  color: inherit;
  font-size: inherit;
}
button { cursor: pointer; border: 0; background: transparent; }
a { color: inherit; text-decoration: none; }

/* iOS: input zoom prevention */
input, select, textarea { font-size: max(16px, 1rem); }

/* =====================================================================
   TIPOGRAFÍA
   ===================================================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display, 'Sora'), 'Inter', sans-serif;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--ink);
  word-wrap: break-word;
  overflow-wrap: break-word;
}
h1 { font-size: var(--fs-h1); font-weight: 800; }
h2 { font-size: var(--fs-h2); font-weight: 700; }
h3 { font-size: var(--fs-h3); font-weight: 700; }
h4 { font-size: var(--fs-h4); font-weight: 600; }

.text-display { font-family: var(--font-display, 'Sora'); font-size: var(--fs-display); font-weight: 900; line-height: 1.05; letter-spacing: -0.04em; }
.text-lead    { font-size: var(--fs-lead); color: var(--ink-soft); line-height: 1.5; }
.text-small   { font-size: var(--fs-small); color: var(--ink-mute); }
.text-mini    { font-size: var(--fs-mini); color: var(--ink-mute); }
.text-mono    { font-family: 'JetBrains Mono', monospace; }
.text-gold    { color: var(--gold); }
.text-amber   { color: var(--amber); }
.text-muted   { color: var(--ink-mute); }
.text-center  { text-align: center; }

.text-gradient {
  background: var(--grad-gold);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-mini);
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  padding: 0.4em 0.95em;
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.section-underline {
  height: 3px;
  width: 56px;
  background: linear-gradient(90deg, var(--gold), transparent);
  border-radius: var(--r-full);
  margin: 0.85rem 0 1.5rem;
}

/* =====================================================================
   LAYOUT
   ===================================================================== */
.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 var(--pad-x);
}

.page {
  min-height: 100vh;
}

.stack    { display: flex; flex-direction: column; gap: 0.85rem; }
.stack-lg { display: flex; flex-direction: column; gap: 1.5rem; }
.stack-xl { display: flex; flex-direction: column; gap: 2rem; }
.row      { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0.85rem; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 0.85rem; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 0.85rem; }
@media (min-width: 540px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 768px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* =====================================================================
   HEADER
   ===================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(6, 9, 18, 0.88);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
[data-theme="light"] .app-header {
  background: rgba(255, 250, 240, 0.92);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  min-height: 60px;
  padding: 0.55rem var(--pad-x);
  max-width: 1240px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  flex-shrink: 1;
}

.brand-logo {
  width: 38px; height: 38px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--grad-gold);
  color: var(--bg-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Sora', sans-serif;
  font-weight: 900;
  font-size: 1.1rem;
  box-shadow: 0 6px 16px -4px rgba(212, 175, 55, 0.5);
}

.brand-text { min-width: 0; line-height: 1.1; }
.brand-text strong {
  font-family: 'Sora', sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
  white-space: nowrap;
  display: block;
}
.brand-text small {
  font-size: 0.65rem;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.header-nav { display: none; gap: 0.25rem; align-items: center; }
@media (min-width: 920px) { .header-nav { display: flex; } }

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--r-full);
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all var(--t-fast);
  border: 1px solid transparent;
  white-space: nowrap;
}
.nav-link:hover {
  color: var(--gold);
  background: rgba(212, 175, 55, 0.08);
}
.nav-link.active {
  color: var(--gold);
  background: rgba(212, 175, 55, 0.12);
  border-color: var(--line);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.icon-btn {
  width: 38px; height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(212, 175, 55, 0.08);
  color: var(--gold);
  font-size: 0.95rem;
  transition: all var(--t-fast);
}
.icon-btn:hover {
  background: rgba(212, 175, 55, 0.2);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem 0.3rem 0.3rem;
  border-radius: var(--r-full);
  background: rgba(212, 175, 55, 0.06);
  border: 1px solid var(--line);
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--grad-gold);
  color: var(--bg-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.78rem;
  overflow: hidden;
  flex-shrink: 0;
}
.user-info { line-height: 1.1; display: none; }
@media (min-width: 920px) { .user-info { display: block; } }
.user-info strong { display: block; font-size: 0.8rem; color: var(--ink); font-weight: 700; }
.user-info small  { font-size: 0.66rem; color: var(--ink-mute); }

.desktop-only { display: none !important; }
.mobile-only  { display: inline-flex !important; }
@media (min-width: 920px) {
  .desktop-only { display: inline-flex !important; }
  .mobile-only  { display: none !important; }
}

/* =====================================================================
   MOBILE BOTTOM NAV
   ===================================================================== */
.mobile-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: flex;
  justify-content: space-around;
  padding: 0.4rem 0.3rem calc(0.4rem + env(safe-area-inset-bottom));
  background: rgba(6, 9, 18, 0.95);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-top: 1px solid var(--line);
}
@media (min-width: 920px) { .mobile-nav { display: none !important; } }

[data-theme="light"] .mobile-nav {
  background: rgba(255, 250, 240, 0.95);
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 3px;
  color: var(--ink-mute);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--r-sm);
  transition: color var(--t-fast);
  min-width: 0;
}
.mobile-nav-item .mobile-nav-icon { font-size: 1.2rem; line-height: 1; }
.mobile-nav-item .mobile-nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.mobile-nav-item.active { color: var(--gold); }

/* =====================================================================
   BUTTONS
   ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: 'Sora', 'Inter', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  padding: 0.85rem 1.3rem;
  min-height: 52px;
  border-radius: var(--r);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--t);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.btn-sm   { min-height: 40px; padding: 0.45rem 1rem; font-size: 0.85rem; border-radius: var(--r-sm); }
.btn-xs   { min-height: 32px; padding: 0.3rem 0.75rem; font-size: 0.78rem; border-radius: var(--r-sm); gap: 0.3rem; }
.btn-lg   { min-height: 60px; padding: 1rem 1.8rem; font-size: 1.02rem; border-radius: var(--r-lg); }
.btn-xl   { min-height: 68px; padding: 1.2rem 2rem; font-size: 1.1rem; border-radius: var(--r-lg); }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--grad-gold);
  color: var(--bg-1);
  box-shadow: 0 10px 24px -8px rgba(212, 175, 55, 0.55);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -10px rgba(212, 175, 55, 0.7); }
.btn-primary:active { transform: translateY(0); }

.btn-dark {
  background: var(--grad-dark);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: var(--sh-sm);
}
.btn-dark:hover { transform: translateY(-2px); border-color: var(--line-strong); }

.btn-outline {
  background: transparent;
  color: var(--gold);
  border-color: var(--line-strong);
}
.btn-outline:hover {
  background: rgba(212, 175, 55, 0.08);
  border-color: var(--gold);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-soft);
  border: 1px solid var(--line-soft);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--ink);
}

.btn-amber {
  background: var(--grad-amber);
  color: var(--bg-1);
  box-shadow: 0 10px 24px -8px rgba(255, 140, 66, 0.55);
}
.btn-amber:hover { transform: translateY(-2px); }

.btn-success { background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; }
.btn-danger  { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* =====================================================================
   CARDS
   ===================================================================== */
.card {
  background: var(--grad-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: clamp(1rem, 3.5vw, 1.6rem);
  transition: all var(--t);
}
.card:hover { border-color: var(--line); }

.card-flat {
  background: transparent;
  border: 0;
  padding: 0;
}

.card-elev {
  background: var(--bg-elev);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: clamp(1rem, 3.5vw, 1.6rem);
  box-shadow: var(--sh);
}

.card-gold {
  background: linear-gradient(135deg, rgba(212,175,55,0.08), rgba(255,140,66,0.04));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(1rem, 3.5vw, 1.6rem);
}

/* =====================================================================
   FORM INPUTS
   ===================================================================== */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-family: 'Sora', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.005em;
}
.field-label .req { color: var(--amber); font-weight: 800; }
.field-label .ocr-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--gold);
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid var(--line);
  padding: 2px 7px;
  border-radius: var(--r-full);
  letter-spacing: 0.1em;
  margin-left: auto;
}
.field-hint { font-size: 0.78rem; color: var(--ink-mute); margin-top: -2px; line-height: 1.4; }

.input,
.textarea,
.select {
  width: 100%;
  min-height: 56px;
  padding: 0.9rem 1.1rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid var(--line-soft);
  border-radius: var(--r);
  transition: all var(--t-fast);
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}
[data-theme="light"] .input,
[data-theme="light"] .textarea,
[data-theme="light"] .select {
  background: rgba(255, 255, 255, 0.6);
}

.input::placeholder, .textarea::placeholder { color: var(--ink-dim); font-weight: 400; }

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
}

.input.autofilled {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.5);
  animation: glow-success 0.7s ease;
}
@keyframes glow-success {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  100% { box-shadow: 0 0 0 12px rgba(34, 197, 94, 0); }
}

.textarea { min-height: 110px; resize: vertical; padding-top: 0.8rem; }

.select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3e%3cpath fill='none' stroke='%23D4AF37' stroke-width='2' d='M1 1l5 5 5-5'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 11px;
  padding-right: 2.5rem;
}

/* Micrófono mini integrado */
.input-mic-wrap {
  position: relative;
  display: block;
}
.input-mic-wrap .input { padding-right: 52px; }

.mic-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid var(--line);
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
  z-index: 2;
}
.mic-btn:hover { background: rgba(212, 175, 55, 0.25); }
.mic-btn svg { width: 16px; height: 16px; }
.mic-btn.recording {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  animation: mic-pulse 1.3s infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.6); }
  50%      { box-shadow: 0 0 0 9px rgba(239,68,68,0); }
}

.mic-listening-overlay {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--danger);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--r-full);
  font-weight: 700;
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 9999;
  box-shadow: 0 14px 28px -8px rgba(239,68,68,0.5);
  max-width: calc(100% - 32px);
  font-size: 0.88rem;
}

/* Field row */
.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
@media (min-width: 540px) {
  .field-row-2 { grid-template-columns: 1fr 1fr; }
  .field-row-3 { grid-template-columns: 2fr 1fr 1fr; }
}

/* Switch */
.switch-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}
.switch-track {
  width: 48px;
  height: 28px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--r-full);
  position: relative;
  transition: all var(--t-fast);
  flex-shrink: 0;
}
.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  transition: all var(--t-fast);
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.switch-toggle.active .switch-track { background: var(--grad-gold); }
.switch-toggle.active .switch-track::after { left: 23px; }

/* =====================================================================
   BIG CHOICE / SECTIONS
   ===================================================================== */
.big-choice-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 1.25rem 0;
}
@media (min-width: 720px) { .big-choice-grid { grid-template-columns: 1fr 1fr; } }

/* Page hero */
.pg-hero {
  padding: clamp(1.2rem, 4vw, 2rem) 0 clamp(0.85rem, 2.5vw, 1.2rem);
  position: relative;
}
.pg-hero .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--ink-mute);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  transition: color var(--t-fast);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.05em;
}
.pg-hero .back-link:hover { color: var(--gold); }

.pg-hero h1 {
  font-size: var(--fs-h1);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 0.35rem;
}
.pg-hero p {
  color: var(--ink-soft);
  font-size: var(--fs-lead);
  max-width: 65ch;
}

/* =====================================================================
   STATUS / OCR
   ===================================================================== */
.status-box {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.1rem;
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin: 0.85rem 0;
}
.status-box .spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(212, 175, 55, 0.25);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.status-box strong { font-size: 0.92rem; color: var(--ink); display: block; }
.status-box small { font-size: 0.76rem; color: var(--ink-mute); }

.status-success { background: var(--success-bg); border-color: rgba(34,197,94,0.3); }

/* Pill chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-soft);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-soft);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.chip-gold { background: rgba(212, 175, 55, 0.12); border-color: var(--line); color: var(--gold); }
.chip-amber { background: rgba(255, 140, 66, 0.12); border-color: rgba(255,140,66,0.3); color: var(--amber); }
.chip-success { background: var(--success-bg); border-color: rgba(34,197,94,0.3); color: var(--success); }
.chip-warn { background: var(--warn-bg); border-color: rgba(245,158,11,0.3); color: var(--warn); }
.chip-danger { background: var(--danger-bg); border-color: rgba(239,68,68,0.3); color: var(--danger); }

/* =====================================================================
   FULLSCREEN VIEWS
   ===================================================================== */
.fullscreen-view {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg-1);
  background-image:
    radial-gradient(ellipse at top, var(--bg-3) 0%, transparent 70%);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  animation: slide-up 0.3s cubic-bezier(.4,0,.2,1);
}
@keyframes slide-up {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.fullscreen-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.75rem var(--pad-x);
  background: rgba(6, 9, 18, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
}
.fullscreen-header h2 {
  font-family: 'Sora', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  flex: 1;
  text-align: center;
  margin: 0;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fullscreen-close {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-soft);
  color: var(--ink);
  font-size: 1.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
  flex-shrink: 0;
}
.fullscreen-close:hover { background: rgba(239, 68, 68, 0.15); border-color: var(--danger); color: var(--danger); }

.fullscreen-body {
  flex: 1;
  padding: 1.2rem var(--pad-x) 130px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.fullscreen-actions {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 0.55rem;
  padding: 0.7rem var(--pad-x) calc(0.7rem + env(safe-area-inset-bottom));
  background: rgba(6, 9, 18, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
  z-index: 60;
}
.fullscreen-actions .btn { flex: 1; min-width: 0; }

/* =====================================================================
   UTILITIES
   ===================================================================== */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.flex-1 { flex: 1; }
.full-w { width: 100%; }
.w-auto { width: auto; }

/* Toast */
#toast-container {
  position: fixed;
  top: 76px;
  right: 12px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: calc(100% - 24px);
  pointer-events: none;
}
#toast-container > * { pointer-events: auto; }
.supra-toast {
  padding: 12px 18px;
  background: var(--bg-3);
  color: var(--ink);
  border-radius: var(--r);
  border: 1px solid var(--line);
  box-shadow: var(--sh);
  font-size: 0.9rem;
  font-weight: 600;
  animation: slideInRight 0.3s ease;
  max-width: 360px;
  backdrop-filter: blur(20px);
}
.supra-toast.success { background: var(--success-bg); border-color: var(--success); color: #6ee7a8; }
.supra-toast.error { background: var(--danger-bg); border-color: var(--danger); color: #fca5a5; }
.supra-toast.warn { background: var(--warn-bg); border-color: var(--warn); color: #fcd34d; }
.supra-toast.info { background: var(--info-bg); border-color: var(--info); color: #93c5fd; }

@keyframes slideInRight {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fade-in 0.3s cubic-bezier(.4,0,.2,1); }

/* =====================================================================
   TABLES (responsive)
   ===================================================================== */
.tbl-wrap {
  overflow-x: auto;
  margin: 0 calc(-1 * var(--pad-x));
  padding: 0 var(--pad-x);
  -webkit-overflow-scrolling: touch;
}
.tbl-wrap::-webkit-scrollbar { height: 6px; }
.tbl-wrap::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

/* =====================================================================
   MOBILE EXTREME FIXES (≤ 400px)
   ===================================================================== */
@media (max-width: 400px) {
  :root {
    --pad-x: 0.7rem;
  }
  .header-inner { gap: 0.4rem; }
  .brand-text small { display: none; }
  .btn { font-size: 0.88rem; padding: 0.75rem 1rem; min-height: 48px; }
  .btn-sm { min-height: 38px; }
  .mobile-nav-item .mobile-nav-label { font-size: 0.58rem; }
}

/* =====================================================================
   PRINT
   ===================================================================== */
@media print {
  body { background: #fff; color: #000; padding-bottom: 0; }
  .app-header, .mobile-nav, .fullscreen-actions { display: none !important; }
}
