/* misnotas.es — hoja de estilos única.
   Sin framework: la v1 cargaba Tailwind desde CDN, lo que rompe el modo offline
   de la PWA y obliga a relajar la CSP. Aquí todo se sirve desde el propio dominio. */

:root {
  color-scheme: light dark;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dde1e7;
  --text: #16191d;
  --text-dim: #5b6470;
  --accent: #2563eb;
  --accent-contrast: #ffffff;
  --accent-soft: #e8efff;
  --danger: #c8302b;
  --danger-soft: #fdecec;
  --ok: #17794a;
  --warn: #9a6400;
  --warn-soft: #fdf3e0;

  --pain-low: #17794a;
  --pain-mid: #b8860b;
  --pain-high: #c8302b;

  --serie-1: #2563eb;
  --serie-2: #7c3aed;
  --serie-3: #0d9488;
  --serie-4: #c2410c;
  --serie-5: #be185d;
  --serie-6: #4d7c0f;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --serie-1: #6aa1ff;
    --serie-2: #a78bfa;
    --serie-3: #2dd4bf;
    --serie-4: #fb923c;
    --serie-5: #f472b6;
    --serie-6: #a3e635;
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #1e242c;
    --border: #2c333d;
    --text: #e8ebef;
    --text-dim: #98a2b3;
    --accent: #6aa1ff;
    --accent-contrast: #0b1220;
    --accent-soft: #1c2740;
    --danger: #ff8b85;
    --danger-soft: #2e1b1b;
    --ok: #56d59a;
    --warn: #e5b567;
    --warn-soft: #2e2617;
    --pain-low: #56d59a;
    --pain-mid: #e5b567;
    --pain-high: #ff8b85;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

:root[data-theme="dark"] {
    --serie-1: #6aa1ff;
    --serie-2: #a78bfa;
    --serie-3: #2dd4bf;
    --serie-4: #fb923c;
    --serie-5: #f472b6;
    --serie-6: #a3e635;
  --bg: #0f1216;
  --surface: #171b21;
  --surface-2: #1e242c;
  --border: #2c333d;
  --text: #e8ebef;
  --text-dim: #98a2b3;
  --accent: #6aa1ff;
  --accent-contrast: #0b1220;
  --accent-soft: #1c2740;
  --danger: #ff8b85;
  --danger-soft: #2e1b1b;
  --ok: #56d59a;
  --warn: #e5b567;
  --warn-soft: #2e2617;
  --pain-low: #56d59a;
  --pain-mid: #e5b567;
  --pain-high: #ff8b85;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; font-weight: 650; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); }

/* ------------------------------------------------------------------ estructura */

.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
/* El logotipo de la cabecera es un boton (lleva al inicio), asi que hay que
   quitarle toda la apariencia de boton. */
.app-header .brand {
  margin-right: auto;
  display: flex; align-items: center;
  padding: 0; border: 0; background: none;
  font: inherit; color: inherit; cursor: pointer;
  border-radius: var(--radius-sm);
}
.app-header .brand:hover .wordmark-text { color: var(--accent); }
.app-header .wordmark-text { font-size: 1.02rem; transition: color .15s; }

main { max-width: 900px; margin: 0 auto; padding: 1.25rem 1rem 5rem; }

/* La analitica y el informe necesitan el ancho real de la pantalla: con 900 px
   fijos, en un monitor quedaba media pantalla vacia mientras las graficas se
   apelotonaban. */
main.wide { max-width: 1560px; padding-left: 1.5rem; padding-right: 1.5rem; }

.page-head {
  display: flex; align-items: flex-start; gap: 1rem;
  flex-wrap: wrap; margin-bottom: 1rem;
}
.page-head .grow { flex: 1 1 240px; min-width: 0; }
.muted { color: var(--text-dim); }
.small { font-size: .875rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: .75rem; }
.stack > * + * { margin-top: .75rem; }

.grid { display: grid; gap: .75rem; }
@media (min-width: 620px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 620px) { .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }

/* ------------------------------------------------------------------- controles */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem .9rem;
  font: inherit; font-weight: 550;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: .3rem .55rem; font-size: .85rem; }
.btn-block { width: 100%; }

:where(.btn, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

label { display: block; font-weight: 550; font-size: .9rem; margin-bottom: .3rem; }
.field + .field { margin-top: .85rem; }
.hint { font-size: .82rem; color: var(--text-dim); margin-top: .3rem; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="time"], input[type="datetime-local"], select, textarea {
  width: 100%;
  padding: .55rem .65rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
textarea { min-height: 90px; resize: vertical; }

input[type="range"] { width: 100%; accent-color: var(--accent); }

.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

/* --------------------------------------------------------------------- fichas */

.list { list-style: none; margin: 0; padding: 0; }
.list li + li { margin-top: .5rem; }

.item {
  display: flex; align-items: center; gap: .75rem;
  width: 100%; text-align: left;
  padding: .75rem .9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer; font: inherit; color: inherit;
}
.item:hover { border-color: var(--accent); }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; }
.item .sub { font-size: .85rem; color: var(--text-dim); }

.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--accent); }

.badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .1rem .45rem;
  font-size: .78rem; font-weight: 600;
  border-radius: 99px;
  background: var(--surface-2); color: var(--text-dim);
  border: 1px solid var(--border);
}
.badge.pain-low { color: var(--pain-low); border-color: currentColor; }
.badge.pain-mid { color: var(--pain-mid); border-color: currentColor; }
.badge.pain-high { color: var(--pain-high); border-color: currentColor; }
.badge.warn { color: var(--warn); background: var(--warn-soft); border-color: currentColor; }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .5rem;
  font-size: .82rem;
  border-radius: 99px;
  background: var(--accent-soft); color: var(--text);
  border: 1px solid transparent;
}
.chip button {
  border: 0; background: transparent; cursor: pointer; color: var(--text-dim);
  font-size: 1rem; line-height: 1; padding: 0;
}
.chip.suggest { background: var(--surface-2); cursor: pointer; }

.stat { text-align: center; padding: .75rem; }
.stat .value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat .label { font-size: .8rem; color: var(--text-dim); }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--text-dim); }

/* -------------------------------------------------------------------- gráficas */

.chart { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis { fill: var(--text-dim); font-size: 11px; font-family: var(--font); }
.chart-label { fill: var(--text); font-size: 12px; font-family: var(--font); }
.chart-empty { fill: var(--text-dim); font-size: 13px; font-family: var(--font); }
.chart-line { stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: var(--accent); opacity: .1; }
.chart-dot { fill: var(--accent); }
.chart-bar { fill: var(--accent); opacity: .85; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 600; font-size: .82rem; }
.table-wrap { overflow-x: auto; }

/* ------------------------------------------------------------------- diálogos */

dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  max-width: min(560px, calc(100vw - 2rem));
  width: 100%;
}
dialog::backdrop { background: rgba(6, 9, 14, .55); }
dialog .dialog-body { padding: 1.1rem; }
dialog h2 { margin-bottom: .75rem; }

.toast-host {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%);
  z-index: 60; display: flex; flex-direction: column; gap: .5rem;
  width: min(420px, calc(100vw - 2rem));
}
.toast {
  padding: .6rem .85rem;
  border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: .9rem;
}
.toast.err { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.toast.ok { border-color: var(--ok); color: var(--ok); }

.banner {
  padding: .6rem .85rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: .9rem;
}
.banner.warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.banner.danger { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

/* ------------------------------------------------------------------ pantallas */

.auth-wrap { max-width: 420px; margin: 0 auto; padding: 2rem 1rem 4rem; }
.auth-logo { text-align: center; margin-bottom: 1.5rem; }
.auth-logo svg { width: 40px; height: 40px; color: var(--accent); }
.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; background: var(--surface-2); padding: .25rem; border-radius: var(--radius-sm); }
.tabs button {
  flex: 1; padding: .45rem; font: inherit; font-weight: 550; font-size: .9rem;
  border: 0; background: transparent; color: var(--text-dim);
  border-radius: var(--radius-sm); cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.recovery-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1rem; letter-spacing: .04em; word-break: break-all;
  padding: .85rem; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px dashed var(--border);
}

.pain-scale { display: flex; align-items: center; gap: .75rem; }
.pain-value {
  font-size: 1.5rem; font-weight: 700; min-width: 2.2rem; text-align: center;
}

.fab {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 30;
  border-radius: 99px; padding: .8rem 1.15rem;
  box-shadow: 0 4px 14px rgba(16, 24, 40, .2);
}

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

.thumbs { display: flex; flex-wrap: wrap; gap: .5rem; }
.thumbs img { width: 84px; height: 84px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* -------------------------------------------------------------------- informe */

@media print {
  .app-header, .fab, .no-print, .toast-host { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  main { max-width: none; padding: 0; }
  .card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
  .report-episode { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
  .chart-line { stroke: #333; }
  .chart-area { fill: #333; opacity: .08; }
  .chart-dot, .chart-bar { fill: #333; }
  .chart-axis, .chart-label { fill: #000; }
}

/* =========================================================== marca y portada */

.wordmark { display: inline-flex; align-items: center; gap: .55rem; }
.wordmark svg { display: block; border-radius: 22%; }
.wordmark-text {
  font-size: 1.15rem; font-weight: 700; letter-spacing: -.02em; color: var(--text);
}
.wordmark-tld { color: var(--text-dim); font-weight: 600; }

.landing { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem 3rem; }
.landing-nav { padding: 1.25rem 0; }

/* El degradado va detrás del héroe, sin tapar el contenido. */
.hero {
  position: relative;
  display: grid;
  gap: 2.5rem;
  padding: 1rem 0 3rem;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -8rem -50vw 10% -50vw;
  background:
    radial-gradient(55% 60% at 22% 5%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 68%),
    radial-gradient(45% 55% at 85% 12%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 68%);
  /* Sin la mascara se ve el canto recto de la caja alla donde el radial todavia
     no ha llegado a transparente, y queda una linea horizontal atravesando la
     pagina. */
  -webkit-mask-image: linear-gradient(to bottom, #000 45%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 45%, transparent 100%);
  z-index: -1;
  pointer-events: none;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .7rem;
  font-size: .8rem; font-weight: 600;
  border-radius: 99px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.eyebrow svg { width: 15px; height: 15px; }

.hero-title {
  font-size: clamp(2rem, 6vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: -.03em;
  margin: 1rem 0 .85rem;
}
.hero-accent {
  background: linear-gradient(100deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #a855f7));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-lead {
  font-size: 1.06rem;
  color: var(--text-dim);
  max-width: 46ch;
}
.hero-points { list-style: none; margin: 1.25rem 0 0; padding: 0; }
.hero-points li {
  position: relative;
  padding-left: 1.6rem;
  margin-bottom: .5rem;
  font-size: .94rem;
}
.hero-points li::before {
  content: "";
  position: absolute; left: 0; top: .42em;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.hero-form .card {
  border-radius: 14px;
  box-shadow: 0 12px 32px -12px rgba(16, 24, 40, .28), var(--shadow);
}

@media (min-width: 900px) {
  .hero { grid-template-columns: 1.05fr .95fr; align-items: start; gap: 3.5rem; }
  .hero-form { position: sticky; top: 1.5rem; }
}
/* En móvil entra primero quien ya tiene cuenta. */
@media (max-width: 899px) {
  .hero { display: flex; flex-direction: column; }
  .hero-form { order: -1; }
}

.features {
  display: grid; gap: 1rem;
  padding: 1rem 0 2.5rem;
}
@media (min-width: 800px) { .features { grid-template-columns: repeat(3, 1fr); } }

.feature {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.feature-icon {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 11px;
  margin-bottom: .85rem;
  color: var(--accent);
  background: var(--accent-soft);
}
.feature-icon svg { width: 21px; height: 21px; }
.feature h2 { font-size: 1.02rem; margin-bottom: .35rem; }
.feature p { color: var(--text-dim); font-size: .92rem; margin: 0; }

.how {
  padding: 2rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
}
.how-head { margin-bottom: 1.5rem; }
.how-head h2 { font-size: 1.3rem; letter-spacing: -.02em; }
.how-head p { margin: 0; }

.how-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.1rem; }
@media (min-width: 800px) { .how-steps { grid-template-columns: repeat(3, 1fr); gap: 1.75rem; } }
.how-steps li { display: flex; gap: .8rem; align-items: flex-start; }
.how-steps h3 { font-size: .97rem; margin-bottom: .2rem; }
.how-steps p { margin: 0; }
.how-num {
  flex: none;
  display: grid; place-items: center;
  width: 27px; height: 27px;
  border-radius: 50%;
  font-size: .82rem; font-weight: 700;
  color: var(--accent-contrast);
  background: var(--accent);
}

.how-warn {
  margin: 1.75rem 0 0;
  padding: .85rem 1rem;
  border-left: 3px solid var(--warn);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--warn-soft);
  color: var(--text);
  font-size: .9rem;
}

.landing-foot {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  padding: 2.5rem 0 0;
  color: var(--text-dim);
  font-size: .85rem;
}
.landing-foot svg { border-radius: 22%; }

/* El formulario de acceso ya no vive en una columna estrecha centrada. */
.auth-panel .tabs { margin-bottom: .85rem; }

/* "Crear cuenta" parte en dos lineas en pantallas estrechas y descuadra la
   barra de pestanas: se aprieta el texto en vez de dejar que salte. */
.tabs button { white-space: nowrap; }
@media (max-width: 430px) {
  .tabs button { font-size: .82rem; padding: .45rem .25rem; letter-spacing: -.01em; }
}

/* ========================================================= panel de analitica */

.filtros {
  position: sticky; top: 52px; z-index: 10;
  display: flex; flex-direction: column; gap: .6rem;
  padding: .85rem 1rem;
  margin-bottom: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.filtros-fila { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
/* Con muchas dolencias los chips desbordaban a tres lineas y la barra fija se
   comia media pantalla al hacer scroll. Se acota el alto y se desplaza dentro. */
.filtros-fila > .chips { max-height: 5.2rem; overflow-y: auto; }

/* En movil la barra fija se comia media pantalla; ahi se desplaza con el resto. */
@media (max-width: 780px) {
  .filtros { position: static; }
}
.filtros-etiqueta {
  font-size: .78rem; font-weight: 650; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-dim);
  min-width: 76px;
}
.filtros-fechas { display: flex; align-items: center; gap: .4rem; }
.filtros-fechas input, .filtros-fechas select { width: auto; padding: .3rem .45rem; font-size: .85rem; }

.filtro-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .7rem;
  font: inherit; font-size: .86rem; font-weight: 550;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
}
.filtro-chip:hover { background: var(--surface-2); color: var(--text); }
.filtro-chip.is-on {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--text);
}
.filtro-chip .dot { width: 8px; height: 8px; }

.chip-filtro {
  background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
}

/* Rejilla de 12 columnas: cada tarjeta declara cuanto ocupa. */
.analitica-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1rem; }
.analitica-grid > * { grid-column: span 12; min-width: 0; }

@media (min-width: 1080px) {
  .analitica-grid > .span-5 { grid-column: span 5; }
  .analitica-grid > .span-6 { grid-column: span 6; }
  .analitica-grid > .span-7 { grid-column: span 7; }
}

.kpis {
  display: grid; gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.kpi {
  padding: .85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.kpi-label {
  font-size: .76rem; font-weight: 650; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-dim);
}
.kpi-value { font-size: 1.85rem; font-weight: 700; line-height: 1.15; margin: .15rem 0 .1rem; }
.kpi-delta { font-size: .78rem; font-weight: 600; }
.kpi-delta.is-good { color: var(--ok); }
.kpi-delta.is-bad { color: var(--danger); }
.kpi-delta.is-neutral { color: var(--text-dim); font-weight: 500; }

.analitica-grid .card h2 { font-size: 1rem; }
.analitica-grid .card .hint { margin-bottom: .6rem; }

.leyenda { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: .5rem; }
.leyenda-item { display: inline-flex; align-items: center; gap: .35rem; font-size: .84rem; }
.leyenda-dot { width: 10px; height: 10px; border-radius: 2px; }

/* --------------------------------------------------------------- graficas */

.chart-wrap { position: relative; }
/* Se recorta al viewBox: si una etiqueta se pasa de largo debe cortarse, no
   dibujarse fuera de la tarjeta. El tooltip vive fuera del SVG, asi que no le
   afecta. */
.chart { width: 100%; height: auto; display: block; overflow: hidden; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis { fill: var(--text-dim); font-size: 12px; font-family: var(--font); }
.chart-label { fill: var(--text); font-size: 13px; font-family: var(--font); }
.chart-empty { fill: var(--text-dim); font-size: 13px; font-family: var(--font); }
.chart-line { stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { opacity: .12; }
.chart-dot { stroke: var(--surface); stroke-width: 1.5; }
.chart-bar { fill: var(--accent); opacity: .85; }
.chart-bar.is-active { fill: var(--warn); opacity: 1; }
.chart-guide { stroke: var(--text-dim); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-cell { fill: var(--accent); }
.chart-cell-num { fill: var(--surface); font-size: 12px; font-weight: 600; font-family: var(--font); }
.chart-clickable { cursor: pointer; }

.chart-row-hit { fill: transparent; }
.chart-row:hover .chart-row-hit { fill: var(--surface-2); }
.chart-row:hover .chart-bar { opacity: 1; }
.chart-label.is-active { font-weight: 700; }

.chart-tip {
  position: absolute; z-index: 5; pointer-events: none;
  min-width: 130px;
  padding: .5rem .6rem;
  font-size: .82rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 18px -6px rgba(16, 24, 40, .35);
}
.chart-tip-title { font-weight: 700; margin-bottom: .25rem; }
.chart-tip-row { display: flex; align-items: center; gap: .4rem; }
.chart-tip-row strong { margin-left: auto; }
.chart-tip-label { color: var(--text-dim); }
.chart-tip-dot { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.chart-tip-hint { margin-top: .3rem; color: var(--text-dim); font-style: italic; }

/* ----------------------------------------------------------------- tablas */

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tabla-corr td { vertical-align: middle; }
.fila-corr:hover { background: var(--surface-2); }
.barra-celda { width: 22%; }
.barra-lift {
  display: block; height: 8px; border-radius: 99px;
  background: color-mix(in srgb, var(--accent) 55%, transparent);
}
.barra-lift.is-alto { background: var(--warn); }

.enlace-filtro {
  border: 0; background: none; padding: 0;
  font: inherit; color: var(--accent); cursor: pointer;
  text-align: left;
}
.enlace-filtro:hover { text-decoration: underline; }

@media print {
  .filtros { display: none !important; }
  .analitica-grid { display: block; }
  .chart-tip { display: none !important; }
}

.chart-host { min-height: 60px; }

/* ------------------------------------------------------ panel de administracion */

.badge.estado-activa    { color: var(--ok); border-color: currentColor; }
.badge.estado-agotada,
.badge.estado-caducada  { color: var(--text-dim); }
.badge.estado-revocada  { color: var(--danger); border-color: currentColor; }

.fila-inactiva { opacity: .55; }
.fila-inactiva td:first-child { text-decoration: line-through; }
