:root {
  --paper: #f6f2e9;
  --paper-deep: #efe9dc;
  --card: #fffdf8;
  --ink: #26231d;
  --ink-soft: #5f5a50;
  --ink-faint: #989184;
  --line: #e2dbcd;
  --line-strong: #d3c9b7;
  --rust: #b5533a;
  --rust-soft: #f3e2db;
  --sage: #6e7f68;
  --sage-soft: #e7ebe1;
  --gold: #c1953f;
  --gold-soft: #f4ead4;
  --shadow: 0 18px 40px -24px rgba(55, 44, 28, .38);
  --serif: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", serif;
  --sans: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  --radius: 14px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
  z-index: 0;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
input, textarea, select { outline: none; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

::selection { background: #e9cdbd; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d7cfbf; border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #c4b9a5; background-clip: content-box; }

.app {
  position: relative;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 26px 20px 20px;
  background: rgba(239, 233, 220, .78);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

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

.brand-mark {
  display: grid;
  gap: 4px;
  width: 34px;
  height: 34px;
  padding: 8px 7px;
  background: var(--ink);
  border-radius: 10px 10px 10px 3px;
  box-shadow: 0 4px 0 rgba(38, 35, 29, .14);
}

.brand-mark span { display: block; height: 2px; background: var(--paper); border-radius: 2px; }
.brand-mark span:nth-child(2) { width: 70%; }
.brand-mark span:nth-child(3) { width: 45%; }

.brand h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: .16em;
  line-height: 1.1;
}

.brand p { margin: 4px 0 0; font-size: 11px; color: var(--ink-faint); letter-spacing: .12em; }

.today-card {
  position: relative;
  overflow: hidden;
  padding: 16px 16px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.today-card::after {
  content: "";
  position: absolute;
  top: -28px;
  right: -28px;
  width: 72px;
  height: 72px;
  border: 1px solid #e8d9c8;
  border-radius: 50%;
}

.today-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--rust);
  font-weight: 600;
}

.today-card-dot { width: 6px; height: 6px; background: var(--rust); border-radius: 50%; box-shadow: 0 0 0 4px var(--rust-soft); }

.today-card strong {
  display: block;
  margin: 7px 0 4px;
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: .02em;
}

.today-card p { margin: 0 0 12px; font-size: 12px; color: var(--ink-soft); }

.today-progress { height: 3px; background: var(--paper-deep); border-radius: 3px; overflow: hidden; }
.today-progress i { display: block; height: 100%; width: 0; background: var(--sage); border-radius: 3px; transition: width .4s ease; }

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  color: var(--rust);
  font-size: 12px;
  font-weight: 600;
}
.text-button:hover { color: #8f3d29; }
.text-button span { transition: transform .2s; }
.text-button:hover span { transform: translateX(3px); }
.text-button.small { font-size: 11px; font-weight: 500; color: var(--ink-faint); }
.text-button.small:hover { color: var(--ink); }

.today-card .text-button { margin-top: 12px; }

.views { margin-top: 26px; }

.nav-label, .section-label {
  margin: 0 0 9px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.nav-label { padding-left: 8px; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  margin-bottom: 2px;
  color: var(--ink-soft);
  border-radius: 9px;
  font-size: 13px;
  text-align: left;
  transition: background .18s, color .18s;
}

.nav-item:hover { background: rgba(255, 253, 248, .7); color: var(--ink); }

.nav-item.is-active { background: var(--ink); color: #fbf8f0; box-shadow: 0 6px 14px -8px rgba(38, 35, 29, .6); }
.nav-item.is-active .nav-icon { color: #e6d5bf; }

.nav-icon { display: grid; place-items: center; width: 20px; color: var(--ink-faint); }
.nav-icon svg { width: 16px; height: 16px; }

.nav-count {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  font-size: 10px;
  text-align: center;
  color: var(--ink-faint);
  background: rgba(38, 35, 29, .05);
  border-radius: 20px;
}
.nav-item.is-active .nav-count { background: rgba(255, 255, 255, .16); color: #f2e9da; }

.sidebar-foot { margin-top: auto; padding-top: 20px; }

.quote {
  position: relative;
  padding: 12px 12px 12px 20px;
  border-left: 1px solid var(--line-strong);
}
.quote-mark {
  position: absolute;
  left: 7px;
  top: 8px;
  font-family: var(--serif);
  font-size: 22px;
  color: var(--line-strong);
}
.quote p { margin: 0; font-family: var(--serif); font-size: 12px; line-height: 1.8; color: var(--ink-soft); }

.storage-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding-left: 4px;
  font-size: 10px;
  letter-spacing: .04em;
  color: var(--ink-faint);
}
.storage-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--sage); }
.storage-note > span:nth-child(2) { flex: 1; }
.demo-clear {
  padding: 0;
  font-size: 10px;
  color: var(--rust);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.demo-clear:hover { color: #8f3d29; }

.sidebar-actions { display: flex; gap: 4px; margin-top: 10px; padding-left: 2px; }

/* ---------- Buttons ---------- */
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--ink-soft);
  border: 1px solid transparent;
  border-radius: 9px;
  transition: background .18s, color .18s, border-color .18s;
}
.icon-button:hover { background: var(--paper-deep); color: var(--ink); }
.icon-button.small { width: 28px; height: 28px; }
.icon-button.small svg { width: 15px; height: 15px; }
.icon-button.danger:hover { color: var(--rust); background: var(--rust-soft); }

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  color: #fdf9f1;
  background: var(--ink);
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .03em;
  box-shadow: 0 8px 18px -10px rgba(38, 35, 29, .8);
  transition: transform .15s, background .15s;
}
.primary-button:hover { background: #3a352c; transform: translateY(-1px); }
.primary-button:active { transform: translateY(0); }
.primary-button svg { width: 15px; height: 15px; stroke-width: 2; }

.ghost-button {
  height: 34px;
  padding: 0 14px;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 12px;
  background: transparent;
  transition: background .15s, color .15s;
}
.ghost-button:hover { background: var(--card); color: var(--ink); }
.ghost-button.small { height: 28px; padding: 0 10px; font-size: 11px; }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 0 0 auto;
  height: 86px;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
}

.menu-button { display: none; }

.breadcrumb { min-width: 0; }
.eyebrow { display: block; margin-bottom: 5px; font-size: 10px; font-weight: 600; letter-spacing: .16em; color: var(--ink-faint); text-transform: uppercase; }
.breadcrumb h2 { margin: 0; font-family: var(--serif); font-size: 25px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.breadcrumb h2 span { margin-left: 6px; font-family: var(--sans); font-size: 13px; font-weight: 400; color: var(--ink-faint); letter-spacing: .06em; }

.topbar-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 232px;
  height: 38px;
  padding: 0 10px;
  background: rgba(255, 253, 248, .66);
  border: 1px solid var(--line);
  border-radius: 9px;
  transition: border-color .18s, background .18s, box-shadow .18s;
}
.search:focus-within { background: var(--card); border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(181, 83, 58, .07); }
.search svg { width: 15px; height: 15px; color: var(--ink-faint); flex: none; }
.search input { width: 100%; min-width: 0; background: none; border: 0; font-size: 12px; }
.search input::placeholder { color: var(--ink-faint); }
.search kbd { flex: none; padding: 2px 5px; font-family: var(--sans); font-size: 9px; color: var(--ink-faint); background: var(--paper-deep); border: 1px solid var(--line); border-radius: 4px; }

/* ---------- Workspace ---------- */
.workspace {
  display: grid;
  grid-template-columns: 296px minmax(330px, 1fr) 366px;
  flex: 1;
  min-height: 0;
}

.calendar-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 24px 22px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.calendar-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.calendar-head-actions { display: flex; align-items: center; gap: 4px; }
.calendar-close, .mobile-calendar { display: none; }
.calendar-kicker { margin: 0 0 3px; font-size: 9px; font-weight: 700; letter-spacing: .2em; color: var(--rust); }
.calendar-head h3 { margin: 0; font-family: var(--serif); font-size: 27px; letter-spacing: .04em; }
.calendar-nav { display: flex; gap: 1px; margin-top: 2px; }
.calendar-nav .icon-button:hover { background: var(--card); }

.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 6px; }
.weekdays span { text-align: center; font-size: 10px; font-weight: 600; letter-spacing: .05em; color: var(--ink-faint); }
.weekdays .weekend { color: #b48a6e; }

.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 3px; }

.day-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  aspect-ratio: 1 / 1.06;
  padding-top: 5px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--ink);
  transition: background .15s;
}
.day-cell:hover { background: rgba(255, 253, 248, .85); }
.day-cell.is-outside { color: #c5bdae; }
.day-cell.is-weekend { color: #8d6a56; }
.day-cell.is-outside.is-weekend { color: #cfc4b4; }
.day-cell .day-num { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; line-height: 1; }
.day-cell.is-today .day-num { color: #fdf9f1; background: var(--rust); font-weight: 600; box-shadow: 0 3px 8px -3px rgba(181, 83, 58, .7); }
.day-cell.is-selected:not(.is-today) .day-num { background: var(--ink); color: #fdf9f1; font-weight: 600; }
.day-cell.is-selected.is-today .day-num { box-shadow: 0 0 0 3px var(--rust-soft), 0 3px 8px -3px rgba(181, 83, 58, .7); }

.day-dots { display: flex; align-items: center; justify-content: center; gap: 2.5px; height: 5px; }
.day-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--gold); }
.day-dots i.high { background: var(--rust); }
.day-dots i.done { background: #b9c2b0; }
.day-dots .more { width: auto; height: auto; background: none; font-size: 8px; color: var(--ink-faint); line-height: 1; }

.calendar-legend { display: flex; align-items: center; gap: 12px; margin: 18px 0 0; padding-top: 14px; border-top: 1px dashed var(--line-strong); font-size: 10px; color: var(--ink-faint); }
.calendar-legend span { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }
.legend-dot.high { background: var(--rust); }
.legend-today i { width: 12px; height: 12px; border-radius: 50%; background: var(--rust); }
.legend-today { margin-left: auto; }

.month-focus { margin-top: 22px; }
.focus-list { display: flex; flex-direction: column; gap: 2px; }
.focus-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  text-align: left;
  border-radius: 6px;
  transition: background .15s;
}
.focus-item:hover { background: rgba(255, 253, 248, .8); }
.focus-item .focus-dot { flex: none; width: 5px; height: 5px; margin-top: 5px; border-radius: 50%; background: var(--gold); }
.focus-item .focus-dot.high { background: var(--rust); }
.focus-item .focus-text { flex: 1; min-width: 0; font-size: 11.5px; line-height: 1.55; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-item .focus-date { flex: none; font-size: 9.5px; color: var(--ink-faint); padding-top: 1px; }
.focus-empty { margin: 0; padding: 7px 8px; font-size: 11px; color: var(--ink-faint); }

.month-note { margin-top: auto; padding-top: 24px; }
.month-stats { display: flex; justify-content: space-between; gap: 6px; }
.month-stats div { display: flex; flex-direction: column; gap: 3px; }
.month-stats strong { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.month-stats span { font-size: 10px; color: var(--ink-faint); }
.month-meter { height: 3px; margin-top: 12px; background: var(--paper-deep); border-radius: 3px; overflow: hidden; }
.month-meter i { display: block; height: 100%; width: 0; background: var(--rust); border-radius: 3px; transition: width .4s; }

/* ---------- Task panel ---------- */
.task-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 24px 26px 0;
}

.task-panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex: none; margin-bottom: 18px; }
.day-heading { display: flex; align-items: center; gap: 13px; min-width: 0; flex: 1 1 auto; }

.date-stamp {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 50px;
  height: 56px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 3px 0 var(--paper-deep);
}
.date-stamp b { font-family: var(--serif); font-size: 23px; line-height: 1; font-weight: 600; }
.date-stamp small { margin-top: 3px; font-size: 8px; letter-spacing: .14em; color: var(--rust); font-weight: 700; }

.day-heading .section-label { margin-bottom: 4px; }
.day-heading h3 { margin: 0; font-family: var(--serif); font-size: 20px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-heading > div { min-width: 0; }

.list-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.filter-pills { display: flex; gap: 1px; padding: 3px; background: var(--paper-deep); border-radius: 8px; }
.filter-pill { padding: 4px 9px; color: var(--ink-faint); border-radius: 6px; font-size: 11px; transition: background .15s, color .15s; }
.filter-pill:hover { color: var(--ink); }
.filter-pill.is-active { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(38, 35, 29, .1); font-weight: 600; }

.quick-add {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
  padding: 0 12px;
  height: 42px;
  margin-bottom: 16px;
  background: rgba(255, 253, 248, .5);
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  transition: background .18s, border-color .18s;
}
.quick-add:focus-within { background: var(--card); border-color: var(--rust); border-style: solid; }
.quick-add-plus { font-size: 17px; color: var(--rust); line-height: 1; }
.quick-add input { flex: 1; min-width: 0; background: none; border: 0; font-size: 12.5px; }
.quick-add input::placeholder { color: var(--ink-faint); }
.quick-add-hint { flex: none; padding: 2px 6px; font-size: 9px; color: var(--ink-faint); border: 1px solid var(--line); border-radius: 4px; }

.task-list { flex: 1; min-height: 0; padding: 2px 4px 26px 0; overflow-y: auto; }

.task-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 15px 12px 14px 15px;
  margin-bottom: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s, transform .18s, opacity .18s;
  animation: card-in .28s ease both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.task-card:hover { border-color: var(--line-strong); box-shadow: 0 10px 22px -18px rgba(55, 44, 28, .55); }
.task-card.is-selected { border-color: var(--ink); box-shadow: 3px 0 0 0 var(--ink) inset, 0 10px 22px -18px rgba(55, 44, 28, .55); }
.task-card.is-done { opacity: .58; }
.task-card.is-done .task-title { text-decoration: line-through; text-decoration-color: var(--ink-faint); text-decoration-thickness: 1px; }
.task-card.is-done .mini-progress { display: none; }

.check {
  display: grid;
  place-items: center;
  flex: none;
  width: 19px;
  height: 19px;
  margin-top: 2px;
  color: transparent;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  transition: background .18s, border-color .18s, color .18s;
}
.check svg { width: 11px; height: 11px; stroke-width: 2.6; }
.check:hover { border-color: var(--sage); color: var(--sage); background: var(--sage-soft); }
.is-done > .check, .check.is-checked { background: var(--sage); border-color: var(--sage); color: #fff; }
.check-large { width: 26px; height: 26px; margin-top: 4px; }
.check-large svg { width: 15px; height: 15px; }

.task-body { flex: 1; min-width: 0; }
.task-line { display: flex; align-items: flex-start; gap: 7px; }
.task-title { margin: 0; font-size: 13.5px; font-weight: 500; line-height: 1.45; overflow-wrap: anywhere; }
.priority-flag { flex: none; width: 6px; height: 6px; margin-top: 6px; border-radius: 50%; background: transparent; }
.priority-flag.high { background: var(--rust); box-shadow: 0 0 0 3px var(--rust-soft); }
.priority-flag.low { background: var(--gold); }

.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 9px; margin-top: 6px; font-size: 10.5px; color: var(--ink-faint); }
.task-meta span:empty { display: none; }
.task-time { display: inline-flex; align-items: center; gap: 3px; }
.task-time::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--line-strong); }
.task-category { padding: 1px 6px; color: var(--ink-soft); background: var(--paper-deep); border-radius: 4px; }
.task-steps { display: inline-flex; align-items: center; gap: 4px; }
.task-steps svg { width: 10px; height: 10px; }

.task-note-preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin-top: 7px;
  font-family: var(--serif);
  font-size: 11px;
  line-height: 1.65;
  color: var(--ink-faint);
}
.task-note-preview:empty { display: none; }

.mini-progress { height: 2px; margin-top: 9px; background: var(--paper-deep); border-radius: 2px; overflow: hidden; }
.mini-progress i { display: block; height: 100%; width: 0; background: var(--sage); border-radius: 2px; }
.mini-progress:not(.has-steps) { display: none; }

.task-more { flex: none; display: grid; place-items: center; width: 24px; height: 24px; margin: -2px -3px 0 0; color: var(--ink-faint); border-radius: 6px; opacity: 0; transition: opacity .15s, background .15s; }
.task-card:hover .task-more, .task-more:focus-visible { opacity: 1; }
.task-more:hover { background: var(--paper-deep); color: var(--ink); }
.task-more svg { width: 14px; height: 14px; fill: currentColor; stroke: none; }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; padding: 20px; text-align: center; }
.empty-illustration { position: relative; width: 120px; height: 84px; margin-bottom: 18px; }
.empty-sun { position: absolute; top: 2px; right: 18px; width: 26px; height: 26px; border: 1px solid #d9b98b; border-radius: 50%; }
.empty-sun::after { content: ""; position: absolute; inset: 5px; border: 1px dashed #e2c9a4; border-radius: 50%; }
.empty-hill { position: absolute; left: 8px; bottom: 8px; width: 92px; height: 40px; border: 1px solid var(--line-strong); border-radius: 50% 50% 0 0; border-bottom: 0; }
.empty-hill::after { content: ""; position: absolute; left: 30px; bottom: 0; width: 50px; height: 26px; border: 1px solid var(--line-strong); border-radius: 50% 50% 0 0; border-bottom: 0; background: var(--paper); }
.empty-line { position: absolute; left: 24px; top: 18px; width: 30px; height: 1px; background: var(--line-strong); }
.empty-line.short { top: 26px; width: 18px; }
.empty-state h4, .detail-empty h4 { margin: 0 0 7px; font-family: var(--serif); font-size: 17px; font-weight: 600; }
.empty-state p, .detail-empty p { margin: 0 0 16px; font-size: 11.5px; line-height: 1.8; color: var(--ink-faint); }

/* ---------- Detail panel ---------- */
.detail-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 14px 18px 18px 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  overscroll-behavior: contain;
}

.detail-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; padding: 30px 34px; text-align: center; }
.detail-empty-art { position: relative; width: 108px; height: 104px; margin-bottom: 22px; }
.paper { position: absolute; display: block; width: 66px; height: 82px; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 3px; }
.paper-back { top: 12px; left: 16px; transform: rotate(-8deg); background: var(--paper-deep); }
.paper-front { top: 7px; left: 26px; padding: 20px 12px; transform: rotate(3deg); box-shadow: 4px 6px 14px -8px rgba(55, 44, 28, .45); }
.paper-front i { display: block; height: 1px; margin-bottom: 9px; background: var(--line-strong); }
.paper-front i:nth-child(2) { width: 80%; }
.paper-front i:nth-child(3) { width: 55%; }
.pencil { position: absolute; right: 9px; bottom: 9px; width: 7px; height: 54px; background: var(--gold); border-radius: 1px; transform: rotate(36deg); box-shadow: inset 0 -9px 0 #e3cfa6; }
.pencil::before { content: ""; position: absolute; top: -7px; left: 0; border-left: 3.5px solid transparent; border-right: 3.5px solid transparent; border-bottom: 7px solid var(--ink-soft); }

.shortcut-list { display: flex; flex-direction: column; gap: 7px; margin-top: 8px; padding-top: 16px; border-top: 1px dashed var(--line); font-size: 10px; color: var(--ink-faint); }
.shortcut-list span { display: flex; align-items: center; justify-content: center; gap: 6px; }
kbd { padding: 1px 5px; font-family: var(--sans); font-size: 9px; color: var(--ink-soft); background: var(--paper-deep); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; }

.detail-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 16px 20px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.detail-toolbar { display: flex; align-items: center; justify-content: space-between; flex: none; margin-bottom: 12px; }
.detail-tag { padding: 2px 8px; font-size: 9px; font-weight: 600; letter-spacing: .08em; color: var(--sage); background: var(--sage-soft); border-radius: 4px; }
.detail-tag:empty { visibility: hidden; }
.detail-toolbar-actions { display: flex; gap: 1px; }

.detail-title-wrap { display: flex; align-items: flex-start; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.detail-title-wrap textarea {
  flex: 1;
  min-width: 0;
  height: auto;
  padding: 0;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--ink);
  background: none;
  border: 0;
  resize: none;
  overflow: hidden;
}

.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; padding: 14px 0 4px; }
.meta-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.meta-field > span { font-size: 9px; font-weight: 600; letter-spacing: .1em; color: var(--ink-faint); }
.meta-field input, .meta-field select {
  width: 100%;
  min-width: 0;
  height: 31px;
  padding: 0 8px;
  font-size: 11.5px;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid transparent;
  border-radius: 6px;
  transition: background .15s, border-color .15s;
}
.meta-field input:hover, .meta-field select:hover { background: var(--paper-deep); }
.meta-field input:focus, .meta-field select:focus { background: var(--card); border-color: var(--line-strong); }
.meta-field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23989184' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; padding-right: 22px; }

.detail-section { padding-top: 14px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.section-heading h5 { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; }
.autosave-note { font-size: 9px; color: var(--ink-faint); transition: color .2s; }
.autosave-note.saving { color: var(--gold); }

.notes-area {
  display: block;
  width: 100%;
  min-height: 96px;
  padding: 10px 11px;
  font-family: var(--serif);
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--ink-soft);
  background-color: var(--paper);
  background-image: linear-gradient(transparent calc(1.85em - 1px), #e8e1d3 1px);
  background-size: 100% 1.85em;
  background-attachment: local;
  border: 1px solid transparent;
  border-radius: 7px;
  resize: vertical;
  transition: border-color .15s, background-color .15s;
}
.notes-area:focus { background-color: var(--card); border-color: var(--line-strong); }
.notes-area::placeholder { color: #b5ad9e; }

.steps-section { padding-top: 16px; }
.step-count { font-size: 9px; font-weight: 500; color: var(--ink-faint); letter-spacing: 0; }
.step-progress { height: 2px; margin-bottom: 10px; background: var(--paper-deep); border-radius: 2px; overflow: hidden; }
.step-progress i { display: block; height: 100%; width: 0; background: var(--sage); transition: width .35s ease; }

.steps { display: flex; flex-direction: column; gap: 2px; }

.step {
  position: relative;
  border-radius: 6px;
}
.step-row { display: flex; align-items: flex-start; gap: 7px; padding: 5px 2px; border-radius: 6px; }
.step-row:hover { background: rgba(246, 242, 233, .75); }
.step-check {
  display: grid;
  place-items: center;
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 2px;
  color: transparent;
  border: 1.3px solid var(--line-strong);
  border-radius: 4px;
  background: transparent;
  transition: all .15s;
}
.step-check svg { width: 8px; height: 8px; stroke-width: 3; }
.step-check:hover { border-color: var(--sage); color: var(--sage); }
.step.is-done > .step-row > .step-check { background: var(--sage); border-color: var(--sage); color: #fff; }

.step-main { flex: 1; min-width: 0; }
.step-text { padding-top: 1px; font-size: 12px; line-height: 1.5; color: var(--ink-soft); overflow-wrap: anywhere; }
.step.is-done > .step-row .step-text { color: var(--ink-faint); text-decoration: line-through; text-decoration-thickness: 1px; }
.step-text:focus { outline: none; color: var(--ink); }
.step-note-preview { display: block; margin-top: 2px; font-size: 9.5px; line-height: 1.5; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-note-preview:empty { display: none; }
.step-actions { display: flex; align-items: center; gap: 1px; opacity: 0; transition: opacity .15s; }
.step-row:hover .step-actions, .step-actions:focus-within { opacity: 1; }
.step-action { display: grid; place-items: center; width: 20px; height: 20px; color: var(--ink-faint); border-radius: 4px; }
.step-action:hover { background: var(--paper-deep); color: var(--ink); }
.step-action svg { width: 11px; height: 11px; }

.children { margin-left: 17px; padding-left: 9px; border-left: 1px solid var(--line); }
.children:empty { display: none; }
.children .step { animation: card-in .2s ease both; }

.step-note-wrap { padding: 2px 0 6px 21px; }
.step-note {
  width: 100%;
  min-height: 40px;
  padding: 6px 8px;
  font-family: var(--serif);
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 5px;
  resize: vertical;
}
.step-note:focus { background: var(--card); border-color: var(--line-strong); }
.step-note[hidden] { display: none; }

.step-add {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  margin-top: 6px;
  padding: 0 8px;
  color: var(--ink-faint);
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  transition: border-color .15s, background .15s;
}
.step-add:focus-within { border-color: var(--sage); background: rgba(231, 235, 225, .35); }
.step-add > span { font-size: 15px; line-height: 1; }
.step-add input { flex: 1; min-width: 0; font-size: 11.5px; background: none; border: 0; }
.step-add input::placeholder { color: #b5ad9e; }
.step-tip { margin: 7px 0 0; font-size: 9.5px; line-height: 1.6; color: #b0a898; }

.detail-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: none; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 9.5px; color: var(--ink-faint); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(38, 35, 29, .34);
  backdrop-filter: blur(3px);
  animation: fade-in .18s ease;
}
.modal-backdrop[hidden] { display: none; }
@keyframes fade-in { from { opacity: 0; } }

.modal {
  width: min(460px, 100%);
  padding: 22px 24px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 30px 70px -24px rgba(30, 25, 18, .5);
  animation: modal-in .22s cubic-bezier(.2, .8, .3, 1) both;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.modal-head .section-label { margin-bottom: 3px; color: var(--rust); }
.modal-head h3 { margin: 0; font-family: var(--serif); font-size: 21px; }
.modal-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; min-width: 0; }
.modal-field > span { font-size: 10px; font-weight: 600; letter-spacing: .08em; color: var(--ink-faint); }
.modal-field input, .modal-field select {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  font-size: 12.5px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 7px;
  transition: border-color .15s, background .15s;
}
.modal-field input:focus, .modal-field select:focus { background: var(--card); border-color: var(--ink-soft); }
.modal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------- Toast / scrim ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 80;
  padding: 9px 16px;
  font-size: 11.5px;
  color: #fbf8f0;
  background: var(--ink);
  border-radius: 7px;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .45);
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity .22s, transform .22s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.scrim { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1460px) {
  .workspace { grid-template-columns: 250px minmax(300px, 1fr) 350px; }
  .calendar-panel { padding: 22px 18px; }
  .task-panel { padding: 22px 20px 0; }
  .detail-panel { margin-right: 14px; }
  .detail-content { padding: 14px 16px 16px; }
  .search { width: 190px; }
}

@media (max-width: 1230px) {
  .workspace { grid-template-columns: 258px minmax(0, 1fr); position: relative; }
  .detail-panel {
    position: fixed;
    top: 96px;
    right: 14px;
    bottom: 14px;
    z-index: 42;
    width: 356px;
    margin: 0;
    background: var(--card);
    transform: translateX(calc(100% + 24px));
    transition: transform .28s cubic-bezier(.3, .8, .3, 1);
  }
  .detail-panel.is-open { transform: translateX(0); }
  .scrim.is-open {
    display: block;
    position: fixed;
    top: 86px;
    right: 0;
    bottom: 0;
    left: 258px;
    z-index: 38;
    background: rgba(38, 35, 29, .18);
  }
  .detail-empty { display: none; }
  .detail-content { display: flex !important; }
  .task-panel-head { flex-wrap: wrap; align-items: flex-start; }
  .list-tools { margin-left: auto; }
}

@media (max-width: 1080px) {
  .scrim.is-open { left: 0; }
  .calendar-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 45;
    width: 292px;
    padding: 20px;
    background: var(--paper);
    box-shadow: 24px 0 60px -34px rgba(0, 0, 0, .45);
    transform: translateX(-100%);
    transition: transform .26s cubic-bezier(.3, .8, .3, 1);
  }
  .calendar-panel.is-open { transform: translateX(0); }
  .calendar-close, .mobile-calendar { display: inline-grid; }
  .month-note { margin-top: 20px; }
}

@media (max-width: 900px) {
  .scrim.is-open { top: 74px; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    width: 244px;
    transform: translateX(-100%);
    transition: transform .26s cubic-bezier(.3, .8, .3, 1);
    box-shadow: 20px 0 50px -30px rgba(0, 0, 0, .4);
  }
  .sidebar.is-open { transform: translateX(0); }
  .menu-button { display: inline-grid; }
  .topbar { height: 74px; padding: 0 18px; gap: 10px; }
  .breadcrumb h2 { font-size: 21px; }
  .search { width: 40px; padding: 0 11px; }
  .search input, .search kbd { display: none; }
  .search:focus-within { width: 200px; }
  .search:focus-within input { display: block; }
  .search:focus-within kbd { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .task-panel { padding: 18px 16px 0; }
  .primary-button { padding: 0 12px; }
}

@media (max-width: 620px) {
  .topbar-actions .primary-button { width: 38px; padding: 0; font-size: 0; gap: 0; }
  .topbar-actions .primary-button svg { width: 17px; height: 17px; }
  .breadcrumb h2 span { display: none; }
  .list-tools .filter-pills { display: none; }
  .detail-panel { top: 78px; right: 8px; bottom: 8px; left: 8px; width: auto; }
  .day-heading h3 { font-size: 18px; }
  .task-panel-head { margin-bottom: 14px; }
}

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