:root {
  --bg: #f4f5f7; --card: #fff; --ink: #1b1f2a; --muted: #6b7280; --line: #e3e5ea;
  --ok: #1f8a4c; --warn: #b7791f; --bad: #c0392b; --accent: #2b5fd9; --accent-ink: #fff;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171f; --card: #1f2430; --ink: #e8eaf0; --muted: #9aa3b2; --line: #2d3443; --ok: #3ccf7a; --warn: #e3a93a; --bad: #ef6a5a; --accent: #6b93ff; --accent-ink: #0b1020; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.4 -apple-system, system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
.top { display: flex; align-items: baseline; justify-content: space-between; padding: calc(env(safe-area-inset-top) + 12px) 16px 8px; }
.top h1 { font-size: 20px; margin: 0; }
.who { color: var(--muted); font-size: 14px; }
.view { padding: 0 12px calc(env(safe-area-inset-bottom) + 84px); }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; padding: 14px 4px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 15px; }
.tabs button.on { color: var(--accent); font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 10px 0; }
.card.given { opacity: .72; }
.card.overdue { border-color: var(--bad); }
.card.due { border-color: var(--warn); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.name { font-weight: 600; font-size: 18px; }
.sub { color: var(--muted); font-size: 14px; }
.time { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 600; min-width: 84px; }
.time.overdue { color: var(--bad); } .time.due { color: var(--warn); } .time.given { color: var(--ok); }
.btn { border: 0; border-radius: 12px; padding: 12px 16px; font: inherit; font-weight: 600; background: var(--accent); color: var(--accent-ink); }
.btn.quiet { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.btn.sm { padding: 8px 12px; font-size: 14px; }
.btn:disabled { opacity: .45; }
.actions { display: flex; gap: 8px; margin-top: 10px; }
.actions .btn { flex: 1; }
.actions .btn.half { flex: 0 0 64px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 13px; color: var(--muted); }
h2 { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 18px 4px 6px; }
.daynav { display: flex; justify-content: space-between; align-items: center; margin: 8px 4px; }
.daynav b { font-size: 17px; }
.grid { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; }
td.med { white-space: normal; min-width: 110px; font-weight: 600; }
tr.clickable { cursor: pointer; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.modal.hidden { display: none; }
.sheet { background: var(--card); width: 100%; max-width: 560px; border-radius: 18px 18px 0 0; padding: 16px 16px calc(env(safe-area-inset-bottom) + 16px); max-height: 92vh; overflow: auto; }
.sheet h3 { margin: 0 0 10px; }
label { display: block; font-size: 14px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { width: 100%; font: inherit; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); }
input.pin { font-size: 28px; letter-spacing: .4em; text-align: center; }
.times { display: flex; flex-wrap: wrap; gap: 6px; }
.times input { width: 110px; }
.err { color: var(--bad); font-size: 14px; margin-top: 8px; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }
.logline { display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 15px; }
.logline .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.inactive { opacity: .55; }
.del { color: var(--muted); text-decoration: none; padding: 0 6px; font-size: 18px; }
@media print { .tabs, .top .who, .actions, .del { display: none !important; } body { background: #fff; color: #000; } }
