:root {
  --navy: #0b3a53;
  --teal: #0f7186;
  --teal-dark: #0b5a6c;
  --ink: #17252e;
  --muted: #5b6c77;
  --line: #dde5ea;
  --bg: #f4f7f9;
  --card: #fff;
  --ok: #17794a;
  --ok-bg: #e4f4ec;
  --warn: #8a5a00;
  --warn-bg: #fdf3dc;
  --danger: #b3261e;
  --danger-bg: #fbe9e7;
  --info: #0b5a6c;
  --info-bg: #e2f2f6;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; display: flex; flex-direction: column; min-height: 100vh; }
a { color: var(--teal-dark); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 16px; color: var(--navy); }
h2 { font-size: 1.1rem; margin: 0 0 12px; color: var(--navy); }
p { margin: 0 0 12px; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .92em; }
[hidden] { display: none !important; }

.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1240px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap; }
.brand { display: block; line-height: 0; }
.brand img { height: 32px; width: auto; }
.top nav { display: flex; gap: 2px; flex: 1 1 auto; flex-wrap: wrap; order: 3; width: 100%; }
.top nav a { padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: .95rem; }
.top nav a:hover { background: var(--bg); }
.top nav a.active { background: var(--info-bg); color: var(--teal-dark); font-weight: 600; }
.logout { margin-left: auto; }
.top-bare .top-inner { justify-content: center; padding: 18px 16px; }
.top-bare .brand img { height: 40px; }

main { flex: 1; width: 100%; margin: 0 auto; padding: 20px 16px 32px; }
.page { max-width: 880px; }
.wide { max-width: 1240px; }
.narrow { max-width: 460px; }
.foot { display: flex; gap: 8px 20px; justify-content: center; flex-wrap: wrap; padding: 16px; color: var(--muted); font-size: .85rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h1, .card-head h2 { margin: 0; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.grid-tight { gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.prose p { margin-bottom: 14px; }

label { display: block; font-size: .9rem; font-weight: 600; }
label.check { display: flex; gap: 8px; font-weight: 400; align-items: flex-start; }
label.check input { width: auto; margin-top: 4px; min-height: 0; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; min-height: 44px; font: inherit; font-weight: 400; color: inherit; background: #fff; border: 1px solid #b9c6ce; border-radius: 8px; }
input[type="file"] { padding: 8px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid #7cc4d6; outline-offset: 1px; }
.stack { display: grid; gap: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 18px; font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 8px; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-ghost { background: #fff; color: var(--ink); border-color: #b9c6ce; }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #8f1e18; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn-block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.stack .actions, form .actions { margin-bottom: 0; }
.stack-actions { display: grid; gap: 8px; margin-top: 12px; }

.notice { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid transparent; }
.notice-ok { background: var(--ok-bg); color: var(--ok); border-color: #bfe3cf; }
.notice-error { background: var(--danger-bg); color: var(--danger); border-color: #f2c5c1; }
.notice-warn { background: var(--warn-bg); color: var(--warn); border-color: #f1dfb2; }
.secret-link { display: block; margin-top: 8px; padding: 10px; background: #fff; color: var(--ink); border-radius: 6px; word-break: break-all; user-select: all; }
.secret { display: inline-block; padding: 2px 6px; background: var(--bg); border-radius: 4px; word-spacing: 4px; user-select: all; }
.hint { color: var(--muted); font-size: .88rem; font-weight: 400; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: #e8edf0; color: var(--muted); }

.greeting { font-size: 1.3rem; }
.clock { text-align: center; padding: 24px 20px; }
.clock-state { font-weight: 600; color: var(--muted); margin: 0; }
.state-on { color: var(--ok); }
.state-pause { color: var(--warn); }
.clock-now { margin: 4px 0 18px; font-size: clamp(2.6rem, 11vw, 4rem); font-weight: 700; line-height: 1.1; color: var(--navy); font-variant-numeric: tabular-nums; }
.clock-actions { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.btn-clock { min-height: 64px; font-size: 1.15rem; color: #fff; border-radius: 10px; }
.btn-go { background: var(--ok); }
.btn-go:hover { background: #115f3a; }
.btn-stop { background: var(--danger); }
.btn-stop:hover { background: #8f1e18; }
.btn-pause { background: #fff; color: var(--warn); border-color: #d8b25a; }
.btn-pause:hover { background: var(--warn-bg); }
.clock-note { margin-top: 14px; text-align: left; color: var(--muted); font-size: .92rem; }
.clock-note summary { cursor: pointer; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stats-4 { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.stat { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; color: inherit; text-decoration: none; }
.stat span { display: block; font-size: .82rem; color: var(--muted); }
.stat strong { font-size: 1.5rem; color: var(--navy); font-variant-numeric: tabular-nums; }
a.stat:hover { border-color: var(--teal); }
.stat-warn { border-color: #e7c674; background: var(--warn-bg); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; font-size: .82rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-tight th, .table-tight td { padding: 5px 8px; font-size: .9rem; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tfoot th { color: var(--ink); font-size: .95rem; border-bottom: 0; }
.notes { max-width: 340px; overflow-wrap: anywhere; }
.row-weekend td { background: #f7f9fa; }
.row-void td { color: var(--muted); text-decoration: line-through; }
.row-void td:last-child { text-decoration: none; }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--muted); white-space: nowrap; border-bottom: 3px solid transparent; }
.tabs a.active { color: var(--teal-dark); border-bottom-color: var(--teal); font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters label { flex: 1 1 170px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; color: var(--muted); font-size: .9rem; }
.data { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 16px; }
.data dt { color: var(--muted); font-size: .88rem; }
.data dd { margin: 0; overflow-wrap: anywhere; }
.steps { padding-left: 20px; margin: 0 0 18px; }
.steps li { margin-bottom: 10px; }
.qr { margin: 10px 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; margin: 0 0 16px; }
.codes code { display: block; padding: 8px; background: var(--bg); border-radius: 6px; text-align: center; user-select: all; }
.chip { display: inline-flex; align-items: center; gap: 2px; background: var(--info-bg); border-radius: 99px; padding: 1px 2px 1px 10px; margin: 0 4px 4px 0; font-size: .88rem; }
.chip button { border: 0; background: none; cursor: pointer; font-size: 1.05rem; padding: 0 6px; color: var(--teal-dark); }
.inline { display: flex; gap: 6px; align-items: center; min-width: 240px; }
.inline select { margin: 0; min-height: 36px; padding: 4px 8px; }
.request { display: flex; gap: 12px 20px; flex-wrap: wrap; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.request p { margin: 2px 0 0; }
.request > div { flex: 1 1 300px; }
.request-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: 1 1 300px; justify-content: flex-end; }
.request-actions input { margin: 0; flex: 1 1 200px; min-height: 36px; padding: 6px 10px; }

.report { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.report-head { display: flex; justify-content: space-between; gap: 12px 30px; flex-wrap: wrap; margin-bottom: 8px; }
.report-data { margin-bottom: 8px; font-size: .92rem; }
.signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 44px; font-size: .85rem; color: var(--muted); }
.signatures div { border-top: 1px solid var(--ink); padding-top: 6px; }

@media (min-width: 760px) {
  .top nav { order: 0; width: auto; }
  h1 { font-size: 1.8rem; }
}
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 10.5pt; display: block; }
  .top, .foot, .no-print, .actions, .tabs { display: none !important; }
  main { padding: 0; max-width: none; }
  .report { border: 0; padding: 0; margin: 0; break-after: page; }
  .report:last-child { break-after: auto; }
  .table-wrap { overflow: visible; }
  .table-tight th, .table-tight td { padding: 2px 6px; font-size: 9.5pt; }
  .row-weekend td { background: #f2f2f2; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .signatures { margin-top: 32px; }
  a { color: inherit; text-decoration: none; }
}
