:root {
  --paper: #EDF0F2; --surface: #FFFFFF; --ink: #10212F; --steel: #566775; --line: #D3DADF;
  --teal: #0B6E75; --teal-dark: #085860; --amber: #F2A900; --red: #B3261E;
  font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); min-height: 100vh; line-height: 1.45; }
.boot { padding: 2rem; color: var(--steel); }
h1 { font-size: 1.7rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 2rem 0 .6rem; }
.muted { color: var(--steel); }
.error { color: var(--red); min-height: 1.2em; margin: 0; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* header */
.top { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: calc(.7rem + env(safe-area-inset-top)) 1rem .7rem; }
.brand { font-weight: 700; letter-spacing: -.01em; }
.who { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; font-size: .9rem; }
.offline { background: var(--amber); padding: .5rem 1rem; font-size: .9rem; }
.page { max-width: 980px; margin: 0 auto; padding: 1.25rem 1rem calc(3rem + env(safe-area-inset-bottom)); }
.flash { background: #DDF1EE; border-left: 4px solid var(--teal); padding: .7rem .9rem; margin-bottom: 1rem; }

/* buttons + inputs */
.btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: .55rem .9rem; border-radius: 8px; cursor: pointer; }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.sm { padding: .3rem .6rem; font-size: .85rem; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); }
.btn.finish { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); }
.btn.big { width: 100%; min-height: 4rem; font-size: 1.2rem; border-radius: 12px; }
label { display: grid; gap: .3rem; font-size: .9rem; font-weight: 600; }
input, select, textarea { font: inherit; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); width: 100%; }
.stack { display: grid; gap: .9rem; }

/* login */
.login { max-width: 380px; margin: 0 auto; padding: calc(4rem + env(safe-area-inset-top)) 1.25rem 2rem; display: grid; gap: 1rem; }

/* timer panel: the one loud element */
.timer { background: var(--ink); color: #fff; border-radius: 16px; padding: 1.5rem 1.25rem 1.25rem; display: grid; gap: .9rem; }
.timer .state { margin: 0; color: #B7C4CE; font-size: .95rem; }
.clock { font-size: clamp(3.4rem, 19vw, 6.2rem); font-weight: 600; letter-spacing: -.03em; line-height: 1;
  font-variant-numeric: tabular-nums; color: #8FA1AF; }
.clock.on { color: var(--amber); }
.timer .what { margin: 0; color: #DCE4EA; }
.timer input, .timer textarea { background: #1B3246; border-color: #2B445A; color: #fff; }
.timer input::placeholder, .timer textarea::placeholder { color: #8FA1AF; }

/* figures */
.figures { display: flex; gap: 2rem; flex-wrap: wrap; margin: 1.25rem 0 0; }
.figures div { display: grid; }
.figures strong { font-size: 1.7rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.figures span { color: var(--steel); font-size: .88rem; }

/* history list */
.history { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.history li { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }
.history .t { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.history small { display: block; color: var(--steel); }

/* tabs + tables */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: .5rem; overflow-x: auto; }
.tab { font: inherit; font-weight: 600; background: none; border: 0; padding: .7rem 1rem; color: var(--steel);
  border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.tab.active { color: var(--ink); border-bottom-color: var(--teal); }
.scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; padding: .65rem .9rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
th { color: var(--steel); font-weight: 600; font-size: .85rem; }
td.wrap { white-space: normal; min-width: 10rem; }
.live { color: var(--teal-dark); font-weight: 700; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; margin: 1rem 0 .75rem; }
.toolbar label { min-width: 11rem; }
.addform { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; margin: 1rem 0; }
