:root {
  --bg: #f4f5f7; --surface: #fff; --ink: #1f2933; --muted: #64707d; --line: #dfe3e8;
  --brand: #17625a; --brand-ink: #fff; --brand-soft: #e3f1ef;
  --ok: #1b7a43; --ok-soft: #e4f4ea; --warn: #92600a; --warn-soft: #fbf1dc;
  --bad: #b3322a; --bad-soft: #fbe9e7; --shade: #f7f8fa;
  --bar-work: #009080; --bar-justified: #b87200; --bar-break: #3b78d8; --bar-unjustified: #a51d1d; --bar-extra: #7b4fc9;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181d; --surface: #1d232a; --ink: #e8ecf0; --muted: #9aa6b2; --line: #333c46;
    --brand: #4fb8aa; --brand-ink: #0d1a18; --brand-soft: #1b3531;
    --ok: #63cf8f; --ok-soft: #173325; --warn: #e6b65c; --warn-soft: #3a2e14;
    --bad: #f0877e; --bad-soft: #3c1f1c; --shade: #232a32;
    --bar-work: #12a594; --bar-justified: #bd8010; --bar-break: #4f8fe6; --bar-unjustified: #b92b33; --bar-extra: #a07de6;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); }
h1 { font-size: 1.5rem; margin: 0; } h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1040px; margin: auto; padding: .6rem 16px; display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: center; }
.logo { font-weight: 700; color: var(--ink); text-decoration: none; margin-right: .5rem; }
.nav { display: flex; flex-wrap: wrap; gap: .1rem; flex: 1; }
.nav a { padding: .3rem .6rem; border-radius: 6px; color: var(--muted); text-decoration: none; font-size: .95rem; }
.nav a.on, .nav a:hover { background: var(--brand-soft); color: var(--brand); }
.who { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .9rem; }
.who form { margin: 0; }
main { max-width: 1040px; margin: auto; padding: 1.25rem 16px 3rem; }
.head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.sub { color: var(--muted); font-size: .92rem; margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.grid .card { margin: 0; }
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; }
.stat b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .85rem; }
.btn { display: inline-block; font: inherit; padding: .5rem .95rem; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--shade); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.danger { color: var(--bad); }
.btn.small { padding: .2rem .55rem; font-size: .85rem; }
.btn.link { border: 0; background: none; color: var(--muted); padding: 0; font-size: .9rem; text-decoration: underline; }
.clock-state { font-size: 1.05rem; margin: 0 0 .75rem; }
.clock-btn { width: 100%; font-size: 1.2rem; padding: .9rem; font-weight: 600; }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--muted); margin-right: .4rem; }
.dot.on { background: var(--ok); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: .82rem; }
th, td { padding: .42rem .55rem; border-bottom: 1px solid var(--line); vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.rest td { background: var(--shade); color: var(--muted); }
tr.today td { background: var(--brand-soft); }
.punch { white-space: nowrap; display: inline-block; margin-right: .6rem; font-variant-numeric: tabular-nums; }
th.timeline-col { min-width: 250px; width: 38%; }
.axis { position: relative; height: 1.1rem; margin-top: .15rem; font-weight: 400; font-size: .72rem; font-variant-numeric: tabular-nums; }
.axis span { position: absolute; transform: translateX(-50%); }
.timeline { position: relative; height: 12px; min-width: 230px; margin-top: .3rem; border-radius: 3px; background: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px calc(100% / var(--hours))); }
.slot { position: absolute; top: 0; bottom: 0; min-width: 2px; border-radius: 2px; }
.slot.window, .swatch.window { background-color: var(--line); }
.slot.window { top: 4px; bottom: 4px; }
.slot.worked, .swatch.worked { background: var(--bar-work); }
.slot.break, .swatch.break { background: var(--bar-break); }
.slot.justified, .swatch.justified { background: var(--bar-justified); }
.slot.pending, .swatch.pending { background: repeating-linear-gradient(135deg, var(--bar-justified) 0 3px, transparent 3px 5px); }
.slot.live, .swatch.live { background: repeating-linear-gradient(135deg, var(--bar-work) 0 3px, transparent 3px 5px); }
.slot.unjustified, .swatch.unjustified { background: var(--bar-unjustified); }
.slot.extra, .swatch.extra { background: var(--bar-extra); }
.slot.incident, .swatch.incident { background: var(--ink); }
.barlegend i.incident { width: 3px; height: .75rem; border-radius: 0; vertical-align: -.1rem; }
.slot.incident { top: -2px; bottom: -2px; min-width: 3px; }
.timeline .now { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--ink); }
.pending-list { max-height: 24rem; overflow-y: auto; margin-top: .5rem; }
.barlegend { display: flex; flex-wrap: wrap; gap: .15rem .9rem; color: var(--muted); font-size: .8rem; margin: .4rem 0 .6rem; }
.barlegend i { display: inline-block; width: .75rem; height: .5rem; border-radius: 2px; margin-right: .3rem; }
.tag.link { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.pos { color: var(--ok); } .neg { color: var(--bad); }
.tag { display: inline-block; font-size: .77rem; padding: 0 .45rem; border-radius: 99px; background: var(--shade); color: var(--muted); white-space: nowrap; margin: 1px 0; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.msg { padding: .55rem .85rem; border-radius: 7px; margin-bottom: .75rem; background: var(--brand-soft); }
.msg.success { background: var(--ok-soft); color: var(--ok); }
.msg.warning { background: var(--warn-soft); color: var(--warn); }
.msg.error { background: var(--bad-soft); color: var(--bad); }
.form p { margin: 0 0 .85rem; }
.form label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: .2rem; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 7px; width: 100%; }
.inline input { width: auto; }
.helptext { color: var(--muted); font-size: .84rem; display: block; }
.helptext ul { margin: .25rem 0; padding-left: 1.1rem; }
.errorlist { list-style: none; margin: 0 0 .25rem; padding: 0; color: var(--bad); font-size: .88rem; }
.narrow { max-width: 420px; margin: 2.5rem auto; }
.month-nav { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.actions { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.actions form { margin: 0; }
.actions input { width: 150px; padding: .2rem .4rem; font-size: .85rem; }
.empty { color: var(--muted); margin: 0; }
@media (max-width: 640px) {
  .logo { flex: 1; }
  .nav { order: 3; flex-basis: 100%; }
  th.opt, td.opt { display: none; }
}
.kiosk { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.kiosk-card { width: 100%; max-width: 400px; text-align: center; }
.kiosk-time { font-size: 3rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kiosk-fields { display: grid; gap: .6rem; margin: 1rem 0; }
.kiosk-fields input { font-size: 1.3rem; text-align: center; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: .6rem; }
.keypad button { font-size: 1.5rem; padding: .7rem 0; }
.kiosk-result { font-size: 1.4rem; font-weight: 600; }
.kiosk-qr { margin: .75rem auto .25rem; width: 200px; min-height: 200px; }
.kiosk-qr svg { display: block; width: 100%; height: auto; }
.inline input[type=checkbox] { width: auto; }
