/* AttendVia design system: the Draconum v7 tokens (DEVELOPMENT_STANDARDS.md §7). Mobile first. */

@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(../fonts/inter-latin.woff2) format('woff2'); }

:root {
  /* Primitive */
  --steel-50: #eef1f5; --steel-100: #dfe5ec; --steel-500: #4a6280; --steel-700: #3b4f68; --steel-900: #30404f;
  --sage-500: #4f7a64; --clay-500: #8a6d3f; --rose-500: #9a4a52;

  /* Semantic */
  --bg: #f7f8fa; --surface: #ffffff; --surface-sunken: #f1f3f6;
  --text: #1c2530; --muted: #57667a; --hairline: #e0e5eb; --field-border: #8896a6;
  --accent: var(--steel-500); --accent-hover: var(--steel-700); --accent-soft: var(--steel-50);
  --success: #3f6a54; --success-soft: #e8f1ec; --warning: #75592f; --warning-soft: #f3eee3; --error: #8a3d46; --error-soft: #f6e9eb;
  --info: var(--steel-700); --info-soft: var(--steel-50);
  --on-accent: #ffffff;
  --band: #1b2430; --on-band: #e6e9ef;

  /* Scale */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;
  --r-sm: 6px; --r: 8px; --r-md: 10px; --r-lg: 12px; --r-xl: 16px; --r-pill: 999px;
  --elev-1: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .06);
  --elev-3: 0 8px 24px rgba(15, 23, 42, .12), 0 2px 6px rgba(15, 23, 42, .08);
  --ease: cubic-bezier(.4, 0, .2, 1); --dur-fast: 120ms; --dur: 200ms;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116; --surface: #161a21; --surface-sunken: #12161c;
    --text: #e6e9ef; --muted: #a2adbb; --hairline: #2a313b; --field-border: #6b7786;
    --accent: #8ba3c0; --accent-hover: #a5bad3; --accent-soft: #1e2632;
    --success: #8fc1a6; --success-soft: #18261f; --warning: #cdb07f; --warning-soft: #2a2418; --error: #dd9aa2; --error-soft: #2d1b1e;
    --info: #a5bad3; --info-soft: #1e2632;
    --on-accent: #0e1116;
    --band: #12161c; --on-band: #e6e9ef;
    --elev-1: 0 1px 0 rgba(255, 255, 255, .04) inset; --elev-3: 0 8px 24px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 400 15px/1.55 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
h1 { font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; margin: 0 0 var(--sp-2); }
h2 { font-size: 20px; line-height: 1.25; font-weight: 700; margin: 0 0 var(--sp-3); }
h3 { font-size: 16px; line-height: 1.3; font-weight: 600; margin: 0 0 var(--sp-2); }
p { margin: 0 0 var(--sp-3); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
p a, li a, td a, .inline-link { font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num, table, .stat-value, .pill, time { font-variant-numeric: tabular-nums lining-nums; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--sp-3); top: var(--sp-3); background: var(--surface); padding: var(--sp-2) var(--sp-3); z-index: 100; }

/* Shell */
.topbar { display: flex; align-items: center; gap: var(--sp-3); min-height: 56px; padding: var(--sp-2) var(--sp-4); background: var(--band); color: var(--on-band); }
.brand { display: flex; align-items: center; gap: var(--sp-2); color: var(--on-band); font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand:hover { color: var(--on-band); }
.brand img { width: 30px; height: 30px; }
.topbar .spacer { flex: 1; }
.nav { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.nav a { display: inline-flex; align-items: center; gap: var(--sp-1); min-height: 44px; padding: 0 var(--sp-3); border-radius: var(--r); color: var(--on-band); font-weight: 500; font-size: 14px; }
.nav a:hover, .nav a[aria-current] { background: rgba(255, 255, 255, .12); color: #fff; }
.nav-toggle { display: none; }
.main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: var(--sp-5) var(--sp-4) var(--sp-7); }
.narrow { max-width: 460px; }
.prose { max-width: 72ch; line-height: 1.7; }
.footer { padding: var(--sp-5) var(--sp-4); background: var(--band); color: var(--on-band); font-size: 13px; }
.footer-in { max-width: 1180px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-5); align-items: center; justify-content: space-between; }
.footer a { color: var(--on-band); font-weight: 500; }
.footer .links { display: flex; flex-wrap: wrap; gap: var(--sp-4); }
@media (max-width: 640px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; background: none; border: 0; color: var(--on-band); }
  .nav { display: none; position: absolute; top: 56px; left: 0; right: 0; flex-direction: column; background: var(--band); padding: var(--sp-2) var(--sp-3) var(--sp-3); z-index: 20; }
  .nav.open { display: flex; }
  .topbar { position: relative; }
}

/* Page head */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.page-head p { margin: 0; color: var(--muted); }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: var(--sp-1); }
.actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* Card */
.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg); box-shadow: var(--elev-1); padding: var(--sp-5); margin-bottom: var(--sp-4); }
.card > :last-child { margin-bottom: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--sp-4); align-items: stretch; margin-bottom: var(--sp-4); }
.grid .card { margin: 0; }
.stat-label { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: 44px; padding: 0 var(--sp-4); border-radius: var(--r); border: 1px solid transparent; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--field-border); }
.btn-secondary:hover { background: var(--surface-sunken); color: var(--text); }
.btn-danger { background: var(--surface); color: var(--error); border-color: var(--error); }
.btn-danger:hover { background: var(--error-soft); color: var(--error); }
.btn-success { background: var(--success); color: var(--on-accent); }
.btn-success:hover { filter: brightness(1.1); color: var(--on-accent); }
.btn-sm { min-height: 36px; padding: 0 var(--sp-3); font-size: 13px; }
.btn-xl { min-height: 64px; width: 100%; font-size: 18px; border-radius: var(--r-lg); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Forms */
.field { margin-bottom: var(--sp-4); }
label, .label { display: block; font-size: 13px; font-weight: 500; margin-bottom: var(--sp-1); }
.hint { font-size: 13px; color: var(--muted); margin-top: var(--sp-1); }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; min-height: 44px; padding: var(--sp-2) var(--sp-3); background: var(--surface); color: var(--text); border: 1px solid var(--field-border); border-radius: var(--r); font: inherit; font-size: 16px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 18%, transparent); }
.check { display: flex; gap: var(--sp-2); align-items: flex-start; font-size: 14px; font-weight: 400; }
.check input { width: 20px; height: 20px; margin-top: 1px; flex: none; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--sp-3); }
.err { color: var(--error); font-size: 13px; margin-top: var(--sp-1); }

/* Tables: stacked on phones */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--hairline); white-space: nowrap; }
td { padding: var(--sp-3); border-bottom: 1px solid var(--hairline); vertical-align: top; }
tbody tr:nth-child(even) { background: var(--surface-sunken); }
@media (max-width: 640px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: var(--sp-2) 0; border-bottom: 1px solid var(--hairline); }
  table.stack td { border: 0; padding: var(--sp-1) 0; }
  table.stack td[data-label]::before { content: attr(data-label) ': '; color: var(--muted); font-size: 13px; }
}

/* Status */
.pill { display: inline-flex; align-items: center; gap: var(--sp-1); padding: 2px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill .icon { width: 14px; height: 14px; }
.pill-success { background: var(--success-soft); color: var(--success); }
.pill-warning { background: var(--warning-soft); color: var(--warning); }
.pill-error { background: var(--error-soft); color: var(--error); }
.pill-info { background: var(--info-soft); color: var(--info); }
.notice { display: flex; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: var(--r); margin-bottom: var(--sp-4); font-size: 14px; }
.notice-info { background: var(--info-soft); color: var(--info); }
.notice-warning { background: var(--warning-soft); color: var(--warning); }
.notice-error { background: var(--error-soft); color: var(--error); }
.notice-success { background: var(--success-soft); color: var(--success); }

/* Empty state */
.empty { text-align: center; padding: var(--sp-6) var(--sp-4); }
.empty .icon { width: 56px; height: 56px; stroke-width: 1.5; color: var(--muted); margin-bottom: var(--sp-3); }
.empty h3 { font-weight: 600; }
.empty p { color: var(--muted); }

/* Toasts */
.toasts { position: fixed; top: var(--sp-4); right: var(--sp-4); left: var(--sp-4); z-index: 50; display: flex; flex-direction: column; gap: var(--sp-2); align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: var(--sp-2); max-width: 420px; padding: var(--sp-3) var(--sp-4); background: var(--surface); color: var(--text); border: 1px solid var(--hairline); border-left: 3px solid var(--accent); border-radius: var(--r); box-shadow: var(--elev-3); font-size: 14px; animation: fade-soft var(--dur) var(--ease); }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--error); }
.toast-warning { border-left-color: var(--warning); }
@keyframes fade-soft { from { opacity: 0; } to { opacity: 1; } }

/* Clock */
.clock-state { font-size: 15px; margin-bottom: var(--sp-4); }
.code-input { font-size: 28px !important; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.evidence { list-style: none; padding: 0; margin: var(--sp-3) 0 0; font-size: 13px; color: var(--muted); }
.evidence li { display: flex; gap: var(--sp-2); padding: 2px 0; }

/* Class Screen: read from the back of a room */
.screen { min-height: 100dvh; background: var(--band); color: var(--on-band); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-5); padding: var(--sp-5); text-align: center; }
.screen-code { font-size: clamp(64px, 16vw, 200px); font-weight: 700; letter-spacing: .08em; line-height: 1; font-variant-numeric: tabular-nums; }
.screen-bar { width: min(560px, 90%); height: 8px; background: rgba(255, 255, 255, .15); border-radius: var(--r-pill); overflow: hidden; }
.screen-bar i { display: block; height: 100%; background: var(--on-band); }
.screen-qr { background: #fff; padding: var(--sp-3); border-radius: var(--r-lg); width: min(280px, 60vw); }
.screen-meta { font-size: 20px; }

/* Map */
.map { height: 340px; border-radius: var(--r); border: 1px solid var(--hairline); background: var(--surface-sunken); position: relative; overflow: hidden; touch-action: none; }
.map img { position: absolute; user-select: none; -webkit-user-drag: none; }
.map canvas { position: absolute; inset: 0; }
.map-credit { position: absolute; right: 0; bottom: 0; background: rgba(255, 255, 255, .85); color: #1c2530; font-size: 10px; font-weight: 500; padding: 1px 4px; }

@media print {
  .topbar, .footer, .actions, .toasts, .no-print { display: none !important; }
  body { background: #fff; color: #000; font-size: 12px; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .main { max-width: none; padding: 0; }
  tbody tr:nth-child(even) { background: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* Small helpers */
.btn-block { width: 100%; }
.top-gap { margin-top: var(--sp-4); }
.bottom-gap { margin-bottom: var(--sp-4); }
.nav-form { display: flex; align-items: center; padding-left: var(--sp-2); }
.nav.open-always { display: flex; position: static; flex-direction: row; background: none; padding: 0; }
.check-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.qr-box { width: min(240px, 70vw); margin: var(--sp-4) auto; padding: var(--sp-2); background: #fff; border-radius: var(--r); }
.qr-box path { fill: #000; }
.stat-value-sm { margin-top: var(--sp-2); }
.map-zoom { position: absolute; top: var(--sp-2); right: var(--sp-2); display: flex; flex-direction: column; gap: var(--sp-1); }
.map-zoom .btn { min-width: 36px; }
.map > div:first-child { position: absolute; inset: 0; }
.evidence-list { display: grid; grid-template-columns: minmax(150px, 240px) 1fr; gap: var(--sp-2) var(--sp-4); margin: 0; font-size: 14px; }
.evidence-list dt { color: var(--muted); }
.evidence-list dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .evidence-list { grid-template-columns: 1fr; gap: 2px; } .evidence-list dd { margin-bottom: var(--sp-2); } }
.sheet { font-size: 13px; }
.sheet th, .sheet td { border: 1px solid var(--hairline); padding: var(--sp-2); }
.sheet td { height: 36px; }
@media print { .sheet th, .sheet td { border-color: #000; color: #000; } }
[hidden] { display: none !important; }
