/* styles.css - 军队文职（公共课 + 中医学）40天专属冲刺系统样式表 */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --primary: #1d4ed8;       /* 军旅藏青蓝 */
  --primary-light: #eff6ff;
  --tcm: #0f766e;           /* 杏林草本青 */
  --tcm-light: #f0fdfa;
  --accent: #d97706;        /* 勋章暖金 */
  --accent-light: #fffbeb;
  --success: #15803d;
  --success-bg: #f0fdf4;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

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

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
}

/* ==================== 账号密码登录门户与顶栏账号切换 ==================== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #134e4a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 16px;
  padding: 28px 24px 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.38);
}

.login-brand {
  text-align: center;
  margin-bottom: 18px;
}

.login-badge-icon {
  font-size: 38px;
  line-height: 1;
  margin-bottom: 8px;
}

.login-brand h2 {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
}

.login-brand p {
  font-size: 12.5px;
  color: var(--text-muted);
}

.login-quick-users {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.quick-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.quick-user-chip {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #1e293b;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.quick-user-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.login-field {
  margin-bottom: 14px;
}
.login-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 5px;
}
.login-field input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14.5px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
}
.login-field input:focus {
  border-color: var(--primary);
}

.pwd-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.pwd-input-wrap input {
  padding-right: 40px;
}
.pwd-eye-btn {
  position: absolute;
  right: 8px;
  border: none;
  background: transparent;
  font-size: 15px;
  cursor: pointer;
  padding: 4px;
}

.login-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0 16px;
  font-size: 13px;
  color: #334155;
}
.login-check-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 500;
  user-select: none;
}
.login-check-item input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
}

.login-submit-btn {
  width: 100%;
  padding: 11px 16px;
  font-size: 15px;
  border-radius: 10px;
}

.login-foot-note {
  margin-top: 14px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-muted);
}

.user-account-pill {
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.32);
  color: #e0f2fe;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.user-account-pill:hover {
  background: rgba(56, 189, 248, 0.26);
  color: #fff;
}

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

/* ==================== 顶部全局导航栏（紧凑自适应 + 可折叠） ==================== */
.top-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  max-width: 100vw;
  background: #0f172a;
  color: #f8fafc;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 14px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-logo {
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  cursor: pointer;
}

.subj-switcher {
  display: flex;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}

.subj-pill {
  border: none;
  background: transparent;
  color: #cbd5e1;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.subj-pill small {
  font-size: 10.5px;
  opacity: 0.85;
}
.subj-pill.active[data-subj="pub"] {
  background: var(--primary);
  color: #fff;
}
.subj-pill.active[data-subj="tcm"] {
  background: var(--tcm);
  color: #fff;
}

.header-center-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.header-center-nav::-webkit-scrollbar {
  display: none;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
}

.nav-tab {
  border: none;
  background: transparent;
  color: #cbd5e1;
  padding: 6px 9px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.nav-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-tab.active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.nav-badge {
  background: #ef4444;
  color: #fff;
  font-size: 10.5px;
  padding: 0 5px;
  border-radius: 8px;
  line-height: 16px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* 实时学习计时器 */
.live-timer-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 3px 8px;
  border-radius: 7px;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.timer-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}
.timer-status-dot.paused { background: #eab308; }
.timer-status-dot.idle { background: #ef4444; }

.timer-val {
  font-family: "SF Mono", Menlo, monospace;
  font-size: 13px;
  font-weight: 700;
  color: #38bdf8;
}

.timer-badge {
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 4px;
}
.timer-badge.active { background: rgba(34, 197, 94, 0.22); color: #86efac; }
.timer-badge.paused { background: rgba(234, 179, 8, 0.22); color: #fde047; }
.timer-badge.idle { background: rgba(239, 68, 68, 0.22); color: #fca5a5; }

.timer-ctrl-btn {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
}

/* 顶栏右侧：账号与系统设置折叠下拉菜单（全屏与移动端统一收纳） */
.settings-menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.user-settings-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.34);
  color: #f0f9ff;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.16s;
}
.user-settings-trigger:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: rgba(56, 189, 248, 0.5);
  color: #fff;
}
.user-settings-trigger .u-gear {
  font-size: 12px;
  opacity: 0.85;
}

.settings-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 12px;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.42);
  z-index: 300;
}
.settings-dropdown.open {
  display: flex;
}

.settings-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}
.su-avatar {
  font-size: 20px;
  line-height: 1;
}
.su-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.su-name {
  font-size: 12.5px;
  color: #e2e8f0;
}
.su-name strong {
  color: #38bdf8;
}
.su-sync {
  font-size: 11px;
  color: #86efac;
}

.settings-menu-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.settings-menu-item {
  border: none;
  background: transparent;
  color: #e2e8f0;
  padding: 9px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s;
}
.settings-menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.settings-menu-item.danger {
  color: #fca5a5;
}
.settings-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.18);
  color: #fecaca;
}
.settings-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 3px 0;
}

.top-util-btn, .icon-toggle-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e2e8f0;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.top-util-btn:hover, .icon-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.mobile-only,
.mobile-bottom-nav,
.wb-mobile-bottom-bar,
.mobile-sheet-close,
.wb-mobile-backdrop {
  display: none;
}

/* ==================== 通用容器与卡片 ==================== */
.main-container {
  max-width: 1440px;
  margin: 18px auto 40px;
  padding: 0 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.text-muted { color: var(--text-muted); font-size: 13px; }
.text-success { color: var(--success); }
.text-warn { color: var(--accent); }
.text-danger { color: var(--danger); }

.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 15px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 6px; }
.btn-lg { padding: 10px 20px; font-size: 15px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1e40af; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover:not(:disabled) { background: #b45309; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover:not(:disabled) {
  background: var(--surface-alt);
  border-color: #cbd5e1;
}

.btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pill-group {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 8px;
  gap: 4px;
  flex-wrap: wrap;
}
.pill-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.pill-btn.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ==================== 视图 1：数据看板 ==================== */
.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 60%, #134e4a 100%);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 26px;
  border: none;
}

.hero-tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.14);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  margin-bottom: 6px;
}

.hero-left h1 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 4px;
}

.countdown-num {
  color: #fbbf24;
  font-size: 32px;
  padding: 0 4px;
}

.hero-sub {
  color: #cbd5e1;
  font-size: 13.5px;
}

.hero-actions {
  display: flex;
  gap: 10px;
}
.hero-actions .btn-outline {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.kpi-label {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  margin: 6px 0;
}
.kpi-value small {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.kpi-foot {
  font-size: 12.5px;
  color: var(--text-muted);
}

.dual-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.dp-item span {
  font-size: 11.5px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 2px;
}

.progress-track {
  height: 7px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}
.progress-track.slim { height: 6px; }
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s;
}
.progress-fill.pub { background: var(--primary); }
.progress-fill.tcm { background: var(--tcm); }

.dash-two-col {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 16px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
}
.task-item.done {
  opacity: 0.65;
  background: #f1f5f9;
}
.task-item.done .task-title {
  text-decoration: line-through;
}
.task-check {
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.task-body { flex: 1; }
.task-title { font-weight: 600; font-size: 13.5px; }
.task-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.subj-tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 4px;
  margin-right: 6px;
}
.subj-tag.pub { background: var(--primary-light); color: var(--primary); }
.subj-tag.tcm { background: var(--tcm-light); color: var(--tcm); }

.ai-coach-box {
  margin-top: 18px;
  border: 1px solid #fde68a;
  background: #fffbeb;
  border-radius: 10px;
  padding: 14px;
}
.ai-coach-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.ai-coach-body {
  font-size: 13.5px;
  color: #334155;
  max-height: 360px;
  overflow-y: auto;
}

/* 柱状趋势图 */
.bar-chart-wrap {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 6px;
  align-items: end;
  padding: 10px 6px 4px;
  border-bottom: 1px solid var(--border);
}
.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.bar-val {
  font-size: 10px;
  color: var(--text-muted);
  height: 14px;
}
.bar-stack {
  width: 18px;
  background: #f1f5f9;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}
.bar-seg.pub { background: var(--primary); }
.bar-seg.tcm { background: var(--tcm); }
.bar-label {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.legend-inline {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 3px;
}
.dot.pub { background: var(--primary); }
.dot.tcm { background: var(--tcm); }

.chap-stat-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.chap-stat-info {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  margin-bottom: 3px;
}
.chap-stat-name { font-weight: 600; }

/* ==================== 视图 2：40天规划表 ==================== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
}

.plan-day-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s;
}
.plan-day-card.is-today {
  border: 2px solid var(--primary);
  box-shadow: 0 4px 16px rgba(29, 78, 216, 0.12);
}
.plan-day-card.all-done {
  background: #f8fafc;
  border-color: #bbf7d0;
}

.plan-day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.day-badge {
  background: #0f172a;
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 5px;
  margin-right: 6px;
}
.today-pill {
  background: #dbeafe;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}
.phase-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}
.phase-tag.p1 { background: #e0e7ff; color: #3730a3; }
.phase-tag.p2 { background: #dcfce7; color: #166534; }
.phase-tag.p3 { background: #fef3c7; color: #92400e; }
.phase-tag.p4 { background: #fee2e2; color: #991b1b; }

.plan-day-tasks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.plan-task-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--surface-alt);
}
.plan-task-row.done .plan-task-text {
  text-decoration: line-through;
  color: var(--text-muted);
}
.plan-check-label {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  cursor: pointer;
  flex: 1;
}
.plan-check-label input { margin-top: 4px; }
.subj-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}
.subj-dot.pub { background: var(--primary); }
.subj-dot.tcm { background: var(--tcm); }

.btn-icon {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
}

.plan-day-foot {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

/* ==================== 视图 3：章节精练 ==================== */
.sniper-banner {
  background: linear-gradient(90deg, #fff1f2 0%, #fffbeb 100%);
  border-color: #fecdd3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 16px;
  flex-wrap: wrap;
}
.sniper-info h3 { color: #9f1239; margin-bottom: 4px; }
.sniper-info p { color: #475569; font-size: 13px; }
.sniper-btns { display: flex; gap: 10px; }

.chapter-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.chapter-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.section-pills {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.sec-pill-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}
.sec-actions { display: flex; gap: 6px; }
.btn-mini {
  border: 1px solid var(--border);
  background: #fff;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
}
.btn-mini.primary {
  background: var(--primary-light);
  color: var(--primary);
  border-color: #bfdbfe;
  font-weight: 600;
}

/* ==================== 视图 4：全真模考列表 ==================== */
.mock-two-col {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 16px;
  align-items: start;
}
.sub-heading {
  font-size: 16px;
  margin-bottom: 12px;
}
.paper-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.paper-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.paper-card.highlight-new {
  border-left: 4px solid var(--primary);
  background: #f8fafc;
}
.badge-new {
  background: #dbeafe;
  color: var(--primary);
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
  font-weight: 600;
}
.paper-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.mock-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.mock-hist-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
}
.mh-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mh-score { font-size: 18px; font-weight: 800; color: var(--primary); }
.mh-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ==================== 核心工作台：刷题 / 背题 / 模考 ==================== */
.workbench-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.wb-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  flex-wrap: wrap;
  gap: 10px;
}
.wb-left, .wb-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.wb-progress-pill {
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
}
.mock-timer-pill {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 14px;
}

.wb-main-layout {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 16px;
  align-items: start;
}
.wb-main-layout.with-ai-drawer {
  grid-template-columns: 1fr 360px 260px;
}

.q-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.q-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.q-type-badge {
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 5px;
}
.q-type-badge.multi { background: #7c3aed; }
.q-chap-badge {
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 5px;
}
.q-tag-badge {
  background: #ecfdf5;
  color: #047857;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 5px;
}
.q-group-badge {
  background: #fffbeb;
  color: #b45309;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 5px;
  font-weight: 600;
}
.acc-pill {
  font-size: 12px;
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 5px;
}
.acc-pill.hard {
  background: #fef2f2;
  color: var(--danger);
}
.prev-rec-pill {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 8px;
}

.notice-2024 {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  margin-bottom: 14px;
}

/* 共用材料分栏布局 */
.shared-material-split {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 18px;
  align-items: start;
}
.material-pane {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  max-height: 520px;
  overflow-y: auto;
}
.material-pane-title {
  font-weight: 700;
  color: var(--primary);
  font-size: 13px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}

.q-stem-text {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.75;
  margin-bottom: 18px;
  color: #0f172a;
}
.q-num-prefix {
  color: var(--primary);
  font-weight: 800;
  margin-right: 6px;
}

.q-img-wrap {
  margin: 10px 0;
}
.q-inline-img {
  max-width: 100%;
  max-height: 340px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: zoom-in;
}

.options-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 15px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.14s;
  background: #fff;
}
.option-item:hover {
  border-color: #93c5fd;
  background: #f8fafc;
}
.option-item.opt-selected {
  border-color: var(--primary);
  background: var(--primary-light);
}
.option-item.opt-correct {
  border-color: #22c55e;
  background: var(--success-bg);
}
.option-item.opt-wrong {
  border-color: #ef4444;
  background: var(--danger-bg);
}
.option-item.opt-missed {
  border-color: #f59e0b;
  background: #fffbeb;
}

.opt-key {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--text);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.option-item.opt-selected .opt-key { background: var(--primary); color: #fff; }
.option-item.opt-correct .opt-key { background: var(--success); color: #fff; }
.option-item.opt-wrong .opt-key { background: var(--danger); color: #fff; }

.opt-content {
  flex: 1;
  font-size: 15px;
  line-height: 1.6;
}
.opt-mark {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}
.opt-mark.ok { color: var(--success); }
.opt-mark.err { color: var(--danger); }

.multi-submit-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  padding: 10px 14px;
  border-radius: 8px;
  margin-top: 6px;
}

.q-nav-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}
.shortcut-hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* 答案解析面板 */
.analysis-panel {
  margin-top: 20px;
  border-top: 2px dashed var(--border);
  padding-top: 18px;
}
.ans-compare-Banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}
.ans-compare-Banner.correct { background: var(--success-bg); border: 1px solid #bbf7d0; }
.ans-compare-Banner.wrong { background: var(--danger-bg); border: 1px solid #fecaca; }
.ans-letter { font-size: 18px; font-weight: 800; }
.ans-letter.ok { color: var(--success); }
.ans-letter.err { color: var(--danger); }

.ai-quick-triggers {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ana-body {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.ana-body h4 { margin-bottom: 8px; color: #0f172a; }
.ana-text { font-size: 14.5px; line-height: 1.75; }

/* 确保做题界面题干、选项、解析、材料与 AI 讲题内容全部允许自由选中复制 (Ctrl+C / Cmd+C) */
.q-stem-text,
.opt-content,
.ana-text,
.ai-drawer-body,
.material-pane,
.note-rich-editor,
.wi-stem,
.wi-opts,
.wi-ana {
  user-select: text;
  -webkit-user-select: text;
}

.note-box {
  margin-top: 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 12px 14px;
}
.note-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.note-title-area {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.note-save-hint {
  font-size: 11.5px;
  color: #92400e;
}
.note-toolbar {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.note-tool-btn {
  border: 1px solid #fcd34d;
  background: #fff;
  color: #334155;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.14s;
}
.note-tool-btn:hover {
  border-color: #f59e0b;
  background: #fef3c7;
}
.note-tool-btn.red {
  color: #dc2626;
}
.note-tool-btn.blue {
  color: #1d4ed8;
}
.note-tool-btn.hl-yellow {
  background: #fef9c3;
  border-color: #facc15;
  color: #854d0e;
}
.note-tool-btn.hl-green {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}
.nt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.nt-dot.red { background: #dc2626; }
.nt-dot.blue { background: #1d4ed8; }

/* 随文字多少自动变长的富文本笔记编辑框 */
.note-rich-editor {
  width: 100%;
  min-height: 84px;
  height: auto;
  border: 1.5px solid #fcd34d;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.68;
  background: #fff;
  color: #1e293b;
  outline: none;
  overflow-y: visible;
  word-break: break-word;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.note-rich-editor:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}
.note-rich-editor:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
}
.wi-note-rich-body {
  margin-top: 4px;
  line-height: 1.65;
}

/* AI 抽屉与右侧答题卡 */
.wb-ai-drawer {
  display: flex;
  flex-direction: column;
  max-height: 740px;
  padding: 14px;
}
.ai-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.ai-action-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.ai-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 4px;
  font-size: 13.5px;
  line-height: 1.7;
}
.ai-drawer-input {
  display: flex;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.ai-drawer-input input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.sheet-legend {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
}
.s-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 2px;
}
.s-dot.ok { background: var(--success); }
.s-dot.err { background: var(--danger); }
.s-dot.dbt { background: var(--accent); }

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  max-height: 540px;
  overflow-y: auto;
}
.sheet-cell {
  height: 32px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.sheet-cell.current {
  border: 2px solid var(--primary);
  color: var(--primary);
}
.sheet-cell.answered { background: #dbeafe; border-color: #93c5fd; }
.sheet-cell.correct { background: #dcfce7; color: var(--success); border-color: #86efac; }
.sheet-cell.wrong { background: #fee2e2; color: var(--danger); border-color: #fca5a5; }
.sheet-cell.doubt { box-shadow: inset 0 0 0 2px var(--accent); }

/* ==================== 视图 5 & 6：错题本与全局搜索 ==================== */
.wrong-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.filter-selects {
  display: flex;
  gap: 10px;
}
.filter-selects select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}

.wrong-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.wrong-item-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.wi-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.err-count-badge {
  background: #fee2e2;
  color: var(--danger);
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
}
.wi-stem { font-weight: 600; font-size: 15px; }
.wi-opts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px;
  font-size: 13.5px;
  color: #334155;
}
.wi-ans-bar {
  background: var(--surface-alt);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
}
.wi-ana {
  font-size: 13.5px;
  color: #475569;
}
.wi-tags-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12.5px;
}
.tag-chip {
  border: 1px solid var(--border);
  background: #fff;
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
}
.tag-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.wi-note-preview {
  background: #fffbeb;
  border-left: 3px solid var(--accent);
  padding: 8px 12px;
  font-size: 13px;
}

.search-input-row {
  display: flex;
  gap: 10px;
}
.search-input-lg {
  flex: 1;
  padding: 10px 14px;
  font-size: 15px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
}
.hot-keywords {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ==================== 模态框与图片灯箱 ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }

.modal-content {
  background: #fff;
  border-radius: 14px;
  max-width: 660px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px 24px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.form-group {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.form-group label { font-weight: 600; font-size: 13px; }
.form-group input, .form-group select {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
}
.modal-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.upload-dropzone {
  margin-top: 14px;
  border: 2px dashed #93c5fd;
  background: #eff6ff;
  border-radius: 12px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
}
.upload-dropzone:hover { background: #dbeafe; }

.backup-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 10px;
  background: var(--surface-alt);
}

/* ==================== AI 思考过程折叠框 + 完整 Markdown 渲染样式 ==================== */
.ai-think-box {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: all 0.2s ease;
}
.ai-think-box.thinking-live {
  border-color: #93c5fd;
  background: #f0f9ff;
}
.ai-think-summary {
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  user-select: none;
  list-style: none;
}
.ai-think-summary::-webkit-details-marker {
  display: none;
}
.think-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.think-badge.live {
  color: #1d4ed8;
}
.think-badge.done {
  color: #475569;
}
.think-hint {
  font-size: 11.5px;
  font-weight: 500;
  color: #64748b;
}
.think-dot-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2563eb;
  display: inline-block;
  animation: thinkPulse 1s infinite ease-in-out;
}
@keyframes thinkPulse {
  0%, 100% { transform: scale(0.85); opacity: 0.5; }
  50% { transform: scale(1.25); opacity: 1; }
}
.ai-think-body {
  padding: 8px 12px 10px;
  border-top: 1px dashed #cbd5e1;
  font-size: 12.5px;
  color: #475569;
  background: rgba(255, 255, 255, 0.65);
  line-height: 1.55;
}

.ai-formal-answer {
  font-size: 13.8px;
  line-height: 1.68;
  color: #1e293b;
}
.md-heading {
  margin: 12px 0 6px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
}
.md-h2 { font-size: 16px; border-bottom: 1px solid #e2e8f0; padding-bottom: 4px; }
.md-h3 { font-size: 15px; color: #1e3a8a; }
.md-h4, .md-h5 { font-size: 14px; color: #0f766e; }

.md-p {
  margin: 6px 0;
}
.md-list {
  margin: 6px 0 8px 18px;
  padding: 0;
}
.md-list li {
  margin-bottom: 4px;
}
.md-hr {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 10px 0;
}
.md-code-block {
  background: #0f172a;
  color: #f8fafc;
  padding: 10px 12px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 12.5px;
  margin: 8px 0;
}
.md-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 8px 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}
.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  background: #fff;
}
.md-table th,
.md-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
}
.md-table th:last-child,
.md-table td:last-child {
  border-right: none;
}
.md-table th {
  background: #f1f5f9;
  font-weight: 700;
  color: #1e293b;
}
.md-table tr:last-child td {
  border-bottom: none;
}

.inline-code {
  background: #e2e8f0;
  color: #0f172a;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: "SF Mono", Menlo, monospace;
  font-size: 0.92em;
}
.ai-quote {
  border-left: 3.5px solid var(--primary);
  background: #eff6ff;
  padding: 8px 12px;
  margin: 6px 0 10px;
  border-radius: 0 6px 6px 0;
  color: #1e3a8a;
  font-size: 13px;
}

/* ==================== 多智能体配置弹窗 & 快速切换组件 ==================== */
.ai-coach-title-group,
.ai-drawer-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ai-drawer-head-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.ai-agent-quick-select {
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #1e293b;
  max-width: 220px;
  cursor: pointer;
}

.agent-tabs-bar {
  margin-top: 12px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.agent-tabs-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.agent-pills-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.agent-profile-pill {
  border: 1.5px solid #cbd5e1;
  background: #fff;
  color: #334155;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.agent-profile-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.agent-profile-pill.selected {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.15);
}
.agent-profile-pill.add-new {
  border-style: dashed;
  color: #0f766e;
  border-color: #5eead4;
  background: #f0fdfa;
}
.ap-active-tag {
  background: #22c55e;
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
}

.agent-form-card {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.form-row-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-row-two .form-group {
  margin-top: 0;
}
.apikey-test-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.model-combo-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 8px;
}

.ai-conn-status {
  margin-top: 6px;
  padding: 8px 11px;
  border-radius: 7px;
  font-size: 12.5px;
  line-height: 1.45;
}
.ai-conn-status.testing {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
}
.ai-conn-status.ok {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}
.ai-conn-status.warn {
  background: #fefce8;
  border: 1px solid #fef08a;
  color: #a16207;
}
.ai-conn-status.err {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

@media (max-width: 640px) {
  .form-row-two,
  .model-combo-row {
    grid-template-columns: 1fr;
  }
  .apikey-test-row .btn {
    width: 100%;
  }
  .ai-think-summary {
    flex-wrap: wrap;
  }
}

/* ==================== 多端响应式深度适配（iPad 横竖屏 / 手机端） ==================== */

/* 1. iPad 竖屏与分屏窗口 (<= 1120px) */
@media (max-width: 1120px) {
  .main-container {
    padding: 0 14px;
    margin-bottom: 84px; /* 为底部固定导航栏留出空间 */
  }

  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .dash-two-col,
  .mock-two-col,
  .wb-main-layout,
  .wb-main-layout.with-ai-drawer,
  .shared-material-split {
    grid-template-columns: 1fr;
  }

  /* 窄屏与平板下共用材料框限高可滚动，保证下方题目与选项同屏可见 */
  .material-pane {
    max-height: 220px;
  }

  .mobile-only {
    display: inline-flex;
  }

  /* 小屏/平板竖屏/手机端：顶栏中间6大Tab自动隐藏，改用底部固定原生 Tab 栏 */
  .header-center-nav {
    display: none;
  }

  /* 底部原生级固定 Tab 导航栏（iPad 竖屏 & 手机端） */
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px));
    z-index: 200;
    box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.06);
  }
  .mobile-bottom-nav.hidden-in-wb {
    display: none;
  }
  .m-nav-item {
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 5px 2px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    border-radius: 8px;
  }
  .m-nav-item.active {
    color: var(--primary);
    background: var(--primary-light);
  }
  .m-nav-icon {
    font-size: 17px;
    line-height: 1.1;
  }
  .m-nav-badge {
    position: absolute;
    top: 2px;
    right: 14%;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    padding: 0 4px;
    border-radius: 8px;
    line-height: 14px;
  }

  /* 刷题工作台：在 iPad/手机端隐藏默认底部切题条，改用吸底拇指操控栏 + 底部弹出式答题卡/AI抽屉 */
  .q-nav-footer {
    display: none;
  }
  .wb-mobile-bottom-bar {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr 1fr;
    gap: 8px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 220;
    box-shadow: 0 -3px 14px rgba(15, 23, 42, 0.08);
  }
  .wb-m-btn {
    border: 1px solid var(--border);
    background: #f8fafc;
    color: var(--text);
    padding: 9px 6px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
  }
  .wb-m-btn.primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
  }
  .wb-m-btn:disabled {
    opacity: 0.4;
  }

  /* 答题卡与 AI 助教在 iPad/手机端转为底部上滑抽屉 (Bottom Sheet) */
  .wb-sheet-column {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 350;
    max-height: 74vh;
    border-radius: 18px 18px 0 0;
    padding: 18px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
  }
  .wb-sheet-column.sheet-open {
    display: block;
  }
  .mobile-sheet-close {
    display: inline-block;
    margin-left: 8px;
  }
  .sheet-grid {
    grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
    max-height: 56vh;
  }

  .wb-ai-drawer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 350;
    max-height: 78vh;
    border-radius: 18px 18px 0 0;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
  }

  .wb-mobile-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 320;
  }
}

/* 全局 Grid 子项防撑破规则：防止任何卡片或内联内容撑宽网格轨道 */
.main-container,
.dashboard-grid,
.kpi-row > *,
.dash-two-col > *,
.mock-two-col > *,
.wb-main-layout > *,
.shared-material-split > *,
.plan-grid > *,
.section-pills > *,
.wi-opts > *,
.card {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* 2. 手机端专属紧凑与防横向溢出深度优化 (<= 640px) */
@media (max-width: 640px) {
  .header-inner {
    padding: 0 8px;
    height: 48px;
    gap: 4px;
  }
  .logo-text {
    display: none; /* 手机端仅保留 🎖️ 图标，将顶栏空间留给双科切换与计时器 */
  }
  .subj-pill {
    padding: 4px 6px;
    font-size: 11.5px;
  }
  .subj-pill small {
    display: none;
  }
  .timer-badge {
    display: none;
  }
  .live-timer-box {
    padding: 3px 6px;
    gap: 4px;
  }
  .timer-val {
    font-size: 12px;
  }
  .user-settings-trigger {
    padding: 4px 7px;
    font-size: 11.5px;
    gap: 3px;
  }
  .settings-dropdown {
    width: 240px;
    right: 0;
  }

  .main-container {
    width: 100%;
    max-width: 100vw;
    padding: 0 10px;
    margin-top: 10px;
    overflow-x: hidden;
  }

  .card {
    width: 100%;
    max-width: 100%;
    padding: 12px;
    border-radius: 10px;
  }

  .hero-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
  }
  .hero-tag {
    font-size: 11px;
    line-height: 1.4;
    white-space: normal;
  }
  .hero-left h1 {
    font-size: 18px;
  }
  .countdown-num {
    font-size: 24px;
  }
  .hero-sub {
    font-size: 12px;
  }
  .hero-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  .hero-actions .btn {
    flex: 1 1 130px;
    font-size: 12px;
    padding: 7px 8px;
  }

  /* 手机端保持 2x2 紧凑指标卡，严格限制不超宽 */
  .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .kpi-card {
    padding: 10px;
  }
  .kpi-label {
    font-size: 11px;
  }
  .kpi-value {
    font-size: 17px;
    margin: 3px 0;
  }
  .kpi-value small {
    font-size: 11px;
    display: block;
  }
  .kpi-foot {
    font-size: 10.5px;
    line-height: 1.4;
  }

  /* 手机端所有多列网格全部强制转为单列 minmax(0, 1fr)，彻底杜绝横向撑破 */
  .plan-grid,
  .section-pills,
  .wi-opts {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  /* 手机端 14 天柱状图自适应压缩，不撑宽父卡片 */
  .bar-chart-wrap {
    grid-template-columns: repeat(14, minmax(0, 1fr));
    gap: 2px;
    padding: 8px 0 4px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }
  .bar-stack {
    width: 10px;
  }
  .bar-val {
    font-size: 8px;
    white-space: nowrap;
  }
  .bar-label {
    font-size: 8.5px;
    white-space: nowrap;
    letter-spacing: -0.5px;
  }

  /* 卡片头部、任务行、章节行自动换行，避免右侧按钮挤出屏幕 */
  .card-header,
  .chapter-card-head,
  .sec-pill-item,
  .wi-head,
  .mh-top,
  .plan-day-head,
  .ai-coach-header,
  .note-head,
  .multi-submit-bar,
  .chap-stat-info {
    flex-wrap: wrap;
    gap: 6px;
  }

  .task-item {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
  }
  .task-body {
    min-width: calc(100% - 34px);
  }
  .task-item > .btn {
    width: 100%;
    margin-top: 2px;
  }

  .sec-pill-item > span {
    flex: 1 1 100%;
  }
  .sec-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .pill-group {
    width: 100%;
  }
  .pill-btn {
    flex: 1 1 auto;
    text-align: center;
    padding: 5px 8px;
    font-size: 11.5px;
  }

  .wrong-filter-bar,
  .filter-selects,
  .search-input-row {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 8px;
  }
  .filter-selects select,
  .search-input-lg {
    width: 100%;
    min-width: 0;
  }

  .wb-topbar {
    padding: 10px 12px;
  }
  .wb-title {
    font-size: 14px;
  }
  .q-stem-text {
    font-size: 15px;
  }
  .option-item {
    padding: 10px 11px;
    gap: 9px;
  }
  .opt-content {
    font-size: 14px;
    min-width: 0;
  }
  .modal-backdrop {
    padding: 12px;
  }
  .modal-content {
    padding: 16px;
    max-height: 90vh;
    overflow-y: auto;
  }
  .login-card {
    padding: 22px 18px 18px;
  }
}
