@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,400;1,9..144,500&family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================================
   MaternIA · SISTEMA DE DISEÑO
   Calidez humana (Fraunces) × precisión clínica (Manrope).
   Petróleo · coral · crema. Motivo: la línea de latido.
   ============================================================ */

/* ---------- TOKENS ---------- */
:root {
  /* Marca MaternIA (funnel + login) */
  --m-teal:        #0E6E6E;
  --m-teal-deep:   #0A5252;
  --m-teal-ink:    #0C3B3B;
  --m-coral:       #FF7A6B;
  --m-coral-deep:  #E85D4D;
  --m-blush:       #FBEDE9;

  /* Neutros tintados hacia el teal (nunca negro/blanco puro) */
  --m-ink:         #14232B;
  --m-ink-soft:    #3C4E57;
  --m-ink-mute:    #6E8189;
  --m-bg:          #F3F7F6;
  --m-surface:     #FFFFFF;
  --m-surface-2:   #FAFCFB;
  --m-line:        #E1EAE8;
  --m-line-soft:   #EDF3F1;

  /* Tokens white-label (config-loader los sobreescribe) */
  --brand-primary:      var(--m-teal);
  --brand-primary-deep: var(--m-teal-deep);
  --brand-accent:       var(--m-coral);
  --brand-tint:         color-mix(in oklab, var(--brand-primary) 8%, var(--m-surface));
  --brand-tint-2:       color-mix(in oklab, var(--brand-primary) 14%, var(--m-surface));

  /* Tipografía */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-ui:      'Manrope', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;

  /* Escala fluida */
  --step--2: clamp(0.69rem, 0.66rem + 0.14vw, 0.76rem);
  --step--1: clamp(0.80rem, 0.76rem + 0.18vw, 0.88rem);
  --step-0:  clamp(0.94rem, 0.90rem + 0.22vw, 1.05rem);
  --step-1:  clamp(1.13rem, 1.05rem + 0.40vw, 1.35rem);
  --step-2:  clamp(1.42rem, 1.28rem + 0.70vw, 1.90rem);
  --step-3:  clamp(1.80rem, 1.55rem + 1.20vw, 2.70rem);
  --step-4:  clamp(2.25rem, 1.85rem + 2.00vw, 3.80rem);
  --step-5:  clamp(2.90rem, 2.20rem + 3.30vw, 5.40rem);

  /* Espaciado */
  --sp-1: 0.4rem;  --sp-2: 0.7rem;  --sp-3: 1.05rem; --sp-4: 1.5rem;
  --sp-5: 2.1rem;  --sp-6: 3rem;    --sp-7: 4.2rem;  --sp-8: 6rem;

  /* Radios y sombras (tintadas hacia el ink teal) */
  --r-xs: 7px; --r-sm: 10px; --r: 14px; --r-lg: 20px; --r-xl: 28px;
  --shadow-sm: 0 1px 2px rgba(12,59,59,0.05), 0 2px 6px rgba(12,59,59,0.04);
  --shadow:    0 4px 12px rgba(12,59,59,0.07), 0 12px 30px rgba(12,59,59,0.06);
  --shadow-lg: 0 10px 30px rgba(12,59,59,0.10), 0 30px 60px rgba(12,59,59,0.10);

  --ease: cubic-bezier(0.22, 1, 0.36, 1); /* out-quint */
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-ui);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--m-ink);
  background: var(--m-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font: inherit; color: inherit; }
ul { list-style: none; padding: 0; }

/* ---------- TIPOGRAFÍA ---------- */
.display {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.015em;
  font-optical-sizing: auto;
}
.display em, .italic { font-style: italic; font-weight: 400; }
h1, h2, h3, h4 { font-family: var(--font-ui); font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }
.eyebrow {
  font-family: var(--font-ui);
  font-size: var(--step--2);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-primary);
}
.lede { font-size: var(--step-1); color: var(--m-ink-soft); line-height: 1.55; }
.muted { color: var(--m-ink-mute); }
.mono {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  letter-spacing: 0.02em;
  color: var(--m-ink-mute);
}
.accent { color: var(--brand-accent); }
.tprimary { color: var(--brand-primary); }

/* ---------- MOTIVO: LÍNEA DE LATIDO ---------- */
.pulse-line { display: block; width: 100%; height: 22px; color: var(--brand-accent); }
.pulse-line path {
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.pulse-line--draw path {
  stroke-dasharray: 340; stroke-dashoffset: 340;
  animation: pulseDraw 2.2s var(--ease) forwards;
}
@keyframes pulseDraw { to { stroke-dashoffset: 0; } }
@keyframes beat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.18); }
  28% { transform: scale(1); }
  42% { transform: scale(1.10); }
}

/* ---------- BOTONES ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.55em;
  font-weight: 600; font-size: var(--step-0);
  padding: 0.72em 1.35em; border-radius: var(--r-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--brand-primary); color: #fff;
  box-shadow: 0 6px 18px color-mix(in oklab, var(--brand-primary) 32%, transparent);
}
.btn--primary:hover { background: var(--brand-primary-deep); transform: translateY(-2px); }
.btn--accent {
  background: var(--brand-accent); color: #fff;
  box-shadow: 0 6px 18px color-mix(in oklab, var(--brand-accent) 34%, transparent);
}
.btn--accent:hover { background: var(--m-coral-deep); transform: translateY(-2px); }
.btn--ghost {
  background: transparent; color: var(--m-ink);
  box-shadow: inset 0 0 0 1.5px var(--m-line);
}
.btn--ghost:hover { box-shadow: inset 0 0 0 1.5px var(--brand-primary); color: var(--brand-primary); }
.btn--on-dark { background: rgba(255,255,255,0.14); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25); }
.btn--on-dark:hover { background: rgba(255,255,255,0.24); }
.btn--sm { padding: 0.5em 0.95em; font-size: var(--step--1); }
.btn--lg { padding: 0.9em 1.8em; font-size: var(--step-1); }
.link-arrow { color: var(--brand-primary); font-weight: 600; display: inline-flex; gap: 0.4em; }
.link-arrow:hover { gap: 0.7em; transition: gap 0.25s var(--ease); }

/* ---------- PILLS / TAGS ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 0.4em;
  font-size: var(--step--2); font-weight: 700; letter-spacing: 0.02em;
  padding: 0.3em 0.7em; border-radius: 999px;
  background: var(--brand-tint); color: var(--brand-primary-deep);
}
.tag--accent { background: var(--m-blush); color: var(--m-coral-deep); }
.tag--dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- CONTENEDORES / CARDS ---------- */
.container { width: min(1180px, 92vw); margin-inline: auto; }
.card {
  background: var(--m-surface); border-radius: var(--r);
  box-shadow: var(--shadow-sm); padding: var(--sp-4);
  border: 1px solid var(--m-line-soft);
}
.card--pad-lg { padding: var(--sp-5); }
.panel {
  background: var(--m-surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow); border: 1px solid var(--m-line-soft);
}
.hairline { height: 1px; background: var(--m-line); border: 0; }

/* ---------- AVATARES / BADGES ---------- */
.avatar {
  display: grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--brand-tint-2); color: var(--brand-primary-deep);
  font-weight: 800; font-size: var(--step-0);
}
.avatar--coral { background: var(--m-blush); color: var(--m-coral-deep); }
.badge-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--brand-accent); color: #fff;
  font-size: 0.65rem; font-weight: 800; display: inline-grid; place-items: center;
}

/* ============================================================
   APP SHELL (suite admin + paciente)
   ============================================================ */
.app-shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }

/* --- Sidebar (white-label) --- */
.sidebar {
  background: linear-gradient(168deg, var(--brand-primary), var(--brand-primary-deep));
  color: #fff; padding: var(--sp-4) var(--sp-3);
  display: flex; flex-direction: column; gap: var(--sp-4);
  position: sticky; top: 0; height: 100vh;
}
.sidebar--admin { --brand-primary: var(--m-teal-ink); } /* admin más oscuro para diferenciar */
.sidebar-brand { display: flex; align-items: center; gap: 0.7rem; padding-bottom: var(--sp-3); border-bottom: 1px solid rgba(255,255,255,0.16); }
.sidebar-brand .mark {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: grid; place-items: center; background: rgba(255,255,255,0.16);
  font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; color: #fff;
}
.sidebar-brand img.mark-logo { width: 42px; height: 42px; border-radius: 12px; object-fit: cover; background:#fff; }
.brand-logo-missing .mark-logo { display: none; }
.sidebar-brand .txt strong { display: block; font-size: var(--step-0); font-weight: 700; line-height: 1.2; }
.sidebar-brand .txt span { font-size: var(--step--2); color: rgba(255,255,255,0.7); }
.nav-list { display: flex; flex-direction: column; gap: 3px; }
.nav-list a {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.68em 0.8em; border-radius: var(--r-sm);
  color: rgba(255,255,255,0.78); font-weight: 600; font-size: var(--step--1);
  transition: background 0.18s, color 0.18s;
}
.nav-list a .ic { width: 18px; height: 18px; opacity: 0.9; }
.nav-list a:hover { background: rgba(255,255,255,0.10); color: #fff; }
.nav-list li.active a { background: rgba(255,255,255,0.16); color: #fff; box-shadow: inset 3px 0 0 var(--brand-accent); }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 0.7rem; padding-top: var(--sp-3); border-top: 1px solid rgba(255,255,255,0.16); }
.sidebar-foot .avatar { background: rgba(255,255,255,0.2); color: #fff; }
.sidebar-foot .txt strong { display: block; font-size: var(--step--1); font-weight: 700; }
.sidebar-foot .txt span { font-size: var(--step--2); color: rgba(255,255,255,0.65); }

/* --- Main --- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5); background: var(--m-surface);
  border-bottom: 1px solid var(--m-line-soft); position: sticky; top: 0; z-index: 20;
}
.topbar-greeting { font-size: var(--step-0); color: var(--m-ink-soft); }
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }
.icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--m-ink-soft);
  transition: background 0.18s, color 0.18s;
}
.icon-btn:hover { background: var(--brand-tint); color: var(--brand-primary); }
.icon-btn .badge-count { position: absolute; top: 5px; right: 5px; }
.view { padding: var(--sp-5); max-width: 1220px; width: 100%; }

/* --- Encabezado de vista --- */
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-5); }
.view-head h1, .view-head .display { font-size: var(--step-3); }

/* ============================================================
   BANNER DE TRIAL
   ============================================================ */
.trial-banner {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  padding: 0.6em var(--sp-5); font-size: var(--step--1); font-weight: 600;
  background: var(--m-teal-ink); color: rgba(255,255,255,0.92);
}
.trial-banner .dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--m-coral); box-shadow: 0 0 0 0 var(--m-coral); animation: live 1.8s infinite; }
@keyframes live { 0%{ box-shadow: 0 0 0 0 rgba(255,122,107,0.6);} 70%{ box-shadow: 0 0 0 7px rgba(255,122,107,0);} 100%{ box-shadow: 0 0 0 0 rgba(255,122,107,0);} }
.trial-banner .track { flex: 1; min-width: 90px; max-width: 220px; height: 5px; border-radius: 999px; background: rgba(255,255,255,0.18); overflow: hidden; }
.trial-banner .track > span { display: block; height: 100%; background: var(--m-coral); border-radius: 999px; transition: width 0.6s var(--ease); }
.trial-banner a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.trial-banner.trial-urgente { background: var(--m-coral-deep); }

/* ============================================================
   STATS (fila con hairlines — no cards idénticas)
   ============================================================ */
.stat-row { display: flex; flex-wrap: wrap; gap: 0; background: var(--m-surface); border-radius: var(--r); box-shadow: var(--shadow-sm); border: 1px solid var(--m-line-soft); overflow: hidden; }
.stat { flex: 1 1 160px; padding: var(--sp-4) var(--sp-4); border-left: 1px solid var(--m-line-soft); }
.stat:first-child { border-left: 0; }
.stat .k { font-size: var(--step--2); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--m-ink-mute); display: flex; align-items: center; gap: 0.4em; }
.stat .k::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--brand-accent); }
.stat .v { font-family: var(--font-ui); font-weight: 800; font-size: var(--step-3); line-height: 1; margin-top: 0.35rem; letter-spacing: -0.02em; }
.stat .v small { font-size: var(--step-0); font-weight: 700; color: var(--m-ink-mute); }
.stat .s { font-size: var(--step--1); color: var(--m-ink-soft); margin-top: 0.25rem; }

/* ============================================================
   PANEL DE ANÁLISIS IA
   ============================================================ */
.ai-panel { position: relative; overflow: hidden; }
.ai-panel .ai-head { display: flex; align-items: center; gap: 0.8rem; padding: var(--sp-4); border-bottom: 1px solid var(--m-line-soft); }
.ai-orb {
  width: 44px; height: 44px; border-radius: 13px; flex: none; display: grid; place-items: center; color: #fff;
  background: linear-gradient(140deg, var(--brand-primary), var(--brand-accent));
}
.ai-orb svg { animation: beat 2.4s var(--ease) infinite; }
.ai-head .txt strong { display: block; font-weight: 700; }
.ai-head .txt span { font-size: var(--step--2); color: var(--m-ink-mute); }
.ai-head .status { margin-left: auto; display: inline-flex; align-items: center; gap: 0.4em; font-size: var(--step--2); font-weight: 700; color: var(--brand-primary); }
.ai-head .status .dot-live { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-primary); }

.ai-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--m-line-soft); }
.ai-metric { background: var(--m-surface); padding: var(--sp-3) var(--sp-4); }
.ai-metric .l { font-size: var(--step--2); color: var(--m-ink-mute); font-weight: 600; }
.ai-metric .n { font-family: var(--font-display); font-weight: 600; font-size: var(--step-2); line-height: 1.1; margin-top: 0.15rem; }
.ai-metric .n em { font-style: normal; font-size: var(--step-0); color: var(--m-ink-mute); }
.ai-metric .x { font-size: var(--step--2); color: var(--brand-primary); font-weight: 600; }

.ai-narrative {
  margin: var(--sp-4); padding: var(--sp-4) var(--sp-4) var(--sp-4) var(--sp-5);
  font-family: var(--font-display); font-style: italic; font-size: var(--step-1);
  line-height: 1.5; color: var(--m-ink); background: var(--brand-tint); border-radius: var(--r-sm);
  position: relative;
}
.ai-narrative::before { content: ""; position: absolute; left: var(--sp-3); top: var(--sp-4); bottom: var(--sp-4); width: 3px; border-radius: 3px; background: var(--brand-accent); }

.findings { display: flex; flex-direction: column; gap: 0; padding: 0 var(--sp-4) var(--sp-4); }
.findings li { display: flex; gap: 0.7rem; padding: 0.7rem 0; border-bottom: 1px solid var(--m-line-soft); font-size: var(--step--1); }
.findings li:last-child { border-bottom: 0; }
.findings li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; margin-top: 0.45em; flex: none; background: var(--brand-primary); }
.findings li.info::before { background: var(--m-ink-mute); }
.findings li strong { font-weight: 700; }

/* ============================================================
   IMAGEN DE ULTRASONIDO (marco clínico + marcadores IA)
   ============================================================ */
.us-frame {
  position: relative; aspect-ratio: 4/3; border-radius: var(--r);
  background:
    radial-gradient(120% 90% at 50% 40%, #26343a 0%, #10181c 60%, #060a0c 100%);
  overflow: hidden; box-shadow: var(--shadow); color: #cfe;
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.04em;
}
.us-frame .fetal { position: absolute; inset: 0; opacity: 0.5;
  background: radial-gradient(45% 40% at 46% 44%, rgba(220,235,255,0.45), transparent 70%),
             radial-gradient(30% 26% at 55% 62%, rgba(200,220,255,0.28), transparent 72%); }
.us-meta { position: absolute; padding: 0.5rem 0.7rem; color: rgba(210,235,240,0.85); line-height: 1.5; }
.us-meta.tl { top: 0; left: 0; } .us-meta.tr { top: 0; right: 0; text-align: right; }
.us-meta.bl { bottom: 0; left: 0; } .us-meta.br { bottom: 0; right: 0; text-align: right; }
.us-tag3d { position: absolute; top: 0.6rem; left: 50%; transform: translateX(-50%); font-weight: 500; color: #bfe; border: 1px solid rgba(180,230,235,0.4); padding: 1px 7px; border-radius: 4px; }
.ai-marker { position: absolute; }
.ai-marker .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--m-coral); box-shadow: 0 0 0 0 rgba(255,122,107,0.7); animation: live 2s infinite; }
.ai-marker .line { position: absolute; height: 1.5px; background: linear-gradient(90deg, var(--m-coral), transparent); transform-origin: left center; top: 5px; left: 6px; }
.ai-marker .lbl { position: absolute; font-family: var(--font-ui); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.02em; color: #fff; background: rgba(232,93,77,0.9); padding: 2px 7px; border-radius: 5px; white-space: nowrap; }

/* ============================================================
   TIMELINE
   ============================================================ */
.timeline { position: relative; padding-left: var(--sp-4); }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--m-line); }
.timeline li { position: relative; padding: 0 0 var(--sp-3) var(--sp-3); }
.timeline li::before { content: ""; position: absolute; left: -0.85rem; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--m-surface); box-shadow: inset 0 0 0 2px var(--m-line); }
.timeline li.done::before { background: var(--brand-primary); box-shadow: none; }
.timeline li.next::before { background: var(--brand-accent); box-shadow: 0 0 0 4px var(--m-blush); }
.timeline .d { font-size: var(--step--2); font-weight: 700; color: var(--m-ink-mute); }
.timeline .t { font-size: var(--step--1); color: var(--m-ink-soft); }

/* ============================================================
   LISTAS (pacientes, medicación, mensajes)
   ============================================================ */
.plist { display: flex; flex-direction: column; }
.plist li { display: flex; align-items: center; gap: 0.9rem; padding: 0.8rem; border-radius: var(--r-sm); cursor: pointer; transition: background 0.15s; }
.plist li:hover { background: var(--brand-tint); }
.plist li.sel { background: var(--brand-tint-2); box-shadow: inset 3px 0 0 var(--brand-primary); }
.plist .info { min-width: 0; flex: 1; }
.plist .info strong { display: block; font-size: var(--step-0); font-weight: 700; }
.plist .info span { font-size: var(--step--2); color: var(--m-ink-mute); }
.plist .stage { font-size: var(--step--2); font-weight: 700; color: var(--brand-primary-deep); background: var(--brand-tint); padding: 0.25em 0.6em; border-radius: 999px; }

.med-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--m-line-soft); font-size: var(--step--1); }
.med-list li:last-child { border-bottom: 0; }
.med-list .dose { color: var(--m-ink-mute); font-weight: 600; }
.med-list li.hecho { color: var(--m-ink-mute); text-decoration: line-through; }

/* ============================================================
   FORMULARIOS
   ============================================================ */
.field { display: block; margin-bottom: var(--sp-3); }
.field label { display: block; font-size: var(--step--1); font-weight: 700; margin-bottom: 0.35rem; }
.input {
  width: 100%; padding: 0.8em 1em; border-radius: var(--r-sm);
  background: var(--m-surface); border: 1.5px solid var(--m-line);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.input:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 4px var(--brand-tint); }
.seg { display: inline-flex; background: var(--brand-tint); border-radius: 999px; padding: 4px; gap: 4px; }
.seg button { padding: 0.5em 1.1em; border-radius: 999px; font-weight: 700; font-size: var(--step--1); color: var(--brand-primary-deep); transition: background 0.18s, color 0.18s; }
.seg button.on { background: var(--brand-primary); color: #fff; box-shadow: var(--shadow-sm); }

/* ============================================================
   DROPZONE / PROCESO IA (admin ultrasonido)
   ============================================================ */
.dropzone {
  border: 2px dashed color-mix(in oklab, var(--brand-primary) 40%, var(--m-line));
  border-radius: var(--r); padding: var(--sp-6) var(--sp-4); text-align: center;
  background: var(--brand-tint); cursor: pointer; transition: border-color 0.2s, background 0.2s, transform 0.2s var(--ease);
}
.dropzone:hover { border-color: var(--brand-primary); background: var(--brand-tint-2); transform: translateY(-2px); }
.dropzone .ico { width: 52px; height: 52px; margin: 0 auto var(--sp-2); border-radius: 50%; display: grid; place-items: center; background: var(--brand-primary); color: #fff; }
.proc-steps { display: flex; flex-direction: column; gap: 2px; }
.proc-step { display: flex; align-items: center; gap: 0.8rem; padding: 0.75rem 0.9rem; border-radius: var(--r-sm); background: var(--m-surface-2); font-size: var(--step--1); opacity: 0.55; transition: opacity 0.3s, background 0.3s; }
.proc-step .no { font-family: var(--font-mono); font-size: var(--step--2); color: var(--m-ink-mute); }
.proc-step .st { margin-left: auto; font-size: var(--step--2); font-weight: 700; color: var(--m-ink-mute); }
.proc-step.active { opacity: 1; background: var(--brand-tint); }
.proc-step.done { opacity: 1; }
.proc-step.done .st { color: var(--brand-primary); }
.spinner { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--brand-tint-2); border-top-color: var(--brand-primary); animation: spin 0.7s linear infinite; margin-left: auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   DEMO BANNER (cinta superior en vistas de demo)
   ============================================================ */
.demo-ribbon { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.45em var(--sp-5); background: var(--m-ink); color: rgba(255,255,255,0.86); font-size: var(--step--2); font-weight: 600; }
.demo-ribbon a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

/* ============================================================
   MOTION: entrada escalonada
   ============================================================ */
.reveal { opacity: 0; transform: translateY(14px); animation: fadeUp 0.7s var(--ease) forwards; }
.reveal:nth-child(2){ animation-delay: 0.06s; } .reveal:nth-child(3){ animation-delay: 0.12s; }
.reveal:nth-child(4){ animation-delay: 0.18s; } .reveal:nth-child(5){ animation-delay: 0.24s; }
.reveal:nth-child(6){ animation-delay: 0.30s; }
@keyframes fadeUp { to { opacity: 1; transform: none; } }

/* ============================================================
   UTILIDADES
   ============================================================ */
.grid { display: grid; gap: var(--sp-4); }
.flex { display: flex; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.items-center { align-items: center; }
.gap-2 { gap: var(--sp-2); } .gap-3 { gap: var(--sp-3); } .gap-4 { gap: var(--sp-4); }
.wrap { flex-wrap: wrap; }
.mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); } .mt-4 { margin-top: var(--sp-4); } .mt-5 { margin-top: var(--sp-5); }
.text-center { text-align: center; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
.sidebar-toggle { display: none; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 60;
    transform: translateX(-100%); transition: transform 0.3s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .app-shell.nav-open .sidebar { transform: none; }
  .sidebar-toggle { display: grid; }
  .ai-metrics { grid-template-columns: repeat(2, 1fr); }
  .view, .topbar { padding-inline: var(--sp-4); }
}
@media (max-width: 560px) {
  .stat { flex-basis: 50%; border-left: 1px solid var(--m-line-soft); }
  .view-head { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  html { scroll-behavior: auto; }
}
