/* A Star Portal – design system (no build step required) */
:root {
  --maroon-950: #2a0204;
  --maroon-900: #3f0306;
  --maroon-800: #5a070b;
  --maroon-700: #7a0d12;
  --maroon-600: #9a1219;
  --maroon-500: #b81c24;
  --maroon-100: #f8e7e7;
  --maroon-50: #fcf4f3;
  --gold-700: #8f6418;
  --gold-600: #b8862f;
  --gold-500: #d4a043;
  --gold-400: #e6bd62;
  --gold-300: #f2d68f;
  --gold-100: #fbf1d9;
  --ink: #1d1718;
  --ink-2: #4a4143;
  --muted: #7c7174;
  --line: #ece4e1;
  --line-2: #e0d6d2;
  --bg: #f7f3f1;
  --surface: #ffffff;
  --green: #15803d; --green-bg: #e7f6ec;
  --amber: #b45309; --amber-bg: #fdf2df;
  --red: #c0262d;   --red-bg: #fdeaea;
  --blue: #1d5fa8;  --blue-bg: #e8f0fb;
  --grey: #6b6466;  --grey-bg: #f1edeb;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(42, 2, 4, .06);
  --shadow: 0 1px 3px rgba(42, 2, 4, .06), 0 8px 24px -12px rgba(42, 2, 4, .18);
  --font: "Plus Jakarta Sans", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Oswald", "Noto Sans SC", sans-serif;
  --sidebar: 264px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--maroon-600); text-decoration: none; }
a:hover { color: var(--maroon-500); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--ink); }
h1 { font-size: 1.55rem; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }
[x-cloak] { display: none !important; }
.icon { width: 1.15em; height: 1.15em; flex-shrink: 0; }

/* ---------- App shell ---------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40;
  background: radial-gradient(120% 60% at 0% 0%, var(--maroon-700) 0%, var(--maroon-900) 55%, var(--maroon-950) 100%);
  color: #f5e9e6; display: flex; flex-direction: column; transition: transform .25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.25rem 1rem; }
.sidebar-brand img { width: 62px; height: auto; }
.sidebar-brand strong { display: block; font-size: 1rem; color: var(--gold-300); letter-spacing: .02em; }
.sidebar-brand span { font-size: .75rem; color: #d9bcb7; }
.sidebar nav { flex: 1; overflow-y: auto; padding: .5rem .75rem 1rem; }
.nav-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: #c49a94; padding: 1rem .75rem .4rem; }
.nav-link {
  display: flex; align-items: center; gap: .75rem; padding: .62rem .75rem; border-radius: 10px;
  color: #f1dcd8; font-weight: 600; font-size: .92rem; position: relative;
}
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active { background: linear-gradient(90deg, rgba(230,189,98,.22), rgba(230,189,98,.06)); color: var(--gold-300); }
.nav-link.active::before { content: ""; position: absolute; left: -.75rem; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--gold-400); }
.nav-link .count { margin-left: auto; background: var(--gold-500); color: var(--maroon-950); font-size: .7rem; font-weight: 800; border-radius: 999px; padding: 0 .45rem; line-height: 1.35rem; min-width: 1.35rem; text-align: center; }
.sidebar-foot { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .75rem; color: #c49a94; }

.main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 64px; display: flex; align-items: center; gap: .75rem;
  padding: 0 1.5rem; background: rgba(247,243,241,.86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar .burger { display: none; }
.topbar-title { font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-search { flex: 1; max-width: 420px; margin-left: 1rem; position: relative; }
.topbar-search input { padding-left: 2.3rem; background: var(--surface); }
.topbar-search .icon { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .4rem; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface); border-color: var(--line); color: var(--ink); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--maroon-500); color: #fff; font-size: .65rem; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--bg); }
.lang-switch { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 2px; background: var(--surface); font-size: .78rem; font-weight: 700; }
.lang-switch a { padding: .2rem .6rem; border-radius: 999px; color: var(--muted); }
.lang-switch a.on { background: var(--maroon-700); color: #fff; }
.content { padding: 1.5rem; width: 100%; max-width: 1240px; margin: 0 auto; flex: 1; }
.content.narrow { max-width: 860px; }
.mobile-brand { display: none; }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: .4rem; z-index: 60;
}
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: .6rem; width: 100%; padding: .55rem .7rem; border-radius: 9px; border: 0; background: none;
  color: var(--ink-2); font: inherit; font-size: .9rem; cursor: pointer; text-align: left;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg); color: var(--ink); }
.dropdown-head { padding: .6rem .7rem .7rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; }
.dropdown-head strong { display: block; font-size: .92rem; }
.dropdown-head span { font-size: .78rem; color: var(--muted); }

.bottom-nav { display: none; }
.backdrop { display: none; }

@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .sidebar.open { transform: none; }
  .backdrop.open { display: block; position: fixed; inset: 0; background: rgba(20,6,7,.45); z-index: 35; }
  .main { margin-left: 0; }
  .topbar { padding: 0 1rem; }
  .topbar .burger { display: inline-grid; }
  .topbar-search { display: none; }
  .content { padding: 1rem; }
  .is-parent .topbar .burger { display: none; }
  .is-parent .mobile-brand { display: flex; align-items: center; gap: .5rem; }
  .is-parent .mobile-brand img { width: 44px; }
  .is-parent .topbar-title { display: none; }
  .is-parent .content { padding-bottom: 6rem; }
  .is-parent .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--line); padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 20px -14px rgba(42,2,4,.35);
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .3rem 0; font-size: .68rem; font-weight: 700; color: var(--muted); }
  .bottom-nav a .icon { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--maroon-600); }
}

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head p { color: var(--muted); margin-top: .25rem; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.breadcrumb { display: flex; align-items: center; gap: .3rem; font-size: .82rem; color: var(--muted); margin-bottom: .4rem; }
.breadcrumb a { color: var(--muted); font-weight: 600; }
.breadcrumb a:hover { color: var(--maroon-600); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 1rem; display: flex; align-items: center; gap: .5rem; }
.card-head h2 .icon { color: var(--maroon-600); }
.card-head .sub { font-size: .8rem; color: var(--muted); font-weight: 500; }
.card-body { padding: 1.25rem; }
.card-body.tight { padding: .5rem 0; }
.card-foot { padding: .9rem 1.25rem; border-top: 1px solid var(--line); background: #fcfaf9; border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }
.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--maroon-600); font-weight: 800; margin: 0 0 .75rem; }

.hero {
  position: relative; overflow: hidden; border-radius: 18px; padding: 1.5rem; color: #fff; margin-bottom: 1.25rem;
  background: radial-gradient(90% 140% at 100% 0%, var(--maroon-500) 0%, var(--maroon-700) 38%, var(--maroon-900) 100%);
  box-shadow: var(--shadow);
}
.hero::after { content: ""; position: absolute; right: -60px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%; border: 2px solid rgba(230,189,98,.25); }
.hero h1 { color: #fff; font-size: 1.45rem; }
.hero p { color: #f3d9d4; }
.hero .gold { color: var(--gold-300); }
.hero-row { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-meta { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.hero-chip { display: inline-flex; align-items: center; gap: .35rem; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.16); padding: .25rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 600; color: #fbe9e5; }

/* ---------- Grid & utilities ---------- */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
@media (max-width: 1023px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } .span-2 { grid-column: auto; } }
@media (max-width: 480px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; } }
.stack > * + * { margin-top: 1rem; }
.stack-sm > * + * { margin-top: .5rem; }
.row { display: flex; align-items: center; gap: .75rem; }
.row-wrap { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.xs { font-size: .75rem; }
.bold { font-weight: 700; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.hide-mobile { } @media (max-width: 720px) { .hide-mobile { display: none !important; } }
.show-mobile { display: none; } @media (max-width: 720px) { .show-mobile { display: initial; } }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; }
.vip { font-family: var(--display); letter-spacing: .04em; font-weight: 600; color: var(--maroon-700); }
.amount { font-family: var(--display); font-weight: 600; letter-spacing: .02em; }
.pre { white-space: pre-line; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .62rem 1.05rem; border-radius: 11px;
  border: 1px solid transparent; font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; white-space: nowrap;
  transition: background .15s, box-shadow .15s, border-color .15s, color .15s; line-height: 1.2;
}
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: linear-gradient(180deg, var(--maroon-600), var(--maroon-700)); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 6px 14px -8px rgba(122,13,18,.7); }
.btn-primary:hover { background: linear-gradient(180deg, var(--maroon-500), var(--maroon-600)); color: #fff; }
.btn-gold { background: linear-gradient(180deg, var(--gold-400), var(--gold-500)); color: var(--maroon-950); box-shadow: 0 6px 14px -8px rgba(184,134,47,.8); }
.btn-gold:hover { background: linear-gradient(180deg, var(--gold-300), var(--gold-400)); color: var(--maroon-950); }
.btn-outline { background: var(--surface); border-color: var(--line-2); color: var(--ink-2); }
.btn-outline:hover { border-color: var(--maroon-600); color: var(--maroon-700); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--grey-bg); color: var(--ink); }
.btn-danger { background: var(--surface); border-color: #f1c4c6; color: var(--red); }
.btn-danger:hover { background: var(--red-bg); color: var(--red); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #116a32; color: #fff; }
.btn-wa { background: #1faa53; color: #fff; }
.btn-wa:hover { background: #178d44; color: #fff; }
.btn-sm { padding: .4rem .7rem; font-size: .8rem; border-radius: 9px; }
.btn-lg { padding: .85rem 1.4rem; font-size: 1rem; border-radius: 13px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--maroon-600); font-weight: 700; cursor: pointer; }
.hero .btn-outline { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.3); }
.hero .btn-outline:hover { background: rgba(255,255,255,.2); color: #fff; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .16rem .58rem; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge-green { color: var(--green); background: var(--green-bg); }
.badge-amber { color: var(--amber); background: var(--amber-bg); }
.badge-red { color: var(--red); background: var(--red-bg); }
.badge-blue { color: var(--blue); background: var(--blue-bg); }
.badge-grey { color: var(--grey); background: var(--grey-bg); }
.badge-gold { color: var(--gold-700); background: var(--gold-100); }
.badge-maroon { color: var(--maroon-700); background: var(--maroon-100); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field > label, .label { font-size: .84rem; font-weight: 700; color: var(--ink-2); }
.label .zh, .field > label .zh { font-weight: 500; color: var(--muted); margin-left: .25rem; }
.req { color: var(--maroon-500); margin-left: 2px; }
.help { font-size: .78rem; color: var(--muted); }
.error { font-size: .8rem; color: var(--red); font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; padding: .66rem .85rem; border: 1px solid var(--line-2); border-radius: 11px; background: #fff;
  font: inherit; font-size: .95rem; color: var(--ink); transition: border-color .15s, box-shadow .15s; min-height: 44px;
}
textarea.input { min-height: 96px; resize: vertical; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237c7174' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2.2rem; }
.input:focus { outline: none; border-color: var(--maroon-600); box-shadow: 0 0 0 3px rgba(154,18,25,.12); }
.input.is-invalid { border-color: var(--red); }
.input[readonly] { background: var(--bg); color: var(--ink-2); }
.input-group { display: flex; }
.input-group .addon { display: grid; place-items: center; padding: 0 .8rem; background: var(--bg); border: 1px solid var(--line-2); border-right: 0; border-radius: 11px 0 0 11px; font-weight: 700; color: var(--muted); font-size: .88rem; }
.input-group .input { border-radius: 0 11px 11px 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.1rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid.sib { grid-template-columns: 2fr 2fr 1fr 1fr; }
.form-grid.pair { grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 720px) { .form-grid { grid-template-columns: minmax(0, 1fr); } .form-grid.sib { grid-template-columns: 1fr 1fr; padding-bottom: 1rem; border-bottom: 1px dashed var(--line-2); } .form-grid.sib > :first-child { grid-column: 1 / -1; } .form-grid.pair { grid-template-columns: 1fr 1fr; } }
.form-section + .form-section { margin-top: 1.75rem; padding-top: 1.5rem; border-top: 1px dashed var(--line-2); }

.choices { display: flex; flex-wrap: wrap; gap: .45rem; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .8rem; border: 1px solid var(--line-2); border-radius: 999px;
  background: #fff; font-size: .86rem; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: all .12s; user-select: none;
}
.choice span small { color: var(--muted); font-weight: 500; }
.choice input:checked + span { background: var(--maroon-50); border-color: var(--maroon-600); color: var(--maroon-700); box-shadow: 0 0 0 1px var(--maroon-600) inset; }
.choice input:checked + span small { color: var(--maroon-600); }
.choice input:focus-visible + span { box-shadow: 0 0 0 3px rgba(154,18,25,.2); }
.choice input:disabled + span { opacity: .45; cursor: not-allowed; }
.check { display: flex; align-items: flex-start; gap: .6rem; font-size: .9rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--maroon-600); margin-top: .15rem; flex-shrink: 0; }
.switch { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-weight: 600; font-size: .9rem; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 999px; background: var(--line-2); position: relative; cursor: pointer; transition: background .15s; flex-shrink: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--maroon-600); }
.switch input:checked::after { transform: translateX(18px); }

.question { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.question:last-child { border-bottom: 0; }
.question .q { font-weight: 700; font-size: .92rem; margin-bottom: .6rem; }
.question .q .zh { display: block; font-weight: 500; color: var(--muted); font-size: .85rem; }
.grades { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }

.upload-box { display: flex; align-items: center; gap: 1rem; padding: 1rem; border: 1.5px dashed var(--line-2); border-radius: 14px; background: #fdfbfa; }
.upload-box input[type=file] { font-size: .85rem; max-width: 100%; }
.sig-pad { border: 1.5px dashed var(--gold-500); border-radius: 14px; background: #fffdf8; position: relative; touch-action: none; }
.sig-pad canvas { width: 100%; height: 190px; display: block; border-radius: 14px; }
.sig-pad .hint { position: absolute; left: 1rem; bottom: .6rem; font-size: .75rem; color: var(--muted); pointer-events: none; }
.sig-line { position: absolute; left: 1rem; right: 1rem; bottom: 2.1rem; border-top: 1px solid #e8dcc4; pointer-events: none; }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: .75rem; align-items: flex-start; padding: .9rem 1rem; border-radius: 12px; border: 1px solid; font-size: .9rem; margin-bottom: 1rem; }
.alert .icon { margin-top: .15rem; }
.alert strong { display: block; }
.alert-success { background: var(--green-bg); border-color: #bfe6cc; color: #14532d; }
.alert-error { background: var(--red-bg); border-color: #f4c6c8; color: #7f1d1d; }
.alert-warn { background: var(--amber-bg); border-color: #f6d9a8; color: #7c3d06; }
.alert-info { background: var(--blue-bg); border-color: #c8daf4; color: #173f6d; }
.alert-gold { background: linear-gradient(90deg, var(--gold-100), #fff9ec); border-color: var(--gold-300); color: var(--gold-700); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: #fcfaf9; white-space: nowrap; }
.table td { padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fdfaf9; }
.table .num { text-align: right; white-space: nowrap; }
.table tr.is-overdue td { background: #fff8f8; }
@media (max-width: 720px) {
  .table.stack-mobile thead { display: none; }
  .table.stack-mobile tr { display: block; padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
  .table.stack-mobile td { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; border: 0; text-align: right; }
  .table.stack-mobile td::before { content: attr(data-label); font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; text-align: left; }
  .table.stack-mobile td.cell-main { display: block; text-align: left; }
  .table.stack-mobile td.cell-main::before { display: none; }
  .table.stack-mobile .num { text-align: right; }
}

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: .85rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
a.list-item { color: inherit; }
a.list-item:hover { background: #fdf9f8; }
.list-item .title { font-weight: 700; font-size: .93rem; }
.list-item .meta { font-size: .8rem; color: var(--muted); display: flex; gap: .35rem .8rem; flex-wrap: wrap; align-items: center; }
.list-item .meta span { display: inline-flex; align-items: center; gap: .25rem; }
.list-item .meta .icon { width: 14px; height: 14px; }
.date-tile { width: 54px; flex-shrink: 0; text-align: center; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.date-tile .m { background: var(--maroon-700); color: var(--gold-300); font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; padding: .15rem 0; }
.date-tile .d { font-family: var(--display); font-size: 1.35rem; font-weight: 600; line-height: 1.6rem; padding: .15rem 0 .1rem; }
.date-tile .w { font-size: .62rem; color: var(--muted); font-weight: 700; padding-bottom: .2rem; text-transform: uppercase; }

/* ---------- Stats ---------- */
.stat { padding: 1.1rem 1.2rem; display: flex; gap: .9rem; align-items: center; }
.stat-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex-shrink: 0; }
.stat-icon .icon { width: 22px; height: 22px; }
.stat-value { font-family: var(--display); font-size: 1.65rem; font-weight: 600; line-height: 1.1; }
.stat-label { font-size: .8rem; color: var(--muted); font-weight: 600; }
a.stat-card { color: inherit; display: block; transition: transform .15s, box-shadow .15s; }
a.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.tone-maroon { background: var(--maroon-100); color: var(--maroon-700); }
.tone-gold { background: var(--gold-100); color: var(--gold-700); }
.tone-green { background: var(--green-bg); color: var(--green); }
.tone-red { background: var(--red-bg); color: var(--red); }
.tone-amber { background: var(--amber-bg); color: var(--amber); }
.tone-blue { background: var(--blue-bg); color: var(--blue); }
@media (max-width: 480px) { .stat { padding: .85rem; gap: .6rem; } .stat-icon { width: 38px; height: 38px; } .stat-value { font-size: 1.35rem; } }

/* ---------- Progress ---------- */
.progress { height: 9px; background: var(--grey-bg); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold-500), var(--maroon-600)); }
.progress.done > div { background: var(--green); }

/* ---------- Avatars ---------- */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: linear-gradient(135deg, var(--gold-300), var(--gold-500)); color: var(--maroon-900); font-weight: 800; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sq { border-radius: 14px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: .7rem .95rem; font-weight: 700; font-size: .88rem; color: var(--muted); border: 0; background: none; border-bottom: 2.5px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; font-family: inherit; }
.tabs a.on, .tabs button.on { color: var(--maroon-700); border-bottom-color: var(--maroon-600); }
.tabs .count { background: var(--grey-bg); border-radius: 999px; padding: 0 .45rem; font-size: .72rem; margin-left: .3rem; }

.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filters .input { width: auto; min-width: 150px; min-height: 40px; padding-top: .5rem; padding-bottom: .5rem; font-size: .88rem; }
.filters .search { flex: 1; min-width: 200px; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 2.5rem 1.25rem; color: var(--muted); }
.empty .icon { width: 42px; height: 42px; margin: 0 auto .75rem; color: var(--gold-500); }
.empty h3 { color: var(--ink-2); margin-bottom: .25rem; }

/* ---------- Definition list ---------- */
.dl { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; gap: .55rem 1rem; font-size: .9rem; }
.dl dt { color: var(--muted); font-weight: 600; }
.dl dd { margin: 0; font-weight: 600; word-break: break-word; }
@media (max-width: 480px) { .dl { grid-template-columns: 1fr; gap: .1rem; } .dl dd { margin-bottom: .55rem; } }

/* ---------- Steps / checklist ---------- */
.steps { display: grid; gap: .6rem; }
.step { display: flex; align-items: center; gap: .85rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 13px; background: #fff; color: inherit; }
a.step:hover { border-color: var(--maroon-600); }
.step .num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem; background: var(--grey-bg); color: var(--muted); flex-shrink: 0; }
.step.done .num { background: var(--green); color: #fff; }
.step .grow strong { display: block; font-size: .93rem; }
.step .grow span { font-size: .8rem; color: var(--muted); }

/* ---------- Course progress ---------- */
.course-row { display: flex; align-items: center; gap: .85rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.course-row:last-child { border-bottom: 0; }
.course-dot { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; color: #fff; }
.course-dot.off { background: var(--grey-bg) !important; color: var(--muted); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.1rem; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 1rem .9rem; }
.timeline li::before { content: ""; position: absolute; left: -1.48rem; top: .35rem; width: 11px; height: 11px; border-radius: 50%; background: var(--gold-500); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--gold-500); }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,6,7,.5); z-index: 80; display: grid; place-items: center; padding: 1rem; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 18px; width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.modal-body { padding: 1.25rem; }
.modal-foot { padding: 1rem 1.25rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: .5rem; }

/* ---------- Guest / auth pages ---------- */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  background: var(--bg);
}
.auth-art {
  position: relative; overflow: hidden; color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(80% 60% at 20% 30%, var(--maroon-500) 0%, var(--maroon-700) 40%, var(--maroon-950) 100%);
}
.auth-art::before { content: ""; position: absolute; inset: auto -20% -35% -20%; height: 60%; background: radial-gradient(ellipse at top, rgba(230,189,98,.25), transparent 60%); }
.auth-art .wave { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: auto; opacity: .9; }
.auth-art .brand { display: flex; align-items: center; gap: 1rem; position: relative; z-index: 1; }
.auth-art .brand img { width: 120px; }
.auth-art h1 { color: var(--gold-300); font-size: 2.3rem; line-height: 1.15; position: relative; z-index: 1; font-family: var(--display); font-weight: 600; letter-spacing: .02em; }
.auth-art p { color: #f1d6d1; max-width: 420px; position: relative; z-index: 1; margin-top: .75rem; }
.auth-art ul { position: relative; z-index: 1; list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .6rem; }
.auth-art li { display: flex; gap: .6rem; align-items: center; color: #fbe7e2; font-weight: 600; font-size: .93rem; }
.auth-art li .icon { color: var(--gold-400); }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card.wide { max-width: 620px; }
.auth-card h2 { font-size: 1.6rem; font-weight: 800; }
.auth-card .lead { color: var(--muted); margin: .35rem 0 1.5rem; }
.auth-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.auth-top img { width: 74px; display: none; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-top img { display: block; }
}

/* ---------- VIP card ---------- */
.vip-card {
  container-type: inline-size; position: relative; width: 100%; aspect-ratio: 1 / 1; overflow: hidden; border-radius: 3cqw;
  background: radial-gradient(75% 70% at 32% 42%, #b5141d 0%, #8c0b12 42%, #5c0508 78%, #460306 100%);
  color: #f2c14e; font-family: var(--display); box-shadow: 0 18px 40px -18px rgba(42,2,4,.6); user-select: none;
}
.vip-card .vc-photo {
  position: absolute; left: 6%; top: 6%; width: 48%; height: 74%; border-radius: 24cqw 24cqw 3cqw 3cqw;
  border: .6cqw solid #e2b04f; background-color: #f4e4d4; background-size: cover; background-position: center top;
  box-shadow: 0 0 0 1.2cqw rgba(226,176,79,.18), 0 2cqw 5cqw rgba(0,0,0,.35);
}
.vip-card .vc-photo.none { display: grid; place-items: center; background: linear-gradient(160deg, #f6e6c9, #e2b04f); color: #7a0d12; font-size: 16cqw; font-weight: 600; }
.vip-card .vc-crown { position: absolute; left: 56%; top: 3.6%; width: 16.5%; }
.vip-card .vc-logo { position: absolute; left: 75%; top: 3%; width: 22%; }
.vip-card .vc-slogan {
  position: absolute; left: 62%; top: 23.5%; width: 30.5%; height: 26%; border-radius: 1.6cqw; border: .45cqw solid #d7a346;
  background: linear-gradient(180deg, #5d0609 0%, #3f0305 100%); box-shadow: 0 1.2cqw 3cqw rgba(0,0,0,.35);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  font-family: "Noto Sans SC", sans-serif; font-weight: 900; font-size: 5.6cqw; line-height: 1.32; color: #f0c45a; letter-spacing: .02em; white-space: pre-line;
}
.vip-card .vc-vipno { position: absolute; left: 60%; width: 34.5%; top: 51%; text-align: center; font-size: 4.2cqw; font-weight: 600; letter-spacing: .1em; color: #f7d27a; }
.vip-card .vc-vipno small { display: block; font-size: 1.9cqw; letter-spacing: .3em; color: #e7b9a6; font-weight: 500; }
.vip-card .vc-wave { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 38%; max-width: none; }
.vip-card .vc-name {
  position: absolute; left: 2%; right: 2%; top: 79.5%; text-align: center; font-size: 8.4cqw; font-weight: 700; line-height: 1.3;
  color: #f4c24f; text-transform: uppercase; letter-spacing: .02em; text-shadow: 0 .4cqw 0 rgba(0,0,0,.25); white-space: nowrap;
}
.vip-card .vc-name.long { font-size: 6.2cqw; top: 81.5%; }
.vip-card .vc-name.xlong { font-size: 4.8cqw; top: 83%; }
.vip-card .vc-sub { position: absolute; left: 0; right: 0; top: 92%; text-align: center; font-family: "Cinzel", serif; font-size: 4.25cqw; font-weight: 700; color: #e7b04a; letter-spacing: .02em; }
.vip-card .vc-stamp {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%) rotate(-14deg); padding: 1.4cqw 4cqw; border: 1cqw solid #fff;
  color: #fff; background: rgba(140, 10, 16, .78); font-size: 9cqw; font-weight: 700; letter-spacing: .12em; border-radius: 2cqw; text-align: center; line-height: 1.05;
}
.vip-card .vc-stamp small { display: block; font-size: 3cqw; letter-spacing: .2em; font-family: "Noto Sans SC", sans-serif; }

.vip-back {
  container-type: inline-size; position: relative; width: 100%; aspect-ratio: 1 / 1; overflow: hidden; border-radius: 3cqw; color: #fff;
  background: radial-gradient(80% 70% at 50% 0%, #a4121a 0%, #6d070c 50%, #430306 100%); box-shadow: 0 18px 40px -18px rgba(42,2,4,.6);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 6cqw;
}
.vip-back .qr-box { background: #fff; padding: 3.4cqw; border-radius: 3cqw; box-shadow: 0 0 0 1cqw rgba(226,176,79,.6); }
.vip-back .qr-box img { width: 44cqw; height: 44cqw; image-rendering: pixelated; }
.vip-back .vb-no { font-family: var(--display); font-size: 7cqw; color: #f4c24f; letter-spacing: .08em; margin-top: 5cqw; font-weight: 600; }
.vip-back .vb-name { font-size: 4.2cqw; font-weight: 700; margin-top: 1cqw; }
.vip-back .vb-meta { font-size: 3.2cqw; color: #f0cfc8; margin-top: 1.5cqw; }
.vip-back .vb-logo { position: absolute; top: 4cqw; left: 4cqw; width: 16cqw; }

.mini-card { display: flex; gap: .9rem; align-items: center; padding: 1rem; border-radius: 16px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(90% 120% at 0% 0%, #a3131b 0%, #6d070c 55%, #430306 100%); box-shadow: var(--shadow); }
.mini-card:hover { color: #fff; transform: translateY(-1px); }
.mini-card .avatar { border: 2px solid var(--gold-400); }
.mini-card .name { font-weight: 800; font-size: 1rem; }
.mini-card .vipno { font-family: var(--display); color: var(--gold-300); letter-spacing: .06em; font-size: .95rem; }
.mini-card .crown { position: absolute; right: .8rem; top: .7rem; width: 38px; opacity: .9; }

/* ---------- Scanner ---------- */
.scanner { position: relative; border-radius: 18px; overflow: hidden; background: #111; aspect-ratio: 1 / 1; max-width: 520px; margin: 0 auto; }
.scanner #reader { width: 100%; height: 100%; }
.scanner #reader video { object-fit: cover; }
.scan-result { border-radius: 16px; padding: 1rem; display: flex; gap: 1rem; align-items: center; border: 2px solid; }
.scan-result.ok { border-color: var(--green); background: var(--green-bg); }
.scan-result.warn { border-color: var(--amber); background: var(--amber-bg); }
.scan-result.bad { border-color: var(--red); background: var(--red-bg); }

/* ---------- Pagination ---------- */
.pager { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .85rem 1.25rem; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); flex-wrap: wrap; }
.pager .links { display: flex; gap: .35rem; }

/* ---------- Print (installment agreement) ---------- */
.print-page { max-width: 820px; margin: 0 auto; background: #fff; padding: 2rem; color: #111; font-size: 13px; }
.print-head { background: #1f4e79; color: #fff; text-align: center; padding: 1rem; }
.print-head h1 { color: #fff; font-size: 1.5rem; letter-spacing: .02em; }
.print-head p { font-weight: 700; margin-top: .25rem; font-size: .95rem; }
.print-sec { background: #dbe5f1; color: #1f4e79; font-weight: 800; padding: .45rem .7rem; margin: 1.1rem 0 0; font-size: .92rem; }
.print-sec.red { background: #fde4e4; color: #c00000; }
.print-table { width: 100%; border-collapse: collapse; }
.print-table td, .print-table th { border: 1px solid #aaa; padding: .45rem .55rem; vertical-align: top; }
.print-table th { background: #f2f2f2; text-align: left; width: 18%; font-weight: 700; }
.print-table thead th { background: #1f4e79; color: #fff; text-align: center; width: auto; }
.print-sig img { height: 70px; }
@media print {
  body { background: #fff; }
  .no-print, .sidebar, .topbar, .bottom-nav { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; max-width: none !important; }
  .print-page { padding: 0; }
}
