:root {
  --bg: #f4f6f9; --card: #fff; --text: #142033; --muted: #5c6b80; --line: #dfe4ec;
  --brand: #0B2545; --accent: #1f7a99; --accent-soft: #e2f1f6;
  --ok: #1d7a46; --ok-soft: #e3f4ea; --warn: #9a5b00; --warn-soft: #fff1d6; --bad: #b3261e; --bad-soft: #fde7e5;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1420; --card: #162131; --text: #e6edf5; --muted: #97a6ba; --line: #2a3a50;
    --accent: #5fb7d4; --accent-soft: #17394a;
    --ok: #6fd39a; --ok-soft: #173826; --warn: #f0b860; --warn-soft: #3b2c12; --bad: #ff8a80; --bad-soft: #3d1a18;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.45; }
a { color: var(--accent); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 5; }
.top a { color: #fff; text-decoration: none; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; }
#topnav { display: flex; gap: 14px; font-size: 14px; }
#topnav button { background: none; border: 0; color: #fff; font: inherit; cursor: pointer; padding: 0; opacity: .85; }
main { max-width: 980px; margin: 0 auto; padding: 16px; }
h1 { font-size: 24px; margin: 4px 0 14px; }
h2 { font-size: 18px; margin: 22px 0 10px; }
h3 { font-size: 16px; margin: 16px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 8px; }
button, .btn { font: inherit; border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 8px 14px; cursor: pointer; text-decoration: none; display: inline-block; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--bad); border-color: var(--bad); }
button.small, .chip { padding: 4px 10px; font-size: 14px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; max-width: 100%; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
label.field { display: block; margin: 10px 0; }
label.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
label.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; }
label.check small { display: block; color: var(--muted); }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 14px; scrollbar-width: none; }
.tabs a { padding: 9px 12px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--text); border-color: var(--accent); font-weight: 600; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.bar { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar.over > i { background: var(--bad); }
.big { font-size: 28px; font-weight: 700; }
table { width: 100%; border-collapse: collapse; }
td, th { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
td.num { text-align: right; white-space: nowrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 4px 9px; font-size: 13px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: #fff; }
.seg button.on.bad { background: var(--bad); }
.seg button.on.ok { background: var(--ok); }
.seg button.on.warn { background: var(--warn); }
.days { display: flex; gap: 4px; flex-wrap: wrap; }
.days label { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 34px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; user-select: none; font-size: 14px; }
.days input { display: none; }
.days label.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.week { display: flex; align-items: flex-end; gap: 6px; height: 120px; margin-top: 8px; }
.week div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: 11px; color: var(--muted); }
.week b { display: block; width: 100%; max-width: 28px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.alert { border-left: 4px solid var(--bad); }
.alert.warn { border-left-color: var(--warn); }
.code { font-family: ui-monospace, monospace; font-size: 30px; letter-spacing: 4px; font-weight: 700; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; }
#toast.err { background: var(--bad); }
.login { max-width: 380px; margin: 40px auto; }
.dim { opacity: .55; }
.nowrap { white-space: nowrap; }
.windows-day { display: grid; grid-template-columns: 34px 1fr; gap: 8px; align-items: center; margin: 6px 0; }
.windows-day .row input { width: 92px; }
@media (max-width: 560px) {
  main { padding: 12px; }
  .hide-sm { display: none; }
  td, th { padding: 6px 3px; }
}
