:root {
  --bg: #f7f5f0; --ink: #1d1d1b; --mute: #63625d; --line: #d9d5cb; --card: #fff;
  --accent: #0b6e5f; --accent-ink: #fff; --soft: #cfe8e2;
  --good: #d5efd9; --ok: #fbeeb8; --bad: #f6d3cf; --danger: #a8321f;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161614; --ink: #eeece6; --mute: #a9a79f; --line: #3a3936; --card: #201f1d;
    --accent: #5cc7b2; --accent-ink: #10231f; --soft: #1f4039;
    --good: #1f3d27; --ok: #4a4016; --bad: #4d2622; --danger: #f08a78;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 300 16px/1.5 Lexend, system-ui, sans-serif; }
main { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }
main.wide { max-width: 1100px; }
h1 { font-size: 28px; font-weight: 600; margin: 0 0 16px; }
h1 a { color: inherit; text-decoration: none; }
h2 { font-size: 16px; font-weight: 600; margin: 24px 0 8px; }
a { color: var(--accent); }
.note, .mute { color: var(--mute); font-size: 14px; }
[hidden] { display: none !important; }

.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; margin-bottom: 16px; }
label { display: grid; gap: 4px; font-size: 14px; font-weight: 500; }
input, select, button { font: inherit; color: inherit; }
input:not([type=checkbox]), select { width: 100%; padding: 8px 10px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; min-height: 40px; }
button { padding: 8px 16px; min-height: 40px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 500; }
button.danger { color: var(--danger); border-color: var(--danger); }
button:disabled { opacity: .4; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hp { position: absolute; left: -9999px; }
#msg { min-height: 24px; margin: 8px 0; font-size: 14px; color: var(--danger); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 12px 0; }
.row label { flex: 1 1 200px; }

/* create: week calendar */
.cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 14px; }
.cal-nav #count { margin-left: auto; font-weight: 500; }
.cal { max-height: 60vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.cal table { border-collapse: collapse; width: 100%; table-layout: fixed; }
.cal th { font-size: 12px; font-weight: 500; color: var(--mute); }
.cal thead th { position: sticky; top: 0; z-index: 2; background: var(--card); padding: 6px 2px; border-bottom: 1px solid var(--line); }
.cal thead th:first-child { width: 52px; }
.cal tbody th { width: 52px; text-align: right; padding: 0 6px; vertical-align: top; line-height: 1; white-space: nowrap; }
.cal td { padding: 0; border-left: 1px solid var(--line); }
.cal tr.hour td { border-top: 1px solid var(--line); }
.cal td button { display: block; width: 100%; height: 26px; min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; font-size: 12px; font-weight: 500; }
.cal.fine td button { height: 20px; }
.cal.coarse td button { height: 44px; }
.cal td button:hover:not(:disabled) { background: var(--soft); }
.cal td button.span { background: var(--soft); }
.cal td button.on { background: var(--accent); color: var(--accent-ink); }
.cal td button:disabled { background: repeating-linear-gradient(135deg, transparent 0 4px, var(--line) 4px 5px); opacity: .5; }

/* schedule: answers table */
.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
#grid { border-collapse: collapse; width: 100%; font-size: 14px; }
#grid th, #grid td { padding: 6px 10px; text-align: center; white-space: nowrap; border-bottom: 1px solid var(--line); }
#grid thead th { font-weight: 500; vertical-align: bottom; }
#grid thead small { display: block; font-size: 12px; font-weight: 300; color: var(--mute); }
#grid tbody th { text-align: left; font-weight: 400; position: sticky; left: 0; background: var(--card); }
#grid tr.day th { font-weight: 600; background: var(--bg); text-align: left; }
#grid tr.all th:first-child { box-shadow: inset 4px 0 var(--accent); font-weight: 600; }
#grid td.c0 { background: var(--good); }
#grid td.c1 { background: var(--ok); }
#grid td.c2 { background: var(--bad); }
#grid td.no { color: var(--mute); }
#grid input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); }
#grid button.x { min-height: 0; padding: 0 6px; font-size: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--mute); margin: 8px 0; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.legend .c0 { background: var(--good); } .legend .c1 { background: var(--ok); } .legend .c2 { background: var(--bad); }
#bestlist { margin: 0; padding-left: 20px; }
#admin { padding: 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 16px; }
