:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1d2330;
  --muted: #667085;
  --line: #d9dee7;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --danger: #b42318;
  --notice: #eef4ff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1218;
    --card: #181c25;
    --text: #e6e9ef;
    --muted: #98a2b3;
    --line: #2d3442;
    --accent: #5b8def;
    --accent-text: #0b1020;
    --danger: #f97066;
    --notice: #1d2740;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1218;
  --card: #181c25;
  --text: #e6e9ef;
  --muted: #98a2b3;
  --line: #2d3442;
  --accent: #5b8def;
  --accent-text: #0b1020;
  --danger: #f97066;
  --notice: #1d2740;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color-scheme: light dark;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1;
}
.brand { font-weight: 700; }
.container { max-width: 720px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.4rem; margin: 8px 0 12px; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; margin-bottom: 16px;
}
.notice { background: var(--notice); }
.muted { color: var(--muted); font-size: 0.9rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
label { display: block; font-size: 0.85rem; color: var(--muted); margin: 8px 0 4px; }
input, textarea, select {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
}
textarea { min-height: 64px; resize: vertical; }
select { appearance: auto; color-scheme: light dark; }
option { background: var(--card); color: var(--text); }
button {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px;
  padding: 10px 14px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text);
}
button.ghost { background: transparent; color: var(--accent); }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button.small { padding: 6px 10px; font-size: 0.9rem; }
button:disabled { opacity: 0.5; cursor: default; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.row input { flex: 1; min-width: 0; }
.row .narrow { flex: 0 0 90px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid label { margin-top: 0; }
.list a {
  display: flex; justify-content: space-between; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none;
}
.list a:last-child { border-bottom: none; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sets-head { display: flex; gap: 8px; font-size: 0.8rem; color: var(--muted); margin-top: 12px; }
.sets-head span { flex: 1; }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px;
  max-width: calc(100% - 32px); z-index: 2;
}
.toast.error { background: var(--danger); color: #fff; }
.login { max-width: 360px; margin: 48px auto; }
@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
}

.date-field { display: grid; gap: 4px; }
.date-field input[type="date"] { width: auto; justify-self: start; padding-right: 16px; }
.date-field .actions { margin-top: 0; }
.edit-dialog {
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; width: min(480px, calc(100% - 32px));
}
.edit-dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.edit-dialog h2 { margin-bottom: 4px; }
.container.wide { max-width: 1100px; }
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.columns h2 { margin: 0 0 8px; }
@media (max-width: 760px) {
  .columns { grid-template-columns: 1fr; }
}
.equip-picker { margin-top: 4px; }
.equip-group { margin-top: 8px; }
.equip-group h3 { font-size: 0.95rem; color: var(--muted); margin: 8px 0 4px; }
.equip-trigger { width: 100%; text-align: left; border: 1px solid var(--line); }
.equip-options { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0 10px; }
button.chip { background: var(--bg); color: var(--text); border: 1px solid var(--line); font-weight: 500; }
button.chip.selected { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.equip-sub h4 { font-size: 0.85rem; color: var(--muted); margin: 6px 0 4px; font-weight: 600; }
.slot-head {
  display: grid; gap: 2px; padding: 10px 12px; margin-bottom: 12px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--card); touch-action: none; user-select: none;
}
.slot-pager .columns { grid-template-columns: 1fr 1fr; gap: 8px; }
.slot-pager .column .card { padding: 10px; }
.slot-pager .row { flex-wrap: wrap; }
.slot-pager .row input { min-width: 0; }
.list-row { display: block; width: 100%; text-align: left; margin-bottom: 6px; }
.edit-dialog.wide-dialog { width: min(900px, calc(100% - 32px)); }
.read-person { margin-bottom: 8px; }
.read-sets { margin: 4px 0 0; padding-left: 18px; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper input { width: 72px; text-align: center; }
.stepper button { padding: 6px 10px; min-width: 36px; }
