/* ============================================================
   KaoyanHub · 样式表
   设计基线：浅色背景 / 靛蓝主色 / 16px 圆角 / 柔和阴影
   所有资源均为本地相对路径，不依赖任何 CDN
   ============================================================ */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --border: #e6eaf2;
  --border-strong: #d5dbe8;

  --text: #111827;
  --text-2: #4b5563;
  --text-3: #8b93a7;
  --text-inv: #ffffff;

  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-soft: #eef2ff;
  --primary-soft-2: #e0e7ff;

  --success: #10b981;
  --success-soft: #ecfdf5;
  --warn: #f59e0b;
  --warn-soft: #fffbeb;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --info: #0ea5e9;
  --info-soft: #f0f9ff;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .12);

  --sidebar-w: 236px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d8deeb; border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #c2cad9; }
::-webkit-scrollbar-track { background: transparent; }

/* ===================== 布局 ===================== */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; bottom: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 40;
  padding: 20px 14px;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 18px;
}
.brand-logo {
  width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; letter-spacing: -.5px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, .35);
  flex: 0 0 auto;
}
.brand-text strong { display: block; font-size: 15px; line-height: 1.2; }
.brand-text span { font-size: 11px; color: var(--text-3); }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.nav-label {
  font-size: 11px; color: var(--text-3); font-weight: 600;
  padding: 14px 10px 6px; letter-spacing: .06em;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--text-2); cursor: pointer; font-weight: 500;
  transition: background .15s, color .15s;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item .ic { width: 20px; text-align: center; font-size: 15px; flex: 0 0 auto; }
.nav-item .badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 20px; min-width: 18px; text-align: center;
}

.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.sidebar-foot .tip { font-size: 11px; color: var(--text-3); padding: 0 8px; line-height: 1.5; }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex; flex-direction: column;
}

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(244, 246, 251, .85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex; align-items: center; gap: 16px;
}
.topbar h1 { font-size: 19px; font-weight: 700; letter-spacing: -.2px; }
.topbar .sub { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.content { padding: 24px 28px 60px; flex: 1; }
.view { animation: fadeUp .28s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.mobile-only { display: none; }

/* ===================== 通用组件 ===================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px; border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 14.5px; font-weight: 700; }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 18px; }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* 关键：grid item 默认 min-width:auto，会被长文本/图表撑破布局，必须显式置 0 */
.grid > * { min-width: 0; }
/* 主副栏布局（宽屏两列，窄屏自动堆叠，见响应式段） */
.g-split { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.g-split2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-weight: 500; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: #c3cad9; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn-soft { background: var(--primary-soft); border-color: var(--primary-soft-2); color: var(--primary); }
.btn-soft:hover { background: var(--primary-soft-2); }
.btn-danger { color: var(--danger); border-color: #fbd0d0; background: var(--danger-soft); }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input, .select, .textarea {
  width: 100%; padding: 8px 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.textarea { resize: vertical; min-height: 76px; line-height: 1.6; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2);
}
.tag-primary { background: var(--primary-soft); color: var(--primary); }
.tag-success { background: var(--success-soft); color: #047857; }
.tag-warn { background: var(--warn-soft); color: #b45309; }
.tag-danger { background: var(--danger-soft); color: #b91c1c; }
.tag-info { background: var(--info-soft); color: #0369a1; }

.subject-dot {
  width: 26px; height: 26px; border-radius: 8px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 700;
}

.progress {
  height: 7px; border-radius: 20px; background: var(--surface-3); overflow: hidden;
}
.progress > i {
  display: block; height: 100%; border-radius: 20px;
  background: linear-gradient(90deg, #818cf8, #4f46e5);
  transition: width .5s ease;
}
.progress.thin { height: 5px; }

.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.b { font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }

.empty {
  padding: 44px 20px; text-align: center; color: var(--text-3);
}
.empty .ei { font-size: 34px; opacity: .5; margin-bottom: 8px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip {
  padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border-strong);
  background: var(--surface); cursor: pointer; font-size: 12.5px; font-weight: 500;
  color: var(--text-2); transition: all .15s;
}
.chip:hover { border-color: #b9c1d1; }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.search-box { position: relative; flex: 1; min-width: 180px; max-width: 300px; }
.search-box .input { padding-left: 32px; }
.search-box::before {
  content: "⌕"; position: absolute; left: 11px; top: 50%; transform: translateY(-52%);
  color: var(--text-3); font-size: 16px;
}

/* ===================== 仪表盘 ===================== */
.hero {
  background: linear-gradient(120deg, #4f46e5 0%, #7c3aed 55%, #0ea5e9 130%);
  border-radius: var(--radius-lg);
  color: #fff; padding: 24px 26px;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  box-shadow: 0 14px 34px rgba(79, 70, 229, .28);
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -80px;
  width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255, 255, 255, .10);
}
.hero::before {
  content: ""; position: absolute; right: 40px; bottom: -110px;
  width: 190px; height: 190px; border-radius: 50%;
  background: rgba(255, 255, 255, .07);
}
.hero-main { position: relative; z-index: 1; }
.hero .hello { font-size: 13px; opacity: .85; }
.hero h2 { font-size: 22px; font-weight: 700; margin: 4px 0 6px; letter-spacing: -.3px; }
.hero .goal { font-size: 13px; opacity: .9; }
.countdown {
  position: relative; z-index: 1; margin-left: auto;
  display: flex; align-items: center; gap: 18px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .22);
  padding: 14px 20px; border-radius: var(--radius);
  backdrop-filter: blur(6px);
}
.countdown .days { font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.countdown .unit { font-size: 12px; opacity: .85; margin-top: 4px; }
.countdown .cd-label { font-size: 12.5px; opacity: .9; line-height: 1.5; }

.stat-card { padding: 16px 18px; }
.stat-card .label { font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.stat-card .value { font-size: 26px; font-weight: 800; letter-spacing: -.6px; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.stat-card .value small { font-size: 13px; font-weight: 600; color: var(--text-3); margin-left: 2px; }
.stat-card .foot { font-size: 12px; color: var(--text-3); }
.stat-ic {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; font-size: 19px;
}

.ring-wrap { display: flex; align-items: center; gap: 18px; }
.ring { position: relative; width: 108px; height: 108px; flex: 0 0 auto; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-text {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.ring .ring-text .v { font-size: 24px; font-weight: 800; letter-spacing: -.8px; }
.ring .ring-text .l { font-size: 11px; color: var(--text-3); }

/* 柱状图 */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding-top: 8px; }
.bar-col {
  flex: 1; min-width: 0; /* min-width:0 必加，否则日期标签的 min-content 会撑破容器 */
  display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end;
}
.bar {
  width: 100%; max-width: 26px; border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #818cf8, #6366f1);
  min-height: 3px; transition: height .5s ease; position: relative;
}
.bar.zero { background: var(--surface-3); }
.bar-col .bl {
  font-size: 10.5px; color: var(--text-3);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar-col .bv { font-size: 10.5px; color: var(--text-2); font-weight: 600; white-space: nowrap; }
/* 窄屏：14 根柱子太密，隔一根显示日期，避免文字挤成一团 */
@media (max-width: 640px) {
  .bars { gap: 4px; }
  .bar-col .bl { font-size: 9px; }
  .bar-col:nth-child(even) .bl { visibility: hidden; }
  .bar-col .bv { font-size: 9px; }
}

/* 热力图 */
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 4px; overflow-x: auto; padding-bottom: 4px; max-width: 100%; }
.heat-cell { width: 13px; height: 13px; border-radius: 3px; background: var(--surface-3); }
.heat-cell[data-l="1"] { background: #c7d2fe; }
.heat-cell[data-l="2"] { background: #a5b4fc; }
.heat-cell[data-l="3"] { background: #818cf8; }
.heat-cell[data-l="4"] { background: #4f46e5; }

.todo-list { display: flex; flex-direction: column; }
.todo-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 18px; border-bottom: 1px solid var(--border);
}
.todo-item:last-child { border-bottom: none; }
.todo-item:hover { background: var(--surface-2); }
.tick {
  width: 19px; height: 19px; border-radius: 6px; flex: 0 0 auto;
  border: 1.8px solid var(--border-strong); background: var(--surface);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: transparent; font-size: 11px; transition: all .15s;
}
.tick:hover { border-color: var(--primary); }
.tick.on { background: var(--success); border-color: var(--success); color: #fff; }
.todo-item.done .t-title { text-decoration: line-through; color: var(--text-3); }
.t-title { font-size: 13.5px; font-weight: 500; }

.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--surface-2); }
.row-main { min-width: 0; flex: 1; }
.row-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.row-actions { display: flex; gap: 6px; flex: 0 0 auto; }

/* ===================== 资料卡 ===================== */
.mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.mat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.mat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.mat-card .top { display: flex; align-items: flex-start; gap: 10px; }
.mat-card .title { font-weight: 700; font-size: 14.5px; line-height: 1.4; }
.mat-card .meta { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.mat-card .note {
  font-size: 12.5px; color: var(--text-2); background: var(--surface-2);
  border-radius: var(--radius-sm); padding: 8px 10px; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.mat-card .foot { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.star { cursor: pointer; color: var(--text-3); font-size: 15px; line-height: 1; }
.star.on { color: #f59e0b; }

/* ===================== 知识点 ===================== */
.kp-group { margin-bottom: 20px; }
.kp-group-head {
  display: flex; align-items: center; gap: 9px; margin: 0 0 10px;
  padding-left: 2px;
}
.kp-group-head h4 { font-size: 14px; font-weight: 700; }
.kp-group-head .count { font-size: 12px; color: var(--text-3); }
.kp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.kp-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
  transition: box-shadow .18s, border-color .18s;
  border-left: 3px solid var(--border-strong);
}
.kp-card:hover { box-shadow: var(--shadow); }
.kp-card.m0 { border-left-color: #cbd5e1; }
.kp-card.m1 { border-left-color: var(--warn); }
.kp-card.m2 { border-left-color: var(--success); }
.kp-card .title { font-weight: 700; font-size: 14px; }
.kp-card .content {
  font-size: 12.5px; color: var(--text-2); line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.kp-card .foot { display: flex; align-items: center; gap: 6px; margin-top: 2px; flex-wrap: wrap; }
.mastery-btns { display: flex; gap: 4px; }
.mbtn {
  padding: 3px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; color: var(--text-3);
}
.mbtn.on[data-m="0"] { background: var(--surface-3); color: var(--text-2); border-color: #cbd5e1; }
.mbtn.on[data-m="1"] { background: var(--warn-soft); color: #b45309; border-color: #fcd34d; }
.mbtn.on[data-m="2"] { background: var(--success-soft); color: #047857; border-color: #6ee7b7; }

/* ===================== 计划看板 ===================== */
.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.kb-col {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
}
.kb-col-head { display: flex; align-items: center; gap: 8px; padding: 2px 6px 12px; }
.kb-col-head h4 { font-size: 13.5px; font-weight: 700; }
.kb-col-head .n { font-size: 11.5px; color: var(--text-3); }
.plan-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 13px 14px; margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.plan-card:last-child { margin-bottom: 0; }
.plan-card .pt { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.plan-card .pd { font-size: 12px; color: var(--text-3); margin: 4px 0 10px; }
.plan-task {
  display: flex; align-items: center; gap: 9px; padding: 5px 0; font-size: 13px;
}
.plan-task .t-title { flex: 1; min-width: 0; }

/* ===================== 答题 ===================== */
.quiz-setup { max-width: 560px; margin: 0 auto; }
.quiz-card { max-width: 780px; margin: 0 auto; }
.q-stem { font-size: 16px; font-weight: 600; line-height: 1.8; margin-bottom: 4px; }
.q-options { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.q-opt {
  display: flex; align-items: flex-start; gap: 11px; padding: 13px 15px;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  cursor: pointer; background: var(--surface); transition: all .15s; text-align: left;
}
.q-opt:hover { border-color: #a5b4fc; background: var(--surface-2); }
.q-opt.selected { border-color: var(--primary); background: var(--primary-soft); }
.q-opt.correct { border-color: var(--success); background: var(--success-soft); }
.q-opt.wrong { border-color: var(--danger); background: var(--danger-soft); }
.q-opt .letter {
  width: 24px; height: 24px; border-radius: 7px; flex: 0 0 auto;
  background: var(--surface-3); color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12.5px;
}
.q-opt.selected .letter { background: var(--primary); color: #fff; }
.q-opt.correct .letter { background: var(--success); color: #fff; }
.q-opt.wrong .letter { background: var(--danger); color: #fff; }
.q-opt .txt { flex: 1; line-height: 1.7; }
.analysis {
  margin-top: 16px; padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--info-soft); border: 1px solid #bae6fd; font-size: 13.5px; line-height: 1.8;
}
.analysis .at { font-weight: 700; color: #0369a1; margin-bottom: 4px; }

.result-hero { text-align: center; padding: 30px 20px; }
.result-hero .score { font-size: 56px; font-weight: 800; letter-spacing: -2px; line-height: 1; }
.result-hero .score small { font-size: 20px; color: var(--text-3); font-weight: 700; }

.q-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.q-nav button {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-2);
}
.q-nav button.done { background: var(--primary-soft); border-color: var(--primary-soft-2); color: var(--primary); }
.q-nav button.right { background: var(--success-soft); border-color: #6ee7b7; color: #047857; }
.q-nav button.wrong { background: var(--danger-soft); border-color: #fca5a5; color: #b91c1c; }
.q-nav button.cur { outline: 2px solid var(--primary); outline-offset: 1px; }

/* ===================== 模态框 / Toast ===================== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .45);
  backdrop-filter: blur(3px); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade .18s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 520px;
  max-height: 88vh; display: flex; flex-direction: column;
  animation: pop .22s cubic-bezier(.2, .9, .3, 1.2) both;
}
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
.modal-head {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-head .x {
  margin-left: auto; width: 30px; height: 30px; border-radius: 8px;
  border: none; background: var(--surface-3); cursor: pointer; font-size: 16px; color: var(--text-2);
}
.modal-head .x:hover { background: var(--border); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

.toast-wrap {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  background: #111827; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13.5px; box-shadow: var(--shadow-lg);
  animation: toastIn .25s ease both;
}
.toast.ok { background: #047857; }
.toast.err { background: #b91c1c; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* 计时器 */
.timer-card {
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  border: 1px solid var(--primary-soft-2);
}
.timer-num {
  font-size: 38px; font-weight: 800; letter-spacing: -1px;
  font-variant-numeric: tabular-nums; color: var(--primary); line-height: 1.1;
}

/* 表格 */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; padding: 10px 14px; font-size: 12px; font-weight: 600;
  color: var(--text-3); border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }

/* 分布条 */
.dist { display: flex; height: 12px; border-radius: 20px; overflow: hidden; background: var(--surface-3); }
.dist > i { display: block; height: 100%; }
.dist-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.dist-legend .item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.dist-legend .sw { width: 10px; height: 10px; border-radius: 3px; }

/* ===================== 全局搜索 ===================== */
.gsearch { position: relative; }
.gsearch .input { width: 250px; padding-left: 32px; }
.gsearch::before {
  content: "⌕"; position: absolute; left: 11px; top: 50%; transform: translateY(-52%);
  color: var(--text-3); font-size: 15px; pointer-events: none;
}
.gsearch-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: 380px; max-height: 420px;
  overflow-y: auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 60; padding: 8px;
}
.sp-group { margin-bottom: 6px; }
.sp-title {
  font-size: 11px; font-weight: 700; color: var(--text-3);
  padding: 6px 10px 4px; letter-spacing: .04em;
}
.sp-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px;
  cursor: pointer; font-size: 13px;
}
.sp-item:hover { background: var(--primary-soft); }
.sp-item .sp-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-item .sp-meta { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.sp-empty { padding: 18px 10px; text-align: center; color: var(--text-3); font-size: 13px; }

/* 节点管理行 */
.ms-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }

/* ===================== 引导页 ===================== */
body.ob-mode .sidebar, body.ob-mode .topbar { display: none; }
body.ob-mode .main { margin-left: 0; }
body.ob-mode { background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 45%, #f0f9ff 100%); }

.ob-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 30px 16px;
}
.ob-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 24px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; overflow: hidden;
}
.ob-brand { display: flex; align-items: center; gap: 12px; padding: 24px 26px 18px; }
.ob-steps {
  display: flex; gap: 8px; padding: 0 26px 18px; border-bottom: 1px solid var(--border);
}
.ob-step {
  flex: 1; font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; font-weight: 500;
}
.ob-step .dot {
  width: 20px; height: 20px; border-radius: 50%; background: var(--surface-3);
  color: var(--text-3); display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex: 0 0 auto;
}
.ob-step.active { color: var(--primary); font-weight: 700; }
.ob-step.active .dot { background: var(--primary); color: #fff; }
.ob-step.done { color: var(--success); }
.ob-step.done .dot { background: var(--success); color: #fff; }

.ob-body { padding: 22px 26px; }
.ob-title { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.ob-foot {
  padding: 16px 26px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; background: var(--surface-2);
}

.ob-subjects { display: flex; flex-direction: column; gap: 10px; }
.ob-sub {
  display: flex; align-items: center; gap: 11px; padding: 13px 14px;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; text-align: left; transition: all .15s;
}
.ob-sub:hover { border-color: #a5b4fc; }
.ob-sub.on { border-color: var(--primary); background: var(--primary-soft); }
.ob-check {
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; flex: 0 0 auto;
}
.ob-sub.on .ob-check { background: var(--primary); border-color: var(--primary); }

.ob-summary { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.ob-row {
  display: flex; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.ob-row:last-child { border-bottom: none; }
.ob-row .k { color: var(--text-3); flex: 0 0 80px; }
.ob-row .v { flex: 1; font-weight: 600; word-break: break-all; }

.ob-preview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.ob-pv {
  background: var(--primary-soft); border-radius: var(--radius-sm);
  padding: 14px 10px; text-align: center;
}
.ob-pv .n { font-size: 22px; font-weight: 800; color: var(--primary); line-height: 1.2; }
.ob-pv .l { font-size: 11.5px; color: var(--text-2); margin-top: 4px; line-height: 1.4; }

/* ===================== 逾期 / 日期标记 ===================== */
.due-tag {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; white-space: nowrap;
}
.due-today { background: var(--primary-soft); color: var(--primary); }
.due-over { background: var(--danger-soft); color: #b91c1c; }
.due-future { background: var(--surface-3); color: var(--text-3); }
.due-done { background: var(--success-soft); color: #047857; }

/* ===================== 资料章节清单 ===================== */
.units { margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 10px; }
.unit-item {
  display: flex; align-items: center; gap: 9px; padding: 5px 0; font-size: 12.5px; cursor: pointer;
}
.unit-item:hover { color: var(--primary); }
.unit-item.done .u-title { color: var(--text-3); text-decoration: line-through; }
.units-toggle {
  background: none; border: none; color: var(--primary); font-size: 12px;
  cursor: pointer; padding: 0; font-weight: 600;
}

/* ===================== 响应式 ===================== */
@media (max-width: 1100px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar {
    width: 100%; height: auto; bottom: auto; top: auto;
    position: fixed; border-right: none; border-top: 1px solid var(--border);
    flex-direction: row; padding: 6px 8px; gap: 4px;
    box-shadow: 0 -2px 14px rgba(16, 24, 40, .08);
  }
  .brand, .nav-label, .sidebar-foot, .nav-item .badge { display: none; }
  .nav { flex-direction: row; margin: 0; width: 100%; justify-content: space-around; gap: 2px; }
  .nav-item { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11px; border-radius: 10px; }
  .nav-item .ic { font-size: 18px; }
  .main { margin-left: 0; padding-bottom: 68px; }
  .content { padding: 16px 14px 40px; }
  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 17px; }
  .g-2, .g-3, .g-4, .g-split, .g-split2 { grid-template-columns: minmax(0, 1fr); }
  .hero { padding: 20px; }
  .countdown { margin-left: 0; width: 100%; }
  .mobile-only { display: block; }
  .desktop-only { display: none; }
  .gsearch { display: none; }
  .nav-item { font-size: 10.5px; }
}
