/* TRAMA · consola local. Sistema de diseño del ecosistema de Yoandy Ramírez Delgado:
 * superficies lisas (sin rejillas, puntos ni texturas), un único acento (siete a elegir,
 * azul eléctrico por defecto), Geist, iconos Lucide y movimiento al estilo Apple. */
@font-face { font-family: "Geist"; src: url("fonts/geist-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("fonts/geist-mono-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

/* ============ Tokens ============ */
:root {
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r-chip: 6px; --r-control: 10px; --r-card: 14px; --r-panel: 20px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --pad: 20px; --gap: 16px; --row: 12px;
  --side-w: 264px;
}
[data-density="compact"] { --pad: 14px; --gap: 12px; --row: 7px; }

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08090b; --side: #0c0e11; --surface: #111317; --surface-2: #171a1f; --surface-3: #1e2228;
  --line: rgb(255 255 255 / 0.07); --line-2: rgb(255 255 255 / 0.12);
  --text: #eef1f3; --ink-2: #a3aab2; --muted: #8f97a0; --ink-4: #646c75;
  --crit: #ff5d5d; --high: #ff9f43; --med: #e3c45a; --low: #8f9aa6; --ok: #4ad38a;
  --crit-fill: #f03e5a; --on-crit: #2a0606;
  --glass: rgb(17 19 23 / 0.78); --glass-thick: rgb(17 19 23 / 0.96);
  --sh-panel: 0 1px 2px rgb(0 0 0 / 0.4), 0 12px 32px rgb(0 0 0 / 0.28);
  --sh-overlay: 0 2px 8px rgb(0 0 0 / 0.45), 0 30px 80px rgb(0 0 0 / 0.55);
  --accent: #6b9bff; --accent-strong: #9dbdff; --accent-ink: #041226;
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f7; --side: #ffffff; --surface: #ffffff; --surface-2: #eef1f4; --surface-3: #e2e6eb;
  --line: rgb(0 0 0 / 0.07); --line-2: rgb(0 0 0 / 0.12);
  --text: #101418; --ink-2: #2c3440; --muted: #5c6773; --ink-4: #8b949e;
  --crit: #a8234a; --high: #9c3d08; --med: #7a5600; --low: #5c6773; --ok: #146c38;
  --crit-fill: #a8234a; --on-crit: #ffffff;
  --glass: rgb(255 255 255 / 0.86); --glass-thick: rgb(255 255 255 / 0.97);
  --sh-panel: 0 1px 3px rgb(0 0 0 / 0.04), 0 10px 25px -5px rgb(0 0 0 / 0.06);
  --sh-overlay: 0 4px 14px rgb(0 0 0 / 0.08), 0 25px 50px -10px rgb(0 0 0 / 0.16);
  --accent: #1a4fe0; --accent-strong: #123db8; --accent-ink: #ffffff;
}
/* Siete acentos de Rosetta. Ajustados para 4,5:1 también sobre su propio tinte. */
[data-theme="dark"][data-accent="rosa"] { --accent: #ff7ab8; --accent-strong: #ffc0de; --accent-ink: #3b0620; }
[data-theme="dark"][data-accent="solar"] { --accent: #ffb020; --accent-strong: #ffd27a; --accent-ink: #2a1600; }
[data-theme="dark"][data-accent="glaciar"] { --accent: #5ee7f5; --accent-strong: #b6f6ff; --accent-ink: #042028; }
[data-theme="dark"][data-accent="orquidea"] { --accent: #b79bff; --accent-strong: #ddd0ff; --accent-ink: #1a0838; }
[data-theme="dark"][data-accent="verde"] { --accent: #5aa86a; --accent-strong: #8fd4a0; --accent-ink: #06210f; }
[data-theme="dark"][data-accent="rojo"] { --accent: #ff6b6b; --accent-strong: #ffb0b0; --accent-ink: #2a0808; }
[data-theme="light"][data-accent="rosa"] { --accent: #b8155a; --accent-strong: #9a0f4a; --accent-ink: #ffffff; }
[data-theme="light"][data-accent="solar"] { --accent: #8a4a00; --accent-strong: #703c00; --accent-ink: #ffffff; }
[data-theme="light"][data-accent="glaciar"] { --accent: #0a6a7d; --accent-strong: #085968; --accent-ink: #ffffff; }
[data-theme="light"][data-accent="orquidea"] { --accent: #5b35f0; --accent-strong: #4a22d6; --accent-ink: #ffffff; }
[data-theme="light"][data-accent="verde"] { --accent: #1a6b36; --accent-strong: #12552a; --accent-ink: #ffffff; }
[data-theme="light"][data-accent="rojo"] { --accent: #b3141a; --accent-strong: #930f14; --accent-ink: #ffffff; }
:root { --tint: color-mix(in oklab, var(--accent) 14%, transparent); --tint-2: color-mix(in oklab, var(--accent) 8%, var(--surface)); }

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); letter-spacing: -0.008em; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-underline-offset: 3px; }
code, kbd, .mono { font-family: var(--mono); font-feature-settings: "zero" 1; }
kbd { display: inline-flex; align-items: center; min-height: 20px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink-2); font-size: 11.5px; }
.ico { width: 18px; height: 18px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent); color: var(--accent-ink); }
.skip { position: absolute; left: 16px; top: -60px; z-index: 300; padding: 10px 14px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Pulsación: respuesta inmediata en el pointer-down. */
.press { transition: transform .16s var(--ease-out), background-color .2s var(--ease-out), border-color .2s var(--ease-out), color .2s var(--ease-out), box-shadow .2s var(--ease-out); }
.press:active:not(:disabled) { transform: scale(.97); transition-duration: .1s; }

/* Cambio de tema: un único fundido coordinado (todo a la vez, misma curva). */
.theme-anim *, .theme-anim *::before, .theme-anim *::after { transition: background-color .32s var(--ease-out), color .32s var(--ease-out), border-color .32s var(--ease-out), fill .32s var(--ease-out), stroke .32s var(--ease-out), box-shadow .32s var(--ease-out), transform .16s var(--ease-out), opacity .2s var(--ease-out) !important; }
.theme-anim .switch .knob { transition: transform .35s var(--ease-drawer), background-color .32s var(--ease-out) !important; }

/* ============ Shell ============ */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .35s var(--ease-drawer); }
.app.collapsed { --side-w: 84px; }
.side { position: sticky; top: 0; height: 100vh; padding: 12px 0 12px 12px; }
.side-in { display: flex; flex-direction: column; height: 100%; padding: 14px 12px; border-radius: 26px; background: var(--side); border: 1px solid var(--line); box-shadow: var(--sh-panel); overflow: hidden; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px 14px; }
.logo { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); flex: none; }
.logo .mark { width: 26px; height: 26px; }
.brand-t { display: flex; flex-direction: column; min-width: 0; }
.brand-t b { font-size: 17px; letter-spacing: .1em; line-height: 1.1; }
.brand-t small { font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pkg { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 11px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); text-align: left; cursor: pointer; }
.pkg:hover { border-color: var(--line-2); }
.pkg .ico { color: var(--accent); }
.pkg-t { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pkg-t b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pkg-t small { font-size: 11.5px; color: var(--muted); }
.pkg .chev { color: var(--muted); }
.nav { position: relative; display: flex; flex-direction: column; gap: 2px; margin-top: 16px; }
.nav a { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 12px; color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: 14.5px; }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); }
.nav a[aria-current="page"] .ico { color: var(--accent); }
.nav a .count { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); font: 600 11px var(--mono); display: grid; place-items: center; color: var(--ink-2); }
.nav a .count.hot { background: var(--crit-fill); color: var(--on-crit); }
.nav-pill { position: absolute; left: 0; right: 0; top: 0; height: 40px; border-radius: 12px; background: var(--tint); transition: transform .35s var(--ease-drawer); pointer-events: none; }
.nav-pill::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--accent); }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.acc-k { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin: 0 4px 8px; }
.swatches { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 4px; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .18); }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--side), 0 0 0 4px var(--text); }
.sw-azul { background: #3f7bff; } .sw-rosa { background: #e3478f; } .sw-solar { background: #e79a12; } .sw-glaciar { background: #1fb8cc; }
.sw-orquidea { background: #8a68ff; } .sw-verde { background: #3d9152; } .sw-rojo { background: #e04848; }
.account { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 14px; border: 0; background: transparent; cursor: pointer; text-align: left; }
.account:hover { background: var(--surface-2); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 700 12.5px var(--mono); flex: none; }
.account-t { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.account-t b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-t small { font-size: 12px; color: var(--muted); }
.account .more { color: var(--muted); }
.app.collapsed .brand-t, .app.collapsed .pkg-t, .app.collapsed .pkg .chev, .app.collapsed .nav a span, .app.collapsed .nav a .count, .app.collapsed .acc-k span, .app.collapsed .account-t, .app.collapsed .account .more { display: none; }
.app.collapsed .nav a { justify-content: center; padding: 0; }
.app.collapsed .pkg, .app.collapsed .account, .app.collapsed .acc-k { justify-content: center; }
.app.collapsed .swatches { flex-direction: column; align-items: center; }

.col { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 12px; z-index: 40; display: flex; align-items: center; gap: 6px; min-height: 58px; margin: 12px 16px 0; padding: 0 8px; border-radius: 999px; background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border: 1px solid var(--line); box-shadow: var(--sh-panel); }
@media (prefers-reduced-transparency: reduce) { .top, .bnav, .dlg { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; } }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.chip-local { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 999px; background: color-mix(in oklab, var(--ok) 13%, transparent); color: var(--ok); font-size: 12.5px; font-weight: 650; }
.spacer { flex: 1; }
.searchbtn { display: inline-flex; align-items: center; gap: 9px; min-width: 240px; height: 40px; padding: 0 8px 0 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.searchbtn:hover { border-color: var(--line-2); color: var(--ink-2); }
#search-btn-t { flex: 1; text-align: left; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); flex: none; }
.seg button { min-width: 36px; height: 30px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); font: 650 12px var(--mono); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--sh-panel); }
.switch { position: relative; display: inline-flex; align-items: center; justify-content: space-between; width: 64px; height: 34px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); cursor: pointer; flex: none; }
.switch .ico { position: relative; z-index: 1; width: 15px; height: 15px; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgb(0 0 0 / .2); transition: transform .35s var(--ease-drawer); }
.switch[aria-checked="true"] .knob { transform: translateX(30px); }
.switch[aria-checked="false"] .t-sun, .switch[aria-checked="true"] .t-moon { color: var(--text); }
.mobile-only { display: none; }

main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 30px 32px 64px; outline: none; }
.foot { max-width: 1240px; width: 100%; margin: 0 auto; padding: 0 32px 28px; color: var(--muted); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.foot a { color: var(--ink-2); }

/* ============ Cabecera de vista ============ */
@media (prefers-reduced-motion: no-preference) {
  .view { transition: opacity .2s var(--ease-out), transform .2s var(--ease-out); }
  @starting-style { .view { opacity: 0; transform: translateY(6px); } }
  .stagger > * { transition: opacity .28s var(--ease-out), transform .28s var(--ease-out); }
  @starting-style { .stagger > * { opacity: 0; transform: translateY(8px); } }
  .stagger > :nth-child(2) { transition-delay: 40ms; } .stagger > :nth-child(3) { transition-delay: 80ms; }
  .stagger > :nth-child(4) { transition-delay: 120ms; } .stagger > :nth-child(5) { transition-delay: 160ms; }
  .stagger > :nth-child(6) { transition-delay: 200ms; }
}
.vhead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.kicker { display: inline-flex; align-items: center; gap: 8px; font: 650 11.5px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.kicker .ico { width: 14px; height: 14px; }
h1 { font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.5rem); line-height: 1.08; letter-spacing: -0.035em; font-weight: 700; }
.lede { margin-top: 9px; max-width: 68ch; color: var(--ink-2); font-size: 15.5px; }
h2 { font-size: 17px; letter-spacing: -0.015em; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.label { font: 650 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* ============ Componentes ============ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: var(--pad); box-shadow: var(--sh-panel); min-width: 0; }
.card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-h .ico { color: var(--accent); }
.card-h > div { min-width: 0; }
.grid { display: grid; gap: var(--gap); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; }
.g2 { align-items: start; }
.mt { margin-top: var(--gap); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); margin: 0 0 var(--gap); }
.kpi { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; margin: 0; }
.kpi dt { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 7px; }
.kpi dt .ico { width: 15px; height: 15px; }
.kpi dd { margin: 0; font-size: 30px; font-weight: 680; letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi dd small { font-size: 13px; font-weight: 550; color: var(--muted); margin-left: 7px; letter-spacing: 0; }
.kpi dd.ok { color: var(--ok); } .kpi dd.bad { color: var(--crit); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-strong); color: var(--accent-ink); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn[aria-pressed="true"] { border-color: var(--crit); color: var(--crit); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.chip .mono { color: var(--accent); font-weight: 600; font-size: 11.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; list-style: none; margin: 0; padding: 0; }
.sev { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font: 700 11px var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--sc); background: color-mix(in oklab, var(--sc) 14%, transparent); white-space: nowrap; }
.sev .ico { width: 13px; height: 13px; }
.sev-CRITICAL { --sc: var(--crit); } .sev-HIGH { --sc: var(--high); } .sev-MEDIUM { --sc: var(--med); } .sev-LOW { --sc: var(--low); }
.tag { display: inline-flex; align-items: center; gap: 5px; min-height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); }
.tag .ico { width: 13px; height: 13px; }
.tag.bad { background: color-mix(in oklab, var(--crit) 13%, transparent); color: var(--crit); }
.tag.warn { background: color-mix(in oklab, var(--high) 13%, transparent); color: var(--high); }
.tag.ok { background: color-mix(in oklab, var(--ok) 13%, transparent); color: var(--ok); }
.hash { font: 12px var(--mono); color: var(--ink-2); word-break: break-all; }
.copy { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.copy:hover { background: var(--surface-2); color: var(--text); }
.copy .ico { width: 15px; height: 15px; }
.empty { color: var(--muted); padding: 14px 0; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); font-size: 13.5px; }
.note .ico { color: var(--accent); margin-top: 1px; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }
.row-item > .ico { color: var(--accent); margin-top: 2px; }
.row-item.bad > .ico { color: var(--crit); }
.row-item .grow { flex: 1; min-width: 0; }
.sub, .lede, .st-m, .st-t, .row-item b, .note, .expo, .deadline .when { overflow-wrap: anywhere; }
.row-item b { display: block; font-size: 14px; }
.row-item .sub { margin-top: 2px; }
.row-item .end { margin-left: auto; text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* Lente */
.lens-flag { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 13px 0 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.lens-flag:hover { border-color: var(--line-2); color: var(--text); }
.lens-flag .ico { color: var(--accent); width: 16px; height: 16px; }
.lenses { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.lens-opt { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; min-height: 92px; }
.lens-opt:hover { border-color: var(--line-2); }
.lens-opt .ico { color: var(--accent); }
.lens-opt b { font-size: 13.5px; }
.lens-opt small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.lens-opt[aria-checked="true"] { border-color: var(--accent); background: var(--tint-2); box-shadow: 0 0 0 1px var(--accent); }
.profile-lenses { grid-template-columns: minmax(0, 1fr); }
.profile-lenses .lens-opt { flex-direction: row; align-items: center; min-height: 0; gap: 12px; }
.profile-lenses .lens-opt div { display: grid; gap: 2px; }

/* Plazos NIS2: pista lineal (no circular) */
.track { position: relative; height: 10px; border-radius: 999px; background: var(--surface-3); margin: 38px 44px 34px; }
.track .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--accent); }
.track .mk { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink-2); }
.track .mk.past { border-color: var(--crit); background: var(--crit); }
.track .mk-l { position: absolute; top: 18px; transform: translateX(-50%); font: 600 11.5px var(--mono); color: var(--muted); white-space: nowrap; }
.track .now { position: absolute; bottom: 16px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; font: 650 11px var(--mono); color: var(--accent); white-space: nowrap; }
.track .now::after { content: ""; width: 2px; height: 12px; margin-top: 3px; border-radius: 2px; background: var(--accent); }
.deadlines { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.deadline { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }
.deadline b { display: block; font-size: 13.5px; }
.deadline .when { font: 600 12.5px var(--mono); margin-top: 4px; color: var(--ink-2); }
.deadline .tag { margin-top: 8px; }

/* Barras de duración (Red) */
.bar { height: 8px; border-radius: 999px; background: var(--surface-3); margin-top: 10px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: inherit; background: var(--accent); }

/* Cobertura (Purple) */
.cov { display: grid; gap: 6px; }
.cov-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.cov-row .mono { color: var(--accent); font-weight: 600; font-size: 12px; }

/* ============ El Hilo (firma visual) ============ */
.hilo-wrap { overflow-x: auto; border-radius: var(--r-card); }
.hilo { display: block; }
.hilo .lane-bg { fill: var(--surface-2); }
.hilo .lane-t { fill: var(--muted); font: 650 10.5px var(--mono); letter-spacing: .12em; }
.hilo .tick { fill: var(--muted); font: 11px var(--mono); }
.hilo .tick-l { stroke: var(--line-2); stroke-dasharray: 2 5; }
.hilo .thread { fill: none; stroke: var(--ink-4); stroke-width: 1.3; opacity: .5; stroke-linecap: round; }
.hilo .thread.on { stroke: var(--accent); stroke-width: 2.6; opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .hilo .thread.on { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw .9s var(--ease-out) forwards; }
}
[data-motion="reduce"] .hilo .thread.on { stroke-dasharray: none; animation: none; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.hilo .ev { fill: var(--surface); stroke: var(--ink-4); stroke-width: 1.5; }
.hilo .ev.on { fill: var(--accent); stroke: var(--accent); }
.hilo .ev-t { fill: var(--ink-2); font: 11.5px var(--font); }
.hilo .ev-t.on { fill: var(--text); font-weight: 650; }
.hilo .node rect { fill: var(--surface); stroke: var(--line-2); }
.hilo .node text { fill: var(--ink-2); font: 600 11px var(--mono); }
.hilo .node.on rect { stroke: var(--accent); stroke-width: 1.6; fill: var(--tint-2); }
.hilo .node.on text { fill: var(--text); }
.hilo .node.fnd.on rect { stroke: var(--crit); fill: color-mix(in oklab, var(--crit) 10%, var(--surface)); }
.inc-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.inc-pick button { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer; text-align: left; }
.inc-pick button[aria-pressed="true"] { border-color: var(--accent); color: var(--text); background: var(--tint-2); box-shadow: 0 0 0 1px var(--accent); }
.inc-pick .mono { font-size: 11.5px; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; padding-bottom: 16px; }
.steps li::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 2px; border-radius: 2px; background: var(--line-2); }
.steps li:last-child::before { display: none; }
.knot { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--tint); color: var(--accent); font: 700 12px var(--mono); }
.knot .ico { width: 14px; height: 14px; }
.knot.fnd { background: color-mix(in oklab, var(--crit) 14%, transparent); color: var(--crit); }
.knot.ctl { background: var(--surface-3); color: var(--ink-2); }
.st-t { font-weight: 650; font-size: 14px; }
.st-m { color: var(--muted); font-size: 13px; margin-top: 2px; }
.cmd { display: block; margin-top: 8px; padding: 9px 11px; border-radius: 10px; background: var(--surface-3); color: var(--text); font: 12.5px var(--mono); white-space: pre-wrap; word-break: break-all; }
.expo { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; color: var(--high); font-size: 13px; }
.expo .ico { width: 15px; height: 15px; margin-top: 2px; }
.hashline { display: flex; align-items: center; gap: 6px; margin-top: 6px; min-width: 0; }

/* Incidentes */
.md { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.inc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; position: sticky; top: 92px; }
.inc-btn { display: grid; gap: 6px; width: 100%; padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; }
.inc-btn:hover { border-color: var(--line-2); }
.inc-btn[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--tint-2); }
.inc-btn .r1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.inc-btn .id { font: 600 11.5px var(--mono); color: var(--muted); }
.inc-btn .title { font-weight: 650; font-size: 14px; line-height: 1.35; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--ink-2); font-size: 13px; margin: 12px 0 4px; }
.meta span { display: inline-flex; align-items: center; gap: 6px; }
.meta .ico { width: 15px; height: 15px; color: var(--muted); }
.sec-t { margin: 22px 0 10px; }

/* Tablas */
.table-wrap { overflow-x: auto; border-radius: var(--r-card); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: var(--row) 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 650 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.wrap { min-width: 220px; }
tr.hit td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.detail-row pre { margin: 0; max-height: 360px; overflow: auto; padding: 12px; border-radius: 10px; background: var(--surface-3); font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-all; }
.link-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.link-btn:hover { background: var(--surface-2); }
.link-btn .ico { transition: transform .2s var(--ease-out); }
.link-btn[aria-expanded="true"] .ico { transform: rotate(90deg); }
.field { display: grid; gap: 6px; }
.field label, .field .lbl { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input { height: 40px; padding: 0 12px; border-radius: var(--r-control); border: 1px solid var(--line-2); background: var(--surface); color: var(--text); min-width: 0; width: 100%; }
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 14px; }
.toolbar .field { min-width: 200px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tab { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: transparent; }
.tab .n { font: 650 11px var(--mono); padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); }
.tab[aria-selected="true"] .n { background: var(--bg); color: var(--text); }

/* ============ Custodia: eslabones ============ */
.verdict { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--surface-2); color: var(--ink-2); margin-bottom: var(--gap); }
.verdict .ico { width: 24px; height: 24px; color: var(--accent); }
.verdict b { display: block; color: var(--text); }
.verdict.ok { background: color-mix(in oklab, var(--ok) 12%, var(--surface)); }
.verdict.ok .ico { color: var(--ok); }
.verdict.bad { background: color-mix(in oklab, var(--crit) 12%, var(--surface)); }
.verdict.bad .ico { color: var(--crit); }
.links { list-style: none; margin: 0; padding: 6px 4px 14px; display: flex; width: max-content; }
.link-blk { position: relative; flex: none; width: 196px; margin-right: 34px; padding: 13px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--surface); }
.link-blk:last-child { margin-right: 0; }
.link-blk::after { content: ""; position: absolute; right: -35px; top: 50%; width: 34px; height: 2px; background: var(--line-2); }
.link-blk:last-child::after { display: none; }
.link-blk .bi { display: flex; align-items: center; justify-content: space-between; font: 650 11.5px var(--mono); color: var(--muted); }
.link-blk .src { font-weight: 650; font-size: 13.5px; margin: 6px 0 8px; }
.link-blk .h { font: 11.5px var(--mono); color: var(--ink-2); }
.link-blk .h span { color: var(--muted); }
.link-blk .tag { margin-top: 10px; }
.link-blk.ok { border-color: color-mix(in oklab, var(--ok) 55%, var(--line-2)); }
.link-blk.ok::after { background: var(--ok); }
.link-blk.bad { border-color: var(--crit); background: color-mix(in oklab, var(--crit) 8%, var(--surface)); }
.link-blk.bad::after { background: transparent; border-top: 2px dashed var(--crit); height: 0; }
.link-blk.skip { opacity: .6; }
@media (prefers-reduced-motion: no-preference) {
  .links.run .link-blk { animation: pulse .5s var(--ease-out) both; animation-delay: calc(var(--i) * 90ms); }
}
@keyframes pulse { 40% { transform: scale(1.035); box-shadow: 0 0 0 4px var(--tint); } }
.hashes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 var(--gap); }
.hashes div { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); min-width: 0; }
.hashes dt { font-size: 12.5px; color: var(--muted); }
.hashes dd { margin: 0; font: 12px var(--mono); word-break: break-all; }

/* Entidades */
.ent-col { display: grid; gap: 8px; align-content: start; }
.ent { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid transparent; }
.ent.exposed { border-color: color-mix(in oklab, var(--crit) 45%, transparent); }
.ent b { font: 600 13px var(--mono); word-break: break-all; }
.ent .meta { margin: 6px 0 0; font-size: 12.5px; }

/* ============ Diálogos ============ */
dialog { padding: 0; border: 0; background: transparent; color: var(--text); max-width: none; max-height: none; }
dialog::backdrop { background: rgb(5 8 14 / .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.dlg { width: min(720px, calc(100vw - 32px)); max-height: min(86vh, 860px); display: flex; flex-direction: column; border-radius: 24px; background: var(--glass-thick); -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px); border: 1px solid var(--line-2); box-shadow: var(--sh-overlay); overflow: hidden; }
dialog[open] { margin: auto; }
dialog.sheet[open] { margin: 0 0 0 auto; height: 100vh; }
dialog.sheet .dlg { width: min(460px, 100vw); height: 100vh; max-height: none; border-radius: 26px 0 0 26px; }
@media (prefers-reduced-motion: no-preference) {
  dialog[open] .dlg { animation: pop .22s var(--ease-out); }
  dialog.sheet[open] .dlg { animation: slide .34s var(--ease-drawer); }
  dialog[open]::backdrop { animation: fade .2s var(--ease-out); }
}
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } }
@keyframes slide { from { transform: translateX(100%); } }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
.dlg-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.dlg-h h2 { font-size: 18px; }
.dlg-b { padding: 18px 20px; overflow-y: auto; display: grid; gap: 18px; align-content: start; }
.dlg-f { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.search-dlg .dlg { width: min(640px, calc(100vw - 32px)); }
dialog.search-dlg[open] { margin-top: 12vh; }
.s-field { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.s-field .ico { color: var(--muted); }
.s-field input { flex: 1; border: 0; background: transparent; font-size: 17px; outline: none; min-width: 0; }
.s-res { list-style: none; margin: 0; padding: 8px; max-height: 56vh; overflow-y: auto; }
.s-res li[role="option"] { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; cursor: pointer; }
.s-res li[aria-selected="true"] { background: var(--tint); }
.s-res .k { font: 650 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); min-width: 92px; }
.s-res .t { font-weight: 600; font-size: 14px; display: block; }
.s-res .s { display: block; font: 11.5px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }
.s-res .none { padding: 14px; color: var(--muted); }
.htabs { display: flex; gap: 4px; padding: 10px 14px 0; overflow-x: auto; border-bottom: 1px solid var(--line); }
.htabs button { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--ink-2); font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.htabs button .ico { width: 15px; height: 15px; }
.htabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.hp { display: grid; gap: 14px; }
.hp p, .hp li { color: var(--ink-2); font-size: 14px; }
.hp ol, .hp ul { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.formula { padding: 12px 14px; border-radius: 12px; background: var(--surface-3); font: 12.5px/1.6 var(--mono); white-space: pre-wrap; word-break: break-word; margin: 0; }
dl.gloss { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: 8px 16px; margin: 0; }
dl.gloss dt { font-weight: 650; font-size: 13.5px; }
dl.gloss dd { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.keys { display: grid; gap: 8px; }
.keys div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; }
.author { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 16px; background: var(--surface-2); }
.author .avatar { width: 48px; height: 48px; font-size: 15px; }
.author small { display: block; color: var(--muted); font-size: 12.5px; }
.eco { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.eco-i { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 14px; background: var(--surface-2); min-width: 0; }
.eco-i.self { box-shadow: inset 0 0 0 1px var(--accent); }
.eco-i div { flex: 1; min-width: 0; }
.eco-i b { display: block; font-size: 13.5px; }
.eco-i small { display: block; color: var(--muted); font-size: 12px; }
.eco-i a { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.opts { display: grid; gap: 8px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.opt:has(input:checked) { border-color: var(--accent); background: var(--tint-2); }
.opt input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; flex: none; }
.opt b { display: block; font-size: 14px; }
.opt small { color: var(--muted); font-size: 12.5px; }
.form { display: grid; gap: 14px; }
/* Hoja «Más» (móvil): secciones con antetítulo, rejilla de vistas y listas agrupadas. */
.more-sec + .more-sec { margin-top: 22px; }
.more-k { margin: 0 4px 8px; font: 600 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 84px; padding: 12px 6px; border-radius: 18px; background: var(--surface-2); color: var(--text); text-decoration: none; font-weight: 600; font-size: 13.5px; text-align: center; }
.tile .ico { width: 22px; height: 22px; color: var(--accent); }
.tile[aria-current="page"] { background: var(--tint-2); box-shadow: inset 0 0 0 1.5px var(--accent); }
.group { list-style: none; margin: 0; padding: 0; border-radius: 18px; background: var(--surface-2); overflow: hidden; }
.group > li + li, .group .pref + .pref { border-top: 1px solid var(--line); }
.grow-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px; border: 0; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.grow-row:active { background: var(--line); }
.grow-row > .ico { width: 18px; height: 18px; color: var(--muted); flex: none; }
.gi { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--tint-2); color: var(--accent); flex: none; }
.gi .ico { width: 18px; height: 18px; }
.gt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gt b { font-size: 15px; font-weight: 600; }
.gt small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pref { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; }
.pref.col { flex-direction: column; align-items: stretch; gap: 12px; padding-bottom: 16px; }
.pref .seg button { min-width: 52px; }
.pref .swatches { justify-content: space-between; padding: 0 2px; gap: 0; }
.pref .swatch { width: 32px; height: 32px; }
#dlg-more .dlg-b { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 400; display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 15px; border-radius: 14px; background: var(--text); color: var(--bg); font-size: 13.5px; font-weight: 600; box-shadow: var(--sh-overlay); }
@media (prefers-reduced-motion: no-preference) { .toast { animation: rise .26s var(--ease-out); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.drop { position: fixed; inset: 16px; z-index: 350; display: grid; place-items: center; border-radius: 28px; border: 2px dashed var(--accent); background: color-mix(in oklab, var(--bg) 88%, transparent); font-size: 18px; font-weight: 650; pointer-events: none; }
.bnav { display: none; }

/* ============ Responsive ============ */
@media (max-width: 1180px) {
  .app:not(.expanded) { --side-w: 84px; }
  .app:not(.expanded) .brand-t, .app:not(.expanded) .pkg-t, .app:not(.expanded) .pkg .chev, .app:not(.expanded) .nav a span, .app:not(.expanded) .nav a .count, .app:not(.expanded) .acc-k span, .app:not(.expanded) .account-t, .app:not(.expanded) .account .more { display: none; }
  .app:not(.expanded) .nav a, .app:not(.expanded) .pkg, .app:not(.expanded) .account, .app:not(.expanded) .acc-k { justify-content: center; }
  .app:not(.expanded) .nav a { padding: 0; }
  .app:not(.expanded) .swatches { flex-direction: column; align-items: center; }
  .lenses { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-main, .md { grid-template-columns: minmax(0, 1fr); }
  .inc-list { position: static; }
}
@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .hashes, .deadlines { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .app, .app.collapsed { grid-template-columns: minmax(0, 1fr); }
  .side, .desk-only { display: none !important; }
  .mobile-only { display: inline-flex; }
  .top { margin: 8px 8px 0; top: 8px; min-height: 52px; padding: 0 6px; gap: 2px; }
  .top > :not(.spacer) { flex: none; }
  .top .icon-btn { width: 36px; height: 36px; }
  .searchbtn { min-width: 0; width: 38px; height: 38px; padding: 0; justify-content: center; }
  .searchbtn kbd { display: none; }
  #search-btn-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .switch { width: 56px; }
  .switch[aria-checked="true"] .knob { transform: translateX(22px); }
  .top .seg, .chip-local .lbl { display: none; }
  .chip-local { padding: 0 9px; }
  .brand-mini { display: inline-flex; align-items: center; gap: 8px; font-weight: 750; letter-spacing: .1em; font-size: 14px; padding-left: 4px; }
  .brand-mini .logo { width: 30px; height: 30px; border-radius: 10px; }
  .brand-mini .logo .mark { width: 21px; height: 21px; }
  main { padding: 22px 16px 120px; }
  .foot { padding: 0 16px 110px; }
  .g2, .eco { grid-template-columns: minmax(0, 1fr); }
  /* Lentes en el móvil: tira horizontal de píldoras; la pregunta de la elegida ya está en la entradilla. */
  .lens-card { padding: 10px; }
  .lens-card .lenses { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .lens-card .lens-opt { flex: none; flex-direction: row; align-items: center; gap: 8px; min-height: 40px; padding: 0 13px; border-radius: 999px; }
  .lens-card .lens-opt small { display: none; }
  .lens-card .lens-opt .ico { width: 16px; height: 16px; }
  .kpi dd { font-size: 24px; }
  .bnav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; z-index: 60; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); padding: 6px; border-radius: 22px; background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border: 1px solid var(--line); box-shadow: var(--sh-overlay); }
  .bnav a, .bnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; border-radius: 16px; border: 0; background: transparent; color: var(--ink-2); text-decoration: none; font-size: 11px; font-weight: 600; cursor: pointer; }
  .bnav a[aria-current="page"] { color: var(--text); background: var(--tint); }
  .bnav a[aria-current="page"] .ico { color: var(--accent); }
  /* Hoja inferior: anclada abajo y con la altura de su contenido (con inset 0 se estiraba a toda la pantalla). */
  dialog.sheet[open] { inset: auto 0 0 0; margin: 0; height: auto; max-height: 92dvh; width: 100vw; }
  dialog.sheet .dlg { width: 100vw; height: auto; max-height: 90dvh; border-radius: 24px 24px 0 0; }
  /* Asa de arrastre, como en las hojas de iOS. */
  dialog.sheet .dlg { position: relative; padding-top: 10px; }
  dialog.sheet .dlg::before { content: ""; position: absolute; top: 7px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 999px; background: var(--line-strong, var(--muted)); opacity: .5; }
  .toasts { right: 12px; left: 12px; bottom: 96px; }
  dl.gloss { grid-template-columns: minmax(0, 1fr); }
  .cards-sm thead { display: none; }
  .cards-sm, .cards-sm tbody, .cards-sm tr, .cards-sm td { display: block; width: 100%; }
  .cards-sm tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .cards-sm td { border: 0; padding: 3px 0; }
  .cards-sm td[data-label]::before { content: attr(data-label); display: block; font: 650 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
  .cov-row { grid-template-columns: 80px minmax(0, 1fr); }
  .cov-row > :last-child { grid-column: 1 / -1; }
  .md .inc-list { position: static; }
}
@media (max-width: 767px) and (prefers-reduced-motion: no-preference) { dialog.sheet[open] .dlg { animation: up .32s var(--ease-drawer); } }

/* ============ Movimiento reducido = fundido ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .press:active:not(:disabled) { transform: none; }
  .nav-pill, .switch .knob, .app, .link-btn .ico { transition: none; }
}
[data-motion="reduce"] *, [data-motion="reduce"] *::before, [data-motion="reduce"] *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }

/* ============ Impresión ============ */
@media print {
  .side, .top, .bnav, .foot, .btn, .copy, .toasts { display: none !important; }
  .app { display: block; }
  main { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* Filas con metadatos a la derecha: en pantallas estrechas pasan debajo del texto. */
@media (max-width: 560px) {
  .row-item:has(> .end) { flex-wrap: wrap; }
  .row-item:has(> .end) > .grow { flex-basis: calc(100% - 42px); }
  /* flex: 1 y ajuste de línea: con flex: none la fila medía lo que su contenido y ensanchaba la página. */
  .row-item > .end { flex: 1 1 auto; max-width: calc(100% - 30px); min-width: 0; flex-direction: row; flex-wrap: wrap; align-items: center; margin-left: 30px; text-align: left; }
}

/* Pantallas muy estrechas: las vistas de «Más» pasan a filas para que ningún nombre se corte. */
@media (max-width: 359px) {
  .tiles { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .tile { flex-direction: row; justify-content: flex-start; min-height: 52px; padding: 0 16px; gap: 12px; font-size: 15px; }
}

/* Importar datos: zona de arrastre, ficheros con su formato detectado, activo y avance por fases. */
.import-dlg .dlg { width: min(760px, calc(100vw - 32px)); }
.imp-body { display: grid; gap: 14px; }
.dz { display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: 18px; border: 1.5px dashed var(--line-2); background: var(--surface-2); transition: border-color .2s var(--ease-out), background-color .2s var(--ease-out); }
.dz.over { border-color: var(--accent); background: var(--tint-2); }
.dz > div { flex: 1; min-width: 0; }
.dz b { display: block; font-size: 15px; }
.dz-i { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--tint-2); color: var(--accent); flex: none; }
.dz-i .ico { width: 22px; height: 22px; }
.imp-sum { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; padding: 0 4px; }
.imp-sum b { font-size: 14px; }
.imp-row { align-items: flex-start; }
.imp-row > .icon-btn { margin: -6px -8px 0 0; flex: none; }
.imp-row.warn > .ico { color: var(--high); }
.imp-row b.mono, #ev-sources b.mono { font-size: 13px; overflow-wrap: anywhere; }
.imp-err { margin-top: 4px; color: var(--crit); font-size: 13px; overflow-wrap: anywhere; }
.imp-asset { margin-top: 10px; max-width: 380px; }
.imp-asset .input { height: 36px; font: 13px var(--mono); }
.imp-guide { border-radius: 14px; background: var(--surface-2); padding: 0 14px; }
.imp-guide summary { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; font-weight: 600; font-size: 13.5px; list-style: none; }
.imp-guide summary::-webkit-details-marker { display: none; }
.imp-guide summary .ico { color: var(--accent); width: 16px; height: 16px; }
.imp-guide[open] summary { border-bottom: 1px solid var(--line); }
.imp-guide table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 8px 0; }
.imp-guide th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 8px 6px 0; }
.imp-guide td { padding: 7px 8px 7px 0; border-top: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.imp-guide td.mono { font: 11.5px/1.5 var(--mono); color: var(--ink-2); }
.imp-guide > p { padding-bottom: 12px; }
.check { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); cursor: pointer; }
.check input { accent-color: var(--accent); width: 18px; height: 18px; margin: 1px 0 0; flex: none; }
.check b { display: block; font-size: 14px; }
.check small { display: block; color: var(--muted); font-size: 12.5px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.step { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.step.run, .step.done { color: var(--text); }
.step.done .ico { color: var(--ok); }
.step.fail .ico { color: var(--crit); }
.step.run .ico { color: var(--accent); }
@media (prefers-reduced-motion: no-preference) { .step.run .ico { animation: spin .9s linear infinite; } }
@keyframes spin { to { transform: rotate(360deg); } }
.note.bad .ico { color: var(--crit); }
.imp-priv { display: inline-flex; align-items: center; gap: 6px; }
.imp-priv .ico { width: 14px; height: 14px; color: var(--ok); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 767px) {
  dialog.import-dlg[open] { inset: auto 0 0 0; margin: 0; width: 100vw; max-height: 94dvh; }
  .import-dlg .dlg { width: 100vw; max-height: 92dvh; border-radius: 24px 24px 0 0; }
  .dz { flex-wrap: wrap; }
  .dz .btn { width: 100%; }
  .import-dlg .dlg-f { flex-direction: column; align-items: stretch; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .import-dlg .dlg-f .btn-row { display: grid; grid-template-columns: 1fr 1fr; }
  .imp-asset { max-width: none; }
  .imp-guide thead { display: none; }
  .imp-guide tr { display: grid; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line); }
  .imp-guide td { border: 0; padding: 0; }
  .imp-guide td:first-child { font-weight: 600; }
}
