@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url(/static/fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap; src: url(/static/fonts/jetbrains-mono-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 700; font-display: swap; src: url(/static/fonts/jetbrains-mono-latin-700-normal.woff2) format("woff2"); }

:root {
  --bg: #0a0a0a; --bg-card: #121212; --bg-elev: #1a1a1a; --bg-hi: #222;
  --border: #1f1f1f; --border-active: #333;
  --text: #e5e5e5; --text-mute: #888; --text-dim: #555;
  --green: #4ade80; --red: #f87171; --amber: #f59e0b; --blue: #60a5fa;
  --purple: #a78bfa; --pink: #e879f9; --teal: #2dd4bf;
  --c-push: var(--blue); --c-pull: var(--purple); --c-legs: var(--green);
  --c-upper: var(--amber); --c-lower: var(--pink);
  --nav-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); color: var(--text); }
body {
  font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 14px; line-height: 1.45;
  padding-top: calc(48px + var(--safe-t));
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: contain;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.mute { color: var(--text-mute); } .dim { color: var(--text-dim); }
.green { color: var(--green); } .red { color: var(--red); } .amber { color: var(--amber); } .blue { color: var(--blue); }
.small { font-size: 11px; } .num { font-variant-numeric: tabular-nums; }

/* ---------- header / nav ---------- */
header.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  height: calc(48px + var(--safe-t)); padding: var(--safe-t) 14px 0;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(10,10,10,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 500; letter-spacing: .12em; font-size: 13px; }
.brand span { color: var(--text-dim); margin-left: 8px; letter-spacing: .08em; font-size: 11px; }
.status { display: flex; gap: 6px; align-items: center; }
.pill { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; padding: 3px 8px; border: 1px solid var(--border-active); border-radius: 99px; color: var(--text-mute); }
.pill.off { color: var(--amber); border-color: #5a3d0a; }
.pill.q { color: var(--blue); border-color: #1e3a5f; }
nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(10,10,10,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--border);
}
nav.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-dim); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; }
nav.tabs a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; }
nav.tabs a.on { color: var(--text); }
nav.tabs a.on svg { stroke: var(--blue); }
#banner:empty { display: none; }
#banner { margin: 10px 12px 0; }
main { padding: 12px; max-width: 720px; margin: 0 auto; }

/* ---------- genéricos ---------- */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
.label { font-size: 10px; color: var(--text-dim); letter-spacing: .15em; text-transform: uppercase; }
.h { font-size: 11px; color: var(--text-mute); letter-spacing: .14em; text-transform: uppercase; margin: 18px 2px 8px; display: flex; justify-content: space-between; align-items: baseline; }
.h:first-child { margin-top: 4px; }
.row { display: flex; gap: 8px; align-items: center; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--border-active); background: var(--bg-elev); color: var(--text); font-size: 13px; letter-spacing: .04em; }
.btn:active { background: var(--bg-hi); }
.btn.primary { background: var(--text); color: #0a0a0a; border-color: var(--text); font-weight: 700; }
.btn.primary:active { background: #bbb; }
.btn.danger { color: var(--red); border-color: #4a1d1d; }
.btn.ghost { background: none; border-style: dashed; color: var(--text-mute); }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 0 10px; font-size: 12px; }
.btn[disabled] { opacity: .4; }
.chip { display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border-active); color: var(--text-mute); font-size: 12px; background: none; white-space: nowrap; }
.chip.on { background: var(--text); color: #0a0a0a; border-color: var(--text); font-weight: 700; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips.scroll::-webkit-scrollbar { display: none; }
input.f, select.f, textarea.f { width: 100%; min-height: 44px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border-active); border-radius: 8px; font-size: 16px; }
input.f:focus, select.f:focus, textarea.f:focus { outline: none; border-color: var(--blue); }
textarea.f { min-height: 120px; font-size: 12px; }
.warn { border: 1px solid #5a3d0a; background: #1a1206; color: var(--amber); border-radius: 8px; padding: 10px 12px; font-size: 12px; margin-bottom: 10px; }
.err { border: 1px solid #4a1d1d; background: #1a0b0b; color: var(--red); border-radius: 8px; padding: 10px 12px; font-size: 12px; margin-bottom: 10px; }
.ok { border: 1px solid #1a4a2a; background: #08160d; color: var(--green); border-radius: 8px; padding: 10px 12px; font-size: 12px; margin-bottom: 10px; }
.empty { color: var(--text-dim); text-align: center; padding: 28px 10px; font-size: 12px; }

/* ---------- registrar ---------- */
.datebar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.seg { position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; border-radius: 8px; border: 1px solid var(--border-active); background: var(--bg-card); color: var(--text-mute); font-size: 13px; overflow: hidden; }
.seg.on { border-color: var(--text); color: var(--text); background: var(--bg-elev); }
.seg input[type=date] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; }
.types { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 12px; }
.type { position: relative; min-height: 46px; border-radius: 8px; border: 1px solid var(--border-active); background: var(--bg-card); color: var(--text-mute); font-size: 12px; letter-spacing: .03em; }
.type.on { color: #0a0a0a; font-weight: 700; }
.type.t-Push.on { background: var(--c-push); border-color: var(--c-push); }
.type.t-Pull.on { background: var(--c-pull); border-color: var(--c-pull); }
.type.t-Legs.on { background: var(--c-legs); border-color: var(--c-legs); }
.type.t-Upper.on { background: var(--c-upper); border-color: var(--c-upper); }
.type.t-Lower.on { background: var(--c-lower); border-color: var(--c-lower); }
.type .dot { position: absolute; top: 5px; right: 6px; width: 6px; height: 6px; border-radius: 99px; background: var(--text); }
.type.on .dot { background: #0a0a0a; }
.tag { display: inline-block; font-size: 10px; letter-spacing: .08em; padding: 1px 7px; border-radius: 4px; color: #0a0a0a; font-weight: 700; }
.tag.t-Push { background: var(--c-push); } .tag.t-Pull { background: var(--c-pull); } .tag.t-Legs { background: var(--c-legs); }
.tag.t-Upper { background: var(--c-upper); } .tag.t-Lower { background: var(--c-lower); }
.excard { display: block; width: 100%; text-align: left; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 8px; position: relative; overflow: hidden; }
button.excard:active, .exhead:active { background: var(--bg-elev); }
.exhead { display: block; width: 100%; text-align: left; margin: -12px -14px 0; padding: 12px 14px 4px; width: calc(100% + 28px); border-radius: 8px 8px 0 0; }
.excard.done { border-color: #1a4a2a; }
.excard .name { font-size: 14px; font-weight: 500; }
.excard .meta { font-size: 11px; color: var(--text-mute); margin-top: 2px; }
.excard .last { font-size: 11px; color: var(--text-dim); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.excard .tops { font-size: 12px; color: var(--text-mute); margin-top: 6px; font-variant-numeric: tabular-nums; }
.excard .tops b, .tops.big b { color: var(--amber); font-weight: 500; }
.tops.big { font-size: 20px; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.toca { font-size: 12px; margin: -4px 2px 6px; }
.excard .count { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text-mute); }
.excard.done .count { color: var(--green); }
.progress { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--green); }
.ex-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ex-head .back { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border-active); border-radius: 8px; font-size: 18px; }
.ex-head h2 { font-size: 16px; font-weight: 500; }
.setline { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.setline:last-child { border-bottom: none; }
.setline .n { color: var(--text-dim); width: 18px; }
.setline .v { flex: 1; }
.setline .v b { font-weight: 500; }
.setline .nt { color: var(--text-mute); font-size: 11px; display: block; }
.setline.pending { opacity: .6; }
.iconbtn { min-width: 40px; min-height: 40px; border-radius: 8px; border: 1px solid var(--border); color: var(--text-mute); display: inline-flex; align-items: center; justify-content: center; }
.stepper { display: grid; grid-template-columns: 56px 1fr 56px; gap: 8px; align-items: center; }
.stepper button { min-height: 56px; border-radius: 10px; border: 1px solid var(--border-active); background: var(--bg-elev); font-size: 24px; color: var(--text); }
.stepper button:active { background: var(--bg-hi); }
.stepper input { text-align: center; font-size: 26px; font-weight: 500; min-height: 56px; background: var(--bg); border: 1px solid var(--border-active); border-radius: 10px; width: 100%; font-variant-numeric: tabular-nums; }
.stepper input:focus { outline: none; border-color: var(--blue); }
.field { margin-bottom: 14px; }
.field > .label { margin-bottom: 6px; display: flex; justify-content: space-between; }
.rir { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.rir button { min-height: 48px; border-radius: 10px; border: 1px solid var(--border-active); background: var(--bg-elev); font-size: 17px; color: var(--text-mute); }
.rir button.on { background: var(--text); color: #0a0a0a; border-color: var(--text); font-weight: 700; }
.save { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 8px); z-index: 5; min-height: 56px; font-size: 15px; box-shadow: 0 -8px 20px rgba(10,10,10,.9); }
.target { font-size: 12px; color: var(--text-mute); }
.target b { color: var(--text); font-weight: 500; }

/* ---------- timer ---------- */
.timer { position: fixed; left: 12px; right: 12px; top: calc(48px + var(--safe-t) + 6px); z-index: 30; max-width: 696px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-radius: 10px; background: #0f1a2b; border: 1px solid #1e3a5f; box-shadow: 0 8px 24px rgba(0,0,0,.6); }
.timer .t { font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--blue); min-width: 70px; }
.timer.done { background: #0b1f12; border-color: #1a4a2a; }
.timer.done .t { color: var(--green); }
.timer .bar { flex: 1; height: 4px; background: #1e3a5f; border-radius: 99px; overflow: hidden; }
.timer .bar i { display: block; height: 100%; background: var(--blue); }

/* ---------- sheet / toast ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; }
.sheet .panel { width: 100%; max-width: 720px; max-height: 88vh; overflow-y: auto; background: var(--bg-card); border-top: 1px solid var(--border-active); border-radius: 14px 14px 0 0; padding: 16px 14px calc(16px + var(--safe-b)); }
.sheet .panel h3 { font-size: 14px; font-weight: 500; margin-bottom: 12px; }
.sheet .grab { width: 40px; height: 4px; border-radius: 99px; background: var(--border-active); margin: -4px auto 12px; }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 76px); z-index: 60; pointer-events: none; }
#toast div { background: var(--text); color: #0a0a0a; padding: 9px 14px; border-radius: 8px; font-size: 12px; font-weight: 500; margin-top: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.6); max-width: 86vw; }
#toast div.e { background: var(--red); }
.pick { display: block; width: 100%; text-align: left; padding: 12px 4px; border-bottom: 1px solid var(--border); font-size: 13px; }
.pick small { color: var(--text-dim); font-size: 10px; letter-spacing: .08em; margin-left: 6px; }

/* ---------- kpis / tablas / charts ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 10px; }
@media (min-width: 560px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
.kpi { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.kpi .v { font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .s { font-size: 10.5px; color: var(--text-mute); margin-top: 1px; }
.chartbox { position: relative; height: 230px; }
.chartbox.sm { height: 160px; }
table.t { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
table.t th { text-align: left; font-weight: 400; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); padding: 6px 6px; border-bottom: 1px solid var(--border-active); }
table.t td { padding: 7px 6px; border-bottom: 1px solid var(--border); }
table.t td.r, table.t th.r { text-align: right; }
.tscroll { overflow-x: auto; margin: 0 -2px; }
td.lo { color: var(--amber); } td.hi { color: var(--green); } td.z { color: var(--text-dim); }
.sess { border: 1px solid var(--border); border-radius: 8px; background: var(--bg-card); margin-bottom: 8px; }
.sess > button { width: 100%; text-align: left; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.sess .body { padding: 0 14px 10px; }
.sess .exn { font-size: 12px; color: var(--text-mute); margin: 10px 0 2px; }
.weekhdr { font-size: 10px; color: var(--text-dim); letter-spacing: .14em; margin: 16px 2px 6px; text-transform: uppercase; }
.list li { list-style: none; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.list li:last-child { border-bottom: none; }
.login { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; gap: 12px; max-width: 360px; margin: 0 auto; }
.login h1 { font-size: 18px; font-weight: 500; letter-spacing: .12em; }
.wknav { display: grid; grid-template-columns: 48px 1fr 48px; gap: 8px; align-items: center; margin-bottom: 12px; }
.wknav .c { text-align: center; }
.wknav .c b { display: block; font-size: 16px; font-weight: 500; }

body.timer-on main { padding-top: 70px; }

/* filas de series prellenadas */
.sets { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--border); }
.sethead, .srow { display: grid; grid-template-columns: 20px 1fr 1.3fr 0.95fr 50px; gap: 6px; align-items: center; }
.sethead { font-size: 9.5px; color: var(--text-dim); letter-spacing: .12em; text-transform: uppercase; padding-bottom: 4px; }
.sethead span { text-align: center; }
.srow { padding: 3px 0; }
.srow .n { color: var(--text-dim); font-size: 12px; text-align: center; }
.srow input, .srow select { width: 100%; min-height: 46px; text-align: center; text-align-last: center; background: var(--bg); border: 1px solid var(--border-active); border-radius: 8px; font-size: 18px; font-variant-numeric: tabular-nums; padding: 0 2px; -webkit-appearance: none; appearance: none; }
.srow input:focus, .srow select:focus { outline: none; border-color: var(--blue); }
.srow input::placeholder { color: var(--text-dim); }
.srow .ok { min-height: 46px; border-radius: 8px; border: 1px solid #1a4a2a; background: #08160d; color: var(--green); font-size: 20px; }
.srow .ok:active { background: #12301c; }
.srow.done .v { text-align: center; font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; min-height: 38px; display: flex; align-items: center; justify-content: center; }
.srow .okd { min-height: 38px; border-radius: 8px; color: var(--green); font-size: 16px; border: 1px solid var(--border); }
.tops.green { color: var(--green); }

/* celdas de fila → abren la ruleta */
.srow .cell { min-height: 46px; border-radius: 8px; border: 1px solid var(--border-active); background: var(--bg); font-size: 18px; font-variant-numeric: tabular-nums; color: var(--text); }
.srow .cell:active { background: var(--bg-hi); }
.srow .cell.missing { color: var(--amber); border-color: #5a3d0a; font-size: 14px; }
/* ruleta */
.wheels { display: grid; grid-template-columns: 1fr 1.35fr 1fr; gap: 8px; }
.wlabel { font-size: 10px; color: var(--text-dim); letter-spacing: .14em; text-transform: uppercase; text-align: center; height: 28px; display: flex; justify-content: center; align-items: center; gap: 8px; }
.wcol.focus .wlabel { color: var(--blue); }
.wbox { position: relative; }
.wbox::after { content: ''; position: absolute; left: 4px; right: 4px; top: 89px; height: 44px; border-radius: 8px; background: rgba(96,165,250,.08); border: 1px solid #1e3a5f; pointer-events: none; }
.wheel { height: 222px; overflow-y: scroll; scroll-snap-type: y mandatory; scrollbar-width: none; overscroll-behavior: contain; padding: 88px 0; background: var(--bg); border: 1px solid var(--border-active); border-radius: 10px; -webkit-mask-image: linear-gradient(transparent, #000 32%, #000 68%, transparent); mask-image: linear-gradient(transparent, #000 32%, #000 68%, transparent); touch-action: pan-y; }
.wheel::-webkit-scrollbar { display: none; }
.witem { height: 44px; display: flex; align-items: center; justify-content: center; scroll-snap-align: center; font-size: 19px; color: var(--text-dim); font-variant-numeric: tabular-nums; user-select: none; }
.witem.on { color: var(--text); font-size: 25px; font-weight: 500; }
.kb { min-width: 30px; min-height: 26px; border: 1px solid var(--border-active); border-radius: 6px; color: var(--text-mute); font-size: 13px; letter-spacing: 0; }
.kbin { text-align: center; font-size: 26px !important; min-height: 222px !important; }

/* unidades */
.usw { display: inline-flex; border: 1px solid var(--border-active); border-radius: 99px; overflow: hidden; letter-spacing: 0; text-transform: none; }
.usw button { min-height: 28px; padding: 0 12px; font-size: 12px; color: var(--text-mute); }
.usw button.on { background: var(--text); color: #0a0a0a; font-weight: 700; }
.convrow { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12px; flex-wrap: wrap; }
.convrow input { width: 20px; height: 20px; }
details > summary { cursor: pointer; }
