:root {
  color-scheme: light;
  --brand: #0f766e;
  --brand-dark: #064e4a;
  --sidebar: #0c3b3a;
  --accent: #f5c969;
  --surface: #ffffff;
  --background: #f3f6f8;
  --text: #173332;
  --muted: #617473;
  --border: #d9e3e2;
  --danger: #b42318;
  --success: #067647;
  --shadow: 0 10px 30px rgba(10, 59, 58, 0.08);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--background); }
body { margin: 0; color: var(--text); background: var(--background); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #6ee7df;
  outline-offset: 3px;
}

.skip-link { position: fixed; left: 16px; top: -80px; z-index: 100; padding: 12px 16px; background: #fff; border-radius: 8px; }
.skip-link:focus { top: 16px; }
.app-shell { min-height: 100dvh; }
.sidebar { display: none; }
.mobile-header { position: sticky; top: 0; z-index: 10; height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; gap: 12px; align-items: center; text-decoration: none; }
.brand span:last-child { display: grid; gap: 2px; }
.brand small { color: #a7c8c6; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--sidebar); background: var(--accent); font-weight: 800; }
main { padding: 22px 16px calc(92px + env(safe-area-inset-bottom)); }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 0 auto 20px; max-width: 1180px; }
.eyebrow { margin: 0 0 5px; color: var(--brand); font-weight: 700; font-size: 13px; letter-spacing: .08em; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(24px, 4vw, 34px); }
h2 { margin-top: 0; font-size: 20px; }
#view { max-width: 1180px; margin: auto; }

.grid { display: grid; gap: 16px; }
.card { padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); }
.card.compact { padding: 16px; }
.card-title { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.metric { margin: 8px 0 0; font-size: 30px; font-weight: 800; }
.muted { color: var(--muted); }
.disclosure { padding: 16px; border-left: 4px solid var(--accent); background: #fffbeb; border-radius: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 17px; border: 1px solid transparent; border-radius: 11px; color: #fff; background: var(--brand); font-weight: 700; cursor: pointer; text-decoration: none; }
.button:hover { background: var(--brand-dark); }
.button.secondary { color: var(--brand-dark); background: #e8f5f3; border-color: #b8dcd8; }
.button.danger { background: var(--danger); }
.button:disabled { opacity: .55; cursor: not-allowed; }
.text-button { min-height: 44px; padding: 0; border: 0; color: inherit; background: none; text-decoration: underline; cursor: pointer; }

.form-stack { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field label, legend { font-weight: 700; }
.field input, .field select { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #aebfbd; border-radius: 10px; background: #fff; color: var(--text); }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.option-list { display: grid; gap: 11px; margin-top: 14px; }
.option { min-height: 52px; display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.option:has(input:checked) { border-color: var(--brand); background: #edf9f7; }
.option input { width: 20px; height: 20px; flex: 0 0 auto; }
.question-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pill { padding: 4px 9px; color: var(--brand-dark); background: #e8f5f3; border-radius: 999px; font-size: 13px; }
progress { width: 100%; height: 10px; accent-color: var(--brand); }
.result.correct { border-left: 5px solid var(--success); }
.result.incorrect { border-left: 5px solid var(--danger); }
.alert { max-width: 1180px; margin: 0 auto 16px; padding: 14px 16px; border: 1px solid #fda29b; border-radius: 10px; color: #7a271a; background: #fef3f2; }
.empty { padding: 36px 20px; text-align: center; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 13px; }
.status { font-weight: 700; }
.status.active, .status.available { color: var(--success); }
.status.suspended, .status.revoked { color: var(--danger); }

.auth-layout { min-height: calc(100dvh - 150px); display: grid; place-items: center; }
.auth-card { width: min(100%, 470px); }
.mobile-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.97); border-top: 1px solid var(--border); }
.nav-link { min-height: 48px; display: grid; place-items: center; padding: 6px; border-radius: 10px; color: var(--muted); text-align: center; text-decoration: none; font-size: 13px; font-weight: 700; }
.nav-link[aria-current="page"] { color: var(--brand-dark); background: #e8f5f3; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (min-width: 768px) {
  .app-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 24px 16px; color: #fff; background: var(--sidebar); }
  .primary-nav { display: grid; gap: 6px; margin-top: 36px; }
  .primary-nav .nav-link { place-items: center start; padding: 0 14px; color: #cae0df; font-size: 15px; }
  .primary-nav .nav-link[aria-current="page"] { color: #fff; background: rgba(255,255,255,.12); }
  .sidebar-foot { margin-top: auto; padding: 14px; border-top: 1px solid rgba(255,255,255,.15); color: #c5d9d8; }
  .mobile-header, .mobile-nav { display: none; }
  main { min-width: 0; padding: 42px 30px; }
  .grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1100px) {
  .app-shell { grid-template-columns: 260px minmax(0, 1fr); }
  main { padding-inline: 48px; }
}
