:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #f1eee7;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e1d8;
  --accent: #d97706;
  --accent-ink: #ffffff;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 16px rgba(31, 41, 55, 0.06);
  --nav-h: 62px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #1b2027;
    --surface-2: #232a33;
    --text: #e9edf2;
    --muted: #9aa4b2;
    --line: #2e3640;
    --accent: #f59e0b;
    --accent-ink: #111418;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ---------- Shell ---------- */
.app { min-height: 100%; }
.shell { display: grid; grid-template-rows: auto 1fr; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar .brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.topbar .brand img { width: 26px; height: 26px; border-radius: 7px; }
.topbar .spacer { flex: 1; }
.iconbtn {
  position: relative; border: 0; background: transparent; width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 20px;
}
.iconbtn:hover { background: var(--surface-2); }
.badge {
  position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; flex: none; position: relative;
}
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); border: 2px solid var(--surface); }
.layout { display: grid; grid-template-columns: 1fr; }
.sidenav { display: none; }
.main { padding: 16px; padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); max-width: 1100px; width: 100%; margin: 0 auto; }
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
}
.navitem {
  border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; color: var(--muted); cursor: pointer; position: relative; text-decoration: none;
}
.navitem .ico { font-size: 22px; line-height: 1; }
.navitem.active { color: var(--accent); font-weight: 600; }
.navitem .badge { top: 6px; right: calc(50% - 22px); }
@media (min-width: 900px) {
  .layout { grid-template-columns: 220px 1fr; }
  .sidenav { display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; border-right: 1px solid var(--line); background: var(--surface); position: sticky; top: 61px; height: calc(100vh - 61px); }
  .sidenav .navitem { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; border-radius: 10px; font-size: 15px; }
  .sidenav .navitem.active { background: var(--surface-2); }
  .sidenav .navitem .badge { position: static; margin-left: auto; }
  .bottomnav { display: none; }
  .main { padding: 24px 32px; }
}

/* ---------- Components ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card.tight { padding: 10px 12px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 14px;
  cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); }
.chip.status-pending { background: #fef3c7; color: #92400e; }
.chip.status-approved { background: #dcfce7; color: #166534; }
.chip.status-declined { background: #fee2e2; color: #991b1b; }
.chip.status-withdrawn { background: var(--surface-2); color: var(--muted); }
.pill { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }
.list-item .sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { color: var(--muted); text-align: center; padding: 24px 8px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.field textarea { min-height: 80px; resize: vertical; }
.field .inline { display: flex; gap: 8px; }
.field .inline > * { flex: 1; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 500; }
.checks label:has(input:checked) { background: var(--surface-2); border-color: var(--accent); }
.checks input { margin: 0; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.error { color: var(--danger); font-size: 13px; margin-top: 6px; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; }
.tab { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap; }
.tab.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login .card { width: 100%; max-width: 380px; }
.login .who { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.login .who button { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; font-size: 12px; }
.login .who button.selected { border-color: var(--accent); background: var(--surface-2); }

/* ---------- Modal & toasts ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .modal-backdrop { align-items: center; } }
.modal { background: var(--surface); width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px; }
@media (min-width: 640px) { .modal { border-radius: 18px; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; cursor: pointer; animation: pop 0.2s ease-out; }
.toast.error { background: var(--danger); color: #fff; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.notif-panel { position: absolute; right: 8px; top: 56px; width: min(92vw, 380px); max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); z-index: 30; padding: 8px; }
.notif { padding: 10px; border-radius: 10px; cursor: pointer; display: flex; gap: 10px; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: var(--surface-2); }
.notif .when { color: var(--muted); font-size: 12px; }

/* ---------- Custody ---------- */
.custody-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.custody-day { text-align: center; font-size: 11px; }
.custody-day .bars { display: flex; flex-direction: column; gap: 2px; margin-top: 3px; }
.bar { height: 8px; border-radius: 4px; }
.custody-day.today .num { font-weight: 700; color: var(--accent); }
.tonight { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; background: var(--surface-2); margin-bottom: 8px; }
.tonight .who { font-weight: 700; }

/* ---------- Calendar ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--muted); font-weight: 600; padding: 4px 0; }
.cal-cell { min-height: 68px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: var(--surface); cursor: pointer; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.cal-cell.other { opacity: 0.45; }
.cal-cell.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-cell.selected { background: var(--surface-2); }
.cal-cell .num { font-size: 12px; font-weight: 600; }
.cal-cell .bars { display: flex; flex-direction: column; gap: 2px; }
.cal-cell .bar { height: 6px; }
.cal-cell .bar.override { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.45) 0 3px, transparent 3px 6px); }
.cal-cell .ev { font-size: 10px; line-height: 1.2; padding: 1px 4px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--surface-2); border-left: 3px solid var(--accent); }
.cal-cell .more { font-size: 10px; color: var(--muted); }
@media (min-width: 720px) { .cal-cell { min-height: 92px; } .cal-cell .ev { font-size: 11px; } }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); margin: 8px 0; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { display: inline-block; width: 14px; height: 8px; border-radius: 4px; }
.event-row { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.event-row:last-child { border-bottom: 0; }
.event-row .time { width: 64px; flex: none; font-size: 12px; color: var(--muted); font-weight: 600; padding-top: 2px; }
.event-row .body { flex: 1; min-width: 0; }
.event-row .name { font-weight: 600; }
.src { font-size: 11px; padding: 1px 6px; border-radius: 4px; color: #fff; }

/* ---------- Messages ---------- */
.chat { display: flex; flex-direction: column; height: calc(100vh - 61px - var(--nav-h) - 32px - env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .chat { height: calc(100vh - 61px - 48px); } }
.chat-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.chat-log { flex: 1; overflow-y: auto; padding: 12px 4px; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 78%; padding: 8px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); word-wrap: break-word; white-space: pre-wrap; }
.msg.mine { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.msg .from { font-size: 11px; font-weight: 700; margin-bottom: 2px; }
.msg .ts { font-size: 10px; opacity: 0.7; margin-top: 2px; text-align: right; }
.day-sep { text-align: center; font-size: 11px; color: var(--muted); margin: 8px 0 2px; }
.composer { display: flex; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.composer textarea { flex: 1; resize: none; min-height: 44px; max-height: 120px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }

/* ---------- Location ---------- */
#map { height: 320px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
@media (min-width: 720px) { #map { height: 440px; } }
.leaflet-container { font: inherit; }

/* ---------- Requests / reminders ---------- */
.req-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.req-meta { color: var(--muted); font-size: 13px; margin: 4px 0; }
.rem { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rem:last-child { border-bottom: 0; }
.rem input[type=checkbox] { width: 20px; height: 20px; margin-top: 2px; }
.rem.overdue .when { color: var(--danger); font-weight: 600; }
.rem .who { display: flex; gap: 4px; }

/* Inputs that must not stretch to full width inside .field */
.field input[type=checkbox] { width: 20px; height: 20px; padding: 0; margin: 0; }
.field input[type=color] { width: 56px; height: 40px; padding: 3px; }
.field label.switch { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 500; }

/* ---------- Floating assistant ---------- */
.assistant-fab {
  position: fixed; right: 16px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 40;
  width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink);
  font-size: 24px; cursor: pointer; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.assistant-fab:hover { filter: brightness(1.05); }
@media (min-width: 900px) { .assistant-fab { bottom: 24px; right: 24px; } }
.assistant-panel {
  position: fixed; z-index: 45; display: flex; flex-direction: column;
  right: 0; left: 0; bottom: 0; height: min(80vh, 640px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px 18px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
}
@media (min-width: 640px) {
  .assistant-panel { left: auto; right: 16px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); width: 400px; border-radius: 18px; }
}
@media (min-width: 900px) { .assistant-panel { bottom: 24px; right: 24px; } }
.assistant-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.assistant-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.assistant-msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; font-size: 14px; line-height: 1.4; }
.assistant-msg.bot { align-self: flex-start; background: var(--surface-2); }
.assistant-msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.assistant-msg.thinking { color: var(--muted); animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: 0.4; } to { opacity: 1; } }
.assistant-suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.assistant-suggestions .chip { cursor: pointer; border: 1px solid var(--line); }
.assistant-composer { display: flex; gap: 8px; padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.assistant-composer textarea { flex: 1; resize: none; min-height: 40px; max-height: 120px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }


/* ---------- Icon buttons, page heads, toolbars ---------- */
.iconbtn.raised { background: var(--surface); border: 1px solid var(--line); width: 40px; height: 40px; font-size: 18px; flex: none; box-shadow: var(--shadow); }
.iconbtn.raised:hover { background: var(--surface-2); }
.iconbtn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-size: 24px; font-weight: 700; }
.iconbtn.primary:hover { filter: brightness(1.05); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.page-head h1 { margin: 0; }
.toolbar { display: flex; align-items: center; gap: 8px; }
.cal-month { margin: 0; min-width: 150px; text-align: center; cursor: pointer; font-size: 18px; }
.card-title .iconbtn.raised { width: 34px; height: 34px; font-size: 18px; box-shadow: none; }
.navitem .lbl { font-size: 11px; }

/* "More" sheet from the bottom nav */
.more-menu {
  position: fixed; left: 8px; right: 8px; bottom: calc(var(--nav-h) + 8px + env(safe-area-inset-bottom)); z-index: 46;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 6px;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; animation: pop 0.15s ease-out;
}
.more-item { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px; font-size: 12px; color: var(--text); cursor: pointer; }
.more-item:hover { background: var(--surface-2); }
.more-item .ico { font-size: 22px; }
@media (min-width: 900px) { .more-menu { display: none; } }

/* ---------- Mobile tightening ---------- */
@media (max-width: 599px) {
  body { font-size: 14px; }
  .main { padding: 12px; }
  h1 { font-size: 20px; }
  h2 { font-size: 16px; }
  .card { padding: 12px; margin-bottom: 12px; border-radius: 12px; }
  .topbar { padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
  .cal-grid { gap: 2px; }
  .cal-cell { min-height: 56px; padding: 3px; border-radius: 6px; }
  .cal-cell .num { font-size: 11px; }
  .cal-cell .ev { display: none; }
  .cal-cell .more { display: none; }
  .cal-cell.has-events::after { content: ''; display: block; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin: 2px auto 0; }
  .legend { font-size: 11px; gap: 6px 10px; }
  .tonight { padding: 8px; gap: 10px; }
  .event-row .time { width: 56px; font-size: 11px; }
  .msg { max-width: 85%; }
  .btn { padding: 8px 12px; }
  .modal { padding: 14px; }
  .assistant-fab { width: 50px; height: 50px; font-size: 22px; right: 12px; }
}

/* Grid/flex children must be allowed to shrink below their content width, or nowrap text widens the page on phones. */
.layout > * { min-width: 0; }
.main { min-width: 0; }
.list-item { min-width: 0; }
.list-item .grow { overflow: hidden; }

/* ---------- iPhone / PWA polish ---------- */
html { -webkit-text-size-adjust: 100%; }
body { overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }
button, a, .list-item, .cal-cell, .tab, .chip { touch-action: manipulation; }
.chat-log, .assistant-log, .main, .modal, .notif-panel { -webkit-overflow-scrolling: touch; }
.iconbtn svg, .navitem .ico svg, .more-item .ico svg { display: block; }
.iconbtn.raised { width: 44px; height: 44px; }
.card-title .iconbtn.raised { width: 36px; height: 36px; }
.navitem { min-height: 44px; }
.topbar .brand-text { font-size: 17px; }
@media (max-width: 599px) {
  /* 16px inputs stop iOS Safari from zooming in on focus */
  input, select, textarea { font-size: 16px !important; }
  .list-item { padding: 12px 0; }
  .chat { height: calc(100dvh - 57px - var(--nav-h) - 24px - env(safe-area-inset-bottom)); }
  .assistant-panel { height: min(78dvh, 640px); }
  .modal { max-height: 90dvh; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .composer, .assistant-composer { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}
@media (display-mode: standalone) {
  .topbar { padding-top: max(10px, env(safe-area-inset-top)); }
}

/* ---------- Notes (knowledge base) ---------- */
.kb-search { display: flex; gap: 8px; margin-bottom: 12px; }
.kb-search input { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.kb-article { padding: 10px 0; border-bottom: 1px solid var(--line); }
.kb-article:last-child { border-bottom: 0; }
.kb-article .head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kb-article .body { white-space: pre-wrap; margin-top: 4px; font-size: 14px; }
.kb-article .tags { color: var(--muted); font-size: 12px; margin-top: 4px; }
.hw { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.hw:last-child { border-bottom: 0; }
.hw .state { flex: none; width: 8px; border-radius: 4px; }
.hw .state.missing { background: var(--danger); }
.hw .state.due { background: var(--accent); }
.hw .state.returned { background: var(--muted); }
