:root {
  --bg: #fbf7f2; --surface: #fff; --ink: #2a211c; --muted: #6f625a; --line: #eadfd4;
  --accent: #c2410c; --accent-ink: #fff; --set: #0e7490; --set-soft: #e0f7fb; --bad: #b91c1c;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17120f; --surface: #211a16; --ink: #f4ece5; --muted: #b3a59b; --line: #3a2f28;
    --accent: #fb923c; --accent-ink: #1c120c; --set: #67e8f9; --set-soft: #123a42; --bad: #f87171;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); text-decoration: none; }
.who { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.who img { width: 28px; height: 28px; border-radius: 50%; }
main { max-width: 980px; margin: 0 auto; padding: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; max-width: 480px; margin: 40px auto; }
.btn { display: inline-block; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 8px 16px; font: inherit; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.small { padding: 4px 10px; font-size: 0.85rem; }
.btn.ghost { background: transparent; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; padding: 8px 12px; border-bottom: 3px solid transparent; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.count { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 7px; font-size: 0.75rem; }
.count:empty { display: none; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters input, .filters select, .field input, .field select, .field textarea, .todo-form input {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; min-width: 0; }
.filters input { flex: 1 1 220px; }
.muted { color: var(--muted); margin: 6px 0; }
.small { font-size: 0.82rem; }
.hint { font-size: 0.85rem; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: 10px; padding: 8px 12px; }
.vrow { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 10px 0; }
.vrow.is-hidden { opacity: 0.7; border-style: dashed; }
.vhead { display: flex; justify-content: space-between; gap: 12px; }
.vhead h3 { margin: 0; font-size: 1.05rem; }
.vhead p { margin: 2px 0; }
.edited { white-space: nowrap; }
.vfields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 12px; margin-top: 10px; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 0.8rem; color: var(--muted); }
.field.wide { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.check input { width: 18px; height: 18px; }
.set { color: var(--set); }
.field.set input, .field.set select, .field.set textarea { border-color: var(--set); background: var(--set-soft); }
.vfoot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.todo-form { display: flex; gap: 8px; margin-bottom: 12px; }
.todo-form input { flex: 1; }
.todos { list-style: none; padding: 0; margin: 0; }
.todos li { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 6px 0; }
.todos li label { flex: 1; display: flex; gap: 8px; align-items: flex-start; }
.todos li.done span:first-of-type { text-decoration: line-through; color: var(--muted); }
.person { display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 8px 0; }
.avatar { width: 52px; height: 52px; border-radius: 50%; padding: 3px; background: var(--ring); flex: none; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; display: block; }
.pinfo { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pinfo .muted { word-break: break-all; }
.pfields { display: flex; gap: 12px; margin-top: 6px; }
.field input[type="color"] { padding: 2px; width: 60px; height: 34px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 16px; border-radius: 999px; font-size: 0.9rem; }
.toast.bad { background: var(--bad); color: #fff; }
.cats { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 0.85rem; cursor: pointer; }
.chip.set { border-color: var(--set); background: var(--set-soft); }
.more { margin-top: 12px; }
.more summary { cursor: pointer; font-weight: 600; color: var(--accent); padding: 4px 0; }
.hours { margin-top: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.hours.set { border-color: var(--set); }
.hours-title { margin: 0 0 6px; font-weight: 600; font-size: 0.9rem; }
.slot { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; padding: 8px 0; border-top: 1px dashed var(--line); }
.slot:first-child { border-top: 0; }
.slot.is-tbd .days, .slot.is-tbd .field:not(:has([data-s="label"])) { opacity: 0.45; }
.days { display: flex; gap: 3px; flex-wrap: wrap; }
.days label { cursor: pointer; }
.days input { position: absolute; opacity: 0; pointer-events: none; }
.days span { display: inline-block; min-width: 38px; text-align: center; border: 1px solid var(--line); border-radius: 8px; padding: 5px 4px; font-size: 0.82rem; }
.days input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.days input:focus-visible + span { outline: 2px solid var(--set); outline-offset: 1px; }
.slot .field input { width: auto; }
.slot .field input[type="text"] { width: 140px; }
@media (max-width: 520px) { .vhead { flex-direction: column; gap: 4px; } }
