/* Demo textil · sistema visual compartido (portada y sistema). Tema «Dashboard V2»:
   claro y limpio, tarjetas blancas muy redondeadas sobre gris, negro para lo activo y lo principal,
   un solo acento cálido (coral en gradiente) usado con moderación, estados en colores suaves.
   Todo color, radio y sombra sale de estas variables. Tema oscuro con las mismas variables. */

:root {
  color-scheme: light;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  /* superficies */
  --bg: #F2F3F5;            /* fondo detrás de las tarjetas */
  --surface: #FFFFFF;       /* tarjetas, menú */
  --surface-2: #F7F7F8;     /* filas, campos, sub-tarjetas */
  --surface-3: #ECECEF;     /* pistas de barras, separadores gruesos */
  --card-dark: #0E0E10;     /* tarjeta oscura destacada */
  --line: #ECECEF;
  --line-2: #DEDEE3;
  /* texto (contraste AA sobre blanco) */
  --ink: #111113;
  --ink-2: #5E5E66;
  --muted: #74747C;
  /* lo activo y lo principal: negro */
  --acc: #111113; --acc-2: #2A2A2E; --acc-ink: #FFFFFF; --acc-soft: #F1F1F3; --acc-rgb: 17, 17, 19;
  /* el acento cálido (una tarjeta por pantalla, gráficas, avisos) */
  --coral: #F2545B; --coral-rgb: 242, 84, 91; --coral-soft: #FDE7E8;
  --coral-grad: linear-gradient(135deg, #FF8A65 0%, #F2545B 55%, #E8364F 100%);
  --lime: #D4F24A; --lime-soft: #EEF9C4; --peach-soft: #FFE4D6;
  /* estados (siempre con texto o ícono, nunca solo color) */
  --ok: #15803D;  --ok-soft: #DCFCE7;
  --warn: #A16207; --warn-soft: #FEF3C7; --warn-dot: #EAB308;
  --bad: #DC2626; --bad-soft: #FEE2E2;
  --info: #2563EB; --info-soft: #DBEAFE;
  --purple: #7C3AED; --purple-soft: #EDE9FE;
  /* series de gráficas, en orden fijo: coral, negro y luego colores fríos */
  --s1: #F2545B; --s2: #111113; --s3: #2563EB; --s4: #65A30D; --s5: #7C3AED; --s6: #D97706; --s7: #0891B2; --s8: #DB2777;
  --grid: #E9E9EC; --axis: #DEDEE3;
  /* forma y sombra */
  --r-shell: 28px; --r-card: 20px; --r-ctl: 14px;
  --shadow: 0 1px 2px rgba(16, 16, 20, .04), 0 4px 16px rgba(16, 16, 20, .04);
  --shadow-hover: 0 8px 28px rgba(16, 16, 20, .08);
  --shadow-up: 0 12px 32px rgba(16, 16, 20, .18);
  --ease: cubic-bezier(.22, 1, .36, 1);
  /* IA */
  --ia-acc: #F2545B; --ia-acc-rgb: 242, 84, 91; --ia-acc2: #FF8A65; --ia-acc2-rgb: 255, 138, 101; --ia-ink: #FFFFFF;
  --ia-bg: #FFFFFF; --ia-bg2: #FFFFFF; --ia-bg3: #F7F7F8; --ia-line: #ECECEF; --ia-text: #111113; --ia-muted: #74747C; --ia-orbe: #FFE4D6;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #09090B; --surface: #141417; --surface-2: #1C1C20; --surface-3: #27272C; --card-dark: #000000; --line: #232328; --line-2: #303036;
    --ink: #F4F4F5; --ink-2: #B4B4BC; --muted: #8E8E97;
    --acc: #F4F4F5; --acc-2: #FFFFFF; --acc-ink: #09090B; --acc-soft: #232328; --acc-rgb: 244, 244, 245;
    --coral-soft: #3A1A1C; --lime-soft: #26300B; --peach-soft: #3A2318;
    --ok: #4ADE80; --ok-soft: #12301C; --warn: #FACC15; --warn-soft: #2E2608; --bad: #F87171; --bad-soft: #3A1515; --info: #60A5FA; --info-soft: #172338; --purple: #A78BFA; --purple-soft: #261B3D;
    --s2: #E4E4E7; --s3: #60A5FA; --s4: #A3E635; --s5: #A78BFA; --s6: #FBBF24; --s7: #22D3EE; --s8: #F472B6;
    --grid: #222226; --axis: #333339;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 6px 20px rgba(0, 0, 0, .35); --shadow-hover: 0 10px 32px rgba(0, 0, 0, .55); --shadow-up: 0 14px 40px rgba(0, 0, 0, .7);
    --ia-ink: #FFFFFF; --ia-bg: #141417; --ia-bg2: #141417; --ia-bg3: #1C1C20; --ia-line: #232328; --ia-text: #F4F4F5; --ia-muted: #8E8E97; --ia-orbe: #3A1A1C;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #09090B; --surface: #141417; --surface-2: #1C1C20; --surface-3: #27272C; --card-dark: #000000; --line: #232328; --line-2: #303036;
  --ink: #F4F4F5; --ink-2: #B4B4BC; --muted: #8E8E97;
  --acc: #F4F4F5; --acc-2: #FFFFFF; --acc-ink: #09090B; --acc-soft: #232328; --acc-rgb: 244, 244, 245;
  --coral-soft: #3A1A1C; --lime-soft: #26300B; --peach-soft: #3A2318;
  --ok: #4ADE80; --ok-soft: #12301C; --warn: #FACC15; --warn-soft: #2E2608; --bad: #F87171; --bad-soft: #3A1515; --info: #60A5FA; --info-soft: #172338; --purple: #A78BFA; --purple-soft: #261B3D;
  --s2: #E4E4E7; --s3: #60A5FA; --s4: #A3E635; --s5: #A78BFA; --s6: #FBBF24; --s7: #22D3EE; --s8: #F472B6;
  --grid: #222226; --axis: #333339;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 6px 20px rgba(0, 0, 0, .35); --shadow-hover: 0 10px 32px rgba(0, 0, 0, .55); --shadow-up: 0 14px 40px rgba(0, 0, 0, .7);
  --ia-ink: #FFFFFF; --ia-bg: #141417; --ia-bg2: #141417; --ia-bg3: #1C1C20; --ia-line: #232328; --ia-text: #F4F4F5; --ia-muted: #8E8E97; --ia-orbe: #3A1A1C;
}

/* ── base ── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -.02em; font-weight: 700; }
p { margin: 0; }
a { color: var(--ink); text-decoration: none; font-weight: 600; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; border-radius: 8px; }
.num, .tab { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .ink2 { color: var(--ink-2); }
.tiny { font-size: 12px; } .small { font-size: 13.5px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.i.lg { width: 22px; height: 22px; } .i.sm { width: 15px; height: 15px; }
/* título a dos tonos: <span class="duo"><b>Costo</b> por prenda</span> */
.duo { color: var(--ink-2); font-weight: 500; } .duo b { color: var(--ink); font-weight: 700; }
.grad { background: var(--coral-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ── rejillas (siempre minmax(0,1fr): ninguna columna crece por su contenido) ── */
.g2, .g3, .g4, .g12 { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c6 { grid-column: span 6; } .c7 { grid-column: span 7; } .c8 { grid-column: span 8; } .c12 { grid-column: span 12; }
.fila { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fila.sb { justify-content: space-between; } .fila.wrap { flex-wrap: wrap; } .fila.top { align-items: flex-start; }
.pila { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pila.g8 { gap: 8px; } .pila.g20 { gap: 20px; }
.grow { flex: 1; min-width: 0; }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .c3, .c4, .c5 { grid-column: span 6; } .c7, .c8 { grid-column: span 12; } .c6 { grid-column: span 12; } }
@media (max-width: 720px) {
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .g12 > * { grid-column: 1 / -1; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

/* ── tarjetas ── */
.card { background: var(--surface); border: 1px solid transparent; border-radius: var(--r-card); padding: 20px; box-shadow: var(--shadow); min-width: 0; transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
:root[data-theme="dark"] .card, :root[data-theme="dark"] .kpi { border-color: var(--line); }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .card, :root:where(:not([data-theme="light"])) .kpi { border-color: var(--line); } }
.card.plano { box-shadow: none; }
.card.sin { padding: 0; overflow: hidden; }
.card.dark { background: var(--card-dark); color: #FFFFFF; border-color: transparent; }
.card.dark .muted, .card.dark .ink2, .card.dark p { color: rgba(255, 255, 255, .72); }
.card.accent { background: var(--coral-grad); color: #FFFFFF; border-color: transparent; }
.card.accent .muted, .card.accent .ink2, .card.accent p { color: rgba(255, 255, 255, .88); }
.card.peach { background: var(--peach-soft); } .card.lime { background: var(--lime-soft); }
.card-cab { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 12px; margin-bottom: 16px; }
.card-cab > :first-child { flex: 1 1 220px; min-width: 0; }
.card-cab h3 { font-size: 15px; letter-spacing: -.01em; font-weight: 700; }
.card-cab p { color: var(--ink-2); font-size: 13px; margin-top: 3px; }
.card-pie { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
@media (hover: hover) { .card:hover { box-shadow: var(--shadow-hover); } }
@media (max-width: 720px) { .card { padding: 16px; border-radius: 18px; } }

/* ── indicadores ── */
.kpi { background: var(--surface); border: 1px solid transparent; border-radius: var(--r-card); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; display: flex; flex-direction: column; gap: 6px; transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
@media (hover: hover) { .kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); } }
.kpi .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi small { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.kpi .ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ink); flex: 0 0 auto; }
.kpi .ic.ok { background: var(--lime-soft); color: var(--ok); } .kpi .ic.warn { background: var(--peach-soft); color: var(--warn); } .kpi .ic.bad { background: var(--coral-soft); color: var(--bad); }
.kpi b { font-size: 28px; letter-spacing: -.03em; line-height: 1.05; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi b.ok { color: var(--ok); } .kpi b.warn { color: var(--warn); } .kpi b.bad { color: var(--bad); }
.kpi .s { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 999px; font-weight: 700; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--ok); background: var(--ok-soft); } .delta.dn { color: #FFFFFF; background: var(--coral); }
@media (max-width: 720px) { .kpi { padding: 13px 14px; border-radius: 18px; } .kpi b { font-size: 22px; } .kpi .ic { width: 28px; height: 28px; } }

/* ── botones (píldora): negro = principal ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent; background: var(--acc); color: var(--acc-ink); font-weight: 650; font-size: 14px; white-space: nowrap; transition: transform .15s var(--ease), background .2s var(--ease), border-color .2s; }
.btn:hover { background: var(--acc-2); }
.btn:active { transform: scale(.98); }
.btn.sec { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn.sec:hover { background: var(--surface-3); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.peligro { background: var(--coral); color: #FFFFFF; }
.btn.blanco { background: #FFFFFF; color: #111113; }
.btn.sm { height: 32px; padding: 0 13px; font-size: 13px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15.5px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icbtn { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); flex: 0 0 auto; position: relative; transition: background .2s var(--ease), transform .15s var(--ease); }
.icbtn:hover { background: var(--surface-2); } .icbtn:active { transform: scale(.96); }
.icbtn .i { width: 17px; height: 17px; }
.icbtn .cont[hidden] { display: none; }
.icbtn .cont { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--coral); color: #FFFFFF; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--bg); }

/* ── botón de voz (audio para quien no lee): siempre visible junto al texto ── */
.voz { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; min-width: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-weight: 650; font-size: 13px; flex: 0 0 auto; }
.voz .i { width: 17px; height: 17px; }
.voz.hablando { background: var(--acc); color: var(--acc-ink); border-color: transparent; }
.voz.solo { padding: 0; width: 34px; }
.voz.grande { height: 46px; min-width: 46px; font-size: 15px; padding: 0 16px; background: var(--acc); color: var(--acc-ink); border-color: transparent; }
.voz.grande .i { width: 22px; height: 22px; }

/* ── píldoras de estado (color + punto + texto: nunca solo color) ── */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 11.5px; font-weight: 650; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.pill .pt { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.pill.acc { background: var(--acc); color: var(--acc-ink); border-color: transparent; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.chip.on { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }

/* control segmentado: la pestaña activa es una píldora negra */
.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: transparent; height: 32px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; transition: background .25s var(--ease), color .25s var(--ease); }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--acc); color: var(--acc-ink); box-shadow: 0 2px 8px rgba(16, 16, 20, .12); }

/* ── campos ── */
.campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.campo label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.campo .ayuda { font-size: 12px; color: var(--muted); }
.inp { height: 44px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface-2); padding: 0 14px; width: 100%; min-width: 0; transition: border-color .2s, background .2s; }
.inp:focus { outline: none; border-color: var(--ink); background: var(--surface); }
textarea.inp { height: auto; min-height: 90px; padding: 10px 14px; resize: vertical; }
.buscar { position: relative; min-width: 0; }
.buscar .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.buscar .inp { padding-left: 40px; border-radius: 999px; }

/* ── barras de avance ── */
.barra { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.barra i { display: block; height: 100%; width: 100%; border-radius: 999px; background: var(--ink); transform-origin: left center; transform: scaleX(var(--p, 0)); transition: transform .8s var(--ease); }
.barra i.ok { background: var(--ok); } .barra i.warn { background: var(--warn-dot); } .barra i.bad { background: var(--coral); }
.barra.fina { height: 5px; }

/* ── tablas (en el teléfono se vuelven tarjetas con la etiqueta de cada columna en data-l) ── */
.tabla-w { overflow-x: auto; min-width: 0; }
table.tabla { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tabla th { text-align: left; font-size: 11px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.tabla td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla .n, .tabla th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla tbody tr.clic { cursor: pointer; }
.tabla tbody tr.clic:hover td { background: var(--surface-2); }
.tabla .fuerte { font-weight: 650; }
@media (max-width: 720px) {
  table.tabla.tarjetas, .tabla.tarjetas tbody, .tabla.tarjetas tr, .tabla.tarjetas td { display: block; width: 100%; }
  .tabla.tarjetas thead { display: none; }
  .tabla.tarjetas tr { border: 1px solid var(--line); border-radius: 16px; padding: 8px 14px; margin-bottom: 10px; background: var(--surface); }
  .tabla.tarjetas td { border: 0; padding: 5px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; }
  .tabla.tarjetas td::before { content: attr(data-l); font-size: 12px; color: var(--muted); font-weight: 600; text-align: left; flex: 0 0 auto; }
  .tabla.tarjetas td.n { text-align: right; }
  .tabla.tarjetas td.prin { font-weight: 700; font-size: 14.5px; justify-content: flex-start; text-align: left; }
  .tabla.tarjetas td.prin::before { display: none; }
}

/* ── listas ── */
.lista { display: flex; flex-direction: column; }
.lista > .it { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); min-width: 0; }
.lista > .it:first-child { border-top: 0; }
.lista .it .t { font-weight: 650; font-size: 14px; } .lista .it .d { font-size: 12.5px; color: var(--muted); }
.ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink); flex: 0 0 auto; }
.ico.acc { background: var(--acc); color: var(--acc-ink); } .ico.ok { background: var(--lime-soft); color: var(--ok); } .ico.warn { background: var(--peach-soft); color: var(--warn); } .ico.bad { background: var(--coral-soft); color: var(--bad); }

/* ── etiqueta de dato de ejemplo y fuente ── */
.ejemplo { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; color: var(--warn); background: var(--warn-soft); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.fuente { font-size: 12px; color: var(--muted); }
.fuente a { color: var(--ink-2); font-weight: 500; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 2px; }
.nd { color: var(--muted); font-style: italic; }

/* ── estado vacío y esqueleto ── */
.vacio { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 32px 16px; color: var(--muted); font-size: 14px; }
.vacio .i { width: 30px; height: 30px; color: var(--line-2); }
.skel { background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%; border-radius: 12px; animation: skel 1.3s linear infinite; }
@keyframes skel { to { background-position: -200% 0; } }

/* ── hoja (modal; en el teléfono sube desde abajo) ── */
.hoja-bg { position: fixed; inset: 0; z-index: 70; background: rgba(10, 10, 12, .4); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; animation: fade .2s var(--ease); }
.hoja { width: min(620px, 100%); background: var(--surface); border-radius: var(--r-shell); border: 1px solid var(--line); box-shadow: var(--shadow-up); padding: 22px; animation: sube .35s var(--ease); margin-block: auto; }
.hoja.ancha { width: min(920px, 100%); }
.hoja .cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.hoja .cab h2 { font-size: 20px; }
.hoja .cerrar { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); display: grid; place-items: center; color: var(--ink); flex: 0 0 auto; }
.hoja .pie { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
@media (max-width: 720px) {
  .hoja-bg { padding: 0; align-items: flex-end; }
  .hoja, .hoja.ancha { width: 100%; border-radius: 26px 26px 0 0; max-height: 92dvh; overflow-y: auto; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); margin-block: 0; animation: subeM .38s var(--ease); }
  .hoja .pie .btn { flex: 1; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes sube { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@keyframes subeM { from { transform: translateY(100%); } }

/* ── aviso (píldora negra flotante) ── */
#aviso { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.aviso { background: #111113; color: #FFFFFF; padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-up); animation: sube .3s var(--ease); }
.aviso.ok { background: #111113; } .aviso.ok::before { content: "✓  "; color: var(--lime); font-weight: 800; }
.aviso.bad { background: var(--coral); }
@media (max-width: 860px) { #aviso { bottom: calc(96px + env(safe-area-inset-bottom)); } }

/* ── gráficas ── */
.graf { position: relative; height: 260px; min-width: 0; }
.graf.alta { height: 320px; } .graf.baja { height: 190px; } .graf.mini { height: 120px; }
.graf canvas { width: 100% !important; }
.leyenda { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px; }
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda i { width: 10px; height: 10px; border-radius: 50%; }
.leyenda i.linea { height: 3px; width: 14px; border-radius: 2px; }
@media (max-width: 720px) { .graf { height: 220px; } .graf.alta { height: 260px; } }

/* ── movimiento: entrada escalonada, todo se apaga si la persona lo pide ── */
.entra { animation: entra .35s var(--ease) both; }
.entra.d1 { animation-delay: 50ms; } .entra.d2 { animation-delay: 100ms; } .entra.d3 { animation-delay: 150ms; } .entra.d4 { animation-delay: 200ms; }
@keyframes entra { from { opacity: 0; transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
