/* Daily planner — theme-token driven, Linear-like board */

:root {
  --ink: var(--wa-ink, #1a2332);
  --muted: var(--wa-muted, #64748b);
  --line: var(--wa-line, #e2e8f0);
  --soft: var(--wa-bg, #f5f7fa);
  --paper: var(--wa-card, #ffffff);
  --elevated: var(--wa-bg-elevated, #ffffff);
  --primary: var(--wa-primary, #0052d9);
  --primary-hover: var(--wa-primary-hover, #0062ff);
  --shadow: var(--wa-shadow, 0 8px 28px rgba(0, 40, 100, 0.08));
  --sidebar-w: 280px;
  --radius: 12px;
  --radius-sm: 8px;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #f43f5e;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font: 14.5px/1.55 "DM Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
.layout { display: flex; min-height: 100vh; }

/* —— Sidebar —— */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar, #070d18), var(--sidebar-2, #101a2c));
  color: var(--sidebar-link, #cbd5e1);
  overflow-y: auto; z-index: 40;
  border-right: 1px solid var(--sidebar-border, rgba(255,255,255,.08));
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35); border-radius: 99px;
}
.brand {
  padding: 20px 18px 14px;
  border-bottom: 1px solid var(--sidebar-border, rgba(255,255,255,.08));
  position: sticky; top: 0; z-index: 2;
  background: color-mix(in srgb, var(--sidebar, #070d18) 92%, transparent);
  backdrop-filter: blur(8px);
}
.brand .mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px; margin-right: 8px;
  background: var(--primary); color: #fff; font-weight: 800; font-size: 13px;
}
.brand h1 {
  display: flex; align-items: center; margin: 0;
  font-size: 15px; font-weight: 700; color: var(--sidebar-text, var(--wa-on-primary));
}
.brand p {
  margin: 8px 0 0; font-size: 12px; color: var(--sidebar-muted, #94a3b8); line-height: 1.5;
}
.hub { padding: 10px 12px 6px; border-bottom: 1px solid var(--sidebar-border, rgba(255,255,255,.06)); }
.hub .toc-label, .toc-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--sidebar-muted, #64748b); padding: 6px 10px 8px; font-weight: 700;
}
.hub a, .toc a.day {
  display: block; color: var(--sidebar-link, #cbd5e1); text-decoration: none;
  padding: 8px 12px; border-radius: 10px; font-size: 13px; margin: 2px 0;
  border: 1px solid transparent;
}
.hub a small, .toc a.day .hint {
  display: block; color: var(--sidebar-muted, #64748b); font-size: 11px; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hub a:hover, .toc a.day:hover {
  background: var(--sidebar-hover, rgba(255,255,255,.05));
  color: var(--sidebar-text, #fff); text-decoration: none;
}
.hub a.here, .toc a.day.active {
  background: var(--sidebar-active-bg, rgba(71,135,240,.18));
  color: var(--sidebar-text, #fff);
  border-color: var(--sidebar-active-border, rgba(71,135,240,.3));
}
.toc { padding: 12px 12px 20px; }
.toc a.day .date { font-weight: 700; font-variant-numeric: tabular-nums; }
.toc a.day .dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary); margin-right: 8px; vertical-align: middle;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent);
}
.sidebar-foot {
  padding: 12px 18px 20px; font-size: 11.5px; color: var(--sidebar-muted, #64748b);
  border-top: 1px solid var(--sidebar-border, rgba(255,255,255,.06));
}

/* —— Main —— */
.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; background: var(--soft); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--soft) 88%, transparent);
  backdrop-filter: blur(12px);
  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: var(--elevated); border-radius: 10px;
  padding: 8px 12px; font-size: 13px; cursor: pointer; color: var(--ink);
}
.top-actions button.primary {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.top-actions button:hover, .menu-btn:hover {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--line));
}
.top-actions button.primary:hover { background: var(--primary-hover); }
.menu-btn { display: none; }
.save-hint { font-size: 12px; color: var(--muted); }

.content { width: 100%; padding: 16px 24px 72px; }

.day-bar {
  display: flex;
  align-items: center;
  gap: 10px 14px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.day-bar .focus-input {
  flex: 1 1 220px;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  padding: 6px 0;
  outline: none;
  border-bottom: 1px solid transparent;
}
.day-bar .focus-input:focus { border-bottom-color: var(--primary); }
.day-bar .focus-input::placeholder { color: var(--muted); font-weight: 500; }
.day-bar .meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.day-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.day-bar-actions .primary {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.day-bar-actions .primary:hover { background: var(--primary-hover); }
.day-bar-actions .primary:disabled { opacity: .45; cursor: default; }
.chip {
  font-size: 12px; padding: 5px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 8%, var(--elevated));
  border: 1px solid var(--line); color: var(--muted);
}
.chip b { color: var(--primary); font-weight: 700; }

/* —— Panels —— */
.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: 16px;
  padding: 16px;
  min-width: 0;
}
.panel.full { grid-column: 1 / -1; }

.secondary-panels {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--soft) 55%, var(--paper));
  padding: 0 14px 14px;
}
.secondary-panels > summary {
  cursor: pointer;
  padding: 14px 4px;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  list-style: none;
  user-select: none;
}
.secondary-panels > summary::-webkit-details-marker { display: none; }
.secondary-panels > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  transition: transform .15s ease;
}
.secondary-panels[open] > summary::before { transform: rotate(90deg); }
.secondary-panels-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.secondary-panels-body .panel {
  border: 1px solid var(--line);
  background: var(--paper);
}

.content-foot {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.weak-link {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
}
.weak-link:hover {
  color: var(--primary);
  text-decoration: underline;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 14px;
}
.panel-head h3 {
  margin: 0; font-size: 14px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.panel-head .ico {
  width: 26px; height: 26px; border-radius: 8px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 14%, transparent);
}
.panel-head .ico.read {
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 16%, transparent);
}
.panel-head h3 small {
  min-width: 22px;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ok) 13%, transparent);
  color: var(--ok);
  font-size: 11px;
  font-weight: 800;
}
.panel-head .add {
  border: 1px solid var(--line); background: transparent; border-radius: 999px;
  padding: 5px 11px; font-size: 12px; cursor: pointer; color: var(--muted); font-weight: 600;
}
.panel-head .add:hover {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

/* —— Plan / Todo —— */
.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: var(--radius-sm);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--soft) 65%, var(--paper));
}
.plan-item .idx {
  width: 22px; height: 22px; border-radius: 6px;
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  color: var(--primary);
  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: 15px; height: 15px; margin-top: 4px; accent-color: var(--ok); flex: 0 0 auto;
}
.inline-edit {
  flex: 1; min-width: 0; border: 0 !important; background: transparent !important; outline: none;
  color: var(--ink) !important; resize: none; line-height: 1.5; padding: 0;
}
.todo-item.done .inline-edit { text-decoration: line-through; color: var(--muted) !important; }
.pri {
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; flex: 0 0 auto;
}
.pri.high {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
  color: color-mix(in srgb, var(--danger) 85%, var(--ink));
}
.pri.mid {
  background: color-mix(in srgb, var(--warn) 18%, transparent);
  color: color-mix(in srgb, var(--warn) 80%, var(--ink));
}
.pri.low {
  background: color-mix(in srgb, var(--muted) 18%, transparent);
  color: var(--muted);
}
.xbtn {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0 2px; opacity: .7;
}
.xbtn:hover { color: var(--danger); opacity: 1; }

/* —— Kanban (Linear-like) —— */
.kanban {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  background: transparent !important;
  border: 0 !important;
}
@media (max-width: 900px) { .kanban { grid-template-columns: 1fr; } }

.col {
  background: color-mix(in srgb, var(--soft) 80%, var(--paper)) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius);
  padding: 10px;
  min-height: 180px;
  color: var(--ink) !important;
}
.col h4 {
  margin: 0 0 10px;
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted) !important;
  display: flex; align-items: center; gap: 8px;
}
.col h4::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted);
}
.col:nth-child(1) h4::before { background: var(--muted); }
.col:nth-child(2) h4::before { background: var(--primary); }
.col:nth-child(3) h4::before { background: var(--ok); }

.task-card {
  background: var(--elevated) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: none;
  color: var(--ink) !important;
  transition: border-color .15s ease, transform .15s ease;
}
.task-card:hover {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--line)) !important;
}
.task-card .title {
  width: 100%; border: 0 !important; outline: none;
  font-weight: 650; font-size: 13.5px;
  background: transparent !important;
  color: var(--ink) !important;
  padding: 0;
}
.task-card .title::placeholder { color: var(--muted); }
.task-card .meta-row {
  display: flex; gap: 6px; align-items: center; margin-top: 10px; flex-wrap: wrap;
}
.task-card select, .task-card .tag-edit {
  border: 1px solid var(--line) !important;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11.5px;
  background: color-mix(in srgb, var(--soft) 70%, var(--elevated)) !important;
  color: var(--ink) !important;
}
.task-card .tag-edit { width: 96px; }

/* —— Inspiration cards —— */
.cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
@media (max-width: 900px) { .cards { grid-template-columns: 1fr; } }

.memo {
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--line) !important;
  min-height: 132px;
  display: flex; flex-direction: column; gap: 8px;
  position: relative;
  background: var(--elevated) !important;
  color: var(--ink) !important;
  box-shadow: none;
}
.memo.insight {
  background: color-mix(in srgb, var(--primary) 12%, var(--elevated)) !important;
  border-color: color-mix(in srgb, var(--primary) 35%, var(--line)) !important;
  border-left: 3px solid var(--primary) !important;
}
.memo.warn {
  background: color-mix(in srgb, var(--warn) 12%, var(--elevated)) !important;
  border-color: color-mix(in srgb, var(--warn) 35%, var(--line)) !important;
  border-left: 3px solid var(--warn) !important;
}
.memo.idea {
  background: color-mix(in srgb, var(--ok) 12%, var(--elevated)) !important;
  border-color: color-mix(in srgb, var(--ok) 35%, var(--line)) !important;
  border-left: 3px solid var(--ok) !important;
}
.memo.plain {
  background: var(--elevated) !important;
  border-left: 3px solid color-mix(in srgb, var(--muted) 50%, var(--line)) !important;
}
.memo .title {
  border: 0 !important; outline: none;
  background: transparent !important;
  font-weight: 700; font-size: 14px;
  color: var(--ink) !important;
  padding: 0;
}
.memo .title::placeholder { color: var(--muted); }
.memo .body {
  border: 0 !important; outline: none;
  background: transparent !important;
  resize: vertical; min-height: 64px;
  color: var(--ink) !important;
  font-size: 13.5px; line-height: 1.6; flex: 1; padding: 0;
  opacity: 0.92;
}
.memo .body::placeholder { color: var(--muted); opacity: 1; }
.memo .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.memo select {
  border: 1px solid var(--line) !important;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11.5px;
  background: color-mix(in srgb, var(--soft) 55%, transparent) !important;
  color: var(--ink) !important;
}

/* —— Notes —— */
.notes {
  width: 100%; min-height: 160px;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius);
  padding: 14px 16px; resize: vertical;
  background: color-mix(in srgb, var(--soft) 55%, var(--paper)) !important;
  outline: none;
  color: var(--ink) !important;
}
.notes:focus {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--line)) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}
.notes::placeholder { color: var(--muted); }

/* —— Reading notes —— */
.reading-notes-head {
  align-items: center;
}

.reading-note-search {
  width: min(260px, 44vw);
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  background: color-mix(in srgb, var(--soft) 55%, var(--paper));
  color: var(--ink);
  outline: none;
}

.reading-note-search:focus {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}

.reading-notes-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.reading-note-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--soft) 62%, var(--paper));
}

.reading-note-card h4 {
  margin: 0;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.45;
}

.reading-note-card .meta {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
}

.reading-note-card p {
  margin: 0;
  color: color-mix(in srgb, var(--ink) 84%, var(--muted));
  font-size: 12.5px;
  line-height: 1.55;
}

.reading-note-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
  font-size: 12px;
  font-weight: 650;
}

.reading-note-actions a {
  color: var(--primary);
}

@media (max-width: 900px) {
  .reading-notes-list {
    grid-template-columns: 1fr;
  }

  .reading-note-search {
    width: 100%;
  }

  .reading-notes-head {
    align-items: stretch;
    flex-direction: column;
  }
}

.empty {
  color: var(--muted) !important;
  font-size: 12.5px;
  padding: 20px 10px;
  text-align: center;
  border: 1px dashed var(--line) !important;
  border-radius: var(--radius-sm);
  background: transparent !important;
}

.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; }
}
