:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1c2330;
  --muted: #667085;
  --line: #e4e7ec;
  --accent: #2e9e6b;
  --accent-soft: #e3f4ec;
  --error: #b42318;
  --heat-0: #eef0f3;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b;
    --panel: #1a1f27;
    --text: #e6e9ef;
    --muted: #98a2b3;
    --line: #2b323d;
    --accent: #46c08a;
    --accent-soft: #1c3a2d;
    --error: #f97066;
    --heat-0: #232933;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
h1 { font-size: 18px; margin: 0; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 13px; margin: 20px 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.bar {
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.range { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.range label { color: var(--muted); display: flex; gap: 6px; align-items: center; }
input, select, .button {
  font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px;
}
.button { text-decoration: none; }
.button:hover { border-color: var(--accent); }
button.link { font: inherit; background: none; border: 0; color: var(--accent); cursor: pointer; padding: 4px; }
button.primary { font: inherit; background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 8px 14px; cursor: pointer; }
button.primary:disabled { opacity: .6; cursor: default; }
button.danger { color: var(--error); }
a { color: var(--accent); }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { height: 28px; width: auto; display: block; }
.account { display: flex; gap: 12px; align-items: center; }

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 20px; }
.login-brand .logo { height: 44px; }
.login form, .stack { display: grid; gap: 14px; }
.login label, .stack label { display: grid; gap: 6px; color: var(--muted); }
.login input { width: 100%; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.inline-form input { flex: 1 1 140px; min-width: 0; }
.checks { display: grid; gap: 4px; max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.checks label { display: flex; gap: 8px; align-items: center; color: var(--text); }
.team { border-top: 1px solid var(--line); padding: 14px 0; }
.team:first-of-type { border-top: 0; }
.team-head { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.team-cols { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-top: 10px; }
@media (max-width: 600px) { .team-cols { grid-template-columns: 1fr; } }
.ok { color: var(--accent); }

main { padding: 20px 24px; max-width: 1200px; margin: 0 auto; }
section { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; margin-bottom: 20px; }
.section-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
#filter { width: min(280px, 100%); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
#people tbody tr { cursor: pointer; }
#people tbody tr:hover, #people tbody tr.selected { background: var(--accent-soft); }
tr:last-child td { border-bottom: 0; }

.meter { display: inline-flex; align-items: center; gap: 8px; }
.meter span.track { width: 60px; height: 6px; border-radius: 3px; background: var(--heat-0); overflow: hidden; }
.meter span.fill { display: block; height: 100%; background: var(--accent); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--line); }
.dot.on { background: var(--accent); }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--error); }

.heatmap { display: grid; grid-template-columns: 90px repeat(24, minmax(14px, 1fr)); gap: 2px; overflow-x: auto; font-size: 11px; }
.heatmap .label { color: var(--muted); padding-right: 6px; white-space: nowrap; align-self: center; }
.heatmap .hour { color: var(--muted); text-align: center; }
.heatmap .cell { height: 18px; border-radius: 3px; background: var(--heat-0); }

.cols { display: grid; grid-template-columns: 3fr 2fr; gap: 24px; }
/* Let wide tables scroll inside their column instead of widening the page. */
.cols > * { min-width: 0; }
@media (max-width: 800px) { .cols { grid-template-columns: 1fr; } .bar, main { padding-left: 16px; padding-right: 16px; } }

.shot-day { margin: 12px 0 4px; font-size: 12px; color: var(--muted); }
.shot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.shot { position: relative; padding: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--heat-0); cursor: zoom-in; font: inherit; color: inherit; text-align: left; }
.shot img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.shot > span { display: flex; justify-content: space-between; gap: 6px; padding: 4px 8px; font-size: 12px; background: var(--panel); }
.badge { color: var(--muted); }
.viewer { width: min(1400px, 96vw); max-height: 94vh; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); }
.viewer::backdrop { background: rgb(0 0 0 / .7); }
.viewer-bar { display: flex; gap: 12px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.viewer-bar span { flex: 1; text-align: center; }
.viewer img { display: block; max-width: 100%; max-height: calc(94vh - 50px); margin: 0 auto; }

.apps { list-style: none; margin: 0; padding: 0; }
.apps li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 6px 0; }
.apps .name { overflow: hidden; text-overflow: ellipsis; }
.apps .bar-track { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--heat-0); }
.apps .bar-fill { height: 100%; border-radius: 2px; background: var(--accent); }
.small-dialog { width: min(420px, 94vw); }
.pad { padding: 0 16px 16px; }
