:root {
  --bg: #f4f6f9; --panel: #fff; --ink: #1b2430; --muted: #5d6b7c; --line: #d9dfe7;
  --brand: #12355b; --accent: #1f6feb; --accent-ink: #fff; --good: #1a7f37; --warn: #9a6700; --bad: #c62828; --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1419; --panel: #172029; --ink: #e6edf3; --muted: #9aa7b4; --line: #2d3a47;
    --brand: #8fb8e8; --accent: #4c8dff; --accent-ink: #fff; --good: #3fb950; --warn: #d29922; --bad: #ff6b6b; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--brand); }
nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
#who { color: var(--muted); font-size: 14px; }
main { max-width: 820px; margin: 24px auto; padding: 0 16px 64px; }
main.wide { max-width: 1080px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 18px; }
h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 22px 0 6px; }
label { display: block; font-weight: 600; margin: 14px 0 6px; }
.hint { color: var(--muted); font-size: 14px; font-weight: 400; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; }
input[type=checkbox] { width: auto; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; min-width: 0; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 10px 16px; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.danger { border-color: var(--bad); color: var(--bad); }
button.link { border: 0; background: none; color: var(--accent); padding: 4px 0; }
button.small { padding: 4px 10px; font-size: 14px; }
button:disabled { opacity: .55; cursor: default; }
.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.error { color: var(--bad); font-size: 14px; margin-top: 8px; min-height: 1em; }
.ok { color: var(--good); font-size: 14px; margin-top: 8px; }
.notice { border: 1px solid var(--warn); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }
.muted { color: var(--muted); }

.clock { text-align: center; }
.now { font-size: 44px; font-weight: 700; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.state { display: inline-block; margin: 8px 0 18px; padding: 4px 14px; border-radius: 99px; font-weight: 600; border: 1px solid var(--line); }
.state.in { border-color: var(--good); color: var(--good); }
.state.lunch { border-color: var(--warn); color: var(--warn); }
.punch { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; max-width: 520px; margin: 0 auto; }
.punch button { padding: 18px; font-size: 20px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--bg); border-radius: 8px; padding: 12px; text-align: center; }
.tile b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.tile small { color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; border-bottom: 0; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); margin-left: 4px; white-space: nowrap; }
.tag.good { border-color: var(--good); color: var(--good); }
.tag.warn { border-color: var(--warn); color: var(--warn); }
.tag.bad { border-color: var(--bad); color: var(--bad); }
.weeknav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.list li:last-child { border-bottom: 0; }
.day h3 { font-size: 15px; margin: 14px 0 4px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal[hidden] { display: none; }
.modal .panel { width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; margin: 0; }
.actions.tight { margin-top: 0; gap: 6px; flex-wrap: nowrap; }
.actions.tight button, td.nowrap { white-space: nowrap; }
.password { font: 600 22px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; padding: 12px; background: var(--bg); border-radius: 8px; text-align: center; user-select: all; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal .head { font-size: 13px; font-weight: 600; color: var(--muted); padding: 6px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal .cell { min-height: 96px; padding: 4px 6px 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.cal .cell.weekend, .cal .cell.blank { background: var(--bg); }
.cal .cell.today .date { background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: 0 7px; display: inline-block; }
.cal .date { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.holiday { font-size: 12px; font-weight: 600; color: var(--brand); margin-bottom: 3px; }
.chip { font-size: 12px; line-height: 1.3; padding: 2px 6px; margin-bottom: 3px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.mine { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip.sick { border-color: var(--warn); }
.chip.pending { border-style: dashed; color: var(--muted); }
.agenda { display: none; }
.agenda .chip { display: inline-block; margin-right: 6px; white-space: normal; }
@media (max-width: 700px) { .cal { display: none; } .agenda { display: block; } }
.spinner { color: var(--muted); padding: 24px 0; text-align: center; }
@media (max-width: 560px) { .weeknav h1 { order: -1; flex-basis: 100%; margin: 0; } .panel { padding: 16px; } .now { font-size: 36px; } }
