:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --text: #17202b;
  --muted: #5d6978;
  --faint: #8b96a4;
  --line: #e2e7ed;
  --line-strong: #cdd5df;
  --accent: #2457c5;
  --accent-hover: #1c49aa;
  --accent-soft: #eaf0fc;
  --ok: #17804a;
  --ok-soft: #e3f4e9;
  --warn: #a5600a;
  --warn-soft: #fcf0db;
  --info: #6a46b6;
  --info-soft: #f0eafa;
  --bad: #c1372c;
  --bad-soft: #fbe8e6;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 16px 40px rgba(16, 24, 40, .16);
  font-family: 'IBM Plex Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { font-size: 16px; line-height: 1.55; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.3; margin: 0; letter-spacing: -.005em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .875rem; }
.hidden { display: none !important; }
.icon { display: inline-flex; flex: none; }
.icon svg { display: block; }

/* ---------- layout ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 20px 16px 48px; }
.narrow { max-width: 440px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section { margin-top: 28px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.section-title h2 { font-size: 1.05rem; }
.section-title .count { color: var(--faint); font-weight: 400; margin-left: 6px; }

/* ---------- top bar ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-in { max-width: 1120px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 18px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; flex: none; }
.brand b { display: block; font-size: 1rem; line-height: 1.2; }
.brand small { display: block; color: var(--muted); font-size: .75rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 290px; }
.nav { display: flex; gap: 2px; }
.nav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.user { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; flex: none; }
.user-text { line-height: 1.25; text-align: right; }
.user-text b { display: block; font-size: .9rem; font-weight: 600; }
.user-text span { font-size: .75rem; color: var(--muted); }

/* ---------- page header ---------- */
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .9rem; margin-bottom: 10px; }
.back:hover { color: var(--accent); text-decoration: none; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub { color: var(--muted); margin-top: 4px; display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; }
.page-head .sub > span { display: inline-flex; align-items: center; gap: 5px; }
.eyebrow { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }

/* ---------- buttons & inputs ---------- */
button, .btn {
  font: inherit; font-weight: 500; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  padding: 8px 15px; border-radius: var(--radius-sm); cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; gap: 7px; min-height: 40px; white-space: nowrap; transition: background .12s, border-color .12s, color .12s;
}
button:hover, .btn:hover { background: var(--surface-2); border-color: var(--faint); text-decoration: none; }
button:focus-visible, .btn:focus-visible, a:focus-visible { outline: 3px solid rgba(36, 87, 197, .35); outline-offset: 1px; }
.primary { background: var(--accent) !important; border-color: var(--accent) !important; color: #fff !important; font-weight: 600; }
.primary:hover { background: var(--accent-hover) !important; }
.danger { color: var(--bad); }
.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.danger.solid:hover { background: #a82e25; }
.ghost { border-color: transparent; background: transparent; }
.ghost:hover { background: var(--surface-2); border-color: transparent; }
.sm { padding: 4px 11px; min-height: 32px; font-size: .875rem; gap: 5px; }
.lg { padding: 12px 22px; min-height: 50px; font-size: 1.05rem; }
.icon-btn { padding: 0; width: 40px; }
.block { width: 100%; }
button:disabled { opacity: .55; cursor: default; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 5px; }
input, select, textarea {
  font: inherit; width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); min-height: 42px;
}
input::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(36, 87, 197, .2); border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--accent); }
.field .hint { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-weight: 400; margin: 0; cursor: pointer; color: var(--muted); font-size: .92rem; }
.search { position: relative; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search input { padding-left: 36px; }
.pin { font-size: 1.7rem; letter-spacing: .6em; text-align: center; font-weight: 600; }

.msg { padding: 11px 14px; border-radius: var(--radius-sm); font-size: .95rem; }
.msg.err { background: var(--bad-soft); color: var(--bad); }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.msg.warn { background: var(--warn-soft); color: var(--warn); }
.msg.info { background: var(--accent-soft); color: var(--accent); }

/* ---------- tags & chips ---------- */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.tag.present { background: var(--ok-soft); color: var(--ok); }
.tag.late { background: var(--warn-soft); color: var(--warn); }
.tag.leave { background: var(--info-soft); color: var(--info); }
.tag.absent, .tag.fail { background: var(--bad-soft); color: var(--bad); }
.tag.none { background: #edf0f4; color: var(--muted); }
.tag.code { background: var(--accent-soft); color: var(--accent); font-size: .82rem; }
.tag.live { background: var(--ok); color: #fff; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.live .dot, .tag.live .dot { animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbfc; }
tr.off td { color: var(--faint); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .9rem; }

/* Status picker coloured like its tag */
.status-select { width: auto; min-height: 32px; padding: 3px 28px 3px 10px; border-radius: 99px; font-size: .85rem; font-weight: 600; border-color: transparent; cursor: pointer; }
.status-select.present { background-color: var(--ok-soft); color: var(--ok); }
.status-select.late { background-color: var(--warn-soft); color: var(--warn); }
.status-select.leave { background-color: var(--info-soft); color: var(--info); }
.status-select.absent { background-color: var(--bad-soft); color: var(--bad); }
.status-select.none { background-color: #edf0f4; color: var(--muted); }

/* Segmented filter */
.seg { display: inline-flex; background: #edf0f4; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; min-height: 32px; padding: 4px 12px; font-size: .875rem; color: var(--muted); border-radius: 8px; }
.seg button:hover { background: rgba(255, 255, 255, .6); }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.seg b { font-weight: 600; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); padding: 10px 14px; min-height: 44px; }
.tabs button:hover { color: var(--text); background: transparent; }
.tabs button.on { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: center; }
.stat-card .icon { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.stat-card b { display: block; font-size: 1.35rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-card span { color: var(--muted); font-size: .85rem; }
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:hover { border-color: #b9c7e6; }
.stat-card.warn .icon { background: var(--warn-soft); color: var(--warn); }
.stat-card.warn b { color: var(--warn); }
.stat-card.bad .icon { background: var(--bad-soft); color: var(--bad); }
.stat-card.bad b { color: var(--bad); }
.pct-cell { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.pct-cell b { min-width: 50px; text-align: right; font-variant-numeric: tabular-nums; }
.pct-bar { position: relative; width: 72px; height: 6px; background: #edf0f4; border-radius: 99px; }
.pct-bar i { display: block; height: 100%; border-radius: 99px; background: var(--ok); }
.pct-bar i.risk { background: #e0a13a; }
.pct-bar i.review { background: #9c80d6; }
.pct-bar i.fail { background: var(--bad); }
.pct-bar::after { content: ''; position: absolute; left: var(--min); top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: .35; border-radius: 1px; }
.att-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: #edf0f4; }
.att-bar > i { display: block; height: 100%; }
.att-bar .p { background: var(--ok); }
.att-bar .l { background: #e0a13a; }
.att-bar .v { background: #9c80d6; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- courses ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.toolbar .search { flex: 1; min-width: 200px; max-width: 360px; }
.toolbar select { width: auto; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.course-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s; }
.course-card:hover { border-color: #b9c7e6; box-shadow: 0 6px 18px rgba(16, 24, 40, .08); }
.course-card .body { padding: 16px 18px 12px; flex: 1; }
.course-card .name { font-size: 1.08rem; font-weight: 700; margin: 8px 0 6px; color: var(--text); }
.course-card .meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: .85rem; }
.course-card .meta span { display: inline-flex; align-items: center; gap: 5px; }
.course-card .teachers { color: var(--faint); font-size: .82rem; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-card .foot { border-top: 1px solid var(--line); padding: 10px 12px 10px 18px; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); min-height: 54px; }
.course-card.is-live { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.course-card.archived { opacity: .7; }
.banner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--ok-soft); border: 1px solid #b8e0c6; color: #0f5a33; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }
.banner b { color: var(--ok); }

.empty { text-align: center; padding: 40px 20px; }
.empty .icon { width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin: 0 auto 14px; }
.empty h2 { margin-bottom: 6px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; text-align: left; margin: 22px 0; }
.step { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; background: var(--surface-2); }
.step b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .85rem; margin-bottom: 8px; }

/* ---------- sessions list ---------- */
.session-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) minmax(160px, 260px) 24px; gap: 16px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); color: inherit; }
.session-row:last-child { border-bottom: 0; }
.session-row:hover { background: #fafbfc; text-decoration: none; }
.date-chip { width: 58px; text-align: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.date-chip small { display: block; background: var(--accent-soft); color: var(--accent); font-size: .72rem; font-weight: 600; padding: 1px 0; }
.date-chip b { display: block; font-size: 1.3rem; line-height: 1.5; }
.session-row .title { font-weight: 600; }
.session-row .chev { color: var(--faint); }
.session-row .att .nums { font-size: .82rem; color: var(--muted); margin-top: 5px; display: flex; gap: 10px; }

/* ---------- live class ---------- */
.live-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.live-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px; align-items: start; grid-template-areas: "qr stats" "qr side"; }
.qr-panel { grid-area: qr; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); text-align: center; position: sticky; top: 76px; }
.qr-panel .qr svg { width: 100%; height: auto; max-height: calc(100vh - 250px); min-height: 260px; display: block; margin: 0 auto; aspect-ratio: 1; }
.qr-bar { height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 12px auto 0; max-width: 520px; }
.qr-bar > div { height: 100%; background: var(--accent); transition: width .25s linear; }
.qr-hint { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: .9rem; margin-top: 10px; }
.count-panel { grid-area: stats; }
.count-panel .big { font-size: 3.4rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.count-panel .big small { font-size: 1.3rem; color: var(--faint); font-weight: 600; letter-spacing: 0; }
.count-panel .att-bar { height: 10px; margin: 14px 0 12px; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mini-stats div { background: var(--surface-2); border-radius: 9px; padding: 8px 6px; text-align: center; font-size: .78rem; color: var(--muted); }
.mini-stats b { display: block; font-size: 1.25rem; color: var(--text); font-variant-numeric: tabular-nums; }
.side-panel { grid-area: side; }
.side-panel .tabs { margin: -8px -4px 14px; }
.side-panel .seg { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
.side-panel .seg button { padding: 4px 9px; }
.late-note { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); margin-top: 12px; }
.roster-list { max-height: 52vh; overflow-y: auto; margin: 0 -20px -20px; border-top: 1px solid var(--line); }
.roster-list table th { position: sticky; top: 0; z-index: 1; }
.present-mode { position: fixed; inset: 0; background: #fff; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2vh 2vw; cursor: pointer; }
.present-mode svg { height: 76vh; width: auto; max-width: 92vw; }
.present-mode .pm-info { display: flex; gap: 5vw; align-items: baseline; font-size: 2.4vh; margin-top: 1.5vh; }
.present-mode .pm-info b { font-size: 4.5vh; }
.present-mode .pm-hint { color: var(--muted); font-size: 1.8vh; margin-top: .6vh; }

.spot-card { border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface); }
.spot-card .who { flex: 1; min-width: 150px; }
.spot-card .who b { font-size: 1.2rem; display: block; }
.spot-card.ok { border-color: #a6d8b8; background: var(--ok-soft); }
.spot-card.fail { border-color: #efb4ad; background: var(--bad-soft); }

.dropzone { margin-top: 14px; border: 2px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 18px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); cursor: pointer; text-align: center; transition: background .12s, border-color .12s, color .12s; }
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone b { color: inherit; }

/* ---------- dialog, toast ---------- */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); color: var(--text); }
dialog::backdrop { background: rgba(15, 23, 33, .45); }
dialog .dlg { padding: 24px; max-height: 84vh; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.secret { font-family: ui-monospace, Menlo, monospace; font-size: 1.35rem; background: var(--surface-2); border: 1px dashed var(--line-strong); padding: 12px 16px; border-radius: 10px; user-select: all; text-align: center; letter-spacing: .05em; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px); animation: rise .2s ease-out; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- auth & student pages ---------- */
.auth { min-height: calc(100vh - 40px); display: grid; place-items: center; padding: 20px 16px; }
.auth .card { width: 100%; max-width: 420px; padding: 28px; }
.auth-head { text-align: center; margin-bottom: 8px; }
.auth-head img { width: 56px; height: 56px; display: block; margin: 0 auto 12px; }
.auth-head .org { color: var(--muted); font-size: .9rem; margin-top: 4px; }

.s-page { max-width: 460px; margin: 0 auto; padding: 16px 16px 40px; }
.s-top { display: flex; align-items: center; gap: 10px; padding: 6px 2px 16px; }
.s-top img { width: 36px; height: 36px; }
.s-top b { display: block; line-height: 1.2; }
.s-top small { display: block; color: var(--muted); font-size: .75rem; line-height: 1.3; }
.course-pill { display: flex; align-items: center; gap: 10px; background: var(--accent-soft); color: var(--accent); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-weight: 600; }
.stepper { display: flex; gap: 6px; margin-bottom: 4px; }
.stepper i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.stepper i.on { background: var(--accent); }
.result { text-align: center; padding: 34px 20px 28px; }
.result .badge { width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 16px; display: grid; place-items: center; color: #fff; }
.result.ok .badge { background: var(--ok); box-shadow: 0 0 0 10px var(--ok-soft); }
.result.late .badge { background: #d48a1c; box-shadow: 0 0 0 10px var(--warn-soft); }
.result.bad .badge { background: var(--bad); box-shadow: 0 0 0 10px var(--bad-soft); }
.result .who { font-size: 1.2rem; font-weight: 700; margin-top: 14px; }
.result .clock { font-size: 2.4rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 16px; letter-spacing: .02em; }
.result .course { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin-top: 14px; }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; margin: 48px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.how { display: grid; gap: 10px; margin-top: 16px; text-align: left; }
.how div { display: flex; gap: 10px; align-items: flex-start; }
.how .icon { color: var(--accent); margin-top: 2px; }

/* ---------- guide ---------- */
.guide { max-width: 860px; }
.guide section { scroll-margin-top: 80px; }
.guide section h2 { margin-bottom: 12px; }
.guide section h3 { margin: 16px 0 6px; }
.guide ol, .guide ul { margin: 8px 0; padding-left: 1.4em; }
.guide li { margin: 6px 0; }
.guide p + p, .guide ul + p, .guide table + p { margin-top: 10px; }
.guide .msg { margin-top: 12px; }
.guide-steps { margin: 0 0 16px; }
.guide-steps .step { background: var(--surface); }
.guide .fields .step h3 { margin-top: 0; }
.toc ol { columns: 2; column-gap: 28px; margin-bottom: 0; }
.toc li { break-inside: avoid; }
.guide-table th { width: 32%; background: transparent; text-transform: none; letter-spacing: 0; font-size: .9rem; color: var(--text); vertical-align: top; }
.guide-table td { vertical-align: top; }
.guide details { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; margin-top: 8px; }
.guide details summary { cursor: pointer; font-weight: 600; }
.guide details p { margin-top: 8px; color: var(--muted); }
.copy-box { margin-top: 16px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 12px 14px; }
.copy-box h3 { margin: 0; font-size: .95rem; }
.copy-box pre { white-space: pre-wrap; font: inherit; font-size: .9rem; margin: 10px 0 0; }

/* ---------- responsive ---------- */
@media (max-width: 920px) {
  .live-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "stats" "qr" "side"; }
  .qr-panel { position: static; }
  .qr-panel .qr svg { max-height: 70vh; max-width: 520px; }
  .roster-list { max-height: none; }
}
@media (max-width: 760px) {
  .topbar-in { flex-wrap: wrap; gap: 8px 12px; padding-bottom: 0; }
  .nav { order: 3; width: 100%; overflow-x: auto; margin: 0 -4px; padding-bottom: 6px; }
  .user-text { display: none; }
  .brand small { max-width: 200px; }
  .hide-sm { display: none !important; }
  h1 { font-size: 1.35rem; }
  .card { padding: 16px; }
  .roster-list { margin: 0 -16px -16px; }
  .session-row { grid-template-columns: 58px minmax(0, 1fr) 20px; }
  .session-row .att { grid-column: 2 / 3; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { padding: 10px 12px; gap: 10px; }
  .stat-card .icon { width: 32px; height: 32px; }
  .stat-card b { font-size: 1.15rem; }
  .stat-card span { font-size: .78rem; }
  .page-head > .row { width: 100%; }
  .toc ol { columns: 1; }
  .guide-table th { width: 40%; }
  .page-head > .row > * { flex: 1; }
  th, td { padding: 9px 8px; }
}
@media print {
  .topbar, button { display: none !important; }
  body, .card { background: #fff; box-shadow: none; }
  .guide section { break-inside: avoid-page; }
  .guide details { border: 0; padding: 0; }
  .toc ol { columns: 1; }
}
