:root {
  --paper: #f6f2e8;
  --paper-deep: #eee9dc;
  --surface: rgba(251, 249, 243, .82);
  --surface-strong: #fbf9f3;
  --ink: #20251f;
  --ink-body: #30352e;
  --muted: #777b70;
  --soft: #92958a;
  --line: rgba(65, 73, 59, .14);
  --line-strong: rgba(65, 73, 59, .22);
  --moss: #677d4b;
  --moss-deep: #405b35;
  --moss-soft: #e8eadc;
  --ochre: #d58a35;
  --clay: #b94a35;
  --plum: #7b668b;
  --shadow: 0 16px 50px rgba(42, 48, 38, .07);
  --serif: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-width: 980px; min-height: 100%; }
body {
  position: relative;
  margin: 0;
  color: var(--ink-body);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 14px;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url("assets/visual/paper-ivory.jpg") center / 720px auto repeat;
  opacity: .18;
  pointer-events: none;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--moss) 70%, white);
  outline-offset: 3px;
}

.desktop-login {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  padding: 42px 4.6vw;
}
.desktop-login::after {
  content: "";
  position: absolute;
  right: -5vw;
  bottom: -10vh;
  width: min(56vw, 820px);
  height: min(92vh, 900px);
  background: url("assets/visual/home-draping-branch.png") center / contain no-repeat;
  opacity: .46;
  transform: rotate(15deg) scale(1.25);
  transform-origin: center;
  filter: saturate(.78) contrast(.92);
  pointer-events: none;
}
.desktop-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 0;
  padding: 0;
  color: var(--moss-deep);
  background: transparent;
  font-family: var(--serif);
  font-size: 31px;
  font-weight: 650;
  letter-spacing: .03em;
}
.desktop-brand-mark {
  position: relative;
  width: 38px;
  height: 38px;
  border: 3px solid var(--moss-deep);
  border-right-color: transparent;
  border-radius: 50%;
  transform: rotate(-22deg);
}
.desktop-brand-mark::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 10px;
  right: -2px;
  bottom: 4px;
  border-radius: 100% 0 100% 0;
  background: var(--moss);
  transform: rotate(28deg);
}
.login-panel {
  position: relative;
  z-index: 1;
  width: 470px;
  margin: 12vh 0 0 17vw;
}
.login-panel h1 {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 52px;
  font-weight: 500;
  letter-spacing: .015em;
}
.login-panel > p { margin: 16px 0 32px; color: var(--muted); font-size: 16px; }
.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field label { color: var(--ink-body); font-size: 13px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 14px 15px;
  color: var(--ink);
  background: rgba(255, 255, 255, .48);
  transition: border-color .18s ease, background .18s ease;
}
.field input { height: 54px; }
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--moss); background: rgba(255,255,255,.72); }
.primary-button, .quiet-button, .text-button {
  border: 0;
  cursor: pointer;
}
.primary-button {
  min-height: 48px;
  border-radius: 8px;
  padding: 0 20px;
  color: #fff;
  background: var(--moss-deep);
  box-shadow: 0 9px 24px rgba(64,91,53,.16);
  font-weight: 650;
  transition: transform .18s ease, background .18s ease;
}
.primary-button:hover { background: #314d2d; transform: translateY(-1px); }
.login-panel .primary-button { width: 100%; margin-top: 4px; font-family: var(--serif); font-size: 18px; }
.login-links { display: grid; gap: 0; margin-top: 14px; }
.login-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  border-bottom: 1px solid var(--line);
  color: var(--moss-deep);
  text-decoration: none;
}
.login-links a:first-child { color: var(--plum); }
.login-note { display: flex; align-items: center; gap: 8px; margin-top: 22px !important; color: var(--soft) !important; font-size: 12px !important; }
.login-error { min-height: 20px; margin: -4px 0 8px; color: var(--clay); font-size: 12px; }

.desktop-shell {
  display: grid;
  grid-template-columns: 226px minmax(560px, 1fr) 326px;
  min-height: 100vh;
}
.desktop-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 28px 18px 24px;
  border-right: 1px solid var(--line);
  background: rgba(247, 244, 235, .76);
  backdrop-filter: blur(12px);
}
.desktop-sidebar .desktop-brand { margin: 2px 12px 28px; font-size: 28px; }
.desktop-sidebar .desktop-brand-mark { width: 34px; height: 34px; }
.desktop-nav { display: grid; gap: 5px; }
.desktop-nav button, .sidebar-utility button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink-body);
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  transition: background .18s ease, color .18s ease;
}
.desktop-nav button i, .sidebar-utility button i { width: 28px; font-size: 19px; color: var(--muted); }
.desktop-nav button:hover, .sidebar-utility button:hover { background: rgba(103,125,75,.07); }
.desktop-nav button.is-active { color: var(--ink); background: rgba(103,125,75,.13); font-weight: 650; }
.desktop-nav button.is-active i { color: var(--moss-deep); }
.sidebar-utility { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.sidebar-account { margin: 16px 14px 0; color: var(--soft); font-size: 10px; line-height: 1.6; overflow: hidden; text-overflow: ellipsis; }

.desktop-main { min-width: 0; padding: 48px clamp(34px, 4vw, 72px) 70px; }
.workspace-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; margin-bottom: 42px; }
.workspace-date { margin: 0 0 13px; color: var(--moss-deep); font-family: var(--serif); font-size: 17px; }
.workspace-head h1 { margin: 0; color: var(--ink); font-family: var(--serif); font-size: clamp(34px, 3vw, 47px); font-weight: 500; line-height: 1.2; letter-spacing: .02em; }
.quick-button { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; margin-top: 58px; }

.workspace-section { margin-top: 34px; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; min-height: 40px; border-bottom: 1px solid var(--line-strong); }
.section-title-row h2 { margin: 0 0 10px; color: var(--moss-deep); font-family: var(--serif); font-size: 21px; font-weight: 650; }
.section-title-row span, .section-title-row button { color: var(--soft); font-size: 11px; }
.section-title-row button { border: 0; background: transparent; cursor: pointer; }
.task-group { margin-top: 18px; }
.task-group-title { display: flex; align-items: center; gap: 9px; margin: 0 0 5px; color: var(--ink-body); font-family: var(--serif); font-size: 17px; font-weight: 600; }
.task-group-title i { color: var(--moss-deep); font-size: 17px; }
.task-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 40px 48px;
  align-items: center;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-body);
}
.task-row:hover { background: rgba(255,255,255,.24); }
.task-check {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(103,125,75,.55);
  border-radius: 5px;
  color: white;
  background: transparent;
  cursor: pointer;
}
.task-check.is-done { border-color: var(--moss); background: var(--moss); }
.task-check:not(.is-done) i { opacity: 0; }
.task-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row.is-done .task-title { color: var(--soft); text-decoration: line-through; }
.priority { font-size: 11px; font-weight: 700; }
.priority.P0 { color: var(--clay); }
.priority.P1 { color: var(--ochre); }
.priority.P2 { color: var(--soft); }
.task-date { color: var(--soft); font-size: 11px; text-align: right; }
.empty-line { padding: 22px 0; border-bottom: 1px solid var(--line); color: var(--soft); font-size: 12px; }

.habit-list { display: grid; margin-top: 2px; }
.habit-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(250px, 1.5fr) 50px;
  align-items: center;
  min-height: 49px;
  border-bottom: 1px solid var(--line);
}
.habit-name { display: flex; align-items: center; gap: 10px; }
.habit-name i { width: 20px; color: var(--moss-deep); font-size: 18px; }
.habit-week { display: grid; grid-template-columns: repeat(7, 22px); gap: 10px; }
.habit-day { display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid rgba(103,125,75,.55); border-radius: 50%; color: transparent; font-size: 10px; }
.habit-day.is-done { color: white; background: var(--moss); border-color: var(--moss); }
.habit-streak { color: var(--moss-deep); font-size: 11px; text-align: right; }

.desktop-rail {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
  padding: 78px 28px 30px 20px;
  border-left: 1px solid var(--line);
  background: rgba(249,247,240,.42);
}
.desktop-rail::before {
  content: "";
  position: absolute;
  top: -55px;
  right: -25px;
  width: 210px;
  height: 200px;
  background: url("assets/visual/home-draping-branch.png") center / contain no-repeat;
  opacity: .42;
  pointer-events: none;
}
.rail-panel { position: relative; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 10px; padding: 17px 17px 13px; background: rgba(251,249,243,.66); }
.rail-panel h2 { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; color: var(--moss-deep); font-family: var(--serif); font-size: 18px; }
.rail-panel h2 i { font-size: 18px; }
.reminder-row, .upcoming-row { display: grid; grid-template-columns: 12px minmax(0,1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.reminder-row:last-child, .upcoming-row:last-child { border-bottom: 0; }
.timeline-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--moss); }
.timeline-dot.warn { background: var(--clay); }
.timeline-dot.gold { background: var(--ochre); }
.timeline-dot.plum { background: var(--plum); }
.rail-copy strong { display: block; color: var(--ink-body); font-size: 12px; font-weight: 650; }
.rail-copy span { display: block; margin-top: 4px; color: var(--soft); font-size: 10px; line-height: 1.5; }
.sync-panel { display: flex; align-items: center; gap: 12px; }
.sync-orb { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: white; background: var(--moss-deep); }
.sync-panel strong { display: block; color: var(--ink-body); font-size: 12px; }
.sync-panel span { display: block; margin-top: 3px; color: var(--soft); font-size: 10px; }

.module-page .workspace-head { margin-bottom: 32px; }
.module-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-block: 1px solid var(--line-strong); }
.module-summary > div { padding: 20px 18px; border-right: 1px solid var(--line); }
.module-summary > div:last-child { border-right: 0; }
.module-summary strong { display: block; color: var(--ink); font-family: var(--serif); font-size: 24px; font-weight: 500; }
.module-summary span { display: block; margin-top: 6px; color: var(--soft); font-size: 11px; }
.data-list { margin-top: 18px; }
.data-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; align-items: center; min-height: 52px; border-bottom: 1px solid var(--line); gap: 18px; }
.data-row time, .data-row small { color: var(--soft); font-size: 11px; }
.data-row strong { color: var(--ink-body); font-size: 13px; font-weight: 600; }
.mobile-edit-link { display: inline-flex; align-items: center; gap: 7px; margin-top: 22px; color: var(--moss-deep); text-decoration: none; font-size: 12px; }

.desktop-modal[hidden], .desktop-toast[hidden] { display: none; }
.desktop-modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 28px; }
.desktop-modal-backdrop { position: absolute; inset: 0; border: 0; background: rgba(32,37,31,.28); backdrop-filter: blur(3px); }
.desktop-dialog { position: relative; width: min(520px, 90vw); border: 1px solid var(--line); border-radius: 12px; padding: 26px; background: var(--surface-strong); box-shadow: var(--shadow); }
.desktop-dialog h2 { margin: 0 0 20px; color: var(--ink); font-family: var(--serif); font-size: 27px; font-weight: 550; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.quiet-button { min-height: 42px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 16px; color: var(--ink-body); background: transparent; }
.text-button { padding: 0; color: var(--moss-deep); background: transparent; }
.desktop-toast { position: fixed; left: 50%; bottom: 28px; z-index: 70; transform: translateX(-50%); border-radius: 8px; padding: 11px 16px; color: white; background: rgba(32,37,31,.9); box-shadow: var(--shadow); font-size: 12px; }

@media (max-width: 1180px) {
  .desktop-shell { grid-template-columns: 210px minmax(540px, 1fr); }
  .desktop-rail { display: none; }
  .desktop-main { padding-inline: 42px; }
}
@media (max-width: 1400px) {
  .workspace-head h1 { font-size: 36px; }
}
@media (max-width: 1000px) {
  .desktop-shell { grid-template-columns: 190px minmax(520px, 1fr); }
  .desktop-main { padding-inline: 30px; }
}
@media (max-height: 800px) {
  .login-panel { margin-top: 6vh; }
  .login-panel > p { margin-block: 10px 22px; }
  .field { gap: 6px; margin-bottom: 12px; }
  .field input { height: 48px; }
  .login-links a { min-height: 46px; }
  .login-note { margin-top: 14px !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
