:root {
  color-scheme: light dark;
  --page: #f4f6f5;
  --surface: #fff;
  --inset: #eaf0ed;
  --line: #d7e1dc;
  --text: #172622;
  --muted: #52655e;
  --accent: #08654e;
  --accent-soft: #dceee6;
  --accent-text: #fff;
  --focus: #087e64;
  --error: #922b38;
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--page);
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #101916;
    --surface: #17231f;
    --inset: #202f29;
    --line: #35463f;
    --text: #edf4f0;
    --muted: #aabdb4;
    --accent: #78d7b6;
    --accent-soft: #233e33;
    --accent-text: #10291f;
    --focus: #78d7b6;
    --error: #ffadb5;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; }
h1, h2, p, dl, dd { margin: 0; }
button, input, select { font: inherit; }
button:not(:disabled), select { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.frame { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.masthead { border-bottom: 1px solid var(--line); background: var(--surface); }
.masthead-content { min-height: 65px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 680; white-space: nowrap; }
.brand-mark { width: 12px; height: 12px; border: 2px solid var(--accent); border-radius: 3px; transform: rotate(45deg); }
.brand-admin { color: var(--muted); font-size: .875rem; padding-left: 10px; border-left: 1px solid var(--line); font-weight: 450; }
.main { padding-block: clamp(30px, 6vw, 68px); }
.surface { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); font-weight: 690; letter-spacing: -.055em; line-height: 1.08; }
h2 { font-size: 1.24rem; letter-spacing: -.025em; line-height: 1.25; font-weight: 670; }
.button, .view {
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  font-size: .875rem;
  font-weight: 640;
  line-height: 1.2;
  min-height: 42px;
  padding: 7px 14px;
  background: transparent;
  white-space: nowrap;
}
.button:disabled { opacity: .55; }
.secondary { border-color: var(--line); background: var(--surface); }
.secondary:hover:not(:disabled), .view:hover { background: var(--inset); }
.primary { color: var(--accent-text); background: var(--accent); }
.primary:hover:not(:disabled) { filter: brightness(.92); }

#connection { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--muted); }
.sign-in { width: min(440px, 100%); padding: clamp(22px, 5vw, 36px); margin: 18px auto 0; }
.sign-in h1 { font-size: 2rem; }
.sign-in form { display: grid; gap: 12px; margin-top: 26px; }
.sign-in label { font-size: .875rem; font-weight: 620; }
input, select {
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 11px;
}
select { padding-right: 24px; }
.form-message { color: var(--error); font-size: .875rem; }
.form-message:empty { display: none; }

.dashboard-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.view-switch { display: inline-flex; gap: 4px; background: var(--inset); padding: 4px; border: 1px solid var(--line); border-radius: 11px; }
.view[aria-pressed="true"] { border-color: var(--line); background: var(--surface); color: var(--accent); }
.counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 16px 0 24px; }
.metric { display: grid; gap: 6px; align-content: start; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: clamp(12px, 2.5vw, 20px); }
.metric dt { color: var(--muted); font-size: .875rem; }
.metric dd { font-size: clamp(1.5rem, 4vw, 2.15rem); font-weight: 680; font-variant-numeric: tabular-nums; line-height: 1.12; letter-spacing: -.04em; }
.activity-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px; }
.activity-header p { margin-top: 5px; color: var(--muted); font-size: .875rem; max-width: 52ch; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .875rem; }
th, td { padding: 14px 12px; text-align: left; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
th { color: var(--muted); font-weight: 640; background: var(--inset); }
th:first-child, td:first-child { padding-left: 20px; width: 26%; }
th:last-child, td:last-child { padding-right: 20px; }
td:first-child { font-weight: 650; }
td time { color: var(--muted); }
.session { display: inline-flex; gap: 5px; align-items: center; border-radius: 6px; padding: 5px 8px; font-size: .8125rem; line-height: 1.15; }
.session.valid { background: var(--accent-soft); color: var(--accent); }
.session.valid::before { content: ""; background: currentColor; border-radius: 50%; width: 6px; height: 6px; }
.session.absent { background: var(--inset); color: var(--muted); }
.cell-label { display: none; }
.empty { padding: 24px 20px; color: var(--muted); border-top: 1px solid var(--line); }
.table-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }
.pagination { display: flex; gap: 10px; align-items: center; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}

@media (max-width: 700px) {
  .frame { width: calc(100% - 32px); }
  .activity-header { align-items: flex-start; flex-direction: column; }
  table { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody { display: block; }
  tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; border-top: 1px solid var(--line); padding: 14px 20px; }
  td, td:last-child, td:first-child { display: block; border: 0; padding: 0; width: auto; }
  td:first-child { grid-column: 1 / -1; }
  .cell-label { display: block; color: var(--muted); font-weight: 550; font-size: .75rem; margin-bottom: 3px; }
  td:first-child .cell-label { display: none; }
}

@media (max-width: 380px) {
  .counts { gap: 6px; }
  .metric { padding: 9px; }
  .metric dt { font-size: .75rem; }
}
