/* THE LAST LECTURE face check-in. Colours, type and shapes follow the event art:
   maroon INK #791B2B, INK_DEEP #500616, GOLD #BF9040, PINK #E29AB0, PAPER #F7F1E4, CREAM #F3E9D8,
   Bai Jamjuree for text, Anton for display numerals, perforated stamp edges, the 137 lobe ring. */

@font-face { font-family: 'Bai Jamjuree'; src: url(/static/assets/fonts/BaiJamjuree-Regular.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Bai Jamjuree'; src: url(/static/assets/fonts/BaiJamjuree-Medium.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Bai Jamjuree'; src: url(/static/assets/fonts/BaiJamjuree-SemiBold.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Bai Jamjuree'; src: url(/static/assets/fonts/BaiJamjuree-Bold.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Anton'; src: url(/static/assets/fonts/Anton-Regular.woff2) format('woff2'); font-weight: 400; font-display: swap; }

:root {
  --maroon: #791B2B;
  --maroon-deep: #500616;
  --wine: #3A0710;
  --night: #24040A;
  --gold: #BF9040;
  --gold-light: #E3C27A;
  --gold-soft: #F4E6C6;
  --pink: #E29AB0;
  --paper: #F7F1E4;
  --cream: #F3E9D8;
  --card: #FFFCF6;
  --ink: #2B0A10;
  --muted: #7B5E63;
  --line: #E6D8C2;
  --line-strong: #D5C1A2;
  --ok: #2F6E45;
  --ok-bg: #E4F0E6;
  --warn: #8A6112;
  --warn-bg: #F7EBCF;
  --bad: #A51536;
  --bad-bg: #FBE4E9;
  --st-reg: #791B2B;
  --st-green: #3F7D45;
  --st-pink: #D9829C;
  --st-gold: #BF9040;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(58, 7, 16, .06), 0 8px 24px rgba(58, 7, 16, .07);
  --font: 'Bai Jamjuree', 'Noto Sans Thai', 'Sarabun', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--paper); line-height: 1.5; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
a { color: var(--maroon); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 700; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 12px; }
.num { font-family: 'Anton', var(--font); font-weight: 400; letter-spacing: .01em; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.eyebrow.gold { color: var(--gold); }
.eyebrow.th { letter-spacing: .01em; text-transform: none; font-size: 14px; }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }

/* ------------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid transparent; background: var(--cream); color: var(--ink); font-weight: 600;
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--maroon); color: var(--cream); }
.btn-primary:hover { background: #8a2233; }
.btn-gold { background: var(--gold); color: var(--night); }
.btn-gold:hover { background: #cc9d4c; }
.btn-ghost { background: transparent; border-color: var(--line-strong); }
.btn-ghost:hover { background: rgba(191, 144, 64, .08); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-link { background: none; border: 0; padding: 6px 0; color: var(--maroon); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.btn-sm { min-height: 34px; padding: 6px 12px; border-radius: 10px; font-size: 14px; }
.btn-xl { min-height: 64px; padding: 14px 22px; font-size: 21px; border-radius: 16px; }
.icon-btn { width: 44px; height: 44px; padding: 0; border-radius: 12px; }

/* ------------------------------------------------------------------ form fields */
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(191, 144, 64, .22); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--maroon); flex: none; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch i { width: 42px; height: 24px; border-radius: 99px; background: rgba(243, 233, 216, .25); position: relative; transition: background .2s; flex: none; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--cream); transition: transform .2s; }
.switch input:checked + i { background: var(--gold); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch.light i { background: var(--line-strong); }
.switch.light input:checked + i { background: var(--maroon); }

/* ------------------------------------------------------------------ pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600;
  background: var(--cream); color: var(--ink); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.gold { background: var(--gold-soft); color: #7a5a1c; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

/* ------------------------------------------------------------------ the stamp: perforated edge like the sticker sheet */
.stamp { --r: 7px; position: relative; background: var(--cream); padding: calc(2 * var(--r) + 6px);
  -webkit-mask: radial-gradient(var(--r), #0000 97%, #000) round calc(-1.5 * var(--r)) calc(-1.5 * var(--r)) / calc(3 * var(--r)) calc(3 * var(--r)),
    linear-gradient(#000 0 0) no-repeat 50% / calc(100% - 3 * var(--r)) calc(100% - 3 * var(--r));
  mask: radial-gradient(var(--r), #0000 97%, #000) round calc(-1.5 * var(--r)) calc(-1.5 * var(--r)) / calc(3 * var(--r)) calc(3 * var(--r)),
    linear-gradient(#000 0 0) no-repeat 50% / calc(100% - 3 * var(--r)) calc(100% - 3 * var(--r)); }
.stamp-frame { border: 1.5px solid var(--gold); padding: 22px; height: 100%; position: relative; }
.stamp.sm { --r: 4px; padding: calc(2 * var(--r) + 3px); }

/* ------------------------------------------------------------------ toast and modal */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--wine); color: var(--cream);
  padding: 12px 18px; border-radius: 12px; z-index: 99; max-width: 90vw; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font-weight: 500; }
.modal-bg { position: fixed; inset: 0; background: rgba(36, 4, 10, .55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--card); border-radius: 20px; padding: 24px; width: min(900px, 100%); max-height: 92vh; overflow: auto; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.modal-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }

/* ================================================================== LOGIN */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: radial-gradient(120% 90% at 20% 15%, #6a1424 0%, var(--wine) 55%, var(--night) 100%); color: var(--cream); }
.login-art { position: relative; display: grid; place-items: center; overflow: hidden; min-height: 360px; }
.login-art svg.ring { position: absolute; width: min(82vmin, 760px); height: min(82vmin, 760px); }
.login-art .burst { position: absolute; width: min(46vmin, 420px); height: min(46vmin, 420px); }
.login-art img { position: relative; width: min(46vmin, 420px); filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .35)); }
.login-side { display: grid; place-items: center; padding: 32px 24px; }
.login-card { width: min(440px, 100%); color: var(--ink); }
.login-card h1 { font-size: 28px; color: var(--maroon); margin: 6px 0 4px; }
.login-card .stamp-frame { padding: 26px; display: grid; gap: 16px; }
.login-foot { margin-top: 18px; color: rgba(243, 233, 216, .72); font-size: 13.5px; text-align: center; }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-art { min-height: 300px; } }

/* ================================================================== KIOSK */
body.kiosk { background: radial-gradient(130% 100% at 25% 0%, #5c1020 0%, var(--wine) 45%, var(--night) 100%) fixed; color: var(--cream); min-height: 100vh; overflow-x: hidden; }
.k-watermark { position: fixed; right: -22vmin; bottom: -30vmin; width: 95vmin; height: 95vmin; opacity: .5; pointer-events: none; z-index: 0; }
.k-top { position: relative; z-index: 2; display: flex; align-items: center; gap: 16px; padding: 14px 28px; }
.k-brand { --r: 3.5px; background: var(--cream); padding: 9px 12px; display: grid; place-items: center; }
.k-logo { height: 38px; width: auto; display: block; }
.k-title { display: grid; line-height: 1.15; }
.k-title b { font-size: 15px; font-weight: 600; }
.k-title span { font-size: 12.5px; color: rgba(243, 233, 216, .7); }
.k-title span.date { letter-spacing: .14em; font-size: 12px; }
.k-top .spacer { flex: 1; }
@media (max-width: 900px) { .k-title { display: none; } .k-count span { display: none; } }
.k-station { position: relative; display: inline-flex; align-items: center; gap: 10px; padding: 6px 8px 6px 14px; border-radius: 99px; background: rgba(243, 233, 216, .1); border: 1px solid rgba(243, 233, 216, .18); }
.k-station .dot { width: 12px; height: 12px; box-shadow: 0 0 0 2px rgba(243, 233, 216, .85); }
.k-station select { background: transparent; border: 0; color: var(--cream); font-weight: 600; min-height: 34px; padding: 4px 6px; width: auto; box-shadow: none; }
.k-station select option { color: var(--ink); }
.k-count { display: grid; text-align: right; line-height: 1.05; }
.k-count .num { font-size: 30px; color: var(--gold-light); }
.k-count span { font-size: 12px; color: rgba(243, 233, 216, .7); }
.k-top .icon-btn { background: rgba(243, 233, 216, .1); color: var(--cream); border: 1px solid rgba(243, 233, 216, .18); }
.k-top a.adminlink { color: rgba(243, 233, 216, .8); font-size: 14px; }

.k-main { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(360px, 1fr); gap: 24px; padding: 4px 28px 28px; align-items: start; }
@media (max-width: 980px), (orientation: portrait) { .k-main { grid-template-columns: 1fr; } }
.k-cam { position: relative; border-radius: 24px; overflow: hidden; background: #120206; aspect-ratio: 4 / 3; max-height: calc(100vh - 230px); width: 100%;
  box-shadow: 0 0 0 1px rgba(227, 194, 122, .35), 0 20px 50px rgba(0, 0, 0, .35); }
@media (orientation: portrait) { .k-cam { max-height: 44vh; } }
.k-cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.k-cam.mirror video { transform: scaleX(-1); }
.k-cam svg.overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.k-cam .flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .18s; }
.k-hint { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); background: rgba(243, 233, 216, .94); color: var(--maroon-deep);
  padding: 8px 18px; border-radius: 99px; font-weight: 600; font-size: clamp(15px, 1.5vw, 19px); white-space: nowrap; box-shadow: 0 6px 18px rgba(0, 0, 0, .2); }
.k-chip { position: absolute; left: 16px; bottom: 16px; display: inline-flex; align-items: center; gap: 8px; background: rgba(36, 4, 10, .72);
  color: var(--cream); padding: 6px 12px; border-radius: 99px; font-size: 13px; }
.k-chip .dot { background: var(--gold-light); }
.k-chip.ready .dot { background: #7CC48A; }
.ring-spin { transform-box: fill-box; transform-origin: center; }
.scanning .ring-spin { animation: spin 5s linear infinite; }
.scanning .perf { animation: march 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes march { to { stroke-dashoffset: -24; } }

.k-scan { width: 100%; margin-top: 16px; min-height: 76px; font-size: clamp(22px, 2.2vw, 28px); border-radius: 18px; gap: 14px;
  box-shadow: 0 10px 28px rgba(191, 144, 64, .28); }
.k-scan .icon { width: 30px; height: 30px; }
.k-tips { display: flex; gap: 22px; flex-wrap: wrap; margin: 14px 4px 0; color: rgba(243, 233, 216, .75); font-size: 14px; }
.k-tips span { display: inline-flex; align-items: center; gap: 8px; }
.k-tips .icon { color: var(--gold-light); }

.k-panel { display: grid; gap: 16px; }
.k-card { min-height: 420px; color: var(--ink); }
.k-card .stamp-frame { padding: clamp(18px, 2vw, 28px); display: flex; flex-direction: column; gap: 14px; min-height: 100%; }
.k-card.test .stamp-frame::before { content: 'โหมดทดลอง ไม่บันทึก'; position: absolute; top: -1px; right: 18px; background: var(--gold); color: var(--night);
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 0 0 8px 8px; }
.k-card h2 { font-size: clamp(26px, 2.4vw, 34px); color: var(--maroon); }
.k-card .lead { color: var(--muted); margin: 0; }
.k-idle-art { width: 100%; height: clamp(170px, 27vh, 280px); object-fit: contain; filter: drop-shadow(0 8px 16px rgba(58, 7, 16, .2)); }
.k-steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; counter-reset: s; }
.k-steps li { display: flex; gap: 12px; align-items: center; font-weight: 500; }
.k-steps li::before { counter-increment: s; content: counter(s); width: 30px; height: 30px; border-radius: 50%; background: var(--maroon); color: var(--cream);
  display: grid; place-items: center; font-family: 'Anton'; font-size: 15px; flex: none; }
.k-pair { display: flex; gap: 14px; align-items: flex-end; }
.k-pair figure { margin: 0; display: grid; gap: 6px; justify-items: center; }
.k-pair img { width: clamp(96px, 9vw, 132px); height: clamp(96px, 9vw, 132px); object-fit: cover; border-radius: 14px; background: #eadfcb; box-shadow: 0 0 0 2px var(--cream), 0 0 0 3.5px var(--gold); }
.k-pair figcaption { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.k-name { font-size: clamp(30px, 3vw, 42px) !important; line-height: 1.15; word-break: break-word; }
.k-meter { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.k-meter .bar { width: 180px; flex: none; height: 8px; border-radius: 99px; background: #e8dcc6; overflow: hidden; }
.k-meter .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--maroon)); border-radius: 99px; }
.k-actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; margin-top: auto; }
.k-meta { font-size: 12.5px; color: var(--muted); }
.k-qrnote { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 10px 12px; border-radius: 12px; background: rgba(191, 144, 64, .1);
  border: 1px solid rgba(191, 144, 64, .35); font-size: 14px; line-height: 1.5; }
.k-qrnote .icon { flex: none; width: 22px; height: 22px; color: var(--maroon); margin-top: 1px; }
.k-list { display: grid; gap: 10px; }
.k-row { display: flex; gap: 14px; align-items: center; padding: 10px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--line); cursor: pointer; text-align: left; width: 100%; }
.k-row:hover, .k-row:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgba(191, 144, 64, .18); }
.k-row img, .k-row .ph { width: 58px; height: 58px; border-radius: 12px; object-fit: cover; background: #eadfcb; flex: none; }
.k-row .nm { font-size: 19px; font-weight: 700; color: var(--maroon); line-height: 1.2; }
.k-row .sub { font-size: 13px; color: var(--muted); }
.k-row .chev { margin-left: auto; color: var(--gold); width: 22px; height: 22px; flex: none; }
.k-row .sc { font-size: 12px; color: var(--muted); white-space: nowrap; }
.k-empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 18px 6px; }
.k-empty img { width: 64px; height: 64px; }

.k-done { display: grid; justify-items: center; text-align: center; gap: 10px; }
.k-burst { position: relative; width: min(100%, 360px); aspect-ratio: 1.25; display: grid; place-items: center; margin-bottom: 26px; }
.k-burst svg.burst { position: absolute; inset: -12% -6%; width: 112%; height: 124%; animation: pop .6s ease-out both; }
.k-burst img.art { position: relative; max-width: 72%; max-height: 82%; filter: drop-shadow(0 10px 18px rgba(58, 7, 16, .28)); animation: rise .5s ease-out both; }
.k-burst svg.postmark { position: absolute; right: -6%; bottom: -8%; width: 38%; transform: rotate(-12deg); animation: stampin .45s .35s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes stampin { from { opacity: 0; transform: rotate(-12deg) scale(1.8); } to { opacity: .92; transform: rotate(-12deg) scale(1); } }
.k-rally { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin: 4px 0; }
.k-rally .st { display: grid; justify-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); min-width: 72px; white-space: nowrap; text-align: center; }
.k-rally .st i { width: 34px; height: 40px; display: block; background: var(--c); --r: 3px;
  -webkit-mask: radial-gradient(var(--r), #0000 97%, #000) round calc(-1.5 * var(--r)) calc(-1.5 * var(--r)) / calc(3 * var(--r)) calc(3 * var(--r)), linear-gradient(#000 0 0) no-repeat 50% / calc(100% - 3 * var(--r)) calc(100% - 3 * var(--r));
  mask: radial-gradient(var(--r), #0000 97%, #000) round calc(-1.5 * var(--r)) calc(-1.5 * var(--r)) / calc(3 * var(--r)) calc(3 * var(--r)), linear-gradient(#000 0 0) no-repeat 50% / calc(100% - 3 * var(--r)) calc(100% - 3 * var(--r)); }
.k-rally .st.off i { background: #e3d6c1; }
.k-rally .st.on { color: var(--ink); font-weight: 600; }
.k-countdown { width: 100%; height: 4px; border-radius: 99px; background: #e8dcc6; overflow: hidden; margin-top: 6px; }
.k-countdown i { display: block; height: 100%; width: 100%; background: var(--gold); transform-origin: left; animation: countdown var(--t, 4.5s) linear forwards; }
@keyframes countdown { to { transform: scaleX(0); } }

.k-search { color: var(--ink); }
.k-search .stamp-frame { padding: 16px; display: grid; gap: 10px; }
.k-search label { font-weight: 600; font-size: 14px; color: var(--muted); }
.k-search .res { display: grid; gap: 8px; max-height: 42vh; overflow: auto; }
.k-search .k-row img, .k-search .k-row .ph { width: 46px; height: 46px; }
.k-search .k-row .nm { font-size: 17px; }

.k-form { display: grid; gap: 12px; }
.k-notice { border-radius: 14px; padding: 12px 14px; background: var(--warn-bg); color: var(--ink); display: grid; gap: 8px; }
/* special guests at the registration desk: the registrar's mark and what the team will do (4 Oct 2569) */
.k-vip { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: flex-start; min-height: 36px; }
.k-done .k-vip { justify-content: center; }
.k-vip.on { padding: 8px 14px; border-radius: 14px; background: #FFF4DE; border: 1px solid var(--gold-light); }
.k-vip .pill .icon { width: 14px; height: 14px; }
.k-vip-text { font-size: 14px; font-weight: 600; color: var(--maroon); }
.k-vip-off { font-size: 13px; padding: 2px 0; color: var(--muted); }
.k-vip-btn { border-style: dashed; border-color: var(--gold); color: var(--maroon); }
.k-vip-pill { vertical-align: 2px; }

/* ================================================================== ADMIN */
body.admin { background: var(--paper); }
.a-top { background: linear-gradient(90deg, var(--maroon-deep), var(--maroon)); color: var(--cream); }
.a-top-in { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 12px 24px; }
.a-top img { height: 38px; }
.a-top .k-title span { color: rgba(243, 233, 216, .7); }
.a-top .spacer { flex: 1; }
.a-top .btn-ghost { color: var(--cream); border-color: rgba(243, 233, 216, .35); }
.a-top .btn-gold { min-height: 40px; }
.a-head { max-width: 1240px; margin: 0 auto; padding: 26px 24px 0; display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.a-head h1 { font-size: 30px; color: var(--maroon); }
.a-head .seal { width: 66px; height: 66px; }
.a-tabs { max-width: 1240px; margin: 0 auto; padding: 0 24px; display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.a-tabs button { background: none; border: 0; padding: 14px 14px 12px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2.5px solid transparent; white-space: nowrap; }
.a-tabs button.on { color: var(--maroon); border-bottom-color: var(--maroon); }
.a-page { max-width: 1240px; margin: 0 auto; padding: 22px 24px 60px; display: grid; gap: 18px; }
.a-banner { max-width: 1240px; margin: 14px auto 0; padding: 0 24px; }
.a-banner > div { border-radius: 14px; padding: 12px 16px; background: var(--bad-bg); color: var(--bad); font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card h3 { font-size: 18px; color: var(--maroon); }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: grid; gap: 4px; }
.stat .lbl { font-size: 13px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.stat .num { font-size: 40px; line-height: 1.05; color: var(--maroon); }
.stat .num small { font-family: var(--font); font-size: 15px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.stat .sub { font-size: 12.5px; color: var(--muted); }
.progress { height: 8px; border-radius: 99px; background: #eadfcb; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--c, var(--maroon)); border-radius: 99px; transition: width .4s; }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.quick button, .quick a { display: flex; gap: 12px; align-items: center; text-align: left; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.quick button:hover, .quick a:hover { border-color: var(--gold); }
.quick img { width: 38px; height: 38px; flex: none; }
.quick b { display: block; font-size: 15.5px; }
.quick span { font-size: 12.5px; color: var(--muted); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .search { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.toolbar .search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar .search input { padding-left: 38px; }
.seg { display: inline-flex; background: #efe5d3; border-radius: 12px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 7px 12px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--maroon); box-shadow: 0 1px 3px rgba(58, 7, 16, .12); }
.seg button b { font-family: 'Anton'; font-weight: 400; margin-left: 4px; }
.people { display: grid; gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.person { display: grid; grid-template-columns: 48px minmax(0, 1.4fr) minmax(0, 1fr) auto 20px; gap: 14px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.person:last-child { border-bottom: 0; }
.person:hover { background: #fbf5ea; }
.person .av { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; background: #eadfcb; }
.person .nm { font-weight: 700; color: var(--ink); }
.person .sub { font-size: 12.5px; color: var(--muted); }
.person .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.person .chev { color: var(--line-strong); }
@media (max-width: 760px) { .person { grid-template-columns: 44px minmax(0, 1fr) 16px; } .person .tags, .person .when { grid-column: 2; } }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); display: grid; justify-items: center; gap: 10px; }
.empty img { width: 70px; }
.tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.tpl { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px; display: grid; gap: 6px; }
.tpl img, .tpl .ph { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: #eadfcb; }
.tpl .act { display: flex; gap: 6px; flex-wrap: wrap; }
.timeline { display: grid; gap: 8px; }
.timeline div { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: 18px; background: #fffaf1; padding: 34px 20px; text-align: center; display: grid; justify-items: center; gap: 10px; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone.over, .dropzone:hover { border-color: var(--gold); background: #fdf3df; }
.dropzone img { width: 64px; }
.dropzone b { font-size: 17px; color: var(--maroon); }
.dropzone input { display: none; }
.modal .dropzone { padding: 18px 16px; }
.modal .dropzone img { width: 40px; }
.split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.steps { display: flex; gap: 8px; flex-wrap: wrap; }
.steps span { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--muted); }
.steps span i { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; font-style: normal; font-family: 'Anton'; font-size: 13px; }
.steps span.on { color: var(--maroon); }
.steps span.on i { border-color: var(--maroon); background: var(--maroon); color: var(--cream); }
.steps span.done i { border-color: var(--ok); background: var(--ok); color: #fff; }
.steps .sep { width: 28px; height: 2px; background: var(--line-strong); align-self: center; }
.howto ol { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
.howto code, code { background: #f3e8d4; padding: 1px 6px; border-radius: 6px; font-size: 13px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.photo-wrap { position: relative; display: inline-block; max-width: 100%; }
.photo-wrap img { max-width: 100%; max-height: 62vh; display: block; border-radius: 12px; }
.photo-wrap .fbox { position: absolute; border: 3px solid var(--gold); border-radius: 8px; cursor: pointer; }
.photo-wrap .fbox.on { border-color: var(--ok); }
.photo-wrap .fbox span { position: absolute; top: -24px; left: 0; background: var(--gold); color: var(--night); font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 6px; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.set-grid .field small { color: var(--muted); font-size: 12.5px; }
.danger { border-color: #ecc3cc; }
.danger h3 { color: var(--bad); }

/* the page is older than the server it talks to: offer a reload */
.stale-bar { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 9999;
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px); padding: 10px 12px 10px 18px; border-radius: 16px;
  background: #6E1F2E; color: #FBF6EC; font-size: 15px; font-weight: 600; }
.stale-bar button { flex: none; border: 0; border-radius: 12px; padding: 8px 14px; background: #FBF6EC; color: #6E1F2E; font: inherit; cursor: pointer; }
/* the kiosk name search: whole name, then the search button (8 Oct 2569) */
.k-qform { display: flex; gap: 8px; align-items: stretch; }
.k-qform input { flex: 1; min-width: 0; }
.k-qform .btn { flex: none; }
.k-seed { display: flex; justify-content: center; }
