:root {
  --bg: #000;
  --fg: #f2f2f2;
  --mute: #8a8a8a;
  --line: #f2f2f2;
  --acid: #e6ff00;
  --warn: #ff9f0a;
  --danger: #ff2a00;
  --ok: #e6ff00;
  --panel: #0b0b0b;
  --b: 3px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --disp: "Archivo Black", "Arial Black", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--fg); }
body { font: 14px/1.45 var(--mono); min-height: 100vh; overflow-x: hidden; }
button, input, select { font: inherit; color: inherit; }

.top {
  display: flex; justify-content: space-between; align-items: stretch;
  border-bottom: var(--b) solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.brand { font-family: var(--disp); font-size: 20px; line-height: .95; padding: 12px 16px; border-right: var(--b) solid var(--line); letter-spacing: -.5px; }
nav { display: flex; }
.tab { background: none; border: 0; border-left: var(--b) solid var(--line); padding: 0 18px; font-weight: 800; cursor: pointer; letter-spacing: 1px; }
.tab.on { background: var(--fg); color: var(--bg); }

main { max-width: 980px; margin: 0 auto; padding: 16px; }
.pane { display: none; }
.pane.on { display: block; }

h2 { font-family: var(--disp); font-size: 18px; letter-spacing: -.3px; margin-bottom: 12px; font-weight: 400; }
.k, .status-label { font-size: 11px; font-weight: 800; letter-spacing: 1.5px; color: var(--mute); }
.k2 { font-size: 12px; color: var(--mute); }

.block { border: var(--b) solid var(--line); padding: 16px; margin-bottom: 16px; background: var(--panel); }

/* status */
.status { border: var(--b) solid var(--line); padding: 16px; margin-bottom: 16px; box-shadow: 8px 8px 0 var(--line); }
.status-word { font-family: var(--disp); font-size: clamp(56px, 16vw, 140px); line-height: .9; letter-spacing: -3px; margin: 6px 0 10px; word-break: break-word; }
.status-sub { font-weight: 700; max-width: 60ch; }
.status.ok { box-shadow: 8px 8px 0 var(--ok); }
.status.ok .status-word { color: var(--ok); }
.status.warn { box-shadow: 8px 8px 0 var(--warn); border-color: var(--warn); }
.status.warn .status-word { color: var(--warn); }
.status.danger { background: var(--danger); color: #000; border-color: var(--danger); box-shadow: 8px 8px 0 var(--fg); }
.status.danger .status-label { color: #000; }

.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); border: var(--b) solid var(--line); margin: 24px 0 16px; }
.stat { padding: 12px; border-right: var(--b) solid var(--line); min-width: 0; }
.stat:last-child { border-right: 0; }
.stat .v { font-family: var(--disp); font-size: 34px; line-height: 1.05; margin: 6px 0; }
.stat .v small { font-family: var(--mono); font-size: 11px; font-weight: 800; color: var(--mute); }
.bar { height: 10px; border: 2px solid var(--line); margin-top: 6px; }
.bar i { display: block; height: 100%; width: 0; background: var(--acid); }
.bar i.over { background: var(--danger); }
@media (max-width: 720px) {
  .grid4 { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: var(--b) solid var(--line); }
  .stat .v { font-size: 28px; }
  .brand { font-size: 16px; }
  .tab { padding: 0 10px; font-size: 12px; }
}

/* controls */
.row { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.when { margin-bottom: 12px; align-items: end; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 800; letter-spacing: 1px; color: var(--mute); }
input, select {
  background: var(--bg); border: 2px solid var(--line); padding: 10px; color: var(--fg); border-radius: 0; min-width: 0;
}
input:focus, select:focus, button:focus-visible { outline: 3px solid var(--acid); outline-offset: 2px; }
#count { width: 70px; }
#ai-text, #access { flex: 1; width: 100%; }

button.hot, button.ghost, button.danger, .filebtn, .preset {
  border: 2px solid var(--line); background: var(--bg); padding: 10px 14px; font-weight: 800; letter-spacing: 1px; cursor: pointer; text-transform: uppercase;
  transition: transform .05s, box-shadow .05s;
}
button.hot { background: var(--acid); color: #000; border-color: var(--acid); }
button.danger { background: var(--danger); color: #000; border-color: var(--danger); }
button:active, .preset:active { transform: translate(3px, 3px); box-shadow: none !important; }
button.hot:hover, button.ghost:hover, .preset:hover, .filebtn:hover { box-shadow: 4px 4px 0 var(--line); }
button:disabled { opacity: .5; cursor: wait; }
.wide { width: 100%; }
.filebtn { flex-direction: row; color: var(--fg); font-size: 14px; }
.filebtn input { display: none; }

.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 16px; }
.preset { text-align: left; font-size: 12px; line-height: 1.3; }
.preset b { display: block; font-size: 13px; }
.preset span { color: var(--mute); font-weight: 400; text-transform: none; letter-spacing: 0; }

.ai { border-top: 2px dashed var(--mute); padding-top: 14px; }
.ai .row { margin-top: 6px; }
#ai-out:not(:empty) { margin-top: 12px; border: 2px solid var(--acid); padding: 12px; }
.ai-item { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid #333; flex-wrap: wrap; }
.ai-item:last-of-type { border-bottom: 0; }
.ai-actions { display: flex; gap: 8px; margin-top: 10px; }
.err { color: var(--danger); font-weight: 800; }

.manual { margin-top: 14px; }
.manual summary { cursor: pointer; font-weight: 800; letter-spacing: 1px; font-size: 12px; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-top: 12px; align-items: end; }
.chk { flex-direction: row; align-items: center; gap: 8px; color: var(--fg); padding: 10px 0; }
.chk input { width: 20px; height: 20px; accent-color: var(--acid); }

/* flags */
.flags { list-style: none; display: grid; gap: 8px; margin-bottom: 12px; }
.flags li { border: 2px solid var(--line); padding: 10px 12px; border-left-width: 12px; }
.flags li b { display: block; text-transform: uppercase; letter-spacing: .5px; }
.flags li.danger { border-color: var(--danger); background: #1a0500; }
.flags li.warn { border-color: var(--warn); }
.flags li.info { border-color: var(--mute); }
.flags li.none { border-color: var(--acid); }
.review:not(:empty) { margin-top: 12px; white-space: pre-wrap; border: 2px solid var(--acid); padding: 12px; }

/* chart */
.chart svg { width: 100%; height: auto; display: block; }
.chart text { fill: var(--mute); font: 10px var(--mono); }

/* log */
.log { list-style: none; }
.log li { display: grid; grid-template-columns: 60px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid #333; }
.log li .t { color: var(--mute); font-size: 12px; }
.log li .m { font-weight: 800; }
.log li button { background: none; border: 2px solid var(--line); width: 32px; height: 32px; cursor: pointer; font-weight: 800; }
.log li button:hover { background: var(--danger); border-color: var(--danger); color: #000; }
.log .empty { display: block; color: var(--mute); }
.log .d { display: block; grid-column: 1 / -1; color: var(--acid); font-weight: 800; padding-top: 14px; border-bottom: 2px solid var(--line); }
.row + .row, .log + .row { margin-top: 12px; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 190px; }
.day { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; text-align: center; font-size: 11px; }
.day .col { background: var(--fg); min-height: 2px; position: relative; }
.day .col.over { background: var(--danger); }
.day .n { font-weight: 800; margin-bottom: 4px; }
.day .l { color: var(--mute); margin-top: 4px; border-top: 2px solid var(--line); padding-top: 4px; }

.limits { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); border: var(--b) solid var(--line); margin-top: 16px; }
.limits div { padding: 10px; border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); margin: 0 -2px -2px 0; }
.limits b { display: block; font-family: var(--disp); font-size: 22px; font-weight: 400; }
.how { padding-left: 18px; display: grid; gap: 8px; margin-bottom: 12px; }

.sos { border-color: var(--danger); }
.sos h2 { color: var(--danger); }
.sos p { font-weight: 700; margin-bottom: 6px; }

.toast { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 480px; margin: 0 auto; background: var(--acid); color: #000; font-weight: 800; padding: 12px 14px; border: var(--b) solid #000; box-shadow: 6px 6px 0 var(--fg); z-index: 20; }
