/* ==========================================================================
   研途 · 考研计划  v3.0
   纸感底色 + 墨色文字 + 深绿强调，干净、克制、适合长时间使用
   ========================================================================== */

:root {
  --bg: #f4f2ec;
  --bg-deep: #eeeae1;
  --card: #fffefb;
  --card-2: #fbfaf6;
  --line: #e5e0d4;
  --line-strong: #d5cfc0;
  --ink: #20262b;
  --ink-2: #49525a;
  --muted: #848b92;
  --muted-2: #a2a8ad;
  --accent: #2f6b5b;
  --accent-strong: #245247;
  --accent-soft: #e9f1ec;
  --accent-line: #cfe0d7;
  --warn: #b4552f;
  --warn-soft: #f9ede7;
  --warn-line: #eed8cc;
  --gold: #9b7a3b;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(32, 38, 43, .035), 0 18px 40px -30px rgba(32, 38, 43, .35);
  --shadow-lift: 0 2px 4px rgba(32, 38, 43, .04), 0 18px 36px -22px rgba(32, 38, 43, .28);
  --font: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --mono: "Cascadia Mono", "Consolas", "Sarasa Mono SC", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

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

button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: .5; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid #86b6a5;
  outline-offset: 2px;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

a { color: var(--accent); }

::selection { background: #cfe5d9; color: var(--ink); }

/* --------------------------------------------------------------------------
   骨架
   -------------------------------------------------------------------------- */
.app {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 16px 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #fbf9f4 0%, #f7f4ed 100%);
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px; }

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent);
  color: #f6f3e9;
  font-family: "STKaiti", "KaiTi", "STSong", "SimSun", serif;
  font-size: 23px;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 6px 16px -10px rgba(47, 107, 91, .8);
}

.brand-mark.lg { width: 54px; height: 54px; border-radius: 16px; font-size: 30px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.35; }
.brand-text strong { font-size: 16px; letter-spacing: .08em; font-weight: 650; }
.brand-text span { font-size: 11px; color: var(--muted); letter-spacing: .04em; }

.nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13.5px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.nav-item svg { width: 18px; height: 18px; color: var(--muted); transition: color .15s ease; }
.nav-item:hover { background: rgba(255, 255, 255, .7); color: var(--ink); }
.nav-item:hover svg { color: var(--ink-2); }

.nav-item.is-active {
  background: #fff;
  border-color: var(--line);
  color: var(--accent-strong);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(32, 38, 43, .04);
}
.nav-item.is-active svg { color: var(--accent); }

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }

.rail-count {
  padding: 12px 13px;
  border: 1px solid var(--accent-line);
  border-radius: 12px;
  background: var(--accent-soft);
}
.rail-count-label { font-size: 11px; color: var(--accent-strong); letter-spacing: .08em; }
.rail-count-num { display: flex; align-items: baseline; gap: 4px; margin: 1px 0 0; }
.rail-count-num b { font-size: 27px; line-height: 1.1; font-weight: 650; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.rail-count-num em { font-style: normal; font-size: 11px; color: var(--accent); }
.rail-count-date { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.rail-link {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
}
.rail-link svg { width: 15px; height: 15px; }
.rail-link:hover { background: rgba(255, 255, 255, .8); color: var(--ink-2); }
.rail-version { padding: 0 10px; font-size: 10.5px; color: var(--muted-2); letter-spacing: .04em; }

.workspace {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px 30px;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 0 14px;
  background: linear-gradient(180deg, rgba(244, 242, 236, .97) 62%, rgba(244, 242, 236, .78) 100%);
  backdrop-filter: blur(8px);
}

.headings { min-width: 0; }
.crumb { font-size: 11.5px; color: var(--muted); letter-spacing: .06em; margin-bottom: 2px; }
h1 { margin: 0; font-size: 27px; line-height: 1.2; font-weight: 650; letter-spacing: -.02em; }

.top-actions { display: flex; align-items: center; gap: 12px; flex: none; }

.today-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.35;
  padding-right: 14px;
  border-right: 1px solid var(--line);
}
.today-chip b { font-size: 13px; font-weight: 600; }
.today-chip span { font-size: 11px; color: var(--muted); }

.engine-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
  font-size: 12px;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.engine-pill:hover { border-color: var(--line-strong); }
.engine-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 107, 91, .13);
}
.engine-pill.is-off { color: var(--muted); background: var(--card-2); }
.engine-pill.is-off .engine-dot { background: var(--muted-2); box-shadow: 0 0 0 3px rgba(132, 139, 146, .12); }
.engine-pill.is-saving .engine-dot { animation: pulse 1s ease infinite; }

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

.mode-banner {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  margin: 0 0 14px;
  border: 1px solid var(--warn-line);
  border-radius: 10px;
  background: var(--warn-soft);
  color: #7e452b;
  font-size: 12px;
}
.mode-banner-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); flex: none; }
.mode-banner .link-btn { margin-left: auto; }

.link-btn {
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 5px;
}
.link-btn:hover { background: rgba(47, 107, 91, .08); }

.view { animation: view-in .22s ease both; }

@keyframes view-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.page-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 34px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 11px;
}

/* --------------------------------------------------------------------------
   通用组件
   -------------------------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.card-head h3 { margin: 0; font-size: 14px; font-weight: 650; letter-spacing: .01em; }
.card-head small { color: var(--muted); font-size: 11px; }
.card-sub { margin: -6px 0 12px; color: var(--muted); font-size: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--line-strong); background: #fdfcf9; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #f7f4ea; }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: #fff; border-color: var(--line); }
.btn.danger { color: var(--warn); border-color: var(--warn-line); background: #fff; }
.btn.danger:hover { background: var(--warn-soft); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12px; border-radius: 8px; }
.btn.sm svg { width: 14px; height: 14px; }
.btn.block { width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: #fff; border-color: var(--line); color: var(--ink); }

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 11px;
  background: #eae6dd;
}
.segmented button {
  height: 30px;
  min-width: 46px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.segmented button:hover { color: var(--ink-2); }
.segmented button.is-active {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(32, 38, 43, .08);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.pill.accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-strong); }
.pill.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }

.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input, .select { height: 38px; padding: 0 11px; }
.textarea { min-height: 92px; padding: 9px 11px; resize: vertical; line-height: 1.65; }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: #9bc4b3;
  box-shadow: 0 0 0 3px rgba(47, 107, 91, .09);
}
.select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23848b92' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 11.5px; color: var(--muted); letter-spacing: .03em; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }
.field + .field { margin-top: 12px; }
.form-row .field + .field { margin-top: 0; }

.progress {
  height: 5px;
  border-radius: 99px;
  background: #edeae2;
  overflow: hidden;
}
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .4s ease; }
.progress.warn > i { background: var(--warn); }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 38px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .45);
  text-align: center;
  color: var(--muted);
}
.empty svg { width: 26px; height: 26px; color: var(--muted-2); margin-bottom: 2px; }
.empty h4 { margin: 0; font-size: 13.5px; color: var(--ink-2); font-weight: 600; }
.empty p { margin: 0; font-size: 12px; max-width: 380px; }

/* --------------------------------------------------------------------------
   计划视图
   -------------------------------------------------------------------------- */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  padding: 13px 15px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card);
  box-shadow: var(--shadow);
  min-width: 0;
}
.stat-label { font-size: 11px; color: var(--muted); letter-spacing: .07em; }
.stat-value { display: flex; align-items: baseline; gap: 4px; margin: 1px 0 2px; font-size: 24px; font-weight: 650; line-height: 1.25; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-value em { font-style: normal; font-size: 11px; font-weight: 400; color: var(--muted); }
.stat-value .stat-accent { color: var(--accent); }
.stat-hint { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card .progress { margin-top: 8px; }

.plan-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.period {
  display: inline-flex;
  align-items: center;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.period .icon-btn { width: 32px; height: 34px; border-radius: 0; }
.period .icon-btn:hover { background: var(--card-2); border-color: transparent; }
.period-label {
  min-width: 132px;
  padding: 0 8px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.subject-filter {
  display: flex;
  gap: 6px;
  margin-left: auto;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
.filter-chip:hover { border-color: var(--line-strong); color: var(--ink-2); }
.filter-chip.is-active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-strong); font-weight: 600; }
.filter-chip i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .65; }

.plan-canvas { min-height: 340px; }

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

.tip-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--accent-line);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.tip-card > div:first-child { min-width: 0; }
.tip-card b { display: block; font-size: 12.5px; font-weight: 650; }
.tip-card span { display: block; font-size: 11.5px; color: var(--ink-2); line-height: 1.6; }
.tip-actions { margin-left: auto; display: flex; gap: 6px; flex: none; }

/* 年视图 */
.year-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.month-card {
  padding: 12px 13px 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card);
  box-shadow: var(--shadow);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.month-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-lift); }
.month-card.is-current { border-color: var(--accent-line); }

.month-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  padding: 0 2px;
  cursor: pointer;
  border-radius: 5px;
}
.month-card-head:hover b { color: var(--accent-strong); }
.month-card-head b { font-size: 13px; font-weight: 650; }
.month-card-head span { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.month-card-head button {
  border: 0;
  background: none;
  padding: 0;
  font-size: 10.5px;
  color: var(--muted);
  cursor: pointer;
}
.month-card-head button:hover { color: var(--accent); }

.mini-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mini-dow { font-size: 9.5px; color: var(--muted-2); text-align: center; padding: 1px 0 3px; }
.mini-day {
  position: relative;
  height: 25px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.mini-day:hover { background: #f1eee6; }
.mini-day.is-blank { visibility: hidden; pointer-events: none; }
.mini-day.has { background: var(--accent-soft); color: var(--accent-strong); font-weight: 650; }
.mini-day.done { background: var(--accent); color: #fff; font-weight: 650; }
.mini-day.today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.mini-day.done.today { box-shadow: inset 0 0 0 1.5px #fff, 0 0 0 1.5px var(--accent); }
.mini-day.exam { box-shadow: inset 0 0 0 1px var(--warn); color: var(--warn); }
.mini-day.exam.done { color: #fff; }

/* 月视图 */
.month-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 14px;
  overflow: hidden;
}
.month-week-head {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}
.month-week-head span { text-align: center; font-size: 11px; color: var(--muted); letter-spacing: .08em; padding: 2px 0; }
.month-week-head span.is-weekend { color: #a58a6d; }

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.day-cell {
  position: relative;
  min-height: 108px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 6px 7px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #fbfaf6;
  cursor: pointer;
  transition: background .13s ease, border-color .13s ease;
  overflow: hidden;
}
.day-cell:hover { background: #f7f4ed; border-color: var(--line); }
.day-cell:hover .day-count { opacity: 0; }
.day-count { transition: opacity .12s ease; }
.day-cell.is-other { opacity: .45; }
.day-cell.is-today { background: #f2f8f4; border-color: var(--accent-line); }
.day-cell.is-weekend { background: #faf7f1; }
.day-cell.drop-hover { background: var(--accent-soft); border-color: var(--accent); border-style: dashed; opacity: 1; }

.day-cell-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: 19px; }
.day-num {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.is-today .day-num { background: var(--accent); color: #fff; }
.day-count { font-size: 10px; color: var(--muted-2); font-variant-numeric: tabular-nums; }

.cell-add {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  cursor: pointer;
  transition: opacity .12s ease;
  z-index: 2;
}
.day-cell:hover .cell-add { opacity: 1; }
.cell-add:hover { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

.chip {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink-2);
  font-size: 10.5px;
  line-height: 1.5;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}
.chip span { overflow: hidden; text-overflow: ellipsis; }
.chip i { width: 5px; height: 5px; border-radius: 50%; background: var(--subj, var(--muted)); flex: none; }
.chip:hover { border-color: var(--line-strong); }
.chip.is-done { background: #f6f5f0; color: var(--muted); border-color: #eeeae0; }
.chip.is-done span { text-decoration: line-through; }
.chip.dragging { opacity: .5; }
.chip-more { font-size: 10px; color: var(--muted); padding: 1px 4px; text-align: left; }

/* 周视图 */
.week-scroll { overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.week-scroll::-webkit-scrollbar { height: 8px; }
.week-scroll::-webkit-scrollbar-thumb { background: #d8d2c4; border-radius: 99px; }
.week-scroll::-webkit-scrollbar-track { background: transparent; }
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(136px, 1fr));
  gap: 10px;
  min-width: 980px;
}
.week-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 370px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
  transition: border-color .13s ease, background .13s ease;
}
.week-col.is-today { border-color: var(--accent-line); background: #fbfdfb; }
.week-col.drop-hover { background: var(--accent-soft); border-color: var(--accent); border-style: dashed; }
.week-col-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 6px; border-bottom: 1px solid var(--line); }
.week-col-head b { font-size: 11px; color: var(--muted); font-weight: 500; letter-spacing: .06em; }
.week-col-head span { font-size: 17px; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.week-col.is-today .week-col-head span { color: var(--accent); }
.week-col-head .week-add {
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  opacity: 0;
  cursor: pointer;
}
.week-col:hover .week-add { opacity: 1; }
.week-col-head .week-add:hover { color: var(--accent); border-color: var(--accent-line); }
.week-col-head > div { display: flex; align-items: center; gap: 6px; }

.week-task {
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  font-size: 11px;
  line-height: 1.45;
  cursor: pointer;
  transition: border-color .12s ease;
}
.week-task:hover { border-color: var(--line-strong); }
.week-task.is-done { background: #f6f5f0; color: var(--muted); }
.week-task.is-done .week-task-title { text-decoration: line-through; }
.week-task-title { display: block; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.week-task-meta { display: flex; align-items: center; gap: 4px; margin-top: 3px; font-size: 10px; color: var(--muted); }
.week-task-meta i { width: 5px; height: 5px; border-radius: 50%; background: var(--subj, var(--muted)); }
.week-empty {
  margin: 4px 0 0;
  padding: 14px 6px;
  border: 1px dashed #e8e4da;
  border-radius: 7px;
  color: var(--muted-2);
  font-size: 10.5px;
  text-align: center;
}

/* 日视图 */
.day-grid { display: grid; grid-template-columns: minmax(0, 1fr) 296px; gap: 16px; align-items: start; }

.day-main { padding: 18px 18px 14px; }
.day-main-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.day-main-head h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
.day-main-head h2 span { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 8px; }
.day-main-head .day-progress { font-size: 11.5px; color: var(--muted); text-align: right; }
.day-main-head .day-progress b { color: var(--accent-strong); font-variant-numeric: tabular-nums; }

.task-list { display: flex; flex-direction: column; gap: 8px; min-height: 50px; }
.task-list.drop-hover { border-radius: 10px; }
.task-list.drop-hover::after { content: ""; display: block; height: 2px; border-radius: 2px; background: var(--accent); }

.day-side { display: flex; flex-direction: column; gap: 12px; }

.checkin-card { display: flex; align-items: center; gap: 13px; padding: 15px 16px; }
.checkin-ring {
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px dashed var(--line-strong);
  color: var(--muted);
  background: var(--card-2);
}
.checkin-ring svg { width: 20px; height: 20px; }
.checkin-card.is-done .checkin-ring { border-style: solid; border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.checkin-card h4 { margin: 0 0 1px; font-size: 13px; font-weight: 600; }
.checkin-card p { margin: 0; font-size: 11px; color: var(--muted); }

.goal-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.goal-line b { color: var(--ink); font-variant-numeric: tabular-nums; }

.review-preview p { margin: 0 0 8px; font-size: 12px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.review-preview .muted { color: var(--muted); }

/* --------------------------------------------------------------------------
   任务卡片
   -------------------------------------------------------------------------- */
.task-card {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  transition: border-color .13s ease, box-shadow .13s ease, background .13s ease;
}
.task-card:hover { border-color: var(--line-strong); box-shadow: 0 8px 20px -18px rgba(32, 38, 43, .4); }
.task-card.is-done { background: #fbfaf7; }
.task-card.is-done .task-title { text-decoration: line-through; color: var(--muted); }
.task-card.dragging { opacity: .4; }

.grip {
  width: 12px;
  align-self: stretch;
  display: grid;
  place-items: center;
  color: #cfcabd;
  cursor: grab;
  font-size: 13px;
  letter-spacing: -2px;
  user-select: none;
  opacity: 0;
  transition: opacity .13s ease;
}
.task-card:hover .grip { opacity: 1; }

.check {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1.5px solid #c9c4b7;
  border-radius: 50%;
  background: #fff;
  color: transparent;
  cursor: pointer;
  transition: background .13s ease, border-color .13s ease, color .13s ease;
}
.check svg { width: 12px; height: 12px; stroke-width: 2.4; }
.check:hover { border-color: var(--accent); color: var(--accent); }
.is-done .check { background: var(--accent); border-color: var(--accent); color: #fff; }

.task-body { flex: 1; min-width: 0; cursor: pointer; }
.task-title { margin: 0; font-size: 13.5px; font-weight: 600; line-height: 1.45; word-break: break-word; }
.task-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 9px; margin-top: 3px; font-size: 11px; color: var(--muted); }
.task-meta .subj { display: inline-flex; align-items: center; gap: 4px; }
.task-meta .subj i { width: 6px; height: 6px; border-radius: 50%; background: var(--subj, var(--muted)); }
.task-meta .goal { display: inline-flex; align-items: center; gap: 3px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-meta .goal svg { width: 11px; height: 11px; }
.task-note {
  margin: 4px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}

.pri {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 5px;
  border-radius: 5px;
  font-size: 10px;
  line-height: 1;
}
.pri-1 { background: #f7f0df; color: #8b6a2b; }
.pri-2 { background: var(--warn-soft); color: var(--warn); }

.task-tools { display: flex; gap: 1px; opacity: 0; transition: opacity .13s ease; }
.task-card:hover .task-tools { opacity: 1; }
.task-tools .icon-btn { width: 26px; height: 26px; border-radius: 6px; }
.task-tools .icon-btn svg { width: 14px; height: 14px; }
.task-tools .icon-btn.del:hover { color: var(--warn); background: var(--warn-soft); }

.add-inline {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  margin-top: 9px;
  padding: 9px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.add-inline:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.add-inline svg { width: 14px; height: 14px; }

/* --------------------------------------------------------------------------
   任务视图
   -------------------------------------------------------------------------- */
.list-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.list-toolbar .search {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}
.list-toolbar .search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted);
}
.list-toolbar .search .input { padding-left: 32px; height: 34px; font-size: 12.5px; }
.list-toolbar .select { height: 34px; width: auto; min-width: 104px; font-size: 12.5px; }

.task-groups { display: flex; flex-direction: column; gap: 18px; }
.task-group-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.task-group-head b { font-size: 13px; font-weight: 650; }
.task-group-head span { font-size: 11px; color: var(--muted); }
.task-group-head .today-tag { margin-left: auto; }
.task-group .task-list { gap: 7px; }

/* --------------------------------------------------------------------------
   复盘
   -------------------------------------------------------------------------- */
.review-grid { display: grid; grid-template-columns: minmax(0, 430px) minmax(0, 1fr); gap: 16px; align-items: start; }

.review-form .field + .field { margin-top: 12px; }
.review-form .textarea { min-height: 76px; }

.mood-row { display: flex; gap: 6px; }
.mood-btn {
  flex: 1;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}
.mood-btn:hover { border-color: var(--line-strong); color: var(--ink-2); }
.mood-btn.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); font-weight: 600; }

.review-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.review-actions .spacer { flex: 1; }

.review-history { display: flex; flex-direction: column; gap: 10px; }
.review-item { padding: 14px 16px; }
.review-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.review-item-head b { font-size: 13px; font-weight: 650; }
.review-item-head .mood { margin-left: auto; }
.review-item .row { display: flex; gap: 8px; margin-top: 7px; font-size: 12px; line-height: 1.6; }
.review-item .row > span:first-child { flex: none; width: 62px; color: var(--muted); font-size: 11px; padding-top: 1px; }
.review-item .row > p { margin: 0; white-space: pre-wrap; word-break: break-word; color: var(--ink-2); }
.review-item .item-tools { display: flex; gap: 2px; opacity: 0; }
.review-item:hover .item-tools { opacity: 1; }

/* --------------------------------------------------------------------------
   实时总结
   -------------------------------------------------------------------------- */
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.span-2 { grid-column: span 2; }

.live-head { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); }
.live-head .right { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; }
.live-head .right .icon-btn { width: 26px; height: 26px; }
.live-head .right .icon-btn svg { width: 14px; height: 14px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(47, 107, 91, .12); animation: live 2.4s ease infinite; }
@keyframes live {
  0%, 100% { box-shadow: 0 0 0 3px rgba(47, 107, 91, .12); }
  50% { box-shadow: 0 0 0 6px rgba(47, 107, 91, .04); }
}

.summary-hero {
  background: linear-gradient(155deg, #fbfdfb 0%, #f4f9f5 46%, #fffefb 100%);
  border-color: var(--accent-line);
}
.summary-hero h2 { margin: 4px 0 2px; font-size: 20px; letter-spacing: -.01em; }
.summary-hero .hero-sub { color: var(--muted); font-size: 12px; }
.hero-metrics { display: flex; flex-wrap: wrap; gap: 10px 26px; margin: 15px 0 13px; }
.hero-metric { display: flex; flex-direction: column; gap: 1px; }
.hero-metric b { font-size: 22px; line-height: 1.2; font-weight: 650; font-variant-numeric: tabular-nums; }
.hero-metric span { font-size: 10.5px; color: var(--muted); letter-spacing: .04em; }
.auto-lines { display: flex; flex-direction: column; gap: 5px; }
.auto-line { display: flex; gap: 8px; font-size: 12.5px; color: var(--ink-2); line-height: 1.65; }
.auto-line::before { content: ""; width: 4px; height: 4px; margin-top: 8px; border-radius: 50%; background: var(--accent); opacity: .65; flex: none; }

.trend { display: flex; align-items: flex-end; gap: 8px; height: 124px; padding-top: 6px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; min-width: 0; }
.trend-bar { width: 100%; max-width: 30px; border-radius: 5px 5px 3px 3px; background: var(--accent); opacity: .88; min-height: 4px; margin-top: auto; }
.trend-bar.is-zero { background: var(--accent-soft); opacity: 1; }
.trend-col.is-today .trend-bar { outline: 1.5px solid var(--accent); outline-offset: 2px; }
.trend-num { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 14px; }
.trend-day { font-size: 10px; color: var(--muted-2); }
.trend-col.is-today .trend-day { color: var(--accent-strong); font-weight: 600; }

.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 64px 1fr 44px; align-items: center; gap: 9px; font-size: 11.5px; }
.bar-row .bar-name { color: var(--ink-2); display: flex; align-items: center; gap: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .bar-name i { width: 6px; height: 6px; border-radius: 50%; background: var(--subj, var(--muted)); flex: none; }
.bar-row .bar-track { height: 6px; border-radius: 99px; background: #eeebe3; overflow: hidden; }
.bar-row .bar-track > i { display: block; height: 100%; border-radius: inherit; background: var(--subj, var(--accent)); }
.bar-row .bar-val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 10.5px; }

.focus-list { display: flex; flex-direction: column; gap: 8px; }
.focus-item { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.focus-item .date { flex: none; width: 46px; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.focus-item .body { flex: 1; min-width: 0; }
.focus-item .body b { display: block; font-size: 12px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-item .body span { font-size: 10.5px; color: var(--muted); }
.focus-item .check { width: 18px; height: 18px; }

.kform { display: grid; grid-template-columns: 1.1fr .9fr; gap: 9px; margin-bottom: 12px; }
.kform .textarea { grid-column: span 2; min-height: 64px; }
.kform .actions { grid-column: span 2; display: flex; justify-content: flex-end; gap: 8px; }
.knowledge-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.knowledge-tools .search { position: relative; flex: 1; max-width: 260px; }
.knowledge-tools .search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--muted); }
.knowledge-tools .input { height: 32px; font-size: 12px; padding-left: 30px; }
.knowledge-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.knowledge-item { padding: 12px 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; position: relative; }
.knowledge-item:hover { border-color: var(--line-strong); }
.knowledge-item h4 { margin: 0 0 3px; font-size: 12.5px; font-weight: 650; padding-right: 36px; word-break: break-word; }
.knowledge-item p { margin: 0; font-size: 11.5px; color: var(--muted); line-height: 1.6; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.knowledge-item .kmeta { display: flex; align-items: center; gap: 6px; margin-top: 7px; font-size: 10px; color: var(--muted-2); }
.knowledge-item .kmeta .subj { display: inline-flex; align-items: center; gap: 4px; }
.knowledge-item .kmeta i { width: 5px; height: 5px; border-radius: 50%; background: var(--subj, var(--muted)); }
.knowledge-item .item-tools { position: absolute; right: 6px; top: 6px; display: flex; gap: 0; opacity: 0; }
.knowledge-item:hover .item-tools { opacity: 1; }
.knowledge-item .item-tools .icon-btn { width: 24px; height: 24px; }
.knowledge-item .item-tools svg { width: 13px; height: 13px; }

/* --------------------------------------------------------------------------
   控制台
   -------------------------------------------------------------------------- */
.console-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }

.power-card {
  grid-column: span 2;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 22px;
  background: linear-gradient(150deg, #fffefb, #f7faf7);
  border-color: var(--accent-line);
}
.power-card.is-off { background: linear-gradient(150deg, #fffefb, #f7f5ef); border-color: var(--line); }
.power-info { flex: 1; min-width: 0; }
.power-info h3 { margin: 0 0 3px; font-size: 16px; letter-spacing: -.01em; }
.power-info p { margin: 0; font-size: 12px; color: var(--muted); }
.power-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.power-meta b { color: var(--ink-2); font-weight: 550; }

.switch {
  position: relative;
  width: 62px;
  height: 34px;
  flex: none;
  border: 0;
  border-radius: 99px;
  background: #d9d4c7;
  cursor: pointer;
  transition: background .2s ease;
  padding: 0;
}
.switch::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(32, 38, 43, .25);
  transition: transform .2s ease;
}
.switch.is-on { background: var(--accent); }
.switch.is-on::after { transform: translateX(28px); }

.console-list { display: flex; flex-direction: column; gap: 0; }
.console-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px solid #f0ece4; font-size: 12px; }
.console-row:last-child { border-bottom: 0; }
.console-row > span:first-child { color: var(--muted); flex: none; }
.console-row > span:last-child { text-align: right; color: var(--ink-2); word-break: break-all; font-variant-numeric: tabular-nums; max-width: 76%; }
.console-row code { font-family: var(--mono); font-size: 10.5px; background: #f6f3ec; padding: 1px 5px; border-radius: 4px; color: var(--ink-2); display: inline-block; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }

.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.status-box { padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--card-2); }
.status-box span { display: block; font-size: 10px; color: var(--muted); letter-spacing: .04em; }
.status-box b { font-size: 12px; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.settings-block { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.settings-block .field.full { grid-column: span 2; }
.subject-edit { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.subject-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 6px 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  font-size: 11.5px;
}
.subject-tag i { width: 6px; height: 6px; border-radius: 50%; background: var(--subj, var(--muted)); }
.subject-tag button { border: 0; background: none; color: var(--muted-2); font-size: 13px; line-height: 1; padding: 2px; cursor: pointer; border-radius: 4px; }
.subject-tag button:hover { color: var(--warn); background: var(--warn-soft); }
.subject-add { display: flex; gap: 6px; margin-top: 8px; }
.subject-add .input { height: 32px; font-size: 12px; }
.subject-add .btn { height: 32px; }

.settings-actions { display: flex; justify-content: flex-end; margin-top: 12px; }

.data-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.data-actions .btn { height: 32px; font-size: 12px; }

.backups { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.backups summary { cursor: pointer; font-size: 12px; color: var(--ink-2); list-style: none; display: flex; align-items: center; gap: 6px; }
.backups summary::-webkit-details-marker { display: none; }
.backups summary::before { content: "›"; color: var(--muted); transition: transform .15s ease; display: inline-block; }
.backups[open] summary::before { transform: rotate(90deg); }
.backup-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; max-height: 200px; overflow: auto; }
.backup-row { display: flex; align-items: center; gap: 8px; padding: 5px 7px; border-radius: 6px; font-size: 11px; }
.backup-row:hover { background: var(--card-2); }
.backup-row .bname { font-family: var(--mono); font-size: 10px; color: var(--ink-2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backup-row .btime { color: var(--muted); font-size: 10px; white-space: nowrap; }
.backup-row .btn { height: 24px; padding: 0 8px; font-size: 10.5px; }

.debug-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.test-list { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.test-row { display: flex; align-items: center; gap: 8px; padding: 5px 7px; border-radius: 6px; font-size: 11.5px; }
.test-row:nth-child(odd) { background: #fbfaf6; }
.test-dot { width: 8px; height: 8px; border-radius: 50%; background: #ddd8ca; flex: none; }
.test-row.is-running .test-dot { background: var(--gold); animation: pulse 1s ease infinite; }
.test-row.is-pass .test-dot { background: var(--accent); }
.test-row.is-fail .test-dot { background: var(--warn); }
.test-row .tname { flex: 1; color: var(--ink-2); }
.test-row .tdetail { color: var(--muted); font-size: 10.5px; }
.test-row.is-fail .tdetail { color: var(--warn); }

.debug-log {
  height: 190px;
  overflow: auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8f6f0;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.65;
  color: #5a6168;
}
.log-line { display: flex; gap: 7px; white-space: pre-wrap; word-break: break-word; }
.log-line .lt { color: #a3a094; flex: none; }
.log-line.warn { color: var(--warn); }
.log-line.ok { color: var(--accent-strong); }

.danger-card { border-color: var(--warn-line); background: #fffdfb; }
.danger-card h3 { color: var(--warn); }
.danger-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }

/* --------------------------------------------------------------------------
   弹层 / 提示
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(25, 30, 33, .34);
  backdrop-filter: blur(3px);
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 30px 70px -24px rgba(25, 30, 33, .45);
  animation: modal-in .18s cubic-bezier(.2, .8, .3, 1);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 20px 0;
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.modal-body { padding: 16px 20px 20px; }

.modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.modal-actions .spacer { flex: 1; }

.confirm-msg { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.75; }
.confirm-note { margin: 8px 0 0; font-size: 11.5px; color: var(--warn); }

.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(460px, 86vw);
  padding: 9px 14px;
  border-radius: 10px;
  background: #262c31;
  color: #f4f1e8;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 12px 30px -14px rgba(0, 0, 0, .5);
  animation: toast-in .2s ease;
}
.toast svg { width: 14px; height: 14px; color: #9fd2bd; }
.toast.is-warn svg { color: #efb08e; }
.toast.is-out { animation: toast-out .25s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

.stopped-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.stopped-card {
  width: min(430px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 34px 30px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  text-align: center;
  box-shadow: var(--shadow-lift);
}
.stopped-card h2 { margin: 4px 0 0; font-size: 19px; }
.stopped-card p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.8; }
.stopped-card small { font-size: 11px; color: var(--muted-2); }
.stopped-actions { display: flex; gap: 8px; margin: 6px 0; }

/* 行内小工具 */
.muted { color: var(--muted); }
.small { font-size: 11px; }
.nowrap { white-space: nowrap; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }

/* --------------------------------------------------------------------------
   响应式
   -------------------------------------------------------------------------- */
@media (max-width: 1120px) {
  .workspace { padding: 0 22px 26px; }
  .year-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .day-grid { grid-template-columns: minmax(0, 1fr) 270px; }
  .summary-grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: span 1; }
  .knowledge-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }  .rail {
    position: sticky;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }
  .brand { flex: none; }
  .brand-text span { display: none; }
  .brand-mark { width: 34px; height: 34px; font-size: 19px; }
  .nav { flex-direction: row; gap: 2px; flex: 1; }
  .nav-item { height: 36px; padding: 0 10px; flex: none; }
  .nav-item.is-active::before { display: none; }
  .nav-item span { font-size: 12.5px; }
  .rail-foot { display: none; }
  .workspace { padding: 0 18px 24px; }
  .topbar { padding-top: 16px; align-items: flex-start; }
  .today-chip { display: none; }
  h1 { font-size: 23px; }
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .day-grid, .review-grid { grid-template-columns: minmax(0, 1fr); }
  .console-grid { grid-template-columns: minmax(0, 1fr); }
  .power-card { grid-column: span 1; }
  .page-foot { flex-direction: column; gap: 4px; }
}

@media (max-width: 780px) {
  .year-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .workspace { padding: 0 13px 20px; }
  .top-actions { gap: 7px; }
  .engine-pill { padding: 0 9px; }
  #engineText { display: none; }
  .btn { padding: 0 11px; }
  .plan-toolbar { gap: 7px; }
  .period-label { min-width: 104px; }
  .subject-filter { margin-left: 0; width: 100%; }
  .month-grid { gap: 3px; }
  .month-week-head { gap: 3px; }
  .day-cell { min-height: 84px; padding: 4px; border-radius: 7px; }
  .chip { font-size: 9.5px; padding: 1px 3px; }
  .year-grid { grid-template-columns: minmax(0, 1fr); }
  .month-card { padding: 12px; }
  .mini-day { height: 30px; font-size: 11.5px; }
  .form-row, .form-row.three, .settings-block, .kform { grid-template-columns: minmax(0, 1fr); }
  .form-row .field + .field { margin-top: 12px; }
  .kform .textarea, .kform .actions, .settings-block .field.full { grid-column: span 1; }
  .modal-backdrop { padding: 12px; }
  .modal-body { padding: 14px; }
  .hero-metrics { gap: 10px 18px; }
  .task-tools, .review-item .item-tools { opacity: 1; }
  .grip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ==========================================================================
   手机离线版（Android WebView）
   ========================================================================== */
@media (max-width: 640px) {
  .brand-text { display: none; }
  .rail { padding: 8px 10px; gap: 8px; }
  .nav { gap: 2px; }
  .nav-item { height: 36px; padding: 0 8px; gap: 6px; }
  .nav-item svg { width: 16px; height: 16px; }
  .nav-item span { font-size: 12px; }
  .workspace { padding: 0 12px 22px; }
  .topbar { padding: 12px 0 10px; gap: 8px; }
  .crumb { display: none; }
  h1 { font-size: 21px; }
  .top-actions { gap: 6px; }
  .btn { height: 34px; padding: 0 10px; font-size: 12.5px; }
  .segmented button { min-width: 38px; padding: 0 10px; }
  .period-label { min-width: 88px; padding: 0 4px; font-size: 11.5px; }
  .stat-card { padding: 11px 12px; }
  .stat-value { font-size: 21px; }
  .month-wrap { overflow: auto; }
  .month-week-head, .month-grid { min-width: 620px; }
  .month-grid, .month-week-head { gap: 4px; }
  .day-cell { min-height: 84px; }
  .task-tools { opacity: 1; }
  .review-item .item-tools, .knowledge-item .item-tools { opacity: 1; }
  .grip { display: none; }
  .page-foot { display: none; }
  .console-row > span:last-child { max-width: 68%; }
  .modal-backdrop { padding: 10px; align-items: end; }
  .modal { max-height: calc(100vh - 20px); border-radius: 18px 18px 14px 14px; }
  .input, .select, .textarea { font-size: 16px; }
  .kform { grid-template-columns: 1fr; }
  .kform .textarea, .kform .actions { grid-column: span 1; }
  .tip-card { align-items: flex-start; flex-direction: column; gap: 8px; }
  .tip-actions { margin-left: 0; }
  .hero-metrics { gap: 12px 20px; }
}

@media (hover: none) {
  .task-tools { opacity: 1; }
  .review-item .item-tools, .knowledge-item .item-tools { opacity: 1; }
  .grip { display: none; }
  .check { width: 24px; height: 24px; }
  .task-tools .icon-btn { width: 30px; height: 30px; }
}

/* 手机端宽度修正：避免横向 flex 内容把整页撑宽 */
@media (max-width: 920px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { min-width: 0; }
  .nav { min-width: 0; }
}

@media (max-width: 640px) {
  .brand-mark { width: 30px; height: 30px; font-size: 17px; border-radius: 9px; }
  .rail { gap: 6px; padding: 7px 8px; }
  .nav-item { height: 34px; padding: 0 6px; gap: 4px; }
  .nav-item svg { width: 15px; height: 15px; }
  .nav-item span { font-size: 11.5px; }
  .top-actions { flex: none; }
}

@media (max-width: 920px) {
  .app { display: block; width: 100%; overflow-x: hidden; }
  .rail { width: 100%; }
  .workspace { width: 100%; }
}

@media (max-width: 640px) {
  .engine-pill { height: 32px; padding: 0 8px; gap: 5px; }
  #engineText { display: inline; font-size: 10.5px; }
  .task-tools .icon-btn { width: 28px; height: 28px; }
  .task-tools .icon-btn svg { width: 13px; height: 13px; }
}

@media (max-width: 640px) {
  .task-tools [data-act="edit"] { display: none; }
}

/* iPhone PWA safe area */
html, body { min-height: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}
@supports (padding: env(safe-area-inset-bottom)) {
  .toast-wrap { bottom: calc(26px + env(safe-area-inset-bottom)); }
  .modal-backdrop { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .stopped-card { margin-bottom: env(safe-area-inset-bottom); }
}
