/* ============================================================
   WB 教务管理系统 — 共享样式表 (Shared Stylesheet)
   适用范围: 全局 CSS 变量、Reset、排版、按钮、表单、表格、
            卡片、弹窗、标签页、徽章、状态模式、Toast、工具类
   ============================================================ */

/* ── 跨平台字体渲染优化（Mac/Windows 一致性） ────────────── */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "liga" 1;
}
/* Windows：次像素渲染 + 补偿渲染差异 */
.os-windows {
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: unset;
}
.os-windows .card,
.os-windows input,
.os-windows select,
.os-windows button,
.os-windows textarea {
  font-family: 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
}

/* ── 1. CSS 变量 ─────────────────────────────────────────── */
:root {
  /* 主色 — 明亮蓝紫 */
  --primary:              #5b6af0;
  --primary-dark:         #4756d8;
  --primary-light:        #eeefff;
  --primary-bg:           #f5f5ff;
  --success:              #10b981;
  --success-light:        #d1fae5;
  --success-bg:           #d1fae5;
  --danger:               #ef4444;
  --danger-light:         #fee2e2;
  --danger-bg:            #fee2e2;
  --warning:              #f59e0b;
  --warning-light:        #fef3c7;
  --warn:                 #d97706;
  --warn-bg:              #fef3c7;
  --color-primary:        #5b6af0;
  --color-primary-dark:   #4756d8;
  --color-primary-light:  #eeefff;
  --color-primary-bg:     #f5f5ff;

  /* 功能色 */
  --color-success:        #10b981;
  --color-success-light:  #d1fae5;
  --color-warning:        #f59e0b;
  --color-warning-light:  #fef3c7;
  --color-danger:         #ef4444;
  --color-danger-light:   #fee2e2;
  --color-info:           #06b6d4;
  --color-info-light:     #cffafe;

  /* 中性色 */
  --gray-50:  #f8f8f7;  --gray-100: #f0f0ee;
  --gray-200: #e5e4e1;  --gray-300: #d3d2ce;
  --gray-400: #a09e99;  --gray-500: #787672;
  --gray-600: #5c5a56;  --gray-700: #3e3d3a;
  --gray-800: #1f1e1b;  --gray-900: #0f0e0c;

  /* 语义映射 */
  --text-primary:    #1f1e1b;
  --text-secondary:  #5c5a56;
  --text-muted:      var(--gray-400);
  --text-placeholder:#a09e99;
  --bg-page:         #f5f4f1;
  --bg-card:         #ffffff;
  --bg-table-header: var(--gray-50);
  --border-color:    #e5e4e1;
  --border-light:    #eeedeb;

  /* 侧栏 */
  --sidebar-bg:      #fff;
  --sidebar-hover:   var(--color-primary-light);
  --sidebar-active:  var(--color-primary);
  --sidebar-text:    #666;
  --sidebar-text-active: var(--color-primary);

  /* 圆角 */
  --radius-sm:  8px;
  --radius:     12px;
  --radius-lg:  16px;
  --radius-xl:  20px;

  /* 阴影 */
  --shadow-sm: 0 1px 4px rgba(0,0,0,.06);
  --shadow:    0 2px 12px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);

  /* 间距 */
  --space-xs: 4px;   --space-sm: 8px;   --space-md: 12px;
  --space:    16px;  --space-lg: 20px;  --space-xl: 24px;
  --space-2xl:32px;

  /* 字体 */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Consolas', 'Menlo', monospace;
  --text-xs: 12px;  --text-sm: 13px;  --text-base: 14px;
  --text-lg: 16px;  --text-xl: 18px;  --text-2xl: 20px;
  --text-3xl: 24px; --text-4xl: 28px;

  /* 表格 */
  --table-stripe:        transparent;
  --table-hover:         var(--color-primary-bg);
  --table-header-bg:     var(--gray-100);
  --table-border:        var(--border-color);
  --table-radius:        var(--radius);

  /* 过渡 */
  --transition-fast: .15s ease;
  --transition:      .2s ease;
  --transition-slow: .3s ease;
}
/* ── 深色模式 ─────────────────────────────────────────── */
[data-theme="dark"] {
  --color-primary:        #4096ff;
  --color-primary-dark:   #60A5FA;
  --color-primary-light:  #1a3555;
  --color-primary-bg:     #162b4a;

  --color-success:        #22C55E;
  --color-success-light:  #14532D;
  --color-warning:        #FBBF24;
  --color-warning-light:  #451A03;
  --color-danger:         #EF4444;
  --color-danger-light:   #450A0A;
  --color-info:           #38BDF8;
  --color-info-light:     #0C2D48;

  --gray-50:  #1F2937;  --gray-100: #374151;
  --gray-200: #4B5563;  --gray-300: #6B7280;
  --gray-400: #9CA3AF;  --gray-500: #D1D5DB;
  --gray-600: #E5E7EB;  --gray-700: #F3F4F6;
  --gray-800: #F9FAFB;  --gray-900: #FFFFFF;

  --text-primary:    #e5e7eb;
  --text-secondary:  #9ca3af;
  --text-muted:      var(--gray-400);
  --bg-page:         #0F172A;
  --bg-card:         #1E293B;
  --bg-table-header: var(--gray-100);
  --border-color:    #2d3748;
  --border-light:    #1e293b;

  --sidebar-bg:      #0f172a;
  --sidebar-hover:   #1e293b;
  --sidebar-text:    #9ca3af;
  --sidebar-text-active: var(--color-primary);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.4);
  --shadow:    0 2px 12px rgba(0,0,0,.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,.45);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.5);

  color-scheme: dark;
}

/* dark 模式下的特殊覆盖 */
[data-theme="dark"] .card { background: var(--bg-card); border: 1px solid var(--border-color); }
[data-theme="dark"] table { color: var(--text-primary); }
[data-theme="dark"] th { background: var(--gray-100); }
[data-theme="dark"] .upload-zone, [data-theme="dark"] .drop-zone { background: var(--gray-100); }
[data-theme="dark"] .welcome-banner { background: #1E3A5F; }
[data-theme="dark"] .todo-banner { background: #451A03; border-color: #78350F; }
[data-theme="dark"] .todo-title { color: #FBBF24; }
[data-theme="dark"] .todo-items { color: #FCD34D; }
[data-theme="dark"] .empty-state { color: var(--text-muted); }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea {
  background: var(--gray-100); color: var(--text-primary); border-color: var(--gray-200);
}

/* 骨架屏 dark */
[data-theme="dark"] .skeleton { background: linear-gradient(90deg, var(--gray-100) 0%, var(--gray-200) 50%, var(--gray-100) 100%); }


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

body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: var(--text-base);
  line-height: 1.6;
}
.os-windows body {
  font-size: 14.5px;
  line-height: 1.65;
}

/* ── 3. Typography ──────────────────────────────────────── */
h1, h2, h3, h4 {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }

p {
  color: var(--text-secondary);
  line-height: 1.6;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

/* ── 4. Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: var(--gray-100);
  color: var(--text-primary);
  cursor: pointer;
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn:hover {
  background: var(--gray-200);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
}

.btn-success {
  background: var(--color-success);
  color: #fff;
}

.btn-success:hover {
  background: #15803d;
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
}

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

.btn-ghost:hover {
  background: var(--gray-100);
}

.btn-sm {
  padding: 5px 10px;
  font-size: var(--text-xs);
}

.btn-lg {
  padding: 12px 24px;
  font-size: var(--text-base);
}

/* ── 5. Forms ───────────────────────────────────────────── */
.form-group {
  margin-bottom: var(--space);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--color-danger);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: var(--text-base);
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--transition-fast);
  background: #fff;
  color: var(--text-primary);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-input.error,
.form-select.error {
  border-color: var(--color-danger);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: var(--text-xs);
  color: var(--color-danger);
  margin-top: 4px;
}

/* ── 6. Data Tables ─────────────────────────────────────── */
.data-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: var(--text-sm);
  border: 1px solid var(--table-border);
  border-radius: var(--table-radius);
  overflow: hidden;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table th {
  background: var(--table-header-bg);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--table-border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.data-table th:hover {
  color: var(--color-primary);
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  transition: background .15s ease;
}

.data-table tbody tr:nth-child(even) { background: rgba(0,0,0,.015); }
.data-table tbody tr:hover { background: var(--table-hover); }

.data-table td.num {
  font-family: var(--font-mono);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* striping removed for cleaner look */

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

.data-table.dense th,
.data-table.dense td {
  padding: 6px 10px;
}

.data-table.comfortable th,
.data-table.comfortable td {
  padding: 14px 16px;
}

.table-wrap {
  overflow-x: auto;
}

/* ── 7. Cards ───────────────────────────────────────────── */
.card {
  background: linear-gradient(180deg, #fefefe 0%, var(--bg-card) 100%);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  padding: 20px;
  margin-bottom: 16px;
  transition: box-shadow .2s ease, transform .15s ease;
}
.card:hover { box-shadow: var(--shadow); }

.card-hover {
  cursor: pointer;
  transition: all var(--transition);
}

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

.card-flat {
  box-shadow: none;
  border: 1px solid var(--border-color);
}

.card-title {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

/* ── 8. Modals ──────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(2px);
}

.modal-overlay.show {
  display: flex;
}

/* 自动展开型弹窗：内容全部可见，超出视口时滚动外层遮罩 */
.modal-overlay.auto-scroll {
  align-items: flex-start;
  padding: 20px 0;
  overflow-y: auto;
}
.modal-overlay.auto-scroll .modal {
  max-height: none;
}

.modal-box,
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-box.sm,
.modal.sm  { width: 400px; }
.modal-box.md,
.modal.md  { width: 560px; }
.modal-box.lg,
.modal.lg  { width: 800px; }

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  font-size: var(--text-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close {
  cursor: pointer;
  font-size: 20px;
  color: var(--gray-400);
  padding: 4px;
  border: none;
  background: none;
  line-height: 1;
}

.modal-close:hover {
  color: var(--gray-600);
}

.modal-body {
  padding: 20px;
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* ── 9. Tabs ────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0 12px;
}

/* Pill-style tabs — 圆角胶囊式（统一tab样式） */
.pill-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid #e8e8e8;
  flex-shrink: 0;
}
.pill-tab {
  padding: 5px 16px;
  cursor: pointer;
  border: none;
  border-radius: 20px;
  background: var(--gray-100);
  color: var(--gray-600);
  font-weight: 500;
  font-size: 13px;
  transition: all .15s;
  user-select: none;
}
.pill-tab:hover {
  background: var(--gray-200);
}
.pill-tab.active {
  background: var(--color-primary);
  color: #fff;
  font-weight: 500;
}
.pill-tab.disabled {
  background: var(--gray-100);
  color: var(--gray-400);
  cursor: not-allowed;
  opacity: 0.55;
}
.pill-tab.disabled:hover {
  background: var(--gray-100);
}

/* ── 10. Badges ─────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: var(--text-xs);
  font-weight: 500;
}

.badge-success  { background: var(--color-success-light); color: var(--color-success); }
.badge-warning  { background: var(--color-warning-light); color: #92400e; }
.badge-danger   { background: var(--color-danger-light);  color: var(--color-danger); }
.badge-info     { background: var(--color-info-light);    color: #0369a1; }
.badge-primary  { background: var(--color-primary-light); color: var(--color-primary); }

/* ── 11. State Patterns ─────────────────────────────────── */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: var(--text-base);
}

.loading .spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-bottom: 8px;
}

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

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: var(--text-base);
}

.empty-state .icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: .5;
}

.error-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.error-state .icon {
  font-size: 40px;
  margin-bottom: 8px;
}

/* ── 13. Utility Classes ────────────────────────────────── */
.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: var(--text-sm); }
.text-xs      { font-size: var(--text-xs); }
.text-lg      { font-size: var(--text-lg); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.font-mono    { font-family: var(--font-mono); }
.font-bold    { font-weight: 600; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-sm); }
.mt-2 { margin-top: var(--space); }
.mt-3 { margin-top: var(--space-xl); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-sm); }
.mb-2 { margin-bottom: var(--space); }
.mb-3 { margin-bottom: var(--space-xl); }

.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm       { gap: var(--space-sm); }
.gap          { gap: var(--space); }
.gap-lg       { gap: var(--space-lg); }
.w-full       { width: 100%; }

/* ── 14. 表格排序 ─────────────────────────────────────── */
.data-table th.sortable { cursor: pointer; user-select: none; position: relative; padding-right: 24px; }
.data-table th.sortable:hover { color: var(--color-primary); }
.data-table th .sort-arrow {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--text-muted);
}
.data-table th.sorted-asc .sort-arrow::after { content: '▲'; color: var(--color-primary); }
.data-table th.sorted-desc .sort-arrow::after { content: '▼'; color: var(--color-primary); }
.data-table th.sortable .sort-arrow::after { content: '⇅'; }

/* ── 15. 骨架屏 ─────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 0%, var(--gray-200) 50%, var(--gray-100) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
  height: 16px;
}
.skeleton-text { width: 80%; margin-bottom: 8px; }
.skeleton-title { width: 40%; height: 20px; margin-bottom: 12px; }
.skeleton-avatar { width: 48px; height: 48px; border-radius: 50%; }
.skeleton-card { height: 120px; border-radius: 8px; }
@keyframes skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ── 16. loading spinner ───────────────────────────────── */
.spinner {
  width: 24px; height: 24px; border: 3px solid var(--gray-200);
  border-top-color: var(--color-primary); border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block; margin-right: 8px; vertical-align: middle;
}

/* ── 17. Responsive ─────────────────────────────────────── */
/* Tablet: 768-1279px */
@media (max-width: 1279px) {
  :root {
    --sidebar-width: 60px;
  }
  .stats-grid, .stats-row { grid-template-columns: repeat(2, 1fr); }
  .charts-row, .dashboard-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: repeat(2, 1fr); }
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: linear-gradient(to right, white 30%, rgba(255,255,255,0)),
                linear-gradient(to right, rgba(255,255,255,0), white 70%) 100% 0,
                radial-gradient(farthest-side at 0% 50%, rgba(0,0,0,.12), rgba(0,0,0,0)),
                radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.12), rgba(0,0,0,0)) 100% 0;
    background-repeat: no-repeat;
    background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
    background-attachment: local, local, scroll, scroll;
  }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* Mobile: < 768px */
@media (max-width: 767px) {
  :root { --sidebar-width: 0px; }
  .stats-grid, .stats-row { grid-template-columns: 1fr; }
  .charts-row { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .card { padding: 14px; }
  .card-title { font-size: 14px; }
  .btn { min-height: 44px; padding: 10px 16px; }
  .btn-sm { min-height: 36px; padding: 6px 12px; }
  .search-box { max-width: 100%; }
  .search-box input { min-width: 0; }
  table { font-size: 12px; }
  th, td { padding: 6px 8px; }
  .modal-box,
  .modal { width: 100vw; height: 100vh; max-width: none; border-radius: 0; margin: 0; }
  .inner-tab { padding: 12px 16px; }
  h1 { font-size: 18px; }
  h2 { font-size: 16px; }
  /* 表格横向滚动 */
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-responsive table { min-width: 600px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar select,
  .filter-bar input[type="text"] { width: 100%; }
  .btn-group { flex-wrap: wrap; }
  .page-header { flex-direction: column; gap: 8px; }
  .info-box { flex-direction: column; align-items: flex-start; gap: 8px; }
  /* 隐藏侧栏汉堡按钮 */
  .mobile-hamburger { display: flex !important; }
  /* pill-tabs 横向滚动 */
  .pill-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .pill-tab { flex-shrink: 0; padding: 5px 12px; font-size: 12px; }
  /* body padding 缩小（手机：左右留 6px，让管理后台 iframe 页面与工作台在窄屏下内容宽度一致、不显窄） */
  body { padding: 12px 6px !important; }
  /* 底部版权自动换行，防止溢出 */
  div[style*="text-align:center"] { overflow-wrap: break-word; word-break: break-word; box-sizing: border-box; }
  /* 手机端隐藏侧边栏 */
  .sidebar-nav { display: none !important; }
  /* 手机端顶部导航缩小内边距 */
  .top-header { padding: 0 12px !important; }
  /* 防止横向溢出 */
  html, body { overflow-x: hidden; width: 100% !important; max-width: 100% !important; }
  /* 确保 body 没有左侧间距（防止为侧边栏预留空间）；左右留 6px 与工作台一致，避免管理页在手机上显窄 */
  body { margin: 0 !important; padding: 12px 6px !important; }
  /* 确保所有表格容器都能横向滚动 */
  .table-wrap, .table-responsive, .schedule-table-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  /* 确保图片不会超出屏幕宽度 */
  img { max-width: 100% !important; height: auto !important; }
  /* 表格容器居中（仅桌面端保留） */
}

/* 平板: 768-1024px */
@media (min-width: 768px) and (max-width: 1024px) {
  :root { --sidebar-width: 180px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  th, td { padding: 8px 12px; }
  .table-responsive { overflow-x: auto; }
  .table-responsive table { min-width: 500px; }
  body { padding: 16px 20px !important; }
}

/* ── 18. Toast 动画优化 ────────────────────────────────── */
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 10000;
  padding: 12px 20px; background: var(--color-success); color: #fff;
  border-radius: 8px; font-size: 13px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateX(120%); transition: all .3s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(0); pointer-events: auto; }
.toast-error { background: var(--color-danger); }
.toast-warning { background: var(--color-warning); color: #000; }
.toast-success { background: var(--color-success); }
.toast-info { background: var(--color-primary); }

/* ── 19. 卡片渐变 + 模块色条 ──────────────────────────────── */
.card-gradient {
  background: linear-gradient(135deg, #fafbff 0%, #f0f4ff 100%);
  border-left: 3px solid var(--color-primary);
  box-shadow: var(--shadow-sm);
}
.card-gradient.green  { background: linear-gradient(135deg, #f7fdf7 0%, #ecfdf5 100%); border-left-color: var(--color-success); }
.card-gradient.orange { background: linear-gradient(135deg, #fffcf5 0%, #fff7ed 100%); border-left-color: var(--color-warning); }
.card-gradient.purple { background: linear-gradient(135deg, #faf7ff 0%, #f3eeff 100%); border-left-color: #7c3aed; }
.card-gradient.cyan   { background: linear-gradient(135deg, #f7fcfd 0%, #eef8fa 100%); border-left-color: var(--color-info); }

.card-hover {
  transition: transform .2s ease, box-shadow .2s ease;
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.10);
}

/* ── 20. 状态徽章 ─────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 500; line-height: 1.6;
  white-space: nowrap;
}
.badge-success { background: var(--color-success-light); color: var(--color-success); }
.badge-warning { background: var(--color-warning-light); color: var(--color-warning); }
.badge-danger  { background: var(--color-danger-light);  color: var(--color-danger); }
.badge-info    { background: var(--color-info-light);     color: var(--color-info); }
.badge-primary { background: var(--color-primary-light);  color: var(--color-primary-dark); }
.badge-gray    { background: var(--gray-100);              color: var(--gray-500); }

/* ── 21. 空状态插图 ────────────────────────────────────── */
.empty-state-illustrated {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 40px 20px; color: var(--gray-400); font-size: 13px;
}
.empty-state-illustrated svg { width: 80px; height: 80px; opacity: .6; }
.empty-state-illustrated .empty-title { font-size: 15px; color: var(--gray-500); font-weight: 600; }
.empty-state-illustrated .empty-hint { color: var(--gray-400); }

/* ── 22. 微动效 ────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.animate-in     { animation: fadeInUp .35s ease; }
.fade-in        { animation: fadeIn .3s ease; }
.stagger-1      { animation-delay: .05s; }
.stagger-2      { animation-delay: .10s; }
.stagger-3      { animation-delay: .15s; }
.stagger-4      { animation-delay: .20s; }

.btn-press:active { transform: scale(.96); transition: transform .1s ease; }

/* ── 23. KPI 统计条 ─────────────────────────────────────── */
.stats-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.stat-mini {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 12px;
  transition: transform .2s ease;
}
.stat-mini:hover { transform: translateY(-1px); }
.stat-mini .stat-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.stat-mini .stat-icon.blue  { background: #e0ecff; }
.stat-mini .stat-icon.green { background: #dcfce7; }
.stat-mini .stat-icon.amber { background: #fef3c7; }
.stat-mini .stat-icon.purp  { background: #f3eeff; }
.stat-mini .stat-value { font-size: 20px; font-weight: 700; color: var(--gray-800); line-height: 1.2; }
.stat-mini .stat-label { font-size: 12px; color: var(--gray-400); }

/* ── 24. 彩色状态点 ────────────────────────────────────── */
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; }
.dot-green  { background: var(--color-success); }
.dot-yellow { background: var(--color-warning); }
.dot-red    { background: var(--color-danger); }
.dot-blue   { background: var(--color-primary); }

/* ── 25. 移动端通用响应式（子页面内容适配） ───────────── */
@media (max-width: 767px) {
  .content-area { padding: 14px !important; }
  /* 全局收口：所有使用 .container { padding:24px 32px } 的页面（teacher/scores/users 等）
     在手机端统一收窄左右内边距，避免内容两侧大面积留白、无法充分利用屏宽 */
  .container { padding: 10px 12px !important; max-width: 100% !important; }
  .card { padding: 14px !important; }
  .card-title { font-size: 15px; }
  .toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .toolbar .btn, .toolbar button { width: 100%; }
  .form-group { margin-bottom: 12px; }
  .data-table, table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .stats-strip { flex-wrap: wrap; gap: 10px; }
  .stats-strip .stat { min-width: 44%; flex: 1 1 44%; }
  .modal-content, .modal { width: 94% !important; max-height: 88vh; overflow: auto; }
  .btn-group { flex-wrap: wrap; }
  .btn-group .btn { flex: 1 1 auto; }
  .db-row { flex-direction: column !important; }
  .db-card { max-height: none !important; overflow: visible; }
  .filter-bar { flex-wrap: wrap; gap: 8px; }
  .filter-bar select, .filter-bar input { width: 100%; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* ── 26. 新手引导气泡 ─────────────────────────────────── */
.wb-guide-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 10050; }
.wb-guide-box {
  position: fixed; z-index: 10051; max-width: 300px; background: #fff;
  border-radius: 14px; padding: 16px 18px; box-shadow: 0 18px 50px rgba(0,0,0,.3);
  border: 1px solid var(--color-primary-light, #eef2ff);
}
.wb-guide-box .gt { font-size: 15px; font-weight: 700; color: var(--color-primary); margin-bottom: 6px; }
.wb-guide-box .gx { font-size: 13px; color: var(--gray-600); line-height: 1.6; }
.wb-guide-box .gb { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }

.wb-guide-box .gb .step { font-size: 12px; color: var(--gray-400); }
.wb-guide-box .gb button { border: 0; border-radius: 8px; padding: 6px 14px; font-size: 13px; cursor: pointer; }
.wb-guide-box .gb .skip { background: var(--gray-100); color: var(--gray-500); margin-right: 8px; }
.wb-guide-box .gb .next { background: var(--color-primary); color: #fff; }
.wb-guide-highlight { position: relative; z-index: 10052; box-shadow: 0 0 0 3px var(--color-primary); border-radius: 8px; }

/* ── 折叠式功能说明面板（intro-tips，任意模块可复用） ── */
.intro-tips {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: 0 0 14px;
  padding: 0;
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
}
.intro-tips > summary {
  cursor: pointer;
  padding: 12px 18px;
  font-weight: 600;
  color: var(--text-primary);
  list-style: none;
  user-select: none;
  display: flex;            /* 三角与标题 上下左右 居中 */
  align-items: center;
  gap: 8px;
  line-height: 1.4;
  background: var(--gray-50);
  border-bottom: 1px solid transparent;
  transition: background var(--transition-fast);
}
.intro-tips > summary:hover { background: var(--color-primary-light); }
.intro-tips[open] > summary {
  background: var(--color-primary-light);
  border-bottom-color: var(--border-color);
}
.intro-tips > summary::-webkit-details-marker { display: none; }
/* 三角标记：固定宽度避免文字抖动 */
.intro-tips > summary::before {
  content: '▶';
  display: inline-block;
  font-size: 11px;
  color: var(--color-primary);
  transition: transform .15s;
  width: 14px;
  text-align: center;
  flex-shrink: 0;
}
.intro-tips[open] > summary::before { transform: rotate(90deg); }
.intro-tips .intro-body {
  padding: 8px 22px 18px;
  line-height: 1.7;
}
.intro-tips h4 {
  font-size: 13px;
  color: var(--color-primary);
  margin: 14px 0 6px;
  font-weight: 600;
}
.intro-tips h4:first-child { margin-top: 6px; }
.intro-tips ul { margin: 0; padding-left: 22px; }
.intro-tips li { margin: 4px 0; }
.intro-tips b { color: var(--text-primary); }
.intro-tips p { margin: 6px 0; }
.intro-tips code {
  background: var(--gray-100);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--text-primary);
}
.intro-tips .legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 6px 0 4px; }
.intro-tips .legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.intro-tips .sw {
  width: 14px; height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,.12);
  display: inline-block; flex-shrink: 0;
}

/* ── 移动端响应（<768px） ── */
@media (max-width: 768px) {
  .intro-tips { border-radius: var(--radius-sm); }
  .intro-tips > summary { padding: 10px 14px; font-size: 13px; }
  .intro-tips .intro-body { padding: 8px 16px 14px; font-size: 12px; }
}

/* ===== 通用确认弹窗（confirm-overlay） =====
   同时服务于主系统与各 iframe 嵌入模块（如运动会）。嵌入态下弹窗会被采纳进顶层文档，
   故这些规则必须放在 shared.css（顶层文档也加载），否则弹窗在顶层文档中会失去样式。 */
.confirm-overlay{position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:2000;display:flex;align-items:center;justify-content:center;}
.confirm-box{background:#fff;border-radius:12px;padding:28px;max-width:420px;width:95%;box-shadow:0 8px 40px rgba(0,0,0,.2);}
.confirm-title{font-size:17px;font-weight:700;margin-bottom:10px;}
.confirm-msg{font-size:14px;color:var(--text-secondary);margin-bottom:24px;line-height:1.8;white-space:pre-line;}
.confirm-actions{display:flex;justify-content:flex-end;gap:10px;}
