/* --------------------------------------------------------------------------
   billebersohl.us — design tokens & layout
   -------------------------------------------------------------------------- */
:root {
  --bg: #0b0f14;
  --bg-elevated: #121821;
  --bg-sidebar: #0e131a;
  --text: #e8eef7;
  --muted: #93a0b4;
  --accent: #6ee7b7;
  --accent-2: #60a5fa;
  --accent-soft: rgba(110, 231, 183, 0.12);
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sidebar-width: 15.5rem;
  --transition: 0.2s ease;
}

[data-theme="light"] {
  --bg: #f4f6f9;
  --bg-elevated: #ffffff;
  --bg-sidebar: #eef2f7;
  --text: #121820;
  --muted: #5c6b80;
  --accent: #0d9488;
  --accent-2: #2563eb;
  --accent-soft: rgba(13, 148, 136, 0.12);
  --border: rgba(0, 0, 0, 0.08);
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

[data-theme="light"] {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  transition: background-color var(--transition), color var(--transition);
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1000px 500px at 10% -10%, rgba(96, 165, 250, 0.18), transparent 60%),
    radial-gradient(800px 400px at 90% 0%, rgba(110, 231, 183, 0.12), transparent 55%),
    var(--bg);
  pointer-events: none;
}

[data-theme="light"] .bg {
  background:
    radial-gradient(1000px 500px at 10% -10%, rgba(37, 99, 235, 0.1), transparent 60%),
    radial-gradient(800px 400px at 90% 0%, rgba(13, 148, 136, 0.1), transparent 55%),
    var(--bg);
}

/* Book Club — library atmosphere */
body.page-book-club .bg {
  background:
    linear-gradient(
      105deg,
      rgba(8, 10, 14, 0.88) 0%,
      rgba(8, 10, 14, 0.72) 42%,
      rgba(8, 10, 14, 0.55) 100%
    ),
    radial-gradient(900px 480px at 12% 0%, rgba(110, 231, 183, 0.1), transparent 55%),
    radial-gradient(700px 420px at 88% 10%, rgba(96, 165, 250, 0.12), transparent 50%),
    url("images/book-club-library.jpg") center / cover no-repeat fixed;
}

[data-theme="light"] body.page-book-club .bg {
  background:
    linear-gradient(
      105deg,
      rgba(244, 246, 249, 0.9) 0%,
      rgba(244, 246, 249, 0.78) 45%,
      rgba(244, 246, 249, 0.62) 100%
    ),
    radial-gradient(900px 480px at 12% 0%, rgba(13, 148, 136, 0.12), transparent 55%),
    url("images/book-club-library.jpg") center / cover no-repeat fixed;
}

body.page-book-club .sidebar {
  background: rgba(14, 19, 26, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

[data-theme="light"] body.page-book-club .sidebar {
  background: rgba(238, 242, 247, 0.88);
}

body.page-book-club .card,
body.page-book-club .bc-drawer-panel {
  background: rgba(18, 24, 33, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

[data-theme="light"] body.page-book-club .card,
[data-theme="light"] body.page-book-club .bc-drawer-panel {
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.1);
}

body.page-book-club .bc-chat {
  background: rgba(0, 0, 0, 0.28);
}

[data-theme="light"] body.page-book-club .bc-chat {
  background: rgba(255, 255, 255, 0.55);
}

body.page-book-club .hero .page-title {
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}

body.page-book-club .bc-setup.is-connected {
  opacity: 0.92;
}

body.page-book-club .bc-setup.is-connected .bc-setup-connected {
  display: block;
  margin: 0 0 0.75rem;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}

body.page-book-club .bc-setup-connected {
  display: none;
}

/* --------------------------------------------------------------------------
   Finances Dashboard — compact cards & tables
   -------------------------------------------------------------------------- */
body.page-finances-dashboard .fin-bg {
  background:
    linear-gradient(
      120deg,
      rgba(8, 12, 20, 0.92) 0%,
      rgba(8, 12, 20, 0.78) 45%,
      rgba(8, 12, 20, 0.7) 100%
    ),
    radial-gradient(900px 420px at 8% -5%, rgba(96, 165, 250, 0.22), transparent 55%),
    radial-gradient(700px 380px at 92% 5%, rgba(52, 211, 153, 0.16), transparent 50%),
    radial-gradient(600px 360px at 50% 100%, rgba(251, 191, 36, 0.1), transparent 55%),
    url("images/finances-bg.jpg") center / cover no-repeat fixed;
}

[data-theme="light"] body.page-finances-dashboard .fin-bg {
  background:
    linear-gradient(
      120deg,
      rgba(244, 246, 249, 0.92) 0%,
      rgba(244, 246, 249, 0.82) 50%,
      rgba(244, 246, 249, 0.75) 100%
    ),
    radial-gradient(900px 420px at 8% -5%, rgba(37, 99, 235, 0.12), transparent 55%),
    radial-gradient(700px 380px at 92% 5%, rgba(13, 148, 136, 0.1), transparent 50%),
    url("images/finances-bg.jpg") center / cover no-repeat fixed;
}

body.page-finances-dashboard .sidebar {
  background: rgba(10, 14, 22, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right-color: rgba(96, 165, 250, 0.12);
}

[data-theme="light"] body.page-finances-dashboard .sidebar {
  background: rgba(255, 255, 255, 0.86);
}

body.page-finances-dashboard .card,
body.page-finances-dashboard .fin-kpi {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

body.page-finances-dashboard .card {
  background: rgba(16, 22, 32, 0.72);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.04);
}

[data-theme="light"] body.page-finances-dashboard .card {
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

body.page-finances-dashboard .page-title {
  background: linear-gradient(105deg, #e8eef7 0%, #93c5fd 45%, #6ee7b7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] body.page-finances-dashboard .page-title {
  background: linear-gradient(105deg, #0f172a 0%, #1d4ed8 50%, #0f766e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.main-fin {
  max-width: 72rem !important;
  padding-top: 1.75rem !important;
}

.footer-fin {
  max-width: 72rem !important;
}

.fin-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.fin-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.fin-badge-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
  animation: fin-pulse 2.2s ease-in-out infinite;
}

@keyframes fin-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

.fin-synced {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
}

.fin-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.75rem 0 1rem;
}

.fin-kpi {
  flex: 0 1 auto;
  min-width: 7.5rem;
  padding: 0.6rem 0.8rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  position: relative;
  overflow: hidden;
}

.fin-kpi::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
  background: var(--accent-2);
}

.fin-kpi--nw::before {
  background: linear-gradient(180deg, #60a5fa, #a78bfa);
}

.fin-kpi--liq::before {
  background: linear-gradient(180deg, #34d399, #2dd4bf);
}

.fin-kpi--et::before {
  background: linear-gradient(180deg, #fbbf24, #f59e0b);
}

.fin-kpi--btc::before {
  background: linear-gradient(180deg, #f59e0b, #f97316);
}

.fin-kpi--up::before {
  background: #34d399;
}

.fin-kpi--down::before {
  background: #f87171;
}

.fin-kpi--nw {
  background: linear-gradient(
    135deg,
    rgba(96, 165, 250, 0.12),
    var(--bg-elevated) 55%
  );
}

.fin-kpi--liq {
  background: linear-gradient(
    135deg,
    rgba(52, 211, 153, 0.1),
    var(--bg-elevated) 55%
  );
}

.fin-kpi--et {
  background: linear-gradient(
    135deg,
    rgba(251, 191, 36, 0.1),
    var(--bg-elevated) 55%
  );
}

.fin-kpi--btc {
  background: linear-gradient(
    135deg,
    rgba(249, 115, 22, 0.1),
    var(--bg-elevated) 55%
  );
}

.fin-kpi--up {
  background: linear-gradient(
    135deg,
    rgba(52, 211, 153, 0.12),
    var(--bg-elevated) 55%
  );
}

.fin-kpi--down {
  background: linear-gradient(
    135deg,
    rgba(248, 113, 113, 0.12),
    var(--bg-elevated) 55%
  );
}

.fin-kpi-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.fin-kpi-value {
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 0.15rem;
  white-space: nowrap;
}

/* Section icons (CSS shapes — no image assets required) */
.fin-card-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.fin-icon {
  display: inline-block;
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
  border-radius: 4px;
  position: relative;
}

.fin-icon-chart {
  background: linear-gradient(145deg, #60a5fa, #3b82f6);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}

.fin-icon-chart::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 2px;
  height: 45%;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.85) 0 2px,
    transparent 2px 4px
  );
  clip-path: polygon(0 80%, 25% 50%, 50% 70%, 75% 20%, 100% 40%, 100% 100%, 0 100%);
}

.fin-icon-pie {
  background: conic-gradient(#60a5fa 0 40%, #34d399 40% 65%, #fbbf24 65% 85%, #a78bfa 85% 100%);
  border-radius: 50%;
}

.fin-icon-shield {
  background: linear-gradient(160deg, #34d399, #059669);
  clip-path: polygon(50% 0, 100% 20%, 100% 55%, 50% 100%, 0 55%, 0 20%);
  border-radius: 0;
}

.fin-icon-wallet {
  background: linear-gradient(145deg, #fbbf24, #d97706);
  border-radius: 3px;
}

.fin-icon-wallet::after {
  content: "";
  position: absolute;
  right: 2px;
  top: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
}

.fin-icon-calendar {
  background: linear-gradient(180deg, #f87171 0 30%, #f8fafc 30% 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.fin-card-guard {
  border-color: rgba(52, 211, 153, 0.22);
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.06);
}

.fin-card-cash {
  border-color: rgba(251, 191, 36, 0.22);
}

.fin-card-rmd {
  border-color: rgba(96, 165, 250, 0.22);
}

.fin-card-holdings {
  border-color: rgba(96, 165, 250, 0.18);
}

.fin-card-alloc {
  border-color: rgba(167, 139, 250, 0.22);
}

.fin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  align-items: flex-start;
}

.fin-row-main .fin-card-holdings {
  flex: 1 1 22rem;
  max-width: 100%;
}

.fin-row-main .fin-card-alloc {
  flex: 0 1 16rem;
  width: 16rem;
  max-width: 100%;
}

.fin-row-three .fin-card {
  flex: 1 1 12rem;
  max-width: 20rem;
}

.fin-card {
  padding: 0.85rem 0.9rem !important;
  width: fit-content;
  max-width: 100%;
}

.fin-table-compact {
  width: auto;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.fin-table-compact th,
.fin-table-compact td {
  padding: 0.2rem 0.4rem; /* ~1–2ch feel */
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-align: left;
  vertical-align: middle;
}

.fin-table-compact th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-weight: 600;
}

.fin-table-compact .num,
.fin-table-compact th.num {
  text-align: right;
}

.fin-table-compact .fin-ticker {
  font-weight: 700;
  font-family: var(--mono);
  font-size: 0.78rem;
}

.fin-total-row td {
  font-weight: 700;
  border-bottom: 0;
  padding-top: 0.35rem !important;
}

.fin-section-row td {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-2);
  font-weight: 600;
  padding-top: 0.45rem !important;
  border-bottom: 0;
}

.fin-spacer-row td {
  padding: 0.35rem 0.4rem !important;
  border-bottom: 0;
  line-height: 0.5;
  height: 0.65rem;
}

.fin-pos {
  color: #34d399 !important;
}

.fin-neg {
  color: #f87171 !important;
}

[data-theme="light"] .fin-pos {
  color: #059669 !important;
}

[data-theme="light"] .fin-neg {
  color: #dc2626 !important;
}

.fin-table-scroll {
  overflow-x: auto;
  max-width: 100%;
}

.fin-alloc {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.fin-pie {
  width: 7.5rem;
  height: 7.5rem;
  border-radius: 50%;
  border: 1px solid var(--border);
}

.fin-alloc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  font-size: 0.78rem;
}

.fin-alloc-list li {
  display: grid;
  grid-template-columns: 0.65rem 1fr auto;
  gap: 0.35rem;
  align-items: center;
  padding: 0.15rem 0;
}

.fin-swatch {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 2px;
}

.fin-alloc-name {
  font-weight: 600;
}

.fin-alloc-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.fin-alloc-total {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  width: 100%;
  text-align: right;
}

.fin-meter {
  margin-top: 0.75rem;
  display: flex;
  justify-content: center;
}

/* Vertical thermometer: 8% ceiling at top, 3% basement at bottom */
.fin-meter-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.fin-meter-cap {
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.fin-meter-col .fin-meter-cap:first-child {
  color: var(--accent-2);
}

.fin-meter-col .fin-meter-cap:last-child {
  color: var(--accent);
}

.fin-meter-track {
  height: 5.75rem;
  width: 1.15rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .fin-meter-track {
  background: rgba(0, 0, 0, 0.05);
}

.fin-meter-fill {
  width: 100%;
  background: linear-gradient(to top, #34d399, #60a5fa 55%, #a78bfa);
  min-height: 4%;
  transition: height 0.35s ease;
  border-radius: 999px 999px 0 0;
}

.fin-setup {
  margin-bottom: 0.75rem;
}

.fin-stub {
  max-width: 28rem;
}

@media (max-width: 800px) {
  .fin-row-main .fin-card-alloc {
    width: 100%;
  }

  .fin-row-three .fin-card {
    max-width: 100%;
    flex: 1 1 100%;
  }

  .fin-kpi-value {
    font-size: 1rem;
  }

  .main-fin {
    padding-left: 1.1rem !important;
    padding-right: 1.1rem !important;
  }
}

/* --------------------------------------------------------------------------
   Finances Settings — accordion cockpit
   -------------------------------------------------------------------------- */
.main-settings {
  max-width: 48rem !important;
}

.set-lede {
  margin: 0.35rem 0 0;
  max-width: 36rem;
  font-size: 0.9rem;
  line-height: 1.45;
}

.set-group-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 1.35rem 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.set-group-icon {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 2px;
}

.set-g-dash {
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
}

.set-g-cf {
  background: linear-gradient(135deg, #34d399, #2dd4bf);
}

.set-g-ath {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.set-acc {
  margin-bottom: 0.55rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(16, 22, 32, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

[data-theme="light"] .set-acc {
  background: rgba(255, 255, 255, 0.9);
}

.set-acc-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.95rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.set-acc-head:hover {
  background: rgba(96, 165, 250, 0.06);
}

.set-acc-title {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.set-acc-chevron {
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
  opacity: 0.8;
}

.set-acc.is-open .set-acc-chevron {
  transform: rotate(45deg);
  margin-top: -0.15rem;
}

.set-acc-body {
  display: none;
  padding: 0 0.95rem 0.95rem;
  border-top: 1px solid var(--border);
}

.set-acc.is-open .set-acc-body {
  display: block;
}

.set-hint {
  margin: 0.65rem 0 0.55rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.set-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.set-table {
  width: 100%;
}

.set-table th,
.set-table td {
  padding: 0.28rem 0.4rem;
}

.set-input {
  font: inherit;
  font-size: 0.82rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.45rem;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.set-input-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  max-width: 7.5rem;
  margin-left: auto;
  display: block;
}

.set-input:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

.set-actions {
  width: 1.75rem;
  text-align: center;
}

.btn-icon {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.btn-icon:hover {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.4);
}

.set-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
  align-items: center;
  margin-top: 0.65rem;
}

.set-form-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: flex-end;
  padding: 0.75rem !important;
}

.set-inline-form {
  width: 100%;
  max-width: 100%;
}

.set-ath-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: stretch;
}

.set-ath-card {
  flex: 1 1 14rem;
  max-width: 22rem;
  padding: 0.85rem !important;
}

.set-ath-danger {
  border-color: rgba(248, 113, 113, 0.35) !important;
}

.set-subhead {
  margin: 0 0 0.45rem;
  font-size: 0.88rem;
}

.set-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.65rem;
}

.set-chip {
  font-size: 0.72rem;
  font-family: var(--mono);
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.35);
  background: rgba(96, 165, 250, 0.1);
  color: var(--accent-2);
}

.set-check {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.55rem 0 0.65rem;
  cursor: pointer;
}

.set-check input {
  margin-top: 0.15rem;
}

.btn-danger {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #fca5a5;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.25);
}

.bc-status.is-ok {
  color: #34d399;
}

.set-empty td {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 0.75rem !important;
}

.set-footer-note {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.8rem;
}

@media (max-width: 800px) {
  .set-ath-card {
    max-width: 100%;
  }

  .set-input-num {
    max-width: 100%;
  }
}

/* --------------------------------------------------------------------------
   90-Day Cash Flow
   -------------------------------------------------------------------------- */
.main-cf {
  max-width: 70rem !important;
}

.cf-kpis {
  margin-bottom: 0.5rem;
}

.cf-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.cf-status-ok {
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.35);
}

.cf-status-warn {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.4);
}

.cf-legend {
  font-size: 0.8rem;
  margin: 0 0 0.85rem;
  line-height: 1.45;
}

.cf-swatch {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 3px;
  vertical-align: -1px;
  margin: 0 0.15rem;
}

.cf-swatch-caution {
  background: #fbbf24;
}

.cf-swatch-safe {
  background: #34d399;
}

.cf-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-start;
}

.cf-card-balances {
  flex: 1 1 22rem;
  max-width: 100%;
  width: fit-content;
}

.cf-card-tx {
  flex: 1 1 16rem;
  max-width: 26rem;
}

.cf-balance-table {
  width: auto;
}

.cf-balance-table th,
.cf-balance-table td {
  padding: 0.15rem 0.35rem;
  font-size: 0.78rem;
}

.cf-date {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cf-bal {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.cf-col-sep {
  border-right: 2px solid rgba(96, 165, 250, 0.45) !important;
  padding-right: 0.5rem !important;
}

.cf-bal--caution {
  background: rgba(251, 191, 36, 0.22);
  color: #fbbf24;
  border-radius: 4px;
}

.cf-bal--safe {
  background: rgba(52, 211, 153, 0.18);
  color: #6ee7b7;
  border-radius: 4px;
}

[data-theme="light"] .cf-bal--caution {
  background: #fef3c7;
  color: #b45309;
}

[data-theme="light"] .cf-bal--safe {
  background: #d1fae5;
  color: #047857;
}

.cf-start-input {
  max-width: 5.5rem !important;
  font-weight: 700 !important;
  font-size: 0.78rem !important;
  padding: 0.12rem 0.25rem !important;
}

.cf-bal--caution .cf-start-input {
  background: rgba(251, 191, 36, 0.15);
  color: inherit;
  border-color: rgba(251, 191, 36, 0.4);
}

.cf-bal--safe .cf-start-input {
  background: rgba(52, 211, 153, 0.12);
  color: inherit;
  border-color: rgba(52, 211, 153, 0.4);
}

.cf-tx-onetime {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fbbf24;
  vertical-align: baseline;
}

[data-theme="light"] .cf-tx-onetime {
  color: #b45309;
}

.cf-note {
  color: var(--muted);
  font-size: 0.75rem;
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {
  .cf-card-tx {
    max-width: 100%;
  }
}

/* --------------------------------------------------------------------------
   All-Time Highs — ledger table + Dashboard ATH flag
   -------------------------------------------------------------------------- */
.main-ath {
  max-width: min(96rem, 100%) !important;
}

.ath-blurb {
  font-size: 0.85rem;
  margin: 0 0 1rem;
  max-width: 42rem;
  line-height: 1.45;
}

.ath-ledger-card {
  width: 100%;
  max-width: 100%;
  padding: 0.5rem !important;
  overflow: hidden;
}

.ath-table-scroll {
  overflow-x: auto;
  max-width: 100%;
}

.ath-ledger-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.ath-ledger-table th,
.ath-ledger-table td {
  padding: 0.28rem 0.4rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: top;
}

.ath-entity-head {
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  border-right: 1px solid var(--border);
  min-width: 6.5rem;
  padding: 0.45rem 0.35rem !important;
}

[data-theme="light"] .ath-entity-head {
  background: rgba(15, 23, 42, 0.03);
}

.ath-entity-name {
  font-weight: 700;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.ath-entity-sub {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.35;
}

.ath-h2 .ath-subh {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  background: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .ath-h2 .ath-subh {
  background: rgba(0, 0, 0, 0.04);
}

.ath-subh-sep {
  border-right: 1px solid var(--border) !important;
}

.ath-hist-date {
  color: var(--muted);
  text-align: center;
  font-size: 0.72rem;
}

.ath-hist-val {
  text-align: right;
  font-weight: 500;
}

.ath-hist-top {
  font-weight: 700;
  color: var(--text);
}

.ath-hist-empty {
  border-right: 1px solid var(--border);
  min-width: 2.5rem;
}

/* Dashboard Key Holdings ATH column */
.ath-col {
  text-align: center !important;
  min-width: 2.4rem;
  padding-left: 0.35rem !important;
  padding-right: 0.35rem !important;
}

.ath-flag {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  font-family: var(--mono);
}

/* Day 0: brand-new ATH — bold + bright lime/cyan */
.ath-flag--0 {
  font-weight: 800;
  color: #39ff14;
  text-shadow: 0 0 10px rgba(57, 255, 20, 0.55);
}

/* Days 1–5: step down brightness / weight */
.ath-flag--1 {
  font-weight: 600;
  color: #86efac;
}

.ath-flag--2 {
  font-weight: 500;
  color: #4ade80;
  opacity: 0.9;
}

.ath-flag--3 {
  font-weight: 500;
  color: #34d399;
  opacity: 0.75;
}

.ath-flag--4 {
  font-weight: 400;
  color: #6ee7b7;
  opacity: 0.55;
}

.ath-flag--5 {
  font-weight: 400;
  color: #a7f3d0;
  opacity: 0.4;
}

[data-theme="light"] .ath-flag--0 {
  color: #15803d;
  text-shadow: none;
}

[data-theme="light"] .ath-flag--1 {
  color: #16a34a;
}

[data-theme="light"] .ath-flag--2 {
  color: #22c55e;
}

[data-theme="light"] .ath-flag--3 {
  color: #4ade80;
  opacity: 0.85;
}

[data-theme="light"] .ath-flag--4 {
  color: #86efac;
  opacity: 0.75;
}

[data-theme="light"] .ath-flag--5 {
  color: #bbf7d0;
  opacity: 0.7;
}

/* --------------------------------------------------------------------------
   Net Worth
   -------------------------------------------------------------------------- */
.main-nw {
  max-width: 64rem !important;
}

.nw-hero-kpi {
  min-width: 9rem;
}

.nw-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}

.nw-card-hist {
  flex: 1 1 18rem;
  max-width: 28rem;
}

.nw-card-chart {
  flex: 1 1 16rem;
  max-width: 22rem;
  width: 100%;
}

.nw-card-calc {
  flex: 1 1 18rem;
  max-width: 28rem;
}

.nw-card-dist {
  flex: 0 1 15rem;
  width: 15rem;
  max-width: 100%;
}

.nw-live-row td {
  color: #60a5fa !important;
  font-weight: 600;
}

[data-theme="light"] .nw-live-row td {
  color: #2563eb !important;
}

.nw-total-row td {
  font-weight: 800;
  border-top: 2px solid var(--border);
  padding-top: 0.45rem !important;
  font-size: 0.95rem;
}

.nw-live-swatch {
  color: #60a5fa;
  font-weight: 700;
}

.nw-chart-svg {
  width: 100%;
  height: auto;
  display: block;
  margin-top: 0.25rem;
}

.nw-value-line {
  stroke: #60a5fa;
  stroke-width: 2.25;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.nw-trend-line {
  stroke: #a78bfa;
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
  opacity: 0.85;
}

.nw-dot {
  fill: #60a5fa;
}

.nw-dot-live {
  fill: #34d399;
  stroke: #6ee7b7;
  stroke-width: 1.5;
}

.nw-axis {
  fill: var(--muted);
  font-size: 9px;
  font-family: var(--font);
}

.nw-chart-legend {
  font-size: 0.72rem;
  margin: 0 0 0.25rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.nw-leg {
  display: inline-block;
  width: 1rem;
  height: 3px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 0.25rem;
}

.nw-leg-val {
  background: #60a5fa;
}

.nw-leg-trend {
  background: #a78bfa;
  height: 2px;
  background: repeating-linear-gradient(
    90deg,
    #a78bfa 0 4px,
    transparent 4px 7px
  );
}

.nw-pie {
  width: 8rem;
  height: 8rem;
}

@media (max-width: 800px) {
  .nw-card-hist,
  .nw-card-chart,
  .nw-card-calc,
  .nw-card-dist {
    max-width: 100%;
    width: 100%;
    flex: 1 1 100%;
  }
}

/* --------------------------------------------------------------------------
   Income
   -------------------------------------------------------------------------- */
.main-inc {
  max-width: 56rem !important;
}

.inc-table-card {
  width: fit-content;
  max-width: 100%;
  margin-bottom: 1rem;
}

.inc-table th,
.inc-table td {
  padding: 0.28rem 0.45rem;
}

.inc-subtotal td {
  font-weight: 700;
  background: rgba(96, 165, 250, 0.08);
}

.inc-total td {
  font-weight: 800;
  background: rgba(52, 211, 153, 0.12);
  border-top: 2px solid rgba(52, 211, 153, 0.35);
  border-bottom: 2px solid rgba(52, 211, 153, 0.25);
}

.inc-surv-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: stretch;
}

.inc-surv-card {
  flex: 1 1 14rem;
  max-width: 22rem;
  padding: 0.9rem !important;
}

.inc-surv-jen {
  border-color: rgba(167, 139, 250, 0.35) !important;
}

.inc-surv-bill {
  border-color: rgba(96, 165, 250, 0.35) !important;
}

.inc-surv-title {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
}

.inc-surv-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.inc-surv-gross {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  color: #60a5fa;
  font-variant-numeric: tabular-nums;
}

.inc-surv-net {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  color: #34d399;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 800px) {
  .inc-surv-card {
    max-width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Projections
   -------------------------------------------------------------------------- */
.main-proj {
  max-width: 64rem !important;
}

.proj-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.75rem;
  align-items: center;
}

.proj-ctrl-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.proj-ctrl-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-right: 0.25rem;
}

.proj-chip.is-active {
  border-color: var(--accent-2);
  color: var(--accent-2);
  background: rgba(96, 165, 250, 0.12);
}

.proj-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}

.proj-card-chart {
  flex: 1 1 100%;
  max-width: 100%;
  width: 100%;
  margin-bottom: 0.85rem;
}

.proj-card-chart-wide {
  max-width: 100%;
}

.proj-row-detail {
  align-items: flex-start;
}

.proj-card-mu {
  flex: 0 1 14rem;
  width: 14rem;
  max-width: 100%;
}

.proj-card-years {
  flex: 1 1 22rem;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 0;
}

.proj-chart-svg {
  width: 100%;
  min-height: 22rem;
  height: auto;
  display: block;
}

.proj-chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin: 0 0 0.35rem;
}
.proj-chart-toolbar .proj-legend {
  margin: 0;
}
.proj-scale-toggle {
  display: inline-flex;
  gap: 0.25rem;
}
.proj-scale-toggle .proj-chip {
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
}
.proj-grid {
  stroke: rgba(148, 163, 184, 0.18);
  stroke-width: 1;
}
[data-theme="light"] .proj-grid {
  stroke: rgba(100, 116, 139, 0.2);
}
.proj-axis-line {
  stroke: rgba(148, 163, 184, 0.4);
  stroke-width: 1;
}
.proj-y-axis {
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}
.proj-scale-note {
  font-size: 8px;
  opacity: 0.7;
}


.proj-line-pess {
  stroke: #f87171;
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
  opacity: 0.85;
}

.proj-line-base {
  stroke: #60a5fa;
  stroke-width: 2.5;
}

.proj-line-opt {
  stroke: #34d399;
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
  opacity: 0.85;
}

.proj-line-sample {
  stroke: #fbbf24;
  stroke-width: 2;
  opacity: 0.95;
}

.proj-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  font-size: 0.72rem;
  margin: 0 0 0.35rem;
}

.proj-leg {
  display: inline-block;
  width: 1.1rem;
  height: 3px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 0.2rem;
}

.proj-leg-pess {
  background: #f87171;
}

.proj-leg-base {
  background: #60a5fa;
  height: 3px;
}

.proj-leg-opt {
  background: #34d399;
}

.proj-leg-sample {
  background: #fbbf24;
}

.proj-ends {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-top: 0.65rem;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.proj-ends strong {
  display: block;
  font-size: 0.95rem;
}

@media (max-width: 800px) {
  .proj-card-chart,
  .proj-card-mu {
    max-width: 100%;
    width: 100%;
    flex: 1 1 100%;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   App shell: sidebar + main
   -------------------------------------------------------------------------- */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  width: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.35rem 1rem 1.15rem;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  transition: transform var(--transition), background-color var(--transition);
}

.sidebar-brand {
  display: block;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text);
  letter-spacing: -0.02em;
  text-decoration: none;
  padding: 0.35rem 0.65rem 1.15rem;
}

.sidebar-brand:hover {
  text-decoration: none;
  color: var(--text);
}

.logo-dot {
  color: var(--accent);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  overflow-y: auto;
}

.sidebar-nav a {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color var(--transition), color var(--transition);
}

.sidebar-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none;
}

[data-theme="light"] .sidebar-nav a:hover {
  background: rgba(0, 0, 0, 0.04);
}

.sidebar-nav a.is-active {
  color: var(--accent);
  background: var(--accent-soft);
}

/* Nested nav (Book Club, Finances, …) */
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition);
}

.nav-group-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .nav-group-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
}

.nav-group-toggle::after {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  opacity: 0.7;
  transition: transform var(--transition);
}

.nav-group-toggle.is-open::after {
  transform: rotate(45deg);
  margin-top: -0.15rem;
}

.nav-sub {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.1rem 0 0.35rem 0.55rem;
  margin-left: 0.35rem;
  border-left: 1px solid var(--border);
}

/* Author CSS display:flex must not override the HTML hidden attribute */
.nav-sub[hidden],
.nav-group:not(.is-expanded) > .nav-sub {
  display: none !important;
}

.nav-group.is-expanded > .nav-sub {
  display: flex !important;
}

.nav-sub a {
  font-size: 0.88rem !important;
  padding: 0.4rem 0.65rem !important;
}

.mono {
  font-family: var(--mono);
  font-size: 0.9em;
}

/* Wider main for Book Club table/chat */
.main-wide {
  max-width: 56rem !important;
}

.footer-wide {
  max-width: 56rem !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition),
    color var(--transition), transform 0.12s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

.btn-primary:hover {
  border-color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border);
}

/* Book Club UI */
.bc-status {
  min-height: 1.25rem;
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.bc-status.is-error {
  color: #f87171;
}

[data-theme="light"] .bc-status.is-error {
  color: #b91c1c;
}

.bc-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.bc-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 7.5rem;
}

.bc-field.grow {
  flex: 1;
  min-width: 12rem;
}

.bc-field input,
.bc-field select,
.bc-field textarea,
.bc-composer textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
}

.bc-field textarea,
.bc-composer textarea {
  resize: vertical;
  min-height: 2.75rem;
}

.bc-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.bc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.bc-table th,
.bc-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.bc-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  background: rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}

[data-theme="light"] .bc-table th {
  background: rgba(0, 0, 0, 0.02);
}

.bc-table tr:last-child td {
  border-bottom: 0;
}

.bc-table tbody tr:hover td {
  background: var(--accent-soft);
}

.bc-linkish {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--accent-2);
  cursor: pointer;
  text-align: left;
}

.bc-linkish:hover {
  text-decoration: underline;
}

.bc-pill {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.7rem;
  color: var(--muted);
  border: 1px solid var(--border);
}

.bc-empty {
  color: var(--muted);
  text-align: center;
  padding: 1.5rem !important;
}

/* Chat — Marian left, user right */
.bc-chat {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 16rem;
  max-height: 28rem;
  overflow-y: auto;
  padding: 1rem;
  margin: 0.75rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .bc-chat {
  background: rgba(0, 0, 0, 0.03);
}

.bc-chat-empty {
  margin: auto;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

.bc-bubble {
  max-width: min(85%, 28rem);
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
  line-height: 1.5;
}

.bc-bubble-who {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
  opacity: 0.85;
}

.bc-bubble-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.bc-bubble--marian {
  align-self: flex-start;
  background: var(--accent-soft);
  border: 1px solid rgba(110, 231, 183, 0.25);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.bc-bubble--marian .bc-bubble-who {
  color: var(--accent);
}

.bc-bubble--user {
  align-self: flex-end;
  background: rgba(96, 165, 250, 0.14);
  border: 1px solid rgba(96, 165, 250, 0.28);
  color: var(--text);
  border-bottom-right-radius: 4px;
}

.bc-bubble--user .bc-bubble-who {
  color: var(--accent-2);
  text-align: right;
}

.bc-composer {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.bc-composer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.bc-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.bc-form-inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
}

.bc-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.65rem;
}

.bc-setup {
  margin-top: 1.25rem;
}

.bc-setup code {
  font-family: var(--mono);
  font-size: 0.85em;
}

.bc-finalize {
  margin-top: 1.25rem;
  border-color: rgba(110, 231, 183, 0.35);
}

.bc-drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.55);
}

.bc-drawer[hidden] {
  display: none !important;
}

.bc-drawer-panel {
  width: min(36rem, 100%);
  max-height: min(90vh, 40rem);
  overflow: auto;
  box-shadow: var(--shadow);
}

.bc-drawer-panel .section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  margin-top: 0.75rem;
}

.sidebar-footer .hint {
  font-size: 0.7rem;
  color: var(--muted);
  font-family: var(--mono);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition),
    transform 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle:active {
  transform: scale(0.94);
}

.theme-icon {
  display: none;
  grid-area: 1 / 1;
}

:root:not([data-theme="light"]) .theme-icon--sun,
[data-theme="light"] .theme-icon--moon {
  display: block;
}

.menu-toggle {
  display: none;
  position: fixed;
  top: 0.9rem;
  left: 0.9rem;
  z-index: 50;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
}

.menu-toggle span {
  display: block;
  width: 1.1rem;
  height: 2px;
  margin: 0.22rem auto;
  background: currentColor;
  border-radius: 2px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.45);
}

.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: 2.5rem 1.75rem 3rem;
}

.footer {
  max-width: 48rem;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.75rem 2.25rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   Typography & sections
   -------------------------------------------------------------------------- */
.hero {
  padding: 0.5rem 0 1.75rem;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.hero h1,
.page-title {
  margin: 0 0 0.85rem;
  font-size: clamp(2.1rem, 5vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.accent {
  color: var(--accent);
}

.lede {
  max-width: 36rem;
  margin: 0;
  font-size: 1.08rem;
  color: var(--muted);
}

.section {
  margin-top: 0.5rem;
}

.section-head {
  margin-bottom: 1rem;
}

.section h2,
.card h2 {
  margin: 0 0 0.55rem;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.muted {
  margin: 0;
  color: var(--muted);
}

.card {
  padding: 1.35rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%),
    var(--bg-elevated);
  box-shadow: var(--shadow);
}

.card + .card {
  margin-top: 1rem;
}

.card p {
  margin: 0 0 0.85rem;
  color: var(--muted);
}

.card p:last-child {
  margin-bottom: 0;
}

.meta-list {
  list-style: none;
  padding: 0;
  margin: 1.1rem 0 0;
}

.meta-list li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
}

.meta-list span {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
}

.stub-card {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.stub-card h1 {
  margin: 0 0 0.75rem;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

.stub-card p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

/* --------------------------------------------------------------------------
   Family list (Home)
   -------------------------------------------------------------------------- */
.family-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.family-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.85rem;
  padding: 0.7rem 0.15rem;
  border-bottom: 1px solid var(--border);
}

.family-item:last-child {
  border-bottom: none;
}

.family-name {
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  color: var(--accent-2);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}

.family-name:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.family-name:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.family-hello {
  font-size: 0.9rem;
  color: var(--muted);
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.25s ease, transform 0.25s ease, color var(--transition);
  min-height: 1.3em;
}

.family-hello.is-visible {
  opacity: 1;
  transform: translateY(0);
  color: var(--accent);
}

.family-status {
  margin: 0.85rem 0 0;
  min-height: 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.family-loading {
  color: var(--muted);
  font-size: 0.95rem;
  padding: 0.5rem 0;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 800px) {
  .menu-toggle {
    display: block;
  }

  .sidebar {
    transform: translateX(-105%);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-backdrop.is-visible {
    display: block;
  }

  .content {
    margin-left: 0;
  }

  main {
    padding: 4.25rem 1.25rem 2.5rem;
  }

  .footer {
    padding: 0 1.25rem 2rem;
  }

  .meta-list li {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* —— Stock Logger —— */
.stk-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 0.85rem;
  margin-bottom: 0.65rem;
}
@media (min-width: 720px) {
  .stk-form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.stk-form .bc-field span {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.72;
  margin-bottom: 0.2rem;
}
.stk-total {
  margin: 0.35rem 0 0.5rem;
  font-size: 0.95rem;
}
.stk-total strong {
  font-variant-numeric: tabular-nums;
}
.stk-edit-btn {
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
  min-height: 0;
}
.stk-row-editing {
  outline: 1px solid color-mix(in srgb, var(--accent, #3b82f6) 45%, transparent);
  background: color-mix(in srgb, var(--accent, #3b82f6) 8%, transparent);
}
.page-finances-stocks .stk-form-card {
  min-width: 0;
}

/* —— Bitcoin Logger —— */
.btc-metrics-list {
  margin: 0;
  padding-left: 1.1rem;
  line-height: 1.55;
  font-size: 0.92rem;
}
.btc-metrics-list li {
  margin: 0.25rem 0;
}
.page-finances-bitcoin .fin-kpis {
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
}


/* —— Home landing VD refresh —— */
body.page-home .home-bg {
  /* Lighter wash so muted canvas + bright accent blooms stay visible */
  background:
    linear-gradient(
      125deg,
      rgba(10, 12, 20, 0.55) 0%,
      rgba(16, 14, 28, 0.42) 40%,
      rgba(12, 18, 28, 0.5) 100%
    ),
    radial-gradient(900px 500px at 12% 8%, rgba(244, 114, 182, 0.12), transparent 55%),
    radial-gradient(800px 480px at 88% 20%, rgba(45, 212, 191, 0.1), transparent 50%),
    radial-gradient(700px 400px at 50% 100%, rgba(251, 191, 36, 0.08), transparent 55%),
    url("images/home/home-bg-v2.jpg") center / cover no-repeat fixed;
}
[data-theme="light"] body.page-home .home-bg {
  background:
    linear-gradient(
      125deg,
      rgba(252, 250, 255, 0.62) 0%,
      rgba(248, 246, 252, 0.55) 45%,
      rgba(244, 248, 252, 0.58) 100%
    ),
    radial-gradient(900px 500px at 12% 8%, rgba(244, 114, 182, 0.08), transparent 55%),
    radial-gradient(800px 480px at 88% 20%, rgba(20, 184, 166, 0.08), transparent 50%),
    url("images/home/home-bg-v2.jpg") center / cover no-repeat fixed;
}
body.page-home .sidebar {
  background: rgba(12, 12, 20, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
[data-theme="light"] body.page-home .sidebar {
  background: rgba(255, 255, 255, 0.86);
}

/* —— Home landing (v1) —— */
.page-home .home-main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.5rem 0 2rem;
}
.home-hero {
  margin-bottom: 1.5rem;
}
.home-title {
  font-family: "Fraunces", "DM Sans", Georgia, serif;
  font-weight: 600;
  font-size: clamp(2rem, 4vw, 2.75rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0.25rem 0 0.75rem;
}
.home-lede {
  max-width: 38rem;
  font-size: 1.05rem;
}
.home-bento {
  display: grid;
  gap: 1.15rem;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .home-bento {
    grid-template-columns: 1.35fr 1fr;
    grid-template-areas:
      "photo where"
      "photo sunday"
      "pins pins"
      "edit edit";
  }
  .home-photo-stage { grid-area: photo; }
  .home-where { grid-area: where; }
  .home-sunday { grid-area: sunday; }
  .home-pins-row { grid-area: pins; }
  .home-edit-hint { grid-area: edit; }
}
@media (min-width: 1000px) {
  .home-bento {
    grid-template-columns: 1.4fr 0.95fr 0.95fr;
    grid-template-areas:
      "photo photo where"
      "photo photo sunday"
      "pins pins pins"
      "edit edit edit";
  }
}

/* Equal-width Book Nook + Golf Pin */
.home-pins-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.15rem;
  width: 100%;
}
@media (min-width: 720px) {
  .home-pins-row {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }
}
.home-edit-hint {
  margin: 0;
  font-size: 0.85rem;
  text-align: right;
}
.home-edit-hint a {
  color: inherit;
  opacity: 0.75;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.home-edit-hint a:hover {
  opacity: 1;
}

/* Framed photo — ornate Imagine frame */
.home-photo-stage {
  display: flex;
  align-items: stretch;
}
.home-frame {
  margin: 0;
  width: 100%;
}
.home-frame--ornate {
  background: transparent;
  border-radius: 0;
  padding: 0;
  /* No wall/mat around the frame — frame is the outer edge */
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.38);
  overflow: hidden;
}
.home-frame-shell {
  position: relative;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  /* Frame fills the box; padding = carved border thickness only */
  padding: 12% 11.5% 13% 11.5%;
  border-radius: 0;
  min-height: 20rem;
  box-shadow: none;
}
.home-frame-mat {
  background: #0f0e0c;
  padding: 0.28rem;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 230, 180, 0.12) inset;
}
[data-theme="light"] .home-frame-mat {
  background: #1a1612;
}
.home-frame-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  max-height: min(56vh, 32rem);
  object-fit: cover;
  border-radius: 2px;
  background: #1a1510;
}
.home-frame-caption {
  margin: 0.55rem 0.25rem 0.15rem;
  font-size: 0.82rem;
  color: rgba(255, 245, 230, 0.82);
  text-align: center;
  font-style: italic;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}
[data-theme="light"] .home-frame-caption {
  color: rgba(50, 40, 30, 0.78);
  text-shadow: none;
}
.home-frame-caption {
  margin: 0.45rem 0.15rem 0.1rem;
  font-size: 0.82rem;
  color: rgba(255, 245, 230, 0.78);
  text-align: center;
  font-style: italic;
}
[data-theme="light"] .home-frame-caption {
  color: rgba(40, 30, 20, 0.72);
}

/* Shared cards */
.home-card {
  background: var(--card, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border, rgba(127, 127, 127, 0.22));
  border-radius: 12px;
  padding: 1rem 1.15rem 1.15rem;
}
.home-card-heading {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}
.home-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.65;
}

/* Map — real state outline + star pin */
.home-map-wrap {
  position: relative;
  margin: 0.35rem 0 0.65rem;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(160deg, #1a2a36 0%, #243a2e 100%);
  border: 1px solid rgba(127, 127, 127, 0.18);
  aspect-ratio: 959 / 593;
}
[data-theme="light"] .home-map-wrap {
  background: linear-gradient(160deg, #d8e8f0 0%, #e4efdf 100%);
}
.home-map-wrap {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.home-map-img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 12rem;
  vertical-align: middle;
  opacity: 1;
}
[data-theme="light"] .home-map-img {
  /* keep greens readable on light bg */
  filter: none;
}
[data-theme="light"] .home-map-wrap {
  background-color: #e8f0ea;
}
.home-map-star {
  position: absolute;
  width: 1.75rem;
  height: 1.75rem;
  margin-left: -0.875rem;
  margin-top: -0.875rem;
  color: #f5c542;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
  pointer-events: none;
  z-index: 2;
}
.home-map-star svg {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}
.home-map-pulse {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2.5rem;
  height: 2.5rem;
  margin: -1.25rem 0 0 -1.25rem;
  border-radius: 50%;
  background: rgba(245, 197, 66, 0.35);
  animation: home-pulse 2.2s ease-out infinite;
  z-index: 0;
}
@keyframes home-pulse {
  0% {
    transform: scale(0.45);
    opacity: 0.55;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}
.home-where-label {
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0 0 0.2rem;
}
.home-where-note {
  margin: 0;
  font-size: 0.9rem;
}

/* Sunday */
.home-sunday-date {
  margin: 0 0 0.55rem;
  font-size: 0.85rem;
}
.home-sunday-excerpt {
  margin: 0 0 1rem;
  line-height: 1.55;
  font-size: 0.95rem;
}
.home-sunday-link {
  display: inline-flex;
}

/* Book Nook / Golf Pin — banner + 3-sided border */
.home-pin {
  display: flex;
  flex-direction: column;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
  background: var(--card, rgba(255, 255, 255, 0.03));
  min-height: 100%;
}
.home-pin-banner {
  position: relative;
  min-height: 5.5rem;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
  padding: 0.85rem 1.1rem;
}
.home-pin-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.55) 0%,
    rgba(0, 0, 0, 0.15) 55%,
    rgba(0, 0, 0, 0.05) 100%
  );
}
.home-pin-label {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}
.home-pin-body {
  padding: 1rem 1.15rem 1.2rem;
  flex: 1;
  border-left: 3px solid;
  border-right: 3px solid;
  border-bottom: 3px solid;
  border-top: none;
  border-radius: 0 0 10px 10px;
}
.home-pin--book .home-pin-body {
  border-color: #8d6e63;
  background: color-mix(in srgb, #8d6e63 8%, transparent);
}
.home-pin--golf .home-pin-body {
  border-color: #4a8f3c;
  background: color-mix(in srgb, #4a8f3c 8%, transparent);
}
.home-pin-meta {
  margin: 0 0 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  opacity: 0.7;
}
.home-pin-title {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
}
.home-pin-blurb {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  line-height: 1.55;
  opacity: 0.9;
}
.home-pin-link {
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}
.home-pin-link:hover {
  text-decoration: underline;
}

/* Sunday full page */
.page-sunday .sunday-article {
  max-width: 40rem;
  margin: 0 auto;
}
.sunday-article-body {
  line-height: 1.65;
  font-size: 1.02rem;
}
.sunday-article-body p {
  margin: 0 0 1rem;
}


/* —— Assistants hub (Visual Designer) —— */
body.page-assistants .as-bg {
  background:
    linear-gradient(
      118deg,
      rgba(10, 8, 18, 0.92) 0%,
      rgba(14, 12, 28, 0.78) 40%,
      rgba(12, 18, 32, 0.62) 100%
    ),
    radial-gradient(920px 520px at 8% -8%, rgba(167, 139, 250, 0.22), transparent 55%),
    radial-gradient(780px 460px at 92% 4%, rgba(251, 191, 36, 0.12), transparent 52%),
    radial-gradient(640px 400px at 50% 100%, rgba(96, 165, 250, 0.14), transparent 55%),
    radial-gradient(500px 300px at 70% 40%, rgba(244, 114, 182, 0.08), transparent 50%),
    #0a0812;
}

[data-theme="light"] body.page-assistants .as-bg {
  background:
    linear-gradient(
      118deg,
      rgba(248, 246, 252, 0.94) 0%,
      rgba(244, 246, 250, 0.88) 45%,
      rgba(240, 245, 252, 0.8) 100%
    ),
    radial-gradient(920px 520px at 8% -8%, rgba(124, 58, 237, 0.1), transparent 55%),
    radial-gradient(780px 460px at 92% 4%, rgba(217, 119, 6, 0.08), transparent 52%),
    radial-gradient(640px 400px at 50% 100%, rgba(37, 99, 235, 0.08), transparent 55%),
    #f7f5fc;
}

body.page-assistants .sidebar {
  background: rgba(12, 10, 22, 0.84);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right-color: rgba(167, 139, 250, 0.12);
}

[data-theme="light"] body.page-assistants .sidebar {
  background: rgba(248, 246, 252, 0.9);
  border-right-color: rgba(124, 58, 237, 0.1);
}

body.page-assistants .card,
body.page-assistants .as-chat-card {
  background: rgba(18, 16, 32, 0.76);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-color: rgba(167, 139, 250, 0.16);
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(251, 191, 36, 0.04);
}

[data-theme="light"] body.page-assistants .card,
[data-theme="light"] body.page-assistants .as-chat-card {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(124, 58, 237, 0.12);
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

body.page-assistants .as-main {
  max-width: 52rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: calc(100vh - 6rem);
  position: relative;
  z-index: 1;
}

body.page-assistants .as-hero {
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

body.page-assistants .as-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: rgba(196, 181, 253, 0.95);
  letter-spacing: 0.06em;
}

[data-theme="light"] body.page-assistants .as-eyebrow {
  color: #6d28d9;
}

body.page-assistants .as-eyebrow-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #c4b5fd, #fbbf24);
  box-shadow: 0 0 12px rgba(167, 139, 250, 0.7);
}

body.page-assistants .as-title {
  margin: 0.2rem 0 0.45rem;
  font-family: "Fraunces", "DM Sans", Georgia, serif;
  font-weight: 600;
  font-size: clamp(2rem, 4.2vw, 2.85rem);
  letter-spacing: -0.02em;
  line-height: 1.12;
  background: linear-gradient(
    105deg,
    #f5f3ff 0%,
    #c4b5fd 38%,
    #93c5fd 68%,
    #fcd34d 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 18px rgba(0, 0, 0, 0.28));
}

[data-theme="light"] body.page-assistants .as-title {
  background: linear-gradient(
    105deg,
    #1e1b4b 0%,
    #6d28d9 40%,
    #2563eb 72%,
    #b45309 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: none;
}

body.page-assistants .as-lede {
  max-width: 36rem;
  margin: 0 0 0.55rem;
  font-size: 1.02rem;
  line-height: 1.55;
  color: rgba(226, 232, 240, 0.9);
}

[data-theme="light"] body.page-assistants .as-lede {
  color: #334155;
}

body.page-assistants .as-sub {
  margin: 0;
  font-size: 0.95rem;
}

body.page-assistants .as-hero-side {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.55rem;
  padding-bottom: 3.1rem; /* room for invisible lock hit under pill */
}

body.page-assistants .as-active-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

body.page-assistants .as-chip {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(196, 181, 253, 0.35);
  background: rgba(167, 139, 250, 0.12);
  backdrop-filter: blur(8px);
}

body.page-assistants .as-chip--primary {
  background: color-mix(in srgb, #8b5cf6 28%, transparent);
  border-color: rgba(167, 139, 250, 0.65);
  color: #ede9fe;
}

[data-theme="light"] body.page-assistants .as-chip--primary {
  color: #4c1d95;
  background: rgba(139, 92, 246, 0.12);
}

body.page-assistants .as-chip--guest {
  background: color-mix(in srgb, #f59e0b 20%, transparent);
  border-color: rgba(251, 191, 36, 0.5);
}

body.page-assistants .as-model-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: rgba(252, 211, 77, 0.95);
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
}

[data-theme="light"] body.page-assistants .as-model-pill {
  color: #92400e;
  background: rgba(251, 191, 36, 0.12);
}

body.page-assistants .as-model-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.8);
}


/* Lock indicator inside model pill (session unlock state) */
body.page-assistants .as-lock-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.2rem;
  vertical-align: -0.12em;
  line-height: 0;
  transition: color 0.15s ease, transform 0.15s ease;
}
body.page-assistants .as-lock-badge.is-locked {
  color: rgba(252, 211, 77, 0.95);
}
body.page-assistants .as-lock-badge.is-unlocked {
  color: #34d399;
  transform: scale(1.08);
}
body.page-assistants .as-lock-badge .as-lock-svg {
  display: none;
}
body.page-assistants .as-lock-badge.is-locked .as-lock-svg--locked {
  display: block;
}
body.page-assistants .as-lock-badge.is-unlocked .as-lock-svg--unlocked {
  display: block;
}
body.page-assistants .as-model-pill.is-unlocked {
  border-color: rgba(52, 211, 153, 0.55);
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.2);
}
[data-theme="light"] body.page-assistants .as-lock-badge.is-locked {
  color: #b45309;
}
[data-theme="light"] body.page-assistants .as-lock-badge.is-unlocked {
  color: #059669;
}
body.page-assistants .as-compose .btn-ghost {
  min-width: 4.5rem;
}


body.page-assistants .as-chat-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 28rem;
  padding: 0;
  overflow: hidden;
}

body.page-assistants .as-chat {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-height: 22rem;
  max-height: min(62vh, 36rem);
  background: rgba(0, 0, 0, 0.28);
  border-bottom: 1px solid rgba(167, 139, 250, 0.1);
}

[data-theme="light"] body.page-assistants .as-chat {
  background: rgba(248, 250, 252, 0.65);
}

body.page-assistants .as-chat-empty {
  margin: 2.2rem auto;
  text-align: center;
  opacity: 0.75;
  max-width: 24rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

body.page-assistants .as-bubble {
  max-width: min(92%, 34rem);
  padding: 0.6rem 0.85rem 0.7rem;
  border-radius: 14px;
  line-height: 1.5;
  font-size: 0.95rem;
  backdrop-filter: blur(6px);
}

body.page-assistants .as-bubble-who {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 0.22rem;
}

body.page-assistants .as-bubble--user {
  align-self: flex-end;
  background: rgba(96, 165, 250, 0.16);
  border: 1px solid rgba(96, 165, 250, 0.32);
  border-bottom-right-radius: 4px;
}

body.page-assistants .as-bubble--user .as-bubble-who {
  color: #93c5fd;
  text-align: right;
}

[data-theme="light"] body.page-assistants .as-bubble--user .as-bubble-who {
  color: #1d4ed8;
}

body.page-assistants .as-bubble--primary {
  align-self: flex-start;
  background: rgba(139, 92, 246, 0.18);
  border: 1px solid rgba(167, 139, 250, 0.38);
  border-bottom-left-radius: 4px;
}

body.page-assistants .as-bubble--primary .as-bubble-who {
  color: #c4b5fd;
}

[data-theme="light"] body.page-assistants .as-bubble--primary .as-bubble-who {
  color: #6d28d9;
}

body.page-assistants .as-bubble--guest {
  align-self: center;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
}

body.page-assistants .as-bubble--guest-a {
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(251, 191, 36, 0.4);
}
body.page-assistants .as-bubble--guest-a .as-bubble-who { color: #fcd34d; }

body.page-assistants .as-bubble--guest-b {
  background: rgba(168, 85, 247, 0.16);
  border: 1px solid rgba(192, 132, 252, 0.4);
}
body.page-assistants .as-bubble--guest-b .as-bubble-who { color: #e9d5ff; }

body.page-assistants .as-bubble--guest-c {
  background: rgba(20, 184, 166, 0.15);
  border: 1px solid rgba(45, 212, 191, 0.38);
}
body.page-assistants .as-bubble--guest-c .as-bubble-who { color: #5eead4; }

body.page-assistants .as-bubble--guest-d {
  background: rgba(244, 114, 182, 0.14);
  border: 1px solid rgba(244, 114, 182, 0.38);
}
body.page-assistants .as-bubble--guest-d .as-bubble-who { color: #f9a8d4; }

body.page-assistants .as-bubble--system {
  align-self: center;
  background: transparent;
  border: 1px dashed rgba(167, 139, 250, 0.35);
  font-size: 0.88rem;
  opacity: 0.92;
}

body.page-assistants .as-compose {
  display: flex;
  gap: 0.55rem;
  padding: 0.85rem;
  border-top: 1px solid rgba(167, 139, 250, 0.14);
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] body.page-assistants .as-compose {
  background: rgba(255, 255, 255, 0.4);
  border-top-color: rgba(124, 58, 237, 0.1);
}

body.page-assistants .as-input {
  flex: 1;
  resize: vertical;
  min-height: 2.7rem;
  max-height: 8rem;
  border-radius: 12px;
  border: 1px solid rgba(167, 139, 250, 0.28);
  padding: 0.6rem 0.8rem;
  font: inherit;
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
}

[data-theme="light"] body.page-assistants .as-input {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(124, 58, 237, 0.2);
}

body.page-assistants .as-input:focus {
  outline: none;
  border-color: rgba(196, 181, 253, 0.65);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

body.page-assistants .as-compose .btn-primary {
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 55%, #2563eb 100%);
  border: none;
  box-shadow: 0 8px 22px rgba(124, 58, 237, 0.28);
}

body.page-assistants .as-compose .btn-primary:hover {
  filter: brightness(1.06);
}

body.page-assistants .as-hint {
  font-size: 0.85rem;
  margin: 0.15rem 0 0;
}

/* Lock/key hit-targets (from Screenshots/LockAndKey.png + LockKeyUpdate.png)
   Red box  → .as-hit--lock under model pill (arm first)
   Green box → .as-hit--key over the "n" in Assistants (then unlock)
   Pixel placement is done in assistants.js (Range API + pill rect).
   Invisible to users; still clickable. */
body.page-assistants .as-title {
  position: relative;
  display: inline-block; /* hit % / rects relative to the word, not full row */
  width: fit-content;
  max-width: 100%;
}

body.page-assistants .as-hit {
  position: absolute;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  opacity: 0;
  box-sizing: border-box;
  cursor: default;
  z-index: 5;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

/* Fallback before JS measures (near letter "n" / under pill) */
body.page-assistants .as-hit--key {
  left: 72%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 0.75em;
  height: 1em;
  min-width: 22px;
  min-height: 28px;
}

body.page-assistants .as-hit--lock {
  right: 0;
  top: calc(100% + 0.35rem);
  width: 6.75rem;
  height: 2.85rem;
  min-width: 96px;
  min-height: 40px;
}

@media (max-width: 640px) {
  body.page-assistants .as-hero-side {
    align-items: flex-start;
    width: 100%;
  }
  body.page-assistants .as-active-chips {
    justify-content: flex-start;
  }
}


/* Book Nook / Golf Pin cards */
.home-pin {
  display: flex;
  flex-direction: column;
  min-height: 22rem;
  height: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(16, 18, 28, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}
[data-theme="light"] .home-pin {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.1);
}
.home-pin-banner {
  position: relative;
  min-height: 7.5rem;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
  padding: 0.85rem 1rem;
}
.home-pin-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.15) 55%, transparent 100%);
  pointer-events: none;
}
.home-pin-kicker {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff8e8;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
}
.home-pin-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 1rem 1.1rem 1.1rem;
  gap: 0.35rem;
}
.home-pin-meta {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.72;
  letter-spacing: 0.02em;
}
.home-pin-title {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.2rem, 2.2vw, 1.45rem);
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: inherit;
}
.home-pin-scroll {
  flex: 1 1 auto;
  min-height: 7.5rem;
  max-height: 14rem;
  overflow-y: auto;
  margin: 0.25rem 0 0.35rem;
  padding-right: 0.35rem;
  scrollbar-width: thin;
}
.home-pin-blurb {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre-wrap;
}
.home-pin-link {
  margin-top: auto;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent, #93c5fd);
}
.home-pin-link:hover {
  text-decoration: underline;
}

/* Home edit page */
.page-home-edit .home-edit-main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1rem 0 2.5rem;
}
.home-edit-card {
  margin-bottom: 1.25rem;
}
.home-edit-card h2 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.35rem;
  margin: 0 0 0.75rem;
}
.home-edit-card label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin: 0.65rem 0 0.25rem;
  opacity: 0.85;
}
.home-edit-card input,
.home-edit-card textarea {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 0.55rem 0.7rem;
  font: inherit;
  background: rgba(0, 0, 0, 0.18);
  color: inherit;
}
[data-theme="light"] .home-edit-card input,
[data-theme="light"] .home-edit-card textarea {
  background: #fff;
}
.home-edit-card textarea {
  min-height: 8rem;
  resize: vertical;
  line-height: 1.5;
}
.home-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}
.home-edit-status {
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.home-pin--golf .home-pin-banner::after {
  background: linear-gradient(to top, rgba(0, 30, 10, 0.55) 0%, rgba(0, 40, 15, 0.12) 50%, transparent 100%);
}
.home-pin--book .home-pin-banner::after {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.2) 55%, transparent 100%);
}

/* Bill's golf course photo is a wide panorama */
.home-pin--golf .home-pin-banner {
  min-height: 8.5rem;
  background-position: center 45%;
  background-size: cover;
}

/* Home photo album path dialog (right-click frame) */
.home-path-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(8, 10, 16, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.home-path-dialog {
  width: min(32rem, 100%);
  max-height: min(85vh, 36rem);
  overflow: auto;
  background: var(--card, #161a24);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  padding: 1.15rem 1.25rem 1.1rem;
}
[data-theme="light"] .home-path-dialog {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.1);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
}
.home-path-dialog-title {
  margin: 0 0 0.75rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
}
.home-path-dialog-body p {
  margin: 0.45rem 0;
  font-size: 0.95rem;
  line-height: 1.45;
}
.home-path-code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.82rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  word-break: break-all;
}
[data-theme="light"] .home-path-code {
  background: rgba(15, 23, 42, 0.06);
}
.home-path-pre {
  white-space: pre-wrap;
  margin: 0.5rem 0;
}
.home-path-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* Photo album editor rows */
.home-photos-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.home-photos-head h2 {
  margin: 0;
}
.home-photos-hint {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
}
.home-photos-rows {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.home-photo-row {
  padding: 0.85rem 1rem 1rem;
  margin: 0;
}
.home-photo-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}
.home-photo-row-num {
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0.65;
  letter-spacing: 0.04em;
}
.home-photo-row label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0.5rem 0 0.2rem;
  opacity: 0.85;
}
.home-photo-row input {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 0.5rem 0.65rem;
  font: inherit;
  background: rgba(0, 0, 0, 0.18);
  color: inherit;
}
[data-theme="light"] .home-photo-row input {
  background: #fff;
}
.home-path-dialog-actions a.btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

/* Owner-only home edit control */
.home-edit-hint[hidden],
#heForm[hidden] {
  display: none !important;
}

/* ==========================================================================
   Task Manager (hub port of example3) — VD: mint/teal tokens, soft cards
   ========================================================================== */
.page-tasks {
  --tm-priority-high: #fb7185;
  --tm-priority-high-soft: rgba(251, 113, 133, 0.16);
  --tm-priority-medium: #fbbf24;
  --tm-priority-medium-soft: rgba(251, 191, 36, 0.14);
  --tm-priority-low: #94a3b8;
  --tm-priority-low-soft: rgba(148, 163, 184, 0.16);
  --tm-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --tm-ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --tm-spring: 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
}
[data-theme="light"] .page-tasks {
  --tm-priority-high: #e11d48;
  --tm-priority-high-soft: rgba(225, 29, 72, 0.12);
  --tm-priority-medium: #d97706;
  --tm-priority-medium-soft: rgba(217, 119, 6, 0.12);
  --tm-priority-low: #64748b;
  --tm-priority-low-soft: rgba(100, 116, 139, 0.14);
}

.page-tasks .tm-main {
  max-width: 40rem;
}

.page-tasks .tm-hero {
  margin-bottom: 0.25rem;
}

.page-tasks .tm-panel {
  padding: 1.2rem 1.25rem 1rem;
  animation: tmPanelIn 0.5s var(--tm-ease-out) both;
}

.page-tasks .tm-add-form {
  display: flex;
  gap: 0.55rem;
  margin-bottom: 1.05rem;
  flex-wrap: wrap;
}

.page-tasks .tm-task-input,
.page-tasks .tm-priority-select,
.page-tasks .tm-edit-input {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.page-tasks .tm-task-input {
  flex: 1 1 10rem;
  min-width: 0;
  font-size: 1rem;
  padding: 0.7rem 0.95rem;
}

.page-tasks .tm-task-input::placeholder {
  color: var(--muted);
  opacity: 0.9;
}

.page-tasks .tm-task-input:hover,
.page-tasks .tm-priority-select:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, rgba(148, 163, 184, 0.28));
}

.page-tasks .tm-task-input:focus,
.page-tasks .tm-priority-select:focus,
.page-tasks .tm-edit-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.page-tasks .tm-priority-select {
  flex-shrink: 0;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.7rem 0.75rem;
  cursor: pointer;
}

.page-tasks .tm-edit-priority {
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
}

.page-tasks .tm-add-form .btn-primary {
  padding: 0.7rem 1.1rem;
}

.page-tasks .tm-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.page-tasks .tm-filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.page-tasks .tm-filters {
  display: inline-flex;
  padding: 0.2rem;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  gap: 0.15rem;
  flex-wrap: wrap;
}
[data-theme="light"] .page-tasks .tm-filters {
  background: rgba(15, 23, 42, 0.04);
}

.page-tasks .tm-filter-btn {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.22s var(--tm-ease-soft), color 0.22s var(--tm-ease-soft),
    transform 0.15s ease, box-shadow 0.22s ease;
}

.page-tasks .tm-filter-btn:hover {
  color: var(--text);
}

.page-tasks .tm-filter-btn:active {
  transform: scale(0.96);
}

.page-tasks .tm-filter-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.page-tasks .tm-priority-filters .tm-filter-btn {
  font-size: 0.72rem;
  padding: 0.35rem 0.6rem;
}

.page-tasks .tm-count {
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  margin: 0;
}

.page-tasks .tm-priority-badge {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.22rem 0.45rem;
  border-radius: 6px;
  line-height: 1.2;
}

.page-tasks .tm-priority-badge--high {
  color: var(--tm-priority-high);
  background: var(--tm-priority-high-soft);
}
.page-tasks .tm-priority-badge--medium {
  color: var(--tm-priority-medium);
  background: var(--tm-priority-medium-soft);
}
.page-tasks .tm-priority-badge--low {
  color: var(--tm-priority-low);
  background: var(--tm-priority-low-soft);
}

.page-tasks .tm-task-item.is-completed .tm-priority-badge {
  opacity: 0.55;
}

.page-tasks .tm-task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 4rem;
}

/* Priority group dividers (when All priorities shows 2+ groups) */
.page-tasks .tm-priority-divider {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  list-style: none;
  margin: 0.45rem 0 0.12rem;
  padding: 0 0.1rem;
  user-select: none;
  pointer-events: none;
}
.page-tasks .tm-priority-divider.is-first {
  margin-top: 0.05rem;
}
.page-tasks .tm-priority-divider-line {
  flex: 1;
  height: 2px;
  border-radius: 999px;
  opacity: 0.95;
  background: linear-gradient(
    90deg,
    transparent,
    currentColor 12%,
    currentColor 88%,
    transparent
  );
  box-shadow: 0 0 10px currentColor;
}
.page-tasks .tm-priority-divider-label {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  line-height: 1.2;
}
.page-tasks .tm-priority-divider--high {
  color: var(--tm-priority-high);
}
.page-tasks .tm-priority-divider--high .tm-priority-divider-label {
  color: var(--tm-priority-high);
  background: var(--tm-priority-high-soft);
  box-shadow: 0 0 0 1px rgba(251, 113, 133, 0.45);
}
.page-tasks .tm-priority-divider--medium {
  color: var(--tm-priority-medium);
}
.page-tasks .tm-priority-divider--medium .tm-priority-divider-label {
  color: var(--tm-priority-medium);
  background: var(--tm-priority-medium-soft);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.45);
}
.page-tasks .tm-priority-divider--low {
  color: var(--tm-priority-low);
}
.page-tasks .tm-priority-divider--low .tm-priority-divider-label {
  color: var(--tm-priority-low);
  background: var(--tm-priority-low-soft);
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.4);
}

.page-tasks .tm-task-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.28rem 0.5rem;
  border-radius: 6px;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  background: transparent;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.28s var(--tm-ease-soft),
    transform 0.28s var(--tm-ease-soft);
}

/*
 * Priority tint bands — solid rgba (no color-mix) so they stay visible
 * in Safari / dark card backgrounds. Applied when All priorities is shown.
 */
.page-tasks .tm-task-item.tm-task-item--band-high {
  background: rgba(251, 113, 133, 0.16) !important;
  border-color: rgba(251, 113, 133, 0.28);
  border-left-color: #fb7185;
}
.page-tasks .tm-task-item.tm-task-item--band-medium {
  background: rgba(251, 191, 36, 0.14) !important;
  border-color: rgba(251, 191, 36, 0.28);
  border-left-color: #fbbf24;
}
.page-tasks .tm-task-item.tm-task-item--band-low {
  background: rgba(148, 163, 184, 0.14) !important;
  border-color: rgba(148, 163, 184, 0.26);
  border-left-color: #94a3b8;
}

.page-tasks .tm-task-item.tm-task-item--band-high:hover {
  background: rgba(251, 113, 133, 0.24) !important;
  border-color: rgba(251, 113, 133, 0.42);
}
.page-tasks .tm-task-item.tm-task-item--band-medium:hover {
  background: rgba(251, 191, 36, 0.22) !important;
  border-color: rgba(251, 191, 36, 0.42);
}
.page-tasks .tm-task-item.tm-task-item--band-low:hover {
  background: rgba(148, 163, 184, 0.22) !important;
  border-color: rgba(148, 163, 184, 0.4);
}

[data-theme="light"] .page-tasks .tm-task-item.tm-task-item--band-high {
  background: rgba(225, 29, 72, 0.1) !important;
  border-color: rgba(225, 29, 72, 0.22);
  border-left-color: #e11d48;
}
[data-theme="light"] .page-tasks .tm-task-item.tm-task-item--band-medium {
  background: rgba(217, 119, 6, 0.11) !important;
  border-color: rgba(217, 119, 6, 0.24);
  border-left-color: #d97706;
}
[data-theme="light"] .page-tasks .tm-task-item.tm-task-item--band-low {
  background: rgba(100, 116, 139, 0.1) !important;
  border-color: rgba(100, 116, 139, 0.22);
  border-left-color: #64748b;
}
[data-theme="light"] .page-tasks .tm-task-item.tm-task-item--band-high:hover {
  background: rgba(225, 29, 72, 0.16) !important;
}
[data-theme="light"] .page-tasks .tm-task-item.tm-task-item--band-medium:hover {
  background: rgba(217, 119, 6, 0.17) !important;
}
[data-theme="light"] .page-tasks .tm-task-item.tm-task-item--band-low:hover {
  background: rgba(100, 116, 139, 0.16) !important;
}

.page-tasks .tm-task-item:hover {
  background: rgba(0, 0, 0, 0.16);
  border-color: rgba(148, 163, 184, 0.16);
}
[data-theme="light"] .page-tasks .tm-task-item:hover {
  background: rgba(15, 23, 42, 0.04);
}

.page-tasks .tm-task-item.is-editing {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(148, 163, 184, 0.28);
  box-shadow: 0 0 0 1px var(--accent-soft);
}
.page-tasks .tm-task-item.is-editing.tm-task-item--band-high,
.page-tasks .tm-task-item.is-editing.tm-task-item--band-medium,
.page-tasks .tm-task-item.is-editing.tm-task-item--band-low {
  box-shadow: 0 0 0 1px var(--accent-soft);
}
[data-theme="light"] .page-tasks .tm-task-item.is-editing {
  background: rgba(15, 23, 42, 0.04);
}

.page-tasks .tm-task-item.tm-task-item--enter {
  animation: tmTaskIn 0.38s var(--tm-ease-out) both;
}
.page-tasks .tm-task-item.tm-task-item--exit {
  animation: tmTaskOut 0.28s var(--tm-ease-soft) both;
  pointer-events: none;
}

.page-tasks .tm-task-list--stagger .tm-task-item {
  animation: tmTaskIn 0.4s var(--tm-ease-out) both;
}
.page-tasks .tm-task-list--stagger .tm-task-item:nth-child(1) { animation-delay: 0.04s; }
.page-tasks .tm-task-list--stagger .tm-task-item:nth-child(2) { animation-delay: 0.08s; }
.page-tasks .tm-task-list--stagger .tm-task-item:nth-child(3) { animation-delay: 0.12s; }
.page-tasks .tm-task-list--stagger .tm-task-item:nth-child(4) { animation-delay: 0.16s; }
.page-tasks .tm-task-list--stagger .tm-task-item:nth-child(5) { animation-delay: 0.2s; }
.page-tasks .tm-task-list--stagger .tm-task-item:nth-child(n + 6) { animation-delay: 0.24s; }

.page-tasks .tm-task-check {
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--accent);
  cursor: pointer;
  transition: transform var(--tm-spring);
}
.page-tasks .tm-task-check:hover {
  transform: scale(1.12);
}

.page-tasks .tm-task-title {
  flex: 1;
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 500;
  word-break: break-word;
  line-height: 1.4;
  position: relative;
  transition: color 0.28s var(--tm-ease-soft), opacity 0.28s var(--tm-ease-soft);
}

.page-tasks .tm-task-title::after {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  height: 1.5px;
  width: 100%;
  background: currentColor;
  opacity: 0.65;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.35s var(--tm-ease-out);
  pointer-events: none;
}

.page-tasks .tm-task-item.is-completed .tm-task-title {
  color: var(--muted);
  font-weight: 400;
  opacity: 0.8;
}
.page-tasks .tm-task-item.is-completed .tm-task-title::after {
  transform: scaleX(1);
}

.page-tasks .tm-task-actions {
  display: flex;
  flex-shrink: 0;
  gap: 0.15rem;
  opacity: 0;
  transform: translateX(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.page-tasks .tm-task-item:hover .tm-task-actions,
.page-tasks .tm-task-item:focus-within .tm-task-actions,
.page-tasks .tm-task-item.is-editing .tm-task-actions {
  opacity: 1;
  transform: translateX(0);
}

.page-tasks .tm-btn-edit:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.page-tasks .btn-sm {
  padding: 0.4rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 8px;
}

.page-tasks .tm-task-edit-fields {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.page-tasks .tm-task-edit-fields .tm-edit-input {
  flex: 1 1 8rem;
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.4rem 0.6rem;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--bg-elevated);
}

.page-tasks .tm-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  list-style: none;
}
.page-tasks .tm-empty-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 0.5rem;
  opacity: 0.7;
}
.page-tasks .tm-empty p {
  margin: 0;
  font-size: 0.9rem;
}

.page-tasks .tm-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  min-height: 2.5rem;
}

.page-tasks .tm-status {
  font-size: 0.8rem;
  min-height: 1.2em;
  flex: 1;
  margin: 0;
}
.page-tasks .tm-status:empty {
  display: none;
}

@keyframes tmPanelIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes tmTaskIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes tmTaskOut {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(12px) scale(0.97);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-tasks .tm-panel,
  .page-tasks .tm-task-item.tm-task-item--enter,
  .page-tasks .tm-task-item.tm-task-item--exit,
  .page-tasks .tm-task-list--stagger .tm-task-item {
    animation: none !important;
  }
  .page-tasks .tm-task-title::after {
    transition: none;
  }
}

@media (max-width: 480px) {
  .page-tasks .tm-add-form {
    flex-direction: column;
  }
  .page-tasks .tm-priority-select,
  .page-tasks .tm-add-form .btn-primary {
    width: 100%;
  }
  .page-tasks .tm-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .page-tasks .tm-filters-row {
    flex-direction: column;
    align-items: stretch;
  }
  .page-tasks .tm-filters {
    width: 100%;
  }
  .page-tasks .tm-filter-btn {
    flex: 1;
  }
  .page-tasks .tm-count {
    text-align: center;
  }
  .page-tasks .tm-task-actions {
    opacity: 1;
    transform: none;
  }
  .page-tasks .tm-panel-footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .page-tasks .tm-panel-footer .btn {
    width: 100%;
  }
  .page-tasks .tm-task-edit-fields {
    flex-direction: column;
    align-items: stretch;
  }
  .page-tasks .tm-edit-priority {
    width: 100%;
  }
}

/* ==========================================================================
   Design tokens — Task Manager hierarchy (Phase 2 visual foundation)
   Neutrals carry chrome; color marks meaning (status, priority, emphasis).
   ========================================================================== */
:root {
  --signal-high: #fb7185;
  --signal-high-soft: rgba(251, 113, 133, 0.16);
  --signal-medium: #fbbf24;
  --signal-medium-soft: rgba(251, 191, 36, 0.14);
  --signal-low: #94a3b8;
  --signal-low-soft: rgba(148, 163, 184, 0.16);
  --signal-ok: var(--accent);
  --signal-ok-soft: var(--accent-soft);
  --signal-warn: #fbbf24;
  --signal-warn-soft: rgba(251, 191, 36, 0.14);
  --signal-danger: #f87171;
  --signal-danger-soft: rgba(248, 113, 113, 0.12);
}
[data-theme="light"] {
  --signal-high: #e11d48;
  --signal-high-soft: rgba(225, 29, 72, 0.1);
  --signal-medium: #d97706;
  --signal-medium-soft: rgba(217, 119, 6, 0.11);
  --signal-low: #64748b;
  --signal-low-soft: rgba(100, 116, 139, 0.1);
  --signal-danger: #dc2626;
  --signal-danger-soft: rgba(220, 38, 38, 0.1);
}

/* Utility bands (opt-in classes for future page polish) */
.band-high {
  background: var(--signal-high-soft) !important;
  border-left: 3px solid var(--signal-high);
}
.band-medium {
  background: var(--signal-medium-soft) !important;
  border-left: 3px solid var(--signal-medium);
}
.band-low {
  background: var(--signal-low-soft) !important;
  border-left: 3px solid var(--signal-low);
}
.band-ok {
  background: var(--signal-ok-soft) !important;
  border-left: 3px solid var(--signal-ok);
}
.band-warn {
  background: var(--signal-warn-soft) !important;
  border-left: 3px solid var(--signal-warn);
}

/* ==========================================================================
   Visual hierarchy pass (VD) — bold meaning, calm chrome
   Inspired by Task Manager priority bands; site-wide application.
   ========================================================================== */

/* —— Global type —— */
.eyebrow {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent);
  background: var(--accent-soft);
  letter-spacing: 0.04em;
  font-weight: 600;
}

.hero h1,
.page-title {
  font-weight: 700;
  letter-spacing: -0.035em;
}

.page-title {
  position: relative;
}

/* Accent underline bar under page titles (skip Assistants gradient title) */
body:not(.page-assistants) .page-title::after {
  content: "";
  display: block;
  width: 3.25rem;
  height: 3px;
  margin-top: 0.55rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 55%, transparent);
}

.lede {
  font-size: 1.05rem;
  line-height: 1.55;
}

.section h2,
.card h2,
.fin-card-title {
  letter-spacing: -0.02em;
}

/* —— Buttons: solid primary (TM energy) —— */
.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: #042f2e;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}

.btn-primary:hover {
  filter: brightness(1.06);
  border-color: transparent;
  color: #042f2e;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 35%, transparent);
}

[data-theme="light"] .btn-primary {
  color: #fff;
  background: var(--accent);
}

[data-theme="light"] .btn-primary:hover {
  color: #fff;
  filter: brightness(1.05);
}

/* —— Cards: clearer elevation + optional accent edge —— */
.card {
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color var(--transition), box-shadow var(--transition),
    transform 0.15s ease;
}

.card:hover {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
}

.fin-card {
  border-left: 3px solid transparent;
}

.fin-card-holdings {
  border-left-color: color-mix(in srgb, var(--accent-2) 70%, transparent);
}

.fin-card-alloc {
  border-left-color: color-mix(in srgb, #a78bfa 80%, transparent);
}

.fin-card-cash {
  border-left-color: color-mix(in srgb, var(--accent) 80%, transparent);
}

.fin-card-guard {
  border-left-color: color-mix(in srgb, var(--signal-warn) 85%, transparent);
}

.fin-card-rmd {
  border-left-color: color-mix(in srgb, var(--signal-medium) 80%, transparent);
}

/* —— Sidebar active: left bar + glow —— */
.sidebar-nav a.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
  font-weight: 600;
}

.nav-sub a.is-active {
  box-shadow: inset 3px 0 0 var(--accent-2);
  color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
}

.nav-group-toggle.is-open {
  color: var(--text);
}

/* —— Finances KPIs: denser signal —— */
.fin-kpi-value {
  font-size: 1.28rem;
  letter-spacing: -0.02em;
}

.fin-kpi-label {
  letter-spacing: 0.06em;
}

.fin-pos {
  color: var(--signal-ok) !important;
  font-weight: 600;
}

.fin-neg {
  color: var(--signal-danger) !important;
  font-weight: 600;
}

[data-theme="light"] .fin-pos {
  color: #0d9488 !important;
}

[data-theme="light"] .fin-neg {
  color: var(--signal-danger) !important;
}

.fin-badge-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 12px color-mix(in srgb, var(--accent) 50%, transparent);
}

/* Cashflow status badge punch */
.cf-status-badge {
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 0.72rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
}

.cf-status-ok {
  color: #042f2e;
  background: var(--accent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 40%, transparent);
}

[data-theme="light"] .cf-status-ok {
  color: #fff;
}

.cf-status-warn {
  color: #1c1000;
  background: var(--signal-warn);
  box-shadow: 0 0 16px color-mix(in srgb, var(--signal-warn) 45%, transparent);
}

/* Balance heat already has levels — strengthen cells */
.cf-bal--caution {
  background: var(--signal-high-soft) !important;
  color: var(--signal-high);
  font-weight: 700;
}

.cf-bal--safe {
  background: var(--signal-ok-soft) !important;
  color: var(--accent);
  font-weight: 700;
}

/* —— Status lines —— */
.bc-status.is-ok,
.home-edit-status:not([style*="f87171"]) {
  color: var(--accent);
}

.bc-status.is-error {
  color: var(--signal-danger);
  font-weight: 600;
}

/* —— Book Club chat: stronger speaker identity —— */
.bc-bubble--marian {
  border-left: 3px solid var(--accent);
  background: linear-gradient(
    135deg,
    var(--accent-soft),
    color-mix(in srgb, var(--bg-elevated) 90%, transparent)
  );
}

.bc-bubble--user {
  border-left: 3px solid var(--accent-2);
}

.bc-table th {
  letter-spacing: 0.05em;
}

.bc-table tbody tr:hover td {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

/* —— Assistants: keep gradient title; punch model pill & chips —— */
body.page-assistants .as-model-pill {
  border: 1px solid color-mix(in srgb, #c4b5fd 50%, transparent);
  background: color-mix(in srgb, #a78bfa 18%, transparent);
  box-shadow: 0 0 20px rgba(167, 139, 250, 0.25);
}

body.page-assistants .as-model-dot {
  box-shadow: 0 0 8px #a78bfa;
}

body.page-assistants .card.as-chat-card {
  border-color: color-mix(in srgb, #a78bfa 28%, var(--border));
  box-shadow:
    var(--shadow),
    0 0 0 1px color-mix(in srgb, #a78bfa 12%, transparent);
}

/* —— Home pins: bolder kickers —— */
.home-pin-kicker,
.home-kicker {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--accent);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.home-pin-title {
  letter-spacing: -0.02em;
}

.home-card-heading {
  letter-spacing: -0.02em;
}

.home-where-label {
  font-weight: 700;
  font-size: 1.15rem;
}

/* —— Tables: section headers as signal —— */
.fin-section-row td {
  color: var(--accent);
  border-left: 2px solid var(--accent);
  padding-left: 0.45rem !important;
}

/* —— Task manager already bold; align filter active with global —— */
.page-tasks .tm-filter-btn.is-active {
  background: var(--accent);
  color: #042f2e;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .page-tasks .tm-filter-btn.is-active {
  color: #fff;
}

/* —— Footer year / brand whisper —— */
.sidebar-brand {
  letter-spacing: -0.03em;
}

.logo-dot {
  text-shadow: 0 0 12px color-mix(in srgb, var(--accent) 70%, transparent);
}

/* ==========================================================================
   VD hierarchy v2 — high-visibility (hard to miss)
   ========================================================================== */

/* Full-bleed top accent rail (true edge-to-edge) */
html::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  max-width: 100%;
  height: 4px;
  z-index: 2147483646;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    var(--accent-2) 45%,
    #c4b5fd 100%
  );
  box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 50%, transparent);
}

/* Avoid double bars if any body::before remained */
body::before {
  display: none !important;
  content: none !important;
}

/* Sidebar: tinted edge so chrome feels intentional */
.sidebar {
  border-right: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}

.sidebar-brand {
  font-size: 1.05rem;
  font-weight: 700;
}

/* Primary buttons — solid mint (you liked these) */
.btn.btn-primary,
button.btn-primary,
a.btn-primary {
  background: var(--accent) !important;
  border-color: transparent !important;
  color: #042f2e !important;
  font-weight: 700 !important;
  box-shadow:
    0 2px 0 color-mix(in srgb, var(--accent) 40%, #000),
    0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent) !important;
}

[data-theme="light"] .btn.btn-primary,
[data-theme="light"] button.btn-primary,
[data-theme="light"] a.btn-primary {
  color: #ffffff !important;
}

.btn.btn-primary:hover,
button.btn-primary:hover,
a.btn-primary:hover {
  filter: brightness(1.08);
  text-decoration: none !important;
}

/* Eyebrows — mint chips */
.eyebrow,
.fin-eyebrow,
.as-eyebrow {
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent) !important;
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  font-weight: 700 !important;
}

/* Section title mark — longer underline under titles (NOT the top rail) */
.home-title::after,
body:not(.page-assistants) .page-title::after,
.hero h1::after {
  content: "";
  display: block;
  width: min(12rem, 40vw);
  height: 4px;
  margin-top: 0.7rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 60%, transparent);
}

.home-title .accent,
.accent {
  color: var(--accent);
  text-shadow: 0 0 24px color-mix(in srgb, var(--accent) 45%, transparent);
}

.card,
.fin-card,
.tm-panel,
.home-card,
.home-pin {
  border-color: color-mix(in srgb, var(--accent) 14%, var(--border)) !important;
}

.sidebar-nav a.is-active {
  background: color-mix(in srgb, var(--accent) 18%, transparent) !important;
  color: var(--accent) !important;
  box-shadow: inset 4px 0 0 var(--accent) !important;
  font-weight: 700 !important;
}

.nav-sub a.is-active {
  background: color-mix(in srgb, var(--accent-2) 16%, transparent) !important;
  color: var(--accent-2) !important;
  box-shadow: inset 4px 0 0 var(--accent-2) !important;
}

.nav-group-toggle.is-open {
  color: var(--text);
}

.fin-kpi-value {
  font-size: 1.4rem !important;
  color: var(--text);
}

.fin-kpi::before {
  width: 4px !important;
}

.fin-pos {
  color: var(--signal-ok) !important;
  font-weight: 600;
}

.fin-neg {
  color: var(--signal-danger) !important;
  font-weight: 600;
}

[data-theme="light"] .fin-pos {
  color: #0d9488 !important;
}

[data-theme="light"] .fin-neg {
  color: var(--signal-danger) !important;
}

.fin-badge-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 12px color-mix(in srgb, var(--accent) 50%, transparent);
}

.cf-status-badge {
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 0.72rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
}

.cf-status-ok {
  color: #042f2e;
  background: var(--accent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 40%, transparent);
}

[data-theme="light"] .cf-status-ok {
  color: #fff;
}

.cf-status-warn {
  color: #1c1000;
  background: var(--signal-warn);
  box-shadow: 0 0 16px color-mix(in srgb, var(--signal-warn) 45%, transparent);
}

.cf-bal--caution {
  background: var(--signal-high-soft) !important;
  color: var(--signal-high);
  font-weight: 700;
}

.cf-bal--safe {
  background: var(--signal-ok-soft) !important;
  color: var(--accent);
  font-weight: 700;
}

.bc-status.is-error {
  color: var(--signal-danger);
  font-weight: 600;
}

.bc-bubble--marian {
  border-left: 3px solid var(--accent);
  background: linear-gradient(
    135deg,
    var(--accent-soft),
    color-mix(in srgb, var(--bg-elevated) 90%, transparent)
  );
}

.bc-bubble--user {
  border-left: 3px solid var(--accent-2);
}

body.page-assistants .as-model-pill {
  border: 1px solid color-mix(in srgb, #c4b5fd 50%, transparent);
  background: color-mix(in srgb, #a78bfa 18%, transparent);
  box-shadow: 0 0 20px rgba(167, 139, 250, 0.25);
}

body.page-assistants .as-model-dot {
  box-shadow: 0 0 8px #a78bfa;
}

body.page-assistants .card.as-chat-card {
  border-color: color-mix(in srgb, #a78bfa 28%, var(--border));
  box-shadow:
    var(--shadow),
    0 0 0 1px color-mix(in srgb, #a78bfa 12%, transparent);
}

body.page-assistants .as-compose .btn-primary {
  background: var(--accent) !important;
  color: #042f2e !important;
}

.home-pin-kicker,
.home-kicker {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--accent);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.home-where-label {
  font-weight: 700;
  font-size: 1.15rem;
}

.fin-section-row td {
  color: var(--accent);
  border-left: 2px solid var(--accent);
  padding-left: 0.45rem !important;
}

.page-tasks .tm-filter-btn.is-active {
  background: var(--accent) !important;
  color: #042f2e !important;
  font-weight: 700 !important;
}

[data-theme="light"] .page-tasks .tm-filter-btn.is-active,
[data-theme="light"] body.page-assistants .as-compose .btn-primary {
  color: #fff !important;
}

.logo-dot {
  text-shadow: 0 0 12px color-mix(in srgb, var(--accent) 70%, transparent);
}
