/* 知序 · 今天 / 计划 / 复盘外壳。依赖 ui.css 的 token。 */

/* ---------- 今天 ---------- */
.home-head { margin-bottom: 20px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.home-main { min-width: 0; container-type: inline-size; }
.home-side { display: grid; gap: 16px; position: sticky; top: 24px; }
@media (max-width: 1000px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .home-side { position: static; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }
}

.today-card { position: relative; padding: clamp(20px, 2.6vw, 28px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-md); overflow: hidden; }
.today-card.is-teacher { border-color: var(--seal-line); }
.today-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.today-number { font-size: 12px; color: var(--ink-3); }
.today-card > h2 { font-size: clamp(20px, 2.2vw, 24px); line-height: 1.35; font-weight: 700; letter-spacing: -0.005em; }
.today-meta { display: flex; flex-wrap: wrap; gap: 4px 0; margin-top: 8px; font-size: 14px; color: var(--ink-3); }
.today-meta span + span::before { content: "·"; margin: 0 8px; color: var(--ink-4); }
.today-flash { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 6px 10px; border-radius: var(--r-sm); background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 600; }
.today-progress { display: grid; gap: 8px; margin: 20px 0 18px; }
.today-progress span { font-size: 14px; color: var(--ink-2); }
.today-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.task-list { margin-top: 22px; border-top: 1px solid var(--line); }
.task-row { border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-row > summary { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto auto 20px; align-items: center; gap: 12px; min-height: 64px; padding: 10px 4px; list-style: none; border-radius: var(--r-sm); }
.task-row > summary:hover { background: var(--surface-2); }
.task-index { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--sunken); color: var(--ink-2); font-size: 13px; font-weight: 700; }
.task-row.is-ok .task-index { background: var(--ok-soft); color: var(--ok); }
.task-row.is-bad .task-index { background: var(--bad-soft); color: var(--bad); }
.task-row.is-pending .task-index, .task-row.is-partial .task-index { background: var(--warn-soft); color: var(--warn); }
.task-main { min-width: 0; display: grid; gap: 2px; }
.task-main strong { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-main small { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-state { font-size: 13px; color: var(--ink-3); min-width: 56px; text-align: right; }
.task-row.is-ok .task-state { color: var(--ok); }
.task-row.is-bad .task-state { color: var(--bad); font-weight: 600; }
.task-row.is-pending .task-state, .task-row.is-partial .task-state { color: var(--warn); }
.task-chevron { color: var(--ink-4); transition: transform 0.2s var(--ease); }
.task-row[open] .task-chevron { transform: rotate(180deg); }
.task-body { padding: 4px 4px 16px 48px; }
.task-stem { font-size: 15px; line-height: 1.75; color: var(--ink); padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); overflow-x: auto; }
.task-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; margin-left: -10px; }
.today-loading { display: grid; gap: 10px; margin-top: 16px; }
.skeleton { display: block; height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--sunken), var(--surface-2), var(--sunken)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skeleton.w40 { width: 40%; } .skeleton.w60 { width: 60%; } .skeleton.w80 { width: 80%; height: 44px; border-radius: var(--r-sm); margin-top: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.today-empty { display: grid; justify-items: start; gap: 12px; margin-top: 14px; color: var(--ink-2); font-size: 15px; }

.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tool-tile { position: relative; display: flex; align-items: center; gap: 0; min-height: 76px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); text-align: left; text-decoration: none; color: inherit; transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease); }
.tool-tile:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.tool-link { display: flex; align-items: center; gap: 14px; padding: 14px 16px; flex: 1; min-width: 0; text-decoration: none; color: inherit; border-radius: inherit; }
.tool-tile.tool-link { padding: 14px 16px; border-radius: var(--r-lg); }
.tool-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); flex: none; }
.tool-link strong { display: block; font-size: 15px; font-weight: 600; }
.tool-link small { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-3); line-height: 1.45; }
.tool-tile select { min-height: 36px; margin-right: 12px; padding: 4px 30px 4px 10px; font-size: 13px; border-radius: var(--r-xs); flex: none; }
@media (max-width: 560px) { .tool-grid { grid-template-columns: minmax(0, 1fr); } }
@container (max-width: 600px) { .tool-grid { grid-template-columns: minmax(0, 1fr); } }

.side-card { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.side-card > h2 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { display: grid; gap: 2px; padding: 12px; text-align: left; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease); }
.stat:hover { border-color: var(--line-strong); background: var(--surface); }
.stat b { font-size: 24px; line-height: 1.15; font-weight: 700; color: var(--ink); }
.stat span { font-size: 13px; color: var(--ink-2); }
.stat small { font-size: 11.5px; color: var(--ink-3); }
.stat.is-bad b { color: var(--bad); }
.stat.is-warn b { color: var(--warn); }
.weak { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.weak > span { width: 100%; font-size: 13px; color: var(--ink-3); }
.weak .chip { min-height: 32px; padding: 0 12px; font-size: 13px; }

.note-card { display: grid; gap: 8px; width: 100%; padding: 16px 18px; text-align: left; background: var(--surface); border: 1px solid var(--seal-line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); color: var(--ink); }
.note-card:hover { border-color: rgba(179, 68, 54, 0.36); }
.note-head { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--seal); }
.note-head .badge { margin-left: auto; background: rgba(255, 255, 255, 0.7); }
.note-text { font-size: 15px; line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.note-foot { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 600; color: var(--seal); }

/* 老师的安排（teacher-link.js 渲染） */
.teacher-plan { padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); font-size: 14px; }
.teacher-plan > p { color: var(--ink-3); }
.teacher-plan > details > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 28px; list-style: none; }
.teacher-plan > details > summary b { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; color: var(--ink); }
.teacher-plan > details > summary b::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--seal); }
.teacher-plan > details > summary small { font-size: 12px; color: var(--ink-3); }
.teacher-plan > details > summary small::after { content: " ▾"; }
.teacher-plan > details[open] > summary small::after { content: " ▴"; }
.teacher-plan h3 { margin: 14px 0 4px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.teacher-plan p { line-height: 1.7; color: var(--ink); white-space: pre-wrap; }
.teacher-plan ul { margin: 4px 0 0; padding-left: 1.1em; color: var(--ink-2); line-height: 1.7; }
.teacher-plan .secondary { margin-top: 14px; width: 100%; }
.teacher-plan .empty-note { margin-top: 10px; }
.teacher-student-slot:empty { display: none; }
body[data-page="plan"] .teacher-student-slot, body[data-page="diagnosis"] .teacher-student-slot { margin-top: 16px; }

/* ---------- 计划 ---------- */
.plan-calendar { padding: 14px 16px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.plan-date-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.plan-date-nav strong { flex: 1; font-size: var(--t-base); font-weight: 600; letter-spacing: -0.01em; text-align: center; color: var(--ink); }
.plan-date-nav .link-btn { min-width: 32px; min-height: 32px; padding: 0 6px; color: var(--ink-3); }
.plan-date-nav .link-btn:hover { color: var(--ink); background: var(--surface-2); }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; justify-items: center; }
.day {
  position: relative;
  display: grid; justify-items: center; align-content: center; gap: 3px;
  width: min(100%, 58px); min-height: 58px; padding: 6px 0;
  border-radius: var(--r-md); border: 1px solid transparent;
  color: var(--ink-2);
  transition: background-color 0.14s var(--ease), color 0.14s var(--ease), border-color 0.14s var(--ease), scale 0.1s var(--ease);
}
.day:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.day span { font-size: 11px; font-weight: 500; color: var(--ink-4); line-height: 1; }
.day b { font-size: 17px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.day.on {
  background: linear-gradient(180deg, var(--action-top) 0%, var(--action) 100%);
  color: #fff;
  border-color: rgba(8, 12, 20, 0.9);
  box-shadow: var(--shadow-btn-primary);
}
.day.on span { color: rgba(255, 255, 255, 0.68); }
.day.on::after {
  content: "";
  position: absolute;
  bottom: 5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #60a5fa;
}
.plan-main { margin-top: 16px; }
.plan-empty { display: grid; justify-items: start; gap: 8px; padding: 28px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); color: var(--ink-2); }
.plan-empty h2 { font-size: 17px; font-weight: 700; color: var(--ink); }
.plan-empty .secondary { margin-top: 6px; }
.plan-sheet { padding: clamp(20px, 2.6vw, 28px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-sm); }
.plan-sheet-eyebrow { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); font-size: 12px; font-weight: 600; margin-bottom: 12px; }
.plan-sheet h2 { font-size: clamp(20px, 2.2vw, 24px); font-weight: 700; line-height: 1.35; }
.plan-sheet-meta { margin-top: 8px; font-size: 14px; color: var(--ink-2); }
.plan-sheet-number { margin-top: 2px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; color: var(--ink-3); }
.plan-sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 20px; }
.plan-teacher-reason { margin: 0 0 14px; padding: 12px 14px; border-radius: var(--r-md); background: var(--seal-soft); color: var(--ink); font-size: 14px; line-height: 1.6; }
.plan-teacher-reason strong { color: var(--seal); }
.plan-task-list { list-style: none; margin: 0; padding: 0; counter-reset: plan-task; border-top: 1px solid var(--line); }
.plan-task-list li { position: relative; counter-increment: plan-task; padding: 14px 0 14px 44px; border-bottom: 1px solid var(--line); }
.plan-task-list li::before { content: counter(plan-task); position: absolute; left: 0; top: 14px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--sunken); color: var(--ink-2); font-size: 13px; font-weight: 700; }
.plan-task-list li > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.plan-task-list strong { font-size: 15px; font-weight: 600; }
.plan-task-list span { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.plan-task-list p { margin-top: 2px; font-size: 13px; color: var(--ink-3); }
.plan-time-note { margin-top: 12px; font-size: 12.5px; color: var(--ink-3); }
.plan-records { margin-top: 16px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.plan-records h2 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.plan-record-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.plan-record-row:first-of-type { border-top: 0; }
.plan-record-row strong { font-size: 14px; font-weight: 600; }
.plan-record-row p { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.plan-disclosure { margin-top: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.plan-disclosure > summary { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; min-height: 60px; padding: 14px 48px 14px 20px; position: relative; list-style: none; font-size: 15px; font-weight: 600; }
.plan-disclosure > summary::after { content: ""; position: absolute; right: 20px; top: 50%; width: 8px; height: 8px; margin-top: -6px; border-right: 2px solid var(--ink-4); border-bottom: 2px solid var(--ink-4); transform: rotate(45deg); transition: transform 0.2s var(--ease); }
.plan-disclosure[open] > summary::after { transform: rotate(-135deg); margin-top: -2px; }
.plan-disclosure > summary span { font-size: 13px; font-weight: 400; color: var(--ink-3); }
.plan-disclosure-body { display: grid; gap: 12px; padding: 0 20px 20px; font-size: 14px; color: var(--ink-2); line-height: 1.65; }
.plan-disclosure-body h3 { margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--ink); }
.plan-disclosure-body ol { padding-left: 1.3em; display: grid; gap: 4px; color: var(--ink); }
.plan-disclosure-body > .secondary { justify-self: start; }
.plan-settings { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 700px) {
  .week { gap: 2px; }
  .day { min-height: 52px; }
  .day b { font-size: 16px; }
  .plan-date-nav strong { font-size: 14px; }
  .plan-task-list li > div { flex-direction: column; gap: 2px; }
  .plan-sheet-actions > * { flex: 1 1 100%; }
  .today-actions > * { flex: 1 1 100%; }
  .task-row > summary { grid-template-columns: 28px minmax(0, 1fr) auto 16px; gap: 10px; }
  .task-row > summary .badge { display: none; }
  .task-body { padding-left: 4px; }
}

/* ---------- 复盘 ---------- */
.review-head { align-items: flex-end; }
.review-head .segmented { margin-bottom: 2px; }
@media (max-width: 700px) {
  .review-head .segmented { width: 100%; }
  .review-head .segmented > * { flex: 1; justify-content: center; padding: 0 8px; }
}

/* ---------- 练习专注模式外壳 ---------- */
body[data-page="practice"] { --rail: 0px; --tabbar: 0px; background: var(--bg); }
body[data-page="practice"] .app-rail, body[data-page="practice"] .mobile-brand, body[data-page="practice"] .mobile-tabs { display: none; }
body[data-page="practice"] #main {
  margin: 0; padding: 0 0 48px; min-height: 100vh;
  border-radius: 0; border: 0; box-shadow: none;
}
body[data-page="practice"] #main > * { max-width: none; }
body[data-page="practice"] .contextbar, body[data-page="mixed"] .contextbar {
  position: sticky; top: 0; z-index: 25; margin: 0; gap: 12px; min-height: calc(56px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  background: rgba(243, 244, 246, 0.88); backdrop-filter: saturate(1.5) blur(14px); -webkit-backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--line);
}
body[data-page="practice"] .context-page { display: none; }
.context-save { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); }
.context-save svg { color: var(--ok); }
@media (max-width: 520px) { .context-save { font-size: 0; } .context-save svg { width: 18px; height: 18px; } }
body[data-page="mixed"] #main > section { padding: 32px 0; color: var(--ink-2); }
body[data-page="tutor"] .context-page { display: none; }
[data-teacher-slot]:not(:has(.teacher-plan)) { display: none; }
