:root {
  --bg: #f6f7f9; --panel: #fff; --ink: #1d2330; --muted: #6b7280; --line: #e3e6eb;
  --online-bg: #e6f0fb; --online-ink: #0c447c; --online-edge: #9cc3ec;
  --inp-bg: #e1f5ee; --inp-ink: #085041; --inp-edge: #8fd6bd;
  --sub-bg: #fdf3e1; --sub-ink: #7a4a06; --accent: #1f5fbf; --warn: #a3471c;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
main { padding: 16px 20px 40px; }
h1 { font-size: 20px; margin: 0 0 6px; font-weight: 600; }
h2 { font-size: 16px; margin: 24px 0 8px; font-weight: 600; }
.muted { color: var(--muted); }
.warn { color: var(--warn); }
.error { color: #fff; background: var(--warn); padding: 8px 10px; border-radius: 6px; }

.topbar { display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 48px; background: #1d2330; color: #fff; }
.topbar a { color: #cdd3dc; }
.topbar .brand { color: #fff; font-weight: 600; }
.topbar nav { display: flex; gap: 16px; flex: 1; }
.topbar nav a.on { color: #fff; border-bottom: 2px solid #fff; padding-bottom: 12px; margin-bottom: -14px; }
.topbar .who { color: #cdd3dc; font-size: 13px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-bottom: 12px; }
.week { display: flex; align-items: center; gap: 6px; }
.week h1 { margin: 0 0 0 8px; }
.btn, button { display: inline-block; padding: 5px 11px; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; color: var(--ink); font: inherit; cursor: pointer; }
.btn:hover { text-decoration: none; background: #eef0f3; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; }
.filters label { color: var(--muted); font-size: 13px; }
select, input { font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.legend { display: flex; gap: 6px; }
.legend .chip { width: auto; }

.gridwrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
table.grid { border-collapse: collapse; width: 100%; min-width: 1000px; table-layout: fixed; }
.grid th, .grid td { border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); padding: 4px; vertical-align: top; text-align: left; }
.grid thead th { background: #f0f2f5; font-weight: 600; font-size: 13px; padding: 7px 6px; position: sticky; top: 0; }
.grid thead th.today { background: #fff6d6; }
.grid th.who { width: 170px; border-left: none; font-weight: 500; padding: 6px 8px; background: #fafbfc; }
.grid th.who small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.grid tr.needsub th, .grid tr.needsub td { background: var(--sub-bg); }
.grid tr.needsub th { color: var(--sub-ink); }
.grid tfoot td, .grid tfoot th { background: #f0f2f5; font-weight: 600; font-size: 13px; }
.grid tfoot small { font-weight: 400; color: var(--muted); }
.grid td.empty { color: var(--muted); padding: 24px; text-align: center; }

.chip { display: block; padding: 3px 6px; margin: 0 0 3px; border-radius: 5px; font-size: 12px; line-height: 1.3; border: 1px solid transparent; overflow: hidden; }
.chip:hover { text-decoration: none; filter: brightness(0.97); }
.chip .t { display: block; font-weight: 600; }
.chip .n { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.online { background: var(--online-bg); color: var(--online-ink); border-color: var(--online-edge); }
.chip.inperson { background: var(--inp-bg); color: var(--inp-ink); border-color: var(--inp-edge); }
.chip.oneoff { background: #fff; border-style: dashed; }
.legend .chip { display: inline-block; margin: 0; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; max-width: 720px; }
dl { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; margin: 12px 0 0; }
dt { color: var(--muted); }
dd { margin: 0; word-break: break-word; }

table.list { border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; width: 100%; max-width: 1100px; }
.list th, .list td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.list thead th { background: #f0f2f5; font-size: 13px; }
.list tr.past td { color: var(--muted); }
.tag { font-size: 11px; background: var(--sub-bg); color: var(--sub-ink); padding: 1px 6px; border-radius: 4px; }

.login { max-width: 340px; margin: 12vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; }
.login form { display: grid; gap: 12px; margin-top: 12px; }
.login label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
