@font-face { font-family: 'Manrope'; src: url('fonts/Manrope.ttf'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'Bodoni Moda'; src: url('fonts/BodoniModa.ttf'); font-weight: 400 900; font-display: swap; }
@font-face { font-family: 'DM Mono'; src: url('fonts/DMMono-Regular.ttf'); font-weight: 400; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #08080A; --app: #0C0C0E; --s1: #141417; --s2: #1B1B1F; --s3: #25252A;
  --line: #26262C; --line2: #35353C;
  --ink: #F4EFE6; --ink2: #C9C2B5; --mut: #8C877E; --mut2: #67635C;
  --gold: #D8B46E; --gold-hi: #F1D9A3; --gold-line: rgba(216,180,110,.30); --gold-soft: rgba(216,180,110,.10);
  --foil: linear-gradient(135deg, #F3DCA6 0%, #D8B46E 38%, #A9843F 70%, #E8CC8E 100%);
  --dark-ink: #15110A;
  --ok: #8CCFA6; --ok-soft: rgba(140,207,166,.12); --err: #E8907F; --err-soft: rgba(232,144,127,.12);
  --fd: 'Bodoni Moda', Didot, Georgia, serif;
  --fb: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fm: 'DM Mono', ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--fb); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.mono { font-family: var(--fm); font-size: 13px; }
.mut { color: var(--mut); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- layout ---------- */
#app { min-height: 100%; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.side { background: var(--app); border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; }
.brand img { width: 74px; height: auto; }
.brand span { font: 700 10px/1.2 var(--fb); letter-spacing: .22em; text-transform: uppercase; color: var(--mut); }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; border-radius: 10px; color: var(--ink2); font-weight: 600; }
.nav:hover { background: var(--s1); text-decoration: none; }
.nav.on { background: var(--s2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--gold-line); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--gold); color: var(--dark-ink); font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; }
.side-foot { margin-top: auto; padding-top: 18px; display: grid; gap: 8px; }
.who { margin: 0; padding: 0 4px 4px; font-weight: 700; overflow-wrap: anywhere; }
.who small { display: block; color: var(--mut); font-weight: 600; font-size: 12px; }
.checks.areas { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 16px; margin-bottom: 8px; }
.main { padding: 32px 36px 64px; max-width: 1240px; width: 100%; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.head h1 { font: 500 34px/1.05 var(--fd); margin: 4px 0 0; }
.eyebrow { font: 700 11px/1.2 var(--fb); letter-spacing: .22em; text-transform: uppercase; color: var(--gold); margin: 0; }
.sub { color: var(--mut); margin: 6px 0 0; max-width: 62ch; }
.tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
h2 { font: 500 21px/1.2 var(--fd); margin: 30px 0 12px; }

/* ---------- grouped navigation ---------- */
.navlist { display: flex; flex-direction: column; gap: 2px; }
.navgroup { margin-top: 8px; }
.navhead { appearance: none; width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: none; border: 0; border-radius: 8px; color: var(--mut); font: 700 11px/1.2 var(--fb); letter-spacing: .14em; text-transform: uppercase; cursor: pointer; }
.navhead:hover { color: var(--ink); background: var(--s1); }
.navhead > span:first-child { flex: 1; text-align: left; }
.chev { width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.navgroup.open .chev { transform: rotate(45deg); }
.navgroup.open .roll { display: none; }
.navitems { display: none; flex-direction: column; gap: 2px; margin-top: 2px; }
.navgroup.open .navitems { display: flex; }
.navitems .nav { position: relative; margin-left: 10px; padding-left: 28px; font-weight: 500; }
.navitems .nav::before { content: ''; position: absolute; left: 13px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: var(--mut); }
.navitems .nav:hover::before { background: var(--ink2); }
.navitems .nav.on::before { background: var(--gold); }

/* ---------- top bar and drawer, below desktop width ---------- */
.topbar, .scrim { display: none; }
.topbar { align-items: center; gap: 12px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--app); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar img { height: 26px; width: auto; }
.topbar b { flex: 1; min-width: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu { appearance: none; width: 44px; height: 44px; margin-left: -10px; display: grid; place-content: center; gap: 5px; background: none; border: 0; border-radius: 10px; cursor: pointer; }
.menu span { display: block; width: 20px; height: 2px; border-radius: 2px; background: var(--ink); }
@media (max-width: 1199px) {
  #app { display: block; }
  .topbar { display: flex; }
  .side { position: fixed; inset: 0 auto 0 0; z-index: 40; width: min(280px, 84vw); height: 100dvh; transform: translateX(-102%); transition: transform .2s ease; padding-top: calc(18px + env(safe-area-inset-top)); }
  .scrim { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.6); }
  body.nav-open { overflow: hidden; }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; }
  .main { padding: 24px 20px 56px; max-width: none; }
}

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .main { padding: 18px 16px 48px; }
  .head h1 { font-size: 28px; }
  .head .tools, .head .tools > * { width: 100%; }
  .head .tools .inp { width: 100% !important; }
  .head .tools .seg { display: flex; }
  .head .tools .seg a { flex: 1; text-align: center; }
  .head .tools .btn { flex: 1 1 calc(50% - 5px); width: auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat b { font-size: 28px; }
  dialog, dialog.wide { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .dlg { padding: 18px 16px; }
  .dlg-acts { flex-wrap: wrap; }
  .dlg-acts .btn { flex: 1 1 auto; }
  .appl-acts { display: grid; grid-auto-flow: row; }
}

@media (max-width: 900px) {
  /* Each row of a table becomes a card, with its column heading above each value. */
  table.cards thead { display: none; }
  table.cards tbody tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  table.cards tbody tr:last-child { border-bottom: 0; }
  table.cards td { display: block; min-width: 0; padding: 0; border: 0; text-align: left; overflow-wrap: anywhere; white-space: normal; }
  table.cards td[data-label]:not([data-label=""])::before { content: attr(data-label); display: block; margin-bottom: 3px; font: 700 10px/1.2 var(--fb); letter-spacing: .12em; text-transform: uppercase; color: var(--mut); }
  table.cards td:first-child, table.cards td.acts, table.cards td[colspan] { grid-column: 1 / -1; }
  table.cards td:first-child::before { display: none !important; }
  table.cards td.acts { display: flex; flex-wrap: wrap; gap: 8px; }
  table.cards td.acts::before { display: none !important; }
  table.cards td.acts .btn { margin: 0; flex: 1 1 auto; }
  table.cards tbody tr { position: relative; }
  table.cards td.grip { position: absolute; top: 8px; right: 8px; width: auto; }
  table.cards td.grip + td { grid-column: 1 / -1; padding-right: 40px; }
  table.cards td.grip + td::before { display: none !important; }
}

/* Fingers need bigger targets than a mouse. */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .nav, .navhead { min-height: 44px; }
  .inp { min-height: 44px; font-size: 16px; }
}

/* ---------- controls ---------- */
.btn { appearance: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 10px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.btn.gold { background: var(--foil); color: var(--dark-ink); }
.btn.line { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--gold-line); }
.btn.ghost { background: var(--s2); color: var(--ink2); box-shadow: inset 0 0 0 1px var(--line); }
.btn.danger { background: var(--err-soft); color: var(--err); box-shadow: inset 0 0 0 1px rgba(232,144,127,.35); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 8px; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.inp, select.inp, textarea.inp { width: 100%; height: 40px; border-radius: 10px; background: var(--s1); border: 1px solid var(--line); padding: 0 12px; color: var(--ink); outline: none; }
textarea.inp { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.inp:focus { border-color: var(--gold-line); box-shadow: 0 0 0 3px var(--gold-soft); }
.inp::placeholder { color: var(--mut2); }
input[type=color].inp { padding: 4px; width: 56px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 12px; font-weight: 700; color: var(--ink2); }
.field small { color: var(--mut); font-size: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 620px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.checks { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; color: var(--ink2); font-weight: 600; }
.check input { width: 16px; height: 16px; accent-color: var(--gold); }
.seg { display: inline-flex; background: var(--s1); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg a { padding: 6px 14px; border-radius: 7px; color: var(--mut); font-weight: 700; font-size: 13px; }
.seg a:hover { text-decoration: none; color: var(--ink); }
.seg a.on { background: var(--s3); color: var(--ink); box-shadow: inset 0 0 0 1px var(--gold-line); }

/* ---------- cards and tables ---------- */
.card { background: var(--s1); border: 1px solid var(--line); border-radius: 16px; }
.pad { padding: 18px 20px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.stat { padding: 18px 20px; display: grid; gap: 6px; color: inherit; }
a.stat:hover { border-color: var(--gold-line); text-decoration: none; }
.stat b { font: 500 34px/1 var(--fd); font-variant-numeric: tabular-nums; }
.stat.hot b { background: var(--foil); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { font-size: 12px; font-weight: 700; color: var(--mut); letter-spacing: .04em; }
.stat small { color: var(--mut); font-size: 12px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 980px) { .cols { grid-template-columns: 1fr; } }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font: 700 11px/1 var(--fb); letter-spacing: .14em; text-transform: uppercase; color: var(--mut); padding: 14px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255,255,255,.015); }
td .t { font-weight: 600; }
td small { display: block; color: var(--mut); font-size: 12px; margin-top: 2px; }
th.right, td.right { text-align: right; }
td.acts { text-align: right; white-space: nowrap; }
td.acts .btn + .btn { margin-left: 6px; }
/* drag to reorder */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
th.grip, td.grip { width: 1%; padding-right: 0; }
.handle { display: inline-grid; place-items: center; width: 30px; height: 34px; border: 0; border-radius: 8px; background: none; color: var(--mut2); font-size: 18px; line-height: 1; cursor: grab; touch-action: none; user-select: none; }
.handle:hover, .handle:focus-visible { color: var(--gold); background: var(--s2); }
tr.dragging { background: var(--s2); box-shadow: inset 3px 0 0 var(--gold); }
tr.dragging .handle { color: var(--gold); cursor: grabbing; }
body.dragging { cursor: grabbing; user-select: none; -webkit-user-select: none; }
.draghint { margin: -6px 0 12px; font-size: 13px; }
.handle-ico { color: var(--gold); }
.pills { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.num { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.plus { color: var(--gold-hi); }
.empty { padding: 44px 20px; text-align: center; color: var(--mut); }

.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; background: var(--s3); color: var(--ink2); white-space: nowrap; }
.pill.pending, .pill.upcoming { background: var(--gold-soft); color: var(--gold); }
.pill.approved, .pill.active, .pill.done, .pill.on { background: var(--ok-soft); color: var(--ok); }
.pill.rejected, .pill.cancelled, .pill.expired { background: var(--err-soft); color: var(--err); }

/* ---------- applications ---------- */
.apps { display: grid; gap: 14px; }
.appl { display: grid; grid-template-columns: 220px minmax(0, 1fr) auto; gap: 20px; padding: 18px; align-items: start; }
@media (max-width: 900px) { .appl { grid-template-columns: 1fr; } }
.photo { width: 100%; aspect-ratio: 1.586; border-radius: 12px; background: var(--s2); border: 1px solid var(--line2); overflow: hidden; display: grid; place-items: center; color: var(--mut); font-size: 12px; text-align: center; padding: 0; }
button.photo { cursor: zoom-in; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo.sample { background: linear-gradient(135deg, #2a2a30, #17171a); padding: 12px; }
.appl h3 { font: 500 22px/1.15 var(--fd); margin: 0 0 4px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 18px; margin-top: 14px; }
.kv div span { display: block; font-size: 12px; color: var(--mut); }
.kv div b { font-weight: 600; overflow-wrap: anywhere; }
.appl-acts { display: grid; gap: 8px; min-width: 150px; }
.note { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--err-soft); color: #F2C2B8; font-size: 13px; }

/* ---------- member detail ---------- */
.profile { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 22px; padding: 20px; }
@media (max-width: 820px) { .profile { grid-template-columns: 1fr; } }
.bal { font: 500 40px/1 var(--fd); background: var(--foil); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- dialog and toast ---------- */
dialog { border: 1px solid var(--gold-line); border-radius: 20px; background: var(--s1); color: var(--ink); padding: 0; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog.wide { width: min(860px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.66); backdrop-filter: blur(3px); }
.dlg { padding: 24px; display: grid; gap: 16px; }
.dlg h2 { font: 500 26px/1.15 var(--fd); margin: 0; }
button.zoom { padding: 0; border: 0; background: none; flex: none; display: block; cursor: zoom-in; border-radius: 9px; }
/* An enlarged picture (ID photo, logo, artwork): whole and readable, never taller than the screen. */
.dlg img.full { display: block; max-width: 100%; max-height: calc(100dvh - 180px); width: auto; height: auto; justify-self: center; border-radius: 12px; object-fit: contain; }
.dlg-acts { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.rows { display: grid; gap: 8px; }
.rowline { display: grid; gap: 8px; align-items: center; }
.rowline.menu { grid-template-columns: minmax(0, 1fr) 180px 34px; }
.rowline.vcat { grid-template-columns: repeat(3, minmax(0, 1fr)) 34px; }
.rowline.prize { grid-template-columns: 84px minmax(0, 1fr) 110px 90px 56px 34px; }
.rowline.kollink { grid-template-columns: 130px minmax(0, 1fr) minmax(0, 1.4fr) 90px 34px; }
.rowline .x:disabled { opacity: .35; cursor: not-allowed; }
@media (max-width: 620px) {
  .rowline.vcat { grid-template-columns: minmax(0, 1fr) 34px; }
  .rowline.vcat [data-k=name_zh], .rowline.vcat [data-k=name_ms] { grid-column: 1; }
  /* The dropdown takes its own line; points, weight and chance sit under it. */
  .rowline.prize { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 56px 34px; }
  .rowline.prize > span:first-child, .rowline.prize.rowhead > span:nth-child(2) { display: none; }
  .rowline.prize > select { grid-column: 1 / -1; }
  .rowline.prize:not(.rowhead) { padding-bottom: 6px; border-bottom: 1px solid var(--line); }
  /* A link takes two lines: platform and handle, then the address and followers. */
  .rowline.kollink { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 34px; }
  .rowline.kollink.rowhead { display: none; }
  .rowline.kollink .x { grid-column: 3; grid-row: 1; }
  .rowline.kollink:not(.rowhead) { padding-bottom: 6px; border-bottom: 1px solid var(--line); }
}
.rowline .x { width: 34px; height: 34px; border-radius: 8px; border: 0; background: var(--s2); color: var(--mut); cursor: pointer; }
.rowhead { font-size: 11px; font-weight: 700; color: var(--mut); letter-spacing: .08em; text-transform: uppercase; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 0; display: grid; gap: 10px; }
legend { padding: 0 6px; font-size: 12px; font-weight: 700; color: var(--ink2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line2); background: transparent; color: var(--ink2); font-size: 12px; font-weight: 600; cursor: pointer; }
.chip:hover { border-color: var(--gold-line); }

#toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: #1F1F23; border: 1px solid var(--gold-line); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 13px; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { border-color: rgba(232,144,127,.5); color: #F2C2B8; }

/* ---------- login ---------- */
.login { grid-column: 1 / -1; min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(700px 420px at 70% 15%, rgba(216,180,110,.10), transparent 60%), var(--bg); }
.login form { width: min(380px, 100%); display: grid; gap: 16px; padding: 30px; }
.login img { width: 120px; }
.login h1 { font: 500 34px/1.05 var(--fd); margin: 0; }

@media (prefers-reduced-motion: reduce) { * { transition-duration: .01ms !important; } }

/* partner logos */
.pname{display:flex;align-items:center;gap:12px}
.plogo{width:36px;height:36px;flex:none;border-radius:9px;background:#fff;object-fit:contain;border:1px solid var(--line,#2a2a30)}
.plogo.none{background:transparent;border-style:dashed}
.plogo.lg{width:72px;height:72px;border-radius:16px;display:grid;place-items:center;font-size:11px;color:var(--mut,#8b8b93)}
.plogo.round{border-radius:50%;object-fit:cover;background:var(--s2,#1b1b1f)}
.logorow{display:flex;align-items:flex-start;gap:16px;flex-wrap:wrap}

/* banner artwork */
.bthumb{width:88px;height:44px;flex:none;border-radius:8px;object-fit:cover;border:1px solid var(--line);display:grid;place-items:center;font-size:10px;color:var(--mut)}
.bthumb.none{border-style:dashed}
.bthumb.lg{width:200px;height:100px;border-radius:12px;font-size:11px}
/* Door check-in: the camera, then what the last scan did. */
.scanbox { background: #000; border-radius: 14px; overflow: hidden; aspect-ratio: 4 / 3; max-height: 48dvh; width: 100%; justify-self: center; }
.scanbox video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanres { padding: 12px 14px; border-radius: 12px; background: var(--s2); font-weight: 600; }
.scanres.ok { background: var(--ok-soft); color: var(--ok); }
.scanres.err { background: var(--err-soft); color: var(--err); }
.scanform { display: flex; gap: 10px; }
.scanform .inp { flex: 1; min-width: 0; }
.qrbox { background: #fff; border-radius: 12px; padding: 16px; width: min(280px, 100%); margin: 0 auto; }
.qrbox svg { display: block; width: 100%; height: auto; }
