@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url('/fonts/archivo-wdth.woff2') format('woff2-variations'), url('/fonts/archivo-wdth.woff2') format('woff2');
}
:root {
  color-scheme: dark;
  --bg: #0d1311;
  --panel: #131b18;
  --raised: #1a2420;
  --line: #24302b;
  --line-2: #2f3d37;
  --ink: #e9f0ed;
  --ink-2: #aab9b2;
  --muted: #74857e;
  --brand: #01bd71;
  --brand-ink: #03140c;
  --brand-soft: rgba(1, 189, 113, 0.12);
  --red: #fd3336;
  --red-soft: rgba(253, 51, 54, 0.13);
  --yellow: #feda56;
  --yellow-soft: rgba(254, 218, 86, 0.13);
  --chart: #0fa866;
  --chart-muted: #2a3832;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sidebar: 248px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: var(--font); font-size: 14.5px; line-height: 1.5; font-variation-settings: 'wdth' 100; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.num, td.n, .tab { font-variant-numeric: tabular-nums; }
.wide { font-variation-settings: 'wdth' 118; letter-spacing: -0.01em; }
h1, h2, h3 { font-weight: 650; margin: 0; font-variation-settings: 'wdth' 116; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 15.5px; }
h3 { font-size: 14px; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.small { font-size: 12.5px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--bg); padding: 22px 14px 14px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }
.brand img.word { height: 15px; width: auto; display: block; }
.side nav { flex: 1; overflow-y: auto; }
.group { margin: 4px 0 14px; }
.group > p { margin: 0 8px 6px; font-size: 12px; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--ink-2); cursor: pointer; border: 0; background: none; width: 100%; text-align: left; }
.nav svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav:hover { background: var(--panel); color: var(--ink); text-decoration: none; }
.nav.on { background: var(--brand-soft); color: var(--ink); }
.nav.on svg { stroke: var(--brand); }
.nav .count { margin-left: auto; background: var(--yellow); color: #1c1600; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 0 7px; line-height: 18px; }
.me { display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid var(--line); }
.me .who { min-width: 0; }
.me .who b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--raised); color: var(--ink); border: 1px solid var(--line-2); flex: none; }

.main { min-width: 0; }
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 16px 32px; background: rgba(13, 19, 17, 0.88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .menu { display: none; }
.top h1 { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2); background: var(--panel); cursor: pointer; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.live .dot { background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.page { padding: 26px 32px 60px; max-width: 1240px; }

/* ---------- surfaces ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.stack > * + * { margin-top: 18px; }
.ph { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.ph p { margin: 2px 0 0; }
.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: 1.6fr 1fr; }
.g-2e { grid-template-columns: 1fr 1fr; }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* stat strip: one surface divided by hairlines (not separate cards) */
.stats { display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); }
.stat { padding: 16px 20px; border-left: 1px solid var(--line); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat .v { font-size: 26px; font-weight: 650; font-variation-settings: 'wdth' 112; font-variant-numeric: tabular-nums; line-height: 1.15; margin-top: 4px; }
.stat .v small { font-size: 14px; color: var(--muted); font-weight: 500; }
.stat .l { font-size: 12.5px; color: var(--ink-2); }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- punch hero ---------- */
.punch { display: grid; grid-template-columns: 1fr 230px; gap: 28px; align-items: center; padding: 26px 28px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); position: relative; overflow: hidden; }
.punch::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--muted); }
.punch.in::before { background: var(--brand); }
.punch .clock { font-size: 64px; font-weight: 600; font-variation-settings: 'wdth' 125; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; margin: 6px 0 10px; }
.punch .clock span { color: var(--muted); }
.punch .state { font-size: 15px; color: var(--ink-2); }
.punch .state b { color: var(--ink); font-weight: 600; }
.ring { width: 230px; height: 230px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .center b { font-size: 30px; font-variation-settings: 'wdth' 118; font-variant-numeric: tabular-nums; font-weight: 650; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line-2); border-radius: 99px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 13px; border-radius: 99px; color: var(--ink-2); cursor: pointer; font-size: 13px; }
.seg button.on { background: var(--raised); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-2); background: var(--raised); color: var(--ink); padding: 9px 15px; border-radius: var(--r-sm); cursor: pointer; font-weight: 550; font-size: 14px; white-space: nowrap; }
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: transparent; border-color: rgba(253, 51, 54, 0.45); color: #ff7d7f; }
.btn.ghost { background: transparent; }
.btn.lg { padding: 14px 26px; font-size: 16px; border-radius: var(--r-md); font-variation-settings: 'wdth' 112; }
.btn.out { background: var(--red); border-color: var(--red); color: #fff; }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
label.f { display: block; }
label.f > span { display: block; font-size: 12.5px; color: var(--ink-2); margin: 0 0 6px; }
.input, select.input, textarea.input { width: 100%; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 9px 11px; outline: none; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea.input { min-height: 74px; resize: vertical; }
input[type='month'].input, input[type='date'].input, input[type='datetime-local'].input { color-scheme: dark; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.check input { accent-color: var(--brand); width: 16px; height: 16px; }
.formsec { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 13px; }

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; margin: 0 -20px -20px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 20px; border-top: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th { font-weight: 500; color: var(--muted); font-size: 12.5px; border-top: 0; padding-top: 4px; }
td.n, th.n { text-align: right; }
tr.click { cursor: pointer; }
tr.click:hover td { background: rgba(255, 255, 255, 0.02); }
.person { display: flex; align-items: center; gap: 10px; }
.person b { font-weight: 550; }
.person div span { display: block; font-size: 12px; color: var(--muted); }

/* ---------- status chips: brand palette = status system, always icon + label ---------- */
.st { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 7px; border-radius: 99px; font-size: 12.5px; font-weight: 550; white-space: nowrap; }
.st i { font-style: normal; font-size: 11px; width: 14px; height: 14px; display: grid; place-items: center; border-radius: 50%; }
.st.good { background: var(--brand-soft); color: #4fe0a4; }
.st.good i { background: var(--brand); color: var(--brand-ink); }
.st.warn { background: var(--yellow-soft); color: var(--yellow); }
.st.warn i { background: var(--yellow); color: #1c1600; }
.st.bad { background: var(--red-soft); color: #ff8a8c; }
.st.bad i { background: var(--red); color: #fff; }
.st.neutral { background: var(--raised); color: var(--ink-2); }
.st.neutral i { background: var(--line-2); color: var(--ink-2); }

/* ---------- roster (admin overview signature) ---------- */
.roster { display: flex; flex-wrap: wrap; gap: 14px 18px; }
.roster .r { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 64px; text-align: center; }
.roster .r .avatar { width: 44px; height: 44px; font-size: 14px; box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--c, var(--line-2)); }
.roster .r small { font-size: 11.5px; color: var(--ink-2); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }

/* ---------- charts ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .bar { fill: var(--chart); }
.chart .bar.mute { fill: var(--chart-muted); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart g.b:hover .bar { fill: #24c07f; }
.chart .ref { stroke: var(--ink-2); stroke-dasharray: 3 4; stroke-width: 1; }
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--raised); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 7px 10px; font-size: 12.5px; color: var(--ink); white-space: nowrap; display: none; }
.tip b { font-weight: 650; }
.hbars { display: grid; gap: 10px; }
.hb { display: grid; grid-template-columns: 130px 1fr 52px; gap: 12px; align-items: center; font-size: 13px; }
.hb .track { height: 10px; border-radius: 0 5px 5px 0; background: transparent; position: relative; }
.hb .fill { position: absolute; inset: 0 auto 0 0; background: var(--chart); border-radius: 0 4px 4px 0; min-width: 2px; }
.hb .lab { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb .val { text-align: right; font-variant-numeric: tabular-nums; }
.hero-num { font-size: 44px; font-weight: 650; font-variation-settings: 'wdth' 120; line-height: 1; font-variant-numeric: tabular-nums; }

/* ---------- lists ---------- */
.list > * { padding: 12px 0; border-top: 1px solid var(--line); }
.list > *:first-child { border-top: 0; padding-top: 0; }
.li { display: flex; align-items: center; gap: 12px; }
.li .grow { flex: 1; min-width: 0; }
.li .grow b { font-weight: 550; }
.li .grow p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.req { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.req:first-child { border-top: 0; padding-top: 0; }
.req .acts { display: flex; gap: 8px; align-items: flex-start; }
.req .why { grid-column: 1 / -1; color: var(--ink-2); font-size: 13.5px; }
.empty { padding: 34px 10px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 4px; }

/* ---------- drawer, toast, misc ---------- */
.scrim { position: fixed; inset: 0; background: rgba(4, 8, 6, 0.6); z-index: 40; display: none; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--panel); border-left: 1px solid var(--line); z-index: 41; transform: translateX(100%); transition: transform 0.22s ease; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.drawer .body { padding: 22px; overflow-y: auto; flex: 1; }
.drawer footer { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 22px; line-height: 1; padding: 4px 8px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60; background: var(--raised); border: 1px solid var(--line-2); color: var(--ink); padding: 11px 16px; border-radius: var(--r-md); display: none; max-width: 92vw; }
.toast.err { border-color: rgba(253, 51, 54, 0.6); }
.toast.ok::before { content: '✓  '; color: var(--brand); font-weight: 700; }
.skel { height: 120px; border-radius: var(--r-lg); background: linear-gradient(90deg, var(--panel), var(--raised), var(--panel)); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px 0 16px; }
.tabs button { background: none; border: 0; padding: 9px 12px; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--brand); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.slip { max-width: 760px; }
.slip .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.slip .net { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; padding: 16px 18px; border-radius: var(--r-md); background: var(--brand-soft); }
.notice { padding: 12px 14px; border-radius: var(--r-md); background: var(--yellow-soft); color: var(--yellow); font-size: 13.5px; }
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate .panel { max-width: 440px; text-align: center; padding: 34px; }
.gate img { height: 18px; margin-bottom: 22px; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) { .g-2, .g-3 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; left: 0; width: 270px; transform: translateX(-100%); transition: transform 0.2s; }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; }
  .top { padding: 12px 16px; }
  .top .menu { display: inline-flex; }
  .page { padding: 18px 16px 50px; }
  .punch { grid-template-columns: 1fr; padding: 22px; }
  .punch .clock { font-size: 40px; }
  .ring { width: 170px; height: 170px; margin: 0 auto; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(odd) { border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .g-2e, .form { grid-template-columns: 1fr; }
  .hb { grid-template-columns: 96px 1fr 44px; }
  .top .pill .lbl { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  .side, .top, .noprint, .scrim, .drawer { display: none !important; }
  .shell { display: block; }
  body { background: #fff; color: #000; }
  .panel { border: 0; background: #fff; color: #000; }
  .slip .net { background: #eee; }
  .muted, .ink2 { color: #444 !important; }
}
.tabs + .req { border-top: 0; padding-top: 4px; }
