/* =======================================================================
   待办与灵感记忆 — stylesheet
   Tokens → reset → layout → components → pages
   ======================================================================= */

/* ---- Tokens: Light (default · fresh) ---- */
:root,
[data-theme="light"] {
  /* Soft, warm, clean paper tones */
  --bg:        #f6f8fb;
  --bg-elev:   #ffffff;
  --surface:   #ffffff;
  --surface-2: #f1f5fa;
  --surface-3: #e6edf5;
  --border:    #e3e9f1;
  --border-strong: #c9d3e0;
  --text:      #1c2533;
  --text-2:    #3e4860;
  --muted:     #6a7489;
  --muted-2:   #93a0b5;

  /* Fresh teal-cyan accent — calm, modern, low-saturation */
  --accent:       #0ea5a5;
  --accent-hover: #0b8d8d;
  --accent-soft:  rgba(14, 165, 165, .10);
  --accent-ring:  rgba(14, 165, 165, .28);
  --teal:         #14b8a6;
  --teal-soft:    rgba(20, 184, 166, .12);

  --danger:        #e11d48;
  --danger-soft:   rgba(225, 29, 72, .10);
  --success:       #10b981;
  --success-soft:  rgba(16, 185, 129, .12);
  --warning:       #d97706;
  --warning-soft:  rgba(217, 119, 6, .12);

  --shadow-sm: 0 1px 2px rgba(30,40,70,.05);
  --shadow-md: 0 4px 14px rgba(30,40,70,.08);
  --shadow-lg: 0 16px 48px rgba(30,40,70,.14);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  --fs-11: 11px; --fs-12: 12px; --fs-13: 13px; --fs-14: 14px;
  --fs-16: 16px; --fs-20: 20px; --fs-24: 24px;

  --sidebar-w: 232px;
  --sidebar-collapsed-w: 72px;
  --toolbar-h: 54px;
  --projectbar-w: 260px;
}

[data-theme="dark"] {
  --bg:        #0b0d12;
  --bg-elev:   #10131b;
  --surface:   #141824;
  --surface-2: #1a1f2e;
  --surface-3: #212739;
  --border:    #242b3d;
  --border-strong: #32394f;
  --text:      #e6e8ee;
  --text-2:    #b8bfcf;
  --muted:     #7e8699;
  --muted-2:   #5d6579;

  --accent:       #2dd4bf;
  --accent-hover: #5eead4;
  --accent-soft:  rgba(45, 212, 191, .15);
  --accent-ring:  rgba(45, 212, 191, .40);
  --teal:         #14b8a6;
  --teal-soft:    rgba(20, 184, 166, .16);

  --danger:        #ef4f67;
  --danger-soft:   rgba(239, 79, 103, .14);
  --success:       #3dc58a;
  --success-soft:  rgba(61, 197, 138, .14);
  --warning:       #e8a64a;
  --warning-soft:  rgba(232, 166, 74, .14);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 6px 20px rgba(0,0,0,.45);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.55);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-14);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; cursor: pointer; }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { margin: 0; font-weight: 500; line-height: 1.3; }
h1 { font-size: var(--fs-20); }
h2 { font-size: var(--fs-16); }
h3 { font-size: var(--fs-14); }
p  { margin: 0; }
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
::-webkit-scrollbar-track { background: transparent; }

/* ---- Buttons ---- */
button, .btn {
  font: inherit;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
button:hover, .btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
button:disabled, .btn:disabled { opacity: .5; cursor: not-allowed; }
button.primary, .btn.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
button.primary:hover, .btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger, .btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
button.danger:hover, .btn.danger:hover { background: var(--danger-soft); }
button.ghost, .btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
button.ghost:hover, .btn.ghost:hover { background: var(--surface-2); color: var(--text); }
button.sm, .btn.sm { height: 26px; padding: 2px 8px; font-size: var(--fs-12); }
button.icon, .btn.icon { padding: 0; width: 32px; }
button.icon.sm, .btn.icon.sm { width: 26px; height: 26px; }

/* ---- Inputs ---- */
input, textarea, select {
  font: inherit;
  padding: 7px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  width: 100%;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:hover, textarea:hover, select:hover { border-color: var(--border-strong); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
textarea { min-height: 96px; resize: vertical; font-family: inherit; line-height: 1.55; }
textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--fs-13); }
label {
  display: block; font-size: var(--fs-12); color: var(--muted);
  margin: 12px 0 4px;
  font-weight: 500; letter-spacing: .2px;
}
.hint { font-size: var(--fs-12); color: var(--muted); margin-top: 4px; }

input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }

/* focus ring utility for clickable non-buttons */
[role="button"]:focus-visible, a:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--accent-ring); border-radius: 4px;
}

/* ---- Layout helpers ---- */
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.row.grow > * { flex: 1; min-width: 0; }
.col { display: flex; flex-direction: column; gap: 8px; }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-12); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 0; }
.center { display: flex; align-items: center; justify-content: center; }

/* ---- App shell ---- */
.app-root { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.app-root.sidebar-collapsed { grid-template-columns: var(--sidebar-collapsed-w) 1fr; }
.app-root.is-auth { grid-template-columns: 1fr; }

.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 16px 12px;
  position: sticky; top: 0; height: 100vh;
  overflow: hidden;
  transition: padding .18s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  justify-content: space-between;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.sidebar-brand-main {
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
}
.sidebar-brand .logo {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.sidebar-brand .logo img { width: 28px; height: 28px; display: block; }
.sidebar-brand .name { font-weight: 500; font-size: var(--fs-13); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-collapse-btn {
  flex: none;
  width: 30px; height: 30px;
  justify-content: center;
  cursor: pointer;
}
.sidebar-collapse-btn svg { transition: transform .18s ease; }
.app-root:not(.sidebar-collapsed) .sidebar-collapse-btn svg { transform: rotate(180deg); }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius);
  color: var(--text-2); font-size: var(--fs-13);
  transition: background .12s, color .12s;
  position: relative;
}
.sidebar-nav a svg { flex: none; }
.sidebar-nav a:hover { background: var(--surface-2); color: var(--text); }
.sidebar-nav a.active { background: var(--accent-soft); color: var(--accent); }
.sidebar-nav a.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.sidebar-nav .count-pill {
  margin-left: auto; font-size: var(--fs-11);
  background: var(--danger); color: #fff;
  padding: 1px 7px; border-radius: 999px; min-width: 20px; text-align: center;
  font-weight: 600;
}
.sidebar-footer {
  display: flex; flex-direction: column; gap: 8px;
  padding-top: 12px; border-top: 1px solid var(--border); font-size: var(--fs-12);
}
.sidebar-footer .status-row { display:flex; align-items:center; gap:8px; color: var(--muted); }
.sidebar-footer .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.app-root.sidebar-collapsed .sidebar {
  padding: 16px 8px;
}
.app-root.sidebar-collapsed .sidebar-brand {
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  padding: 4px 0 16px;
}
.app-root.sidebar-collapsed .sidebar-brand-main,
.app-root.sidebar-collapsed .sidebar-footer .status-row {
  justify-content: center;
}
.app-root.sidebar-collapsed .sidebar-brand .name,
.app-root.sidebar-collapsed .sidebar-nav .sidebar-label,
.app-root.sidebar-collapsed .sidebar-footer .sidebar-label {
  display: none;
}
.app-root.sidebar-collapsed .sidebar-collapse-btn {
  width: 32px;
  height: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.app-root.sidebar-collapsed .sidebar-nav a {
  justify-content: center;
  padding: 10px 0;
}
.app-root.sidebar-collapsed .sidebar-nav a.active::before {
  left: -8px;
}
.app-root.sidebar-collapsed .sidebar-nav .count-pill {
  position: absolute;
  top: 2px;
  right: 4px;
  min-width: 16px;
  padding: 0 4px;
  font-size: 10px;
}
.app-root.sidebar-collapsed .sidebar-footer {
  align-items: center;
}
.app-root.sidebar-collapsed .sidebar-footer button {
  width: 40px;
  justify-content: center;
  padding-inline: 0;
}

.sidebar-toggle {
  display: none;
  position: fixed; top: 10px; left: 10px; z-index: 40;
}

@media (max-width: 860px) {
  .app-root,
  .app-root.sidebar-collapsed { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 50;
    width: 240px; transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: inline-flex; }
}

/* ---- Main / topbar ---- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--toolbar-h);
  display: flex; align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  gap: 12px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .title { font-weight: 500; font-size: var(--fs-14); }
.topbar .crumb { color: var(--muted); }
.topbar .spacer { flex: 1; }
.topbar .actions { display: flex; align-items: center; gap: 8px; }
.content { padding: 20px 24px; min-height: calc(100vh - var(--toolbar-h)); }
@media (max-width: 560px) { .content { padding: 16px; } .topbar { padding: 0 16px; } }

/* ---- Cards ---- */
.card {
  border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-lg);
  padding: 16px;
}
.card + .card { margin-top: 12px; }
.card.hover:hover { border-color: var(--border-strong); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }

/* ---- Badges & chips ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: var(--fs-11); font-weight: 500;
  background: var(--surface-3); color: var(--text-2);
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.conf    { background: var(--danger-soft);  color: var(--danger); }
.badge.pub     { background: var(--success-soft); color: var(--success); }
.badge.accent  { background: var(--accent-soft);  color: var(--accent); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.muted-badge { background: var(--surface-3); color: var(--text-3); }
.badge.teal    { background: var(--teal-soft);    color: var(--teal); }
.badge.due-date { background: #ede9fe; color: #7c3aed; }
.badge.due-date.overdue { background: var(--danger-soft); color: var(--danger); }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; margin-right: 4px; }
.badge.processing { background: var(--accent-soft); color: var(--accent); animation: badgePulse 1.2s ease-in-out infinite; }
@keyframes badgePulse { 0%,100% { opacity:1; } 50% { opacity:.45; } }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2);
  font-size: var(--fs-12);
  border: 1px solid var(--border);
  cursor: pointer; user-select: none;
  white-space: nowrap;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.tag { background: transparent; cursor: default; color: var(--text-2); }
.chip.tag.added { background: var(--success-soft); color: var(--success); border-color: transparent; }
.chip.tag.removed { background: var(--danger-soft); color: var(--danger); border-color: transparent; text-decoration: line-through; }
.chip .close { cursor: pointer; opacity: .6; }
.chip .close:hover { opacity: 1; }

.tag {
  display: inline-flex; align-items: center;
  background: var(--accent-soft); color: var(--accent);
  padding: 2px 8px; border-radius: 999px;
  font-size: var(--fs-11);
}

/* Segmented control */
.segmented {
  display: inline-flex; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2px; gap: 2px;
}
.segmented button {
  height: 26px; padding: 0 10px; font-size: var(--fs-12);
  border: 0; background: transparent; color: var(--text-2); border-radius: 6px;
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; background: var(--surface-3);
  border-radius: 999px; transition: .15s; cursor: pointer;
}
.switch .slider::before {
  content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px;
  background: white; border-radius: 50%; transition: .15s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(16px); }

/* Chip input (tag editor) */
.chip-input {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 4px; min-height: 36px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-elev);
}
.chip-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.chip-input input { border: 0; background: transparent; flex: 1; min-width: 80px; padding: 4px; }
.chip-input input:focus { box-shadow: none; }
.chip-input .chip { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* ---- Toasts (右下角，不遮护顶部「+ 新条目」与 tooltip) ---- */
#toast-root {
  position: fixed; top: auto; bottom: 16px; right: 16px; z-index: 100;
  display: flex; flex-direction: column-reverse; gap: 8px;
  pointer-events: none;
  max-width: min(420px, calc(100vw - 32px));
}
@media (max-width: 520px) {
  #toast-root { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

/* ---- Jobs Pill (右上角，聚合 N 个长耗时任务) ---- */
#jobs-pill-root {
  position: fixed; top: 14px; right: 16px; z-index: 90;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  pointer-events: none;
}
.jobs-pill {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  box-shadow: var(--shadow-md);
  font-size: var(--fs-12); font-weight: 500;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.jobs-pill:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg, var(--shadow-md)); }
.jobs-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.jobs-pill-spinner,
.jobs-pill-item-spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: jobsSpin 0.9s linear infinite;
}
.jobs-pill-item-spinner { width: 12px; height: 12px; border-width: 2px; }
.jobs-pill-caret { font-size: 10px; color: var(--text-2); }
@keyframes jobsSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .jobs-pill-spinner, .jobs-pill-item-spinner { animation: none; border-top-color: var(--accent); }
}
.jobs-pill-popover {
  pointer-events: auto;
  min-width: 240px; max-width: 320px;
  padding: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; gap: 6px;
}
.jobs-pill-item {
  display: flex; flex-direction: column; gap: 4px;
  padding: 6px 8px; border-radius: 6px; background: var(--surface-2, transparent);
}
.jobs-pill-item-row { display: grid; grid-template-columns: 14px 1fr auto; gap: 8px; align-items: center; }
.jobs-pill-item-label { font-size: var(--fs-12); color: var(--text); }
.jobs-pill-item-time { font-size: var(--fs-11); }
.jobs-pill-item-preview {
  margin-left: 22px; max-width: 360px;
  font-size: var(--fs-12); color: var(--muted, var(--text));
  white-space: pre-wrap; word-break: break-word;
  border-left: 2px solid var(--accent, #5b8def); padding-left: 8px;
  max-height: 6.5em; overflow-y: auto;
}
@media (max-width: 520px) {
  #jobs-pill-root { top: 10px; right: 12px; }
  .jobs-pill-label { display: none; }
  .jobs-pill { padding: 0 10px; }
}
.toast {
  pointer-events: auto;
  min-width: 240px; max-width: 360px;
  padding: 10px 14px; border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  box-shadow: var(--shadow-md);
  display: flex; gap: 10px; align-items: flex-start;
  animation: slideIn .2s ease;
}
.toast .t-body { flex: 1; font-size: var(--fs-13); }
.toast .t-action { background: transparent; border: 0; color: var(--accent); padding: 0; height: auto; font-size: var(--fs-12); }
.toast.err { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
.toast.warning { border-left-color: var(--warning); }
@keyframes slideIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(5, 8, 14, .55);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .12s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp .15s ease;
}
.modal.lg { max-width: 720px; }
.modal.sm { max-width: 420px; }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { font-size: var(--fs-16); }
.modal-body { padding: 16px 20px; }
.modal-footer {
  padding: 12px 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--surface);
  position: sticky; bottom: 0;
}

/* ---- 加载中 Spinner Modal ---- */
.spinner-ring {
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite; margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.modal-loading { text-align: center; padding: 28px 20px 24px; }
.modal-loading .loading-title { font-size: var(--fs-15); font-weight: 650; margin-bottom: 6px; }
.modal-loading .loading-desc { color: var(--text-2); font-size: var(--fs-13); line-height: 1.6; max-width: 260px; margin: 0 auto; }

/* ---- Auth / login card ---- */
.auth-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
  background:
    radial-gradient(1200px 500px at 10% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(1000px 500px at 100% 110%, var(--teal-soft), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-lg);
}
.auth-card h1 { margin-bottom: 6px; }
.auth-card .muted { margin-bottom: 18px; }
.auth-card .brand-logo {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 600;
  margin-bottom: 16px;
}
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 40px; }
.pw-wrap .pw-toggle {
  position: absolute; right: 4px; top: 4px;
  height: 28px; width: 32px;
  background: transparent; border: 0; color: var(--muted);
}
.pw-wrap .pw-toggle:hover { color: var(--text); background: transparent; }
.strength { display: flex; gap: 3px; margin-top: 6px; height: 4px; }
.strength span { flex: 1; border-radius: 2px; background: var(--surface-3); }
.strength span.on-1 { background: var(--danger); }
.strength span.on-2 { background: var(--warning); }
.strength span.on-3 { background: var(--accent); }
.strength span.on-4 { background: var(--success); }

.recovery {
  background: var(--warning-soft); border: 1px solid var(--warning);
  padding: 14px; border-radius: var(--radius);
  font-family: ui-monospace, monospace; font-size: var(--fs-16);
  letter-spacing: 2px; word-break: break-all;
  color: var(--text); margin: 12px 0;
  user-select: all;
}

/* ---- Entries page ---- */
.entries-layout {
  display: grid; gap: 16px;
  grid-template-columns: 1fr;
  align-items: start;
}
.entries-layout.capture-board {
  max-width: 980px; margin: 0 auto;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

/* Capture-board page header */
.capture-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; margin-bottom: 14px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f0fdfa;
  color: #134e4a;
}
.capture-header .capture-title {
  display: flex; flex-direction: column; gap: 6px;
  min-width: 0;
}
.capture-header .capture-kicker {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent);
}
.capture-header .capture-title h1 { font-size: 34px; font-weight: 820; letter-spacing: 0; }
.capture-header .capture-lead {
  max-width: 58ch; margin: 0;
  font-size: 15px; line-height: 1.7; color: #315f5b;
}
.capture-help-toggle { font-size: 12px; color: var(--muted); flex: 0 0 auto; }
.capture-help-toggle > summary {
  list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2);
}
.capture-help-toggle > summary::-webkit-details-marker { display: none; }
.capture-help-toggle > summary:hover { background: var(--surface-3); color: var(--text); }
.capture-help-toggle[open] > summary { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.capture-help-toggle .capture-help-body {
  margin-top: 8px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* Composer shell wraps the composer at the top of the capture board. */
.composer-shell {
  margin-bottom: 16px;
}
/* Override IM-style sticky behaviour when inside the capture board. */
.composer-shell .composer.composer-board {
  position: static; background: var(--surface); box-shadow: none;
  border-radius: 8px; padding: 18px;
  border-color: var(--border-strong);
}
.composer-board .c-toprow {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
  font-size: var(--fs-12); color: var(--muted);
  justify-content: space-between;
  flex-wrap: wrap;
}
.composer-board .c-proj-wrap { display: inline-flex; align-items: center; gap: 6px; }
.composer-board .c-proj-select {
  width: auto; min-width: 120px; max-width: 200px;
  height: 30px; padding: 2px 10px;
  background: var(--surface-2); border-color: var(--border);
  font-size: var(--fs-12); color: var(--text);
}
.composer-board .c-topnote {
  font-size: 12px; color: var(--muted);
}
.composer-board .c-main {
  align-items: stretch;
  gap: 8px;
}
.composer-board .c-input-wrap {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.composer-board .c-input-wrap textarea {
  padding: 14px;
  min-height: 112px;
  line-height: 1.6;
  font-size: 16px;
}
.composer-board .c-btn {
  width: 40px; height: 40px;
  border-radius: 12px;
  align-self: flex-end;
}
.composer-board .c-btn.c-send {
  width: 46px;
}
.composer-board .c-extras { max-height: none; overflow: visible; }
.composer-board .c-extras-row {
  border-top: 1px dashed var(--border);
  padding: 10px 0 0; margin-top: 10px;
  gap: 8px;
}
.composer-board .c-inline-note {
  margin-left: auto;
  font-size: 12px; color: var(--muted);
}

/* Attachment tray */
.attach-tray {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 8px 0 0; margin-top: 6px;
  border-top: 1px dashed var(--border);
}
.attach-tray.empty { display: none; }
.attach-item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 4px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; font-size: var(--fs-12); color: var(--text-2);
  max-width: 220px;
}
.attach-item img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; }
.attach-item .attach-icon { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-3); border-radius: 6px; color: var(--muted); }
.attach-item .attach-name { max-width: 130px; }
.attach-item .attach-remove {
  width: 22px; height: 22px; padding: 0; border-radius: 50%;
  background: transparent; border: 0; color: var(--muted);
}
.attach-item .attach-remove:hover { background: var(--danger-soft); color: var(--danger); }

/* Recent section: search + view toggle in toolbar, advanced filters collapsed. */
.recent-section { display: flex; flex-direction: column; gap: 10px; }
.recent-toolbar {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.recent-toolbar-main {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.recent-title-wrap {
  display: flex; flex-direction: column; gap: 3px;
}
.recent-toolbar .recent-title {
  font-size: 18px; color: var(--text);
  text-transform: none; letter-spacing: 0; font-weight: 780; margin: 0;
}
.recent-note {
  margin: 0;
  font-size: 13px; color: var(--text-2);
}
.recent-toolbar-sub {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px; align-items: center;
}
.recent-toolbar .search-wrap { flex: unset; min-width: 0; max-width: none; }
.recent-toolbar .search-wrap input { padding-left: 30px; height: 36px; font-size: 13px; }
.advanced-filters {
  font-size: var(--fs-12); color: var(--muted);
}
.advanced-filters > summary {
  list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
}
.advanced-filters > summary::-webkit-details-marker { display: none; }
.advanced-filters[open] > summary { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.advanced-filters .advanced-filters-body {
  margin-top: 8px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.entry-list { display: flex; flex-direction: column; gap: 8px; }
.empty.empty-sm { padding: 24px; font-size: var(--fs-13); }
@media (max-width: 900px) {
  .entries-layout { grid-template-columns: 1fr; }
  .entries-layout.capture-board { max-width: none; }
  .capture-header { gap: 10px; }
  .capture-header .capture-title h1 { font-size: 24px; }
  .capture-header .capture-lead { max-width: none; }
  .composer-shell .composer.composer-board { padding: 14px; }
  .recent-toolbar-sub { grid-template-columns: 1fr; }
  .composer-board .c-inline-note { margin-left: 0; width: 100%; }
}

.projectbar {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 12px;
  position: sticky; top: calc(var(--toolbar-h) + 20px);
}
.projectbar-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 4px 10px; }
.projectbar-head h3 { font-size: var(--fs-12); text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.projectbar-head button.ghost { color: var(--accent); background: var(--accent-soft); border-color: transparent; border-radius: 8px; }
.project-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--radius);
  cursor: pointer; color: var(--text-2); font-size: var(--fs-13);
  position: relative;
}
.project-item:hover { background: var(--surface-2); color: var(--text); }
.project-item.active { background: var(--accent-soft); color: var(--accent); }
.project-item .pname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-item .pcount { font-size: var(--fs-11); color: var(--muted); background: var(--surface-2); padding: 1px 6px; border-radius: 999px; }
.project-item.active .pcount { background: var(--accent); color: white; }
.project-item .pdot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); flex: none; }
.project-item .pdot.archived { background: var(--muted-2); }
.project-item .pmenu { opacity: 0; transition: opacity .1s; color: var(--muted); }
.project-item:hover .pmenu { opacity: 1; }

/* ---- Settings: project management rows ---- */
.project-settings-list { display: flex; flex-direction: column; gap: 4px; }
.project-settings-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border);
}
.project-settings-row.archived { opacity: 0.6; }
.psrow-info { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.psrow-name { font-size: var(--fs-13); font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.psrow-desc { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.psrow-actions { flex: none; }

.filter-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); margin-bottom: 12px;
}
.filter-bar input.search { max-width: 320px; }
.search-wrap { position: relative; flex: 1; min-width: 180px; max-width: 320px; }
.search-wrap .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-wrap input { padding-left: 32px; }
.search-wrap kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--muted); background: var(--surface-2);
  padding: 1px 6px; border-radius: 4px; border: 1px solid var(--border);
  font-family: inherit;
}

.entry-card {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 10px;
  transition: border-color .12s;
}
.entry-card:hover { border-color: var(--border-strong); }
.entry-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.entry-meta .time { color: var(--muted); font-size: var(--fs-12); margin-left: auto; }
.entry-preview { color: var(--text-2); font-size: var(--fs-13); line-height: 1.55; word-break: break-word; }
.entry-preview.masked { white-space: pre-wrap; border-left: 3px solid var(--danger); padding-left: 10px; color: var(--text); }
.entry-preview.md-body p { margin: 0 0 4px; }
.entry-preview.md-body p:last-child { margin-bottom: 0; }
.entry-preview.md-body h4 { font-size: var(--fs-13); font-weight: 600; margin: 6px 0 2px; color: var(--text); }
.entry-preview.md-body h5 { font-size: var(--fs-13); font-weight: 600; margin: 4px 0 2px; color: var(--text); }
.entry-preview.md-body h6 { font-size: var(--fs-12); font-weight: 600; margin: 4px 0 2px; color: var(--muted); }
.entry-preview.md-body ul, .entry-preview.md-body ol { margin: 4px 0; padding-left: 20px; }
.entry-preview.md-body li { margin-bottom: 2px; }
.entry-preview.md-body strong { font-weight: 600; color: var(--text); }
.entry-preview.md-body em { font-style: italic; }
.entry-preview.md-body code { font-family: ui-monospace, monospace; font-size: .85em; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; color: var(--accent); }
.entry-preview.md-body pre { background: var(--surface-2); border-radius: var(--radius); padding: 8px 12px; overflow-x: auto; margin: 6px 0; }
.entry-preview.md-body pre code { background: none; padding: 0; color: var(--text); }
.entry-preview.md-body hr { border: none; border-top: 1px solid var(--border); margin: 6px 0; }
.entry-preview.md-body br { display: block; content: ""; margin-top: 4px; }
.entry-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 8px; flex-wrap: wrap; }
.entry-tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* Secondary actions hide until hover/focus on the row, keeping rows calm. */
.entry-card .entry-actions { opacity: .6; transition: opacity .12s ease; }
.entry-card:hover .entry-actions,
.entry-card:focus-within .entry-actions { opacity: 1; }
.entry-more { position: relative; display: inline-block; }
.entry-more-toggle { width: 28px; height: 26px; padding: 0; }
.entry-more-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 4px);
  z-index: 20; min-width: 160px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: 4px;
  flex-direction: column; gap: 2px;
}
.entry-more.open .entry-more-menu { display: flex; }
.entry-more-menu button { justify-content: flex-start; height: 30px; width: 100%; }
.entry-more-menu button.danger { color: var(--danger); }
.entry-more-menu button.danger:hover { background: var(--danger-soft); }

/* ---- Loading skeleton ---- */
.loading-row { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 48px 20px; }
.loading-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); animation: ldp 1.2s ease-in-out infinite; }
.loading-dot:nth-child(2) { animation-delay: .2s; }
.loading-dot:nth-child(3) { animation-delay: .4s; }
@keyframes ldp { 0%,100%{opacity:.3} 50%{opacity:1} }

.empty {
  padding: 48px 20px; text-align: center; color: var(--muted);
  border: 1px dashed var(--border); border-radius: var(--radius-lg);
  background: var(--bg-elev);
}
.empty-art {
  width: 96px; height: 96px; margin: 0 auto 16px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--accent-soft), var(--teal-soft));
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}

/* ---- Inbox diff ---- */
.diff-block {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; margin-top: 8px;
  font-family: ui-monospace, monospace; font-size: var(--fs-12);
}
.diff-row { display: grid; grid-template-columns: 120px 1fr; gap: 10px; padding: 4px 0; align-items: start; }
.diff-row + .diff-row { border-top: 1px dashed var(--border); }
.diff-row .k { color: var(--muted); }
.diff-row .before { text-decoration: line-through; color: var(--danger); }
.diff-row .arrow { color: var(--muted); margin: 0 6px; }
.diff-row .after  { color: var(--success); }
.citation-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 999px; font-size: var(--fs-11);
  color: var(--text-2); margin-right: 4px;
}
.citation-pill:hover { border-color: var(--accent); color: var(--accent); }

.group-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius);
  margin: 12px 0 8px; cursor: pointer; user-select: none;
}
.group-header .caret { transition: transform .12s; }
.group-header.collapsed .caret { transform: rotate(-90deg); }

.sticky-bulk {
  position: sticky; bottom: 12px; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; margin-top: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
}

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs button {
  background: transparent; border: 0; border-bottom: 2px solid transparent;
  border-radius: 0; height: 36px; padding: 0 14px; color: var(--muted);
}
.tabs button:hover { color: var(--text); background: transparent; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-13); }
table.data th, table.data td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
table.data th { background: var(--surface-2); font-weight: 500; color: var(--muted); font-size: var(--fs-12); text-transform: uppercase; letter-spacing: .3px; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: var(--surface-2); }

/* ---- Settings ---- */
.settings-wrap { max-width: 720px; }
.settings-section {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius-lg); margin-bottom: 16px;
  overflow: hidden;
}
.settings-section > .sh {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  cursor: pointer; user-select: none;
  border-bottom: 1px solid transparent;
}
.settings-section.open > .sh { border-bottom-color: var(--border); }
.settings-section > .sh h3 { flex: 1; }
.settings-section > .sh .caret { transition: transform .12s; color: var(--muted); }
.settings-section.open > .sh .caret { transform: rotate(90deg); }
.settings-section > .sb { padding: 18px; display: none; }
.settings-section.open > .sb { display: block; }
.settings-section .form-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .settings-section .form-grid.two { grid-template-columns: 1fr 1fr; } }

/* JSON editor */
.json-editor {
  font-family: ui-monospace, monospace; font-size: var(--fs-13);
  min-height: 200px; tab-size: 2;
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
[data-tip] { position: relative; }
[data-tip]:hover::after,
[data-tip]:focus-visible::after {
  content: attr(data-tip);
  /* 默认向下展开，避免在顶部被 topbar/页面边界遮住 */
  position: absolute; top: calc(100% + 8px); right: 0; left: auto;
  background: var(--surface-3); color: var(--text); padding: 6px 10px; border-radius: 6px;
  font-size: var(--fs-12); line-height: 1.45;
  width: max-content; min-width: 4em; max-width: 220px;
  white-space: normal; word-break: keep-all;
  pointer-events: none; z-index: 110;
  border: 1px solid var(--border); box-shadow: var(--shadow-md);
}
/* topbar 右侧反转：如果提示在左边会被遮，允许调用方加 .tip-left 让它左齐 */
[data-tip].tip-left:hover::after { right: auto; left: 0; }

/* ---- Quick-add bar (entries page) ---- */
.quick-add {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 12px 14px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.quick-add textarea {
  border: 0; background: transparent; padding: 4px 4px;
  min-height: 36px; resize: none; flex: 1;
}
.quick-add textarea:focus { box-shadow: none; }
.quick-add .qa-actions { display: flex; gap: 4px; align-items: center; }
.quick-add .qa-hint { color: var(--muted); font-size: var(--fs-11); margin-top: 4px; }

/* Mic recording pulse */
.mic-rec {
  background: var(--danger-soft) !important; color: var(--danger) !important;
  animation: micPulse 1.2s ease-in-out infinite;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--danger-soft); }
  50%      { box-shadow: 0 0 0 6px transparent; }
}

/* ---- Upload preview inside entry dialog ---- */
.upload-preview { margin-top: 8px; display: flex; gap: 12px; align-items: center; }
.upload-preview img, .upload-preview audio {
  max-width: 200px; max-height: 120px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-2);
}
.upload-preview .meta { font-size: var(--fs-12); color: var(--muted); }

/* ---- Entry thumbnail (image / voice entries) ---- */
.entry-thumb {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-top: 6px;
  background: var(--surface-2); border-radius: var(--radius);
  border: 1px dashed var(--border);
}
.entry-thumb img { max-width: 96px; max-height: 64px; border-radius: 6px; }
.entry-thumb audio { max-width: 240px; height: 32px; }

/* 内联附件托盘：文字 capture 带图片附件时展示 */
.attach-inline-tray {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 8px; padding: 8px 10px;
  background: var(--surface-2); border-radius: var(--radius);
  border: 1px dashed var(--border);
}
.attach-inline-item { position: relative; }
.attach-inline-item img {
  display: block; max-width: 120px; max-height: 80px;
  border-radius: 6px; object-fit: cover; cursor: pointer;
}
.attach-inline-item audio { height: 32px; max-width: 220px; }

/* ---- Audit log panel ---- */
.audit-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; align-items: center; }
.audit-filters input, .audit-filters select { max-width: 180px; }
.audit-list { font-size: var(--fs-12); }
.audit-list .audit-row {
  display: grid; grid-template-columns: 160px 90px 1fr; gap: 10px;
  padding: 6px 10px; border-bottom: 1px dashed var(--border);
  align-items: start;
}
.audit-list .audit-row:hover { background: var(--surface-2); }
.audit-list .audit-row .t { color: var(--muted); font-family: ui-monospace, monospace; font-size: var(--fs-11); }
.audit-list .audit-row .a { color: var(--accent); font-weight: 500; }
.audit-list .audit-row .tgt { color: var(--text-2); word-break: break-all; }
.audit-list .audit-row .meta-pre { grid-column: 1 / -1; font-size: var(--fs-11); color: var(--muted); font-family: ui-monospace, monospace; margin-left: 160px; }

/* Keyboard shortcuts help card */
.kbd-help { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: var(--fs-13); }
.kbd-help kbd {
  font-family: ui-monospace, monospace; font-size: var(--fs-11);
  padding: 2px 6px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text-2);
}

/* Better primary CTAs — softer shadow for light theme */
[data-theme="light"] button.primary, [data-theme="light"] .btn.primary {
  box-shadow: 0 1px 0 rgba(14,165,165,.15), var(--shadow-sm);
}
[data-theme="light"] .entry-card { box-shadow: var(--shadow-sm); }
[data-theme="light"] .card { box-shadow: var(--shadow-sm); }

/* =======================================================================
   2026 REDESIGN — mobile-first, IM-style composer, softer palette
   (Additive section — overrides earlier rules where needed.)
   ======================================================================= */

/* --- Palette refresh: warmer off-white, calmer accent ---------------- */
:root, [data-theme="light"] {
  --bg:        #f7f8fb;
  --bg-elev:   #ffffff;
  --surface:   #ffffff;
  --surface-2: #f1f4f9;
  --surface-3: #e6ebf3;
  --border:    #e4e9f1;
  --border-strong: #ccd4e0;

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 2px rgba(22,32,56,.04), 0 1px 1px rgba(22,32,56,.03);
  --shadow-md: 0 6px 18px rgba(22,32,56,.08);
  --shadow-lg: 0 24px 64px rgba(22,32,56,.16);

  --bottom-tabs-h: 60px;
  --composer-gap:  12px;
}

/* --- Topbar brand tweak --------------------------------------------- */
.topbar { border-bottom: 1px solid var(--border); background: rgba(255,255,255,.85); backdrop-filter: saturate(1.1) blur(8px); }
.tb-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); }
.tb-logo {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
}
.tb-logo img { width: 28px; height: 28px; display: block; }
.tb-name { font-size: var(--fs-14); letter-spacing: .2px; }

/* --- Bottom tab bar (mobile) ---------------------------------------- */
.bottom-tabs {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(1.2) blur(14px);
  border-top: 1px solid var(--border);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
.bottom-tabs .bt-item {
  flex: 1;
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px;
  color: var(--muted); font-size: var(--fs-11);
  border-radius: 12px; text-decoration: none; position: relative;
}
.bottom-tabs .bt-item.active { color: var(--accent); background: var(--accent-soft); }
.bottom-tabs .bt-item svg { width: 22px; height: 22px; }
.bottom-tabs .bt-pill {
  position: absolute; top: 2px; right: 18%;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--danger); color: #fff; border-radius: 999px;
  font-size: 10px; line-height: 16px; text-align: center;
}
@media (max-width: 380px) {
  .bottom-tabs .bt-item { padding: 6px 2px; font-size: 10px; }
  .bottom-tabs .bt-item svg { width: 20px; height: 20px; }
}

@media (max-width: 900px) {
  .app-root,
  .app-root.sidebar-collapsed {
    grid-template-columns: 1fr;
    min-height: 100vh;
    min-height: 100dvh;
  }
  .sidebar { display: none !important; }
  .bottom-tabs { display: flex; }
  .main { padding-bottom: calc(var(--bottom-tabs-h) + env(safe-area-inset-bottom) + 8px); }
  .topbar { padding: 0 14px; }
  .content { padding: 12px; overflow-x: hidden; }
  /* 移动端专属页面（有自己的内部间距）去掉 content 的冗余 padding/min-height */
  .content:has(> .m-tasks),
  .content:has(> .m-dash),
  .content:has(> .m-inbox),
  .content:has(> .m-topics) { padding: 0; min-height: 0; }
}

/* --- Entries layout: legacy two-column mode only --------------------- */
/* The capture-board redesign uses a single-column layout. Keep the old
  projectbar split only when a projectbar is actually rendered. */
.entries-layout:has(.projectbar) { grid-template-columns: var(--projectbar-w) 1fr; }
.feed-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

@media (max-width: 900px) {
  .projectbar { display: none; }
  .entries-layout { grid-template-columns: 1fr; gap: 8px; }
}

/* --- Project chips row (mobile only) -------------------------------- */
.project-chips {
  display: none;
  gap: 8px; padding: 2px 2px 4px;
  overflow-x: auto; scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.project-chips::-webkit-scrollbar { display: none; }
@media (max-width: 900px) { .project-chips { display: flex; } }

.project-chips .pchip {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; height: 34px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; color: var(--text-2);
  font-size: var(--fs-13); white-space: nowrap;
  scroll-snap-align: start;
  box-shadow: var(--shadow-sm);
  transition: transform .08s ease;
}
.project-chips .pchip:active { transform: scale(.97); }
.project-chips .pchip.active {
  background: var(--accent-soft); border-color: transparent; color: var(--accent);
  font-weight: 500;
}
.project-chips .pchip .pdot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.project-chips .pchip .pdot.archived { background: var(--muted-2); }
.project-chips .pchip .pcount {
  background: var(--surface-3); color: var(--muted);
  padding: 0 6px; border-radius: 999px;
  font-size: 10px; font-weight: 500; min-width: 18px; text-align: center;
}
.project-chips .pchip.active .pcount { background: rgba(14,165,165,.22); color: var(--accent); }
.project-chips .pchip .pmenu {
  margin-left: 4px; padding: 0 4px; color: var(--muted);
  cursor: pointer; font-size: 16px; line-height: 1;
}
.project-chips .pchip-add {
  background: var(--accent-soft); color: var(--accent); border: 1px dashed var(--accent);
  box-shadow: none; font-weight: 500;
}

/* --- Entry card refresh --------------------------------------------- */
.entry-card {
  position: relative;
  padding: 14px 16px 14px 18px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s ease, transform .08s ease;
}
.entry-card:hover { box-shadow: var(--shadow-md); }
.entry-card::before {
  content: ""; position: absolute; left: 8px; top: 14px; bottom: 14px;
  width: 3px; border-radius: 3px; background: var(--accent-soft);
}
.entry-card:has(.badge.conf)::before { background: var(--danger); }
.entry-card:has(.badge.warning)::before { background: var(--warning); }
.entry-card:has(.badge.success)::before { background: var(--success); }
.entry-card:has(.badge.muted-badge)::before { background: var(--text-3); }
.entry-card:has(.badge.success),
.entry-card:has(.badge.muted-badge) { opacity: 0.65; }
.entry-card:has(.badge.success):hover,
.entry-card:has(.badge.muted-badge):hover { opacity: 1; }
.entry-meta .time { font-size: var(--fs-11); }
.entry-preview { font-size: var(--fs-14); line-height: 1.6; color: var(--text); }
.entry-preview.masked { border-left-color: var(--danger); }
.secure-preview {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px;
  border: 0; border-left: 4px solid var(--danger);
  background: transparent; color: var(--text);
  border-radius: 10px; cursor: pointer;
}
.secure-preview:hover { background: var(--danger-soft); }
.secure-hint { display: block; margin-top: 6px; font-size: var(--fs-11); color: var(--text-3); }
.secure-peek {
  position: fixed; z-index: 95; width: min(340px, calc(100vw - 24px));
  padding: 12px; border: 1px solid var(--border-strong);
  border-radius: 16px; background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.secure-peek pre,
.secure-modal pre {
  margin: 8px 0 10px; padding: 10px;
  white-space: pre-wrap; word-break: break-word;
  border: 1px dashed var(--danger);
  border-radius: 12px; background: var(--danger-soft);
  color: var(--text); font-size: 14px; line-height: 1.55;
}

.entry-thumb img { max-width: 220px; max-height: 160px; }
@media (max-width: 900px) {
  .entry-thumb img { max-width: 100%; max-height: 220px; width: 100%; object-fit: cover; }
}

/* --- Composer (IM-style) -------------------------------------------- */
.composer {
  position: sticky; bottom: 0; z-index: 15;
  background: rgba(255,255,255,.94);
  backdrop-filter: saturate(1.2) blur(10px);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius-lg) + 4px);
  padding: 8px 10px;
  box-shadow: var(--shadow-md);
  margin-top: 8px;
}
.composer .c-main {
  display: flex; align-items: flex-end; gap: 6px;
}
.composer .c-proj {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 10px;
  background: var(--accent-soft); color: var(--accent);
  border: 0; border-radius: 10px;
  font-size: var(--fs-12); font-weight: 500; white-space: nowrap;
  max-width: 120px; overflow: hidden; text-overflow: ellipsis;
}
.composer .c-proj .dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.composer .c-btn {
  flex: 0 0 auto;
  width: 36px; height: 36px; padding: 0;
  background: var(--surface-3); color: var(--text-2);
  border: 1px solid var(--border); border-radius: 10px;
}
.composer .c-btn:hover { background: var(--border); color: var(--text); }
.composer .c-btn.c-send {
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 6px rgba(14,165,165,.35);
}
.composer .c-btn.c-send:hover { background: var(--accent-hover); }
.composer .c-input-wrap { flex: 1; min-width: 0; }
.composer .c-input-wrap textarea {
  border: 0; background: transparent; padding: 8px 10px;
  min-height: 36px; max-height: 180px; resize: none;
  width: 100%; font-size: var(--fs-14); line-height: 1.5;
}
.composer .c-input-wrap textarea:focus { box-shadow: none; outline: none; }

.composer .c-extras {
  max-height: 0; overflow: hidden; transition: max-height .18s ease;
}
.composer.is-focused .c-extras,
.composer.has-text .c-extras { max-height: 80px; }
.composer .c-extras-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 4px 2px;
  border-top: 1px dashed var(--border);
  margin-top: 6px;
  font-size: var(--fs-12);
}
.composer .c-sens {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-3); padding: 3px 8px 3px 5px;
  border-radius: 999px;
  cursor: pointer; user-select: none;
  font-size: var(--fs-12); color: var(--text-2);
  margin: 0;
}
.composer .c-sens input { width: 14px; height: 14px; margin: 0; accent-color: var(--accent); }
.segmented.sm button { height: 24px; padding: 0 8px; font-size: var(--fs-11); }

.composer.composer-empty { display: flex; align-items: center; padding: 14px; }

/* Mic pulse applies to the new .c-mic button too */
.composer .c-mic.mic-rec {
  background: var(--danger-soft) !important; color: var(--danger) !important;
}
.composer-fab-wrap { display: none; }
.composer-fab {
  display: inline-flex; align-items: center; justify-content: center;
  width: 58px; height: 58px;
  border: 0; border-radius: 50%;
  background: var(--accent); color: #fff;
  box-shadow: 0 10px 28px rgba(14,165,165,.32);
  font-size: 16px; font-weight: 700;
  flex-shrink: 0;
}
.composer-fab:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 3px; }
.composer-fab.pushtalk-fab {
  background: linear-gradient(135deg, #10b981, #0ea5a5);
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; /* iOS 长按不弹 callout 菜单 */
  touch-action: none;  /* 阻止滚动以保持 pointer 流 */
}
.composer-fab.pushtalk-fab span,
.composer-fab.pushtalk-fab svg {
  -webkit-user-select: none; user-select: none;
  pointer-events: none; /* 防止子元素拦截 pointer 事件 */
}
.composer-fab.pushtalk-fab.disabled {
  background: #cbd5e1; color: #64748b; box-shadow: none;
}
.composer-fab.pushtalk-fab:active {
  transform: scale(0.96);
  box-shadow: 0 6px 14px rgba(16,185,129,.45);
}

/* WeChat-style fullscreen overlay while holding the push-to-talk button */
.ptt-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
  background: rgba(15, 23, 42, 0.86);
  color: #fff;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  pointer-events: none;  /* 让 pointermove/up 继续到 button */
  animation: pttIn .14s ease-out;
}
.ptt-overlay.cancelling { background: rgba(185, 28, 28, 0.88); }
.ptt-overlay .ptt-mic {
  width: 96px; height: 96px; border-radius: 50%;
  background: rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  animation: pttPulse 1.2s ease-in-out infinite;
}
.ptt-overlay.cancelling .ptt-mic { animation: none; background: rgba(255,255,255,0.18); }
.ptt-overlay .ptt-text {
  max-width: 86vw;
  font-size: 16px; line-height: 1.5;
  text-align: center;
  color: rgba(255,255,255,0.92);
  min-height: 1.5em;
  padding: 0 12px;
  white-space: pre-wrap; word-break: break-word;
}
.ptt-overlay .ptt-hint {
  font-size: 13px; color: rgba(255,255,255,0.7); letter-spacing: 0.5px;
}
@keyframes pttIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes pttPulse {
  0%,100% { transform: scale(1);    box-shadow: 0 0 0 0    rgba(255,255,255,0.4); }
  50%     { transform: scale(1.08); box-shadow: 0 0 0 18px rgba(255,255,255,0); }
}

/* On mobile composer docks above the bottom-tab-bar */
@media (max-width: 900px) {
  .composer-fab-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    position: fixed;
    right: 16px;
    bottom: calc(var(--bottom-tabs-h) + env(safe-area-inset-bottom) + 14px);
    z-index: 35;
  }
  .composer {
    position: fixed;
    left: auto; right: 12px;
    width: min(420px, calc(100vw - 24px));
    bottom: calc(var(--bottom-tabs-h) + env(safe-area-inset-bottom) + 12px);
    margin: 0;
    padding: 10px;
    border-radius: 22px;
  }
  .feed-col { padding-bottom: 132px; }  /* reserve room for floating composer */
  .composer .c-proj { display: none; }  /* save width; project selected via chip row */
  .composer .c-main {
    display: grid;
    grid-template-columns: 40px 40px 40px 1fr 46px;
    gap: 8px;
    align-items: center;
  }
  .composer .c-input-wrap {
    grid-column: 1 / -1;
    grid-row: 1;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 16px;
  }
  .composer .c-main > .c-btn { grid-row: 2; }
  .composer .c-btn { width: 40px; height: 40px; border-radius: 12px; }
  .composer .c-btn.c-send { grid-column: 5; justify-self: end; width: 46px; }
  .composer .c-input-wrap textarea {
    font-size: 16px;
    min-height: 46px;
    padding: 11px 12px;
  }
  .composer.is-mobile-simple .c-main {
    grid-template-columns: 40px minmax(0, 1fr) 44px 48px;
    gap: 8px;
  }
  .composer.is-mobile-simple .c-input-wrap {
    grid-column: 2;
    grid-row: 1;
  }
  .composer.is-mobile-simple .c-main > .c-btn { grid-row: 1; }
  .composer.is-mobile-simple .c-mic { grid-column: 3; }
  .composer.is-mobile-simple .c-send { grid-column: 4; }
  .composer.is-mobile-simple .c-collapse { grid-column: 1; }
  .composer.is-mobile-simple .c-extras { display: none; }
  .composer.is-mobile-simple .c-input-wrap textarea {
    min-height: 44px;
    max-height: 128px;
    padding: 10px 12px;
  }
  input, textarea, select { font-size: 16px; }
  .search-wrap input { font-size: 14px; } /* 搜索框不需要防 iOS 缩放，保持紧凑 */
  #toast-root { top: 12px; left: 12px; right: 12px; }
  .toast { min-width: 0; max-width: none; }
}

/* --- Action sheet (mobile attach menu) ------------------------------ */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(8,12,22,.45);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px;
  animation: fadeIn .12s ease;
}
.sheet {
  width: 100%; max-width: 460px;
  background: var(--surface);
  border-radius: 18px;
  padding: 8px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .16s ease;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
}
.sheet-title {
  padding: 10px 14px; font-size: var(--fs-13); color: var(--muted);
  text-align: center; border-bottom: 1px solid var(--border);
}
.sheet-items { display: flex; flex-direction: column; padding: 6px; gap: 2px; }
.sheet-item {
  width: 100%; height: 48px;
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px;
  border: 0; background: transparent;
  border-radius: 12px; color: var(--text); font-size: var(--fs-14);
  justify-content: flex-start;
}
.sheet-item:hover, .sheet-item:active { background: var(--surface-2); }
.sheet-item svg { color: var(--accent); }
.sheet-item.danger { color: var(--danger); }
.sheet-item.danger svg { color: var(--danger); }
.sheet-cancel {
  width: 100%; margin-top: 6px; height: 48px;
  background: var(--surface-2); border: 0; border-radius: 12px;
  font-size: var(--fs-14); color: var(--text);
}

/* Desktop: render sheet as centered modal-like floating card */
@media (min-width: 901px) {
  .sheet-backdrop { align-items: center; }
  .sheet { max-width: 360px; }
}

/* --- Projectbar refresh (desktop) ----------------------------------- */
.projectbar { box-shadow: var(--shadow-sm); }
.project-item.active { font-weight: 500; }
.project-item .pmenu-btn {
  opacity: .8; color: var(--muted);
  width: 26px; height: 26px; padding: 0;
  font-size: 18px; font-weight: 700; letter-spacing: 1px;
  line-height: 1; border-radius: 8px;
}
.project-item:hover .pmenu-btn { opacity: 1; color: var(--text-2); background: var(--surface-3); }

/* --- Filter bar polish ---------------------------------------------- */
.filter-bar {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 10px 12px;
}
@media (max-width: 900px) {
  .filter-bar { overflow-x: auto; flex-wrap: nowrap; }
  .filter-bar .search-wrap { min-width: 140px; }
}

/* --- Misc tightening for narrow screens ----------------------------- */
@media (max-width: 560px) {
  h1 { font-size: 18px; }
  .entry-card { padding: 12px 14px 12px 16px; }
  .entry-card::before { left: 6px; }
  .topbar { height: 52px; }
  .content { padding: 10px; }
  .modal { border-radius: 18px; }
  .modal-header, .modal-body, .modal-footer { padding-left: 16px; padding-right: 16px; }
}

/* Legacy quick-add rule retained for any old callers (harmless no-op). */

/* --- Inline guidance / help ------------------------------------------ */
.page-guide {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
  overflow: hidden;
}
.page-guide summary {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--text-2);
  list-style: none;
}
.page-guide summary::-webkit-details-marker { display: none; }
.page-guide summary svg { color: var(--accent); flex: none; }
.page-guide summary .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guide-content { padding: 12px 14px 14px; border-top: 1px dashed var(--border); }
.guide-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 10px; }
.guide-grid h4, .help-card h4 { margin: 0 0 6px; font-size: var(--fs-13); color: var(--text); }
.guide-grid ul, .help-card ul, .help-card ol { margin: 0; padding-left: 20px; color: var(--text-2); }
.guide-grid li, .help-card li { margin: 4px 0; }
.guide-grid dl { margin: 0; }
.guide-grid dt { font-weight: 650; color: var(--text); margin-top: 6px; }
.guide-grid dd { margin: 2px 0 6px; color: var(--muted); }
.help-wrap { max-width: 1080px; display: flex; flex-direction: column; gap: 16px; }
.help-hero h1 { font-size: 26px; font-weight: 700; margin-bottom: 8px; }
.help-flow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.help-flow span:not(:nth-child(even)) {
  background: var(--accent-soft); color: var(--accent);
  padding: 6px 10px; border-radius: 999px; font-size: var(--fs-12); font-weight: 600;
}
.help-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  box-shadow: var(--shadow-sm);
}
.help-card h2 { margin-bottom: 10px; font-weight: 650; }
.help-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.help-page-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.help-page-grid .help-card { box-shadow: none; }
.callout {
  padding: 10px 12px; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--text);
  border: 1px solid rgba(14,165,165,.18);
  margin: 8px 0 12px;
}
.callout.warning { background: var(--warning-soft); color: var(--warning); border-color: rgba(217,119,6,.22); }
.permission-guide ol { margin: 10px 0 0; padding-left: 20px; color: var(--text-2); }
.permission-guide li { margin: 6px 0; }
.delete-preview {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--danger);
  background: var(--surface-2);
  border-radius: var(--radius);
  color: var(--text-2);
  white-space: pre-wrap;
}

/* --- Public OpenClaw learning page ---------------------------------- */
.learn-body { background: linear-gradient(180deg, #f0fdfa, #f8fafc 38%, #fff); color: var(--text); }
.learn-page { width: min(1120px, calc(100vw - 32px)); margin: 0 auto; padding: 28px 0 48px; }
.learn-hero {
  padding: clamp(24px, 6vw, 52px);
  border-radius: 28px;
  background: radial-gradient(circle at top right, rgba(20,184,166,.18), transparent 36%), var(--surface);
}
.learn-hero h1 { max-width: 760px; font-size: clamp(30px, 6vw, 58px); letter-spacing: -.04em; }
.learn-hero p { max-width: 760px; color: var(--text-2); font-size: 17px; line-height: 1.75; }
.learn-kicker { color: var(--accent); font-weight: 800; margin-bottom: 10px; }
.learn-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.learn-card { margin-top: 16px; padding: clamp(18px, 3vw, 28px); border-radius: 24px; }
.learn-card h2 { margin-bottom: 14px; font-size: clamp(22px, 3vw, 30px); }
.learn-card h3 { margin-bottom: 6px; }
.learn-grid { display: grid; gap: 12px; }
.learn-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.learn-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.learn-grid > div {
  padding: 14px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface-2);
}
.learn-grid p, .learn-card li { color: var(--text-2); line-height: 1.7; }
.learn-steps { display: grid; gap: 10px; padding-left: 0; list-style: none; counter-reset: step; }
.learn-steps li {
  counter-increment: step; display: grid; grid-template-columns: auto 1fr; gap: 8px 12px;
  padding: 12px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface-2);
}
.learn-steps li::before {
  content: counter(step); grid-row: span 3;
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 800;
}
.learn-steps code { width: fit-content; padding: 2px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.learn-timeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.learn-timeline div { padding: 14px; border-radius: 18px; background: var(--accent-soft); }
.learn-timeline span { display: inline-flex; margin-bottom: 8px; color: var(--accent); font-weight: 800; }
.learn-checks { display: grid; gap: 8px; padding-left: 20px; }

@media (max-width: 900px) {
  .guide-grid, .help-columns, .help-page-grid { grid-template-columns: 1fr; }
  .page-guide summary { align-items: flex-start; }
  .page-guide summary .small { white-space: normal; }
  .help-hero h1 { font-size: 22px; }
  .learn-grid.two, .learn-grid.three, .learn-timeline { grid-template-columns: 1fr; }
  .learn-page { width: min(100vw - 20px, 1120px); padding-top: 14px; }
}

/* =======================================================================
   v0.3 Cognitive Layer views
   ======================================================================= */
.view-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.dashboard-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.metric-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  box-shadow: var(--shadow-sm);
}
.metric-label { color: var(--muted); font-size: var(--fs-12); margin-bottom: 8px; }
.metric-value { font-size: 28px; line-height: 1.1; color: var(--text); font-weight: 650; letter-spacing: -.02em; }
.dashboard-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; }
.status-bars { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.status-bar .bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.status-bar .bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--teal)); border-radius: inherit; }
.topics-hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .72fr);
  gap: 16px; align-items: stretch; margin-bottom: 14px;
}
.topics-hero-main {
  min-height: 220px; padding: 22px;
  border: 1px solid var(--border); border-radius: 8px;
  background: #f0fdfa; color: #134e4a;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 12px;
}
.topics-kicker {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-11); font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: #0f766e;
}
.topics-hero h1 {
  font-size: clamp(30px, 5vw, 56px);
  line-height: .98; font-weight: 850; max-width: 620px;
}
.topics-hero-main p {
  max-width: 620px; color: #315f5b; font-size: var(--fs-16); line-height: 1.65;
}
.topics-hero-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.topics-hero-stats span {
  display: inline-flex; align-items: baseline; gap: 4px;
  padding: 6px 10px; border: 1px solid rgba(13, 148, 136, .22);
  border-radius: 999px; background: rgba(255,255,255,.58); color: #315f5b;
  font-size: var(--fs-12);
}
.topics-hero-stats strong { color: #134e4a; font-size: var(--fs-16); }
.topic-focus-card {
  position: relative; overflow: hidden; min-height: 220px;
  padding: 18px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text);
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: var(--shadow-sm);
}
.topic-focus-card:hover { color: var(--text); border-color: #f97316; }
.topic-focus-card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: #f97316;
}
.topic-focus-card.type-todo::before { background: #4f46e5; }
.topic-focus-card.type-decision::before { background: #f97316; }
.topic-focus-card.type-idea::before { background: #06b6d4; }
.topic-focus-card.type-reference::before { background: #16a34a; }
.topic-focus-icon {
  width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; background: var(--surface-2); color: var(--accent);
}
.topic-focus-card h2 { margin-top: 4px; font-size: var(--fs-24); font-weight: 760; line-height: 1.22; }
.topic-focus-card p { margin-top: 8px; color: var(--text-2); line-height: 1.6; }
.topic-focus-foot {
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: var(--fs-12);
}
.topic-focus-foot span:not(:last-child)::after { content: "·"; margin-left: 8px; color: var(--muted-2); }
.empty-focus { justify-content: center; border-style: dashed; }
.empty-focus strong { font-size: var(--fs-20); }
.topic-category-nav {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px; margin-bottom: 12px;
}
.topic-category-card {
  height: auto; min-height: 78px; justify-content: flex-start;
  padding: 12px; border-radius: 8px; background: var(--surface);
  border-color: var(--border); color: var(--text); gap: 10px;
}
.topic-category-card:hover { background: var(--surface); border-color: var(--border-strong); }
.topic-category-card.active { border-color: #0d9488; box-shadow: 0 0 0 3px rgba(13, 148, 136, .14); }
.topic-category-icon {
  width: 34px; height: 34px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); flex: none;
}
.topic-category-card.type-todo .topic-category-icon { background: #eef2ff; color: #4338ca; }
.topic-category-card.type-decision .topic-category-icon { background: #fff7ed; color: #c2410c; }
.topic-category-card.type-idea .topic-category-icon { background: #ecfeff; color: #0e7490; }
.topic-category-card.type-reference .topic-category-icon { background: #f0fdf4; color: #15803d; }
.topic-category-copy { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.topic-category-copy strong { font-size: var(--fs-13); }
.topic-category-copy small {
  max-width: 100%; color: var(--muted); font-size: var(--fs-11);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topic-category-count {
  margin-left: auto; min-width: 28px; height: 28px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--text); font-weight: 800; font-size: var(--fs-12);
}
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.topic-list.compact { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.topic-filter-bar .segmented button { min-width: 58px; }
.topic-filter-bar {
  margin-bottom: 14px; border-radius: 8px; background: var(--surface);
}
.topic-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* topic-scroll-strip：桌面端 flex 行内展开；手机端横滑 */
.topic-scroll-strip {
  display: flex; align-items: center; gap: 6px; flex: 1; flex-wrap: wrap;
}
.topic-strip-sep {
  width: 1px; height: 18px; background: var(--border); flex-shrink: 0; margin: 0 2px;
}
.topic-filter-bar .view-toggle button { min-width: 36px; padding: 4px 8px; }

/* 点击"查看原始录入"后，对应卡片短暂高亮 */
@keyframes highlightFlash {
  0%,100% { box-shadow: none; }
  30%      { box-shadow: 0 0 0 3px var(--accent); }
}
.highlight-flash { animation: highlightFlash 1.4s ease; }

/* ── 手机端 filter-bar：搜索框首行，筛选条横滑第二行 ───────────── */
@media (max-width: 900px) {
  .topics-hero { grid-template-columns: 1fr; }
  .topics-hero-main, .topic-focus-card { min-height: auto; }
  .topics-hero h1 { font-size: 34px; }
  .topic-category-nav {
    display: flex; overflow-x: auto; gap: 8px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px;
  }
  .topic-category-nav::-webkit-scrollbar { display: none; }
  .topic-category-card { min-width: 172px; flex: 0 0 172px; }
  .topic-filter-bar {
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
  }
  .topic-filter-bar .search-wrap {
    width: 100%; max-width: 100%;
    min-width: 0;
  }
  /* 第二行：可横向滑动的筛选条 */
  .topic-scroll-strip {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding-bottom: 2px;  /* 保留滑动手感空间 */
  }
  .topic-scroll-strip::-webkit-scrollbar { display: none; }
  .topic-scroll-strip .chip { flex-shrink: 0; }
  .topic-scroll-strip .segmented { flex-shrink: 0; }
  .topic-scroll-strip .segmented button {
    min-width: 42px; font-size: 12px; padding: 5px 9px; white-space: nowrap;
  }
  .topic-filter-bar .view-toggle button { min-width: 34px; padding: 5px 8px; }
  .topic-strip-sep { flex-shrink: 0; }
}
.event-timeline,
.topic-category-sections { display: flex; flex-direction: column; gap: 14px; }
.topic-category-section {
  padding: 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.topic-category-section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.topic-category-section-head h2 { margin-top: 2px; font-size: var(--fs-20); font-weight: 760; }

/* --- Project × type cluster view --- */
.topic-project-clusters { display: flex; flex-direction: column; gap: 20px; }
.topic-project-cluster {
  padding: 14px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.topic-project-cluster-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.topic-project-cluster-title .topics-kicker { display: block; margin-bottom: 2px; }
.topic-project-cluster-title h2 { margin: 0; font-size: var(--fs-18); font-weight: 760; }
.topic-project-cluster-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* Mobile project filter chips */
.m-proj-chips {
  display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto;
  padding: 8px 16px; scrollbar-width: none;
}
.m-proj-chips::-webkit-scrollbar { display: none; }
.m-proj-chip {
  flex-shrink: 0; padding: 6px 14px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: var(--fs-13); cursor: pointer; transition: background .15s, border-color .15s;
  white-space: nowrap; min-height: 36px; display: flex; align-items: center;
}
.m-proj-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.event-time-group {
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.event-time-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.event-time-head strong { font-size: var(--fs-13); color: var(--text); }
.event-time-list { display: flex; flex-direction: column; gap: 8px; }
.event-row {
  display: grid; grid-template-columns: 58px auto auto minmax(0, 1fr) auto;
  gap: 10px; align-items: center; min-height: 56px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface-2); color: var(--text);
}
.event-row:hover { color: var(--text); border-color: var(--accent); box-shadow: var(--shadow-sm); }
.event-row-date { color: var(--muted); font-variant-numeric: tabular-nums; font-size: var(--fs-12); }
.event-row-main { min-width: 0; }
.event-row-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-14); }
.event-row-main p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 事件行/卡片的删除按钮包装层 */
.event-row-wrap { display: flex; align-items: center; gap: 6px; }
.event-row-wrap .event-row { flex: 1; min-width: 0; }
.topic-card-wrap { position: relative; }
.topic-card-wrap .topic-card { width: 100%; }
.btn-delete-topic {
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0;
  background: none; border: 1px solid transparent;
  color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1;
  border-radius: 6px; opacity: 0; transition: opacity .15s, background .12s, color .12s, border-color .12s;
}
.event-row-wrap:hover .btn-delete-topic,
.topic-card-wrap:hover .btn-delete-topic { opacity: 1; }
.btn-delete-topic:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-delete-topic.danger {
  background: var(--danger-soft); border-color: var(--danger); color: var(--danger);
  opacity: 1; width: auto; padding: 0 8px; white-space: nowrap; font-size: var(--fs-12);
}
/* 卡片视图中绝对定位到右上角 */
.topic-card-wrap .btn-delete-topic { position: absolute; top: 8px; right: 8px; }
.topic-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px; min-height: 156px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); color: var(--text);
  box-shadow: var(--shadow-sm); transition: transform .08s ease, box-shadow .15s ease, border-color .15s ease;
}
.topic-card:hover { color: var(--text); transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.topic-card h3 { font-size: var(--fs-16); font-weight: 650; }
.topic-card p { flex: 1; line-height: 1.55; }
.topic-stats { display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: var(--fs-11); }
.topic-stats span { background: var(--surface-2); border-radius: 999px; padding: 2px 7px; }
.topic-hero { margin-bottom: 16px; }
.topic-hero h1 { margin: 10px 0 6px; font-size: var(--fs-24); font-weight: 680; }
.topic-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin-bottom: 14px; padding: 4px 2px 8px;
}
.topic-header-main { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.topic-header h1 { margin: 8px 0 6px; font-size: var(--fs-24); line-height: 1.25; font-weight: 720; word-break: break-word; }
.topic-header p { max-width: 760px; line-height: 1.6; }
.topic-header-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; flex: none; padding-top: 28px; }
.topic-header-overview {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px;
}
.topic-header-pill {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 38px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); color: var(--text-2);
}
.topic-header-pill.tone-warning { background: var(--warning-soft); }
.topic-header-pill.tone-accent { background: var(--accent-soft); }
.topic-header-pill.tone-success { background: var(--success-soft); }
.topic-header-pill-label {
  font-size: var(--fs-11); font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted);
}
.topic-header-pill-value { font-size: var(--fs-13); line-height: 1.45; color: var(--text); }
.topic-context-archive { margin-top: 16px; }
.topic-context-archive > summary {
  min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  cursor: pointer; font-weight: 700; list-style: none;
}
.topic-context-archive > summary::-webkit-details-marker { display: none; }
.topic-archive-body { display: grid; gap: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.topic-archive-section { padding: 12px 0; border-bottom: 1px dashed var(--border); }
.topic-archive-section:last-child { border-bottom: 0; }
.topic-archive-section h3 { margin: 0 0 4px; font-size: var(--fs-15); }
.security-flow-card {
  margin-bottom: 16px; border-left: 4px solid var(--danger);
  background: linear-gradient(180deg, var(--danger-soft), var(--surface));
}
.security-flow-card ul { margin-bottom: 0; line-height: 1.7; }
.topic-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.topic-section h2 { margin-bottom: 4px; }
.mini-row {
  padding: 10px 0; border-bottom: 1px dashed var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.mini-row:last-child { border-bottom: 0; }
.badge.pipeline { font-variant-numeric: tabular-nums; }
.topic-link { cursor: pointer; }
.pipeline-list { display: flex; flex-direction: column; gap: 10px; }
.pipeline-row {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-elev); overflow: hidden;
}
.pipeline-row summary {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; cursor: pointer; list-style: none;
}
.pipeline-row summary::-webkit-details-marker { display: none; }
.json-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 12px 12px; }
.json-pair pre {
  margin: 4px 0 0; padding: 10px; max-height: 240px; overflow: auto;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); font-size: var(--fs-11); white-space: pre-wrap;
}
.alert.warning { margin: 0 12px 10px; padding: 8px 10px; border-radius: var(--radius); background: var(--warning-soft); color: var(--warning); }
.memory-context-block { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.memory-context-refs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.memory-context-refs li { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.kanban { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; align-items: start; }
.kanban-col {
  min-height: 220px; padding: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.kanban-col.drag-over { outline: 2px dashed var(--accent); outline-offset: 4px; background: var(--accent-soft); }
.kanban-col h2 { color: var(--muted); font-size: var(--fs-12); text-transform: uppercase; letter-spacing: .04em; margin: 2px 4px 10px; display: flex; align-items: center; gap: 4px; }
.kanban-empty-hint { padding: 12px 8px; color: var(--muted); font-style: italic; line-height: 1.5; }
.task-blocker-note { font-size: var(--fs-12); color: var(--warning, #b45309); background: var(--warn-soft, #fef3c7); border-left: 3px solid currentColor; padding: 4px 8px; margin: 6px 0 0; border-radius: 0 4px 4px 0; }
.task-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; margin-bottom: 10px;
  box-shadow: var(--shadow-sm); cursor: pointer;
  touch-action: manipulation;
}
.task-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }
.task-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.schedule-board { margin-bottom: 16px; overflow: hidden; }
.schedule-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 14px; align-items: stretch; }
.schedule-strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(132px, 1fr);
  gap: 10px; overflow-x: auto; padding-bottom: 4px;
}
.schedule-day {
  min-height: 148px; padding: 10px;
  border: 1px solid var(--border); border-radius: 18px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
}
.schedule-day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-soft); }
.schedule-day-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.schedule-day-head span { color: var(--text-3); font-size: var(--fs-11); }
.schedule-event {
  display: flex; flex-direction: column; gap: 3px;
  padding: 7px 8px; margin-bottom: 6px;
  border-radius: 12px; color: var(--text);
  background: var(--accent-soft); border: 1px solid rgba(14,165,165,.18);
  font-size: var(--fs-12);
}
.schedule-event.task { background: #eef2ff; border-color: #c7d2fe; }
.schedule-event.decision { background: #fff7ed; border-color: #fed7aa; }
.schedule-event.idea { background: #ecfeff; border-color: #a5f3fc; }
.schedule-kind { font-size: var(--fs-11); color: var(--accent); font-weight: 700; }
.schedule-empty { padding: 16px 0; color: var(--text-3); text-align: center; font-size: var(--fs-12); }
.unscheduled-panel {
  padding: 12px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface-2);
}
.unscheduled-panel h3 { margin-bottom: 10px; font-size: var(--fs-14); }
.unscheduled-item {
  width: 100%; min-height: 42px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px;
  margin-bottom: 8px; padding: 8px 10px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); text-align: left;
}
.unscheduled-item .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
/* topic 详情：来源 → 需求 → 任务 处理脉络 */
.topic-relation-story { margin-bottom: 16px; }
.relation-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 12px; align-items: stretch; }
.relation-stage {
  padding: 12px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface-2);
}
.relation-stage.source { background: #ecfeff; }
.relation-stage.requirement { background: #eef2ff; }
.relation-stage.task { background: #f0fdf4; }
.relation-arrow { display: flex; align-items: center; color: var(--accent); font-weight: 800; }
.relation-chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.relation-chip {
  display: inline-flex; padding: 4px 8px; border-radius: 999px;
  background: rgba(255,255,255,.75); border: 1px solid var(--border); font-size: var(--fs-11);
}

/* ==================== 工作台（总览页重写） ==================== */
.workbench-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px; margin-bottom: 16px;
}
.workbench-card { display: flex; flex-direction: column; gap: 12px; min-height: 220px; }
.workbench-card .card-header { align-items: flex-start; }
.workbench-card.focus { border-left: 4px solid var(--accent); }
.workbench-card.decisions { border-left: 4px solid #f59e0b; }
.workbench-card.unsorted { border-left: 4px solid #6366f1; }
.workbench-card.recap { border-left: 4px solid #14b8a6; }
.focus-list, .decision-list { display: flex; flex-direction: column; gap: 8px; }
.focus-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px; align-items: center; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 14px; color: var(--text); min-height: 56px;
}
.focus-row:hover { border-color: var(--border-strong); }
.focus-row.overdue { background: #fef2f2; border-color: #fecaca; }
.focus-row strong { font-size: var(--fs-14); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.status-dot.todo { background: #94a3b8; }
.status-dot.doing { background: #0ea5a5; box-shadow: 0 0 0 3px rgba(14,165,165,.18); }
.status-dot.blocked { background: #f97316; }
.status-dot.done { background: #22c55e; }
.decision-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px; align-items: center; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 14px; color: var(--text); min-height: 56px;
}
.decision-row strong { font-size: var(--fs-14); }
.decision-tag {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 999px; font-size: var(--fs-11); font-weight: 700;
}
.decision-tag.warn { background: #fff7ed; color: #c2410c; }
.decision-tag.info { background: #eef2ff; color: #4338ca; }
.decision-tag.type-todo { background: #eef2ff; color: #4338ca; }
.decision-tag.type-decision { background: #fff7ed; color: #c2410c; }
.decision-tag.type-idea { background: #ecfeff; color: #0e7490; }
.decision-tag.type-reference { background: #f0fdf4; color: #15803d; }
.triage-row { min-height: 64px; }
.triage-row .accent-text { color: var(--accent); white-space: nowrap; }
.suggestion-row { background: #fffbeb; border-color: #fde68a; }
.recap-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.recap-stat {
  padding: 12px; border-radius: 14px; background: var(--surface-2);
  border: 1px solid var(--border); text-align: center;
}
.recap-stat strong { display: block; font-size: 22px; font-weight: 700; color: var(--text); }

/* ==================== 任务页：按时间分组列表 ==================== */
.task-command-center {
  display: grid;
  grid-template-columns: minmax(320px, 1.15fr) minmax(360px, .85fr);
  gap: 14px;
  margin-bottom: 16px;
}
.task-focus-panel {
  min-height: 220px;
  padding: 18px;
  border: 1px solid rgba(14, 165, 165, .22);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #f0fdfa, var(--surface));
  color: var(--text);
}
.task-focus-panel h2 {
  margin: 4px 0 12px;
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 28px;
  line-height: 1.15;
}
.task-focus-card {
  padding: 14px;
  border: 1px solid rgba(14, 165, 165, .24);
  border-radius: var(--radius);
  background: var(--surface);
}
.task-focus-card strong {
  display: block;
  margin-top: 10px;
  font-size: var(--fs-20);
  line-height: 1.35;
}
.task-focus-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: var(--fs-13);
}
.task-focus-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--fs-12);
  font-weight: 850;
}
.task-focus-tag.urgent,
.task-focus-tag.blocked {
  background: #fff7ed;
  color: #c2410c;
}
.task-focus-tag.today {
  background: #ccfbf1;
  color: #0f766e;
}
.task-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.task-metric {
  min-height: 105px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.task-metric span {
  color: var(--muted);
  font-size: var(--fs-12);
  font-weight: 750;
}
.task-metric strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 32px;
  line-height: 1;
  color: var(--text);
}
.task-metric small {
  color: var(--text-2);
  font-size: var(--fs-12);
  line-height: 1.45;
}
.task-metric.urgent,
.task-metric.blocked {
  border-color: rgba(249, 115, 22, .32);
  background: #fff7ed;
}
.task-metric.urgent strong,
.task-metric.blocked strong {
  color: #c2410c;
}
.task-metric.today {
  border-color: rgba(14, 165, 165, .26);
  background: #f0fdfa;
}
.task-metric.today strong {
  color: #0f766e;
}
.task-active-board {
  grid-template-columns: minmax(260px, .75fr) minmax(360px, 1.25fr);
  margin-top: 16px;
}
.task-active-board .kanban-col {
  min-height: 180px;
}
.task-completed-summary {
  margin-top: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.task-completed-summary h2 {
  margin: 4px 0 6px;
  font-size: 18px;
}
.task-completed-summary p {
  margin: 0;
}
.task-completed-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 52%;
}
@media (max-width: 900px) {
  .task-command-center,
  .task-active-board {
    grid-template-columns: 1fr;
  }
  .task-completed-summary {
    flex-direction: column;
  }
  .task-completed-list {
    justify-content: flex-start;
    max-width: none;
  }
}
.schedule-list { display: flex; flex-direction: column; gap: 14px; }
.schedule-group { display: flex; flex-direction: column; gap: 8px; }
.schedule-group-head { display: flex; align-items: baseline; gap: 8px; padding: 0 4px; }
.schedule-group-head strong { font-size: var(--fs-13); letter-spacing: .02em; }
.schedule-group.danger .schedule-group-head strong { color: #b91c1c; }
.schedule-group.accent .schedule-group-head strong { color: var(--accent); }
.schedule-group-body { display: flex; flex-direction: column; gap: 6px; }
.schedule-row {
  display: grid; grid-template-columns: 60px 60px minmax(0, 1fr) auto auto;
  gap: 10px; align-items: center; padding: 10px 12px; min-height: 48px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); cursor: pointer;
}
.schedule-row:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.schedule-row .schedule-date { color: var(--muted); font-variant-numeric: tabular-nums; font-size: var(--fs-12); }
.schedule-row .schedule-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-row .schedule-kind {
  display: inline-flex; padding: 2px 8px; border-radius: 999px;
  font-size: var(--fs-11); font-weight: 700; background: var(--surface-2); color: var(--text-2);
  white-space: nowrap;
}
.schedule-row .schedule-kind.task { background: #eef2ff; color: #4338ca; }
.schedule-row.s-doing { border-left: 3px solid var(--accent); }
.schedule-row.s-blocked { border-left: 3px solid #f97316; }
.schedule-row.s-done { opacity: .6; }
.schedule-group.danger .schedule-row { background: #fef2f2; border-color: #fecaca; }

/* ==================== 主题详情：内容退化 callout ==================== */
.topic-relation-story.degraded {
  background: #fff7ed; border-color: #fed7aa;
}
.topic-relation-story.degraded h2 { color: #c2410c; }
.callout-tips { margin: 8px 0 0 18px; color: var(--text-2); line-height: 1.7; font-size: var(--fs-13); }

/* ==================== 主题详情：类型化处理工作台 ==================== */
.topic-workbench {
  margin-bottom: 16px;
  border-left: 4px solid var(--accent);
}
.topic-workbench.type-todo { border-left-color: #4f46e5; }
.topic-workbench.type-decision { border-left-color: #f97316; }
.topic-workbench.type-idea { border-left-color: #06b6d4; }
.topic-workbench.type-reference { border-left-color: #16a34a; }
.workbench-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; margin-bottom: 14px;
}
.workbench-head h2 { margin: 6px 0 6px; font-size: var(--fs-20); }
.workbench-head p.muted { max-width: 64ch; font-size: var(--fs-13); line-height: 1.6; }
.workbench-summary {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; padding: 14px;
  border: 1px solid var(--border); border-radius: 18px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
}
.workbench-summary.tone-warning { background: linear-gradient(180deg, var(--warning-soft), var(--surface)); }
.workbench-summary.tone-accent,
.workbench-summary.tone-idea { background: linear-gradient(180deg, var(--accent-soft), var(--surface)); }
.workbench-summary.tone-success,
.workbench-summary.tone-reference { background: linear-gradient(180deg, var(--success-soft), var(--surface)); }
.workbench-summary.tone-todo { background: linear-gradient(180deg, #eef2ff, var(--surface)); }
.workbench-summary.tone-decision { background: linear-gradient(180deg, #fff7ed, var(--surface)); }
.workbench-summary-main {
  min-width: 0; flex: 1;
  display: flex; flex-direction: column; gap: 8px;
}
.workbench-summary-side {
  flex: 0 1 340px; width: min(100%, 340px);
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
}
.summary-kicker {
  font-size: var(--fs-11); font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.summary-title { font-size: var(--fs-18); line-height: 1.4; color: var(--text); }
.summary-note { margin: 0; font-size: var(--fs-12); line-height: 1.6; color: var(--text-2); }
.workbench-summary-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.workbench-summary-metrics { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.workbench-summary-metric {
  display: flex; flex-direction: column; gap: 4px;
  min-width: 110px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 12px;
  background: rgba(255,255,255,.72);
}
.workbench-summary-metric.tone-warning { background: rgba(253, 192, 47, .12); }
.workbench-summary-metric.tone-accent,
.workbench-summary-metric.tone-idea { background: rgba(14, 165, 165, .10); }
.workbench-summary-metric.tone-success,
.workbench-summary-metric.tone-reference { background: rgba(16, 185, 129, .10); }
.workbench-summary-metric.tone-todo { background: rgba(99, 102, 241, .10); }
.workbench-summary-metric.tone-decision { background: rgba(249, 115, 22, .10); }
.workbench-summary-metric-label {
  font-size: var(--fs-11); font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted);
}
.workbench-summary-metric-value { font-size: var(--fs-14); line-height: 1.4; color: var(--text); }
.flow-type-pill {
  display: inline-flex; align-items: center; border-radius: 999px;
  padding: 3px 10px; font-size: var(--fs-11); font-weight: 800;
  background: var(--accent-soft); color: var(--accent);
}
.flow-type-pill.type-todo { background: #eef2ff; color: #4338ca; }
.flow-type-pill.type-decision { background: #fff7ed; color: #c2410c; }
.flow-type-pill.type-idea { background: #ecfeff; color: #0e7490; }
.flow-type-pill.type-reference { background: #f0fdf4; color: #15803d; }
.flow-status-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.flow-status-card {
  padding: 12px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface-2); min-height: 112px;
}
.flow-status-card span {
  display: block; color: var(--muted); font-size: var(--fs-11); margin-bottom: 6px;
}
.flow-status-card strong {
  display: block; font-size: var(--fs-14); line-height: 1.45; margin-bottom: 6px;
}
.flow-status-card p { color: var(--text-3); font-size: var(--fs-12); line-height: 1.5; }
.direction-panel {
  margin-bottom: 14px; padding: 12px;
  border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface-2);
}
.direction-panel .card-header { margin-bottom: 10px; }
.direction-panel h3 { font-size: var(--fs-15); margin-bottom: 2px; }
/* 方向选择器 —— Claude 头脑风暴风格 ABCD 垂直列表 */
.direction-list {
  display: flex; flex-direction: column; gap: 8px;
}
.direction-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border: 1.5px solid var(--border); border-radius: 14px;
  background: var(--surface); text-align: left; cursor: pointer; color: var(--text);
  transition: border-color .15s, background .15s; width: 100%;
  word-break: break-word; line-height: 1.55;
}
.direction-item:hover { border-color: var(--accent); background: var(--surface-2); }
.direction-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.direction-item.selected { border-color: var(--accent); background: var(--accent-soft); }
.dir-badge {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 9px;
  background: var(--surface-2); border: 1.5px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-13); font-weight: 800; color: var(--text-2); margin-top: 2px;
  transition: background .15s, border-color .15s, color .15s;
}
.direction-item.selected .dir-badge,
.direction-item:hover .dir-badge { background: var(--accent); border-color: var(--accent); color: #fff; }
.dir-badge.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.dir-body { flex: 1; min-width: 0; }
.dir-title { display: block; font-size: var(--fs-15); font-weight: 650; line-height: 1.4; margin-bottom: 4px; }
.dir-desc { display: block; font-size: var(--fs-13); color: var(--text-2); line-height: 1.6; }
.dir-hint { display: block; margin-top: 6px; font-size: var(--fs-12); color: var(--text-3); line-height: 1.5; }
.direction-other {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px 16px; border: 1.5px dashed var(--border); border-radius: 14px;
  background: var(--surface);
}
.direction-other.other-typing .dir-other-header .dir-badge { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
.direction-other.other-typing { border-color: var(--accent); }
.dir-other-header { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.direction-other textarea {
  width: 100%; box-sizing: border-box; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text);
  font-size: var(--fs-14); line-height: 1.55; resize: vertical; min-height: 68px;
  font-family: inherit;
}
.direction-other textarea:focus { outline: 2px solid var(--accent); outline-offset: 2px; border-color: transparent; }
.process-step-strip {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px; margin-bottom: 12px;
}
.process-step-card {
  position: relative; padding: 12px 10px 10px; border: 1px solid var(--border);
  border-radius: 14px; background: var(--surface); min-height: 126px;
}
.process-step-card .process-step-index {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: var(--fs-11); font-weight: 800; margin-bottom: 8px;
}
.process-step-card strong { display: block; font-size: var(--fs-13); margin-bottom: 6px; }
.process-step-card p { color: var(--text-2); font-size: var(--fs-12); line-height: 1.5; }
.topic-framework {
  border: 1px dashed var(--border); border-radius: 14px; background: rgba(255,255,255,.55);
}
.topic-framework summary {
  min-height: 44px; display: flex; align-items: center; padding: 0 12px;
  cursor: pointer; font-weight: 650; color: var(--accent);
}
.framework-card-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px; padding: 0 12px 12px;
}
@media (max-width: 900px) {
  .topic-header { flex-direction: column; }
  .topic-header-actions { padding-top: 0; justify-content: flex-start; }
  .workbench-head { flex-direction: column; }
  .workbench-summary { flex-direction: column; }
  .workbench-summary-side { width: 100%; align-items: stretch; }
  .workbench-summary-actions { justify-content: flex-start; }
  .workbench-summary-metrics { justify-content: flex-start; }
}
.framework-card {
  padding: 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface);
}
.framework-card strong { display: block; margin-bottom: 6px; font-size: var(--fs-13); }
.framework-card p { font-size: var(--fs-12); color: var(--text-2); line-height: 1.55; }

/* ==================== v0.4 AI 工作台 ==================== */
.wb-body { display: flex; flex-direction: column; gap: 12px; margin: 12px 0 4px; }
.wb-body.empty { padding: 14px; border: 1px dashed var(--border); border-radius: 12px; background: var(--surface-2); }
.wb-card {
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface);
}
.wb-card h3 { font-size: var(--fs-14); margin: 0 0 8px; }
.wb-card.accent { background: var(--accent-soft); border-color: var(--accent); }
.wb-card.warning { background: #fff7ed; border-color: #fed7aa; }
.wb-card ul, .wb-card ol { margin: 0 0 0 18px; line-height: 1.7; font-size: var(--fs-13); color: var(--text-2); }
.wb-matrix-wrap { overflow-x: auto; }
.wb-matrix { width: 100%; border-collapse: collapse; font-size: var(--fs-12); }
.wb-matrix th, .wb-matrix td { border: 1px solid var(--border); padding: 6px 8px; text-align: center; }
.wb-matrix th { background: var(--surface-2, #f5f5f7); font-weight: 600; }
.wb-matrix td:first-child { text-align: left; font-weight: 500; }
.wb-matrix .score.pos { background: #ecfdf5; color: #047857; }
.wb-matrix .score.neg { background: #fef2f2; color: #b91c1c; }
.wb-matrix .score.zero { color: var(--text-2); }
.wb-step-list li { margin-bottom: 8px; }
.wb-step-list li strong { color: var(--text); }
.todo-split-form textarea { min-height: 120px; font-size: var(--fs-16); }
.todo-split-form input[type="datetime-local"] { font-size: var(--fs-16); }
.wb-two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.wb-option-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px;
}
.wb-option-card {
  display: flex; flex-direction: column; gap: 6px; padding: 12px;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2);
}
.wb-option-card strong { font-size: var(--fs-14); }
.wb-option-card button { margin-top: auto; align-self: flex-start; }
.wb-milestone {
  margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--accent);
  background: var(--surface); border-radius: 0 12px 12px 0;
}
.wb-milestone strong { display: block; font-size: var(--fs-13); margin-bottom: 4px; }
/* 旧 .direction-option.selected 已并入 .direction-item.selected */
@media (max-width: 900px) {
  .wb-two-col { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-two, .topic-detail-grid { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .schedule-layout { grid-template-columns: 1fr; }
  .schedule-strip { grid-auto-columns: minmax(150px, 72vw); }
  .relation-flow { grid-template-columns: 1fr; }
  .relation-arrow { justify-content: center; transform: rotate(90deg); }
  .json-pair { grid-template-columns: 1fr; }
  .view-head { align-items: stretch; flex-direction: column; }
  .workbench-grid { grid-template-columns: 1fr; }
  .recap-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workbench-head { flex-direction: column; }
  .flow-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* direction-list 是 flex-column，无需响应式用修覆 */
  .process-step-strip { grid-template-columns: 1fr; }
  .framework-card-grid { grid-template-columns: 1fr; }
  .schedule-row { grid-template-columns: 56px minmax(0, 1fr) auto; }
  .schedule-row .schedule-kind { display: none; }
  .schedule-row .row { grid-column: 1 / -1; }
  .event-row { grid-template-columns: 52px auto auto; align-items: start; }
  .event-row-main { grid-column: 1 / -1; }
  .event-row > .small:last-child { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .metric-value { font-size: 24px; }
  .recap-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow-status-grid { grid-template-columns: 1fr; }

  .decision-row { grid-template-columns: auto minmax(0, 1fr); }
  .decision-row > .small, .decision-row > button, .decision-row > .accent-text { grid-column: 1 / -1; justify-self: start; }
}

/* ==== Brainstorm wizard (idea workbench) ==== */
.wb-bs-entry { border: 1px dashed var(--accent); background: linear-gradient(180deg, rgba(99,102,241,0.05), transparent); }
.wb-bs-entry h3 { margin: 0 0 4px; }
.wb-bs-entry button { min-height: 44px; }

.wb-bs-wizard { display: grid; gap: 16px; }
.wb-bs-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.wb-bs-header h3 { margin: 0; }
.wb-bs-progress { min-width: 180px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.wb-bs-progress-bar { width: 180px; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.wb-bs-progress-fill { height: 100%; background: var(--accent); transition: width 240ms ease; }

.wb-bs-q h4 { margin: 4px 0 12px; font-size: var(--fs-16); line-height: 1.5; }
.wb-bs-options { display: grid; gap: 8px; }
.wb-bs-option {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); cursor: pointer; transition: all 160ms ease;
  min-height: 44px; margin: 0; color: var(--text); font-size: var(--fs-14);
}
.wb-bs-option:hover { border-color: var(--accent); background: var(--surface-2); }
.wb-bs-option.selected { border-color: var(--accent); background: rgba(99,102,241,0.08); }
.wb-bs-option input { margin-top: 2px; width: auto; flex: none; }
.wb-bs-option-label { flex: 1; min-width: 0; line-height: 1.5; word-break: break-word; }
.wb-bs-recommendation {
  display: grid; gap: 8px; padding: 12px 14px;
  border: 1px solid rgba(14, 165, 165, .26); border-radius: 12px;
  background: rgba(236, 254, 255, .7);
}
.wb-bs-recommendation strong { font-size: var(--fs-13); color: #0e7490; }
.wb-bs-note { border: 1px dashed var(--border); border-radius: 12px; padding: 0 12px; background: var(--surface); }
.wb-bs-note summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--text-2); font-weight: 650; }
.wb-bs-note-input { width: 100%; margin: 0 0 12px; min-height: 44px; font-size: 16px; }
.wb-bs-error {
  display: grid; gap: 8px; padding: 12px 14px;
  border: 1px solid var(--warning); border-radius: 12px;
  background: var(--warning-soft);
}
.wb-bs-error strong { color: var(--warning); }
.wb-bs-fallback-notice {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; border-radius: 8px;
  background: var(--warning-soft, rgba(253,192,47,.12));
  border: 1px solid var(--warning, #fdc02f);
  font-size: var(--fs-13); color: var(--text-2);
}
.wb-bs-fallback-icon { font-size: var(--fs-14); line-height: 1; }
.wb-bs-fallback-reason { word-break: break-word; }
.wb-bs-stream {
  display: grid; gap: 8px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-2);
}
.wb-bs-stream-head { display: flex; align-items: center; gap: 8px; font-size: var(--fs-13); }
.wb-bs-stream-text {
  max-height: 180px; overflow: auto; margin: 0; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text-2);
  white-space: pre-wrap; word-break: break-word; font-size: var(--fs-12); line-height: 1.55;
}

.wb-bs-text { width: 100%; min-height: 96px; padding: 10px 12px; font-size: 16px; border: 1px solid var(--border); border-radius: 10px; }

.wb-bs-result { display: grid; gap: 10px; }
.wb-bs-summary { font-weight: 600; color: var(--text); }
.wb-brief-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.wb-brief-card {
  padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(14, 165, 165, .22);
  background: rgba(255, 255, 255, .68);
}
.wb-brief-card strong { display: block; margin-bottom: 4px; font-size: var(--fs-12); color: var(--accent); }
.wb-brief-card p { font-size: var(--fs-13); color: var(--text-2); line-height: 1.6; }
.wb-requirement-list { padding-top: 4px; }
.wb-requirement-list > strong { display: block; margin-bottom: 6px; font-size: var(--fs-13); }

.wb-bs-nav button { min-height: 44px; padding: 0 16px; }
.wb-bs-foot { justify-content: space-between; align-items: center; }

.wb-bs-history { background: var(--surface-2); }
.wb-bs-history > summary { cursor: pointer; padding: 8px 4px; font-weight: 600; }
.wb-bs-history-list { display: grid; gap: 12px; padding-top: 8px; }
.wb-bs-history-item { padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.wb-bs-history-item p { margin: 6px 0; }
.wb-bs-history-qa > summary { cursor: pointer; padding: 4px 0; }
.wb-bs-history-qa ul { padding-left: 18px; }
.wb-bs-history-qa li { margin: 4px 0; }

@media (max-width: 520px) {
  .topic-header { flex-direction: column; }
  .topic-header-actions { width: 100%; justify-content: flex-start; padding-top: 0; }
  .topic-header-actions button { min-height: 44px; }
  .topic-context-archive > summary { align-items: flex-start; flex-direction: column; padding: 8px 0; }
  .topic-header-pill { width: 100%; justify-content: space-between; }
  .workbench-summary-metric { min-width: 100%; }
  .wb-bs-progress { align-items: flex-start; }
  .wb-bs-progress-bar { width: 100%; }
  .wb-brief-grid { grid-template-columns: 1fr; }
  .wb-bs-nav { flex-direction: column-reverse; align-items: stretch; }
  .wb-bs-nav button { width: 100%; }
}

/* ==================== Mobile compact polish (v0.5) ==================== */
/* Targets: Android WebView fullscreen + small phone screens.
   Goals: smaller fonts, tighter paddings, reclaim vertical space. */
@media (max-width: 560px) {
  :root {
    --toolbar-h: 46px;
    --radius-lg: 12px;
    --radius: 9px;
  }
  body { font-size: 13px; }
  h1 { font-size: 17px; }
  h2 { font-size: 15px; }
  h3 { font-size: 13px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .title { font-size: 15px; font-weight: 600; }
  .content { padding: 12px 12px 16px; }
  .card { padding: 12px; }
  .card + .card { margin-top: 10px; }
  .page-guide { margin-bottom: 10px; }
  .page-guide summary { padding: 8px 12px; gap: 6px; font-size: 12px; }
  .guide-content { padding: 10px 12px 12px; }
  .guide-grid { grid-template-columns: 1fr; gap: 10px; }
  .filter-bar { padding: 8px 10px; gap: 6px; }
  .project-chips { gap: 6px; }
  .pchip { height: 30px; padding: 4px 10px; font-size: 12px; border-radius: 999px; }
  .empty { padding: 24px 12px; }
  .empty-art { transform: scale(.85); }
  .badge { padding: 1px 6px; font-size: 10px; }
  .small, .muted { font-size: 11px; }
  .entry-card { padding: 10px 12px; }
  .entry-card .meta-row { gap: 4px; }
  .composer { padding: 8px !important; border-radius: 18px !important; }
  .composer .c-btn { width: 36px !important; height: 36px !important; border-radius: 10px !important; }
  .composer .c-input-wrap textarea { min-height: 40px !important; padding: 9px 10px !important; }
  .bottom-tabs { padding: 4px 4px calc(4px + env(safe-area-inset-bottom)) !important; }
  .bottom-tabs a { font-size: 10px !important; gap: 2px !important; }
  .bottom-tabs a svg { width: 18px !important; height: 18px !important; }
}

@media (max-width: 380px) {
  body { font-size: 12.5px; }
  h1 { font-size: 16px; }
  .topbar .title { font-size: 14px; }
  .pchip { height: 28px; padding: 3px 9px; }
  .composer .c-btn { width: 34px !important; height: 34px !important; }
}

/* ==================== Mobile compact polish (v0.5) ==================== */
/* Targets: Android WebView fullscreen + small phone screens.
   Goals: smaller fonts, tighter paddings, reclaim vertical space. */
@media (max-width: 560px) {
  :root {
    --toolbar-h: 46px;
    --radius-lg: 12px;
    --radius: 9px;
  }
  body { font-size: 13px; }
  h1 { font-size: 17px; }
  h2 { font-size: 15px; }
  h3 { font-size: 13px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .title { font-size: 15px; font-weight: 600; }
  .content { padding: 12px 12px 16px; }
  .card { padding: 12px; }
  .card + .card { margin-top: 10px; }
  .page-guide { margin-bottom: 10px; }
  .page-guide summary { padding: 8px 12px; gap: 6px; font-size: 12px; }
  .guide-content { padding: 10px 12px 12px; }
  .guide-grid { grid-template-columns: 1fr; gap: 10px; }
  .filter-bar { padding: 8px 10px; gap: 6px; }
  .project-chips { gap: 6px; }
  .pchip { height: 30px; padding: 4px 10px; font-size: 12px; border-radius: 999px; }
  .empty { padding: 24px 12px; }
  .empty-art { transform: scale(.85); }
  .badge { padding: 1px 6px; font-size: 10px; }
  .small, .muted { font-size: 11px; }
  .entry-card { padding: 10px 12px; }
  .entry-card .meta-row { gap: 4px; }
  .composer { padding: 8px !important; border-radius: 18px !important; }
  .composer .c-btn { width: 36px !important; height: 36px !important; border-radius: 10px !important; }
  .composer .c-input-wrap textarea { min-height: 40px !important; padding: 9px 10px !important; }
  .bottom-tabs { padding: 4px 4px calc(4px + env(safe-area-inset-bottom)) !important; }
  .bottom-tabs a { font-size: 10px !important; gap: 2px !important; }
  .bottom-tabs a svg { width: 18px !important; height: 18px !important; }
}

@media (max-width: 380px) {
  body { font-size: 12.5px; }
  h1 { font-size: 16px; }
  .topbar .title { font-size: 14px; }
  .pchip { height: 28px; padding: 3px 9px; }
  .composer .c-btn { width: 34px !important; height: 34px !important; }
}


/* ============================================================================
   MOBILE UI — 「数字文房」Digital Atelier
   温暖纸张质感 · 墨迹色彩标记 · 优雅衬线标题 · 微妙光影层次
   ============================================================================ */

/* ---- Paper texture (subtle noise grain) ---- */
@supports (background: url("data:image/svg+xml,%3Csvg")) {
  .m-header, .m-dash, .m-tasks, .m-inbox, .m-topics {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
    background-repeat: repeat;
  }
}

/* ---- Header: kicker + stats + voice + chips ---- */
.m-header {
  padding: 20px 20px 0;
  position: relative;
}
.m-header::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 180px;
  background: linear-gradient(180deg, rgba(14,165,165,.045) 0%, transparent 100%);
  pointer-events: none;
}
.m-kicker {
  margin-bottom: 18px;
  position: relative;
}
.m-kicker-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.m-kicker-tag {
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--muted);
}
.m-sync-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent);
  background: var(--surface);
  font-weight: 600;
  font-size: 11px;
  cursor: pointer;
  transition: all .2s ease;
}
.m-sync-btn:active {
  transform: scale(.96);
}
.m-sync-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: m-pulse 2s ease-in-out infinite;
}
@keyframes m-pulse {
  0%, 100% { opacity: .5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.3); }
}
.m-kicker-title {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.m-title {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--text);
}
.m-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-weight: 400;
  line-height: 1.5;
}
.m-stats-row {
  display: flex;
  gap: 10px;
  margin-top: 2px;
}
.m-stat-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(30,40,70,.05), 0 0 0 1px rgba(30,40,70,.04);
}
.m-stat-chip strong {
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}
.m-stat-chip span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .02em;
}

/* ---- Voice button (circular mic) ---- */
.m-voice-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 4px 0 2px;
}
.m-voice-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(145deg, var(--accent) 0%, #0b9a9a 100%);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow:
    0 4px 16px rgba(14,165,165,.30),
    0 1px 4px rgba(14,165,165,.15),
    inset 0 1px 0 rgba(255,255,255,.15);
  transition: all .2s ease;
}
.m-voice-btn:active {
  transform: scale(.92);
  box-shadow:
    0 2px 8px rgba(14,165,165,.25),
    0 0 0 1px rgba(14,165,165,.1);
}
.m-voice-btn.recording {
  background: linear-gradient(145deg, #e11d48 0%, #be123c 100%);
  box-shadow:
    0 0 0 6px rgba(225,29,72,.12),
    0 4px 20px rgba(225,29,72,.30);
  animation: m-recording-pulse 1.2s ease-in-out infinite;
}
@keyframes m-recording-pulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(225,29,72,.12), 0 4px 20px rgba(225,29,72,.30); }
  50% { box-shadow: 0 0 0 10px rgba(225,29,72,.06), 0 4px 24px rgba(225,29,72,.35); }
}
.m-voice-btn.cancel {
  background: linear-gradient(145deg, #6b7280 0%, #4b5563 100%);
  box-shadow: 0 2px 8px rgba(107,114,128,.25);
}
.m-voice-icon {
  display: grid;
  place-items: center;
}
.m-voice-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .02em;
}

/* ---- Project chips ---- */
.m-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 20px 8px;
  scrollbar-width: none;
}
.m-chips::-webkit-scrollbar { display: none; }
.m-chip {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 1px 2px rgba(30,40,70,.05), 0 0 0 1px rgba(30,40,70,.04);
  transition: all .2s ease;
  letter-spacing: .01em;
}
.m-chip:active {
  transform: scale(.96);
}
.m-chip.active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(14,165,165,.25);
  font-weight: 700;
}
.m-chip-count {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 400;
}
.m-chip.active .m-chip-count {
  color: rgba(255,255,255,.7);
}
.m-chip-add {
  border: 1.5px dashed var(--border-strong);
  background: transparent;
  box-shadow: none;
}

/* ---- Feed: row list ---- */
.m-feed {
  padding: 4px 0 100px;
}

/* ---- Single row ---- */
.m-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  min-height: 76px;
  margin: 0 12px;
  border-bottom: 1px solid rgba(30,40,70,.05);
  background: transparent;
  transition: all .2s ease;
  position: relative;
}
.m-row.clickable { cursor: pointer; }
.m-row:active {
  background: rgba(14,165,165,.03);
}
.m-row:active .m-row-mark {
  transform: scaleY(1.15);
}
.m-row-longpressing {
  background: rgba(14,165,165,.06) !important;
  transform: scale(0.98);
  transition: transform .15s ease, background .15s ease;
}

/* Left ink-stroke mark */
.m-row-mark {
  width: 4px;
  border-radius: 4px;
  margin: 18px 4px 18px 0;
  transition: transform .2s ease;
  position: relative;
}
.m-row-mark::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 40%;
  background: inherit;
  opacity: .15;
  border-radius: 0 0 4px 4px;
  filter: blur(3px);
}

/* Main content */
.m-row-main {
  padding: 14px 8px 14px 12px;
  min-width: 0;
}
.m-row-text {
  margin: 0;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.62;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  letter-spacing: .005em;
}
.m-row-text strong {
  color: var(--text);
  font-weight: 700;
}
.m-row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
}
.m-row-type {
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: .03em;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(14,165,165,.06);
}
.m-row-project {
  color: var(--muted);
  font-size: 11px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.m-row-time {
  color: var(--muted-2);
  font-size: 10.5px;
  flex-shrink: 0;
}
.m-row-due {
  color: var(--muted);
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(30,40,70,.04);
  flex-shrink: 0;
}
.m-row-due.overdue {
  color: var(--danger);
  background: var(--danger-soft);
  font-weight: 600;
}
.m-row-due.due-today {
  color: var(--warning);
  background: var(--warning-soft);
  font-weight: 600;
}
.m-row-topic-icon {
  display: inline-flex;
  align-items: center;
  color: var(--muted-2);
}

/* Row states */
.m-row-done { opacity: 0.45; }
.m-row-archived { opacity: 0.35; }
.m-row-strike .m-row-text {
  text-decoration: line-through;
  text-decoration-color: var(--muted);
  color: var(--muted);
}
.m-row-fade-out {
  opacity: 0;
  transform: translateX(30px);
  max-height: 0;
  overflow: hidden;
  margin: 0 12px;
  padding: 0;
  border-width: 0;
  transition: opacity .35s ease, transform .35s ease, max-height .4s ease .1s, margin .4s ease .1s, padding .4s ease .1s;
}

/* ---- Action icons ---- */
.m-row-actions {
  display: flex;
  align-items: center;
  gap: 0;
  padding-right: 2px;
}
.m-action-icon {
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 10px;
  transition: all .15s ease;
  position: relative;
}
.m-action-icon:active {
  transform: scale(.88);
  background: rgba(30,40,70,.04);
}
.m-action-icon svg {
  transition: transform .15s ease;
}
.m-action-icon:active svg {
  transform: scale(1.1);
}

/* ---- Undo toast ---- */
.m-undo-toast {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 18px;
  background: rgba(28,37,51,.92);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  color: #fff;
  border-radius: 12px;
  font-size: 13.5px;
  z-index: 100;
  box-shadow: 0 6px 24px rgba(0,0,0,.2), 0 0 0 1px rgba(255,255,255,.06);
  animation: m-toast-in .3s cubic-bezier(.22,1,.36,1);
}
.m-undo-btn {
  border: 0;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  padding: 3px 10px;
  border-radius: 6px;
  transition: background .15s;
}
.m-undo-btn:active {
  background: rgba(255,255,255,.2);
}
@keyframes m-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(16px) scale(.95); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* ---- Action sheet (long-press menu) ---- */
.m-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,.3);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: m-backdrop-in .2s ease;
}
@keyframes m-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.m-sheet {
  position: fixed;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 201;
  transform: translateX(-50%);
  width: min(440px, calc(100vw - 20px));
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0,0,0,.18), 0 0 0 1px rgba(30,40,70,.06);
  animation: m-sheet-up .28s cubic-bezier(.22,1,.36,1);
}
@keyframes m-sheet-up {
  from { opacity: 0; transform: translateX(-50%) translateY(24px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.m-sheet-title {
  padding: 14px 18px 10px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  border-bottom: 1px solid rgba(30,40,70,.06);
  letter-spacing: .02em;
}
.m-sheet-item {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  transition: background .12s;
}
.m-sheet-item:active {
  background: rgba(30,40,70,.04);
}
.m-sheet-item.danger {
  color: var(--danger);
}
.m-sheet-icon {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  width: 20px;
}
.m-sheet-item.danger .m-sheet-icon {
  color: var(--danger);
}
.m-sheet-cancel {
  border-top: 1px solid rgba(30,40,70,.06);
  font-weight: 600;
  color: var(--muted);
  justify-content: center;
  font-size: 14px;
}

/* ---- Skeleton loading ---- */
.m-skeleton {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.m-skeleton-row {
  height: 76px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: m-skeleton-shimmer 1.5s infinite;
  border-radius: 8px;
}
.m-skeleton-dash {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 20px;
}
.m-skeleton-card {
  height: 100px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: m-skeleton-shimmer 1.5s infinite;
  border-radius: 12px;
}
@keyframes m-skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- Dashboard (总览页) ---- */
.m-dash {
  padding: 20px 20px 100px;
  position: relative;
}
.m-dash::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 160px;
  background: linear-gradient(180deg, rgba(14,165,165,.03) 0%, transparent 100%);
  pointer-events: none;
}
.m-dash-title {
  margin-bottom: 18px;
  position: relative;
}
.m-dash-title h1 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 26px;
  font-weight: 900;
}
.m-dash-sub {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
}
.m-dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  position: relative;
}
.m-dash-card {
  display: flex;
  flex-direction: column;
  padding: 16px;
  border-radius: 12px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(30,40,70,.06), 0 0 0 1px rgba(30,40,70,.04);
  transition: all .2s ease;
  position: relative;
  overflow: hidden;
}
.m-dash-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--border);
  transition: background .2s;
}
.m-dash-card:active {
  transform: scale(.97);
  box-shadow: 0 1px 2px rgba(30,40,70,.04);
}
.m-dash-card.danger::before {
  background: var(--danger);
}
.m-dash-card.danger .m-dash-card-value {
  color: var(--danger);
}
.m-dash-card.accent::before {
  background: var(--accent);
}
.m-dash-card.accent .m-dash-card-value {
  color: var(--accent);
}
.m-dash-card-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.m-dash-card-value {
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
}
.m-dash-card-detail {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted);
}
.m-dash-voice {
  margin-top: 18px;
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--text) 0%, #2a3448 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(30,40,70,.15);
  transition: all .2s ease;
  position: relative;
}
.m-dash-voice:active {
  transform: scale(.98);
  background: linear-gradient(135deg, var(--accent) 0%, #0b8d8d 100%);
}
.m-dash-voice.recording {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  box-shadow: 0 0 0 4px rgba(225, 29, 72, .14), 0 8px 24px rgba(225, 29, 72, .2);
}
.m-dash-voice-icon {
  display: inline-flex;
}

/* ---- Tasks page (任务页) ---- */
.m-tasks {
  padding: 12px 0 calc(var(--bottom-tabs-h, 60px) + env(safe-area-inset-bottom, 0px) + 24px);
}
.m-task-feed { padding-bottom: 12px; }
.m-task-hero {
  margin: 0 12px 14px;
  padding: 16px;
  border: 1px solid rgba(13, 148, 136, .20);
  border-radius: 10px;
  background: #f0fdfa;
  color: #134e4a;
}
.m-task-kicker {
  display: block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .12em;
  color: #0f766e;
}
.m-task-hero h1 {
  margin: 2px 0 0;
  font-family: Inter, "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -.02em;
  color: #134e4a;
}
.m-task-hero p {
  margin: 10px 0 0;
  color: #315f5b;
  font-size: 13px;
  line-height: 1.65;
}
.m-task-focus {
  width: 100%;
  margin: 16px 0 0;
  padding: 14px 14px 13px;
  border: 1px solid rgba(13, 148, 136, .22);
  border-radius: 10px;
  background: rgba(255,255,255,.96);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.m-task-focus:active {
  background: #ecfeff;
  border-color: #0d9488;
}
.m-task-focus-label {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
}
.m-task-focus strong {
  display: -webkit-box;
  margin-top: 10px;
  font-size: 16px;
  line-height: 1.55;
  font-weight: 650;
  word-break: break-word;
  overflow-wrap: break-word;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.m-task-focus small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.m-task-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.m-task-metrics span {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(13, 148, 136, .18);
  border-radius: 8px;
  background: rgba(255,255,255,.78);
  color: #315f5b;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.m-task-metrics span.urgent {
  border-color: rgba(249, 115, 22, .35);
  background: #fff7ed;
  color: #c2410c;
}
.m-task-feed {
  gap: 14px;
}
.m-task-section {
  padding: 0 12px;
}
.m-task-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 10px;
  padding: 0 4px;
}
.m-task-section-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.01em;
}
.m-task-section-head span {
  min-width: 26px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.m-task-section.urgent .m-task-section-head h2 {
  color: #c2410c;
}
.m-task-section.urgent .m-task-section-head span {
  background: #fff7ed;
  color: #c2410c;
}
.m-task-section.today .m-task-section-head h2 {
  color: #0f766e;
}
.m-task-section.today .m-task-section-head span {
  background: #ccfbf1;
  color: #0f766e;
}

/* ---- Inbox page (收件箱) ---- */
.m-inbox {
  padding: 16px 0 100px;
}
.m-inbox-title {
  padding: 0 20px 12px;
}
.m-inbox-title h1 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 26px;
  font-weight: 900;
}
.m-inbox-sub {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* ---- Clarification Bottom Sheet ---- */
.m-clar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  animation: mClarFadeIn 0.2s ease;
}
.m-clar-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 75vh;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 12px 16px 24px;
  z-index: 1001;
  overflow-y: auto;
  animation: mClarSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-lg);
}
.m-clar-handle {
  width: 36px;
  height: 4px;
  background: var(--muted);
  border-radius: 2px;
  margin: 0 auto 12px;
}
.m-clar-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}
.m-clar-badge.blocking {
  background: #fef3c7;
  color: #92400e;
}
.m-clar-badge.normal {
  background: #e0e7ff;
  color: #3730a3;
}
.m-clar-question {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  margin: 0 0 14px;
  color: var(--text);
}
.m-clar-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
}
.m-clar-option:active {
  background: var(--surface-2);
}
.m-clar-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.m-clar-option.selected {
  border-color: #6366f1;
  background: #eef2ff;
}
.m-clar-radio {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.15s;
}
.m-clar-option.selected .m-clar-radio {
  border-color: #6366f1;
}
.m-clar-option.selected .m-clar-radio::after {
  content: "";
  position: absolute;
  inset: 3px;
  background: #6366f1;
  border-radius: 50%;
}
.m-clar-textarea {
  width: 100%;
  min-height: 56px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  margin-top: 6px;
}
.m-clar-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.m-clar-submit {
  display: block;
  width: 100%;
  padding: 12px;
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  margin-top: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.m-clar-submit:active {
  background: #4f46e5;
}
.m-clar-submit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.m-clar-submit:disabled {
  opacity: 0.5;
  cursor: default;
}

@keyframes mClarFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes mClarSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ---- Option preview pills in inbox row ---- */
.m-row-options-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.m-row-option-pill {
  display: inline-block;
  padding: 2px 8px;
  background: var(--surface-2);
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.m-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
}

/* ---- Topics page (事件页) ---- */
.m-topics {
  padding: 16px 0 100px;
}
.m-topics-hero {
  margin: 0 12px 14px;
  padding: 16px;
  border: 1px solid rgba(13, 148, 136, .18);
  border-radius: 10px;
  background: #f0fdfa;
  color: #134e4a;
}
.m-topics-kicker {
  display: block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .12em;
  color: #0f766e;
}
.m-topics-hero h1 {
  margin: 2px 0 4px;
  font-family: Inter, "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -.02em;
}
.m-topics-hero p {
  margin: 0;
  color: #315f5b;
  font-size: 13px;
  line-height: 1.65;
}
.m-topic-focus {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(13, 148, 136, .24);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.m-topic-focus strong {
  font-size: 16px;
  line-height: 1.55;
  font-weight: 650;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: break-word;
}
.m-topic-focus small {
  color: var(--muted);
  line-height: 1.5;
}
.m-topic-focus-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
  align-self: flex-start;
}
.m-topic-cats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 12px 14px;
}
.m-topic-cat {
  min-height: 64px;
  padding: 10px 8px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}
.m-topic-cat span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
}
.m-topic-cat strong {
  font-size: 20px;
  line-height: 1;
}
.m-topic-cat.type-todo { border-color: #c7d2fe; }
.m-topic-cat.type-decision { border-color: #fed7aa; }
.m-topic-cat.type-idea { border-color: #a5f3fc; }
.m-topic-cat.type-reference { border-color: #bbf7d0; }
.m-topic-cat.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(14,165,165,.15);
}
.m-topic-cat.active span {
  color: var(--accent);
}
.m-topic-cat.active strong {
  color: var(--accent);
}
.m-topic-cat:active {
  transform: scale(0.97);
  transition: transform .1s ease;
}
.m-filter-clear {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.m-filter-clear:active {
  background: var(--surface-2);
}
.m-topics-title {
  padding: 0 20px 12px;
}
.m-topics-title h1,
.m-topics-title h2 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 22px;
  font-weight: 900;
}
.m-topic-section-label {
  margin: 14px 20px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}
.m-topic-section-label strong {
  color: var(--text);
}

/* ---- Responsive: small phones ---- */
@media (max-width: 560px) {
  .m-title { font-size: 24px; }
  .m-stats strong { font-size: 20px; }
  .m-voice-btn { min-height: 52px; font-size: 13px; }
  .m-dash-card-value { font-size: 28px; }
  .m-row { margin: 0 8px; }
  .m-row-main { padding: 12px 6px 12px 8px; }
  .m-topic-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 380px) {
  .m-title { font-size: 22px; }
  .m-chip { min-height: 28px; padding: 0 10px; font-size: 11px; }
}

/* ---- Mobile entries redesign: focused capture workbench ---- */
@media (max-width: 900px) {
  .m-header {
    padding: 14px 14px 8px;
    background: #f7fafc;
  }
  .m-header::before { display: none; }
  .m-kicker {
    margin: 0 0 10px;
    padding: 0;
  }
  .m-kicker-label {
    margin: 0 0 8px;
    letter-spacing: 0;
    text-transform: none;
  }
  .m-kicker-tag {
    font-family: inherit;
    letter-spacing: 0;
    font-weight: 800;
    color: var(--accent);
  }
  .m-sync-btn {
    min-height: 30px;
    padding: 0 11px;
    border-radius: 8px;
    background: #fff;
    color: #0f766e;
    box-shadow: none;
  }
  .m-kicker-title {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    align-items: end;
  }
  .m-title {
    font-family: inherit;
    font-size: 24px;
    line-height: 1.18;
    letter-spacing: 0;
  }
  .m-subtitle {
    grid-column: 1 / -1;
    margin: 0;
    font-family: inherit;
    font-size: 13px;
    color: var(--text-2);
  }
  .m-stats-row {
    grid-row: 1 / span 2;
    grid-column: 2;
    margin: 0;
    align-self: center;
  }
  .m-stat-chip {
    min-width: 58px;
    padding: 7px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .m-stat-chip strong {
    font-family: inherit;
    font-size: 18px;
  }
  .m-stat-chip span { font-size: 10px; }
  .m-capture-panel {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
  }
  .m-capture-input,
  .m-sheet-textarea {
    display: block;
    width: 100%;
    min-height: 88px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text);
    font: inherit;
    font-size: 16px;
    line-height: 1.55;
    resize: none;
  }
  .m-capture-input:focus,
  .m-sheet-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
    background: #fff;
  }
  .m-capture-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(96px, 132px);
    gap: 8px;
    align-items: center;
    margin-top: 10px;
  }
  .m-type-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
  }
  .m-type-tabs button {
    min-width: 0;
    height: 32px;
    padding: 0 5px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }
  .m-type-tabs button.active {
    background: var(--accent);
    color: #fff;
  }
  .m-capture-select {
    height: 40px;
    border-radius: 8px;
    font-size: 13px;
  }
  .m-capture-actions,
  .m-compose-actions {
    display: grid;
    gap: 8px;
    margin-top: 10px;
  }
  .m-capture-actions { grid-template-columns: 44px 44px minmax(0, 1fr); }
  .m-compose-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .m-icon-action {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  }
  .m-icon-action:active,
  .m-icon-action.recording {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 3px var(--accent-ring);
  }
  .m-voice-text-action.recording {
    color: var(--danger);
  }
  .m-primary-action,
  .m-secondary-action {
    min-height: 44px;
    border-radius: 8px;
    text-align: center;
    font-weight: 800;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }
  .m-primary-action {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
  }
  .m-secondary-action {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-2);
  }
  .m-chips {
    padding: 12px 0 2px;
    gap: 7px;
  }
  .m-chip {
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: none;
    background: #fff;
    color: var(--text-2);
  }
  .m-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: none;
  }
  .m-chip-add {
    min-width: 42px;
    justify-content: center;
    border-style: dashed;
  }
  .m-feed {
    padding: 6px 0 92px;
    background: #f7fafc;
  }
  .m-section-head {
    margin: 8px 16px 4px;
    color: var(--muted);
  }
  .m-section-head > div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
  }
  .m-section-head strong {
    color: var(--text);
    font-size: 14px;
  }
  .m-section-head span {
    font-size: 12px;
  }
  .m-row {
    grid-template-columns: 5px minmax(0, 1fr) auto;
    min-height: 82px;
    margin: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
  }
  .m-row-mark {
    width: 5px;
    margin: 10px 0;
    border-radius: 0 6px 6px 0;
  }
  .m-row-mark::after { display: none; }
  .m-row-main {
    padding: 12px 8px 12px 12px;
  }
  .m-row-text {
    font-size: 15px;
    line-height: 1.48;
    letter-spacing: 0;
  }
  .m-row-actions {
    padding-right: 6px;
  }
  .m-action-icon {
    min-width: 42px;
    min-height: 42px;
  }
  .m-compose-sheet,
  .m-detail-sheet {
    padding: 12px;
  }
  .m-compose-sheet .m-sheet-title,
  .m-detail-sheet .m-sheet-title {
    padding: 0 0 10px;
    text-align: left;
    font-weight: 800;
    color: var(--text);
  }
  .m-compose-sheet .sheet-tools {
    grid-template-columns: 1fr;
  }
  .m-detail-body {
    max-height: min(58vh, 520px);
    overflow: auto;
    padding: 8px 0;
  }
  .m-detail-meta {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 10px;
  }
  .m-detail-text {
    white-space: pre-wrap;
    line-height: 1.65;
    color: var(--text);
    font-size: 15px;
  }
  .m-detail-attachments {
    display: grid;
    gap: 8px;
    margin-top: 12px;
  }
  .m-attachment-link {
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-2);
  }
}
