/* ================================================================
 * 随时记 · LifeOS
 * Design tokens + component styles
 * ================================================================ */

/* ---------- Design Tokens ---------- */
:root {
  /* Brand */
  --brand: #3B6DF6;
  --brand-strong: #2E58D9;
  --brand-soft: rgba(59, 109, 246, 0.10);
  --brand-softer: rgba(59, 109, 246, 0.06);
  --accent: #3B6DF6;

  /* Surfaces (Light) */
  --bg: #F7F7F5;
  --bg-elevated: #FFFFFF;
  --bg-sunken: #F1F1EE;
  --surface-1: #FFFFFF;
  --surface-2: #FBFBF9;
  --surface-hover: rgba(0, 0, 0, 0.035);
  --surface-press: rgba(0, 0, 0, 0.06);

  /* Text */
  --text-1: #111114;
  --text-2: #4A4A55;
  --text-3: #8A8A95;
  --text-4: #B6B6BF;
  --text-inv: #FFFFFF;

  /* Borders */
  --border-1: rgba(17, 17, 20, 0.08);
  --border-2: rgba(17, 17, 20, 0.05);
  --border-strong: rgba(17, 17, 20, 0.14);

  /* Semantic */
  --success: #2FAA6B;
  --warning: #E39A2E;
  --danger: #E5484D;
  --danger-soft: rgba(229, 72, 77, 0.10);

  /* Heatmap (Green ladder) */
  --heat-0: rgba(17, 17, 20, 0.05);
  --heat-1: #C6E8CE;
  --heat-2: #7FCE93;
  --heat-3: #3FAF5B;
  --heat-4: #1E8A3E;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(15, 15, 25, 0.04), 0 1px 1px rgba(15, 15, 25, 0.03);
  --shadow-md: 0 4px 14px rgba(15, 15, 25, 0.06), 0 2px 6px rgba(15, 15, 25, 0.04);
  --shadow-lg: 0 12px 40px rgba(15, 15, 25, 0.12), 0 4px 12px rgba(15, 15, 25, 0.06);
  --shadow-composer: 0 -8px 28px rgba(15, 15, 25, 0.05), 0 -2px 6px rgba(15, 15, 25, 0.02);

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* Motion */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur-fast: 120ms;
  --dur: 200ms;
  --dur-slow: 320ms;

  /* Font */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  /* Safe area */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html[data-theme="dark"] {
  --brand: #6D93FF;
  --brand-strong: #4F79F0;
  --brand-soft: rgba(109, 147, 255, 0.14);
  --brand-softer: rgba(109, 147, 255, 0.08);
  --accent: #6D93FF;
  --bg: #0B0B0E;
  --bg-elevated: #17171B;
  --bg-sunken: #08080A;
  --surface-1: #16161A;
  --surface-2: #1B1B20;
  --surface-hover: rgba(255, 255, 255, 0.04);
  --surface-press: rgba(255, 255, 255, 0.07);
  --text-1: #F4F4F5;
  --text-2: #C0C0C8;
  --text-3: #8A8A94;
  --text-4: #55555E;
  --text-inv: #0B0B0E;
  --border-1: rgba(255, 255, 255, 0.08);
  --border-2: rgba(255, 255, 255, 0.05);
  --border-strong: rgba(255, 255, 255, 0.14);
  --heat-0: rgba(255, 255, 255, 0.06);
  --heat-1: #1E3F2B;
  --heat-2: #2C6640;
  --heat-3: #47955C;
  --heat-4: #67BE7E;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-composer: 0 -8px 28px rgba(0, 0, 0, 0.4), 0 -2px 6px rgba(0, 0, 0, 0.2);
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #6D93FF;
    --brand-strong: #4F79F0;
    --brand-soft: rgba(109, 147, 255, 0.14);
    --brand-softer: rgba(109, 147, 255, 0.08);
    --accent: #6D93FF;

    --bg: #0B0B0E;
    --bg-elevated: #17171B;
    --bg-sunken: #08080A;
    --surface-1: #16161A;
    --surface-2: #1B1B20;
    --surface-hover: rgba(255, 255, 255, 0.04);
    --surface-press: rgba(255, 255, 255, 0.07);

    --text-1: #F4F4F5;
    --text-2: #C0C0C8;
    --text-3: #8A8A94;
    --text-4: #55555E;
    --text-inv: #0B0B0E;

    --border-1: rgba(255, 255, 255, 0.08);
    --border-2: rgba(255, 255, 255, 0.05);
    --border-strong: rgba(255, 255, 255, 0.14);

    --heat-0: rgba(255, 255, 255, 0.06);
    --heat-1: #1E3F2B;
    --heat-2: #2C6640;
    --heat-3: #47955C;
    --heat-4: #67BE7E;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-composer: 0 -8px 28px rgba(0, 0, 0, 0.4), 0 -2px 6px rgba(0, 0, 0, 0.2);
  }
}

/* Manual theme override */
html[data-theme="dark"] {
  color-scheme: dark;
}
html[data-theme="light"] {
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}
body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
input, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  border: none;
  outline: none;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--brand-soft); color: var(--text-1); }

/* hidden attribute must always win over layout display rules */
[hidden] { display: none !important; }

.view {
  flex: 1;
  min-height: 0;
  animation: viewIn 0.4s var(--ease-out);
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================================================================
 * Login View
 * ================================================================ */
.login-view {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-height: 100dvh;
  overflow: hidden;
}
.login-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 100% -10%, var(--brand-softer), transparent 60%),
    radial-gradient(900px 500px at -10% 100%, rgba(46, 88, 217, 0.05), transparent 60%);
}
.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
  animation: orbFloat 16s ease-in-out infinite;
}
.login-orb--1 { width: 320px; height: 320px; top: -60px; right: -40px; background: radial-gradient(circle, var(--brand), transparent 70%); }
.login-orb--2 { width: 260px; height: 260px; bottom: -80px; left: -60px; background: radial-gradient(circle, #6DBAFF, transparent 70%); animation-delay: -6s; }
.login-orb--3 { width: 180px; height: 180px; top: 40%; left: 55%; background: radial-gradient(circle, #B8A0FF, transparent 70%); animation-delay: -10s; opacity: 0.3; }
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, -30px) scale(1.06); }
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-1);
  border-radius: 24px;
  padding: 36px 32px 28px;
  box-shadow: var(--shadow-lg);
  animation: loginCardIn 0.6s var(--ease-out);
}
@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand--large .brand-mark { width: 44px; height: 44px; }
.brand--hero { margin-bottom: 36px; }
.brand--hero .brand-mark { width: 52px; height: 52px; }
.brand-text { line-height: 1.15; }
.brand-name { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.brand--large .brand-name { font-size: 20px; }
.brand--hero .brand-name { font-size: 23px; }
.brand-name-sub { font-weight: 500; color: var(--text-2); }
.brand-tag {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 2px;
}
.brand--hero .brand-tag { font-size: 12px; margin-top: 8px; }
.brand--hero .brand-tag-cn { font-size: 11px; margin-top: 3px; }
.brand-tag-cn {
  font-size: 10px;
  color: var(--text-3);
  opacity: 0.62;
  letter-spacing: 0.01em;
  margin-top: 2px;
}
.brand-tag--compact {
  font-size: 10.5px;
  letter-spacing: 0.005em;
  text-transform: none;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.sidebar-header .brand { align-items: flex-start; min-width: 0; flex: 1; }
.sidebar-header .brand-text { min-width: 0; }

.login-hero { margin: 32px 0 24px; }
.login-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  line-height: 1.2;
}
.login-subtitle {
  color: var(--text-3);
  margin: 0;
  font-size: 14px;
}

.login-form { }
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-sunken);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-pill);
  padding: 5px 5px 5px 18px;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input-wrap:focus-within {
  border-color: var(--brand);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.input {
  flex: 1;
  padding: 12px 0;
  font-size: 15px;
}
.input::placeholder { color: var(--text-4); }

.login-error {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  border-radius: var(--radius-sm);
  animation: shake 0.4s var(--ease);
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

.login-footer {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
  font-size: 12px;
}
.login-footer .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(47, 170, 107, 0.6);
}

/* ================================================================
 * App Layout
 * ================================================================ */
.app-view {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100dvh;
  background: var(--bg);
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: calc(16px + var(--safe-top)) 16px 16px;
  gap: 16px;
  background: var(--surface-2);
  border-right: 1px solid var(--border-1);
  overflow-y: auto;
  scrollbar-width: thin;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.icon-btn.sidebar-close { display: none; }

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav-item svg { flex-shrink: 0; color: var(--text-3); transition: color var(--dur-fast) var(--ease); }
.nav-item:hover { background: var(--surface-hover); color: var(--text-1); }
.nav-item:hover svg { color: var(--text-1); }
.nav-item--active {
  background: var(--brand-soft);
  color: var(--brand);
}
.nav-item--active svg { color: var(--brand); }
.nav-item--muted { color: var(--text-3); }
.nav-item--muted:hover { color: var(--text-2); }
.chip {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.chip--soon {
  background: var(--surface-press);
  color: var(--text-3);
}

/* ---------- Calendar ---------- */
.calendar {
  padding: 12px;
  background: var(--surface-1);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
}
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.calendar-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
  color: var(--text-4);
  font-size: 10.5px;
  text-align: center;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.day {
  aspect-ratio: 1;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--text-3);
  background: var(--heat-0);
  cursor: default;
  position: relative;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.day--empty { background: transparent; }
.day--other { color: var(--text-4); opacity: 0.4; }
.day--has {
  cursor: pointer;
  color: var(--text-1);
}
.day--has:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
.day--h1 { background: var(--heat-1); }
.day--h2 { background: var(--heat-2); color: white; }
.day--h3 { background: var(--heat-3); color: white; }
.day--h4 { background: var(--heat-4); color: white; }
.day--today { box-shadow: inset 0 0 0 2px var(--brand); }
.day--selected { outline: 2px solid var(--brand); outline-offset: 1px; }

.calendar-legend {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-4);
  font-size: 10.5px;
  justify-content: flex-end;
}
.legend-cell {
  width: 10px; height: 10px; border-radius: 3px; display: inline-block;
}
.legend-cell--0 { background: var(--heat-0); }
.legend-cell--1 { background: var(--heat-1); }
.legend-cell--2 { background: var(--heat-2); }
.legend-cell--3 { background: var(--heat-4); }

.selected-date-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
}
.selected-date-info { display: flex; align-items: center; gap: 8px; }

/* ---------- Main ---------- */
.main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(12px + var(--safe-top)) 20px 12px;
  border-bottom: 1px solid var(--border-2);
  background: color-mix(in oklab, var(--bg), transparent 20%);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.icon-btn.topbar-menu { display: none; }

.search-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-pill);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  height: 38px;
}
.search-wrap:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.search-icon { color: var(--text-3); flex-shrink: 0; }
.search-input { flex: 1; font-size: 14px; }
.search-input::placeholder { color: var(--text-4); }
.search-clear {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-press);
  color: var(--text-2);
  transition: background var(--dur-fast) var(--ease);
}
.search-clear:hover { background: var(--border-strong); }

/* Icon buttons */
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--text-2);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text-1); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn--soft { background: var(--surface-1); border: 1px solid var(--border-1); }
.icon-btn--soft:hover { background: var(--surface-hover); }
.icon-btn--ghost { background: transparent; }
.icon-btn--danger { color: var(--danger); }
.icon-btn--danger:hover { background: var(--danger-soft); color: var(--danger); }

/* Search badge */
.search-badge {
  margin: 12px 20px 0;
  padding: 8px 12px;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: fadeSlide 0.3s var(--ease-out);
}
.search-badge strong { font-weight: 600; }
.search-count { margin-left: auto; opacity: 0.8; }

/* ---------- Timeline ---------- */
.timeline {
  flex: 1;
  overflow-y: auto;
  padding: 8px 20px 110px;
  scroll-behavior: smooth;
}
.timeline::-webkit-scrollbar { width: 8px; }
.timeline::-webkit-scrollbar-thumb { background: var(--border-1); border-radius: 4px; }
.timeline::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

.day-group {
  margin-top: 24px;
  animation: fadeSlide 0.35s var(--ease-out);
}
.day-group:first-child { margin-top: 12px; }
.day-group-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 4px 10px;
  position: sticky;
  top: 0;
  padding: 4px 0;
  z-index: 1;
  background: var(--bg);
}
.day-group-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: -0.005em;
}
.day-group-count {
  font-size: 11.5px;
  color: var(--text-4);
}

.note {
  background: var(--surface-1);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
  animation: noteIn 0.35s var(--ease-out) both;
}
.note:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-1);
}
@keyframes noteIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.note--removing { animation: noteOut 0.28s var(--ease) forwards; }
@keyframes noteOut {
  to { opacity: 0; transform: translateY(-4px) scale(0.98); max-height: 0; padding-top: 0; padding-bottom: 0; margin-top: 0; margin-bottom: 0; border-width: 0; }
}
.note-content {
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--text-1);
  white-space: pre-wrap;
  word-break: break-word;
  letter-spacing: -0.003em;
}
.note-meta {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-4);
}
.note-time { }
.note-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-press);
  color: var(--text-3);
  font-size: 11px;
}
.note-badge--voice {
  background: rgba(59, 109, 246, 0.10);
  color: var(--brand);
}
.note-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transform: translateX(4px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.note:hover .note-actions,
.note:focus-within .note-actions {
  opacity: 1;
  transform: translateX(0);
}
@media (hover: none) {
  .note-actions {
    opacity: 0.85;
    transform: translateX(0);
  }
}
.note-action {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-3);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.note-action:hover { background: var(--surface-hover); color: var(--text-1); }
.note-action--danger:hover { color: var(--danger); background: var(--danger-soft); }

.note-edit-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  min-height: 0;
}
.note-edit-tags:empty { margin-top: 0; }

/* Empty state */
.empty-state {
  flex: 1;
  min-height: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px 200px;
  text-align: center;
  color: var(--text-3);
}
.empty-illust {
  color: var(--brand);
  margin-bottom: 16px;
  animation: floaty 4s ease-in-out infinite;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.empty-title {
  color: var(--text-1);
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 6px;
}
.empty-sub {
  max-width: 320px;
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 12px 20px 200px;
}

/* ---------- Record FAB ---------- */
.record-fab-wrap {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 20px calc(16px + var(--safe-bottom));
  background: linear-gradient(180deg, transparent, var(--bg) 40%);
  z-index: 20;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.record-fab {
  pointer-events: auto;
  padding: 14px 28px;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 600;
  gap: 8px;
  box-shadow: var(--shadow-md);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease);
  white-space: nowrap;
}
.btn:active { transform: scale(0.96); }
.btn--pill { border-radius: var(--radius-pill); }
.btn--tiny { padding: 4px 10px; font-size: 12px; }
.btn--primary {
  background: var(--brand);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 109, 246, 0.28);
}
.btn--primary:hover { background: var(--brand-strong); }
.btn--primary:disabled { background: var(--surface-press); color: var(--text-4); box-shadow: none; cursor: not-allowed; }
.btn--ghost { background: var(--surface-hover); color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-press); color: var(--text-1); }
.btn--danger { background: var(--danger); color: white; }
.btn--danger:hover { filter: brightness(1.05); }

/* Mic recording state */
.icon-btn.mic--active {
  background: var(--danger);
  color: white;
  animation: micPulse 1.4s ease-in-out infinite;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(229, 72, 77, 0); }
}

/* ================================================================
 * Note Editor (全屏记录/编辑页)
 * ================================================================ */
.note-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  animation: editorSlideIn 0.28s var(--ease-out);
  overscroll-behavior: none;
}
@keyframes editorSlideIn {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.note-editor-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  border-bottom: 1px solid var(--border-2);
  flex-shrink: 0;
}
.note-editor-title { font-size: 16px; font-weight: 600; }
.note-editor-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 20px 0;
  overflow: hidden;
  min-height: 0;
}
.note-editor-input {
  flex: 1;
  width: 100%;
  min-height: 120px;
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--text-1);
  resize: none;
  border: 1.5px solid var(--border-2);
  border-radius: 10px;
  background: var(--surface-1);
  padding: 12px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.note-editor-input:focus {
  border-color: var(--brand);
  outline: none;
}
.note-editor-input::placeholder { color: var(--text-4); }
.note-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 20px calc(8px + var(--safe-bottom));
  border-top: 1px solid var(--border-2);
  flex-shrink: 0;
  background: var(--bg);
}
.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border-2);
  margin: 0 6px;
}
.note-editor-counter {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.note-content strong { font-weight: 700; }
.note-content u { text-decoration-thickness: 1.5px; }

/* ================================================================
 * Draft Editor (文稿编辑器)
 * ================================================================ */
.draft-editor-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  animation: editorSlideIn 0.28s var(--ease-out);
  overscroll-behavior: none;
  overflow: hidden;
}
.draft-editor-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  border-bottom: 1px solid var(--border-2);
  flex-shrink: 0;
}
.draft-topic-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.draft-editor-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 20px 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}
.draft-title-input {
  width: 100%;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-1);
  padding: 0;
  line-height: 1.3;
}
.draft-title-input::placeholder { color: var(--text-4); font-weight: 600; }
.draft-divider {
  height: 1px;
  background: var(--border-2);
  margin: 14px 0;
  flex-shrink: 0;
}
.draft-content-input {
  flex: 1;
  width: 100%;
  min-height: 200px;
  font-size: 15.5px;
  line-height: 1.8;
  color: var(--text-1);
  resize: none;
  border: none;
  background: transparent;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.draft-content-input::placeholder { color: var(--text-4); }
.draft-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 20px calc(8px + var(--safe-bottom));
  border-top: 1px solid var(--border-2);
  flex-shrink: 0;
  background: var(--bg);
}
.draft-editor-counter {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

body.draft-page-active {
  overflow: hidden;
}
body.draft-page-active > *:not(.draft-editor-overlay):not(#toast-root):not(#confirm-overlay) {
  display: none !important;
}

/* ================================================================
 * Voice Overlay
 * ================================================================ */
.voice-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fadeIn 0.25s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.voice-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-elevated);
  border-radius: 22px;
  padding: 32px 24px 20px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.35s var(--ease-out);
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.94) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.voice-pulse {
  position: relative;
  width: 88px; height: 88px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
}
.pulse {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: var(--brand);
  opacity: 0.16;
  animation: pulseRing 2s ease-out infinite;
}
.pulse--2 { animation-delay: 0.6s; }
.pulse--3 { animation-delay: 1.2s; }
@keyframes pulseRing {
  0%   { transform: scale(0.6); opacity: 0.35; }
  100% { transform: scale(1.6); opacity: 0; }
}
.voice-icon {
  position: relative;
  z-index: 1;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgba(59, 109, 246, 0.4);
}
.voice-hint { color: var(--text-3); font-size: 13px; margin-bottom: 12px; }
.voice-transcript {
  min-height: 72px;
  max-height: 180px;
  overflow-y: auto;
  padding: 14px 16px;
  background: var(--bg-sunken);
  border-radius: 14px;
  text-align: left;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-1);
  margin-bottom: 20px;
  border: 1px solid var(--border-2);
}
.voice-transcript:empty::before {
  content: "开始说话，文字将实时出现在这里…";
  color: var(--text-4);
  font-size: 13px;
}
.voice-actions {
  display: flex;
  gap: 10px;
  justify-content: stretch;
}
.voice-actions .btn { flex: 1; padding: 12px 14px; font-size: 14px; }

/* ================================================================
 * Confirm Overlay
 * ================================================================ */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fadeIn 0.2s var(--ease);
}
.confirm-card {
  width: 100%;
  max-width: 340px;
  background: var(--bg-elevated);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.28s var(--ease-out);
}
.confirm-title { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.confirm-desc { margin: 0 0 20px; color: var(--text-3); font-size: 13.5px; line-height: 1.55; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ================================================================
 * Toast
 * ================================================================ */
.toast-root {
  position: fixed;
  top: calc(16px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(92vw, 420px);
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-1);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  color: var(--text-1);
  font-size: 13.5px;
  min-width: 220px;
  max-width: 100%;
  animation: toastIn 0.32s var(--ease-out);
}
.toast--out { animation: toastOut 0.24s var(--ease) forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-14px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-10px) scale(0.98); }
}
.toast-icon {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: white;
  flex-shrink: 0;
}
.toast--success .toast-icon { background: var(--success); }
.toast--warning .toast-icon { background: var(--warning); }
.toast--error .toast-icon { background: var(--danger); }
.toast--info .toast-icon { background: var(--brand); }
.toast-msg { flex: 1; line-height: 1.4; }

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================================================================
 * Responsive: Mobile ≤ 680px
 * ================================================================ */
@media (max-width: 680px) {
  .app-view {
    display: flex;
    flex-direction: column;
    height: 100dvh;
  }
  .main { flex: 1; min-height: 0; }
  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: min(88vw, 320px);
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.36s var(--ease-out);
    box-shadow: var(--shadow-lg);
  }
  .sidebar--open { transform: translateX(0); }
  .icon-btn.sidebar-close { display: grid; }

  .sidebar-mask {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--ease);
  }
  .sidebar-mask--visible {
    opacity: 1;
    pointer-events: auto;
  }

  .icon-btn.topbar-menu { display: grid; }
  .topbar { padding-left: 12px; padding-right: 12px; gap: 8px; }
  .timeline { padding-left: 14px; padding-right: 14px; }
  .record-fab-wrap { padding-left: 12px; padding-right: 12px; padding-bottom: calc(12px + var(--safe-bottom)); }
  .search-badge { margin-left: 14px; margin-right: 14px; }

  .login-card { padding: 32px 24px 24px; }
  .login-title { font-size: 24px; }
}

/* Small tweaks for very small screens */
@media (max-width: 380px) {
  .note { padding: 12px 14px; }
  .note-content { font-size: 15px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}

/* ================================================================
 * v0.0.1 · 闪念胶囊(capsule) 增量样式
 * page-hero / 类型 chips / 卡片头尾 / 标签 / 折叠搜索 / 侧栏 slogan
 * ================================================================ */

/* 极简顶栏 */
.topbar--minimal {
  padding-top: calc(14px + var(--safe-top));
  padding-bottom: 6px;
  border-bottom: none;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.topbar-spacer { flex: 1; }

/* Page hero */
.page-hero {
  padding: 6px 32px 4px;
  animation: fadeSlide 0.4s var(--ease-out);
}
.page-title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-1);
  line-height: 1.2;
}
.page-subtitle {
  margin: 4px 0 0;
  color: var(--text-3);
  font-size: 13.5px;
  letter-spacing: -0.003em;
}

/* 折叠搜索栏 */
.search-bar {
  padding: 12px 32px 4px;
  animation: fadeSlide 0.24s var(--ease-out);
}
.search-bar .search-wrap { height: 40px; }

/* 类型过滤 chips */
.type-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 32px 4px;
}
.chip-filter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.chip-filter:hover { background: var(--surface-hover); }
.chip-filter:active { transform: scale(0.96); }
.chip-filter--active {
  background: var(--text-1);
  color: var(--bg);
  border-color: var(--text-1);
}
.chip-filter .chip-emoji { font-size: 13px; line-height: 1; }
.chip-filter .chip-count {
  margin-left: 2px;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}
.chip-filter--active .chip-count { opacity: 0.7; }

/* Timeline padding 调整 */
.timeline { padding: 12px 32px 110px; }
.day-group-header { margin: 0 0 12px; padding: 6px 0; }

/* 卡片:类型化胶囊布局 */
.note-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12.5px;
}
.note-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  background: var(--type-bg, var(--surface-press));
  color: var(--type-fg, var(--text-2));
}
.note-type--idea        { --type-bg: rgba(245, 197, 24, 0.16); --type-fg: #C48A00; }
.note-type--todo        { --type-bg: rgba(34, 166, 94, 0.16); --type-fg: #187C43; }
.note-type--inspiration { --type-bg: rgba(232, 106, 106, 0.16); --type-fg: #C64545; }
.note-type--memo        { --type-bg: rgba(59, 109, 246, 0.16); --type-fg: var(--brand); }

html[data-theme="dark"] .note-type--idea        { --type-bg: rgba(245, 197, 24, 0.14); --type-fg: #E9C15A; }
html[data-theme="dark"] .note-type--todo        { --type-bg: rgba(46, 190, 116, 0.16); --type-fg: #5FCE8E; }
html[data-theme="dark"] .note-type--inspiration { --type-bg: rgba(255, 130, 130, 0.16); --type-fg: #FF9797; }
html[data-theme="dark"] .note-type--memo        { --type-bg: rgba(109, 147, 255, 0.18); --type-fg: #A9BEFF; }

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .note-type--idea        { --type-bg: rgba(245, 197, 24, 0.14); --type-fg: #E9C15A; }
  html:not([data-theme="light"]) .note-type--todo        { --type-bg: rgba(46, 190, 116, 0.16); --type-fg: #5FCE8E; }
  html:not([data-theme="light"]) .note-type--inspiration { --type-bg: rgba(255, 130, 130, 0.16); --type-fg: #FF9797; }
  html:not([data-theme="light"]) .note-type--memo        { --type-bg: rgba(109, 147, 255, 0.18); --type-fg: #A9BEFF; }
}

.note-time-rel {
  color: var(--text-4);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.note-flag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-press);
  color: var(--text-3);
  font-size: 11px;
}
.note-flag--voice { background: var(--brand-soft); color: var(--brand); }

.note-footer {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 22px;
}
.note-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 6px;
  background: var(--surface-press);
  color: var(--text-2);
  font-size: 12px;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  cursor: pointer;
}
.note-tag:hover {
  background: var(--brand-soft);
  color: var(--brand);
}
.note-footer .note-actions {
  margin-left: auto;
}

/* 隐藏旧版 meta 中冗余的时间(改由 header 展示) */
.note .note-meta { display: none; }

/* Composer 类型选择 */
.composer-types {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px 4px;
}
.chip-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.chip-type:hover { color: var(--text-2); background: var(--surface-hover); }
.chip-type--active {
  background: var(--type-bg, var(--brand-soft));
  color: var(--type-fg, var(--brand));
  border-color: transparent;
}

/* 侧栏 slogan(sidebar 本身是 flex column,margin-top:auto 会自动把 slogan 推到底) */
.sidebar-slogan {
  margin-top: auto;
  padding-top: 16px;
  color: var(--text-4);
  font-size: 11.5px;
  line-height: 1.6;
  letter-spacing: 0.02em;
}
.sidebar-slogan .slogan-text {
  color: var(--text-3);
  font-weight: 500;
}
.sidebar-slogan .slogan-version {
  margin-top: 2px;
  color: var(--text-4);
}

/* 高亮 mark 与深色适配 */
.note-content mark {
  background: var(--brand-soft);
  color: var(--brand);
  padding: 0 2px;
  border-radius: 3px;
}

/* 响应式:移动端 */
@media (max-width: 680px) {
  .page-hero { padding: 6px 16px 4px; }
  .type-filters { padding: 12px 16px 4px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .type-filters::-webkit-scrollbar { display: none; }
  .timeline { padding-left: 14px; padding-right: 14px; }
  .search-bar { padding: 10px 16px 4px; }
  .page-title { font-size: 22px; }
  .page-subtitle { font-size: 13px; }
  .composer-types { padding: 8px 10px 2px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .composer-types::-webkit-scrollbar { display: none; }
  .record-fab-wrap {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
  }
  .timeline { padding-bottom: 100px; }
}

/* ================================================================
 * 内容创作模块 (Content Creation)
 * 作用域: #topics-module
 * 品牌色: 琥珀 #f59e0b (区别于闪念记录的蓝色)
 * ================================================================ */

#topics-module, #topic-form-overlay {
  --cc-brand-50: #fffbeb; --cc-brand-100: #fef3c7; --cc-brand-200: #fde68a;
  --cc-brand-400: #fbbf24; --cc-brand-500: #f59e0b; --cc-brand-600: #d97706; --cc-brand-700: #b45309;
  --cc-ink-50: #f7f7f7; --cc-ink-100: #efefef; --cc-ink-200: #e0e0e0; --cc-ink-300: #c4c4c4;
  --cc-ink-400: #8f8f8f; --cc-ink-500: #6b6b6b; --cc-ink-600: #4a4a4a; --cc-ink-700: #333333; --cc-ink-800: #1f1f1f;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

/* ---- Page Hero ---- */
.cc-page-hero { padding: 24px 20px 0; }
.cc-page-title { font-size: 24px; font-weight: 600; color: var(--cc-ink-800); letter-spacing: -0.02em; }
.cc-page-subtitle { font-size: 13px; color: var(--cc-ink-400); margin-top: 4px; }

/* ---- Tabs ---- */
.cc-tabs {
  display: flex;
  gap: 0;
  margin-top: 16px;
  padding: 0 20px;
  border-bottom: 1px solid var(--cc-ink-100);
  overflow-x: auto;
  scrollbar-width: none;
}
.cc-tabs::-webkit-scrollbar { display: none; }
.cc-tab {
  height: 40px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--cc-ink-500);
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  cursor: pointer;
  text-decoration: none;
}
.cc-tab:hover { color: var(--cc-ink-700); }
.cc-tab--active {
  color: var(--cc-ink-800);
  border-bottom-color: var(--cc-brand-500);
}

/* ---- View containers ---- */
.cc-view { padding: 0 20px 20px; flex: 1; overflow-y: auto; }

/* ---- Toolbar (选题库) ---- */
.cc-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 16px 0;
}
.cc-toolbar-spacer { flex: 1; }
.cc-search-wrap {
  position: relative;
  width: 100%;
  max-width: 280px;
}
.cc-search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--cc-ink-400);
}
.cc-search-input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 32px;
  border: 1px solid var(--cc-ink-200);
  border-radius: 8px;
  font-size: 14px;
  color: var(--cc-ink-800);
  background: var(--bg-elevated, #fff);
  transition: border-color 0.15s;
}
.cc-search-input:focus { border-color: var(--cc-brand-400); outline: none; box-shadow: 0 0 0 3px var(--cc-brand-50); }
.cc-search-input::placeholder { color: var(--cc-ink-400); }
.cc-select {
  height: 36px;
  padding: 0 28px 0 12px;
  border: 1px solid var(--cc-ink-200);
  border-radius: 8px;
  font-size: 13px;
  color: var(--cc-ink-700);
  background: var(--bg-elevated, #fff);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238f8f8f' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
.cc-select:focus { border-color: var(--cc-brand-400); outline: none; box-shadow: 0 0 0 3px var(--cc-brand-50); }

/* ---- Buttons ---- */
.cc-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 16px;
  border-radius: 10px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  border: none; white-space: nowrap;
}
.cc-btn--primary {
  background: var(--cc-brand-500); color: white;
}
.cc-btn--primary:hover { background: var(--cc-brand-600); }
.cc-btn--primary:disabled { opacity: 0.5; cursor: default; }
.cc-btn--secondary {
  background: var(--cc-ink-100); color: var(--cc-ink-700);
}
.cc-btn--secondary:hover { background: var(--cc-ink-200); }
.cc-btn--sm { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 8px; }
.cc-icon-btn {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--cc-ink-500); cursor: pointer;
  transition: background 0.15s;
  border: none; background: transparent;
}
.cc-icon-btn:hover { background: var(--cc-ink-100); }
.cc-brand-btn { background: var(--cc-brand-500) !important; }
.cc-brand-btn:hover { background: var(--cc-brand-600) !important; }
.cc-brand-btn:disabled { opacity: 0.5 !important; }

/* ---- Chips / Badges ---- */
.cc-chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px;
  border-radius: 6px;
  font-size: 11.5px; font-weight: 500;
  border: 1px solid transparent;
}
.cc-chip::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.cc-chip--rose   { background: #fdf2f4; color: #be123c; border-color: #fecdd3; }
.cc-chip--rose::before { background: #fb7185; }
.cc-chip--indigo  { background: #eef2ff; color: #3730a3; border-color: #c7d2fe; }
.cc-chip--indigo::before { background: #818cf8; }
.cc-chip--emerald { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.cc-chip--emerald::before { background: #34d399; }
.cc-chip--amber   { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.cc-chip--amber::before { background: #fbbf24; }
.cc-chip--cyan    { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.cc-chip--cyan::before { background: #22d3ee; }
.cc-chip--ink     { background: var(--cc-ink-100); color: var(--cc-ink-600); border-color: var(--cc-ink-200); }
.cc-chip--ink::before { background: var(--cc-ink-400); }
.cc-chip--sky     { background: #f0f9ff; color: #0369a1; border-color: #bae6fd; }
.cc-chip--sky::before { background: #38bdf8; }
.cc-chip--yellow  { background: #fefce8; color: #a16207; border-color: #fef08a; }
.cc-chip--yellow::before { background: #facc15; }
.cc-chip--violet  { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.cc-chip--violet::before { background: #a78bfa; }
.cc-chip--green   { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.cc-chip--green::before { background: #4ade80; }
.cc-chip--orange  { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.cc-chip--orange::before { background: #fb923c; }

/* Platform compact badges */
.cc-plat-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 4px;
  background: var(--cc-ink-100); color: var(--cc-ink-600);
  font-size: 10px; font-weight: 600;
}
.cc-plat-extra { font-size: 10px; color: var(--cc-ink-400); margin-left: 2px; }

/* ---- Topic Card (选题库) ---- */
.cc-topic-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 12px;
}
@media (min-width: 681px) {
  .cc-topic-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .cc-topic-grid { grid-template-columns: repeat(3, 1fr); }
}
.cc-card {
  position: relative;
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--cc-ink-100);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.cc-card:hover { border-color: var(--cc-ink-200); box-shadow: 0 1px 2px rgba(17,17,17,0.03); }
.cc-card-top { display: flex; align-items: flex-start; gap: 8px; }
.cc-card-info { flex: 1; min-width: 0; }
.cc-card-title {
  font-size: 15px; font-weight: 600; color: var(--cc-ink-800);
  line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cc-card-desc {
  font-size: 13px; color: var(--cc-ink-500); line-height: 1.5; margin-top: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cc-card-menu-btn {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--cc-ink-400); font-size: 16px; font-weight: 700;
  cursor: pointer; border: none; background: transparent;
  transition: background 0.12s;
}
.cc-card-menu-btn:hover { background: var(--cc-ink-100); color: var(--cc-ink-700); }
@media (min-width: 681px) {
  .cc-card-menu-btn { opacity: 0; transition: opacity 0.15s, background 0.12s; }
  .cc-card:hover .cc-card-menu-btn { opacity: 1; }
}
.cc-card-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.cc-card-date-tag { margin-left: auto; font-size: 11.5px; color: var(--cc-ink-500); white-space: nowrap; }
.cc-card-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid rgba(0,0,0,0.04);
}
.cc-card-platforms { display: flex; gap: 4px; align-items: center; }
.cc-card-date { font-size: 11.5px; color: var(--cc-ink-500); display: flex; align-items: center; gap: 4px; }

/* ---- Dropdown menu ---- */
.cc-dropdown {
  position: absolute; right: 12px; top: 44px; z-index: 30;
  width: 160px;
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--cc-ink-100);
  border-radius: 10px;
  box-shadow: 0 4px 24px -4px rgba(17,17,17,0.08);
  padding: 4px 0;
  animation: ccPopIn 120ms ease-out;
}
@keyframes ccPopIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
.cc-dropdown-item {
  display: flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px;
  font-size: 13px; color: var(--cc-ink-700);
  cursor: pointer; border: none; background: none; width: 100%; text-align: left;
  transition: background 0.1s;
}
.cc-dropdown-item:hover { background: var(--cc-ink-50); }
.cc-dropdown-item--danger { color: #e5484d; }
.cc-dropdown-item--danger:hover { background: rgba(229,72,77,0.06); }
.cc-dropdown-sep { height: 1px; background: var(--cc-ink-100); margin: 4px 0; }
.cc-dropdown-hint { padding: 4px 12px; font-size: 11px; color: var(--cc-ink-400); }

/* ---- Empty state ---- */
.cc-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; text-align: center;
}
.cc-empty-icon { color: var(--cc-ink-300); margin-bottom: 16px; }
.cc-empty-title { font-size: 15px; font-weight: 500; color: var(--cc-ink-600); }
.cc-empty-sub { font-size: 13px; color: var(--cc-ink-400); margin-top: 4px; }
.cc-empty-state .cc-btn { margin-top: 16px; }

/* ---- Kanban ---- */
.cc-kanban-board {
  display: flex; gap: 12px; padding: 16px 0;
  overflow-x: auto; min-height: 400px;
}
.cc-kanban-board::-webkit-scrollbar { display: none; }
.cc-kanban-col {
  flex-shrink: 0; width: 280px;
  display: flex; flex-direction: column;
  background: rgba(0,0,0,0.02); border-radius: 12px; padding: 12px;
}
@media (min-width: 1024px) {
  .cc-kanban-col { flex: 1; width: auto; }
}
.cc-kanban-col-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px; padding: 0 4px;
}
.cc-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cc-dot--ink { background: var(--cc-ink-400); }
.cc-dot--sky { background: #38bdf8; }
.cc-dot--yellow { background: #facc15; }
.cc-dot--violet { background: #a78bfa; }
.cc-dot--green { background: #4ade80; }
.cc-dot--orange { background: #fb923c; }
.cc-dot--rose { background: #fb7185; }
.cc-dot--indigo { background: #818cf8; }
.cc-dot--emerald { background: #34d399; }
.cc-dot--amber { background: #fbbf24; }
.cc-dot--cyan { background: #22d3ee; }
.cc-kanban-col-name { font-size: 13px; font-weight: 500; color: var(--cc-ink-700); }
.cc-kanban-col-count { font-size: 12px; color: var(--cc-ink-400); }
.cc-kanban-cards { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.cc-kanban-empty { text-align: center; padding: 40px 0; font-size: 12px; color: var(--cc-ink-400); }

.cc-kcard {
  position: relative;
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--cc-ink-100);
  border-radius: 8px; padding: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.cc-kcard:hover { border-color: var(--cc-ink-200); box-shadow: 0 1px 2px rgba(17,17,17,0.03); }
.cc-kcard-top { display: flex; align-items: flex-start; gap: 6px; }
.cc-kcard-info { flex: 1; min-width: 0; }
.cc-kcard-title { font-size: 13.5px; font-weight: 500; color: var(--cc-ink-800); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-kcard-desc { font-size: 12px; color: var(--cc-ink-500); margin-top: 4px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-kcard-actions {
  display: flex; align-items: center; gap: 2px; flex-shrink: 0;
}
@media (min-width: 681px) {
  .cc-kcard-actions { opacity: 0; transition: opacity 0.15s; }
  .cc-kcard:hover .cc-kcard-actions { opacity: 1; }
}
.cc-kcard-advance, .cc-kcard-menu {
  width: 24px; height: 24px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--cc-ink-400); cursor: pointer;
  border: none; background: transparent;
  transition: background 0.1s, color 0.1s;
}
.cc-kcard-advance:hover { background: var(--cc-brand-50); color: var(--cc-brand-600); }
.cc-kcard-menu:hover { background: var(--cc-ink-100); color: var(--cc-ink-700); }
.cc-kcard-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }

/* ---- Calendar ---- */
.cc-calendar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0;
}
.cc-calendar-title { font-size: 18px; font-weight: 600; color: var(--cc-ink-800); }
.cc-calendar-nav { display: flex; align-items: center; gap: 6px; }
.cc-calendar-legend {
  display: none; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px; font-size: 11.5px; color: var(--cc-ink-500);
}
@media (min-width: 681px) { .cc-calendar-legend { display: flex; } }
.cc-legend-item { display: flex; align-items: center; gap: 4px; }
.cc-legend-dot { width: 8px; height: 8px; border-radius: 50%; }

.cc-month-grid-wrap {
  border: 1px solid var(--cc-ink-100); border-radius: 12px; overflow: hidden; background: var(--bg-elevated, #fff);
}
.cc-calendar-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--cc-ink-100);
  background: rgba(0,0,0,0.015);
}
.cc-calendar-weekdays span {
  padding: 8px 0; text-align: center;
  font-size: 12px; font-weight: 500; color: var(--cc-ink-500);
}
.cc-month-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: minmax(92px, auto);
}
@media (min-width: 681px) { .cc-month-grid { grid-auto-rows: minmax(112px, auto); } }
.cc-cal-cell {
  border-right: 1px solid rgba(0,0,0,0.04);
  border-bottom: 1px solid rgba(0,0,0,0.04);
  padding: 6px; display: flex; flex-direction: column; gap: 3px;
}
.cc-cal-cell:nth-child(7n) { border-right: none; }
.cc-cal-cell--other { background: rgba(0,0,0,0.015); }
.cc-cal-day { font-size: 12px; font-weight: 500; color: var(--cc-ink-700); padding: 0 4px; }
.cc-cal-cell--other .cc-cal-day { color: var(--cc-ink-300); }
.cc-cal-today {
  display: inline-flex; justify-content: center; align-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--cc-brand-500); color: white; font-weight: 600;
}
.cc-cal-event {
  display: block;
  font-size: 11px; line-height: 1.3;
  padding: 2px 6px; border-radius: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
  transition: opacity 0.1s;
}
.cc-cal-event:hover { opacity: 0.8; }
.cc-event--rose    { background: #fdf2f4; color: #be123c; border-left: 2px solid #fb7185; }
.cc-event--indigo  { background: #eef2ff; color: #3730a3; border-left: 2px solid #818cf8; }
.cc-event--emerald { background: #ecfdf5; color: #047857; border-left: 2px solid #34d399; }
.cc-event--amber   { background: #fffbeb; color: #b45309; border-left: 2px solid #fbbf24; }
.cc-event--cyan    { background: #ecfeff; color: #0e7490; border-left: 2px solid #22d3ee; }
.cc-cal-more { padding: 0 4px; font-size: 11px; color: var(--cc-ink-400); }

/* Mobile calendar → week list */
@media (max-width: 680px) {
  .cc-month-grid-wrap { display: none; }
  .cc-calendar-legend { display: none !important; }
}
@media (min-width: 681px) {
  .cc-week-list { display: none; }
}
.cc-week-list { padding: 0 0 20px; }
.cc-wl-day { margin-bottom: 16px; }
.cc-wl-day-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 0 4px;
}
.cc-wl-day-date { font-size: 13px; font-weight: 600; color: var(--cc-ink-700); }
.cc-wl-day-date--today { color: var(--cc-brand-600); }
.cc-wl-day-weekday { font-size: 11px; color: var(--cc-ink-400); }
.cc-wl-today-badge {
  height: 18px; padding: 0 6px; border-radius: 4px;
  font-size: 10px; font-weight: 500;
  background: var(--cc-brand-500); color: white;
  display: inline-flex; align-items: center;
}
.cc-wl-day-line { flex: 1; height: 1px; background: var(--cc-ink-100); }
.cc-wl-day-count { font-size: 11px; color: var(--cc-ink-400); }
.cc-wl-item {
  background: var(--bg-elevated, #fff); border: 1px solid var(--cc-ink-100);
  border-radius: 8px; padding: 12px; margin-bottom: 8px;
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
}
.cc-wl-item:hover { border-color: var(--cc-ink-200); box-shadow: 0 1px 2px rgba(17,17,17,0.03); }
.cc-wl-item-top { display: flex; align-items: flex-start; gap: 8px; }
.cc-wl-item-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.cc-wl-item-title { font-size: 13.5px; font-weight: 500; color: var(--cc-ink-800); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-wl-item-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.cc-cal-empty { text-align: center; padding: 64px 0; font-size: 13px; color: var(--cc-ink-400); }

/* ---- Form dialog ---- */
.cc-form-overlay {
  z-index: 100;
  padding: 24px 16px;
  padding-top: calc(24px + env(safe-area-inset-top));
}
.cc-form-card { max-width: 520px; width: calc(100% - 32px); max-height: 85vh; max-height: 85dvh; overflow-y: auto; }
.cc-form-card .confirm-actions .btn--ghost {
  background: var(--cc-ink-100); color: var(--cc-ink-700); border: 1px solid var(--cc-ink-200);
}
.cc-form-card .confirm-actions .btn--ghost:hover { background: var(--cc-ink-200); color: var(--cc-ink-800); }
.cc-form-field { margin-top: 16px; }
.cc-form-label { display: block; font-size: 13px; font-weight: 500; color: var(--cc-ink-700); margin-bottom: 6px; }
.cc-form-hint { font-weight: 400; color: var(--cc-ink-400); margin-left: 6px; }
.cc-form-input {
  width: 100%; height: 36px; padding: 0 12px;
  border: 1px solid var(--cc-ink-200); border-radius: 8px;
  font-size: 14px; color: var(--cc-ink-800); background: var(--bg-elevated, #fff);
  transition: border-color 0.15s;
}
.cc-form-input:focus { border-color: var(--cc-brand-400); outline: none; box-shadow: 0 0 0 3px var(--cc-brand-50); }
.cc-form-textarea {
  width: 100%; padding: 8px 12px; min-height: 72px;
  border: 1px solid var(--cc-ink-200); border-radius: 8px;
  font-size: 14px; color: var(--cc-ink-800); line-height: 1.5;
  background: var(--bg-elevated, #fff); resize: vertical;
  transition: border-color 0.15s;
}
.cc-form-textarea:focus { border-color: var(--cc-brand-400); outline: none; box-shadow: 0 0 0 3px var(--cc-brand-50); }
.cc-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cc-form-card .cc-form-field:last-of-type { margin-bottom: 24px; }
.cc-form-card input[type="date"] { text-align: right; }
.cc-choice-group { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-choice-btn {
  height: 30px; padding: 0 12px; border-radius: 8px;
  font-size: 12.5px; font-weight: 500; border: 1px solid var(--cc-ink-200);
  background: var(--cc-ink-50); color: var(--cc-ink-700);
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
  transition: all 0.12s;
}
.cc-choice-btn:hover { background: var(--cc-ink-100); border-color: var(--cc-ink-300); }
.cc-choice-btn--active {
  border-color: var(--cc-brand-500); background: var(--cc-brand-500); color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.35);
}
.cc-choice-btn--active:hover { background: var(--cc-brand-600); border-color: var(--cc-brand-600); }

/* ---- Deep dark mode support ---- */
@media (prefers-color-scheme: dark) {
  #topics-module {
    --cc-ink-50: #1a1a1d; --cc-ink-100: #27272a; --cc-ink-200: #3f3f46; --cc-ink-300: #52525b;
    --cc-ink-400: #a1a1aa; --cc-ink-500: #a1a1aa; --cc-ink-600: #d4d4d8; --cc-ink-700: #e4e4e7; --cc-ink-800: #fafafa;
  }
  .cc-card, .cc-kcard, .cc-wl-item, .cc-month-grid-wrap, .cc-form-input, .cc-form-textarea, .cc-search-input, .cc-select {
    background: var(--cc-ink-50);
    border-color: var(--cc-ink-200);
  }
  .cc-dropdown { background: var(--cc-ink-50); border-color: var(--cc-ink-200); }
}

/* ---- Filter toggle (mobile-only) ---- */
.cc-filter-row {
  display: none;
  padding: 8px 0 0;
}
.cc-filter-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--cc-ink-500);
  background: var(--cc-ink-50);
  border: 1px solid var(--cc-ink-200);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.cc-filter-toggle-btn:hover { background: var(--cc-ink-100); }
.cc-filter-toggle-btn--active { color: var(--cc-brand-600); border-color: var(--cc-brand-200); background: var(--cc-brand-50); }
.cc-filter-arrow { transition: transform 0.2s; }
.cc-filter-toggle-btn--active .cc-filter-arrow { transform: rotate(180deg); }

/* ---- FAB (mobile-only) ---- */
.cc-fab-wrap { display: none; }
.cc-fab {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--cc-brand-500); color: white;
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}
.cc-fab:hover { transform: scale(1.05); }
.cc-fab:active { transform: scale(0.95); }

/* ---- Responsive mobile ---- */
@media (max-width: 680px) {
  .cc-page-hero { padding: 8px 16px 0; }
  .cc-page-title { font-size: 22px; }
  .cc-tabs { padding: 0 16px; }
  .cc-view { padding: 0 16px 80px; }
  .cc-filter-row { display: flex; }
  .cc-toolbar { flex-direction: column; align-items: stretch; display: none; }
  .cc-toolbar--open { display: flex; }
  #cc-new-btn { display: none; }
  #td-new-btn { display: none; }
  .cc-search-wrap { max-width: none; }
  .cc-toolbar-spacer { display: none; }
  .cc-fab-wrap {
    display: block;
    position: fixed;
    right: 16px;
    bottom: calc(20px + var(--safe-bottom));
    z-index: 20;
  }
  .cc-form-row { grid-template-columns: 1fr; }
  .cc-form-card { max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); }
}

/* ================================================================
 * 每日简报模块 · Briefing
 * ================================================================ */
.br-page-hero { padding: 20px 24px 0; }
.br-hero-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
}
.br-page-title {
  font-size: 26px; font-weight: 700; letter-spacing: -0.02em;
  color: var(--text-1); margin: 0;
}
.br-page-subtitle {
  font-size: 13px; color: var(--text-3); margin: 4px 0 0;
}
.br-generate-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 600;
  background: var(--brand); color: var(--text-inv);
  border: none; cursor: pointer;
  transition: opacity var(--dur-fast), transform var(--dur-fast);
}
.br-generate-btn:hover { opacity: 0.9; }
.br-generate-btn:active { transform: scale(0.97); }
.br-generate-btn:disabled {
  opacity: 0.5; cursor: not-allowed; transform: none;
}
.br-generate-hint {
  font-size: 12px; color: var(--text-3); margin: 8px 0 0;
  animation: br-pulse 1.5s ease-in-out infinite;
}
@keyframes br-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Date nav */
.br-date-nav {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px 0;
}
.br-date-btn {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--border-1); background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-2);
  transition: background var(--dur-fast);
}
.br-date-btn:hover { background: var(--surface-hover); }
.br-date-label {
  font-size: 14px; font-weight: 600; color: var(--text-1);
  min-width: 120px; text-align: center;
}

/* Content area */
.br-content { padding: 16px 24px 40px; }

.br-section {
  background: var(--surface-1); border: 1px solid var(--border-1);
  border-radius: var(--radius); padding: 20px;
  margin-bottom: 16px;
}
.br-section-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
}
.br-section-emoji { font-size: 20px; }
.br-section-title {
  font-size: 16px; font-weight: 700; color: var(--text-1); margin: 0;
}
.br-section-summary {
  font-size: 13.5px; line-height: 1.7; color: var(--text-2);
  margin: 0 0 14px; padding: 10px 14px;
  background: var(--brand-softer); border-radius: var(--radius-sm);
  border-left: 3px solid var(--brand);
}

/* Articles */
.br-articles { display: flex; flex-direction: column; gap: 8px; }
.br-article {
  display: block; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); text-decoration: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.br-article:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.br-article-title {
  font-size: 14px; font-weight: 600; color: var(--text-1);
  line-height: 1.4;
}
.br-article-snippet {
  font-size: 12.5px; color: var(--text-3); margin-top: 4px;
  line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.br-article-source {
  font-size: 11px; color: var(--text-4); margin-top: 6px;
}

.br-no-source {
  font-size: 13px; color: var(--text-4); padding: 16px 0;
  font-style: italic;
}

.br-gen-time {
  text-align: center; font-size: 11px; color: var(--text-4);
  padding: 16px 0 8px;
}

/* Empty state */
.br-empty {
  text-align: center; padding: 60px 24px 80px;
  color: var(--text-3);
}
.br-empty svg { margin-bottom: 12px; color: var(--text-4); }
.br-empty-title {
  font-size: 16px; font-weight: 600; color: var(--text-2);
  margin: 0 0 6px;
}
.br-empty-sub {
  font-size: 13px; color: var(--text-3); margin: 0;
  max-width: 320px; margin-inline: auto; line-height: 1.6;
}

/* Loading state */
.br-loading {
  text-align: center; padding: 80px 24px;
}
.br-loading-spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--border-1);
  border-top-color: var(--brand);
  animation: br-spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes br-spin {
  to { transform: rotate(360deg); }
}
.br-loading-text {
  font-size: 13px; color: var(--text-3); margin: 0;
}

/* Briefing dark mode */
@media (prefers-color-scheme: dark) {
  .br-section { background: var(--surface-1); border-color: var(--border-1); }
  .br-article { border-color: var(--border-2); }
}

/* Briefing mobile */
@media (max-width: 680px) {
  .br-page-hero { padding: 12px 16px 0; }
  .br-page-title { font-size: 22px; }
  .br-hero-row { flex-direction: column; gap: 12px; }
  .br-date-nav { padding: 10px 16px 0; }
  .br-content { padding: 12px 16px 32px; }
  .br-section { padding: 16px; }
}

/* ================================================================
 * Todos (待办事项模块)
 * ================================================================ */
.td-list-view {
  padding: 4px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 900px;
}
.td-group-header {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--cc-ink-500);
  margin: 16px 0 2px;
}
.td-group-header:first-child { margin-top: 4px; }

.td-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--cc-ink-100);
  border-left: 3px solid var(--text-4);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.td-card:hover { box-shadow: 0 1px 2px rgba(17,17,17,0.03); }
.td-card.td-priority--high { border-left-color: var(--danger); }
.td-card.td-priority--medium { border-left-color: var(--warning); }
.td-card.td-priority--low { border-left-color: var(--text-4); }
.td-card--done { opacity: 0.5; }
.td-card--done .td-card-title { text-decoration: line-through; }

.td-checkbox {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border-radius: 50%;
  border: 1.5px solid var(--cc-ink-300);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background 0.12s, border-color 0.12s;
}
.td-checkbox:hover { border-color: var(--brand); }
.td-checkbox--checked {
  background: var(--brand);
  border-color: var(--brand);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='13' height='13' fill='none'%3E%3Cpath d='M5 12l5 5L20 7' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.td-card-body { flex: 1; min-width: 0; }
.td-card-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--cc-ink-800);
  line-height: 1.4;
}
.td-card-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }

/* Todos mobile */
@media (max-width: 680px) {
  .td-list-view { padding: 4px 16px 100px; }
}

