/* NewArgos — sistema de diseño «Premium Investment Intelligence».
   Azul marino, grafito y blanco roto; un solo color de acento (azul petróleo); verde y rojo solo para
   resultados; ámbar para avisos. Tipografías alojadas aquí (sin recursos externos):
   Inter para la interfaz y las cifras (tabulares) y Source Serif 4 para los títulos.
   Licencias en static/fonts y static/LICENSE-Lucide.txt. */

@font-face {
  font-family: "Inter";
  src: url("fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4-var.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

/* --- 1. Tokens --- */

:root {
  color-scheme: light;
  --bg: #f4f3ef;          /* fondo: blanco roto cálido */
  --surface: #ffffff;     /* tarjetas, paneles y tablas */
  --surface-2: #f9f8f5;   /* cabeceras de tabla, filas al pasar */
  --surface-3: #efede7;   /* campos de supuestos, chips */
  --ink: #12202e;         /* texto principal: azul marino casi negro */
  --ink-2: #4a5462;       /* texto secundario: grafito */
  --ink-3: #7b8491;       /* etiquetas y notas */
  --rule: #e3e0d8;
  --rule-strong: #cfcbc1;
  --accent: #1c6a80;      /* azul petróleo: acciones y enlaces */
  --accent-hover: #155567;
  --accent-soft: #e2eef1;
  --on-accent: #ffffff;
  --pos: #23744a;
  --pos-soft: #e3f1e8;
  --neg: #b23f35;
  --neg-soft: #f8e5e2;
  --warn: #9c6a12;
  --warn-soft: #f7eedb;
  --info: #3f5f8a;
  --brand-gold: #a3812f;  /* el oro de la pluma de Argos: solo en la marca */
  --sidebar: #0f1b29;
  --sidebar-ink: #c9d1db;
  --sidebar-ink-strong: #ffffff;
  --sidebar-hover: #182839;
  --sidebar-active: #1d3044;
  --sidebar-rule: #1e2d3e;
  --series-1: #2c5d8f;
  --series-2: #c27c34;
  --series-3: #5f8f6d;
  --shadow-1: 0 1px 2px rgb(15 27 41 / 6%), 0 1px 1px rgb(15 27 41 / 4%);
  --shadow-2: 0 12px 32px rgb(15 27 41 / 16%), 0 2px 6px rgb(15 27 41 / 8%);
  --radius: 8px;
  --radius-sm: 6px;
  --measure: none;  /* el texto llega hasta el borde del contenido (preferencia de Juan Paz) */
  --sidebar-w: 236px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  /* Nombres anteriores, para las reglas que aún los usan */
  --paper: var(--bg);
  --ink-soft: var(--ink-2);
  --teal: var(--accent);
  --gold: var(--warn);
  --focus: var(--accent);
  --on-teal: var(--on-accent);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e151e; --surface: #141d28; --surface-2: #18222e; --surface-3: #1d2836;
    --ink: #e8eaed; --ink-2: #aab3bf; --ink-3: #7f8a99;
    --rule: #233041; --rule-strong: #30405396;
    --accent: #5fb2c7; --accent-hover: #7cc3d5; --accent-soft: #17303b; --on-accent: #0b141c;
    --pos: #5fbf8a; --pos-soft: #15301f; --neg: #ef8277; --neg-soft: #3a1c1a;
    --warn: #e0aa4f; --warn-soft: #33270f; --info: #8fb0d8;
    --sidebar: #0a1119; --sidebar-hover: #121c28; --sidebar-active: #172534; --sidebar-rule: #16212e;
    --series-1: #79abe0; --series-2: #e0a15e; --series-3: #85b894;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 30%);
    --shadow-2: 0 16px 40px rgb(0 0 0 / 50%), 0 2px 6px rgb(0 0 0 / 30%);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e151e; --surface: #141d28; --surface-2: #18222e; --surface-3: #1d2836;
  --ink: #e8eaed; --ink-2: #aab3bf; --ink-3: #7f8a99;
  --rule: #233041; --rule-strong: #304053;
  --accent: #5fb2c7; --accent-hover: #7cc3d5; --accent-soft: #17303b; --on-accent: #0b141c;
  --pos: #5fbf8a; --pos-soft: #15301f; --neg: #ef8277; --neg-soft: #3a1c1a;
  --warn: #e0aa4f; --warn-soft: #33270f; --info: #8fb0d8;
  --sidebar: #0a1119; --sidebar-hover: #121c28; --sidebar-active: #172534; --sidebar-rule: #16212e;
  --series-1: #79abe0; --series-2: #e0a15e; --series-3: #85b894;
  --shadow-1: 0 1px 2px rgb(0 0 0 / 30%);
  --shadow-2: 0 16px 40px rgb(0 0 0 / 50%), 0 2px 6px rgb(0 0 0 / 30%);
}

/* --- 2. Base --- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 .9375rem/1.55 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
p { max-width: var(--measure); }
code, pre { font-family: var(--mono); font-size: .88em; }
.num, table.data, .kpi dd, .figures dd, .tnum { font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.muted { color: var(--ink-2); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: 1rem; top: -3rem; padding: .5rem .75rem; background: var(--surface); color: var(--ink); z-index: 100; }
.skip:focus { top: 1rem; }
.icon { width: 18px; height: 18px; flex: none; }

/* --- 3. Estructura: barra lateral + contenido --- */

.app {
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh;
  /* el fondo oscuro sigue bajo la barra aunque la página sea larga */
  background: linear-gradient(to right, var(--sidebar) var(--sidebar-w), transparent 0);
}
html[data-sidebar="collapsed"] .app { --sidebar-w: 68px; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
  background: var(--sidebar); color: var(--sidebar-ink);
  border-right: 1px solid var(--sidebar-rule);
  scrollbar-width: thin;
}
.sidebar .brand {
  display: flex; align-items: center; gap: .65rem;
  height: 60px; padding: 0 1.1rem; color: var(--sidebar-ink-strong); text-decoration: none;
  border-bottom: 1px solid var(--sidebar-rule);
}
.brand-mark { width: 26px; height: 26px; flex: none; }
.brand-name { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; letter-spacing: -.005em; white-space: nowrap; }
.brand-argos { color: var(--brand-gold); }
.sidebar nav { display: block; padding: .75rem .6rem; flex: 1; }
.nav-label {
  display: block; padding: .9rem .6rem .35rem; font-size: .68rem; font-weight: 650;
  letter-spacing: .09em; text-transform: uppercase; color: #6d7d90; white-space: nowrap;
}
.nav-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .5rem .6rem; margin: 1px 0; border-radius: var(--radius-sm);
  color: var(--sidebar-ink); text-decoration: none; font-size: .9rem; font-weight: 500; white-space: nowrap;
}
.nav-link:hover { background: var(--sidebar-hover); color: var(--sidebar-ink-strong); }
.nav-link[aria-current="page"] { background: var(--sidebar-active); color: var(--sidebar-ink-strong); box-shadow: inset 2px 0 0 var(--brand-gold); }
.nav-link .icon { opacity: .85; }
.nav-link .badge { margin-left: auto; }
.sidebar-foot { padding: .6rem; border-top: 1px solid var(--sidebar-rule); }
.sidebar-foot .nav-link, .sidebar-foot button.nav-link {
  width: 100%; min-height: 0; margin: 1px 0; padding: .5rem .6rem; justify-content: flex-start;
  background: none; border: 0; border-radius: var(--radius-sm); color: var(--sidebar-ink);
  cursor: pointer; font: inherit; font-size: .9rem; font-weight: 500; text-align: left;
}
.sidebar-foot button.nav-link:hover { background: var(--sidebar-hover); color: var(--sidebar-ink-strong); }
.sidebar-foot .when-expanded, .sidebar-foot .when-collapsed { display: inline-flex; }
html:not([data-sidebar="collapsed"]) .sidebar-foot .when-collapsed { display: none; }
html[data-sidebar="collapsed"] .sidebar-foot .when-expanded { display: none; }
.sidebar-foot form { margin: 0; }
.sidebar-collapse { display: flex; }
html[data-sidebar="collapsed"] .sidebar .brand-name,
html[data-sidebar="collapsed"] .sidebar .nav-text,
html[data-sidebar="collapsed"] .sidebar .nav-label { display: none; }
html[data-sidebar="collapsed"] .sidebar .brand { justify-content: center; padding: 0; }
html[data-sidebar="collapsed"] .nav-link { justify-content: center; padding: .55rem 0; }
html[data-sidebar="collapsed"] .nav-link .badge { position: absolute; transform: translate(10px, -9px); margin: 0; }
html[data-sidebar="collapsed"] .nav-link { position: relative; }
html[data-sidebar="collapsed"] .sidebar nav { padding-top: 1rem; }

.content { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .75rem;
  height: 60px; padding: 0 clamp(1rem, 3vw, 2rem);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.topbar .brand { display: none; }
.icon-button.menu-button { display: none; }
.search-trigger {
  display: flex; align-items: center; gap: .6rem;
  width: min(30rem, 100%); height: 38px; margin: 0; padding: 0 .75rem;
  background: var(--surface); color: var(--ink-3);
  border: 1px solid var(--rule-strong); border-radius: var(--radius-sm);
  font: inherit; font-size: .9rem; font-weight: 400; text-align: left; cursor: pointer;
}
.search-trigger:hover { border-color: var(--ink-3); filter: none; }
.search-trigger .kbd-hint { margin-left: auto; }
kbd, .kbd-hint {
  font-family: var(--font); font-size: .72rem; font-weight: 600; color: var(--ink-3);
  border: 1px solid var(--rule-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 .35rem; line-height: 1.35rem;
  background: var(--surface-2);
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .25rem; }
.icon-button {
  display: inline-grid; place-items: center; width: 36px; height: 36px; margin: 0; padding: 0;
  background: none; color: var(--ink-2); border: 0; border-radius: var(--radius-sm); cursor: pointer;
}
.icon-button:hover { background: var(--surface-3); color: var(--ink); filter: none; }
.theme-icon { display: none; }
html:not([data-theme]) .theme-icon-auto, html[data-theme="light"] .theme-icon-light, html[data-theme="dark"] .theme-icon-dark { display: block; }

main {
  flex: 1;
  width: 100%;
  max-width: none;  /* todo el ancho disponible, también en pantallas grandes */
  margin: 0;
  padding: clamp(1.25rem, 3vw, 2rem) clamp(1rem, 3vw, 2rem) 3rem;
}
main.wide { max-width: none; }

.footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1rem;
  padding: 1rem clamp(1rem, 3vw, 2rem); border-top: 1px solid var(--rule);
  color: var(--ink-3); font-size: .8rem;
}
.footer p { margin: 0; max-width: none; }
.footer .authorship { color: var(--ink-2); font-weight: 600; }

/* Pantallas sin sesión (inicio de sesión y verificación) */
.auth-shell { min-height: 100vh; display: flex; flex-direction: column; }
.auth-shell .auth-top { display: flex; align-items: center; height: 64px; padding: 0 clamp(1rem, 4vw, 2.5rem); }
.auth-shell .brand { display: flex; align-items: center; gap: .65rem; color: var(--ink); text-decoration: none; }
.auth-shell .brand-argos { color: var(--accent); }
.auth-shell main:has(> .auth) { display: flex; justify-content: center; align-items: flex-start; padding-top: clamp(2rem, 8vh, 6rem); }
.auth {
  width: 100%; max-width: 26rem; background: var(--surface); border: 1px solid var(--rule);
  border-radius: 12px; padding: 2rem 2rem 1.5rem; box-shadow: var(--shadow-1);
}
.auth-wide { max-width: 40rem; }
.auth h1 { font-size: 1.6rem; max-width: none; }

@media (max-width: 62rem) {
  .app { grid-template-columns: minmax(0, 1fr); background: none; }
  .sidebar {
    position: fixed; z-index: 60; left: 0; top: 0; width: 264px; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: var(--shadow-2);
  }
  html[data-menu="open"] .sidebar { transform: none; }
  html[data-menu="open"] .scrim { display: block; }
  html[data-sidebar="collapsed"] .app { --sidebar-w: 0; }
  html[data-sidebar="collapsed"] .sidebar .brand-name, html[data-sidebar="collapsed"] .sidebar .nav-text,
  html[data-sidebar="collapsed"] .sidebar .nav-label { display: initial; }
  html[data-sidebar="collapsed"] .nav-link { justify-content: flex-start; padding: .5rem .6rem; }
  .sidebar-collapse { display: none; }
  .icon-button.menu-button { display: inline-grid; }
  .topbar .brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--ink); }
  .topbar .brand .brand-argos { color: var(--accent); }
  .search-trigger { width: auto; flex: 1; }
  .search-trigger .search-text, .search-trigger .kbd-hint { display: none; }
  .search-trigger { flex: none; width: 36px; padding: 0; justify-content: center; border: 0; background: none; }
}
.scrim { display: none; position: fixed; inset: 0; z-index: 50; background: rgb(8 14 22 / 45%); }

/* --- 4. Tipografía --- */

h1, h2, h3 { color: var(--ink); }
h1 {
  font-family: var(--serif); font-size: clamp(1.6rem, 3vw, 2.05rem); font-weight: 600;
  line-height: 1.15; letter-spacing: -.012em; margin: 0 0 .5rem; max-width: 32ch;
}
h1 .h1-sub {
  display: block; margin-top: .3rem; font-family: var(--font); font-size: .9rem; font-weight: 500;
  color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase;
}
h2 {
  font-family: var(--serif); font-size: 1.2rem; font-weight: 600; line-height: 1.25;
  letter-spacing: -.005em; margin: 2rem 0 .75rem;
}
h3 { font-size: .95rem; font-weight: 650; margin: 1.5rem 0 .5rem; }
.lede { font-size: 1.05rem; color: var(--ink-2); margin: 0 0 1rem; }
.lede-small { color: var(--ink-2); margin: .25rem 0 1.25rem; max-width: var(--measure); }
.meta-line { color: var(--ink-3); font-size: .84rem; margin: .2rem 0 0; max-width: none; }
.breadcrumb { color: var(--ink-3); font-size: .82rem; margin: 0 0 .6rem; }
.breadcrumb a { color: var(--ink-2); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); text-decoration: underline; }
.hint { color: var(--ink-2); font-size: .9rem; }
.unit { font-weight: 400; color: var(--ink-3); font-size: .88em; }
.sub { display: block; font-size: .78rem; }
.name { display: block; font-size: .78rem; color: var(--ink-3); font-weight: 400; }
.symbol { display: block; font-weight: 650; letter-spacing: .01em; }
a.symbol { color: var(--ink); text-decoration: none; }
a.symbol:hover { color: var(--accent); text-decoration: underline; }
.prose { white-space: pre-line; max-width: var(--measure); overflow-wrap: anywhere; line-height: 1.65; }

/* --- 5. Botones y formularios --- */

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font: inherit; font-size: .9rem; font-weight: 600;
  color: var(--on-accent); background: var(--accent);
  border: 1px solid var(--accent); border-radius: var(--radius-sm);
  padding: .55rem 1.05rem; margin-top: .75rem; min-height: 38px;
  cursor: pointer; text-decoration: none; transition: background .15s ease, border-color .15s ease;
}
button:hover, .button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.button-secondary, button.button-secondary {
  display: inline-flex; align-items: center; gap: .45rem; min-height: 38px;
  font: inherit; font-size: .9rem; font-weight: 600;
  color: var(--ink); background: var(--surface); border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm); padding: .5rem 1rem; text-decoration: none; cursor: pointer;
}
.button-secondary:hover, button.button-secondary:hover { background: var(--surface-2); border-color: var(--ink-3); color: var(--ink); }
.button-small { margin: 0; padding: .3rem .7rem; min-height: 30px; font-size: .82rem; white-space: nowrap; }
.link-button {
  font: inherit; font-weight: 500; color: var(--accent); background: none; border: 0; border-radius: 0;
  padding: .25rem 0; margin: 0; min-height: 0; cursor: pointer;
}
.link-button:hover { background: none; color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }
.actions-row { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin: 1.25rem 0; }
.actions-row form { margin: 0; }
.actions-row button, .actions-row .button { margin: 0; }
.actions-row .button-secondary { margin: 0; }

input[type="text"], input[type="password"], input[type="date"], input[type="url"], input[type="number"], textarea, select {
  font: inherit; font-size: .9rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule-strong); border-radius: var(--radius-sm);
  padding: .5rem .65rem; min-height: 38px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input[type="text"], input[type="password"], input[type="date"], input[type="url"] { width: 100%; }
input[type="number"] { width: 7rem; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
textarea { display: block; width: 100%; max-width: none; line-height: 1.5; resize: vertical; margin: .25rem 0 1.25rem; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
.code-input { font-size: 1.4rem; letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.stack { display: grid; gap: .45rem; margin: 1.25rem 0; }
.stack label { font-weight: 600; font-size: .88rem; margin-top: .5rem; }
.stack button { justify-self: start; }
.block-label { display: block; font-weight: 600; font-size: .9rem; margin-top: .9rem; }
.field-help { margin: .1rem 0 .35rem; max-width: none; font-size: .84rem; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem 1.5rem; margin: .75rem 0 1rem; }
.field-grid label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .86rem; }
.field-grid input { width: 100%; max-width: 14rem; text-align: right; }
.field-grid-narrow { grid-template-columns: minmax(14rem, 18rem) 1fr; align-items: end; }
.field-grid-5 { grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); }
.field-grid-5 input { max-width: 10rem; }
@media (max-width: 40rem) { .field-grid-narrow { grid-template-columns: 1fr; } }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .75rem; margin: 1rem 0 0; }
.inline-form label { display: inline-flex; align-items: center; gap: .5rem; color: var(--ink-2); font-size: .88rem; }
.inline-form button { margin-top: 0; }
.inline-form input { width: 8rem; text-align: right; }
.inline-form input[type="checkbox"] { width: auto; min-height: 0; }
.inline-form .input-file { width: auto; min-width: 16rem; max-width: 100%; padding: .35rem; text-align: left; }
.inline-form .input-date { width: 10rem; text-align: left; }
.inline-form .input-note, .input-note { width: 14rem; text-align: left; }
.input-ticker { width: 7rem !important; text-align: left !important; text-transform: uppercase; }
.input-lei { width: 15rem !important; max-width: 100%; text-align: left !important; text-transform: uppercase; font-family: var(--mono); }
.input-lei::placeholder { text-transform: none; font-family: var(--font); }
.input-pct { width: 100%; max-width: 7.5rem; min-width: 0; text-align: right; }
.note-field { display: flex; align-items: center; gap: .5rem; font-size: .88rem; color: var(--ink-2); }
.check-label { display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; cursor: pointer; }
.check-label input { width: 1.05rem; height: 1.05rem; }
.filters { margin: 1rem 0; }
.row-form { margin: 0; }

/* --- 6. Avisos, etiquetas, insignias --- */

.alert {
  display: block; max-width: none; margin: .75rem 0;
  background: var(--warn-soft); color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  border-left: 3px solid var(--warn); border-radius: var(--radius-sm);
  padding: .6rem .9rem; font-size: .9rem;
}
.alert[role="alert"] { background: var(--neg-soft); border-color: color-mix(in srgb, var(--neg) 30%, transparent); border-left-color: var(--neg); }
.alert-ok { background: var(--pos-soft); border-color: color-mix(in srgb, var(--pos) 30%, transparent); border-left-color: var(--pos); }
.alert-strong { font-weight: 600; }
.tag {
  display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 600; line-height: 1.5;
  padding: 0 .5rem; border-radius: 999px; border: 1px solid var(--rule-strong); color: var(--ink-2); background: var(--surface);
  white-space: nowrap; vertical-align: 1px;
}
.tag-manual { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: var(--warn-soft); width: fit-content; }
.tag-ok { color: var(--pos); border-color: color-mix(in srgb, var(--pos) 40%, transparent); background: var(--pos-soft); }
.tag-warn { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 40%, transparent); background: var(--neg-soft); }
.badge {
  display: inline-block; min-width: 1.25rem; padding: 0 .35rem; border-radius: 999px;
  background: var(--warn); color: #fff; font-size: .7rem; font-weight: 700; line-height: 1.25rem; text-align: center;
}
.claim { margin-right: .35rem; }
.claim-dato, .claim-calculo, .claim-documento { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); }
.claim-interpretacion, .claim-hipotesis { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-soft); }
.claim-verificar { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 40%, transparent); background: var(--neg-soft); }
.restated { color: var(--warn); margin-left: .1rem; }

/* --- 7. Cifras clave: una franja, no tarjetas sueltas --- */

.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  margin: 1.25rem 0; padding: 0;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.kpi { padding: 1rem 1.25rem; border-left: 1px solid var(--rule); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi dt { color: var(--ink-3); font-size: .72rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.kpi dd { margin: .3rem 0 0; font-size: 1.55rem; font-weight: 600; letter-spacing: -.015em; line-height: 1.2; }
.kpi dd.kpi-note { font-size: .8rem; font-weight: 400; color: var(--ink-3); letter-spacing: 0; line-height: 1.4; margin-top: .3rem; }
.kpi-main dd:not(.kpi-note) { font-size: 1.75rem; }
.kpis-3 { margin: 1rem 0; }
@media (min-width: 40rem) { .kpis-3 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 40rem) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { border-left: 0; border-top: 1px solid var(--rule); }
  .kpi:nth-child(-n+2) { border-top: 0; }
  .kpi:nth-child(even) { border-left: 1px solid var(--rule); }
  .kpi-main { grid-column: 1 / -1; }
  .kpi-main + .kpi { border-left: 0; border-top: 1px solid var(--rule); }
  .kpi dd { font-size: 1.25rem; }
  .kpi-main dd:not(.kpi-note) { font-size: 1.5rem; }
}
.kpis-compact { margin: 1rem 0 1.25rem; }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem 2rem; margin: 0; }
.figures-3 { margin: 1rem 0 1.25rem; }
.figures dt { color: var(--ink-3); font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.figures dd { margin: .2rem 0 0; font-size: 1.1rem; font-weight: 600; }
.figures dd.figure-note { font-size: .78rem; font-weight: 400; color: var(--ink-3); }

/* --- 8. Tablas --- */

.table-wrap {
  overflow-x: auto; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .875rem; }
table.data th, table.data td { padding: .55rem .9rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.data thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); color: var(--ink-3);
  font-size: .7rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase;
  text-align: left; white-space: nowrap; border-bottom: 1px solid var(--rule-strong);
  padding-top: .6rem; padding-bottom: .6rem;
}
table.data tbody th { text-align: left; font-weight: 500; min-width: 9rem; max-width: 18rem; }
table.data .num { text-align: right; white-space: nowrap; }
table.data tfoot th, table.data tfoot td { font-weight: 650; border-bottom: 0; border-top: 1px solid var(--rule-strong); background: var(--surface-2); }
table.data tfoot th { text-align: left; }
table.data th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
table.data thead th:first-child { z-index: 3; background: var(--surface-2); }
table.data tfoot th:first-child { background: var(--surface-2); }
table.data tbody tr { transition: background .1s ease; }
table.data tbody tr:hover, table.data tbody tr:hover th { background: var(--surface-2); }
.data-clean tbody tr:last-child th, .data-clean tbody tr:last-child td { border-bottom: 0; }
table.data.data-compact { max-width: 36rem; }
table.data.data-compact th, table.data.data-compact td { padding: .4rem .65rem; }
table.data.data-compact tbody th { min-width: 0; }
table.data th[aria-sort] { cursor: pointer; user-select: none; }
table.data th[data-sortable] { cursor: pointer; user-select: none; }
table.data th[data-sortable]:hover { color: var(--ink); }
table.data th[aria-sort="ascending"]::after { content: " ↑"; color: var(--accent); }
table.data th[aria-sort="descending"]::after { content: " ↓"; color: var(--accent); }
.muted-num, .fund-table .muted-num { color: var(--ink-3); }
@media (max-width: 40rem) {
  .data-clean { font-size: .82rem; }
  .data-clean .name { display: none; }
  table.data th, table.data td { padding: .5rem .5rem; }
  table.data th:first-child { padding-left: .75rem; }
  table.data td:last-child { padding-right: .75rem; }
  table.data tbody th { min-width: 0; }
}
.fund-table { font-size: .84rem; }
.fund-table th, .fund-table td { padding: .4rem .7rem; }
.fund-table tbody th { min-width: 14rem; }
.fund-table thead th a { color: inherit; }
.fund-table .section-row th {
  background: var(--surface-3); font-weight: 650; font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2);
}
.fund-table .col-ttm { background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.fund-table thead th .sub { font-weight: 500; text-transform: none; letter-spacing: 0; }
.peers-table .row-median th, .peers-table .row-median td, .row-median th, .row-median td { font-weight: 650; border-top: 1px solid var(--rule-strong); }
.row-own th, .row-own td { background: var(--accent-soft); }
.sensitivity .cell-center { font-weight: 700; background: var(--accent-soft); }
.doc-table td:first-child { min-width: 15rem; }
.list-table td { padding: .3rem .4rem; vertical-align: top; }
.list-table input, .list-table select { width: 100%; min-width: 9rem; }

/* Barra de peso dentro de una tabla */
.weight { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; }
.weight-bar { width: 4.5rem; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.weight-bar > span { display: block; height: 100%; background: var(--series-1); }

/* --- 9. Paneles desplegables --- */

details.panel {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow-1); margin: .75rem 0; overflow: hidden;
}
details.panel > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: .85rem;
  padding: .8rem 1.1rem; font-weight: 600; font-size: .92rem;
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before {
  content: ""; flex: none; width: .42rem; height: .42rem;
  border-right: 1.75px solid var(--ink-3); border-bottom: 1.75px solid var(--ink-3);
  transform: rotate(-45deg); transition: transform .15s ease;
}
details.panel[open] > summary::before { transform: rotate(45deg); }
details.panel > summary:hover { background: var(--surface-2); }
details.panel > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
details.panel[open] > summary { border-bottom: 1px solid var(--rule); }
details.panel > summary > span:first-child { white-space: nowrap; }
.summary-meta { margin-left: auto; font-weight: 400; color: var(--ink-3); font-size: .82rem; text-align: right; }
.panel-body { padding: 1rem 1.1rem 1.15rem; }
.panel-body > :first-child { margin-top: 0; }
.panel-body > :last-child { margin-bottom: 0; }
.panel-flush { border: 0; border-radius: 0; box-shadow: none; }
.panel-note { color: var(--ink-3); font-size: .82rem; margin: 0; padding: .7rem 1.1rem; border-top: 1px solid var(--rule); max-width: none; }
div.panel-note p { margin: 0 0 .5rem; max-width: none; }
div.panel-note p:last-child { margin-bottom: 0; }
.panel-warn { border-left: 3px solid var(--warn); }
.panel-warn .panel-body p { margin: 0 0 .5rem; }
.panel-subtitle { font-size: .95rem; margin: 1.25rem 0 .35rem; }
.panel-body h3, .split h3 { font-size: .92rem; margin: 1.5rem 0 .5rem; }
.split { display: grid; gap: 0 2rem; }
@media (min-width: 48rem) { .split { grid-template-columns: 1fr 1fr; } }
.split > div > h3 { margin-top: .5rem; }
@media (max-width: 40rem) { .summary-meta { font-size: .76rem; } }

.method { margin: 2rem 0 0; max-width: var(--measure); }
.method summary { cursor: pointer; font-weight: 600; }
.method li { margin-bottom: .5rem; }
.method ul { padding-left: 1.2rem; margin: 0; }
pre.command { background: var(--surface-2); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: .75rem 1rem; overflow-x: auto; }

/* --- 10. Gráficos --- */

.evolution { margin: 1rem 0 2rem; }
.periods { display: flex; flex-wrap: wrap; gap: .35rem; margin: .5rem 0 .25rem; }
.periods a {
  color: var(--ink-2); text-decoration: none; font-size: .82rem; font-weight: 500;
  border: 1px solid var(--rule-strong); border-radius: 999px; padding: .2rem .75rem; background: var(--surface);
}
.periods a:hover { color: var(--ink); border-color: var(--ink-3); }
.periods a[aria-current="true"] { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
figure.chart {
  margin: 0 0 1rem; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem 1rem .5rem;
}
figure.chart figcaption { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; align-items: baseline; margin-bottom: .5rem; }
.chart-title { font-weight: 600; font-size: .9rem; }
.legend { display: flex; flex-wrap: wrap; gap: .25rem 1rem; color: var(--ink-2); font-size: .8rem; }
.legend-item { display: inline-flex; align-items: center; gap: .4rem; }
.chart-key { display: inline-block; width: 14px; height: 0; border-top: 2px solid currentColor; }
.chart-key.series-1 { color: var(--series-1); }
.chart-key.series-2 { color: var(--series-2); }
.chart-area { position: relative; }
.chart-plot { width: 100%; min-height: 1px; }
.chart-plot svg { display: block; overflow: visible; }
.chart-plot svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chart-grid { stroke: var(--rule); stroke-width: 1; }
.chart-zero { stroke: var(--rule-strong); stroke-width: 1.25; }
.chart-axis { fill: var(--ink-3); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart-direct { fill: var(--ink-2); font-size: 11.5px; font-weight: 500; font-family: var(--font); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.chart-line { fill: none; stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.chart-line.series-1 { stroke: var(--series-1); }
.chart-line.series-2 { stroke: var(--series-2); stroke-dasharray: 0; }
.chart-dot { stroke: var(--surface); stroke-width: 2; }
.chart-dot.series-1 { fill: var(--series-1); }
.chart-dot.series-2 { fill: var(--series-2); }
.chart-cross { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-hit { fill: transparent; cursor: crosshair; }
.chart-bar.series-1 { fill: var(--series-1); }
.chart-bar.is-active { fill: var(--accent); }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none;
  background: var(--surface); color: var(--ink); border: 1px solid var(--rule-strong); border-radius: var(--radius-sm);
  padding: .5rem .7rem; font-size: .8rem; white-space: nowrap; box-shadow: var(--shadow-2); font-variant-numeric: tabular-nums;
}
.chart-tip-date { color: var(--ink-3); margin-bottom: .2rem; font-size: .75rem; }
.chart-tip-row { display: flex; align-items: center; gap: .5rem; }
.chart-tip-row span:last-child { color: var(--ink-2); }
.chart-nojs { color: var(--ink-3); font-size: .85rem; margin: 0; }
figure.chart.is-ready .chart-nojs { display: none; }
.chart-table { margin-top: .5rem; }
.chart-table summary { cursor: pointer; color: var(--ink-2); font-size: .85rem; }
.chart-table .table-wrap { margin-top: .75rem; }
#evolucion .chart:last-of-type { margin-bottom: 0; }

/* --- 11. Panel principal (inicio) --- */

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .5rem 1.5rem; margin-bottom: .25rem; }
.page-head h1 { margin: 0; }
.page-head .meta-line { margin: 0 0 .2rem; }
.dash-grid { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); margin-top: 1.25rem; }
@media (min-width: 70rem) { .dash-grid { grid-template-columns: minmax(0, 2fr) minmax(18rem, 1fr); } }
.card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-1);
  min-width: 0;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .85rem 1.1rem; border-bottom: 1px solid var(--rule);
}
.card-head h2 { margin: 0; font-size: 1.02rem; }
.card-head a { white-space: nowrap; font-size: .82rem; text-decoration: none; display: inline-flex; align-items: center; gap: .2rem; }
.card-head a:hover { text-decoration: underline; }
.card-body { padding: 1rem 1.1rem; }
.card .table-wrap { border: 0; border-radius: 0 0 var(--radius) var(--radius); box-shadow: none; }
.card figure.chart { border: 0; margin: 0; padding: .25rem 0 0; }
.attention { list-style: none; margin: 0; padding: 0; }
.attention li { display: flex; gap: .75rem; padding: .7rem 1.1rem; border-bottom: 1px solid var(--rule); align-items: flex-start; }
.attention li:last-child { border-bottom: 0; }
.attention .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: .45rem; background: var(--ink-3); }
.attention .dot-warn { background: var(--warn); }
.attention .dot-neg { background: var(--neg); }
.attention .dot-ok { background: var(--pos); }
.attention a { color: var(--ink); text-decoration: none; font-weight: 550; }
.attention a:hover { color: var(--accent); text-decoration: underline; }
.attention .detail { display: block; color: var(--ink-3); font-size: .8rem; }
.empty { padding: 1.25rem 1.1rem; color: var(--ink-3); font-size: .88rem; margin: 0; }
.alloc { list-style: none; margin: 0; padding: .4rem 1.1rem .9rem; }
.alloc li { display: grid; grid-template-columns: 1fr auto; gap: .2rem .75rem; padding: .45rem 0; font-size: .86rem; }
.alloc .bar { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.alloc .bar > span { display: block; height: 100%; background: var(--series-1); border-radius: 3px; }
.alloc .num { color: var(--ink-2); }
.stack-cards { display: grid; gap: 1.25rem; align-content: start; }
/* En pantallas estrechas, lo urgente va antes que el gráfico */
@media (max-width: 69.99rem) {
  .stack-cards { display: contents; }
  .card-first { order: -1; }
}
@media (max-width: 40rem) { .weight-bar { display: none; } }

/* --- 12. Ficha de empresa: cabecera tipo terminal y navegación por secciones --- */

.company-head { display: grid; gap: .75rem 2rem; grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.company-head h1 { margin: 0; }
.company-head .ticker { font-family: var(--font); font-size: .78rem; font-weight: 700; letter-spacing: .08em; color: var(--accent); }
.quote { text-align: right; }
.quote-price { font-size: 1.9rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.quote-meta { color: var(--ink-3); font-size: .78rem; }
@media (max-width: 40rem) { .company-head { grid-template-columns: 1fr; } .quote { text-align: left; } }
.subnav {
  position: sticky; top: 60px; z-index: 15; display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none;
  margin: 1rem 0 0; padding: .4rem 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}
.subnav::-webkit-scrollbar { display: none; }
.subnav a {
  flex: none; color: var(--ink-2); text-decoration: none; font-size: .85rem; font-weight: 550;
  padding: .35rem .75rem; border-radius: var(--radius-sm);
}
.subnav a:hover { background: var(--surface-3); color: var(--ink); }
.statline {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  margin: 1rem 0; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.statline div { padding: .7rem 1rem; border-left: 1px solid var(--rule); }
.statline div:first-child { border-left: 0; }
.statline dt { color: var(--ink-3); font-size: .68rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; }
.statline dd { margin: .15rem 0 0; font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.statline dd .sub { display: inline; font-size: .75rem; font-weight: 400; color: var(--ink-3); }
@media (max-width: 40rem) { .statline { grid-template-columns: 1fr 1fr; } .statline div { border-left: 0; border-top: 1px solid var(--rule); } .statline div:nth-child(-n+2) { border-top: 0; } .statline div:nth-child(even) { border-left: 1px solid var(--rule); } }

/* --- 13. Paleta de órdenes (Ctrl + K) --- */

dialog.cmdk {
  width: min(40rem, calc(100vw - 2rem)); max-height: min(32rem, 80vh); padding: 0; margin: 12vh auto 0;
  background: var(--surface); color: var(--ink); border: 1px solid var(--rule-strong); border-radius: 12px; box-shadow: var(--shadow-2);
  overflow: hidden;
}
dialog.cmdk::backdrop { background: rgb(8 14 22 / 45%); backdrop-filter: blur(2px); }
.cmdk-field { display: flex; align-items: center; gap: .6rem; padding: 0 1rem; border-bottom: 1px solid var(--rule); }
.cmdk-field .icon { color: var(--ink-3); }
.cmdk-field input { border: 0; box-shadow: none; height: 52px; font-size: 1rem; padding: 0; background: none; }
.cmdk-field input:focus { box-shadow: none; }
.cmdk-list { list-style: none; margin: 0; padding: .4rem; overflow-y: auto; max-height: calc(min(32rem, 80vh) - 96px); }
.cmdk-group { padding: .6rem .6rem .25rem; font-size: .68rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.cmdk-item a { display: flex; align-items: center; gap: .7rem; padding: .5rem .6rem; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; }
.cmdk-item a .icon { color: var(--ink-3); }
.cmdk-item .cmdk-meta { margin-left: auto; color: var(--ink-3); font-size: .8rem; }
.cmdk-item[aria-selected="true"] a { background: var(--accent-soft); }
.cmdk-empty { padding: 1.25rem; color: var(--ink-3); text-align: center; }
.cmdk-foot { display: flex; gap: 1rem; padding: .5rem 1rem; border-top: 1px solid var(--rule); color: var(--ink-3); font-size: .75rem; background: var(--surface-2); }

/* --- 14. Pantallas concretas (se conservan sus clases) --- */

/* Acerca de: fases del proyecto */
.hero { padding-bottom: 1.5rem; border-bottom: 1px solid var(--rule); }
.phases { list-style: none; counter-reset: fase; margin: 0; padding: 0; }
.phases li { counter-increment: fase; display: grid; grid-template-columns: 2.25rem 1fr; column-gap: 1rem; padding: .85rem 0; border-top: 1px solid var(--rule); }
.phases li::before {
  content: counter(fase); grid-row: span 2; width: 1.75rem; height: 1.75rem; display: grid; place-items: center;
  border: 1px solid var(--rule-strong); border-radius: 50%; color: var(--ink-2); font-weight: 600; font-size: .82rem;
}
.phases li.is-current::before { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.phases strong { font-weight: 600; }
.phases span { color: var(--ink-2); }
.facts { margin: 1.5rem 0 0; display: grid; gap: 0; max-width: var(--measure); }
.facts div { display: grid; grid-template-columns: 9rem 1fr; gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--rule); }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; }
.facts .author { font-weight: 650; }
@media (max-width: 30rem) { .facts div { grid-template-columns: 1fr; gap: .1rem; } }

/* Verificación en dos pasos */
.steps { padding-left: 1.25rem; }
.steps li { margin-bottom: 1.5rem; padding-left: .25rem; }
.steps li > strong { display: block; margin-bottom: .25rem; }
.steps li > span { display: block; color: var(--ink-2); }
.steps-plain { padding-left: 1.25rem; max-width: var(--measure); }
.steps-plain li { margin-bottom: .5rem; }
.steps-compact { padding-left: 1.25rem; margin: .5rem 0 1rem; }
.steps-compact li { margin-bottom: .4rem; }
.qr { display: block; margin: 1rem 0; background: #ffffff; border: 1px solid var(--rule); border-radius: var(--radius-sm); }
.secret, .recovery-codes code { font-family: var(--mono); font-size: 1rem; letter-spacing: .05em; }
.secret { display: inline-block; margin-top: .5rem; padding: .35rem .6rem; background: var(--surface-2); border-radius: var(--radius-sm); }
.recovery-codes { list-style: none; padding: 0; margin: 1.5rem 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .5rem; }
.recovery-codes li { background: var(--surface-2); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: .5rem .75rem; }
.hint code { white-space: nowrap; }

/* Alertas */
.settings { margin-top: 1rem; }
.rule-list { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); }
.rule-list-flush { border: 0; border-radius: 0; box-shadow: none; }
.rule { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1.5rem; padding: .8rem 1.1rem; border-top: 1px solid var(--rule); }
.rule:first-child { border-top: 0; }
.rule .hint { display: block; font-size: .84rem; }
.check { display: flex; gap: .75rem; align-items: flex-start; cursor: pointer; flex: 1 1 20rem; }
.check input { width: 1.05rem; height: 1.05rem; margin-top: .25rem; flex: none; }
.threshold, .quiet { display: inline-flex; align-items: center; gap: .5rem; color: var(--ink-2); font-size: .88rem; }
.quiet { gap: 1rem; }
.threshold input, .quiet input { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); padding: .3rem .5rem; }
.threshold input { width: 4.5rem; text-align: right; }

/* Ficha de valor */
.price-alerts { list-style: none; padding: 0; margin: 1rem 0; max-width: 40rem; }
.price-alerts li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .5rem .85rem; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface); margin-bottom: .5rem; }
.price-alerts form { margin: 0; }

/* Incidencias */
.issue-text { display: block; font-size: .86rem; color: var(--ink-2); max-width: none; white-space: normal; }
table.data tbody th .issue-text { max-width: none; }
.issue-list { list-style: none; margin: 1rem 0; padding: 0; }
.issue { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: flex-start; justify-content: space-between; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); padding: .85rem 1.1rem; margin-bottom: .6rem; box-shadow: var(--shadow-1); }
.issue.is-open { border-left: 3px solid var(--warn); }
.issue-main { flex: 1 1 20rem; min-width: 0; }
.issue-main p { margin: .25rem 0 0; overflow-wrap: anywhere; }
.issue-meta { color: var(--ink-3); font-size: .8rem; }

/* Valoración */
.valuation-form h2 { margin-top: 1.75rem; }
.scenario-table th[scope="row"] { font-weight: 600; }
.scenario-table th .sub { display: block; font-weight: 400; color: var(--ink-3); }
.scenario-table { table-layout: fixed; }
.scenario-table thead th:first-child { width: 34%; }
/* Todo lo que escribes en una valoración va en campos sombreados; lo calculado, en blanco */
.scenario-table td input, .valuation-form .field-grid input { background: var(--surface-3); border-color: transparent; }
.scenario-table td input:focus, .valuation-form .field-grid input:focus { background: var(--surface); border-color: var(--accent); }
@media (max-width: 640px) { .scenario-table td.num { padding-left: .3rem; padding-right: .3rem; } .scenario-table .input-pct { padding: .5rem .4rem; } }
.capm-line { margin: 0; }

/* Tesis y diario */
.thesis-meta input, .thesis-meta select, .journal-form .field-grid input, .journal-form .field-grid select { max-width: 18rem; width: 100%; }
.thesis-meta input[type="text"] { text-align: right; }
.diff del { color: var(--neg); background: var(--neg-soft); text-decoration: line-through; }
.diff ins { color: var(--pos); background: var(--pos-soft); text-decoration: none; }
.claims { list-style: none; padding: 0; max-width: none; }
.claims li { padding: .5rem 0; border-bottom: 1px solid var(--rule); }
.plain-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.plain-list li { padding: .35rem 0; }
.journal { list-style: none; padding: 0; margin: 0 0 1.25rem; max-width: none; }
.journal li { padding: .6rem 0; border-bottom: 1px solid var(--rule); }
.journal-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.journal-delete { margin: 0 0 0 auto; }
.helper-data { max-width: none; margin: .3rem 0 .45rem; padding: .55rem .8rem; border-left: 2px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: .86rem; }
.helper-data p { margin: .25rem 0 0; }

/* Documentos */
.doc-form .field-grid input, .doc-form .field-grid select { max-width: 22rem; width: 100%; }
.doc-form input[type="file"] { font: inherit; font-size: .88rem; }
.doc-delete { margin: 0; gap: .5rem; flex-wrap: nowrap; }
.doc-delete label { font-size: .8rem; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Iconos de aviso dentro del texto */
.warn-title { display: inline-flex; align-items: center; gap: .5rem; }
.warn-title .icon, .warn-inline .icon { color: var(--warn); }
.warn-inline { display: inline-flex; align-items: center; gap: .3rem; }
.warn-inline .icon { width: 14px; height: 14px; }

/* Al saltar a una sección, que no quede tapada por la barra superior y el índice */
details.panel, h2[id] { scroll-margin-top: 7.5rem; }
.company-actions { margin: 1rem 0 0; gap: .5rem; }
.company-actions .icon { width: 16px; height: 16px; }

/* Un único bloque de avisos al principio de la página */
.notice {
  display: flex; gap: .75rem; align-items: flex-start; max-width: none; margin: 1rem 0;
  padding: .75rem 1rem; border-radius: var(--radius-sm);
  background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  font-size: .9rem;
}
.notice > .icon { color: var(--warn); margin-top: .15rem; }
.notice-body { min-width: 0; }
.notice-body > p { margin: 0 0 .35rem; }
.notice-body > :last-child { margin-bottom: 0; }
.notice details summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
.notice details p { margin: .35rem 0 0; }

/* Pestañas entre métodos de valoración */
.tabs { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; margin: .9rem 0 1rem; border-bottom: 1px solid var(--rule); }
.tabs a {
  flex: none; padding: .5rem .9rem; margin-bottom: -1px; color: var(--ink-2); text-decoration: none;
  font-size: .9rem; font-weight: 550; border-bottom: 2px solid transparent;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* Supuestos frente a resultado */
.step-label {
  margin: 2rem 0 -.25rem; font-size: .72rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
}
.kpis-result { border-top: 3px solid var(--accent); }
.result-jump {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .6rem; max-width: none; margin: 1rem 0;
  padding: .7rem 1rem; border-radius: var(--radius-sm); text-decoration: none; color: var(--ink);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.result-jump:hover { color: var(--ink); border-color: var(--accent); }
.result-jump strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.result-jump-label { font-size: .72rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.result-jump-go { margin-left: auto; display: inline-flex; align-items: center; gap: .2rem; color: var(--accent); font-size: .85rem; font-weight: 600; }
.result-jump-go .icon { width: 16px; height: 16px; }
.step-label + h2, .step-label + .valuation-form > h2:first-of-type { margin-top: .4rem; }

/* Formularios largos (tesis): índice fijo arriba y botón de guardar siempre a mano */
.form-toc { margin-bottom: .5rem; }
.thesis-form h2[id], .thesis-form [id="cambio"] { scroll-margin-top: 7.5rem; }
.sticky-actions {
  position: sticky; bottom: 0; z-index: 10; margin: 1.5rem -1rem 0; padding: .75rem 1rem;
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(6px);
  border-top: 1px solid var(--rule);
}

/* Ajustes y administración */
.settings-card { margin: 1.25rem 0; }
.settings-card .card-body > :first-child { margin-top: 0; }
.stack-narrow { max-width: 28rem; }
.facts-compact { margin: 0 0 1rem; }
.facts-compact div { grid-template-columns: 11rem 1fr; padding: .45rem 0; }
.notice-ok { background: var(--pos-soft); border-color: color-mix(in srgb, var(--pos) 30%, transparent); }
.copy-text { display: inline-block; padding: .35rem .6rem; background: var(--surface); border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); overflow-wrap: anywhere; user-select: all; }
.row-actions { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }
.row-actions .inline-form { margin: 0; }

/* --- 15. Ayuda y curso --- */

.doc-layout { display: grid; gap: 1.5rem 2.5rem; grid-template-columns: minmax(0, 1fr); margin-top: 1rem; }
@media (min-width: 70rem) { .doc-layout { grid-template-columns: 15rem minmax(0, 1fr); } }
.doc-toc { align-self: start; }
@media (min-width: 70rem) { .doc-toc { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; } }
.doc-toc p { margin: 0 0 .4rem; font-size: .7rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.doc-toc ol, .doc-toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); }
.doc-toc a { display: block; padding: .3rem .8rem; margin-left: -1px; border-left: 2px solid transparent; color: var(--ink-2); text-decoration: none; font-size: .86rem; }
.doc-toc a:hover { color: var(--ink); border-left-color: var(--rule-strong); }
@media (max-width: 69.99rem) {
  .doc-toc ol, .doc-toc ul { display: flex; flex-wrap: wrap; gap: .25rem; border: 0; }
  .doc-toc a { border: 1px solid var(--rule-strong); border-radius: 999px; padding: .2rem .7rem; margin: 0; background: var(--surface); }
}
.doc { min-width: 0; line-height: 1.65; }
.doc > section { padding-bottom: .5rem; scroll-margin-top: 5rem; }
.doc > section + section { border-top: 1px solid var(--rule); margin-top: 1.75rem; }
.doc h2 { margin-top: 1.5rem; scroll-margin-top: 5rem; }
.doc h3 { margin-top: 1.4rem; }
.doc li { margin: .3rem 0; }
.doc ol.steps-doc { padding-left: 1.4rem; }
.doc ol.steps-doc > li { margin: .6rem 0; padding-left: .25rem; }
.doc kbd { font-size: .75rem; }
.box {
  margin: 1rem 0; padding: .85rem 1.1rem; border-radius: var(--radius); border: 1px solid var(--rule);
  background: var(--surface);
}
.box > :first-child { margin-top: 0; }
.box > :last-child { margin-bottom: 0; }
.box-title { display: flex; align-items: center; gap: .5rem; margin: 0 0 .4rem; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.box-title .icon { width: 16px; height: 16px; }
.box-formula { background: var(--surface-2); border-left: 3px solid var(--accent); }
.box-formula .formula { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 1rem; margin: .2rem 0; }
.box-example { border-left: 3px solid var(--series-2); }
.box-app { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.box-app .box-title { color: var(--accent); }
.box-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.box-warn .box-title { color: var(--warn); }
.box table.data { margin: .5rem 0; }
.example-table { max-width: 40rem; }
.quiz { margin: 1rem 0; }
.quiz details { border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface); margin: .5rem 0; }
.quiz summary { cursor: pointer; padding: .65rem .9rem; font-weight: 600; }
.quiz summary:hover { background: var(--surface-2); }
.quiz details[open] summary { border-bottom: 1px solid var(--rule); }
.quiz details > div { padding: .65rem .9rem; }
.quiz details > div > :first-child { margin-top: 0; }
.quiz details > div > :last-child { margin-bottom: 0; }
.lesson-meta { color: var(--ink-3); font-size: .84rem; margin: .25rem 0 0; }
.lesson-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin: 2.5rem 0 0; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.lesson-nav a { display: flex; flex-direction: column; gap: .1rem; max-width: 48%; text-decoration: none; padding: .7rem 1rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.lesson-nav a:hover { border-color: var(--accent); }
.lesson-nav a span { font-size: .72rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.lesson-nav a strong { color: var(--ink); font-weight: 600; }
.lesson-nav .next { margin-left: auto; text-align: right; }
.lessons { list-style: none; margin: 1.25rem 0; padding: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); counter-reset: leccion; }
.lessons li { counter-increment: leccion; }
.lessons a {
  display: grid; grid-template-columns: 2.25rem 1fr; gap: .1rem .9rem; height: 100%;
  padding: 1rem 1.1rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow-1); text-decoration: none; color: var(--ink);
}
.lessons a::before {
  content: counter(leccion); grid-row: span 3; width: 2rem; height: 2rem; display: grid; place-items: center;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .9rem;
}
.lessons a:hover { border-color: var(--accent); }
.lessons strong { font-weight: 600; }
.lessons .muted { font-size: .86rem; }
.lessons .lesson-time { font-size: .76rem; color: var(--ink-3); }
.lessons a.is-done::before { content: "✓"; background: var(--pos-soft); color: var(--pos); }
.lessons a { align-content: start; }
.example-table table.data.data-compact { max-width: none; }

/* Recomendación de primeros pasos en el panel */
.hint-card { margin: 1rem 0 0; border-left: 3px solid var(--accent); background: linear-gradient(to right, var(--accent-soft), var(--surface) 60%); }
.hint-card h2 { margin: .2rem 0 .5rem; }
.hint-card .step-label { margin: 0; }
.hint-card .actions-row { margin: 1rem 0 .5rem; }
.settings-card, section.card[id] { scroll-margin-top: 5rem; }
