/* ==========================================================================
   Apple Design System — 花漾员工培训系统
   BEM naming, CSS custom properties, dark mode, responsive
   All class names match js/app.js innerHTML output exactly.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Variables (Light Theme)
   -------------------------------------------------------------------------- */
:root {
  /* Typography */
  --font: "Inter", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", monospace;
  --fs-xs: 0.6875rem;   /* 11px */
  --fs-sm: 0.8125rem;   /* 13px */
  --fs-base: 0.9375rem; /* 15px */
  --fs-md: 1.0625rem;   /* 17px */
  --fs-lg: 1.25rem;     /* 20px */
  --fs-xl: 1.5rem;      /* 24px */
  --fs-2xl: 2rem;       /* 32px */
  --fs-3xl: 2.5rem;     /* 40px */
  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --lh-tight: 1.25;
  --lh-normal: 1.5;
  --lh-relaxed: 1.7;

  /* Colors */
  --bg: #ffffff;
  --bg-inset: #f5f5f7;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #aeaeb2;
  --primary: #0071e3;
  --primary-hover: #0077ed;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-bg: rgba(0, 113, 227, 0.08);
  --success: #30b158;
  --success-bg: rgba(48, 177, 88, 0.08);
  --warning: #ff9f0a;
  --warning-bg: rgba(255, 159, 10, 0.08);
  --danger: #ff3b30;
  --danger-bg: rgba(255, 59, 48, 0.08);
  --border: #e5e5ea;
  --border-light: #f0f0f2;

  /* Shadows — soft multi-layer Apple-style */
  --shadow-sm: 0 2px 8px -2px rgba(0,0,0,0.06), 0 1px 3px -1px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px -2px rgba(0,0,0,0.06), 0 4px 16px -2px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px -4px rgba(0,0,0,0.08), 0 8px 32px -4px rgba(0,0,0,0.12);
  --shadow-xl: 0 8px 32px -6px rgba(0,0,0,0.12), 0 16px 64px -8px rgba(0,0,0,0.16);

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 80px;

  /* Layout */
  --sidebar-w: 260px;
  --header-h: 52px;

  /* Easing */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* --------------------------------------------------------------------------
   2. Reset / Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
  overflow: hidden;
  min-height: 100vh;
}

img, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}
a:hover { color: var(--accent-hover); }

ul, ol { list-style: none; }

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--text);
}

h1 { font-size: var(--fs-3xl); font-weight: var(--fw-bold); letter-spacing: -0.03em; }
h2 { font-size: var(--fs-2xl); letter-spacing: -0.02em; }
h3 { font-size: var(--fs-lg); letter-spacing: -0.01em; }
h4 { font-size: var(--fs-md); }
h5 { font-size: var(--fs-md); }
h6 { font-size: var(--fs-base); }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

::selection {
  background: var(--accent);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

em { font-style: normal; font-weight: var(--fw-semibold); }

strong, b { font-weight: var(--fw-semibold); }

/* --------------------------------------------------------------------------
   3. Layout — #app / #sidebar / #main
   -------------------------------------------------------------------------- */
#app {
  display: flex;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
}

#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-inset);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-lg);
  gap: var(--space-sm);
  transition: transform 0.3s var(--ease);
  z-index: 100;
  position: relative;
}

#main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

#main-content {
  flex: 1;
  padding: var(--space-lg) var(--space-lg) var(--space-4xl);
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   4. Topbar
   -------------------------------------------------------------------------- */
.topbar {
  height: var(--header-h);
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  gap: var(--space-md);
  z-index: 50;
  position: sticky;
  top: 0;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.topbar__menu-btn {
  display: none;
  width: 28px;
  height: 24px;
  flex-direction: column;
  justify-content: space-between;
  padding: 2px;
  cursor: pointer;
}

.topbar__menu-btn span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.2s var(--ease);
}

.topbar__logo {
  font-size: var(--fs-xl);
  line-height: 1;
}

.topbar__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  color: var(--text);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.topbar__search {
  flex: 1;
  max-width: 320px;
  position: relative;
}

.topbar__search input {
  width: 100%;
  padding: 7px 14px 7px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  background: var(--bg-inset);
  color: var(--text);
  outline: none;
  transition: all 0.2s var(--ease);
}

.topbar__search input:focus {
  background: var(--bg);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

/* Search magnifier ::before = circle, ::after = handle */
.topbar__search::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border: 2px solid var(--text-tertiary);
  border-radius: 50%;
  pointer-events: none;
}

.topbar__search::after {
  content: "";
  position: absolute;
  left: 26px;
  top: 50%;
  transform: translateY(-50%) rotate(-45deg);
  width: 6px;
  height: 2px;
  background: var(--text-tertiary);
  border-radius: 1px;
  pointer-events: none;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
  flex-shrink: 0;
}

.topbar__theme-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-lg);
  transition: background 0.2s var(--ease);
  cursor: pointer;
  color: var(--text);
  background: transparent;
}

.topbar__theme-btn:hover {
  background: var(--bg-inset);
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.topbar__user span {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   5. Sidebar
   -------------------------------------------------------------------------- */

/* Brand */
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-xs);
  margin-bottom: var(--space-md);
  font-size: 20px;
  font-weight: var(--fw-bold);
  color: var(--text);
  letter-spacing: -0.02em;
}

.sidebar__logo {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xl);
  border-radius: var(--radius-sm);
}

/* Navigation */
.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  position: relative;
  text-decoration: none;
}

.sidebar__link:hover {
  background: var(--accent-bg);
  color: var(--text);
}

.sidebar__link--active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: var(--fw-semibold);
}

/* Active indicator ::before bar */
.sidebar__link--active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.sidebar__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: inherit;
  opacity: 0.8;
}

.sidebar__link--active .sidebar__icon { opacity: 1; }

.sidebar__label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Nav item variant (used by updateSidebarActive) */
.sidebar__nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  position: relative;
  text-decoration: none;
}

.sidebar__nav-item:hover {
  background: var(--accent-bg);
  color: var(--text);
}

.sidebar__nav-item--active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: var(--fw-semibold);
}

.sidebar__nav-item--active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.sidebar__quick-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  text-decoration: none;
}

.sidebar__quick-link:hover {
  background: var(--accent-bg);
  color: var(--text);
}

.sidebar__quick-link--active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: var(--fw-semibold);
}

/* Divider */
.sidebar__divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-sm) 0;
}

/* Footer */
.sidebar__footer {
  padding-top: var(--space-md);
  text-align: center;
}

/* Scrollable nav area */
.sidebar__scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* Fixed bottom area */
.sidebar__bottom {
  flex-shrink: 0;
  border-top: 1px solid var(--border-light);
  padding-top: var(--space-sm);
}

.sidebar__version {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

/* Sidebar progress bar */
.sidebar__progress {
  padding: var(--space-sm) 0;
}
.sidebar__progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.sidebar__progress-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
}
.sidebar__progress-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}
.sidebar__progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border-light);
  border-radius: 6px;
  overflow: hidden;
}
.sidebar__progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 6px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Badge inside sidebar link */
.sidebar__badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: var(--fw-semibold);
  line-height: 1;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 99;
  animation: fadeIn 0.2s var(--ease);
}

.sidebar-overlay--visible,
.sidebar-overlay.is-visible {
  display: block;
}

/* --------------------------------------------------------------------------
   6. Cards
   -------------------------------------------------------------------------- */
.card {
  background: #fafbfc;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px;
  transition: box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-title {
  font-size: 18px;
  font-weight: var(--fw-semibold);
  margin-bottom: var(--space-xs);
  color: var(--text);
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
}

.card-body {
  font-size: var(--fs-base);
  line-height: var(--lh-relaxed);
  color: var(--text-secondary);
}

.card-body p { margin-bottom: var(--space-sm); }
.card-body p:last-child { margin-bottom: 0; }
.card-body ul, .card-body ol { padding-left: var(--space-lg); margin-bottom: var(--space-sm); }
.card-body li { margin-bottom: var(--space-xs); list-style: disc; }
.card-body ol li { list-style: decimal; }

/* Platform-colored card variants (left border) */
.card--douyin {
  border-left: 3px solid #1a1a1a;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.card--xiaohongshu {
  border-left: 3px solid #fe2c55;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.card--wechat {
  border-left: 3px solid #07c160;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.card--general {
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

/* --------------------------------------------------------------------------
   7. Dashboard
   -------------------------------------------------------------------------- */
.dashboard {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
}

/* Welcome card */
.dashboard__welcome {
  margin-bottom: var(--space-xs);
}

.welcome-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  background: linear-gradient(135deg, var(--bg-inset) 0%, var(--bg) 100%);
  border-radius: var(--radius-2xl);
  padding: var(--space-xl) var(--space-2xl);
  border: 1px solid var(--border-light);
}

.welcome-card__text { flex: 1; }

.welcome-card__title {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-xs);
  color: var(--text);
}

.welcome-card__subtitle {
  font-size: var(--fs-base);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
}

.welcome-card__stats {
  display: flex;
  gap: var(--space-xl);
  flex-shrink: 0;
}

.stat-item {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.stat-item__num {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  color: var(--accent);
  letter-spacing: -0.02em;
}

.stat-item__label {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Section title */
.section-title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
  color: var(--text);
}

/* Module cards grid */
.dashboard__modules {
  display: flex;
  flex-direction: column;
}

.module-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-lg);
}

.module-card {
  background: var(--bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 0;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
  border: 1px solid var(--border-light);
  cursor: pointer;
  overflow: hidden;
  position: relative;
}

.module-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), #5ac8fa);
  z-index: 1;
}

.module-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.module-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-lg) var(--space-sm);
  padding-top: calc(var(--space-lg) + 4px);
}

.module-card__icon {
  font-size: var(--fs-xl);
  line-height: 1;
  flex-shrink: 0;
}

.module-card__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--text);
  letter-spacing: -0.01em;
}

.module-card__desc {
  flex: 1;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
  padding: 0 var(--space-lg);
}

.module-card__meta {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  padding: 0 var(--space-lg);
}

.module-card__progress {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg) var(--space-lg);
  margin-top: auto;
}

.module-card__progress .progress-bar {
  flex: 1;
}

.module-card__progress .progress-bar__text {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  font-weight: var(--fw-semibold);
  flex-shrink: 0;
}

/* Quick links */
.dashboard__quick {
  display: flex;
  flex-direction: column;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.quick-link-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-lg);
  background: var(--bg-inset);
  border-radius: var(--radius-xl);
  text-decoration: none;
  transition: all 0.3s var(--ease);
  border: 1px solid transparent;
}

.quick-link-card:hover {
  background: var(--bg);
  border-color: var(--border);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.quick-link-card__icon {
  font-size: var(--fs-2xl);
  line-height: 1;
}

.quick-link-card__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--text);
}

.quick-link-card__desc {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

/* Recent activity */
.dashboard__recent {
  display: flex;
  flex-direction: column;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.activity-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  transition: background 0.2s var(--ease);
}

.activity-item:hover {
  background: var(--bg-inset);
}

.activity-item__icon {
  font-size: var(--fs-lg);
  flex-shrink: 0;
}

.activity-item__content {
  flex: 1;
  min-width: 0;
}

.activity-item__desc {
  font-size: var(--fs-sm);
  color: var(--text);
  line-height: var(--lh-normal);
}

.activity-item__time {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

/* --------------------------------------------------------------------------
   8. Module Detail
   -------------------------------------------------------------------------- */
.module-detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.module-detail__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: var(--space-xl);
  background: var(--bg);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.module-detail__header-left {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.module-detail__icon {
  font-size: var(--fs-2xl);
  line-height: 1;
  flex-shrink: 0;
  padding-top: var(--space-xs);
}

.module-detail__title {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-xs);
}

.module-detail__desc {
  font-size: var(--fs-base);
  color: var(--text-secondary);
  max-width: 560px;
  line-height: var(--lh-relaxed);
}

.module-detail__header-right {
  display: flex;
  gap: var(--space-xl);
  flex-shrink: 0;
}

.module-detail__stat {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.module-detail__stat-num {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  color: var(--accent);
}

/* Overall progress section */
.module-detail__overall-progress {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-inset);
  border-radius: var(--radius-xl);
}

.module-detail__progress-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.module-detail__overall-progress .progress-bar {
  flex: 1;
}

.module-detail__overall-progress .progress-bar__text {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text);
  flex-shrink: 0;
}

/* Chapters section */
.module-detail__chapters {
  display: flex;
  flex-direction: column;
}

.chapter-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.chapter-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.25s var(--ease);
}

.chapter-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: scale(1.01);
}

.chapter-item__num {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-inset);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: var(--fw-bold);
  flex-shrink: 0;
  transition: all 0.25s var(--ease);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.chapter-item--completed .chapter-item__num {
  background: var(--success);
  color: #fff;
  box-shadow: 0 2px 8px rgba(48,177,88,0.3);
}

.chapter-item--in-progress .chapter-item__num {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,113,227,0.3);
}

.chapter-item--pending .chapter-item__num {
  background: var(--bg-inset);
  color: var(--text-tertiary);
}

.chapter-item__content {
  flex: 1;
  min-width: 0;
}

.chapter-item__title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--text);
  margin-bottom: 2px;
}

.chapter-item__desc {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.chapter-item__status {
  font-size: var(--fs-lg);
  flex-shrink: 0;
}

/* Quiz entry section */
.module-detail__quiz {
  display: flex;
  flex-direction: column;
}

.quiz-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: var(--space-lg);
  background: var(--bg);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.quiz-entry--locked {
  opacity: 0.7;
}

.quiz-entry__info h3 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--space-xs);
}

.quiz-entry__info p {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.quiz-entry__prev-score {
  margin-top: var(--space-xs);
  font-size: var(--fs-sm);
  color: var(--accent);
  font-weight: var(--fw-medium);
}

/* --------------------------------------------------------------------------
   9. Chapter Detail
   -------------------------------------------------------------------------- */
.chapter-detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  max-width: 900px;
}

.chapter-detail__header {
  padding-bottom: var(--space-lg);
  border-bottom: 2px solid var(--border-light);
}

.chapter-detail__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: var(--fw-bold);
  color: #fff;
  background: var(--accent);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-sm);
  letter-spacing: 0.04em;
}

.chapter-detail__title {
  font-size: 28px;
  font-weight: var(--fw-bold);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-sm);
  line-height: 1.2;
}

.chapter-detail__desc {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
}

.chapter-detail__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  font-size: var(--fs-base);
  line-height: var(--lh-relaxed);
  color: var(--text);
}

.chapter-detail__content p {
  margin-bottom: var(--space-sm);
}

.chapter-detail__content ul,
.chapter-detail__content ol {
  padding-left: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.chapter-detail__content li {
  margin-bottom: var(--space-xs);
  list-style: disc;
}

.chapter-detail__content ol li {
  list-style: decimal;
}

.chapter-detail__actions {
  display: flex;
  gap: var(--space-sm);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-light);
}

.chapter-detail__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-light);
}

.chapter-detail__nav span {
  flex: 1;
}

.chapter-detail__nav a {
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   10. Steps
   -------------------------------------------------------------------------- */
.steps {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

.step {
  text-align: center;
  flex: 1;
  min-width: 80px;
  position: relative;
}

/* Connecting line between steps */
.step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 22px;
  left: calc(50% + 22px);
  width: calc(100% - 44px);
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-bg) 100%);
  z-index: 0;
}

.step-num {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  position: relative;
  z-index: 1;
  margin-bottom: var(--space-sm);
  box-shadow: 0 2px 8px rgba(0,113,227,0.3);
}

.step--pending .step-num {
  background: var(--border);
  color: var(--text-tertiary);
  box-shadow: none;
}

.step-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text);
  margin-bottom: 2px;
  display: block;
}

.step--pending .step-label {
  color: var(--text-tertiary);
}

.step-desc {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

/* Vertical steps variant */
.steps--vertical {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.steps--vertical .step {
  display: flex;
  align-items: flex-start;
  text-align: left;
  gap: var(--space-sm);
  padding-bottom: var(--space-lg);
  flex: none;
  min-width: 0;
  width: 100%;
}

.steps--vertical .step-num {
  margin-bottom: 0;
  flex-shrink: 0;
}

.steps--vertical .step:not(:last-child)::after {
  top: 44px;
  left: 21px;
  width: 3px;
  height: calc(100% - 44px);
  background: linear-gradient(180deg, var(--accent) 0%, var(--border-light) 100%);
}

/* --------------------------------------------------------------------------
   11. Tables
   -------------------------------------------------------------------------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-base);
}

.data-table thead th {
  background: linear-gradient(180deg, #1d1d1f 0%, #2d2d2f 100%);
  color: #fff;
  padding: 14px 16px;
  text-align: left;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.data-table thead th:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.data-table thead th:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.data-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tbody tr:nth-child(even) td {
  background: rgba(0,0,0,0.015);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover td {
  background: var(--accent-bg);
}

.data-table tbody tr {
  transition: background 0.15s var(--ease);
}

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   12. Highlight Box
   -------------------------------------------------------------------------- */
.highlight-box {
  background: linear-gradient(135deg, var(--accent-bg) 0%, rgba(0,113,227,0.02) 100%);
  border-left: 4px solid var(--accent);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
  color: var(--text);
  line-height: var(--lh-relaxed);
}

.highlight-box__body {
  color: inherit;
}

.highlight-box strong,
.highlight-box b {
  color: var(--accent);
}

/* Success / warning / danger variants */
.highlight-box--success {
  background: linear-gradient(135deg, var(--success-bg) 0%, rgba(48,177,88,0.02) 100%);
  border-left-color: var(--success);
}

.highlight-box--warning {
  background: linear-gradient(135deg, var(--warning-bg) 0%, rgba(255,159,10,0.02) 100%);
  border-left-color: var(--warning);
}

.highlight-box--danger {
  background: linear-gradient(135deg, var(--danger-bg) 0%, rgba(255,59,48,0.02) 100%);
  border-left-color: var(--danger);
}

/* --------------------------------------------------------------------------
   13. Tags
   -------------------------------------------------------------------------- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.6;
  white-space: nowrap;
  background: var(--bg-inset);
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin: var(--space-md) 0;
}

/* Platform color tag variants */
.tag--primary {
  background: var(--accent-bg);
  color: var(--accent);
}

.tag--douyin {
  background: #f0f0f0;
  color: #1a1a1a;
}

.tag--xiaohongshu {
  background: #fff0f3;
  color: #fe2c55;
}

.tag--wechat {
  background: #e8f8ef;
  color: #07c160;
}

.tag--success {
  background: var(--success-bg);
  color: var(--success);
}

.tag--warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.tag--danger {
  background: var(--danger-bg);
  color: var(--danger);
}

/* --------------------------------------------------------------------------
   14. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  border: 1px solid transparent;
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
  user-select: none;
  color: var(--text);
  background: var(--bg-inset);
}

.btn:hover {
  opacity: 0.85;
}

.btn:active {
  transform: scale(0.97);
}

/* Primary */
.btn--primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn--primary:hover {
  background: #0056c7;
  border-color: #0056c7;
  opacity: 1;
  box-shadow: 0 2px 8px rgba(0,113,227,0.3);
}

/* Outline */
.btn--outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn--outline:hover {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
  opacity: 1;
}

/* Danger */
.btn--danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn--danger:hover {
  background: #e0352b;
  border-color: #e0352b;
  opacity: 1;
}

/* Ghost */
.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn--ghost:hover {
  background: var(--bg-inset);
  color: var(--text);
  opacity: 1;
}

/* Success */
.btn--success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

.btn--success:hover {
  opacity: 0.9;
}

/* Text-only */
.btn--text {
  background: transparent;
  color: var(--accent);
  border-color: transparent;
  padding: 6px 12px;
}

.btn--text:hover {
  background: var(--accent-bg);
  opacity: 1;
}

/* Sizes */
.btn--sm {
  padding: 5px 12px;
  font-size: var(--fs-sm);
  border-radius: var(--radius-sm);
}

.btn--lg {
  padding: 12px 28px;
  font-size: var(--fs-md);
  border-radius: var(--radius-lg);
}

.btn--xl {
  padding: 14px 36px;
  font-size: var(--fs-lg);
  border-radius: var(--radius-lg);
}

/* Block / full-width */
.btn--block {
  width: 100%;
}

/* Icon button (circular) */
.btn--icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-full);
}

.btn--icon.btn--sm {
  width: 28px;
  height: 28px;
}

.btn--icon.btn--lg {
  width: 44px;
  height: 44px;
}

/* Completed state */
.btn--completed {
  cursor: default;
  opacity: 1;
}

.btn--completed:active {
  transform: none;
}

/* Disabled */
.btn:disabled,
.btn[disabled],
.btn--disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

/* Button group */
.btn-group {
  display: inline-flex;
  gap: var(--space-xs);
}

/* --------------------------------------------------------------------------
   15. Badges
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: var(--fw-semibold);
  line-height: 1;
  color: #fff;
  background: var(--accent);
  white-space: nowrap;
}

.badge--success {
  background: var(--success);
}

.badge--warning {
  background: var(--warning);
  color: #1d1d1f;
}

.badge--danger {
  background: var(--danger);
}

/* Outline badge */
.badge--outline {
  background: transparent;
  color: var(--accent);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.badge--outline.badge--success {
  color: var(--success);
  box-shadow: inset 0 0 0 1.5px var(--success);
}

.badge--outline.badge--warning {
  color: var(--warning);
  box-shadow: inset 0 0 0 1.5px var(--warning);
}

.badge--outline.badge--danger {
  color: var(--danger);
  box-shadow: inset 0 0 0 1.5px var(--danger);
}

/* --------------------------------------------------------------------------
   16. Progress Bar
   -------------------------------------------------------------------------- */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border-light);
  border-radius: 6px;
  overflow: hidden;
}

.progress-bar--large {
  height: 10px;
  border-radius: 10px;
}

.progress-bar__fill {
  height: 100%;
  background: var(--accent);
  border-radius: 6px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-bar__fill--success {
  background: var(--success);
}

.progress-bar__fill--warning {
  background: var(--warning);
}

.progress-bar__fill--danger {
  background: var(--danger);
}

.progress-bar__text {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text);
}

/* --------------------------------------------------------------------------
   17. Quiz
   -------------------------------------------------------------------------- */
.quiz-page {
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.quiz-page__header {
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-light);
}

.quiz-page__header h1 {
  font-size: var(--fs-2xl);
  margin-bottom: var(--space-xs);
}

.quiz-page__header p {
  font-size: var(--fs-base);
  color: var(--text-secondary);
}

.quiz-page__prev {
  margin-top: var(--space-xs);
  font-size: var(--fs-sm);
  color: var(--accent);
}

/* Quiz form */
.quiz-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.quiz-question {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
}

.quiz-question__header {
  margin-bottom: var(--space-md);
}

.quiz-question__num {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--accent);
  background: var(--accent-bg);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-sm);
}

.quiz-question__text {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--text);
  line-height: var(--lh-relaxed);
}

.quiz-question__options {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.quiz-question__explanation {
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-inset);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
}

/* Quiz option */
.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: 16px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.25s var(--ease);
  font-size: var(--fs-base);
  background: var(--bg);
  color: var(--text);
  user-select: none;
}

.quiz-option:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
  transform: translateX(2px);
}

.quiz-option input[type="radio"] {
  display: none;
}

/* Quiz option marker (A, B, C, D circle) */
.quiz-option__marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--text-tertiary);
  transition: all 0.25s var(--ease);
  margin-top: 1px;
}

.quiz-option__text {
  flex: 1;
  line-height: var(--lh-normal);
}

.quiz-option__result {
  flex-shrink: 0;
  font-size: var(--fs-base);
}

/* Correct / wrong states */
.quiz-option--correct {
  border-color: #2ecc71;
  background: linear-gradient(135deg, rgba(46,204,113,0.08) 0%, rgba(46,204,113,0.02) 100%);
  color: #27ae60;
  cursor: default;
  font-weight: var(--fw-semibold);
  box-shadow: 0 0 0 1px rgba(46,204,113,0.15);
}

.quiz-option--correct .quiz-option__marker {
  border-color: #2ecc71;
  background: #2ecc71;
  color: #fff;
  box-shadow: 0 2px 6px rgba(46,204,113,0.35);
}

.quiz-option--wrong {
  border-color: #e74c3c;
  background: linear-gradient(135deg, rgba(231,76,60,0.06) 0%, rgba(231,76,60,0.01) 100%);
  color: #c0392b;
  cursor: default;
  font-weight: var(--fw-semibold);
  box-shadow: 0 0 0 1px rgba(231,76,60,0.12);
}

.quiz-option--wrong .quiz-option__marker {
  border-color: #e74c3c;
  background: #e74c3c;
  color: #fff;
  box-shadow: 0 2px 6px rgba(231,76,60,0.35);
}

/* Quiz form actions */
.quiz-form__actions {
  display: flex;
  gap: var(--space-sm);
  padding-top: var(--space-md);
}

/* Quiz result */
.quiz-result {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  text-align: center;
}

.quiz-result__title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  margin-bottom: var(--space-md);
}

.quiz-result__title--pass {
  color: var(--success);
}

.quiz-result__title--fail {
  color: var(--danger);
}

.quiz-result__score {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
  color: var(--text);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-sm);
}

.quiz-result__message {
  font-size: var(--fs-base);
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.quiz-result__actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
}

/* --------------------------------------------------------------------------
   18. Stats Page
   -------------------------------------------------------------------------- */
.stats-page {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.stats-page__header {
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-light);
}

.stats-page__header h1 {
  font-size: var(--fs-2xl);
  margin-bottom: var(--space-xs);
}

.stats-page__header p {
  font-size: var(--fs-base);
  color: var(--text-secondary);
}

/* Stats overview grid */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

.stat-card {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  transition: box-shadow 0.3s var(--ease);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
}

.stat-card__num {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  color: var(--accent);
  letter-spacing: -0.02em;
}

.stat-card__label {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

/* Stats section */
.stats-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.stats-modules {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* Stats module row */
.stats-module-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
}

.stats-module-row__info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 200px;
  flex-shrink: 0;
}

.stats-module-row__icon {
  font-size: var(--fs-lg);
  flex-shrink: 0;
}

.stats-module-row__name {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats-module-row__count {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.stats-module-row .progress-bar {
  flex: 1;
}

.stats-module-row .progress-bar__text {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text);
  flex-shrink: 0;
  min-width: 36px;
  text-align: right;
}

.stats-module-row .badge {
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   19. Cases Page
   -------------------------------------------------------------------------- */
.cases-page {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.cases-page__header {
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-light);
}

.cases-page__header h1 {
  font-size: var(--fs-2xl);
  margin-bottom: var(--space-xs);
}

.cases-page__header p {
  font-size: var(--fs-base);
  color: var(--text-secondary);
}

.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-lg);
}

.case-card {
  background: var(--bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  transition: box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
  border: 1px solid var(--border-light);
  cursor: pointer;
}

.case-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.case-card__header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.case-card__icon {
  font-size: var(--fs-2xl);
  line-height: 1;
  flex-shrink: 0;
}

.case-card__header h3 {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  margin-bottom: 2px;
}

.case-card__header p {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
}

.case-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-light);
}

.case-card__count {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

.case-card__arrow {
  font-size: var(--fs-base);
  color: var(--text-tertiary);
  transition: color 0.2s var(--ease), transform 0.2s var(--ease);
}

.case-card:hover .case-card__arrow {
  color: var(--accent);
  transform: translateX(2px);
}

.cases-page__placeholder {
  margin-top: var(--space-xs);
}

/* --------------------------------------------------------------------------
   20. Search Results
   -------------------------------------------------------------------------- */
.search-results {
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.search-results h1 {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.03em;
}

.search-results h1 em {
  color: var(--accent);
  font-style: normal;
}

.search-results p {
  font-size: var(--fs-base);
  color: var(--text-secondary);
}

.search-results__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: all 0.2s var(--ease);
}

.search-result-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.search-result-item__type {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--accent);
  background: var(--accent-bg);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.search-result-item__title {
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  color: var(--text);
  flex: 1;
}

.search-result-item__arrow {
  font-size: var(--fs-base);
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: color 0.2s var(--ease), transform 0.2s var(--ease);
}

.search-result-item:hover .search-result-item__arrow {
  color: var(--accent);
  transform: translateX(2px);
}

/* --------------------------------------------------------------------------
   21. Modal
   -------------------------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-lg);
  animation: fadeIn 0.2s var(--ease);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal__backdrop {
  position: absolute;
  inset: 0;
}

.modal__dialog {
  background: var(--bg);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  max-width: 440px;
  width: 100%;
  padding: var(--space-xl);
  animation: fadeInUp 0.35s var(--ease);
  position: relative;
  z-index: 1;
}

.modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  background: var(--bg-inset);
  border: none;
  line-height: 1;
}

.modal__close:hover {
  background: var(--border);
  color: var(--text);
}

/* --------------------------------------------------------------------------
   22. Forms
   -------------------------------------------------------------------------- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.auth-form__offline {
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-sm);
}

.auth-form__offline a {
  color: var(--text-secondary);
  text-decoration: underline;
}

.auth-form__offline a:hover {
  color: var(--accent);
}

.auth-form__switch {
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
}

.auth-form__switch a {
  font-weight: var(--fw-medium);
}

/* Auth tabs */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-light);
}

.auth-tabs__tab {
  flex: 1;
  text-align: center;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  margin-bottom: -1px;
}

.auth-tabs__tab:hover {
  color: var(--text);
}

.auth-tabs__tab--active,
.auth-tabs__tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: var(--fw-semibold);
}

/* Form groups and inputs */
.form__group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-sm);
}

.form__label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text);
}

.form__input {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  outline: none;
  line-height: 1.4;
}

.form__input::placeholder {
  color: var(--text-tertiary);
}

.form__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

select.form__input {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236e6e73' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

textarea.form__input {
  resize: vertical;
  min-height: 80px;
}

/* --------------------------------------------------------------------------
   23. Toast Notifications
   -------------------------------------------------------------------------- */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  color: var(--text);
  max-width: 380px;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  border: 1px solid var(--border-light);
}

.toast--visible {
  opacity: 1;
  transform: translateY(0);
}

.toast--success {
  border-left: 3px solid var(--success);
}

.toast--error {
  border-left: 3px solid var(--danger);
}

.toast--warning {
  border-left: 3px solid var(--warning);
}

.toast--info {
  border-left: 3px solid var(--accent);
}

.toast__icon {
  flex-shrink: 0;
  font-size: var(--fs-base);
}

.toast__message {
  flex: 1;
  line-height: var(--lh-normal);
}

/* --------------------------------------------------------------------------
   24. Empty State
   -------------------------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
}

.empty-state p {
  font-size: var(--fs-base);
  color: var(--text-tertiary);
  margin-bottom: var(--space-md);
}

.empty-state .btn {
  margin-top: var(--space-sm);
}

/* --------------------------------------------------------------------------
   25. Loading / Spinner / Skeleton
   -------------------------------------------------------------------------- */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner--sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

.spinner--lg {
  width: 44px;
  height: 44px;
  border-width: 4px;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
}

.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--bg-inset) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton--text {
  height: 14px;
  margin-bottom: var(--space-sm);
  width: 100%;
}

.skeleton--title {
  height: 22px;
  width: 60%;
  margin-bottom: var(--space-md);
}

.skeleton--avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
}

.skeleton--card {
  height: 160px;
  width: 100%;
}

/* --------------------------------------------------------------------------
   26. Utility Classes
   -------------------------------------------------------------------------- */

/* Typography */
.text-xs        { font-size: var(--fs-xs); }
.text-sm        { font-size: var(--fs-sm); }
.text-base      { font-size: var(--fs-base); }
.text-md        { font-size: var(--fs-md); }
.text-lg        { font-size: var(--fs-lg); }
.text-xl        { font-size: var(--fs-xl); }
.text-2xl       { font-size: var(--fs-2xl); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary  { color: var(--text-tertiary); }
.text-accent    { color: var(--accent); }
.text-success   { color: var(--success); }
.text-warning   { color: var(--warning); }
.text-danger    { color: var(--danger); }
.text-center    { text-align: center; }
.text-left      { text-align: left; }
.text-right     { text-align: right; }
.font-normal    { font-weight: var(--fw-normal); }
.font-medium    { font-weight: var(--fw-medium); }
.font-semibold  { font-weight: var(--fw-semibold); }
.font-bold      { font-weight: var(--fw-bold); }

/* Margin */
.mt-0   { margin-top: 0; }
.mt-xs  { margin-top: var(--space-xs); }
.mt-sm  { margin-top: var(--space-sm); }
.mt-md  { margin-top: var(--space-md); }
.mt-lg  { margin-top: var(--space-lg); }
.mt-xl  { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mb-0   { margin-bottom: 0; }
.mb-xs  { margin-bottom: var(--space-xs); }
.mb-sm  { margin-bottom: var(--space-sm); }
.mb-md  { margin-bottom: var(--space-md); }
.mb-lg  { margin-bottom: var(--space-lg); }
.mb-xl  { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }
.mx-auto { margin-left: auto; margin-right: auto; }

/* Padding */
.p-sm   { padding: var(--space-sm); }
.p-md   { padding: var(--space-md); }
.p-lg   { padding: var(--space-lg); }
.p-xl   { padding: var(--space-xl); }

/* Flex */
.flex            { display: flex; }
.flex-col        { display: flex; flex-direction: column; }
.flex-wrap       { flex-wrap: wrap; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.flex-1          { flex: 1; }
.gap-xs          { gap: var(--space-xs); }
.gap-sm          { gap: var(--space-sm); }
.gap-md          { gap: var(--space-md); }
.gap-lg          { gap: var(--space-lg); }

/* Grid (used for grid-2, grid-3, grid-4) */
.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid--2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
}

.grid--3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.grid--4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
}

/* Compatibility: grid-2, grid-3, grid-4 classes */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
}

/* Visibility */
.hidden   { display: none !important; }
.block    { display: block; }
.inline   { display: inline; }
.inline-flex { display: inline-flex; }
.relative { position: relative; }

/* Width */
.w-full { width: 100%; }
.w-auto { width: auto; }

/* Radius */
.rounded-sm    { border-radius: var(--radius-sm); }
.rounded-md    { border-radius: var(--radius-md); }
.rounded-lg    { border-radius: var(--radius-lg); }
.rounded-xl    { border-radius: var(--radius-xl); }
.rounded-full  { border-radius: var(--radius-full); }

/* Shadows */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }

/* Backgrounds */
.bg-white { background: var(--bg); }
.bg-page  { background: var(--bg-inset); }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* --------------------------------------------------------------------------
   27. Admin Panel
   -------------------------------------------------------------------------- */

/* Admin page header */
.admin__header, .admin-page__header {
  padding: var(--space-lg) 0 var(--space-md);
}
.admin__header h1, .admin-page__header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-xs);
}
.admin__header p, .admin-page__header p {
  font-size: 15px;
  color: var(--text-secondary);
}

/* Admin toolbar */
.admin__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

/* Admin table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.admin-table thead {
  background: var(--text);
}
.admin-table thead th {
  color: #fff;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.admin-table thead th:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.admin-table thead th:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.admin-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  vertical-align: middle;
}
.admin-table tbody tr:last-child td {
  border-bottom: none;
}
.admin-table tbody tr:hover td {
  background: var(--bg-inset);
}

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}
.status-badge--active {
  background: rgba(48,177,88,0.1);
  color: var(--success);
}
.status-badge--disabled {
  background: rgba(255,59,48,0.1);
  color: var(--danger);
}

/* Admin user detail */
.admin-user-detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}
.admin-user-card {
  padding: var(--space-lg);
  border-radius: var(--radius-xl);
  background: var(--bg-inset);
  display: flex;
  gap: var(--space-xl);
  align-items: flex-start;
  flex-wrap: wrap;
}
.admin-user-card__avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  flex-shrink: 0;
}
.admin-user-card__info {
  flex: 1;
  min-width: 200px;
}
.admin-user-card__name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}
.admin-user-card__meta {
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-top: var(--space-sm);
}

/* Admin form */
.admin-form {
  max-width: 520px;
}
.admin-form .field {
  margin-bottom: var(--space-md);
}
.admin-form .field__label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}
.admin-form .field__input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.2s var(--ease);
}
.admin-form .field__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.admin-form .field__actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

/* Sidebar section title */
.sidebar__section-title {
  padding: var(--space-xs) var(--space-xs);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Progress mini (compact bar for table cells) */
.progress-mini {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}
.progress-mini__bar {
  width: 80px;
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}
.progress-mini__fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s var(--ease);
}
.progress-mini__text {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* Action button group in tables */
.action-btns {
  display: flex;
  gap: 4px;
}
.action-btns .btn--sm {
  padding: 3px 10px;
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   28. Animations (@keyframes)
   -------------------------------------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

/* Animation utility classes */
.animate-fade-in       { animation: fadeIn 0.4s var(--ease) both; }
.animate-fade-in-up    { animation: fadeInUp 0.5s var(--ease) both; }
.animate-fade-in-down  { animation: fadeInDown 0.4s var(--ease) both; }
.animate-slide-in-left { animation: slideInLeft 0.4s var(--ease) both; }
.animate-slide-in-right{ animation: slideInRight 0.4s var(--ease) both; }

/* Animation delays */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* --------------------------------------------------------------------------
   28. Dark Mode ([data-theme="dark"])
   -------------------------------------------------------------------------- */
[data-theme="dark"] {
  --bg: #1c1c1e;
  --bg-inset: #2c2c2e;
  --text: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-tertiary: #636366;
  --primary: #0a84ff;
  --primary-hover: #409cff;
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --accent-bg: rgba(10, 132, 255, 0.15);
  --success: #30d158;
  --success-bg: rgba(48, 209, 88, 0.12);
  --warning: #ff9f0a;
  --warning-bg: rgba(255, 159, 10, 0.12);
  --danger: #ff453a;
  --danger-bg: rgba(255, 69, 58, 0.12);
  --border: #38383a;
  --border-light: #2c2c2e;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2), 0 1px 6px -1px rgba(0,0,0,0.3);
  --shadow-md: 0 2px 8px -2px rgba(0,0,0,0.3), 0 4px 16px -2px rgba(0,0,0,0.4);
  --shadow-lg: 0 4px 16px -4px rgba(0,0,0,0.4), 0 8px 32px -4px rgba(0,0,0,0.5);
  --shadow-xl: 0 8px 32px -6px rgba(0,0,0,0.5), 0 16px 64px -8px rgba(0,0,0,0.6);
}

[data-theme="dark"] .topbar {
  background: rgba(28, 28, 30, 0.8);
}

[data-theme="dark"] .modal {
  background: rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .welcome-card {
  background: linear-gradient(135deg, var(--bg-inset) 0%, var(--bg) 100%);
}

[data-theme="dark"] .card {
  background: var(--bg-inset);
}

[data-theme="dark"] .data-table thead th {
  background: linear-gradient(180deg, #2c2c2e 0%, #3a3a3c 100%);
  color: #f5f5f7;
}

[data-theme="dark"] .data-table tbody tr:nth-child(even) td {
  background: rgba(255,255,255,0.02);
}

[data-theme="dark"] .data-table tbody tr:hover td {
  background: var(--accent-bg);
}

[data-theme="dark"] .data-table tbody td:first-child {
  background: var(--bg);
}

[data-theme="dark"] .data-table tbody tr:nth-child(even) td:first-child {
  background: rgba(255,255,255,0.02);
}

[data-theme="dark"] .data-table thead th:first-child {
  background: linear-gradient(180deg, #2c2c2e 0%, #3a3a3c 100%);
}

[data-theme="dark"] .highlight-box {
  background: linear-gradient(135deg, var(--accent-bg) 0%, rgba(10,132,255,0.02) 100%);
}

[data-theme="dark"] .highlight-box--success {
  background: linear-gradient(135deg, var(--success-bg) 0%, rgba(48,209,88,0.02) 100%);
}

[data-theme="dark"] .highlight-box--warning {
  background: linear-gradient(135deg, var(--warning-bg) 0%, rgba(255,159,10,0.02) 100%);
}

[data-theme="dark"] .highlight-box--danger {
  background: linear-gradient(135deg, var(--danger-bg) 0%, rgba(255,69,58,0.02) 100%);
}

[data-theme="dark"] .quiz-option--correct {
  border-color: #2ecc71;
  background: linear-gradient(135deg, rgba(46,204,113,0.12) 0%, rgba(46,204,113,0.03) 100%);
  color: #2ecc71;
}

[data-theme="dark"] .quiz-option--wrong {
  border-color: #e74c3c;
  background: linear-gradient(135deg, rgba(231,76,60,0.1) 0%, rgba(231,76,60,0.02) 100%);
  color: #e74c3c;
}

[data-theme="dark"] .badge--warning {
  color: #1d1d1f;
}

[data-theme="dark"] .tag--douyin {
  background: #3a3a3a;
  color: #d0d0d0;
}

[data-theme="dark"] .admin-table thead {
  background: var(--bg-inset);
}
[data-theme="dark"] .admin-table thead th {
  color: var(--text);
}

/* --------------------------------------------------------------------------
   30. Responsive Design
   -------------------------------------------------------------------------- */

/* Tablet (<=768px) */
@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s var(--ease);
    box-shadow: var(--shadow-lg);
    z-index: 200;
  }

  #sidebar.sidebar--open,
  #sidebar.is-open,
  .sidebar--open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 150;
  }

  .sidebar-overlay.is-visible,
  .sidebar-overlay--visible {
    display: block;
  }

  #main-content {
    margin-left: 0;
    padding: var(--space-md);
    max-width: 100%;
  }

  /* Grids: --3 becomes 2-col, --4 becomes 2-col, --2 stays 2-col */
  .grid--3,
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid--4,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid--2,
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-overview {
    grid-template-columns: repeat(2, 1fr);
  }

  .module-cards {
    grid-template-columns: 1fr;
  }

  .cases-grid {
    grid-template-columns: 1fr;
  }

  .quick-links {
    grid-template-columns: 1fr;
  }

  .welcome-card {
    flex-direction: column;
    text-align: center;
    padding: var(--space-lg);
  }

  .welcome-card__stats {
    gap: var(--space-lg);
  }

  .module-detail__header {
    flex-direction: column;
  }

  .module-detail__header-right {
    width: 100%;
    justify-content: space-around;
  }

  .chapter-detail {
    max-width: 100%;
  }

  .chapter-detail__title {
    font-size: 24px;
  }

  .quiz-page {
    max-width: 100%;
  }

  .steps {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .step {
    text-align: left;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: none;
    min-width: 0;
    width: 100%;
  }

  .step:not(:last-child)::after {
    display: none;
  }

  .step-num {
    margin-bottom: 0;
  }

  /* Sticky first column on data tables */
  .data-table th:first-child,
  .data-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: inherit;
  }

  .data-table thead th:first-child {
    z-index: 3;
    background: linear-gradient(180deg, #1d1d1f 0%, #2d2d2f 100%);
  }

  .data-table tbody td:first-child {
    background: var(--bg);
  }

  .data-table tbody tr:nth-child(even) td:first-child {
    background: rgba(0,0,0,0.015);
  }

  .stats-module-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-md);
  }

  .stats-module-row__info {
    width: 100%;
    min-width: 0;
  }

  .stats-module-row .progress-bar {
    width: 100%;
  }

  .topbar__search {
    max-width: 200px;
  }

  .admin-table {
    font-size: 12px;
  }
  .admin-table thead th,
  .admin-table tbody td {
    padding: 8px 10px;
  }

  /* Card padding reduction on tablet */
  .card {
    padding: var(--space-lg);
    border-radius: var(--radius-md);
  }
}

/* Phone (<=480px) */
@media (max-width: 480px) {
  h1 { font-size: var(--fs-xl); }
  h2 { font-size: var(--fs-lg); }
  h3 { font-size: var(--fs-md); }
  h4 { font-size: var(--fs-base); }

  #main-content {
    padding: var(--space-sm);
  }

  /* All grids become 1 column */
  .grid--2, .grid--3, .grid--4,
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .card {
    padding: var(--space-md);
    border-radius: var(--radius-md);
  }

  .welcome-card {
    padding: var(--space-md);
  }

  .welcome-card__title {
    font-size: var(--fs-xl);
  }

  .welcome-card__stats {
    gap: var(--space-md);
  }

  .stat-item__num {
    font-size: var(--fs-xl);
  }

  .stats-overview {
    grid-template-columns: 1fr 1fr;
  }

  .module-detail__header {
    padding: var(--space-md);
  }

  .module-detail__title {
    font-size: var(--fs-xl);
  }

  .chapter-detail__title {
    font-size: var(--fs-xl);
  }

  .chapter-detail__num {
    padding: 3px 10px;
    font-size: 11px;
  }

  .chapter-detail__desc {
    font-size: var(--fs-base);
  }

  .chapter-detail__nav {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .chapter-detail__nav span {
    display: none;
  }

  .btn--lg {
    padding: 10px 20px;
    font-size: var(--fs-base);
  }

  .topbar__search {
    display: none;
  }

  .toast {
    max-width: 100%;
    left: var(--space-sm);
    right: var(--space-sm);
  }

  .modal__dialog {
    padding: var(--space-lg);
    margin: var(--space-md);
    border-radius: var(--radius-xl);
  }

  .table-wrapper {
    margin: 0 calc(-1 * var(--space-sm));
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  /* Sticky first column on phone tables */
  .data-table th:first-child,
  .data-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
  }

  .data-table thead th:first-child {
    z-index: 3;
  }

  .data-table tbody td:first-child {
    background: var(--bg);
  }

  .data-table tbody tr:nth-child(even) td:first-child {
    background: rgba(0,0,0,0.015);
  }

  .quiz-option {
    padding: 14px 16px;
    font-size: var(--fs-sm);
  }

  .quiz-option__marker {
    width: 24px;
    height: 24px;
  }

  .quiz-form__actions {
    flex-direction: column;
  }

  .quiz-form__actions .btn {
    width: 100%;
  }

  /* Module card padding reduction */
  .module-card__header {
    padding: var(--space-md) var(--space-md) var(--space-xs);
    padding-top: calc(var(--space-md) + 4px);
  }

  .module-card__desc,
  .module-card__meta {
    padding: 0 var(--space-md);
  }

  .module-card__progress {
    padding: var(--space-sm) var(--space-md) var(--space-md);
  }
}

/* --------------------------------------------------------------------------
   30. Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01s !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   31. Print Styles
   -------------------------------------------------------------------------- */
@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 13px;
  }

  #sidebar,
  .topbar,
  .modal,
  .toast,
  .no-print {
    display: none !important;
  }

  #main {
    margin-left: 0 !important;
    overflow: visible;
  }

  #main-content {
    padding: 0;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  .data-table thead th {
    background: #ddd;
    color: #000;
  }
}

/* ==========================================================================
   END OF FILE
   ========================================================================== */
