/* ===== Tokens ===== */
:root {
  color-scheme: light;
  --page: #f6f5f1;
  --surface: #fcfcfb;
  --surface-2: #f0efea;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #7a7873;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --border-strong: rgba(11, 11, 11, 0.18);
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-wash: #e6f0fc;
  --on-accent: #ffffff;

  /* categórica (identidad: tipos de caja) */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
  /* serie "dentro de tarea" / "incentivo" */
  --base: #2a78d6;
  --base-track: #cde2fb;
  --extra: #eb6834;
  /* secuencial (mapa de calor) */
  --q0: #f0efec; --q1: #cde2fb; --q2: #9ec5f4; --q3: #6da7ec; --q4: #3987e5; --q5: #256abf; --q6: #184f95; --q7: #0d366b;
  --qt1: #0b0b0b; --qt2: #0b0b0b; --qt3: #0b0b0b; --qt4: #fff; --qt5: #fff; --qt6: #fff; --qt7: #fff;
  /* estado */
  --good: #0ca30c; --good-ink: #006300; --warn: #fab219; --warn-ink: #8a5a00; --bad: #d03b3b; --bad-ink: #b02a2a;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 16px rgba(0, 0, 0, 0.04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321;
    --ink: #ffffff; --ink-2: #c3c2b7; --muted: #95938c;
    --grid: #2c2c2a; --axis: #383835;
    --border: rgba(255, 255, 255, 0.1); --border-strong: rgba(255, 255, 255, 0.2);
    --accent: #3987e5; --accent-ink: #86b6ef; --accent-wash: #16263a;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --base: #3987e5; --base-track: #1c2f47; --extra: #d95926;
    --q0: #262624; --q1: #104281; --q2: #184f95; --q3: #1c5cab; --q4: #256abf; --q5: #3987e5; --q6: #6da7ec; --q7: #9ec5f4;
    --qt1: #fff; --qt2: #fff; --qt3: #fff; --qt4: #fff; --qt5: #fff; --qt6: #0b0b0b; --qt7: #0b0b0b;
    --good-ink: #0ca30c; --warn-ink: #fab219; --bad-ink: #e66767;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321;
  --ink: #ffffff; --ink-2: #c3c2b7; --muted: #95938c;
  --grid: #2c2c2a; --axis: #383835;
  --border: rgba(255, 255, 255, 0.1); --border-strong: rgba(255, 255, 255, 0.2);
  --accent: #3987e5; --accent-ink: #86b6ef; --accent-wash: #16263a;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --base: #3987e5; --base-track: #1c2f47; --extra: #d95926;
  --q0: #262624; --q1: #104281; --q2: #184f95; --q3: #1c5cab; --q4: #256abf; --q5: #3987e5; --q6: #6da7ec; --q7: #9ec5f4;
  --qt1: #fff; --qt2: #fff; --qt3: #fff; --qt4: #fff; --qt5: #fff; --qt6: #0b0b0b; --qt7: #0b0b0b;
  --good-ink: #0ca30c; --warn-ink: #fab219; --bad-ink: #e66767;
  --shadow: none;
}

/* ===== Base ===== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.5rem; font-weight: 650; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 600; }
a { color: var(--accent-ink); }
small, .muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.num, td.n, th.n { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===== Layout ===== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand svg { width: 28px; height: 28px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 999px;
  color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: 0.95rem;
}
.nav a svg { width: 20px; height: 20px; flex: none; }
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--ink); color: var(--page); }
.userbox { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }
.save-state { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.save-state.err { color: var(--bad-ink); font-weight: 600; }

.view { max-width: 1280px; margin: 0 auto; padding: 20px 20px 48px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }

@media (max-width: 860px) {
  /* sin backdrop-filter: si no, la barra fija de abajo quedaría anclada a la cabecera */
  .topbar { padding: 8px 16px; backdrop-filter: none; background: var(--page); }
  .topbar .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    justify-content: space-around; gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .nav a { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 0.7rem; border-radius: 10px; min-width: 52px; }
  .nav a.active { background: var(--accent-wash); color: var(--accent-ink); }
  .view { padding: 16px 16px calc(var(--nav-h) + 32px); }
  .userbox .who { display: none; }
  .userbox .guia span { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  min-width: 0;
}
.card > header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card > header p { margin: 2px 0 0; font-size: 0.9rem; color: var(--muted); }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > header { padding: 16px 18px 0; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.page-head .sub { color: var(--muted); font-size: 0.95rem; }
.empty { text-align: center; padding: 36px 16px; color: var(--ink-2); }
.empty h2 { margin-bottom: 8px; }

/* ===== Buttons & forms ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; font-size: 0.95rem;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad-ink); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { min-height: 34px; padding: 0 10px; font-size: 0.85rem; border-radius: 8px; }
.btn.icon { width: 44px; padding: 0; font-size: 1.3rem; }
.btn svg { width: 18px; height: 18px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--ink-2); font: inherit; font-weight: 600; font-size: 0.88rem; padding: 0 14px; min-height: 40px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.on { background: var(--ink); color: var(--page); }

label.f { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; color: var(--ink-2); font-weight: 550; }
input, select, textarea {
  font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px;
  min-height: 44px; padding: 0 12px;
}
textarea { padding: 10px 12px; min-height: 80px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px;
}
input[type="number"] { font-variant-numeric: tabular-nums; }
input.w-xs { width: 84px; }
input.w-s { width: 110px; }
input:disabled, select:disabled { background: var(--surface-2); color: var(--ink-2); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 0.95rem; cursor: pointer; }
.check input { width: 22px; height: 22px; min-height: 0; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 650; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good-ink); }
.badge.warn { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn-ink); }
.badge.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad-ink); }
.badge.info { background: var(--accent-wash); color: var(--accent-ink); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.st { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-weight: 600; }
.st.good { color: var(--good-ink); }
.st.warn { color: var(--warn-ink); }
.st.bad { color: var(--bad-ink); }

/* ===== Stat tiles ===== */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.tile .lbl { font-size: 0.82rem; color: var(--ink-2); font-weight: 550; }
.tile .val { font-size: 1.6rem; font-weight: 650; margin-top: 2px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .val small { font-size: 0.9rem; font-weight: 550; }
.tile .sub { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.hero { padding: 20px; }
.hero .val { font-size: 3.2rem; line-height: 1.05; }

/* ===== Tables ===== */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.tbl th { text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); font-weight: 650; padding: 10px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; background: var(--surface); }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.tbl tfoot td { font-weight: 650; border-top: 2px solid var(--axis); border-bottom: 0; background: var(--surface-2); }
.tbl .name { font-weight: 600; white-space: nowrap; }
.tbl .name a { color: var(--ink); text-decoration: none; }
.tbl .name a:hover { text-decoration: underline; }
.tbl.compact td { padding: 6px 10px; }
.sticky-col { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.tbl thead .sticky-col { z-index: 2; }

/* ===== Jornada ===== */
.cfg { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.cfg label.f input { width: 112px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button {
  border: 0; background: none; font: inherit; font-weight: 650; color: var(--ink-2);
  padding: 12px 16px; border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; min-height: 48px;
}
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .count { font-weight: 550; color: var(--muted); }

.asis-list { display: flex; flex-direction: column; }
.asis-row { display: grid; grid-template-columns: 48px minmax(140px, 1fr) auto minmax(110px, auto); gap: 12px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--grid); }
.asis-row .toggle {
  width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--border-strong); background: var(--surface);
  cursor: pointer; display: grid; place-items: center; color: transparent; font-size: 1.3rem; font-weight: 800;
}
.asis-row.on .toggle { background: var(--good); border-color: var(--good); color: #fff; }
.asis-row:not(.on) .times, .asis-row:not(.on) .hrs { opacity: 0.35; pointer-events: none; }
.asis-row .times { display: flex; gap: 8px; }
.asis-row .times input { width: 118px; }
.asis-row .hrs { text-align: right; font-size: 0.9rem; color: var(--ink-2); }
@media (max-width: 700px) {
  .asis-row { grid-template-columns: 48px 1fr auto; }
  .asis-row .times { grid-column: 2 / 4; }
  .asis-row .hrs { grid-row: 1; grid-column: 3; }
}

.tramo-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface);
  font: inherit; font-weight: 600; font-size: 0.9rem; color: var(--ink); cursor: pointer;
}
.chip.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.chip .dot { width: 12px; height: 12px; }

.conteo th.pale { min-width: 96px; text-align: center; }
.conteo td.cell { padding: 4px 6px; text-align: center; }
.conteo td.cell input {
  width: 76px; min-height: 46px; text-align: center; font-size: 1.15rem; font-weight: 650; padding: 0 4px;
  -moz-appearance: textfield; appearance: textfield;
}
.conteo td.cell input::-webkit-outer-spin-button, .conteo td.cell input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.conteo td.cell input.dirty { border-color: var(--warn); }
.conteo td.cell input.unsaved { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, var(--surface)); }
.conteo td.cell.active-col input { border-color: var(--accent); }
.conteo th.active-col { color: var(--accent-ink); }
.conteo .plus { min-width: 52px; }
.conteo td.prog { min-width: 170px; }
.conteo tfoot input { width: 76px; min-height: 38px; text-align: center; }
.cuadre { font-size: 0.8rem; display: block; margin-top: 2px; }

.sel-tramo-head { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.sel-tramo-head .caja-title { display: flex; align-items: center; gap: 10px; }
.sel-tramo-head .caja-title .dot { width: 18px; height: 18px; border-radius: 5px; }

.box-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.box-pick button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  border: 2px solid var(--border-strong); border-radius: 12px; background: var(--surface); padding: 12px; cursor: pointer; font: inherit; color: var(--ink);
}
.box-pick button .dot { width: 16px; height: 16px; border-radius: 4px; }
.box-pick button.on { border-color: var(--accent); background: var(--accent-wash); }
.box-pick button b { font-size: 1rem; }
.box-pick button small { font-size: 0.82rem; }

/* ===== Charts ===== */
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.85rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { width: 12px; height: 12px; }
.legend .tick { width: 2px; height: 14px; background: var(--ink); border-radius: 1px; }

.pbar { position: relative; height: 12px; border-radius: 4px; background: var(--base-track); min-width: 80px; }
.pbar .b { position: absolute; top: 0; bottom: 0; left: 0; background: var(--base); border-radius: 4px; }
.pbar .x { position: absolute; top: 0; bottom: 0; background: var(--extra); border-radius: 0 4px 4px 0; }
.pbar .m { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 1px; }
.pbar.full .b { border-radius: 4px 0 0 4px; }

.hbars { display: flex; flex-direction: column; gap: 6px; }
.hbar { display: grid; grid-template-columns: 30px minmax(90px, 180px) 1fr auto; gap: 10px; align-items: center; min-height: 32px; font-size: 0.92rem; }
.hbar .pos { font-weight: 700; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.hbar .lbl { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .lbl a { color: inherit; text-decoration: none; }
.hbar .track { display: flex; gap: 2px; height: 22px; align-items: stretch; min-width: 0; }
.hbar .seg-b { background: var(--base); border-radius: 0; }
.hbar .seg-x { background: var(--extra); }
.hbar .track > :first-child { border-radius: 4px 0 0 4px; }
.hbar .track > :last-child { border-radius: 0 4px 4px 0; }
.hbar .track > :only-child { border-radius: 4px; }
.hbar .v { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 0.88rem; color: var(--ink-2); min-width: 120px; text-align: right; }
.hbar .v b { color: var(--ink); }
@media (max-width: 600px) {
  .hbar { grid-template-columns: 24px 1fr auto; }
  .hbar .track { grid-column: 2 / 4; grid-row: 2; height: 16px; }
  .hbar .v { min-width: 0; }
}

.timeline { display: flex; gap: 2px; height: 40px; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.timeline .seg { display: flex; align-items: center; padding: 0 8px; min-width: 0; color: #fff; font-size: 0.8rem; font-weight: 650; white-space: nowrap; overflow: hidden; cursor: pointer; }
.timeline .seg .t { overflow: hidden; text-overflow: ellipsis; }
.timeline .seg.light { color: #0b0b0b; }
.timeline .seg.sel { box-shadow: inset 0 0 0 3px var(--ink); }
.timeline .seg.gap { background: transparent; cursor: default; }
.timeline .seg.open { background-image: repeating-linear-gradient(45deg, transparent 0 8px, rgba(255, 255, 255, 0.18) 8px 16px); }
.timeline-axis { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }

.heat { display: grid; gap: 2px; font-size: 0.8rem; }
.heat .h { color: var(--muted); font-weight: 650; text-align: center; padding: 4px 0; font-size: 0.75rem; text-transform: uppercase; }
.heat .rn { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; display: flex; align-items: center; }
.heat .c { height: 34px; border-radius: 4px; display: grid; place-items: center; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.78rem; }
.heat .c.dk { color: #fff; }
.heat .c.lt { color: #0b0b0b; }
.heat .c.none { background: transparent; border: 1px dashed var(--grid); }
.scale { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--muted); }
.scale i { display: inline-block; width: 22px; height: 10px; border-radius: 2px; }

/* ===== Panel ===== */
.sec { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.sec h2 { font-size: 1.3rem; }
.sec .sub { color: var(--muted); font-size: 0.92rem; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 0.8rem; font-weight: 650; color: var(--muted); margin-top: 4px; }
.delta.good { color: var(--good-ink); }
.delta.bad { color: var(--bad-ink); }
.tile .spark { display: block; width: 100%; margin-top: 8px; }
.spark-l { fill: none; stroke: var(--base); stroke-width: 2; stroke-linejoin: round; }
.spark-a { fill: var(--base); opacity: 0.1; }
.meter { height: 10px; border-radius: 4px; background: var(--base-track); margin-top: 10px; overflow: hidden; }
.meter > div { height: 100%; background: var(--base); border-radius: 4px; }
.avisos { display: flex; flex-direction: column; gap: 8px; }
.aviso { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); text-decoration: none; color: var(--ink); }
.aviso:hover { background: color-mix(in srgb, var(--surface-2) 70%, var(--border-strong)); }
.aviso .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
.aviso.warn .ic { background: color-mix(in srgb, var(--warn) 25%, transparent); color: var(--warn-ink); }
.aviso.bad .ic { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad-ink); }
.aviso.info .ic { background: var(--accent-wash); color: var(--accent-ink); }
.aviso small { display: block; color: var(--muted); }
.aviso .ir { color: var(--accent-ink); font-weight: 650; font-size: 0.88rem; white-space: nowrap; }
.hbar.caja { grid-template-columns: minmax(110px, 200px) 1fr auto; }
.hbar.caja .lbl { display: flex; align-items: center; gap: 6px; }
.hbar.caja .track > div { border-radius: 4px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; max-width: 460px; }
.cal .h { text-align: center; font-size: 0.75rem; font-weight: 650; color: var(--muted); }
.cal .c { aspect-ratio: 1.3; border-radius: 6px; display: grid; place-items: center; font-size: 0.85rem; font-weight: 650; text-decoration: none; font-variant-numeric: tabular-nums; }
.cal .c.none { border: 1px dashed var(--grid); color: var(--muted); }
.cal .c.fut { color: var(--muted); opacity: 0.45; }
.apoyo { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--grid); font-size: 0.92rem; }
.apoyo:last-child { border-bottom: 0; }
.apoyo a { color: var(--ink); text-decoration: none; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 600px) { .hbar.caja { grid-template-columns: 1fr auto; } .hbar.caja .track { grid-column: 1 / 3; grid-row: 2; } }

svg.chart { display: block; width: 100%; overflow: visible; }
svg.chart text { fill: var(--muted); font: 11px var(--font); font-variant-numeric: tabular-nums; }
svg.chart .gl { stroke: var(--grid); stroke-width: 1; }
svg.chart .ax { stroke: var(--axis); stroke-width: 1; }
svg.chart .col { fill: var(--base); }
svg.chart .col.x { fill: var(--extra); }
svg.chart .hit { fill: transparent; }
svg.chart .hit:hover + .col, svg.chart g.colg:hover .col { filter: brightness(1.1); }
svg.chart .ln { fill: none; stroke: var(--base); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.chart .ln2 { fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linejoin: round; }
svg.chart .area { fill: var(--base); opacity: 0.1; }
svg.chart .pt { fill: var(--base); stroke: var(--surface); stroke-width: 2; }
svg.chart .lbl-v { fill: var(--ink); font-weight: 650; }

.podium { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; align-items: end; max-width: 620px; margin: 0 auto; }
.podium .p { text-align: center; }
.podium .who { font-weight: 700; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podium .kg { font-size: 0.9rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.podium .step { margin-top: 8px; border-radius: 10px 10px 0 0; display: grid; place-items: center; font-size: 1.8rem; font-weight: 800; color: var(--ink); background: var(--surface-2); border: 1px solid var(--border); border-bottom: 0; }
.podium .p1 .step { height: 120px; background: color-mix(in srgb, #eda100 30%, var(--surface)); }
.podium .p2 .step { height: 88px; background: color-mix(in srgb, #9a9a9a 28%, var(--surface)); }
.podium .p3 .step { height: 64px; background: color-mix(in srgb, #b8733a 26%, var(--surface)); }
.medal { font-size: 1.6rem; }

/* ===== Compartir (captura para WhatsApp) ===== */
.share-overlay { position: fixed; inset: 0; z-index: 60; background: var(--page); overflow: auto; padding: 24px 16px 48px; }
.share-card { max-width: 560px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 24px; }
.share-card h2 { font-size: 1.4rem; }
.share-card .srow { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.share-card .srow .pos { font-size: 1.15rem; font-weight: 800; text-align: center; }
.share-card .srow .n { font-weight: 700; font-size: 1.05rem; }
.share-card .srow .d { font-size: 0.85rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.share-card .srow .eur { font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; }

/* ===== Login ===== */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.login .brand { justify-content: center; font-size: 1.3rem; margin-bottom: 18px; }
.login .brand svg { width: 40px; height: 40px; }
.login form { display: flex; flex-direction: column; gap: 14px; }
.login .err { color: var(--bad-ink); font-weight: 600; min-height: 1.4em; margin: 0; font-size: 0.92rem; }

/* ===== Overlays ===== */
.tip {
  position: fixed; z-index: 100; pointer-events: none;
  background: var(--ink); color: var(--page); border-radius: 8px; padding: 8px 10px;
  font-size: 0.82rem; line-height: 1.35; max-width: 260px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  font-variant-numeric: tabular-nums; white-space: pre-line;
}
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
#toast .t { background: var(--ink); color: var(--page); padding: 12px 18px; border-radius: 12px; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); pointer-events: auto; max-width: 90vw; }
#toast .t.err { background: var(--bad); color: #fff; }
@media (max-width: 860px) { #toast { bottom: calc(var(--nav-h) + 20px); } }

dialog {
  border: 1px solid var(--border); border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
dialog form { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
dialog .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
dialog p { margin: 0; color: var(--ink-2); }

details.tbl-toggle > summary { cursor: pointer; font-weight: 600; color: var(--accent-ink); padding: 8px 0; }

/* ===== Parte (impresión) ===== */
.doc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.doc h1 { font-size: 1.4rem; }
.doc h2 { font-size: 1.05rem; margin: 22px 0 8px; }
.doc .meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--ink-2); font-size: 0.92rem; margin-top: 6px; }
.doc .pale-list { display: flex; flex-direction: column; gap: 6px; font-size: 0.92rem; }
.doc .pale-list .pl { padding: 8px 10px; border: 1px solid var(--grid); border-radius: 8px; }
.firmas { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 48px; }
.firmas div { border-top: 1px solid var(--ink); padding-top: 6px; font-size: 0.85rem; color: var(--ink-2); }

@media print {
  :root { color-scheme: light; --page: #fff; --surface: #fff; --surface-2: #f3f3f3; --ink: #000; --ink-2: #333; --muted: #555; --grid: #ccc; }
  body { background: #fff; font-size: 11px; }
  .topbar, .no-print, #toast, .tip { display: none !important; }
  .view { padding: 0; max-width: none; }
  .doc { border: 0; padding: 0; }
  .tbl th, .tbl td { padding: 4px 6px; }
  .tbl-wrap { overflow: visible; }
  .card, .tile { box-shadow: none; break-inside: avoid; }
  .share-overlay { position: static; padding: 0; }
}
