@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/static/fonts/bricolage.woff2") format("woff2");
  font-weight: 300 800;
  font-display: swap;
}

:root {
  --paper: #f2f5ee;
  --sheet: #fbfcf8;
  --band: #e9eee4;
  --ink: #16241d;
  --soft: #5d6b63;
  --rule: #d3dbcf;
  --pine: #1f6f5b;
  --pine-ink: #165244;
  --amber: #d99a06;
  --amber-wash: #fbf0cf;
  --rest: #b4beb6;
  --danger: #a3341f;
  --font: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1713;
    --sheet: #151f1a;
    --band: #1a2620;
    --ink: #e2e9e1;
    --soft: #8e9c93;
    --rule: #2a3830;
    --pine: #5cc4a6;
    --pine-ink: #8ad9c1;
    --amber: #efb73a;
    --amber-wash: #33290f;
    --rest: #4c5a52;
    --danger: #f08a73;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1713;
  --sheet: #151f1a;
  --band: #1a2620;
  --ink: #e2e9e1;
  --soft: #8e9c93;
  --rule: #2a3830;
  --pine: #5cc4a6;
  --pine-ink: #8ad9c1;
  --amber: #efb73a;
  --amber-wash: #33290f;
  --rest: #4c5a52;
  --danger: #f08a73;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.45 var(--font);
  font-optical-sizing: auto;
}
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
a { color: inherit; }
h1, h2, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 4px; }

/* ---- Top bar ---- */
.top {
  display: flex; align-items: center; gap: 8px 28px; flex-wrap: wrap;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--rule);
}
.mark { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 700; font-size: 1.12rem; letter-spacing: -0.01em; color: var(--pine-ink); }
.mark span { color: var(--ink); }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 7px 13px; border-radius: 999px; text-decoration: none; color: var(--soft); font-weight: 500; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current] { background: var(--ink); color: var(--paper); }
.tools { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.quiet { background: none; border: 0; padding: 7px 10px; border-radius: 8px; color: var(--soft); cursor: pointer; display: inline-flex; align-items: center; }
.quiet:hover { color: var(--ink); background: var(--band); }

/* ---- Page frame ---- */
.page { max-width: 1180px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 72px; }
.page > section, .two > section { margin-top: 44px; }
h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; }
h2 { font-size: 1.05rem; font-weight: 650; letter-spacing: -0.005em; margin-bottom: 14px; }
.sub { color: var(--soft); margin-top: 4px; }
.sub b { color: var(--ink); font-weight: 650; }
.note { color: var(--soft); font-size: 0.875rem; margin-top: 14px; max-width: 68ch; }
.bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 22px; }
.controls { display: flex; gap: 12px; flex-wrap: wrap; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.scroll { overflow-x: auto; margin-inline: calc(-1 * clamp(16px, 4vw, 40px)); padding-inline: clamp(16px, 4vw, 40px); }

.stepper, .switch { display: inline-flex; border: 1px solid var(--rule); border-radius: 10px; background: var(--sheet); overflow: hidden; }
.stepper a, .switch a { padding: 7px 13px; text-decoration: none; font-weight: 500; color: var(--soft); min-width: 40px; text-align: center; }
.stepper a + a, .switch a + a { border-left: 1px solid var(--rule); }
.stepper a:hover, .switch a:hover { color: var(--ink); background: var(--band); }
.stepper a[aria-current], .switch a[aria-current] { color: var(--ink); font-weight: 650; }
.switch a[aria-current] { background: var(--ink); color: var(--paper); }

.primary { background: var(--pine); color: var(--sheet); border: 0; border-radius: 9px; padding: 9px 16px; font-weight: 650; cursor: pointer; }
:root[data-theme="dark"] .primary { color: #0f1713; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .primary { color: #0f1713; } }
.primary:hover { filter: brightness(1.08); }

input { background: var(--sheet); border: 1px solid var(--rule); border-radius: 9px; padding: 8px 11px; }
input:focus-visible { border-color: var(--pine); }
/* ---- Login ---- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login main { width: min(100%, 360px); }
.dial { width: 84px; margin-bottom: 22px; color: var(--pine); }
.dial-face { fill: var(--sheet); stroke: currentColor; stroke-width: 4; }
.dial-ticks path { stroke: var(--rest); stroke-width: 3; stroke-linecap: round; fill: none; }
.dial-hands { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.login h1 { font-size: 2.4rem; font-weight: 750; letter-spacing: -0.03em; }
.login .lede { margin: 4px 0 26px; }
.login form { display: grid; gap: 14px; }
.login label { display: grid; gap: 5px; font-size: 0.875rem; color: var(--soft); }
.login input { font-size: 1rem; padding: 11px 12px; color: var(--ink); }
.login .primary { padding: 12px 16px; margin-top: 6px; }
.alert { border-left: 4px solid var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); padding: 10px 12px; margin-bottom: 18px; border-radius: 0 6px 6px 0; }

/* ---- Ticket list ---- */
.page.wide { max-width: 1480px; }
.stepper span { padding: 7px 13px; color: var(--rest); min-width: 40px; text-align: center; }
.stepper span[aria-current] { color: var(--ink); font-weight: 650; border-inline: 1px solid var(--rule); }

.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 26px; }
.fig { background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.fig .lab { color: var(--soft); font-size: 0.8125rem; font-weight: 500; }
.fig .val { margin-top: 4px; color: var(--soft); }
.fig .val b { font-size: 1.9rem; font-weight: 750; letter-spacing: -0.03em; color: var(--pine-ink); line-height: 1.1; }
.fig .val span { font-size: 0.875rem; }
.fig .val.when { color: var(--ink); font-weight: 650; font-size: 1.05rem; padding-top: 8px; }
.fig .val.none { color: var(--soft); padding-top: 8px; }
.fig .meter { height: 5px; background: var(--band); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.fig .meter i { display: block; height: 100%; background: var(--pine); }
.fig.over .val b { color: var(--danger); }
.fig.over .meter i { background: var(--danger); }

.gridbox { overflow-x: auto; border: 1px solid var(--rule); border-radius: 12px; background: var(--sheet); -webkit-overflow-scrolling: touch; }
.grid { width: 100%; min-width: 1120px; border-collapse: collapse; }
.grid th, .grid td { padding: 12px 14px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; font-size: 0.9375rem; white-space: normal; overflow-wrap: anywhere; }
.grid thead th { font-weight: 500; color: var(--soft); font-size: 0.8125rem; border-bottom: 2px solid var(--ink); vertical-align: bottom; white-space: nowrap; }
.grid tbody tr:last-child > * { border-bottom: 0; }
.grid tbody tr:nth-child(even) > * { background: var(--band); }
.grid .c-ticket { width: 22%; min-width: 220px; font-weight: 400; }
.grid .c-text { width: 23%; min-width: 230px; }
.grid .c-num { width: 7%; text-align: right; white-space: nowrap; font-weight: 650; }
.grid thead .c-num { text-align: right; }
.grid .c-tolog { width: 9%; white-space: nowrap; }
.grid .c-block { width: 16%; min-width: 170px; }
.grid .key { font-weight: 700; color: var(--pine-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.grid .title { display: block; margin-top: 2px; font-weight: 650; }
.grid .meta { display: block; margin-top: 4px; color: var(--soft); font-size: 0.8125rem; }
.started { display: inline-block; font-size: 0.72rem; font-weight: 650; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--pine) 16%, transparent); color: var(--pine-ink); vertical-align: 1px; }
.grid td.blocked { background: var(--amber-wash) !important; box-shadow: inset 4px 0 0 var(--amber); font-weight: 500; }
.tolog { display: inline-flex; align-items: center; gap: 6px; }
.tolog input { width: 5.2rem; text-align: right; padding: 7px 9px; font-weight: 650; }
.tolog .unit { color: var(--soft); }
.state { display: block; min-height: 1.2em; margin-top: 4px; font-size: 0.78rem; color: var(--soft); white-space: normal; }
.state.ok { color: var(--pine-ink); }
.state.bad { color: var(--danger); }
.grid .empty td { color: var(--soft); padding: 34px 16px; }

@media (max-width: 760px) {
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fig .val b { font-size: 1.5rem; }
}
