/* Values follow the workload.zero theme tokens (kette-tokens 5.26, theme_zero) */
:root {
  --background: #ffffff;
  --surface: #ffffff;
  --muted: #f1f5f9;
  --foreground: #0f172a;
  --text-secondary: #475569;
  --muted-foreground: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --shadow-xs: 0 1px 2px rgb(0 0 0 / 0.04);
  --input-border: #8492a6;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --selected-bg: #eff6ff;
  --destructive: #dc2626;
  --destructive-hover: #b91c1c;
  --destructive-text: #b91c1c;
  --success-bg: #f0fdf4; --success-text: #047857;
  --warning-bg: #fffbeb; --warning-text: #c2410c;
  --danger-bg: #fef2f2;
  --info-bg: #eff6ff; --info-text: #2563eb;
  --radius-control: 8px;
  --radius-card: 12px;
  --radius-badge: 6px;
  --shadow-dialog: 0 16px 32px -8px rgba(0, 0, 0, 0.05), 0 32px 64px -16px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.03);
  --scrim: rgba(15, 23, 42, 0.28);
  font-family: Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--background); color: var(--foreground); -webkit-font-smoothing: antialiased; font-size: 13px; line-height: 1.25; letter-spacing: -0.006em; }
[hidden] { display: none !important; }
.muted { color: var(--muted-foreground); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 28px; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.appbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.appbar-inner { height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-mark { width: 28px; height: 28px; border-radius: var(--radius-control); border: 1px solid var(--border); display: grid; place-items: center; color: var(--foreground); flex-shrink: 0; }
.brand-name { font-size: 14px; font-weight: 600; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 28px 0 20px; }
.page-title { min-width: 0; }
.page-title h1 { margin: 0; font-size: 24px; line-height: 29px; font-weight: 600; letter-spacing: -0.02em; }
.page-sub { margin: 4px 0 0; color: var(--muted-foreground); font-size: 13px; line-height: 18px; }
.admin-note { margin: 10px 0 0; color: var(--text-secondary); font-size: 13px; line-height: 18px; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius-control); border: 1px solid var(--border); background: var(--surface); color: var(--foreground); font: 500 13px/16px Inter, system-ui, sans-serif; letter-spacing: -0.006em; cursor: pointer; transition: background .12s, border-color .12s; white-space: nowrap; }
.btn:hover { background: var(--muted); }
.btn:disabled { opacity: .7; cursor: progress; }
.btn[aria-pressed="true"] { background: var(--selected-bg); border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-outline { background: var(--surface); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--muted); color: var(--foreground); }
.btn-accent { color: var(--primary); font-weight: 600; }
.btn-accent:hover { background: var(--selected-bg); }
.btn-danger { background: var(--destructive); border-color: var(--destructive); color: #fff; }
.btn-danger:hover { background: var(--destructive-hover); border-color: var(--destructive-hover); }
.btn-ghost-danger { background: transparent; border-color: transparent; color: var(--destructive-text); }
.btn-ghost-danger:hover { background: var(--muted); }
.btn-block { width: 100%; }
.btn-sm { height: 28px; padding: 0 10px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tabs { display: inline-flex; flex-wrap: nowrap; gap: 2px; padding: 2px; background: var(--muted); border-radius: var(--radius-control); max-width: 100%; overflow-x: auto; scrollbar-width: none; position: relative; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid transparent; border-radius: var(--radius-badge); flex-shrink: 0; background: transparent; color: var(--text-secondary); font: 500 13px/16px Inter, system-ui, sans-serif; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--foreground); }
.tab:focus-visible { outline-offset: 0; }
.tab[aria-pressed="true"] { background: var(--surface); border-color: var(--border-strong); color: var(--foreground); font-weight: 600; box-shadow: var(--shadow-xs); }
.tab-count { color: var(--text-secondary); font-weight: 400; font-variant-numeric: tabular-nums; }
.search { display: flex; align-items: center; gap: 8px; height: 32px; background: var(--surface); border: 1px solid var(--input-border); border-radius: var(--radius-control); padding: 0 12px; color: var(--muted-foreground); width: 280px; max-width: 100%; }
.search:focus-within { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.search input { border: 0; outline: none; font: 400 13px/16px Inter, system-ui, sans-serif; color: var(--foreground); background: transparent; width: 100%; }
.search input::placeholder { color: var(--muted-foreground); }
.result-count { margin: 12px 0 0; font-size: 12px; color: var(--muted-foreground); }

.badge { display: inline-flex; align-items: center; font-size: 12px; line-height: 15px; font-weight: 500; padding: 2px 6px; border-radius: var(--radius-badge); white-space: nowrap; }
.badge-success { color: var(--success-text); background: var(--success-bg); }
.badge-warning { color: var(--warning-text); background: var(--warning-bg); }
.badge-danger { color: var(--destructive-text); background: var(--danger-bg); }
.badge-info { color: var(--info-text); background: var(--info-bg); }

.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; padding: 12px 0 60px; }
.course-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; display: flex; flex-direction: column; }
.cc-body { padding: 16px 16px 12px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.chan { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font-size: 12px; line-height: 15px; font-weight: 500; padding: 1px 6px; border: 1px solid var(--border); border-radius: var(--radius-badge); color: var(--foreground); white-space: nowrap; }
.chan-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; background: #64748b; }
.chan-dot.cat-0 { background: #2563eb; }
.chan-dot.cat-1 { background: #16a34a; }
.chan-dot.cat-2 { background: #db2777; }
.chan-dot.cat-3 { background: #7c3aed; }
.chan-dot.cat-4 { background: #d97706; }
.cc-title { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; }
.cc-meta { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.cc-meta .row { display: flex; align-items: center; gap: 8px; }
.cc-meta svg { color: var(--muted-foreground); flex-shrink: 0; }
.cc-seats { margin-top: auto; padding-top: 4px; }
.seat-bar { height: 6px; background: var(--muted); border-radius: 3px; overflow: hidden; }
.seat-fill { height: 100%; background: var(--text-secondary); border-radius: 3px; }
.seat-fill.full { background: var(--foreground); }
.seat-label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; line-height: 16px; margin-top: 8px; color: var(--text-secondary); }
.cc-foot { display: flex; gap: 8px; padding: 0 16px 16px; }

.empty, .loading { grid-column: 1/-1; padding: 48px 20px; text-align: center; color: var(--muted-foreground); }
.empty p { margin: 0 0 14px; }
.error-state { grid-column: 1/-1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 32px 24px; text-align: center; }
.error-state h2 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.error-state p { margin: 0 0 16px; color: var(--muted-foreground); }

dialog.modal { border: 1px solid var(--border); padding: 0; background: var(--surface); color: var(--foreground); border-radius: var(--radius-card); width: calc(100% - 32px); max-width: 480px; max-height: calc(100% - 32px); box-shadow: var(--shadow-dialog); }
dialog.modal-sm { max-width: 400px; }
dialog.modal::backdrop { background: var(--scrim); }
.modal-head { padding: 20px 20px 4px; }
.modal-head h2 { margin: 0; font-size: 16px; line-height: 24px; font-weight: 600; }
.modal-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted-foreground); }
.modal-body { padding: 12px 20px 16px; display: flex; flex-direction: column; gap: 14px; }
.modal-body > p { margin: 0; color: var(--text-secondary); line-height: 19px; }
.modal-foot { padding: 12px 20px 20px; display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.foot-spacer { flex: 1; }
.notice { border: 1px solid var(--border); border-radius: var(--radius-control); padding: 10px 12px; font-size: 13px; line-height: 19px; color: var(--text-secondary); margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 13px; line-height: 20px; font-weight: 500; color: var(--foreground); }
.field input, .field select { width: 100%; min-width: 0; height: 32px; padding: 0 12px; border: 1px solid var(--input-border); border-radius: var(--radius-control); font: 400 13px/16px Inter, system-ui, sans-serif; color: var(--foreground); background: var(--surface); }
.field input:focus-visible, .field select:focus-visible { border-color: var(--primary); outline: 2px solid var(--primary); outline-offset: 1px; }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--destructive); }
.field-hint { margin: 0; font-size: 12px; line-height: 15px; color: var(--muted-foreground); }
.field-err, .form-err { margin: 0; font-size: 12px; line-height: 15px; font-weight: 500; color: var(--destructive-text); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.participants h3 { margin: 4px 0 2px; font-size: 13px; font-weight: 600; }
.participants > p { margin: 0 0 8px; font-size: 12px; }
.enr-items { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-control); }
.enr-item { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 12px; font-size: 13px; }
.enr-item + .enr-item { border-top: 1px solid var(--border); }
.enr-who { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 17px; }
.enr-who small { color: var(--muted-foreground); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-wait { font-size: 12px; line-height: 15px; font-weight: 500; color: var(--warning-text); background: var(--warning-bg); padding: 2px 6px; border-radius: var(--radius-badge); white-space: nowrap; }
.inline-error { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.inline-error p { margin: 0; color: var(--destructive-text); font-weight: 500; font-size: 13px; }

#toast-root { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100% - 32px); }
.toast { display: flex; align-items: center; gap: 12px; background: var(--foreground); color: #fff; padding: 10px 14px; border-radius: var(--radius-control); font-size: 13px; font-weight: 500; box-shadow: var(--shadow-dialog); }
.toast-action { background: transparent; border: 1px solid rgba(255,255,255,.7); color: #fff; border-radius: var(--radius-badge); height: 24px; padding: 0 8px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.toast-action:focus-visible { outline-color: #fff; }

.spinner { width: 24px; height: 24px; border: 3px solid var(--muted); border-top-color: var(--text-secondary); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .page-head { padding-top: 20px; }
  .course-grid { grid-template-columns: 1fr; }
  .search { width: 100%; }
}
@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; }
  .modal-head, .modal-body { padding-left: 16px; padding-right: 16px; }
  .modal-foot { padding: 12px 16px 16px; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
