/* ============================================================
   专升本英语宝典 — Design System v2
   响应式自适应 · 一套 HTML 兼容 PC + Mobile
   参考截图：白底+蓝紫点缀，无大色块
   ============================================================ */

:root {
  /* Brand — 与线上 style.css 保持一致 */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-light: #3b82f6;
  --primary-bg: #eff6ff;
  --primary-border: #bfdbfe;
  --accent: #8b5cf6;
  --accent-light: #f5f3ff;
  --accent-50: #F3E8FF;

  /* Semantic */
  --success: #10B981;
  --success-50: #D1FAE5;
  --success-text: #065F46;
  --warning: #F59E0B;
  --warning-50: #FEF3C7;
  --warning-text: #92400E;
  --error: #EF4444;
  --error-50: #FEE2E2;
  --error-text: #991B1B;
  --info-text: #3730A3;

  /* Neutral — 与线上 style.css 保持一致 */
  --bg: #f8fafc;
  --surface: #fff;
  --text: #1e293b;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  /* Spacing */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;

  /* Radius — 与线上 style.css 一致 */
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 16px; --r-2xl: 20px; --r-full: 9999px;
  --radius-sm: 6px; --radius: 10px; --radius-lg: 14px; --radius-full: 9999px;

  /* Shadow — 与线上 style.css 一致 */
  --sh-sm: 0 1px 3px rgba(0,0,0,0.06);
  --sh-md: 0 6px 16px rgba(0,0,0,0.07), 0 2px 6px rgba(0,0,0,0.05);
  --sh-lg: 0 12px 32px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 2px 8px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 6px 16px rgba(0,0,0,0.07), 0 2px 6px rgba(0,0,0,0.05);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);

  --font: "Inter", system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* navbar is position:sticky — no padding-top needed */
  padding-bottom: 0; /* tabbar disabled — hamburger menu replaces it */
  overflow-x: hidden; /* prevent any child from causing horizontal scroll */
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ===== Layout ===== */
.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 16px;
}
@media (min-width: 768px) { .container { padding: 0 32px; } }
@media (min-width: 1024px) { .container { padding: 0 40px; } }

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.flex-1 { flex: 1; }
.text-center { text-align: center; }

/* ===== Navbar (Aigate-style: white, clean, underline active) ===== */
.navbar {
  position: sticky;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}
.navbar-inner {
  height: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 24px;
}
@media (min-width: 768px) { .navbar-inner { padding: 0 32px; } }
@media (min-width: 1024px) { .navbar-inner { padding: 0 40px; } }

.navbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  text-decoration: none;
}
.navbar-logo .logo-icon {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  background-color: var(--primary-50);
  background-image: url("../images/icon-512.png?v=20260719");
  background-image: image-set(
    url("../images/icon-512.webp?v=20260719") type("image/webp"),
    url("../images/icon-512.png?v=20260719") type("image/png")
  );
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  line-height: 0;
  color: transparent;
  overflow: hidden;
  flex-shrink: 0;
}
.navbar-logo .logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.navbar-logo .logo-sub { font-size: 11px; font-weight: 500; color: var(--text-tertiary); margin-top: 2px; }

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
}
/* Mobile: hamburger dropdown panel */
@media (max-width: 767px) {
  .navbar-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--sh-lg);
    padding: 8px 16px 16px;
    z-index: 999;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
  }
  .navbar-menu.open { display: flex; }
  .navbar-menu .navbar-link {
    padding: 12px 8px;
    font-size: 15px;
    border-bottom: 1px solid var(--border-light);
    border-radius: 0;
  }
  .navbar-menu .navbar-link::after { display: none; }
  .navbar-menu .navbar-link.active {
    background: var(--primary-50);
    border-radius: var(--r-sm);
    border-bottom-color: transparent;
  }
}
.navbar-link {
  position: relative;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: color 0.15s;
}
.navbar-link::after {
  content: '';
  position: absolute;
  left: 16px; right: 16px;
  bottom: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
  transform: scaleX(0);
  transition: transform 0.2s;
}
.navbar-link:hover { color: var(--primary); }
.navbar-link:hover::after { transform: scaleX(1); }
.navbar-link.active { color: var(--primary); font-weight: 600; }
.navbar-link.active::after { transform: scaleX(1); }

.navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
@media (max-width: 767px) { .navbar-right { display: none; } }

/* Navbar actions: search/account on every viewport, hamburger on mobile. */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}
.navbar-icon-btn {
  display: flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  color: var(--text);
  transition: all 0.15s;
  text-decoration: none;
}
.navbar-icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.navbar-icon-btn svg { width: 18px; height: 18px; }
.navbar-announcement-btn { position: relative; }
.navbar-announcement-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  display: none;
  width: 8px;
  height: 8px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--error, #dc2626);
  pointer-events: none;
}
.navbar-announcement-btn.has-unread .navbar-announcement-dot { display: block; }
.navbar-account-label { display: none; }
@media (min-width: 1024px) {
  .navbar-icon-btn.navbar-account-btn {
    width: auto;
    min-width: 96px;
    gap: 7px;
    padding: 0 12px;
    white-space: nowrap;
  }
  .navbar-account-label { display: inline; font-size: 13px; font-weight: 600; }
}

/* Hamburger toggle button */
.navbar-toggle {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.navbar-toggle:hover { border-color: var(--primary); color: var(--primary); }
.navbar-toggle .bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 16px;
}
.navbar-toggle .bars span {
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: all 0.25s;
}
.navbar-toggle.open .bars span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.navbar-toggle.open .bars span:nth-child(2) { opacity: 0; }
.navbar-toggle.open .bars span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }
@media (max-width: 767px) {
  .navbar-toggle { display: flex; }
  .navbar-right .navbar-switcher,
  .navbar-right .navbar-avatar { display: none; }
}

@media (max-width: 360px) {
  .navbar-inner { gap: 6px; padding-right: 8px; padding-left: 8px; }
  .navbar-logo { gap: 6px; }
  .navbar-logo .logo-text > span:first-child { font-size: 0; }
  .navbar-logo .logo-text > span:first-child::after {
    content: '英语宝典';
    font-size: 14px;
  }
  .navbar-logo .logo-sub { display: none; }
  .navbar-actions { gap: 3px; }
  .navbar-icon-btn,
  .navbar-toggle { width: 34px; height: 34px; }
}

.navbar-lang {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  font-size: 13px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}
.navbar-lang span { padding: 2px 6px; border-radius: 4px; cursor: pointer; }
.navbar-lang span.active { color: var(--primary); font-weight: 600; background: var(--primary-50); }

.navbar-avatar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.navbar-avatar-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}

/* Page switcher (integrated into navbar for design review) */
.navbar-switcher {
  position: relative;
}
.navbar-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-tertiary);
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.navbar-switcher-btn:hover { color: var(--primary); border-color: var(--primary-100); }
.navbar-switcher-btn .arrow { font-size: 10px; }
.navbar-switcher-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 180px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  padding: 4px;
  z-index: 1100;
  display: none;
}
.navbar-switcher-menu.open { display: block; }
.navbar-switcher-menu a {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  border-radius: var(--r-sm);
  white-space: nowrap;
}
.navbar-switcher-menu a:hover { background: var(--primary-50); color: var(--primary); }
.navbar-switcher-menu .group-label {
  padding: 6px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== Mobile Tabbar (DEPRECATED — replaced by hamburger menu) ===== */
.mobile-tabbar { display: none !important; }

/* ===== Hero (clean white, no big color) ===== */
.hero {
  padding: 32px 0 24px;
  text-align: center;
}
@media (min-width: 768px) { .hero { padding: 48px 0 40px; } }
.hero h1 { font-size: 24px; font-weight: 700; color: var(--text); }
@media (min-width: 768px) { .hero h1 { font-size: 32px; } }
.hero .subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 8px; }
@media (min-width: 768px) { .hero .subtitle { font-size: 15px; } }

/* ===== Page header (clean) ===== */
.page-header {
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
@media (min-width: 768px) { .page-header { padding: 32px 0 24px; } }
.page-header h1 { font-size: 22px; font-weight: 700; }
@media (min-width: 768px) { .page-header h1 { font-size: 28px; } }
.page-header p { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

/* ===== Card ===== */
.card {
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  box-shadow: var(--sh-sm);
  padding: 20px;
  min-width: 0; /* allow shrinking in flex/grid parent */
  overflow: hidden; /* clip any child that still overflows */
}
@media (min-width: 768px) { .card { padding: 28px; } }
.card-hover { transition: all 0.2s ease; cursor: pointer; }
.card-hover:hover { box-shadow: var(--sh-md); border-color: var(--primary-100); transform: translateY(-1px); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.15s;
  min-height: 36px;
}
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
  background: var(--primary-50);
  color: var(--primary);
}
.btn-secondary:hover { background: var(--primary-100); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { color: var(--text-secondary); }
.btn-ghost:hover { background: var(--border-light); }
.btn-sm { padding: 6px 12px; font-size: 12px; min-height: 28px; }
.btn-lg { padding: 12px 24px; font-size: 15px; min-height: 44px; }
.btn-block { width: 100%; }

/* ===== Form ===== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 14px;
  background: var(--surface);
  font-family: inherit;
  transition: all 0.15s;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.form-input::placeholder { color: var(--text-tertiary); }

/* ===== Badge / Tag ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-primary { background: var(--primary-50); color: var(--primary); }
.badge-success { background: var(--success-50); color: var(--success); }
.badge-warning { background: var(--warning-50); color: var(--warning); }
.badge-error { background: var(--error-50); color: var(--error); }

/* ===== Progress ===== */
.progress-bar {
  height: 6px;
  background: var(--border-light);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--r-full);
  transition: width 0.3s, background 0.3s;
}
.progress-fill.success { background: var(--success); }
.progress-fill.warning { background: var(--warning); }
.progress-fill.error { background: var(--error); }

/* ===== Avatar ===== */
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}
.avatar-lg { width: 72px; height: 72px; font-size: 28px; }

/* ===== Stats Card ===== */
.stat-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  padding: 16px;
  text-align: center;
}
.stat-value { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ===== Section header ===== */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.section-title { font-size: 18px; font-weight: 700; }
@media (min-width: 768px) { .section-title { font-size: 20px; } }
.section-sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ===== Responsive Grids ===== */
.grid { display: grid; gap: 16px; }
@media (min-width: 768px) { .grid { gap: 20px; } }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 768px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.grid-4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 768px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1024px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }

/* ===== List Item ===== */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--r-md);
  transition: background 0.15s;
  cursor: pointer;
}
.list-item:hover { background: var(--border-light); }
.list-item-ico {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: var(--primary-50);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-size: 14px; font-weight: 500; }
.list-item-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ===== Spacing utilities ===== */
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; } .mb-8 { margin-bottom: 32px; }

/* navbar is position:sticky — no body offset needed */

/* Breathing room between fixed navbar and main content */
main { margin-top: 16px; }

/* ============================================================
   Admin Layout — 后台管理系统
   ============================================================ */

/* Admin body reset — admin pages have their own layout (navbar is sticky, no offset) */
body.admin { padding-top: 0; padding-bottom: 0; background: var(--bg); }
body.admin .navbar, body.admin .mobile-tabbar { display: none; }

/* Admin Shell */
.admin-shell {
  display: flex;
  min-height: calc(100vh - 60px);
}

/* Sidebar */
.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 60px;
  bottom: 0;
  left: 0;
  z-index: 900;
  overflow-y: auto;
  transition: transform 0.25s ease;
}
@media (max-width: 1023px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
}

.admin-sidebar-head {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-sidebar-head .logo-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background-color: var(--primary-50);
  background-image: url("../images/icon-512.png?v=20260719");
  background-image: image-set(
    url("../images/icon-512.webp?v=20260719") type("image/webp"),
    url("../images/icon-512.png?v=20260719") type("image/png")
  );
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  display: flex; align-items: center; justify-content: center;
  font-size: 0;
  line-height: 0;
  color: transparent;
  overflow: hidden;
}
.admin-sidebar-head .title { font-size: 15px; font-weight: 700; white-space: nowrap; }
.admin-sidebar-head .sub { font-size: 11px; color: var(--text-tertiary); }

.admin-nav { padding: 12px 12px; }
.admin-nav-group { margin-bottom: 16px; }
.admin-nav-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0 12px 8px;
  white-space: nowrap;
}
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  font-size: 14px;
  color: var(--text-secondary);
  transition: all 0.15s;
  white-space: nowrap;
  cursor: pointer;
}
.admin-nav-item:hover { background: var(--border-light); color: var(--text); }
.admin-nav-item.active { background: var(--primary-50); color: var(--primary); font-weight: 600; }
.admin-nav-item .ico { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.admin-nav-item .badge { margin-left: auto; }

/* Main area */
.admin-main {
  flex: 1;
  margin-left: 240px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
@media (max-width: 1023px) { .admin-main { margin-left: 0; } }

/* Admin topbar */
.admin-topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 800;
  gap: 12px;
}
.admin-topbar-left { display: flex; align-items: center; gap: 12px; }
.admin-menu-btn {
  display: none;
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text);
}
@media (max-width: 1023px) { .admin-menu-btn { display: flex; } }
.admin-page-title { font-size: 16px; font-weight: 600; white-space: nowrap; }
.admin-topbar-right { display: flex; align-items: center; gap: 16px; margin-left: auto; }

.admin-content { padding: 24px; flex: 1; }
@media (min-width: 768px) { .admin-content { padding: 32px; } }

/* Admin sidebar overlay (mobile) */
.admin-overlay {
  display: none;
  position: fixed;
  inset: 0 0 0 0;
  background: rgba(0,0,0,0.3);
  z-index: 850;
}
.admin-overlay.show { display: block; }
@media (min-width: 1024px) { .admin-overlay { display: none !important; } }

/* ===== Admin Components ===== */

/* Admin stat cards */
.astat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.astat-ico {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.astat-body { flex: 1; min-width: 0; }
.astat-label { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.astat-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1.2; margin-top: 4px; }
.astat-delta { font-size: 12px; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.astat-delta.up { color: var(--success); }
.astat-delta.down { color: var(--error); }

/* Data table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--border-light);
}
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.data-table tbody tr { transition: background 0.15s; }
.data-table tbody tr:hover { background: var(--border-light); }
.data-table .table-actions { display: flex; gap: 8px; }

/* Table wrapper (horizontal scroll on mobile) */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
.table-wrap .data-table { min-width: 600px; }

/* Pagination */
.admin-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 36px; height: 36px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  padding: 0 8px;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Toggle switch */
.toggle {
  position: relative;
  width: 44px; height: 24px;
  background: var(--border);
  border-radius: var(--r-full);
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle.on { background: var(--primary); }
.toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle.on::after { transform: translateX(20px); }

/* Checkbox-based toggle (accessible) */
.toggle input { display: none; }
.toggle-slider {
  position: relative;
  display: inline-block;
  width: 44px; height: 24px;
  background: var(--border);
  border-radius: var(--r-full);
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::after { transform: translateX(20px); }

/* Setting row */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 14px; font-weight: 500; }
.setting-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; line-height: 1.5; }

/* Chart placeholder */
.chart-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
}
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 200px;
  margin-top: 16px;
}
.chart-bar {
  flex: 1;
  background: var(--primary-100);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  position: relative;
  min-height: 4px;
  transition: background 0.2s;
}
.chart-bar:hover { background: var(--primary); }
.chart-bar .bar-label {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}
.chart-bar .bar-val {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

/* Admin card with header */
.acard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.acard-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.acard-title { font-size: 16px; font-weight: 600; }
.acard-body { padding: 20px; }

/* Search input */
.search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0 12px;
  height: 36px;
}
.search-input input {
  border: none;
  background: none;
  outline: none;
  font-size: 14px;
  flex: 1;
  font-family: inherit;
}
.search-input .ico { color: var(--text-tertiary); font-size: 16px; }

/* Code block */
.code-block {
  background: #1F2937;
  color: #D1D5DB;
  border-radius: var(--r-md);
  padding: 16px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
}
.code-block .key { color: #93C5FD; }
.code-block .str { color: #86EFAC; }
.code-block .com { color: #6B7280; }

/* ============================================================
   Interactive Components — 弹窗/Toast/骨架屏/空状态/侧滑面板
   ============================================================ */

/* ===== Modal / Dialog ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(8px);
  transition: transform 0.2s;
}
.modal-overlay.show .modal { transform: scale(1) translateY(0); }
.modal.modal-lg { max-width: 640px; }
.modal.modal-sm { max-width: 360px; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.modal-title { font-size: 17px; font-weight: 600; white-space: nowrap; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--border-light); color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
}

/* ===== Slide-over (侧滑面板) ===== */
.slideover-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 5000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}
.slideover-overlay.show { opacity: 1; visibility: visible; }
.slideover {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  box-shadow: var(--sh-lg);
  z-index: 5001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.slideover-overlay.show .slideover { transform: translateX(0); }
.slideover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.slideover-title { font-size: 16px; font-weight: 600; white-space: nowrap; }
.slideover-body { flex: 1; overflow-y: auto; padding: 20px; }
.slideover-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 76px;
  right: 16px;
  z-index: 6000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}
@media (min-width: 768px) { .toast-container { top: 80px; right: 24px; } }
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  box-shadow: var(--sh-lg);
  font-size: 14px;
  animation: toast-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 3px solid var(--text-tertiary);
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--error); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-info { border-left-color: var(--primary); }
.toast-ico { font-size: 18px; flex-shrink: 0; line-height: 1.4; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 600; font-size: 14px; }
.toast-msg { font-size: 13px; color: var(--text-secondary); margin-top: 2px; line-height: 1.5; }
.toast-close { font-size: 16px; color: var(--text-tertiary); cursor: pointer; flex-shrink: 0; line-height: 1.4; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== Skeleton loading ===== */
.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--border) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  border-radius: var(--r-md);
  animation: skeleton-shimmer 1.5s infinite;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text:last-child { width: 60%; }
.skeleton-title { height: 20px; width: 40%; margin-bottom: 12px; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-card { height: 120px; border-radius: var(--r-lg); }

/* ===== Empty state ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}
.empty-ico {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}
.empty-title { font-size: 16px; font-weight: 600; color: var(--text); }
.empty-desc { font-size: 14px; color: var(--text-secondary); margin-top: 8px; line-height: 1.6; }
.empty-action { margin-top: 20px; }

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab-item {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  position: relative;
  top: 1px;
}
.tab-item:hover { color: var(--text); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-content { padding-top: 20px; }

/* ===== Accordion ===== */
.accordion-item {
  border-bottom: 1px solid var(--border);
}
.accordion-item:last-child { border-bottom: none; }
.accordion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  gap: 12px;
}
.accordion-head .arrow { font-size: 12px; color: var(--text-tertiary); transition: transform 0.2s; flex-shrink: 0; }
.accordion-item.open .arrow { transform: rotate(180deg); }
.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.accordion-item.open .accordion-body { max-height: 500px; padding-bottom: 14px; }

/* ===== Tooltip ===== */
.tooltip-wrap { position: relative; display: inline-flex; }
.tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1F2937;
  color: white;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--r-md);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s;
  pointer-events: none;
  z-index: 4000;
}
.tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1F2937;
}
.tooltip-wrap:hover .tooltip { opacity: 1; visibility: visible; }

/* ===== Dropdown menu ===== */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  padding: 4px;
  z-index: 3000;
  display: none;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text);
  border-radius: var(--r-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s;
}
.dropdown-item:hover { background: var(--border-light); }
.dropdown-item.danger { color: var(--error); }
.dropdown-item.danger:hover { background: var(--error-50); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ===== Spinner ===== */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-lg { width: 36px; height: 36px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Alert banner ===== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 14px;
  line-height: 1.6;
}
.alert-info { background: var(--primary-50); color: var(--info-text); }
.alert-success { background: var(--success-50); color: var(--success-text); }
.alert-warning { background: var(--warning-50); color: var(--warning-text); }
.alert-error { background: var(--error-50); color: var(--error-text); }
.alert-ico { font-size: 18px; flex-shrink: 0; line-height: 1.4; }

/* ===== Steps / Wizard ===== */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
}
.step {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--border-light);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.step.active .step-num { background: var(--primary); color: white; }
.step.done .step-num { background: var(--success); color: white; }
.step-label { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.step.active .step-label { color: var(--text); font-weight: 600; }
.step-line { width: 32px; height: 2px; background: var(--border); margin: 0 4px; flex-shrink: 0; }
.step.done + .step-line { background: var(--success); }

/* ===== Switch (toggle variant) ===== */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  gap: 12px;
}

/* ===== Chip / Input tag ===== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--primary-50);
  color: var(--primary);
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.chip .chip-close { cursor: pointer; font-size: 14px; opacity: 0.6; }
.chip .chip-close:hover { opacity: 1; }

/* ===== Progress ring ===== */
.progress-ring {
  position: relative;
  width: 56px;
  height: 56px;
}
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring .ring-bg { stroke: var(--border); fill: none; }
.progress-ring .ring-fg { stroke: var(--primary); fill: none; stroke-linecap: round; transition: stroke-dashoffset 0.3s; }
.progress-ring .ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}

/* ===== Avatar group ===== */
.avatar-group { display: flex; }
.avatar-group .avatar {
  margin-left: -8px;
  border: 2px solid var(--surface);
}
.avatar-group .avatar:first-child { margin-left: 0; }
.avatar-more {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--border-light);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  margin-left: -8px;
  border: 2px solid var(--surface);
}

/* ===== Banner (top announcement) ===== */
.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--primary-50);
  border-radius: var(--r-md);
  font-size: 14px;
  color: var(--text);
}
.banner .banner-ico { font-size: 18px; flex-shrink: 0; }
.banner .banner-close { margin-left: auto; cursor: pointer; color: var(--text-tertiary); font-size: 16px; flex-shrink: 0; }

/* ===== Wizard (多步骤表单) ===== */
.wizard-step { display: none; }
.wizard-step.active { display: block; }
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

/* ===== Form fields (增强) ===== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.form-label .req { color: var(--error); margin-left: 2px; }
.form-hint { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; line-height: 1.5; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-50);
}
.form-textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.form-row { display: flex; gap: 12px; }
.form-row > .form-group { flex: 1; }

/* Radio cards (可选择的卡片式选项) */
.radio-cards { display: grid; gap: 10px; }
.radio-cards.grid-2 { grid-template-columns: repeat(2, 1fr); }
.radio-cards.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 480px) {
  .radio-cards.grid-2, .radio-cards.grid-3 { grid-template-columns: 1fr; }
}
.radio-card {
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.radio-card:hover { border-color: var(--primary-100); }
.radio-card.selected {
  border-color: var(--primary);
  background: var(--primary-50);
}
.radio-card-ico { font-size: 24px; margin-bottom: 6px; }
.radio-card-title { font-size: 14px; font-weight: 600; }
.radio-card-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* Result summary (报告/结果汇总) */
.result-hero {
  text-align: center;
  padding: 20px 0;
}
.result-score {
  font-size: 48px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}
.result-grade {
  display: inline-block;
  padding: 4px 14px;
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
}
.result-grade.excellent { background: var(--success-50); color: var(--success); }
.result-grade.good { background: var(--primary-50); color: var(--primary); }
.result_grade.pass { background: var(--warning-50); color: var(--warning); }
.result-grade.fail { background: var(--error-50); color: var(--error); }
.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0;
}
.result-stat {
  text-align: center;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--r-md);
}
.result-stat-val { font-size: 20px; font-weight: 700; }
.result-stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* Question review (答题回顾) */
.q-review-list { display: flex; flex-direction: column; gap: 10px; }
.q-review-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
}
.q-review-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.q-review-num.correct { background: var(--success-50); color: var(--success); }
.q-review-num.wrong { background: var(--error-50); color: var(--error); }
.q-review-num.skip { background: var(--border-light); color: var(--text-tertiary); }
.q-review-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-review-answer { font-weight: 600; flex-shrink: 0; }
.q-review-answer.correct { color: var(--success); }
.q-review-answer.wrong { color: var(--error); }

/* ===== Site Footer ===== */
.site-footer {
  margin-top: clamp(28px, 4vw, 48px);
  padding: 0 16px;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.45;
}
.site-footer-inner {
  width: 100%;
  max-width: var(--max-width, 1200px);
  min-height: 88px;
  margin: 0 auto;
  padding: 17px 0;
  display: grid;
  grid-template-columns: minmax(260px, 1.15fr) auto minmax(190px, .85fr);
  align-items: center;
  gap: 24px 34px;
}
.footer-col { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.footer-brand {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 11px;
  align-items: center;
}
.footer-brand::before {
  content: "";
  width: 36px;
  height: 36px;
  grid-row: 1 / 3;
  border-radius: 8px;
  background: url("../images/icon-192.png") center / cover no-repeat;
}
.footer-brand-name { color: var(--text); font-size: 0.82rem; font-weight: 750; line-height: 1.25; }
.footer-brand-desc { color: var(--text-tertiary); font-size: 0.7rem; }
.footer-legal { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 8px 18px; }
.footer-legal a,
.footer-contact a { color: var(--text-secondary); font-weight: 600; text-decoration: none; transition: color 0.15s ease; }
.footer-legal a:hover,
.footer-contact a:hover { color: var(--primary); }
.footer-contact { align-items: flex-end; text-align: right; }
.footer-contact span { color: var(--text-tertiary); font-size: 0.68rem; }
.footer-contact a { white-space: nowrap; }
@media (max-width: 800px) {
  .site-footer-inner { grid-template-columns: minmax(0, 1fr) auto; }
  .footer-legal { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
}
@media (max-width: 640px) {
  .site-footer { margin-top: 20px; padding: 0 16px; }
  .site-footer-inner { min-height: 0; padding: 18px 0 20px; grid-template-columns: 1fr; gap: 13px; }
  .footer-brand { grid-template-columns: 32px minmax(0, 1fr); }
  .footer-brand::before { width: 32px; height: 32px; border-radius: 7px; }
  .footer-brand-desc { display: none; }
  .site-footer-inner { justify-items: center; text-align: center; }
  .footer-brand { justify-self: center; text-align: left; }
  .footer-legal { grid-column: auto; grid-row: auto; justify-content: center; gap: 6px 15px; }
  .footer-contact { align-items: center; text-align: center; }
  .footer-contact span { display: none; }
  .footer-legal a, .footer-contact a { white-space: nowrap; }
}

/* ============================================================
   Utility classes + Component patterns
   (Migrated from design-system v2 — zero inline-style infrastructure)
   ============================================================ */

/* Display */
.hidden { display: none; }
.block { display: block; }
.inline-flex { display: inline-flex; }

/* Text colors */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-white { color: #fff; }

/* Backgrounds */
.bg-primary-50 { background: var(--primary-50); }
.bg-primary-100 { background: var(--primary-100); }
.bg-primary { background: var(--primary); }
.bg-success-50 { background: var(--success-50); }
.bg-success { background: var(--success); }
.bg-warning-50 { background: var(--warning-50); }
.bg-warning { background: var(--warning); }
.bg-error-50 { background: var(--error-50); }
.bg-error { background: var(--error); }
.bg-accent-50 { background: var(--accent-50); }
.bg-surface { background: var(--surface); }
.bg-base { background: var(--bg); }
.bg-border-light { background: var(--border-light); }

/* Tag style (bg + color combo) */
.tag-primary { background: var(--primary-50); color: var(--primary); }
.tag-success { background: var(--success-50); color: var(--success); }
.tag-warning { background: var(--warning-50); color: var(--warning); }
.tag-error { background: var(--error-50); color: var(--error); }

/* Font sizes */
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-base { font-size: 13px; }
.text-md { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }

/* Font weights */
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Combined text styles */
.text-meta { font-size: 12px; color: var(--text-secondary); }
.text-label { font-size: 14px; font-weight: 500; }
.text-section-title { font-size: 14px; font-weight: 600; }
.text-stat-val { font-size: 20px; font-weight: 700; }

/* Cursor */
.cursor-pointer { cursor: pointer; }

/* Margin — new additions (mt-2/3/4/6/8, mb-2/3/4/6/8 already exist above) */
.mt-5 { margin-top: 20px; }
.mt-7 { margin-top: 28px; }
.mb-5 { margin-bottom: 20px; }
.m-0 { margin: 0; }
.mx-auto { margin: 0 auto; }
.pt-4 { padding-top: 16px; }
.pt-6 { padding-top: 24px; }

/* Width */
.w-full { width: 100%; }
.w-140 { width: 140px; }
.min-w-0 { min-width: 0; }
.flex-1-min0 { flex: 1; min-width: 0; }

/* Max height */
.max-h-300 { max-height: 300px; }

/* Border */
.border-t { border-top: 1px solid var(--border); }

/* ===== Component patterns ===== */

/* Panel head */
.panel-head { padding: 14px 16px; border-bottom: 1px solid var(--border-light); }
.panel-head-clickable { padding: 14px 16px; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; cursor: pointer; }

/* Section card */
.section-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 20px; }

/* Link row / item */
.link-row { display: flex; align-items: center; justify-content: space-between; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-md); text-decoration: none; color: var(--text); transition: all 0.15s; }
.link-row:hover { border-color: var(--primary-100); background: var(--primary-50); }
.link-item { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: var(--r-md); text-decoration: none; color: var(--text); transition: all 0.15s; }
.link-item:hover { border-color: var(--primary-100); background: var(--primary-50); }

/* Stat box */
.stat-box { padding: 14px; background: var(--bg); border-radius: var(--r-md); text-align: center; }

/* Divider */
.divider-v { width: 1px; background: var(--border); margin: 4px; }

/* Boxes */
.warning-box { padding: 14px; background: var(--warning-50); border-radius: var(--r-md); margin-bottom: 20px; }
.info-box { padding: 16px; background: var(--primary-50); border-radius: var(--r-md); margin-bottom: 16px; text-align: center; }
.bg-box { padding: 16px; background: var(--bg); border-radius: var(--r-md); margin-bottom: 16px; }
.result-box-success { padding: 12px; background: var(--success-50); border-radius: var(--r-md); border: 1px solid var(--success); }
.result-box-error { padding: 12px; background: var(--error-50); border-radius: var(--r-md); border: 1px solid var(--error); }

/* Text helpers */
.text-xs-tertiary { font-size: 11px; color: var(--text-tertiary); }
.text-xs-secondary { font-size: 11px; color: var(--text-secondary); }
.text-lg-bold { font-size: 18px; font-weight: 700; }
.text-2xl-bold { font-size: 24px; font-weight: 700; }
.text-display { font-size: 48px; }
.text-body-lg { font-size: 15px; line-height: 1.8; color: var(--text); }
.text-body-secondary { font-size: 14px; line-height: 1.8; color: var(--text-secondary); }
.text-quote { border-left: 3px solid var(--primary); padding-left: 10px; color: var(--text-secondary); }
.text-quote-sm { border-left: 2px solid var(--primary); padding-left: 8px; margin-top: 4px; color: var(--text-tertiary); }

/* White space */
.nowrap { white-space: nowrap; }

/* Code box */
.code-box { background: var(--bg); padding: 10px; border-radius: var(--r-md); font-size: 13px; }

/* Stat row */
.stat-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }

/* Step item */
.step-item { display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--bg); border-radius: var(--r-md); }

/* Icon color variants */
.ico-primary { background: var(--primary-50); }
.ico-warning { background: var(--warning-50); }
.ico-success { background: var(--success-50); }
.ico-error { background: var(--error-50); }
.ico-accent { background: var(--accent-50); }

/* Border helpers */
.border-none { border: none; }
.radius-0 { border-radius: 0; }
.border-t-section { border-top: 1px solid var(--border); padding-top: 14px; }
.divider-top { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 16px; }

/* Max width */
.max-w-720 { max-width: 720px; }
.max-w-840 { max-width: 840px; }

/* Min height */
.min-h-120 { min-height: 120px; }

/* Flex combos */
.flex-col-gap10 { display: flex; flex-direction: column; gap: 10px; }
.flex-row-gap10 { display: flex; align-items: center; gap: 10px; }
.flex-wrap-gap8 { display: flex; flex-wrap: wrap; gap: 8px; }
.flex-wrap-gap12 { display: flex; flex-wrap: wrap; gap: 12px; }
.flex-gap12-wrap { display: flex; gap: 12px; flex-wrap: wrap; }

/* Icon button small */
.icon-btn-sm { width: 32px; height: 32px; font-size: 13px; }

/* Step circles */
.step-circle-done { width: 32px; height: 32px; border-radius: 50%; background: var(--success); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.step-circle-pending { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }

/* Profile */
.profile-link { display: flex; align-items: center; justify-content: space-between; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-md); text-decoration: none; color: var(--text); transition: all 0.15s; }
.profile-link:hover { border-color: var(--primary-100); background: var(--primary-50); }
.profile-avatar { margin: 0 auto 12px; width: 72px; height: 72px; font-size: 28px; cursor: pointer; }

/* Pagination ellipsis */
.pagination-ellipsis { color: var(--text-tertiary); font-size: 13px; padding: 0 4px; }

/* Empty state compact */
.empty-compact { text-align: center; padding: 12px 0; }
.empty-compact-ico { font-size: 48px; margin-bottom: 12px; }
.empty-compact-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.empty-compact-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

/* Clickable primary */
.click-primary { cursor: pointer; background: var(--primary); color: white; }

/* Showcase / demo */
.demo-card { padding: 14px; border: 1px solid var(--border); border-radius: var(--r-md); }
.demo-card-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.grid-auto-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.swatch { width: 56px; height: 56px; border-radius: var(--r-md); margin: 0 auto; }
.swatch-label { font-size: 11px; margin-top: 4px; color: var(--text-secondary); }
.inline-code { background: var(--surface); padding: 2px 6px; border-radius: var(--r-sm); }
.empty-center { text-align: center; padding: 40px 0; color: var(--text-tertiary); font-size: 13px; }
.advice-text { font-size: 13px; color: var(--text-secondary); line-height: 1.8; list-style: disc; padding-left: 20px; }
.info-box-sm { margin-top: 16px; padding: 12px; background: var(--primary-50); border-radius: var(--r-md); font-size: 13px; color: var(--info-text); }
.section-mb { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.text-md-bold { font-size: 15px; font-weight: 600; }
.text-sm-tertiary { font-size: 13px; color: var(--text-tertiary); font-weight: 400; }

/* Detail page helpers */
.detail-section-head { font-size: 14px; font-weight: 700; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.detail-meta-line { font-size: 11px; color: var(--text-tertiary); margin-top: 6px; }
.detail-flex-gap { display: flex; gap: 12px; margin-top: 4px; }
.detail-flex1-xs { font-size: 12px; flex: 1; }
