:root {
  --ink: #1a2332;
  --muted: #64748b;
  --line: #e2e8f0;
  --soft: #f1f5f9;
  --paper: #ffffff;
  --sidebar: #0f172a;
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --teal: #0f766e;
  --blue: #2563eb;
  --ok: #059669;
  --warn: #d97706;
  --danger: #e11d48;
  --shadow: 0 10px 40px rgba(15, 23, 42, .08);
  --sidebar-w: 280px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--ink); background: var(--soft);
  font: 15.5px/1.7 "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea { font: inherit; }
.layout { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar), #111827); color: #e2e8f0;
  overflow-y: auto; z-index: 40; border-right: 1px solid rgba(255,255,255,.06);
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 99px; }
.brand {
  padding: 22px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.08);
  position: sticky; top: 0; background: rgba(15,23,42,.96); backdrop-filter: blur(8px); z-index: 2;
}
.brand .mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px; margin-right: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0f172a; font-weight: 800; font-size: 13px;
}
.brand h1 { display: flex; align-items: center; margin: 0; font-size: 16px; font-weight: 750; color: #f8fafc; }
.brand p { margin: 8px 0 0; font-size: 12px; color: #94a3b8; line-height: 1.5; }

.hub { padding: 10px 12px 6px; border-bottom: 1px solid rgba(255,255,255,.06); }
.hub .toc-label, .toc-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: #64748b; padding: 6px 10px 8px; font-weight: 700;
}
.hub a, .toc a.day {
  display: block; color: #cbd5e1; text-decoration: none;
  padding: 8px 12px; border-radius: 12px; font-size: 13px; margin: 2px 0;
  border: 1px solid transparent;
}
.hub a small, .toc a.day .hint {
  display: block; color: #64748b; font-size: 11px; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hub a:hover, .toc a.day:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.hub a.here, .toc a.day.active {
  background: linear-gradient(90deg, rgba(56,189,248,.18), rgba(129,140,248,.12));
  color: #fff; border-color: rgba(56,189,248,.25);
}
.toc { padding: 12px 12px 20px; flex: 1; }
.toc a.day .date { font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.toc a.day .dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); margin-right: 8px; vertical-align: middle;
  box-shadow: 0 0 0 3px rgba(56,189,248,.2);
}
.sidebar-foot {
  padding: 12px 18px 20px; font-size: 11.5px; color: #64748b;
  border-top: 1px solid rgba(255,255,255,.06);
}

.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 28px; background: rgba(241,245,249,.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.crumb { font-size: 13px; color: var(--muted); }
.crumb b { color: var(--ink); font-weight: 650; }
.top-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.top-actions button, .menu-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 8px 12px; font-size: 13px; cursor: pointer; color: var(--ink);
}
.top-actions button.primary {
  background: #0f172a; color: #fff; border-color: #0f172a;
}
.top-actions button:hover, .menu-btn:hover { background: #f8fafc; }
.top-actions button.primary:hover { background: #1e293b; }
.menu-btn { display: none; }
.save-hint { font-size: 12px; color: var(--muted); }

.content { width: 100%; padding: 24px 28px 96px; }
.book-cover {
  background:
    radial-gradient(900px 280px at 10% -10%, rgba(56,189,248,.18), transparent 55%),
    radial-gradient(700px 260px at 90% 0%, rgba(16,185,129,.12), transparent 50%),
    var(--paper);
  border: 1px solid var(--line); border-radius: 20px; padding: 26px 30px 22px;
  box-shadow: var(--shadow); margin-bottom: 18px;
}
.eyebrow {
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--teal); font-weight: 700; margin-bottom: 8px;
}
.book-cover h2 { margin: 0 0 10px; font-size: 28px; line-height: 1.25; }
.focus-input {
  width: 100%; border: 1px solid transparent; background: transparent;
  font-size: 16px; font-weight: 650; color: var(--ink); padding: 8px 0; outline: none;
  border-bottom: 1px dashed #cbd5e1;
}
.focus-input:focus { border-bottom-color: var(--accent); }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  font-size: 12px; padding: 5px 10px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); color: #334155;
}
.chip b { color: var(--blue); }

.grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 14px;
}
@media (max-width: 1100px) { .grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--paper); border: 1px solid var(--line); border-radius: 18px;
  padding: 18px 18px 16px; box-shadow: var(--shadow); min-width: 0;
}
.panel.full { grid-column: 1 / -1; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 12px;
}
.panel-head h3 {
  margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px;
}
.panel-head .ico {
  width: 28px; height: 28px; border-radius: 9px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 14px; color: #fff;
}
.panel-head .ico.plan { background: linear-gradient(135deg, #0ea5e9, #2563eb); }
.panel-head .ico.todo { background: linear-gradient(135deg, #f59e0b, #ea580c); }
.panel-head .ico.task { background: linear-gradient(135deg, #8b5cf6, #6366f1); }
.panel-head .ico.card { background: linear-gradient(135deg, #10b981, #0d9488); }
.panel-head .ico.note { background: linear-gradient(135deg, #64748b, #334155); }
.panel-head .add {
  border: 1px solid var(--line); background: #f8fafc; border-radius: 999px;
  padding: 5px 10px; font-size: 12px; cursor: pointer; color: #334155;
}
.panel-head .add:hover { background: #eef2ff; }

.plan-list, .todo-list { display: flex; flex-direction: column; gap: 8px; }
.plan-item, .todo-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: #f8fafc;
}
.plan-item .idx {
  width: 22px; height: 22px; border-radius: 7px; background: #0f172a; color: #fff;
  font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; margin-top: 2px;
}
.todo-item input[type="checkbox"] {
  width: 16px; height: 16px; margin-top: 4px; accent-color: var(--ok); flex: 0 0 auto;
}
.inline-edit {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  color: var(--ink); resize: none; line-height: 1.55;
}
.todo-item.done .inline-edit { text-decoration: line-through; color: var(--muted); }
.pri {
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; flex: 0 0 auto;
}
.pri.high { background: #fee2e2; color: #b91c1c; }
.pri.mid { background: #ffedd5; color: #c2410c; }
.pri.low { background: #e2e8f0; color: #475569; }
.xbtn {
  border: 0; background: transparent; color: #94a3b8; cursor: pointer; font-size: 16px; line-height: 1;
  padding: 0 2px;
}
.xbtn:hover { color: var(--danger); }

.kanban {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
@media (max-width: 900px) { .kanban { grid-template-columns: 1fr; } }
.col {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 14px; padding: 10px;
  min-height: 140px;
}
.col h4 {
  margin: 0 0 10px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: #64748b;
}
.task-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  margin-bottom: 8px; box-shadow: 0 4px 14px rgba(15,23,42,.04);
}
.task-card .title {
  width: 100%; border: 0; outline: none; font-weight: 700; font-size: 13.5px; background: transparent;
}
.task-card .meta-row {
  display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap;
}
.task-card select, .task-card .tag-edit {
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; font-size: 11.5px; background: #fff;
}
.task-card .tag-edit { width: 90px; }

.cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
@media (max-width: 900px) { .cards { grid-template-columns: 1fr; } }
.memo {
  border-radius: 14px; padding: 12px 14px; border: 1px solid var(--line); min-height: 120px;
  display: flex; flex-direction: column; gap: 8px; position: relative;
}
.memo.insight { background: linear-gradient(180deg, #eff6ff, #f8fafc); border-color: #bfdbfe; }
.memo.warn { background: linear-gradient(180deg, #fff7ed, #f8fafc); border-color: #fed7aa; }
.memo.idea { background: linear-gradient(180deg, #ecfdf5, #f8fafc); border-color: #a7f3d0; }
.memo.plain { background: #f8fafc; }
.memo .title {
  border: 0; outline: none; background: transparent; font-weight: 750; font-size: 14px;
}
.memo .body {
  border: 0; outline: none; background: transparent; resize: vertical; min-height: 64px;
  color: #334155; font-size: 13.5px; line-height: 1.6; flex: 1;
}
.memo .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.memo select {
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; font-size: 11.5px; background: #fff;
}

.notes {
  width: 100%; min-height: 160px; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; resize: vertical; background: #f8fafc; outline: none; color: #334155;
}
.notes:focus { border-color: #93c5fd; background: #fff; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }

.empty {
  color: var(--muted); font-size: 13px; padding: 10px; text-align: center;
  border: 1px dashed var(--line); border-radius: 12px;
}

.backdrop { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 30; }
body.nav-open .backdrop { display: block; }

@media (max-width: 960px) {
  .sidebar { transform: translateX(-105%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px 12px 80px; }
  .book-cover { padding: 18px 16px; }
  .book-cover h2 { font-size: 22px; }
}
