/* Sistema de diseño de NevadoRates (lienzo "NevadoRates — dirección de
   diseño"): panel (index.html), /cuenta, /admin y /demo.
   - Tipografías: Newsreader (titulares, lectura), IBM Plex Sans (interfaz),
     IBM Plex Mono (cifras). Se cargan desde Google Fonts en cada página.
   - Color con significado: tinta = tu hotel; verde agua = el mercado; señal
     (rojo) solo para alertas. Estar arriba o abajo del mercado no es bueno
     ni malo: se lee contra el objetivo de cada hotel.
   - Líneas antes que cajas: reglas finas y espacio; recuadros solo para
     objetos aparte (diálogos, campos). */
:root {
  color-scheme: light;
  --page: #F6F4EE;          /* nieve */
  --surface: #FBFAF6;       /* diálogos, menús */
  --field: #FFFFFF;
  --bar: #F6F4EE;
  --ink: #1B2B45;           /* tinta */
  --ink-2: #3B4A63;
  --muted: #5B6472;         /* roca */
  --rule: #DAD6CC;
  --grid: #E4E0D6;
  --axis: #B9B4A8;
  --tint: #EFECE4;          /* en tu objetivo, fines de semana */
  --hover: rgba(27, 43, 69, 0.05);
  --mark: #7DB9AC;          /* verde agua: el mercado */
  --mark-deep: #2F7D6F;     /* texto en verde agua */
  --signal: #C2412D;        /* solo alertas */
  --warning: #D9A21E;       /* precio fuera de escala */
  --good: #2F7D6F;
  --critical: #C2412D;
  --own: #1B2B45;           /* línea de tu hotel */
  --other: #B9B4A8;         /* cada competidor */
  --below: #2F7D6F;         /* más barato que tu objetivo */
  --above: #1B2B45;         /* más caro que tu objetivo */
  --shadow: 0 12px 40px rgba(17, 26, 41, 0.14);
  --sk-base: #ECE9E1;
  --serif: 'Newsreader', Georgia, serif;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  /* Compatibilidad con nombres anteriores (cuenta/admin/shell.js). */
  --series-1: var(--own);
  --series-2: var(--mark);
  --border: var(--rule);
  --surface-2: var(--tint);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #111A29;
  --surface: #172234;
  --field: #0E1624;
  --bar: #111A29;
  --ink: #ECEAE4;
  --ink-2: #C4C8CF;
  --muted: #9AA3B2;
  --rule: #2A3548;
  --grid: #223047;
  --axis: #3C4A62;
  --tint: #1B273B;
  --hover: rgba(236, 234, 228, 0.06);
  --mark: #7DB9AC;
  --mark-deep: #8ED0C1;
  --signal: #E0664F;
  --warning: #E6B640;
  --good: #8ED0C1;
  --critical: #E0664F;
  --own: #ECEAE4;
  --other: #4A5870;
  --below: #7DB9AC;
  --above: #ECEAE4;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --sk-base: #1B273B;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--mark-deep); }
h1, h2, h3 { margin: 0; }
h1 { font-size: 18px; font-weight: 600; }
h2 { font-family: var(--serif); font-weight: 500; font-size: 26px; letter-spacing: -0.005em; line-height: 1.2; }
.sub { color: var(--muted); font-size: 14px; }
.muted { color: var(--muted); }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--mark-deep); outline-offset: 2px; }

main { max-width: 1280px; margin: 0 auto; padding: 0 40px 72px; }

/* ---------- Barra superior ---------- */
.topbar { background: var(--bar); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 10; }
.topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 40px; min-height: 64px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 32px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand h1, .brand .wordmark { font-size: 19px; font-weight: 400; letter-spacing: -0.01em; }
.brand b { font-weight: 700; }
.brand svg { flex: none; }
.nav { display: flex; align-items: stretch; gap: 24px; align-self: stretch; }
.nav a { color: var(--muted); text-decoration: none; font-size: 15px; display: flex; align-items: center; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.run-status { flex: 1; min-width: 160px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: var(--ink-2); font-size: 14px; }
.run-status .dot { flex: none; }
.head-right { display: flex; align-items: center; gap: 10px; }
.who { color: var(--muted); font-size: 14px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Botones ---------- */
.btn-primary, .btn-ghost, .btn-danger {
  font: 500 14px var(--sans); min-height: 40px; padding: 0 18px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap;
}
.btn-primary { color: var(--page); background: var(--ink); border: 1px solid var(--ink); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.15); color: var(--page); }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-ghost { color: var(--ink); background: transparent; border: 1px solid var(--rule); }
.btn-ghost:hover { background: var(--hover); color: var(--ink); }
.btn-ghost.icon { width: 40px; padding: 0; }
.btn-danger { color: var(--critical); background: transparent; border: 1px solid color-mix(in oklab, var(--critical) 45%, transparent); }
.btn-danger:hover { background: color-mix(in oklab, var(--critical) 8%, transparent); }
.btn-sm { min-height: 32px !important; padding: 0 12px !important; font-size: 13px !important; }
.linkish { font: inherit; font-size: 14px; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }

/* Pastillas (filtros del panel). */
.pills { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.pill {
  font: 500 14px var(--sans); color: var(--ink); background: transparent; border: 1px solid var(--rule);
  min-height: 40px; padding: 0 16px; border-radius: 999px; cursor: pointer;
}
.pill:hover { background: var(--hover); }
.pill[aria-pressed="true"] { background: var(--ink); color: var(--page); border-color: var(--ink); }
.pill.locked { color: var(--muted); border-style: dashed; }

/* Plan: candado de lo que el plan no incluye, aviso de prueba y comparación de planes. */
.lock { vertical-align: -1px; margin-left: 5px; color: var(--muted); flex: none; }
.plan-note { margin-top: 28px; padding: 12px 16px; background: var(--tint); font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.plan-note + .lede { padding-top: 32px; }
/* Mismo aviso dentro de una sección plegable (nombres que se ven solo para la competencia). */
.fold-body > .plan-note:first-child { margin: 4px 0 14px; }
/* Nombre oculto por el plan: lleva a lo que lo muestra (competencia o planes). */
.linkish.anon { font-size: inherit; text-align: left; text-decoration-style: dotted; }
.plans th, .plans td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; font-size: 14px; white-space: normal; }
.plans thead th { font-family: var(--serif); font-size: 19px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink); border-bottom: 2px solid var(--ink); }
.plans tbody th { font-weight: 500; color: var(--ink-2); }
.plans .cur { background: var(--tint); }
dialog#plans-dlg { width: min(760px, calc(100vw - 32px)); }
select {
  font: 500 14px var(--sans); color: var(--ink); background: var(--field); border: 1px solid var(--rule);
  min-height: 40px; padding: 0 12px; border-radius: 999px;
}

/* ---------- Panel: lectura del día ---------- */
.lede { padding: 48px 0 0; display: flex; flex-direction: column; gap: 18px; }
.kicker { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; color: var(--muted); }
.headline { font-family: var(--serif); font-weight: 400; font-size: 48px; line-height: 1.12; letter-spacing: -0.015em; max-width: 1100px; }
.deck { margin: 0; font-family: var(--serif); font-size: 22px; line-height: 1.45; color: var(--ink-2); max-width: 1000px; }
.deck:empty { display: none; }
.lede-cta { display: flex; gap: 12px; }
.figure .note .linkish { font-size: 13px; }

.figures { margin-top: 36px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); }
.figure { padding: 18px 24px 20px; display: flex; flex-direction: column; gap: 6px; border-left: 1px solid var(--rule); min-width: 0; }
.figure:first-child { padding-left: 0; border-left: 0; }
.figure .label { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.figure .label button { font: 500 13px var(--sans); background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.figure .value { font-family: var(--mono); font-size: 32px; font-weight: 500; line-height: 1.15; }
.figure .value small { font-size: 16px; color: var(--muted); font-weight: 400; }
.figure .value.market { color: var(--mark-deep); }
.figure .note { font-size: 13px; color: var(--muted); }

/* Filtros: arriba de todo y fijos al bajar, porque todo lo de la página los sigue.
   En el celular se pliegan en un botón con el resumen de lo elegido. */
.controls {
  position: sticky; top: var(--topbar-h, 64px); z-index: 9;
  margin: 0 -40px; padding: 12px 40px; background: var(--page); border-bottom: 1px solid var(--rule);
}
.filters-body { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.filters-toggle { display: none; }
.controls .sep { width: 1px; height: 24px; background: var(--rule); }
.controls label { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.controls select { max-width: 220px; }
.pills-label { align-self: center; font-size: 14px; color: var(--muted); margin-right: 2px; }
.controls .push { margin-left: auto; }
.controls + .plan-note { margin-top: 20px; }
.figures.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Bloque sin datos: una línea, no un bloque vacío. */
.block-empty { margin-top: 32px; }
.block-empty p { margin: 0; font-size: 15px; color: var(--ink-2); }

/* Sección plegable (Todas las tarifas). */
.fold summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 14px; padding: 6px 0; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: 'Abrir ▸'; margin-left: auto; font-size: 14px; color: var(--ink); }
.fold[open] summary::after { content: 'Cerrar ▾'; }
.fold .fold-sub { font-size: 14px; color: var(--muted); }
.fold-block { margin-top: 0; border-top: 1px solid var(--rule); padding-top: 10px; }
.fold-block + .fold-block { margin-top: 0; }
.fold-body { padding-top: 6px; display: flex; flex-direction: column; gap: 14px; }
section.block + .fold-block { margin-top: 48px; }

/* Noches para revisar: una fila por noche con lo que la mueve. */
.group-label { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600; color: var(--muted); padding-top: 6px; }
.review { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.review li { border-bottom: 1px solid var(--rule); }
.rv {
  width: 100%; display: grid; grid-template-columns: 150px 160px minmax(0, 1fr) 240px; gap: 20px; align-items: center;
  padding: 16px 0; background: none; border: 0; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
}
.rv:hover { background: var(--hover); }
.rv-day { display: flex; flex-direction: column; gap: 3px; }
.rv-day b { font-family: var(--serif); font-weight: 400; font-size: 21px; }
.rv-day span, .rv-verdict > span:not(.tag-v) { font-size: 13px; color: var(--muted); }
.rv-price { display: flex; flex-direction: column; gap: 3px; font-family: var(--mono); }
.rv-price span:first-child { font-size: 19px; font-weight: 500; }
.rv-price span:last-child { font-size: 13px; color: var(--ink-2); }
.rv-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--tint); color: var(--ink); }
.rv-verdict { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.tag-v { font-size: 14px; font-weight: 600; padding: 3px 9px; }
.compact-list { border-top: 1px solid var(--rule); }
.rv.compact { padding: 11px 0; font-size: 14px; }
.rv.compact .rv-day { font-weight: 600; }
.rv.compact .rv-price { font-size: 14px; }
.rv.compact .rv-why { color: var(--ink-2); }
.rv.compact .tag-v { font-size: 13px; }

/* Demanda de la noche: 1 a 3 puntos. */
.dem { display: inline-flex; gap: 3px; align-items: center; margin-right: 6px; }
.dem-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--rule); display: inline-block; }
.dem-dot.on { background: var(--ink); }
.day .dem { margin: 0 0 0 auto; }

/* Calendario / Gráfico en pestañas. */
.tabs.view-tabs { margin-bottom: 8px; }
.view-legend { margin-bottom: 4px; }

/* Vista de una noche. */
dialog.night-dlg { width: min(680px, calc(100vw - 32px)); }
/* Asistente de configuración inicial (competencia y objetivo). */
dialog.setup-dlg { width: min(640px, calc(100vw - 32px)); }
.setup-dlg .setup-pct { margin-top: 18px; max-width: 220px; }
.setup-later { margin: 18px 0 0; font-size: 13px; color: var(--muted); }
.setup-scroll { max-height: min(46vh, 420px); overflow-y: auto; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 8px 2px; }
.setup-search {
  width: 100%; margin: 0 0 12px; font: 400 15px var(--sans); color: var(--ink); background: var(--field);
  border: 1px solid var(--rule); border-radius: 999px; min-height: 40px; padding: 0 16px;
}
.set-list li[hidden] { display: none; }
/* Celular: el contador ("2 de 4 hoteles") en su línea, los dos botones abajo. */
@media (max-width: 520px) {
  .setup-dlg .dlg-actions { flex-wrap: wrap; }
  .setup-dlg .dlg-actions .count { flex-basis: 100%; }
  .setup-dlg .dlg-actions button { flex: 1; }
  .setup-scroll { max-height: 30vh; }
}
.night-dlg .kicker { margin-bottom: 4px; }
.nv-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 6px 0 16px; border-bottom: 1px solid var(--rule); }
.nv-figs span { display: block; font-size: 12px; color: var(--muted); }
.nv-figs b { font-family: var(--mono); font-size: 24px; font-weight: 500; }
.nv-figs b.market { color: var(--mark-deep); }
.nv-verdict { margin-top: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.nv-verdict > b { font-size: 15px; }
.nv-band { font-family: var(--mono); font-size: 18px; font-weight: 500; }
.nv-lines { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.nv-lines li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.nv-lines li > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.nv-lines li > span:last-child span { font-size: 13px; color: var(--ink-2); }
.nv-kind { flex: none; width: 104px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.nv-table tr.own td { font-weight: 700; }
.nv-table td .linkish { font-size: 14px; text-align: left; }

.block { margin-top: 56px; display: flex; flex-direction: column; gap: 14px; }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend span[hidden] { display: none; }
.swatch { width: 18px; height: 3px; display: inline-block; }
.swatch.box { height: 12px; width: 14px; }
.foot-note { font-size: 13px; color: var(--muted); }

/* ---------- Gráfico ---------- */
#chart { position: relative; }
#chart svg { display: block; width: 100%; overflow: visible; }
#chart text { fill: var(--muted); font: 12px var(--mono); font-variant-numeric: tabular-nums; }
#chart text.lbl { font: 600 13px var(--sans); }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 220px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 6px;
  box-shadow: var(--shadow); padding: 10px 12px; font-size: 13px; display: none;
}
.tooltip .t-head { font-weight: 600; margin-bottom: 6px; }
.tooltip .row { display: flex; justify-content: space-between; gap: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tooltip .row span:last-child { font-family: var(--mono); }
.tooltip .row.hl { color: var(--ink); font-weight: 600; }
.tooltip .row.med { color: var(--mark-deep); }

/* ---------- Calendario de posición ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .dow { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 0 0 4px 2px; font-weight: 500; }
.cal .dow.we { color: var(--ink); font-weight: 700; }
.cal .month { grid-column: 1 / -1; font-family: var(--serif); font-size: 20px; padding: 14px 0 2px; }
.cal .gap-cell { min-height: 84px; }
.day {
  min-height: 84px; border: 0; border-top: 1px solid var(--rule); padding: 9px 11px; text-align: left;
  display: flex; flex-direction: column; justify-content: space-between; gap: 6px;
  font: inherit; color: var(--ink); background: var(--tint); cursor: pointer; min-width: 0;
}
.day:hover { outline: 2px solid var(--ink); outline-offset: -2px; }
.day[disabled] { cursor: default; background: transparent; color: var(--muted); }
.day[disabled]:hover { outline: none; }
.day .top { display: flex; justify-content: space-between; gap: 6px; font-size: 13px; color: var(--ink-2); }
.day .bottom { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.day .price { font-family: var(--mono); font-size: 20px; font-weight: 500; }
.day .diff { font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
.day .diff.off { font-weight: 600; color: var(--ink); }
.day .stay { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; }
/* Cruceros que zarpan, feriados (número subrayado) y noches de finde largo (línea arriba). */
.ship { vertical-align: -1px; margin-right: 2px; flex: none; }
.day .ev { font-size: 11px; font-weight: 600; color: var(--ink-2); white-space: nowrap; margin-left: auto; }
.day.lw { box-shadow: inset 0 3px 0 var(--mark); }
.hol { text-decoration: underline dotted; text-underline-offset: 3px; font-weight: 700; color: var(--ink); }
.prices thead tr.days th .ev { display: block; font-size: 10px; font-weight: 600; color: var(--ink-2); letter-spacing: 0; }

/* Noches fuera del objetivo (lista; sobre todo en el celular). */
.watch { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.watch li { border-bottom: 1px solid var(--rule); }
.watch button {
  width: 100%; min-height: 60px; padding: 10px 0; background: none; border: 0; cursor: pointer; font: inherit; color: var(--ink);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left;
}
.watch .sw { width: 10px; height: 10px; flex: none; align-self: flex-start; margin-top: 6px; }
.watch .who2 { display: flex; align-items: center; gap: 10px; }
.watch .t { display: flex; flex-direction: column; gap: 2px; }
.watch .t b { font-size: 15px; }
.watch .t span { font-size: 13px; color: var(--muted); }
.watch .p { display: flex; flex-direction: column; align-items: flex-end; font-family: var(--mono); white-space: nowrap; }
.watch .p span:last-child { font-size: 13px; color: var(--ink-2); }

/* ---------- Tablas ---------- */
.scroll { overflow-x: auto; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--rule); }
thead th { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; color: var(--muted); background: var(--page); }
.board { border-top: 2px solid var(--ink); }
.board th:first-child, .board td:first-child { text-align: left; padding-left: 0; }
.board td { font-size: 15px; padding-top: 12px; padding-bottom: 12px; }
.board td.num { font-family: var(--mono); }
.board tr.own td { font-weight: 600; }
.board td.trend { padding-left: 32px; text-align: left; }

/* Todas las tarifas: hotel × noche. */
.scroll.prices { overflow: auto; max-height: 75vh; border-top: 2px solid var(--ink); }
/* Barras propias, finas y en los tonos de la app (sin las flechas de Windows).
   Chrome, Edge y Safari usan las ::-webkit- (sin flechas: la versión "thin"
   estándar de Chrome todavía las dibuja); Firefox, las estándar. */
@supports not selector(::-webkit-scrollbar) {
  .scroll.prices { scrollbar-width: thin; scrollbar-color: var(--axis) transparent; }
  .scroll.prices:hover { scrollbar-color: var(--muted) transparent; }
}
.scroll.prices::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll.prices::-webkit-scrollbar-track, .scroll.prices::-webkit-scrollbar-corner { background: transparent; }
.scroll.prices::-webkit-scrollbar-thumb { background: var(--axis); border-radius: 4px; }
.scroll.prices::-webkit-scrollbar-thumb:hover { background: var(--muted); }
/* Quedan noches a la derecha: el borde se desvanece (priceFade en index.html). */
.prices-wrap { position: relative; }
.prices-wrap::after {
  content: ""; position: absolute; top: 0; right: var(--sb-w, 0px); bottom: var(--sb-h, 0px); width: 56px;
  background: linear-gradient(to right, transparent, var(--page)); pointer-events: none; opacity: 0; transition: opacity 0.2s;
}
.prices-wrap.more-right::after { opacity: 1; }
.prices thead th { position: sticky; top: 0; z-index: 2; }
.prices th.name, .prices td.name { text-align: left; position: sticky; left: 0; background: var(--page); z-index: 1; min-width: 200px; }
.prices thead th.name { z-index: 3; }
.prices thead th.we { color: var(--ink); font-weight: 700; }
.prices thead tr.months th { text-align: left; font-family: var(--serif); text-transform: none; letter-spacing: 0; font-size: 16px; font-weight: 500; color: var(--ink); padding: 8px 8px 2px; border-bottom: 0; }
.prices thead tr.days th { top: var(--months-h, 29px); }
.month-label { position: sticky; left: calc(var(--name-w, 200px) + 8px); }
th.m1, td.m1 { border-left: 2px solid var(--axis); }
.prices tr:last-child td { border-bottom: 0; }
.prices tr.own td { border-bottom: 2px solid var(--axis); }
.prices tr.hl td.name { font-weight: 600; }
.prices tr.hl td.name::before { content: ""; display: inline-block; width: 3px; height: 14px; background: var(--own); margin-right: 8px; vertical-align: -2px; }
td.cell { cursor: pointer; font-family: var(--mono); font-size: 13px; min-width: 66px; }
td.cell:hover { outline: 2px solid var(--ink); outline-offset: -2px; }
td.empty { color: var(--muted); cursor: default; }
td.empty:hover { outline: none; }
td.pending { color: var(--axis); }
td.stale { color: var(--muted); }
td.odd { box-shadow: inset 0 0 0 2px var(--warning); }
.delta { display: block; font-size: 10px; color: var(--ink-2); line-height: 1.1; }
.delta b { font-weight: 700; color: var(--ink); }
tr.out td.name { color: var(--muted); font-weight: 400; }
tr:not(.out) + tr.out td { box-shadow: inset 0 2px 0 var(--axis); }
.engine { color: var(--muted); font-size: 12px; margin-left: 6px; font-family: var(--sans); }
.scale { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.scale i { width: 16px; height: 10px; display: inline-block; }
.set-note { margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.odd-note { color: var(--ink-2); }

/* ---------- Estado ---------- */
.status { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ok .dot { background: var(--good); }
.err .dot { background: var(--critical); }
.old .dot { background: var(--warning); }
th.errmsg, td.errmsg { text-align: left; white-space: normal; color: var(--muted); font-size: 13px; min-width: 220px; }

/* ---------- Diálogos ---------- */
dialog {
  border: 1px solid var(--rule); border-radius: 8px; padding: 0; width: min(640px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(17, 26, 41, 0.45); }
.dlg-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; padding: 22px 24px 10px; }
.dlg-head h2 { font-size: 26px; }
.dlg-body { padding: 4px 24px 24px; }
.close { font: inherit; background: none; border: 0; color: var(--muted); font-size: 24px; cursor: pointer; line-height: 1; padding: 4px 8px; border-radius: 999px; }
.close:hover { color: var(--ink); background: var(--hover); }
.dlg-body table td, .dlg-body table th { text-align: left; }
.dlg-body table td.num, .dlg-body table th.num { text-align: right; }
.dlg-body h3 { font-family: var(--serif); font-size: 19px; font-weight: 500; margin: 22px 0 8px; }
.tag { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; border: 1px solid var(--rule); padding: 1px 6px; color: var(--ink-2); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; align-items: center; }
.dlg-actions .count { margin-right: auto; color: var(--muted); font-size: 14px; }
.set-list { list-style: none; margin: 0; padding: 0; columns: 2 240px; column-gap: 24px; }
.set-list li { break-inside: avoid; padding: 4px 0; }
.set-list label { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.set-list input { width: 18px; height: 18px; accent-color: var(--ink); }
.set-list .engine { margin-left: 0; }

/* Guía (modal). */
dialog.guide-dlg { width: min(760px, calc(100vw - 32px)); }
.guide-dlg .dlg-body { max-height: min(72vh, 680px); overflow-y: auto; font-size: 15px; color: var(--ink-2); }
.guide-dlg .dlg-body h3:first-child { margin-top: 4px; }
.guide-dlg ul { margin: 0; padding-left: 18px; }
.guide-dlg li { margin-bottom: 6px; }
.guide-dlg strong, .guide-dlg b { color: var(--ink); }
.swatch-inline { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin: 0 6px 0 2px; }
.swatch-inline.box { height: 11px; width: 11px; }

/* Objetivo de posición (modal). */
.opt { display: flex; gap: 14px; align-items: flex-start; padding: 16px 4px; border-bottom: 1px solid var(--rule); cursor: pointer; }
.opt:first-of-type { border-top: 2px solid var(--ink); }
.opt:has(input:checked) { background: var(--tint); }
.opt input { margin: 4px 0 0; width: 18px; height: 18px; accent-color: var(--ink); flex: none; }
.opt .t { display: flex; flex-direction: column; gap: 3px; flex-grow: 1; }
.opt .t b { font-size: 16px; }
.opt .t span { font-size: 14px; color: var(--muted); }
.target-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 20px; }
.preview { margin-top: 20px; padding: 16px 18px; background: var(--tint); }
.preview .kicker { margin-bottom: 4px; }
.preview p { margin: 0; font-family: var(--serif); font-size: 20px; line-height: 1.35; }

/* ---------- Formularios y páginas (cuenta, admin) ---------- */
.page { max-width: 1080px; margin: 0 auto; padding: 40px 40px 72px; }
.page h1.title { font-family: var(--serif); font-weight: 400; font-size: 44px; line-height: 1.1; letter-spacing: -0.015em; margin: 0 0 8px; }
.page .intro { color: var(--muted); margin: 0 0 28px; font-size: 16px; }
.card { background: none; border: 0; border-top: 2px solid var(--ink); border-radius: 0; padding: 20px 0 32px; margin-bottom: 8px; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 12px; }
.card h2 { margin-bottom: 6px; }
.card .card-sub { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 18px; align-items: end; }
.fld label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }
.fld input, .fld select {
  width: 100%; font: 15px var(--sans); color: var(--ink); background: var(--field);
  border: 1px solid var(--rule); border-radius: 4px; min-height: 42px; padding: 0 12px;
}
.fld select { border-radius: 4px; }
.fld input:focus, .fld select:focus { outline: 2px solid color-mix(in oklab, var(--mark-deep) 50%, transparent); outline-offset: 0; border-color: var(--mark-deep); }
.fld input[type=number] { font-family: var(--mono); }
.help { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
/* Borrador del email frío (/admin → Prospectos). */
.draft { display: block; width: 100%; min-height: 300px; font: 14px/1.5 var(--sans); color: var(--ink); background: var(--field); border: 1px solid var(--rule); border-radius: 4px; padding: 10px 12px; resize: vertical; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
.list { width: 100%; border-collapse: collapse; border-top: 1px solid var(--rule); }
.list th, .list td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--rule); vertical-align: middle; white-space: normal; }
.list th:first-child, .list td:first-child { padding-left: 0; }
.list th { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); position: static; }
.list td.right, .list th.right { text-align: right; }
.list tr.off td { color: var(--muted); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.empty-note { color: var(--muted); font-size: 14px; padding: 8px 0; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 7px; border: 1px solid var(--rule); color: var(--ink-2); white-space: nowrap; }
.badge.ok { color: var(--good); border-color: color-mix(in oklab, var(--good) 45%, transparent); }
.badge.off { color: var(--critical); border-color: color-mix(in oklab, var(--critical) 45%, transparent); }
.badge.warn { color: var(--ink); border-color: var(--warning); }
.linkbox { margin-top: 14px; padding: 14px 16px; background: var(--tint); font-size: 14px; }
.linkbox .row { display: flex; gap: 8px; margin-top: 8px; }
.linkbox input { flex: 1; min-width: 0; font: 13px var(--mono); color: var(--ink); background: var(--field); border: 1px solid var(--rule); border-radius: 4px; padding: 8px 10px; }
/* /admin → Envíos y Prospectos */
.funnel { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); border-top: 1px solid var(--rule); margin: 4px 0 14px; }
.funnel div { padding: 12px 14px 12px 0; border-bottom: 1px solid var(--rule); }
.funnel b { display: block; font: 500 32px/1.1 var(--serif); color: var(--ink); }
.funnel span { font-size: 13px; color: var(--muted); }
.mail-text { white-space: pre-wrap; overflow-wrap: anywhere; font: 14px/1.5 var(--sans); color: var(--ink); background: var(--field); border: 1px solid var(--rule); border-radius: 4px; padding: 10px 12px; margin: 6px 0 0; }
.adopt { font-size: 14px; }
.adopt summary { cursor: pointer; font-weight: 600; }
h3.mini { font-size: 13px; margin: 18px 0 8px; color: var(--ink-2); }
.msg { font-size: 14px; margin-top: 10px; }
.msg.err { color: var(--critical); }
.msg.ok { color: var(--good); }
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--rule); margin-bottom: 24px; flex-wrap: wrap; }
.tabs button { font: 500 15px var(--sans); color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 0; cursor: pointer; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.error-box { padding: 16px 18px; border-left: 3px solid var(--critical); background: color-mix(in oklab, var(--critical) 6%, transparent); color: var(--ink); }

/* "Viendo como" / aviso de demo. */
.acting { background: var(--tint); border-bottom: 1px solid var(--rule); font-size: 14px; }
.acting-inner { max-width: 1280px; margin: 0 auto; padding: 9px 40px; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.acting a, .acting button { font: inherit; color: var(--ink); background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- Carga ---------- */
/* Esqueleto quieto: el único movimiento es el aviso centrado (un brillo
   recorriendo cada bloque se leía como parpadeos). */
.sk { display: block; background: var(--sk-base); }
.sk-wait { position: relative; }
.sk-wait .loading-note { position: absolute; inset: 0; justify-content: center; }
/* Cambio de noches con el panel ya dibujado: los filtros quedan nítidos (la
   pastilla elegida muestra una ruedita) y el resto se atenúa mientras llegan
   los datos. */
#app.reloading { cursor: progress; }
#app.reloading > :not(.controls) { opacity: .45; pointer-events: none; transition: opacity .12s; }
/* La ruedita ocupa el lugar del número: la pastilla no cambia de ancho. */
.pill.pending { position: relative; color: transparent; }
.pill.pending::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  border: 2px solid color-mix(in oklab, var(--page) 35%, transparent); border-top-color: var(--page);
  animation: spin .7s linear infinite;
}
.sk-line { height: 12px; }
.sk-title { height: 44px; margin: 14px 0 8px; }
.sk-block { height: 280px; }
.loading-note { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.spin { width: 14px; height: 14px; border-radius: 50%; display: inline-block; border: 2px solid var(--rule); border-top-color: var(--ink); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center { display: flex; justify-content: center; padding: 28px 0; }

.only-narrow { display: none; }

/* ---------- Celular ---------- */
@media (max-width: 760px) {
  main { padding: 0 18px 56px; }
  /* Dos filas: marca y botones arriba; secciones y estado de los precios abajo. */
  .topbar-inner {
    padding: 8px 18px 0; gap: 4px 12px; min-height: 56px;
    display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "brand right" "nav status";
  }
  .brand { grid-area: brand; }
  .head-right { grid-area: right; justify-self: end; gap: 6px; }
  .head-right .btn-ghost { min-height: 36px; }
  .head-right .btn-ghost.icon { width: 36px; }
  .head-right .btn-ghost:not(.icon) { padding: 0 14px; }
  .nav { grid-area: nav; gap: 20px; }
  .nav a { min-height: 40px; }
  .run-status { grid-area: status; min-width: 0; font-size: 13px; text-align: right; }
  .who { display: none; }
  .acting-inner { padding: 9px 18px; }
  .lede { padding-top: 28px; gap: 12px; }
  .headline { font-size: 30px; line-height: 1.15; }
  .deck { font-size: 17px; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 24px; }
  .figure { padding: 14px 12px 16px; }
  .figure:nth-child(3) { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
  .figure:nth-child(4) { border-top: 1px solid var(--rule); }
  .figure .value { font-size: 24px; }
  .controls { margin: 0 -18px; padding: 10px 18px; }
  .filters-toggle {
    display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 44px;
    font: 500 14px var(--sans); color: var(--ink); background: var(--field); border: 1px solid var(--rule); border-radius: 999px; padding: 0 16px; cursor: pointer;
  }
  .controls:not(.open) .filters-body { display: none; }
  .controls.open .filters-body { padding-top: 12px; }
  .controls .push { margin-left: 0; }
  .figures.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rv {
    grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "day verdict" "price price" "chips chips";
    gap: 8px 12px; padding: 14px 0;
  }
  .rv-day { grid-area: day; }
  .rv-verdict { grid-area: verdict; }
  .rv-price { grid-area: price; flex-direction: row; align-items: baseline; gap: 10px; }
  .rv-chips { grid-area: chips; }
  .rv-verdict > span:not(.tag-v) { display: none; }
  .chip { font-size: 12px; }
  .nv-figs b { font-size: 19px; }
  .nv-kind { width: 80px; }
  .block { margin-top: 40px; }
  h2 { font-size: 22px; }
  .cal { gap: 3px; }
  .day, .cal .gap-cell { min-height: 64px; padding: 6px 4px; }
  .day .top { justify-content: center; font-size: 11px; }
  .day .top .stay { display: none; }
  .day .bottom { justify-content: center; }
  .day .price { font-size: 13px; }
  .day .diff { display: none; }
  .board td.trend, .board th.trend { display: none; }
  .only-narrow { display: block; }
  .page { padding: 28px 18px 56px; }
  .page h1.title { font-size: 34px; }
}
/* Celulares angostos: que la marca no se pise con los botones. */
@media (max-width: 370px) {
  .topbar-inner { column-gap: 8px; }
  .brand { gap: 6px; }
  .brand .wordmark { font-size: 17px; }
  .head-right { gap: 4px; }
}
