:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --ink: #17252a;
  --muted: #5c6b70;
  --line: #dde3e1;
  --brand: #0f6b6f;
  --brand-ink: #ffffff;
  --brand-soft: #e3f1f0;
  --ok: #1e7a46;
  --ok-soft: #e4f4ea;
  --warn: #8a5a00;
  --warn-soft: #fdf1d8;
  --error: #b3261e;
  --error-soft: #fbe7e5;
  --radius: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1719;
    --surface: #172225;
    --ink: #e7eeec;
    --muted: #9aaaae;
    --line: #2a3a3e;
    --brand: #4fb3b0;
    --brand-ink: #0b1416;
    --brand-soft: #1c3436;
    --ok: #6fd39a;
    --ok-soft: #173326;
    --warn: #f0c062;
    --warn-soft: #3a2f14;
    --error: #ff8a80;
    --error-soft: #3d1c1a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 "Source Sans 3", system-ui, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--brand);
  box-shadow: inset -10px -10px 0 rgba(255,255,255,.18);
}
.brand-name { font-family: "Source Serif 4", Georgia, serif; font-weight: 600; font-size: 18px; line-height: 1.1; }
.brand-sub { color: var(--muted); font-size: 13px; }
.demo-badge {
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
  padding: 4px 10px; border-radius: 999px;
  background: var(--warn-soft); color: var(--warn);
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 300px;
  gap: 20px;
  padding: 20px 24px 40px;
  max-width: 1400px;
  margin: 0 auto;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  min-width: 0;
}
h1 { font-family: "Source Serif 4", Georgia, serif; font-weight: 600; font-size: 26px; margin: 0; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 10px; }
.meta { color: var(--muted); margin: 4px 0 0; }

.class-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.class-card {
  width: 100%; text-align: left; cursor: pointer;
  display: grid; gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: inherit;
}
.class-card:hover { border-color: var(--brand); }
.class-card.is-selected { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.class-title { font-weight: 600; }
.class-when, .class-seats { font-size: 13px; color: var(--muted); }

.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.pill {
  white-space: nowrap; font-size: 13px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
}

.register { border-top: 1px solid var(--line); padding-top: 16px; margin-bottom: 18px; }
.fields { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
input {
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
}
input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 9px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.btn:hover { border-color: var(--brand); }
.btn.primary, .btn-small.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.ghost { width: 100%; margin-top: 10px; color: var(--muted); }
.btn-small {
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 4px 10px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}

.message { margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; font-weight: 600; }
.message[data-tone="ok"] { background: var(--ok-soft); color: var(--ok); }
.message[data-tone="warn"] { background: var(--warn-soft); color: var(--warn); }
.message[data-tone="error"] { background: var(--error-soft); color: var(--error); }

.tables { display: grid; grid-template-columns: 3fr 2fr; gap: 18px; }
td:first-child { white-space: nowrap; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn-small + .btn-small { margin-left: 6px; }
td.empty, li.empty { color: var(--muted); font-style: italic; }
tr[data-status="offered"] td { background: var(--warn-soft); }

.clock { display: grid; gap: 2px; margin-bottom: 10px; }
.clock .label { font-size: 13px; color: var(--muted); }
.clock strong { font-size: 18px; }
.clock-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.clock-buttons .btn { padding: 6px 10px; font-size: 14px; }

.activity-h { margin-top: 24px; }
.activity { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 14px; }
.activity li { display: grid; gap: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.activity time { font-size: 12px; color: var(--muted); }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .layout { padding: 16px; }
  .fields, .tables { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
}

.top-links { display: flex; align-items: center; gap: 14px; font-size: 14px; font-weight: 600; }
.top-links a { color: var(--brand); }
