/* Shared shell for the _phone/ web app.
   Tokens, layout container, card system, tab bar, top nav.
   Per-page styles live alongside in inline <style> blocks. */

:root {
  --bg: #fafafa; --bg-elev: #ffffff; --border: #e5e7eb;
  --fg: #0f172a; --muted: #6b7280;
  --pos: #059669; --neg: #dc2626; --warn: #d97706;
  --accent: #6366f1;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --nav-height: 64px;
  /* Motion system. iOS-style spring + decelerate curves and a shared
     duration scale so every transition across the app feels related. */
  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.30, 1);
  --dur-fast: 0.14s; --dur: 0.24s; --dur-slow: 0.42s;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0a0a0a; --bg-elev: #141414; --border: #262626;
  --fg: #f4f4f5; --muted: #9ca3af;
  --pos: #10b981; --neg: #ef4444; --warn: #f59e0b;
  --accent: #818cf8;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; min-height: 100vh; }
body {
  background: var(--bg); color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.55;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top);
}
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

.container {
  max-width: 560px; margin: 0 auto;
  padding: 24px 18px;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 24px);
}

header.app-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 18px; gap: 14px;
}
header.app-head h1 {
  font-size: 28px; font-weight: 700; margin: 0; letter-spacing: -0.025em;
}
header.app-head .subtitle { color: var(--muted); font-size: 13px; margin-top: 4px; }

.theme-toggle {
  appearance: none; border: 1px solid var(--border);
  background: var(--bg-elev); color: var(--fg);
  padding: 8px 12px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; display: inline-flex; align-items: center; gap: 7px;
  font-family: inherit;
  flex-shrink: 0;
}
@media (max-width: 480px) {
  /* Icon-only toggle on phones so the header subtitle keeps its line. */
  .theme-toggle .theme-label { display: none; }
  .theme-toggle { padding: 8px 10px; }
}

.card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  margin-bottom: 12px;
}
.card-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); font-weight: 600; margin-bottom: 10px;
}

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

/* Visible keyboard focus on every interactive element (accessibility). */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Bottom tab bar. Phone only. Five evenly spaced cells. */
.tab-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; align-items: stretch;
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  z-index: 20;
}
.tab-bar .tab {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px; padding: 8px 2px;
  color: var(--muted); text-decoration: none;
  font-size: 10px;
  min-height: 44px;
  border-top: 2px solid transparent;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.tab-bar .tab .tab-icon {
  width: 20px; height: 20px; color: currentColor;
}
.tab-bar .tab .tab-label {
  font-size: 10px; font-weight: 500; letter-spacing: 0.01em;
  white-space: nowrap;
}
.tab-bar .tab[aria-current="page"] {
  color: var(--accent);
  border-top-color: var(--accent);
}
.tab-bar .tab:active { color: var(--fg); }

/* Desktop top nav, hidden by default. */
.top-nav { display: none; }

@media (min-width: 1024px) {
  .container {
    max-width: 960px;
    padding: 32px 28px 48px;
  }
  .tab-bar { display: none; }
  .top-nav {
    display: flex; gap: 4px; justify-content: center;
    margin: 0 auto 24px;
    padding: 6px;
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: 999px;
    /* Hug the tabs and centre, so all six fit without the rounded bar
       clipping the first icon and last label (the old max-width:560px +
       overflow:hidden chopped both ends). Caps at the container width. */
    width: max-content; max-width: 100%;
  }
  .top-nav .tab {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px; border-radius: 999px;
    color: var(--muted); text-decoration: none;
    font-size: 13px; font-weight: 500;
    flex-direction: row;
    flex: 0 0 auto;            /* keep natural width; never shrink/wrap */
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
  }
  .top-nav .tab:hover {
    color: var(--fg);
    background: color-mix(in srgb, var(--fg) 6%, var(--bg-elev));
  }
  .top-nav .tab .tab-icon { width: 16px; height: 16px; color: currentColor; }
  .top-nav .tab .tab-label { font-size: 13px; }
  /* Solid (not translucent) tint so it does not ghost over the glass nav's
     backdrop-filter in Safari. Mixed with the surface = opaque + theme-aware. */
  .top-nav .tab[aria-current="page"] {
    background: #eef0ff;
    background: color-mix(in srgb, var(--accent) 16%, var(--bg-elev));
    color: var(--accent);
    font-weight: 600;
  }
  .top-nav .tab[aria-current="page"]:hover {
    background: color-mix(in srgb, var(--accent) 22%, var(--bg-elev));
  }
  .top-nav .tab[aria-current="page"] .tab-icon { color: var(--accent); }

  .cards-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
    align-items: start;
  }
  .cards-grid > .card { margin-bottom: 0; }
  .span-2 { grid-column: 1 / -1; }
}

@media (max-width: 1023px) {
  .top-nav { display: none; }
}

/* Hero card */
.card.hero { padding: 24px 20px; }
.hero-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); font-weight: 600;
}
.hero-value {
  font-size: 48px; font-weight: 700; letter-spacing: -0.04em;
  line-height: 1; margin: 8px 0 4px;
}
.hero-sub { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.hero-progress {
  height: 6px; background: var(--bg); border-radius: 999px;
  overflow: hidden; margin-bottom: 18px;
}
.hero-progress-fill {
  height: 100%; background: var(--accent); border-radius: 999px;
}
.hero-deltas {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
}
.hero-delta {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--bg);
}
.hero-delta .num { font-size: 17px; font-weight: 600; }
.hero-delta .label {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Tasks card */
.task-list { list-style: none; padding: 0; margin: 0; }
.task-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.task-list li:last-child { border-bottom: none; }
.task-imp {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 6px;
  font-size: 12px; font-weight: 600;
  background: var(--bg); color: var(--muted); flex-shrink: 0;
}
.task-imp.imp-5 { background: rgba(239,68,68,0.15); color: var(--neg); }
.task-imp.imp-4 { background: rgba(245,158,11,0.15); color: var(--warn); }
.task-imp.imp-3 { background: rgba(99,102,241,0.15); color: var(--accent); }
.task-imp.imp-2 { background: rgba(99,102,241,0.10); color: var(--accent); }
.task-imp.imp-1 { background: rgba(156,163,175,0.15); color: var(--muted); }
.task-title { font-size: 15px; }

/* Journal card */
.journal-list { list-style: none; padding: 0; margin: 0; }
.journal-list li {
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.journal-list li:last-child { border-bottom: none; }
.journal-meta {
  display: flex; gap: 8px; margin-bottom: 4px;
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.05em;
}
.journal-mood {
  padding: 1px 7px; border-radius: 999px;
  background: rgba(99,102,241,0.15); color: var(--accent);
}
.journal-summary { font-size: 14px; line-height: 1.45; }

/* Activity card */
.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-list li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 0; font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.activity-list li:last-child { border-bottom: none; }
.activity-date { color: var(--muted); font-size: 12px; flex-shrink: 0; }

/* Clients list card */
.client-list { list-style: none; padding: 0; margin: 0; }
.client-list li {
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.client-list li:last-child { border-bottom: none; }
.client-name {
  font-size: 15px; font-weight: 600;
  display: flex; gap: 8px; align-items: center;
}
.client-status {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(16,185,129,0.15); color: var(--pos); font-weight: 600;
}
.client-note { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* Footer for vertical pages */
.page-footer {
  color: var(--muted); font-size: 12px; margin-top: 28px;
  text-align: center; line-height: 1.6;
}

/* Tappable tasks: toggle button + done state */
.tappable-task .task-toggle {
  appearance: none; border: 1.5px solid var(--muted);
  background: transparent; color: var(--muted);
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1; cursor: pointer; padding: 0; flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit;
  position: relative; /* anchor the invisible hit-area overlay */
}
/* Keep the 22px circle but expand the tap target to >=44px (Apple HIG,
   WCAG 2.5.5) so the dense list rows are not easy to mis-hit. */
.tappable-task .task-toggle::after {
  content: ""; position: absolute; inset: -11px;
}
.tappable-task .task-toggle:hover { border-color: var(--fg); color: var(--fg); }
.tappable-task[data-task-status="done"] .task-toggle {
  background: var(--pos); border-color: var(--pos); color: white;
}
.tappable-task[data-task-status="done"] .task-toggle::before { content: "\2713"; }
.tappable-task[data-task-status="done"] .task-title {
  text-decoration: line-through; color: var(--muted);
}
.tappable-task .task-toggle:disabled { opacity: 0.5; cursor: wait; }

/* Daily routine card on the hub */
.routine-list { list-style: none; padding: 0; margin: 0; }
.routine-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--border);
}
.routine-item:last-child { border-bottom: none; }
.routine-item .task-toggle {
  appearance: none; border: 1.5px solid var(--muted);
  background: transparent; color: var(--muted);
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1; cursor: pointer; padding: 0;
  font-family: inherit; flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  position: relative; /* anchor the invisible hit-area overlay */
}
/* Same >=44px tap target as the home tasks: 22px circle, padded hit area. */
.routine-item .task-toggle::after {
  content: ""; position: absolute; inset: -11px;
}
.routine-item[data-done="true"] .task-toggle {
  background: var(--pos); border-color: var(--pos); color: white;
}
.routine-item[data-done="true"] .task-toggle::before { content: "\2713"; }
.routine-item[data-done="true"] .routine-label {
  text-decoration: line-through; color: var(--muted);
}
.routine-label { font-size: 15px; }

/* Gym link on the Health page */
.open-gym-link {
  display: block; padding: 14px 18px;
  background: var(--accent); color: white;
  border-radius: var(--radius-sm); text-decoration: none;
  text-align: center; font-weight: 600; margin-bottom: 12px;
}
.open-gym-link:hover { filter: brightness(1.05); }

/* Smart gym card on the Health page */
.gym-today-card .gym-status { font-size: 14px; line-height: 1.45; }
.gym-today-card .gym-status.done { color: var(--pos); font-weight: 600; }
.gym-today-card .gym-status.muted { color: var(--muted); }
.gym-today-card .gym-cta { margin-top: 12px; }
.gym-today-card .gym-cta-link {
  color: var(--accent); text-decoration: none; font-weight: 600; font-size: 14px;
}
.gym-today-card .gym-cta-link:hover { text-decoration: underline; }

/* Progressive-overload note on gym exercise cards */
.exercise-meta {
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center;
  margin-top: 4px;
}
.prog-note {
  font-size: 10.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.prog-note.prog-up { color: var(--pos); border: 1px solid var(--pos); }
.prog-note.prog-flat { color: var(--muted); border: 1px solid var(--border); }

/* Gym page exercise cards */
.exercise-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; margin-bottom: 4px;
}
.exercise-name { font-size: 16px; font-weight: 600; }
.exercise-target { font-size: 12px; color: var(--muted); }
.exercise-last {
  font-size: 11px; color: var(--muted); margin-top: 2px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.set-list { list-style: none; padding: 0; margin: 10px 0; }
.set-row {
  display: flex; gap: 14px; padding: 6px 0;
  font-size: 14px; border-bottom: 1px solid var(--border);
}
.set-row:last-child { border-bottom: none; }
.set-num { color: var(--muted); width: 60px; }
.set-weight { font-weight: 600; }
.set-reps { color: var(--muted); }
.add-set {
  width: 100%; padding: 10px; border-radius: var(--radius-sm);
  border: 1.5px dashed var(--border); background: transparent;
  color: var(--muted); font-size: 14px; cursor: pointer;
  font-family: inherit;
}
.add-set:hover { border-color: var(--fg); color: var(--fg); }
.set-form {
  display: flex; gap: 8px; align-items: center; margin-top: 10px;
  flex-wrap: wrap;
}
.set-form input {
  flex: 1; min-width: 0; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--fg); font-family: inherit; font-size: 15px;
}
.set-form button {
  padding: 9px 14px; border: none; border-radius: var(--radius-sm);
  background: var(--accent); color: white; font-size: 14px;
  cursor: pointer; font-family: inherit;
}
.set-form button.cancel { background: var(--bg-elev); color: var(--muted); }

/* Brain tab: vault browser */
.note-body {
  max-width: 720px;
  line-height: 1.65;
  font-size: 16px;
  color: var(--fg);
}
.note-body h1, .note-body h2, .note-body h3, .note-body h4 {
  margin-top: 1.6em;
  margin-bottom: 0.5em;
  line-height: 1.25;
  letter-spacing: -0.015em;
}
.note-body h1 { font-size: 28px; }
.note-body h2 { font-size: 22px; }
.note-body h3 { font-size: 18px; }
.note-body h4 { font-size: 16px; color: var(--muted); }
.note-body p { margin: 0 0 1em; }
.note-body ul, .note-body ol { margin: 0 0 1em; padding-left: 22px; }
.note-body li { margin: 0.2em 0; }
.note-body code {
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.92em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.note-body pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 13px;
  margin: 0 0 1em;
}
.note-body pre code { background: transparent; padding: 0; }
.note-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 14px;
  margin: 0 0 1em;
  color: var(--muted);
}
.note-body a { color: var(--accent); text-decoration: none; border-bottom: 1px solid currentColor; }
.note-body a:hover { text-decoration: none; }
.note-body .wiki-link {
  color: var(--accent);
  border-bottom: 1px dashed currentColor;
}
.note-body .wiki-link-broken {
  color: var(--muted);
  border-bottom: 1px dashed currentColor;
  cursor: not-allowed;
}
.note-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5em 0;
}
.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--fg); }
.brain-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
  display: block;
  text-decoration: none;
  color: var(--fg);
}
.brain-card .brain-card-label {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.brain-card .brain-card-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.brain-card .brain-card-preview {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.45;
}

/* Task blocker */
.task-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
}
.task-blocker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--warn);
  margin-top: 4px;
  margin-left: 32px;
}
.task-blocker-btn {
  appearance: none;
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  cursor: pointer;
  margin-left: auto;
  font-family: inherit;
  position: relative; /* anchor the invisible hit-area overlay */
}
/* Keep the small pill but pad the hit area up to >=44px tall. */
.task-blocker-btn::after {
  content: ""; position: absolute; inset: -12px -6px;
}
.task-blocker-btn:hover { border-color: var(--warn); color: var(--warn); }

/* Habit streak chip */
.streak {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(245,158,11,0.15);
  color: var(--warn);
  font-weight: 600;
  margin-left: 8px;
}
.routine-progress {
  margin-bottom: 14px;
}
.routine-progress-text {
  font-size: 12px;
  color: var(--muted);
}
.routine-progress-bar {
  height: 4px;
  background: var(--bg);
  border-radius: 999px;
  margin-top: 6px;
  overflow: hidden;
}
.routine-progress-bar > div {
  height: 100%;
  background: var(--pos);
  border-radius: 999px;
  transition: width 0.2s;
}

/* Recent themes card */
.theme-list { list-style: none; padding: 0; margin: 0; }
.theme-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.theme-list li:last-child { border-bottom: none; }
.theme-name { font-size: 14px; text-transform: capitalize; }
.theme-count {
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(99,102,241,0.15); color: var(--accent);
}

/* Nutrition: meal form + meal list */
.meal-form-row {
  display: flex; gap: 8px; margin-top: 8px;
}
.meal-form-row input {
  flex: 1; min-width: 0; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--fg); font-size: 15px; font-family: inherit;
}
.meal-form-row button {
  padding: 10px 16px; border: none; border-radius: var(--radius-sm);
  background: var(--accent); color: white; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.meal-form-status {
  font-size: 13px; color: var(--muted); margin-top: 8px; padding: 8px 0;
}
.meal-form-status.error { color: var(--neg); }
.meal-list { list-style: none; padding: 0; margin: 0; }
.meal-list li {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border);
}
.meal-list li:last-child { border-bottom: none; }
.meal-desc { font-size: 14px; flex: 1; }
.meal-nutri {
  font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.meal-time { font-size: 11px; color: var(--muted); margin-top: 2px; }
.open-nutrition-link {
  display: block; padding: 13px 18px;
  background: rgba(99, 102, 241, 0.12);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  color: var(--accent);
  border: 1px solid rgba(99, 102, 241, 0.30);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  border-radius: var(--radius-sm); text-decoration: none;
  text-align: center; font-weight: 600; margin-bottom: 12px;
}
.open-nutrition-link:hover {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

/* Calendar */
.calendar-embed {
  width: 100%;
  aspect-ratio: 16 / 11;
  min-height: 420px; /* keep it usable on a phone, and stop the iframe
                        collapsing to 0 height on engines without aspect-ratio */
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
}
.calendar-setup {
  padding: 24px 20px;
  background: var(--bg-elev);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.calendar-setup h2 { font-size: 16px; margin: 0 0 12px; }
.calendar-setup ol { padding-left: 18px; margin: 0 0 12px; font-size: 14px; }
.calendar-setup li { margin: 6px 0; }
.calendar-setup code {
  background: var(--bg); padding: 2px 6px; border-radius: 4px;
  font-size: 13px;
}

/* Wealth: revenue log form + recent list */
.revenue-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.revenue-form input, .revenue-form select {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  font-family: inherit;
  font-size: 14px;
}
.revenue-form input[name="note"] {
  grid-column: 1 / -1;
}
.revenue-form button {
  grid-column: 1 / -1;
  padding: 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.revenue-log-list { list-style: none; padding: 0; margin: 12px 0 0; }
.revenue-log-list li {
  display: flex; justify-content: space-between;
  padding: 6px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.revenue-log-list li:last-child { border-bottom: none; }
.revenue-amount { font-weight: 600; }
.revenue-amount.banked { color: var(--pos); }
.revenue-amount.in_motion { color: var(--warn); }
.revenue-note { color: var(--muted); }

/* --- CRM Kanban board (crm.html) ---------------------------------- */
.kanban-hero { padding: 16px; }
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}
@media (max-width: 720px) {
  .kanban-board {
    grid-template-columns: repeat(4, minmax(220px, 1fr));
  }
}
.kanban-col {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 200px;
  overflow: hidden;
}
.kanban-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg, transparent);
}
.kanban-col-name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg);
}
.kanban-col-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--border);
  padding: 2px 8px;
  border-radius: 999px;
}
.kanban-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 80px;
}
.kanban-list.drop-target {
  background: rgba(96, 165, 250, 0.06);
  outline: 2px dashed var(--accent, #60a5fa);
  outline-offset: -4px;
}
.kanban-card {
  background: var(--card-bg, var(--bg));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  cursor: grab;
  user-select: none;
  transition: transform 80ms ease-out, box-shadow 120ms ease-out;
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging {
  opacity: 0.6;
  transform: scale(0.98);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}
.kanban-card-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.kanban-title {
  font-size: 13px;
  line-height: 1.4;
  color: var(--fg);
  flex: 1 1 auto;
}
.kanban-blocker {
  font-size: 11px;
  color: var(--warn);
  margin-top: 6px;
}
.kanban-empty {
  list-style: none;
  font-size: 12px;
  color: var(--muted);
  padding: 6px 4px;
  font-style: italic;
}

/* CRM hub card link (matches calendar card styling) */
.crm-card { padding: 14px; }
.open-crm-link {
  display: inline-block;
  font-weight: 600;
  color: var(--accent, #60a5fa);
  text-decoration: none;
  font-size: 14px;
}
.open-crm-link:hover { text-decoration: underline; }

/* --- Voice journal mic (FAB on home) ------------------------------ */
.voice-fab {
  position: fixed;
  right: 18px;
  bottom: 88px;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: var(--accent, #60a5fa);
  color: white;
  border: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 40;
  transition: transform 120ms ease-out;
}
.voice-fab:hover { transform: translateY(-1px); }
.voice-fab.recording {
  background: var(--neg, #ef4444);
  animation: voice-pulse 1.2s ease-in-out infinite;
}
@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(239, 68, 68, 0.35); }
  50%      { box-shadow: 0 6px 26px rgba(239, 68, 68, 0.75); }
}
.voice-fab svg { width: 22px; height: 22px; }
.voice-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
.voice-modal.open { display: flex; }
.voice-modal-card {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  width: 100%;
  max-width: 520px;
  padding: 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}
.voice-modal h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
}
.voice-modal .voice-state {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.voice-modal textarea {
  width: 100%;
  min-height: 110px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  padding: 10px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  box-sizing: border-box;
}
.voice-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}
.voice-modal-actions button {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.voice-modal-actions button.primary {
  background: var(--accent, #60a5fa);
  color: white;
  border-color: transparent;
}
.voice-modal-actions button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* --- Gemini insights card ----------------------------------------- */
.card.insights .card-title { color: var(--accent, #60a5fa); }
.insights-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
}
.insights-list li {
  padding: 8px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.45;
}
.insights-list li:first-child { border-top: 0; padding-top: 0; }
.insights-meta {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
}
.insights-meta.stale { color: var(--warn); }
.insights-empty {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.insights-refresh {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
}
.insights-refresh:hover { background: var(--border); }
.insights-refresh:disabled { opacity: 0.6; cursor: not-allowed; }

/* Stat band */
.stat-band { margin-bottom: 14px; }

.card.stat {
  padding: 14px 14px;
  display: flex; flex-direction: column;
  gap: 8px;
  min-height: 150px;
}
.stat-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); font-weight: 600;
}
.stat-foot {
  font-size: 12px; color: var(--muted);
}
.stat-foot strong { color: var(--fg); font-weight: 600; }

/* Ring (conic-gradient) */
.ring {
  --ring-pct: 0;
  --ring-color: var(--accent);
  width: 86px; height: 86px;
  border-radius: 50%;
  background: conic-gradient(
    var(--ring-color) calc(var(--ring-pct) * 1%),
    var(--border) calc(var(--ring-pct) * 1%) 100%
  );
  position: relative;
  align-self: center;
}
.ring-inner {
  position: absolute; inset: 7px;
  background: var(--bg-elev);
  border-radius: 50%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  gap: 1px;
}
.ring-value {
  font-size: 19px; font-weight: 700; line-height: 1;
  letter-spacing: -0.02em;
}
.ring-sub {
  font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.05em;
}
.card.stat-kcal .ring { --ring-color: var(--accent); }
.card.stat-protein .ring { --ring-color: var(--warn); }
.card.stat-sleep .ring { --ring-color: var(--pos); }

/* Empty ring (no data) */
.ring.empty {
  background: repeating-conic-gradient(var(--border) 0deg 8deg,
                                       transparent 8deg 16deg);
}
.ring.empty .ring-value { color: var(--muted); font-size: 12px; }

/* Dot grid (habits) */
.dot-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  padding: 8px 0;
}
.dot {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
}
.dot.done {
  background: var(--accent);
  border-color: var(--accent);
}

/* Big value (sprint, MRR, tasks fallback) */
.big-value {
  font-size: 26px; font-weight: 700; letter-spacing: -0.025em;
  line-height: 1;
}
.big-value-sub {
  font-size: 13px; font-weight: 500; color: var(--muted);
  margin-left: 4px;
}

/* Linear progress bar */
.bar {
  height: 6px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.bar-pos .bar-fill { background: var(--pos); }
.bar-warn .bar-fill { background: var(--warn); }

/* Activity feed */
.activity-feed-list { list-style: none; padding: 0; margin: 0; }
.activity-row {
  display: flex; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.activity-row:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px; border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
  background: var(--muted);
}
.activity-dot.meal { background: var(--warn); }
.activity-dot.habit { background: var(--accent); }
.activity-dot.finance { background: var(--pos); }
.activity-dot.biometric { background: #38bdf8; }
.activity-row-text {
  font-size: 14px; line-height: 1.35;
}
.activity-row-time {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-top: 2px;
}

/* ============================================================
   Glass + glow upgrade. Whole-app override layer.
   Appended last so it wins on source order. Base rules above
   stay intact, so this layer can be removed to revert.
   ============================================================ */

:root {
  --glass-bg: rgba(255, 255, 255, 0.62);
  --glass-border: rgba(255, 255, 255, 0.55);
  --glass-hi: rgba(255, 255, 255, 0.95);
  /* Layered light: a tight contact shadow, a soft key light, and a wide
     ambient pool. Reads as a real floating pane instead of one flat blur. */
  --glass-shadow:
    0 1px 1px rgba(15, 23, 42, 0.04),
    0 6px 16px rgba(15, 23, 42, 0.06),
    0 18px 40px rgba(15, 23, 42, 0.07);
  --glass-blur: 20px;
  /* Specular sheen drawn across the top of every glass pane (iOS 26 lensing). */
  --glass-sheen: linear-gradient(
    180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 46%);
  --glow-soft: 0 6px 26px rgba(99, 102, 241, 0.20);
}
:root[data-theme="dark"] {
  --glass-bg: rgba(26, 26, 32, 0.58);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-hi: rgba(255, 255, 255, 0.16);
  --glass-shadow:
    0 1px 1px rgba(0, 0, 0, 0.30),
    0 8px 20px rgba(0, 0, 0, 0.38),
    0 24px 48px rgba(0, 0, 0, 0.40);
  --glass-sheen: linear-gradient(
    180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0) 44%);
  --glow-soft: 0 8px 30px rgba(129, 140, 248, 0.24);
}

/* Backdrop the glass blurs over. Fixed, so it stays put while
   content scrolls. Dark values are the base; light is softened. */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(58% 46% at 14% -2%, rgba(129, 140, 248, 0.22), transparent 72%),
    radial-gradient(48% 38% at 102% 6%, rgba(16, 185, 129, 0.14), transparent 72%),
    radial-gradient(72% 58% at 50% 104%, rgba(99, 102, 241, 0.12), transparent 74%),
    var(--bg);
}
:root:not([data-theme="dark"]) body::before {
  background:
    radial-gradient(58% 46% at 14% -2%, rgba(99, 102, 241, 0.12), transparent 72%),
    radial-gradient(48% 38% at 102% 6%, rgba(16, 185, 129, 0.08), transparent 72%),
    radial-gradient(72% 58% at 50% 104%, rgba(99, 102, 241, 0.07), transparent 74%),
    var(--bg);
}
/* The fixed ::before only covers the viewport, so the html canvas must
   carry the theme colour or content past the first screen sits on white. */
html { background: var(--bg); }
body { background: transparent; }

/* Frosted cards with a top-edge highlight and soft lift on load. */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-hi);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  backdrop-filter: blur(var(--glass-blur)) saturate(150%);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  animation: glass-rise 0.4s ease both;
}
.card:active { transform: scale(0.992); }
@keyframes glass-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* Frosted navigation. */
.tab-bar {
  background: var(--glass-bg);
  border-top: 1px solid var(--glass-border);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.18);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
}
.top-nav {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-hi);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
  /* Clip the backdrop blur to the rounded shape and give the pills a clean
     stacking context. Safari otherwise leaks the rectangular blur past the
     rounded corner, which reads as a faint second pill. */
  overflow: hidden;
  isolation: isolate;
}
.tab-bar .tab[aria-current="page"] .tab-icon {
  filter: drop-shadow(0 0 6px var(--accent));
}
.top-nav .tab[aria-current="page"] {
  box-shadow: none;
}

/* Glass toggle + glassy inputs. */
.theme-toggle {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  backdrop-filter: blur(12px) saturate(150%);
  transition: transform 0.12s ease;
}
.theme-toggle:active { transform: scale(0.96); }

/* Rings glow in their own metric colour. */
.ring {
  filter: drop-shadow(0 0 7px var(--ring-color, var(--accent)));
}
.ring-inner {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  backdrop-filter: blur(8px) saturate(140%);
  box-shadow: inset 0 1px 0 var(--glass-hi);
}

/* Progress bars get a gradient fill and a glow. */
.bar { background: rgba(127, 127, 127, 0.18); }
.bar-fill {
  background: linear-gradient(90deg, var(--accent), #a5b4fc);
  box-shadow: 0 0 10px rgba(129, 140, 248, 0.55);
}
.bar-pos .bar-fill {
  background: linear-gradient(90deg, var(--pos), #6ee7b7);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}
.bar-warn .bar-fill {
  background: linear-gradient(90deg, var(--warn), #fcd34d);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

/* Buttons: press feedback everywhere, glow on the primary action. */
button { transition: transform 0.12s ease, box-shadow 0.12s ease; }
button:active { transform: scale(0.97); }
.login-form button {
  box-shadow: 0 6px 22px rgba(99, 102, 241, 0.45);
}
.login-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-hi);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
}

/* Login screen shell + fields. The login page is hand-authored and uses
   these classes, so they must be defined here or the sign-in screen reads
   unstyled: uncentred shell, default-serif title, browser-default field,
   and an error that inherits body colour instead of the danger red. */
.login-body, .login-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-title { font-size: 24px; font-weight: 700; margin: 0; }
.login-sub { color: var(--muted); font-size: 14px; }
.login-form {
  display: flex; flex-direction: column; gap: 10px; margin-top: 16px;
}
.login-form input {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--fg); font-family: inherit;
  font-size: 16px; /* >=16px stops iOS zooming the field on focus */
}
.login-error { color: var(--neg); font-size: 13px; margin-top: 12px; }

/* Passkey (Touch ID / Face ID) controls on the login card. */
.login-bio {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 16px; margin-bottom: 14px;
  font-size: 15px; font-weight: 600;
  color: #fff; cursor: pointer;
  border: none; border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--accent), #4f46e5);
  box-shadow: 0 6px 22px rgba(99, 102, 241, 0.45);
}
.login-bio-icon { font-size: 17px; line-height: 1; }
.login-enrol { margin-top: 14px; text-align: center; }
.login-enrol-row { display: flex; gap: 10px; margin-top: 8px; }
.login-enrol-row button {
  flex: 1; padding: 11px 14px; font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; border-radius: var(--radius-sm);
  color: #fff;
  background: linear-gradient(180deg, var(--accent), #4f46e5);
  box-shadow: 0 6px 22px rgba(99, 102, 241, 0.45);
}
.login-enrol-row .login-ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); box-shadow: none;
}

/* Truncation note under a capped list. */
.more-note {
  font-size: 12px; color: var(--muted);
  margin-top: 8px; font-style: italic;
}

/* Honour reduced-motion: drop the entrance animation and presses. */
@media (prefers-reduced-motion: reduce) {
  .card { animation: none; }
  .card:active, .theme-toggle:active, button:active { transform: none; }
}

/* Older engines without backdrop-filter fall back to a solid elevated
   surface so glass never reads as washed-out transparency. */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .card, .tab-bar, .top-nav, .theme-toggle, .login-card, .ring-inner {
    background: var(--bg-elev);
  }
}

/* ============================================================
   Roadmap page: milestone timeline, path, daily engine.
   ============================================================ */
.roadmap-gate { display: flex; flex-direction: column; gap: 6px; }
.bet-line { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.gate-line { font-size: 13px; color: var(--muted); }
.gate-line strong { color: var(--warn); }

.rm-track { list-style: none; margin: 0; padding: 0; }
.rm-node { position: relative; padding: 0 0 18px 22px; }
.rm-node:last-child { padding-bottom: 0; }
.rm-node:not(:last-child)::before {
  content: ""; position: absolute; left: 5px; top: 14px; bottom: 0;
  width: 2px; background: var(--border);
}
.rm-dot {
  position: absolute; left: 0; top: 3px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
}
.rm-node.green .rm-dot { background: var(--pos); box-shadow: 0 0 8px var(--pos); }
.rm-node.amber .rm-dot { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.rm-node.red .rm-dot { background: var(--neg); box-shadow: 0 0 8px var(--neg); }
.rm-node.moonshot .rm-dot { background: #a855f7; box-shadow: 0 0 11px #a855f7; }

.rm-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.rm-window {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted);
}
.rm-pill {
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
}
.rm-pill.green { background: rgba(16, 185, 129, 0.18); color: var(--pos); }
.rm-pill.amber { background: rgba(245, 158, 11, 0.18); color: var(--warn); }
.rm-pill.red { background: rgba(239, 68, 68, 0.18); color: var(--neg); }
.rm-pill.moonshot { background: rgba(168, 85, 247, 0.20); color: #c084fc; }
.rm-pill.tracking { background: rgba(127, 127, 127, 0.18); color: var(--muted); }

.rm-target { font-size: 16px; font-weight: 700; margin-top: 3px; letter-spacing: -0.01em; }
.rm-current { font-size: 13px; color: var(--muted); margin-top: 1px; }
.rm-node .bar { margin-top: 8px; }
.rm-when { display: inline-block; margin-top: 6px; font-size: 11px; color: var(--muted); }

.path-list { margin: 0; padding-left: 18px; }
.path-step { margin-bottom: 12px; font-size: 14px; line-height: 1.4; }
.path-step:last-child { margin-bottom: 0; }
.path-when {
  display: block; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--accent); font-weight: 700;
}

.engine-note { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.engine-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 12px; padding: 6px 12px; border-radius: 999px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}

/* ============================================================
   Campaigns page: per-client health, steps, guardrails.
   ============================================================ */
.camp-summary-row { display: flex; gap: 10px; flex-wrap: wrap; }
.camp-stat {
  font-size: 13px; color: var(--muted);
  display: inline-flex; align-items: baseline; gap: 5px;
}
.camp-stat b { font-size: 17px; font-weight: 700; }
.camp-stat.green b { color: var(--pos); }
.camp-stat.amber b { color: var(--warn); }
.camp-stat.red b { color: var(--neg); }

.card.campaign { border-left: 3px solid var(--border); }
.card.campaign.green { border-left-color: var(--pos); }
.card.campaign.amber { border-left-color: var(--warn); }
.card.campaign.red { border-left-color: var(--neg); }

.camp-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.camp-name { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.camp-sub { font-size: 12px; font-weight: 500; color: var(--muted); }
.camp-pill {
  font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
}
.camp-pill.green { background: rgba(16, 185, 129, 0.18); color: var(--pos); }
.camp-pill.amber { background: rgba(245, 158, 11, 0.18); color: var(--warn); }
.camp-pill.red { background: rgba(239, 68, 68, 0.18); color: var(--neg); }
.camp-pill.tracking { background: rgba(127, 127, 127, 0.18); color: var(--muted); }

.camp-field {
  font-size: 13px; line-height: 1.45; padding: 3px 0;
  border-bottom: 1px solid var(--border);
}
.camp-field:last-of-type { border-bottom: none; }
.camp-field span {
  display: inline-block; min-width: 84px; color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
}
.camp-step-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent); font-weight: 700; margin: 12px 0 6px;
}
.camp-steps { margin: 0; padding-left: 18px; }
.camp-steps li { font-size: 14px; line-height: 1.4; margin-bottom: 4px; }
.camp-guard {
  margin-top: 12px; padding: 8px 10px; border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.10); color: var(--warn);
  font-size: 12px; line-height: 1.4;
}
.camp-guard-list { margin: 0; padding-left: 18px; }
.camp-guard-list li { font-size: 13px; line-height: 1.4; margin-bottom: 5px; color: var(--muted); }

/* Campaign performance metrics (appear once lead/reply data flows in). */
.camp-metrics { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.camp-metric {
  flex: 1 1 auto; min-width: 82px; padding: 8px 11px;
  border-radius: var(--radius-sm);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
}
.camp-metric-val { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.camp-metric-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); margin-top: 2px;
}

/* Comms freshness: last email / WhatsApp, awaiting reply, follow-up due. */
.camp-comm-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); font-weight: 700; margin: 12px 0 6px;
}
.camp-comms { display: flex; flex-direction: column; gap: 4px; }
.camp-comm {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 13px; padding: 5px 9px; border-radius: var(--radius-sm);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-left: 3px solid var(--muted);
}
.camp-comm.email { border-left-color: #38bdf8; }
.camp-comm.whatsapp { border-left-color: var(--pos); }
.camp-comm.contact { border-left-color: var(--accent); }
.camp-comm.hot {
  border-left-color: var(--warn);
  background: rgba(245, 158, 11, 0.10);
}
.camp-comm-label {
  min-width: 92px; color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
}
.camp-comm-val { color: var(--fg); }
.camp-comm.hot .camp-comm-val { color: var(--warn); font-weight: 600; }

/* What you said: recent bot/voice mentions for a client. Compact. */
.camp-said { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.camp-said-item {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-size: 13px; padding: 5px 9px; border-radius: var(--radius-sm);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
}
.camp-said-text { color: var(--fg); flex: 1; min-width: 0; }
.camp-said-meta { display: flex; align-items: baseline; gap: 6px; flex-shrink: 0; }
.camp-said-time { color: var(--muted); font-size: 11px; }
.camp-said-tag {
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 1px 6px; border-radius: 999px;
  background: rgba(129,140,248,0.15); color: var(--accent); font-weight: 600;
}

/* Clients page comms feed: per-client strip of email, WhatsApp, said. */
.client-comms-list { list-style: none; padding: 0; margin: 0; }
.client-comms-list li {
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.client-comms-list li:last-child { border-bottom: none; }
.client-comms-name { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.client-comms-line {
  font-size: 13px; color: var(--muted); margin-top: 3px;
  padding-left: 9px; border-left: 2px solid var(--border);
}
.client-comms-line.email { border-left-color: #38bdf8; }
.client-comms-line.whatsapp { border-left-color: var(--pos); }
.client-comms-line.said { color: var(--fg); border-left-color: var(--accent); }
.client-comms-time { color: var(--muted); font-size: 11px; margin-left: 6px; }

/* Leads Outreach dashboard: hero, campaign rows, status dot, sparkline, badge.
   Reuses .card.campaign for the glass + status border; adds only the dot,
   sparkline, source badge, as-of tag and hero strip. */
.camp-hero { padding: 14px 16px; }
.camp-hero-row { display: flex; gap: 20px; flex-wrap: wrap; }
.camp-hero-stat { flex: 1 1 auto; min-width: 110px; }
.camp-hero-num { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.05; }
.camp-hero-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); margin-top: 3px;
}
.camp-hero-week {
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--muted);
}

.camp-group-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 700; margin: 18px 4px 8px;
}

/* The whole row is a tap target to /c/<slug>; no underline, inherit colour. */
a.camp-row, a.camp-row:visited { color: var(--fg); text-decoration: none; display: block; }
a.camp-row:active { transform: scale(0.997); }

.camp-row-top {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.camp-dot {
  flex-shrink: 0; width: 11px; height: 11px; border-radius: 999px;
  background: var(--muted); box-shadow: 0 0 0 3px rgba(127,127,127,0.14);
}
.camp-dot.green { background: var(--pos); box-shadow: 0 0 0 3px rgba(16,185,129,0.18); }
.camp-dot.amber { background: var(--warn); box-shadow: 0 0 0 3px rgba(245,158,11,0.18); }
.camp-dot.red { background: var(--neg); box-shadow: 0 0 0 3px rgba(239,68,68,0.18); }
.camp-dot.idle { background: var(--muted); box-shadow: 0 0 0 3px rgba(127,127,127,0.14); }
.camp-dot.paused { background: var(--muted); box-shadow: 0 0 0 3px rgba(127,127,127,0.10); opacity: 0.55; }
.camp-row.paused { opacity: 0.6; }

.camp-row-name {
  flex: 1; min-width: 0; font-size: 16px; font-weight: 700;
  letter-spacing: -0.01em; display: flex; align-items: center;
  gap: 8px; flex-wrap: wrap;
}
.camp-badge {
  font-size: 10px; font-weight: 600; color: var(--muted);
  padding: 2px 7px; border-radius: 999px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  text-transform: none; letter-spacing: 0; white-space: nowrap;
}
.camp-tag {
  font-size: 10px; font-weight: 600; color: var(--muted);
  padding: 2px 7px; border-radius: 999px;
  background: rgba(127,127,127,0.14); white-space: nowrap;
}
.camp-tag.warn { background: rgba(245,158,11,0.16); color: var(--warn); }

.camp-row-sent { text-align: right; flex-shrink: 0; }
.camp-row-sent-num { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.camp-row-sent-label {
  display: block; font-size: 9px; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted); margin-top: 2px;
}

.camp-row-spark { margin: 4px 0 10px; }
.camp-spark { display: block; width: 100%; height: 24px; }
.camp-spark rect { fill: var(--muted); opacity: 0.55; }
.camp-spark.green rect { fill: var(--pos); opacity: 0.7; }
.camp-spark.amber rect { fill: var(--warn); opacity: 0.7; }
.camp-spark.red rect { fill: var(--neg); opacity: 0.6; }

.camp-reason { font-size: 12px; color: var(--muted); margin-top: 8px; }
.camp-overlay-phase {
  font-size: 13px; line-height: 1.45; margin-top: 8px;
  padding-top: 8px; border-top: 1px solid var(--border);
}
.camp-overlay-phase span {
  display: inline-block; min-width: 56px; color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
}
.camp-empty { text-align: center; }

/* Lemlist mini-detail page (/c/<slug>): reuse glass cards, light extra. */
.camp-detail-back { font-size: 13px; color: var(--accent); text-decoration: none; }
.camp-detail-series { list-style: none; padding: 0; margin: 10px 0 0; }
.camp-detail-series li {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--border);
}
.camp-detail-series li:last-child { border-bottom: none; }

/* Roadmap probability line. Banded by likelihood. */
.rm-prob {
  display: inline-block; margin-top: 6px;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.02em;
  padding: 2px 8px; border-radius: 999px;
}
.rm-prob.green { background: rgba(16, 185, 129, 0.18); color: var(--pos); }
.rm-prob.amber { background: rgba(245, 158, 11, 0.18); color: var(--warn); }
.rm-prob.red { background: rgba(239, 68, 68, 0.18); color: var(--neg); }
.rm-prob-caption {
  margin-top: 12px; font-size: 11px; color: var(--muted); line-height: 1.4;
}

/* Days page. Contribution score, history bars, per-day rows. */
.contrib-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 26px; padding: 0 9px;
  font-size: 14px; font-weight: 700; border-radius: 999px;
  letter-spacing: -0.01em;
}
.contrib-pill.green { background: rgba(16, 185, 129, 0.18); color: var(--pos); }
.contrib-pill.amber { background: rgba(245, 158, 11, 0.18); color: var(--warn); }
.contrib-pill.muted { background: rgba(127, 127, 127, 0.16); color: var(--muted); }

.day-today-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 8px;
}
.day-today-head .card-title { margin-bottom: 0; }
.day-today-date { font-size: 13px; color: var(--muted); }
.day-auto { font-size: 14px; line-height: 1.45; margin-bottom: 12px; }

.day-score-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.day-score-bar { flex: 1 1 auto; min-width: 0; }
.day-score-bar .bar { margin-bottom: 6px; }
.day-score-split { font-size: 11px; color: var(--muted); }

#day-note {
  width: 100%; min-height: 70px; resize: vertical;
  font-family: inherit; font-size: 14px; line-height: 1.45;
  color: var(--fg); padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
#day-note::placeholder { color: var(--muted); }
.day-note-actions {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 12px; margin-top: 10px;
}
.day-note-status { font-size: 12px; color: var(--muted); margin-right: auto; }
.day-note-save {
  appearance: none; cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 600;
  padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--pos); background: var(--pos); color: #0a0a0a;
}
.day-note-save:disabled { opacity: 0.55; cursor: default; }

/* Log a past day: date picker, dictation mic, backfill note. */
.day-backfill-sub { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.day-backfill-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
#backfill-date {
  flex: 1 1 auto; font-family: inherit; font-size: 15px;
  color: var(--fg); padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
#backfill-note {
  width: 100%; min-height: 70px; resize: vertical;
  font-family: inherit; font-size: 14px; line-height: 1.45;
  color: var(--fg); padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
#backfill-note::placeholder { color: var(--muted); }
.day-mic {
  appearance: none; cursor: pointer; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 999px;
  color: var(--fg); background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: transform 0.12s ease, box-shadow 0.12s ease, color 0.12s ease;
}
.day-mic:active { transform: scale(0.94); }
.day-mic.recording {
  color: var(--neg); border-color: var(--neg);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.18);
  animation: mic-pulse 1.1s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16); }
  50% { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0.06); }
}
@media (prefers-reduced-motion: reduce) {
  .day-mic.recording { animation: none; }
}

/* Seven vertical bars, one per day, height proportional to score. */
.contrib-bars {
  display: flex; align-items: flex-end; gap: 8px;
  height: 90px; padding-top: 4px;
}
.contrib-bar {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; height: 100%; gap: 4px;
}
.contrib-bar-fill {
  width: 70%; max-width: 22px; border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--accent), rgba(99, 102, 241, 0.35));
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.35);
  transition: height 0.3s ease;
}
.contrib-bar.today .contrib-bar-fill {
  background: linear-gradient(180deg, var(--pos), rgba(16, 185, 129, 0.4));
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.45);
}
.contrib-bar-score { font-size: 10px; color: var(--muted); font-weight: 600; }
.contrib-bar-label {
  font-size: 11px; color: var(--muted); font-weight: 600;
}
.contrib-bar.today .contrib-bar-label { color: var(--pos); }

.day-row .day-row-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 6px;
}
.day-row-date { font-size: 14px; font-weight: 600; }
.day-block-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 700; margin: 8px 0 4px;
}
.day-said ul { margin: 0; padding-left: 18px; }
.day-said li { font-size: 13px; line-height: 1.4; color: var(--fg); }
.day-claude {
  margin-top: 4px; padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
}
.day-claude-text { font-size: 12px; line-height: 1.45; color: var(--muted); }
.day-note-shown {
  margin-top: 8px; font-size: 13px; font-style: italic; color: var(--muted);
}

/* Command center bento (Phase 3, additive) */
.bento-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}
@media(max-width:1024px){.bento-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:560px){.bento-grid{grid-template-columns:1fr}}
.bento-tile{background:var(--glass-bg);border:1px solid var(--glass-border);
 border-radius:18px;padding:16px 18px;backdrop-filter:blur(16px) saturate(150%);
 box-shadow:var(--glass-shadow);display:flex;flex-direction:column;gap:8px;min-height:0}
.b-2{grid-column:span 2}.b-3{grid-column:span 3}.b-4{grid-column:1/-1}
.b-tall{grid-row:span 2}
@media(max-width:560px){.b-2,.b-3,.b-4{grid-column:1/-1}}
.bento-tile.acc-wealth{background:linear-gradient(180deg,rgba(16,185,129,.10),var(--glass-bg))}
.bento-tile.acc-clients{background:linear-gradient(180deg,rgba(96,165,250,.10),var(--glass-bg))}
.bento-tile.acc-health{background:linear-gradient(180deg,rgba(245,158,11,.10),var(--glass-bg))}
.bento-tile.acc-system{background:linear-gradient(180deg,rgba(129,140,248,.12),var(--glass-bg))}
.bento-k{font-size:11px;text-transform:uppercase;letter-spacing:.1em;color:var(--muted);font-weight:600}
.bento-big{font-size:26px;font-weight:700;line-height:1.1}
.bento-jump{display:flex;flex-wrap:wrap;gap:6px}
.bento-jump a{font-size:12px;padding:5px 10px;border:1px solid var(--border);border-radius:999px;text-decoration:none;color:var(--fg)}

/* ============================================================
   LIQUID GLASS v2 — iOS 26 refinement pass (2026-06-14).
   Appended last so it wins on source order. Refines material,
   motion and depth only; no structural class is renamed, so the
   whole block can be deleted to revert to the v1 glass layer.
   ============================================================ */

/* Momentum scroll, smooth in-page jumps, crisper text, tidy selection. */
html { scroll-behavior: smooth; }
body { -webkit-overflow-scrolling: touch; text-rendering: optimizeLegibility; }
::selection { background: color-mix(in srgb, var(--accent) 26%, transparent); }

/* Tighter optical tracking on display text for an SF-Pro feel. */
header.app-head h1, .hero-value, .big-value, .bento-big,
.ring-value, .camp-hero-num, .camp-row-sent-num {
  letter-spacing: -0.022em;
}

/* --- Glass material: specular sheen + layered depth + spring ----- */
/* The sheen is layered as a background-image OVER the translucent fill
   (it sits on top of the backdrop blur and fades to transparent), so it
   only lifts the top edge. No pseudo-elements, so nothing inside a card
   shifts position. */
.card, .bento-tile, .login-card {
  background-image: var(--glass-sheen);
  background-repeat: no-repeat;
  border-radius: 20px;
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-hi);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(170%);
  backdrop-filter: blur(var(--glass-blur)) saturate(170%);
  transition:
    transform var(--dur) var(--ease-spring),
    box-shadow var(--dur) var(--ease-out);
}
/* Keep the translucent fill under the sheen (two-layer background). */
.card { background-color: var(--glass-bg); }
/* Springy settle on press, replacing the v1 linear scale. */
.card:active { transform: scale(0.985); }

/* Desktop pointer: a gentle, tangible hover lift. */
@media (hover: hover) and (min-width: 1024px) {
  .cards-grid > .card:hover, .bento-tile:hover {
    transform: translateY(-2px);
    box-shadow:
      0 2px 4px rgba(15, 23, 42, 0.05),
      0 14px 30px rgba(15, 23, 42, 0.10),
      0 30px 60px rgba(15, 23, 42, 0.08),
      inset 0 1px 0 var(--glass-hi);
  }
}

/* Springier entrance rise. Redefines the v1 keyframe (last wins). */
@keyframes glass-rise {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: none; }
}
.card { animation: glass-rise var(--dur-slow) var(--ease-out) both; }

/* --- Navigation: richer glass + spring taps --------------------- */
.tab-bar, .top-nav {
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  backdrop-filter: blur(28px) saturate(190%);
  background-image: var(--glass-sheen);
  background-repeat: no-repeat;
}
.tab-bar .tab { transition: color var(--dur) var(--ease-out); }
.top-nav .tab {
  transition: background-color var(--dur) var(--ease-out),
              color var(--dur) var(--ease-out),
              transform var(--dur-fast) var(--ease-spring);
}
.top-nav .tab:active { transform: scale(0.96); }

/* --- Controls: springy buttons + accent-ring focus on inputs ---- */
button, .theme-toggle {
  transition: transform var(--dur-fast) var(--ease-spring),
              box-shadow var(--dur) var(--ease-out),
              filter var(--dur) var(--ease-out);
}
button:active, .theme-toggle:active { transform: scale(0.95); }

input, textarea, select {
  transition: border-color var(--dur) var(--ease-out),
              box-shadow var(--dur) var(--ease-out);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--glass-border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

/* Crisper hairlines on retina list rows. */
@media (min-resolution: 2dppx) {
  .task-list li, .routine-item, .meal-list li, .activity-row,
  .client-list li, .revenue-log-list li, .theme-list li,
  .activity-feed-list .activity-row {
    border-bottom-width: 0.5px;
  }
}

/* Pills/chips: spring tap. */
.bento-jump a, .chip {
  transition: transform var(--dur-fast) var(--ease-spring),
              background-color var(--dur) var(--ease-out);
}
.bento-jump a:active, .chip:active { transform: scale(0.94); }

/* Honour reduced-motion across the whole v2 layer. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .bento-tile, .login-card, .tab-bar .tab, .top-nav .tab,
  button, .theme-toggle, .bento-jump a, .chip,
  input, textarea, select { transition: none; }
  .card { animation: none; }
  .cards-grid > .card:hover, .bento-tile:hover { transform: none; }
}

/* ============================================================
   Global quick capture (Cmd/Ctrl+J). A FAB + modal injected on
   every page by theme.js so a task/note/quote/journal/idea can be
   logged again and again from anywhere. Styles only; behaviour in
   theme.js. Revertible by deleting this block + the capture IIFE.
   ============================================================ */
.cap-fab {
  position: fixed; right: 18px;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 22px);
  width: 56px; height: 56px; border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: linear-gradient(180deg, var(--accent), #4f46e5);
  color: #fff; font-size: 30px; font-weight: 300; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45), inset 0 1px 0 var(--glass-hi);
  cursor: pointer; z-index: 45;
  transition: transform var(--dur-fast, .14s) var(--ease-spring, ease),
              box-shadow var(--dur, .24s) ease;
}
.cap-fab:hover { transform: translateY(-2px); }
.cap-fab:active { transform: scale(0.92); }
/* When the home voice mic is present, lift the capture FAB above it. */
.cap-fab--stacked {
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 86px);
}
@media (min-width: 1024px) {
  .cap-fab { bottom: 28px; }
  .cap-fab--stacked { bottom: 96px; }
}
.cap-modal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: flex-start; justify-content: center;
  padding: max(11vh, 56px) 16px 16px;
  background: rgba(10, 12, 20, 0.45);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur, .24s) ease;
}
.cap-modal.open { opacity: 1; pointer-events: auto; }
.cap-card {
  width: 100%; max-width: 540px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: 22px; padding: 16px;
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-hi);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  transform: translateY(-10px) scale(0.98);
  transition: transform var(--dur, .24s) var(--ease-spring, ease);
}
.cap-modal.open .cap-card { transform: none; }
.cap-seg { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.cap-seg button {
  font-size: 0.8rem; font-weight: 600; padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  cursor: pointer; font-family: inherit;
  transition: background-color var(--dur-fast, .14s) ease, color var(--dur-fast, .14s) ease;
}
.cap-seg button.is-on {
  background: color-mix(in srgb, var(--accent) 16%, var(--bg-elev));
  color: var(--accent); border-color: transparent;
}
.cap-input {
  width: 100%; box-sizing: border-box; min-height: 64px; resize: vertical;
  font-family: inherit; font-size: 1.05rem; line-height: 1.45;
  padding: 12px 14px; border-radius: 14px; color: var(--fg);
  background: var(--bg); border: 1px solid var(--glass-border);
}
.cap-input::placeholder { color: var(--muted); }
.cap-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 10px;
}
.cap-status { font-size: 0.84rem; color: var(--pos); min-height: 1.2em; }
.cap-status.error { color: var(--neg); }
.cap-save {
  font-size: 0.92rem; font-weight: 600; padding: 9px 20px; border-radius: 999px;
  border: none; background: var(--accent); color: #fff; cursor: pointer;
  font-family: inherit;
}
.cap-save:disabled { opacity: 0.55; cursor: default; }
.cap-hint { font-size: 0.72rem; color: var(--muted); margin-top: 10px; text-align: center; }
@media (prefers-reduced-motion: reduce) {
  .cap-fab, .cap-modal, .cap-card { transition: none; }
}

/* --- Today rail: Slipping + Resurfacing cards (plan.html) ----------- */
.card.slipping { border-left: 3px solid var(--warn); }
.slip-list { list-style: none; margin: 0; padding: 0; }
.slip-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.slip-row:last-child { border-bottom: none; }
.slip-title { font-size: 0.95rem; }
.slip-badge {
  flex-shrink: 0; font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 2px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn);
}
.card.resurfacing { border-left: 3px solid var(--accent); }
.resurf-body { font-size: 1.02rem; line-height: 1.5; font-style: italic; }
.resurf-meta { margin-top: 8px; font-size: 0.78rem; }
.resurf-kind {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent);
}
.card.people-today { border-left: 3px solid var(--pos); }
.ppl-list { list-style: none; margin: 0; padding: 0; }
.ppl-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.ppl-row:last-child { border-bottom: none; }
.ppl-name { font-size: 0.95rem; }
.ppl-badge {
  flex-shrink: 0; font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 2px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn);
}
.ppl-badge.bday {
  background: color-mix(in srgb, var(--pos) 16%, transparent); color: var(--pos);
}

/* ==========================================================================
   Standalone-app feel. Small touches so the phone app reads as a native app
   installed to the home screen, not a web page in a browser. The look is
   unchanged; these only affect scroll/zoom behaviour and how the extra Outbox
   tab lays out. Added 2026-07-18.
   ========================================================================== */

/* Stop iOS reflowing text to its own size, and kill the whole-page rubber-band
   bounce at the scroll edges (the tell-tale "this is a web page" wobble). The
   content still scrolls; only the overscroll chain to the document stops. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overscroll-behavior-y: none; }

/* The bottom bar now carries a 7th tab (Outbox) on the fuller pages. Tabs are
   flex: 1 so they still divide evenly; on narrow phones trim the padding and
   ease the label down a touch so nothing clips or wraps. */
@media (max-width: 400px) {
  .tab-bar .tab { padding: 8px 1px; gap: 1px; }
  .tab-bar .tab .tab-label { font-size: 9px; letter-spacing: 0; }
  .tab-bar .tab .tab-icon { width: 19px; height: 19px; }
}

/* ==========================================================================
   Nutrition hero: calorie ring (donut) + macro legend. Added 2026-08-01.
   ========================================================================== */
.macro-ring-wrap { position: relative; display: flex; align-items: center;
  gap: 18px; margin: 6px 0 14px; flex-wrap: wrap; }
.macro-ring { width: 120px; height: 120px; flex-shrink: 0; }
.macro-ring-centre { position: absolute; width: 120px; text-align: center;
  pointer-events: none; }
.macro-ring-centre .num { font-size: 1.8rem; font-weight: 700;
  line-height: 1.1; }
.macro-ring-unit { font-size: 0.8rem; color: var(--muted); }
.ring-legend { display: flex; flex-direction: column; gap: 8px; flex: 1 1 140px; }
.ring-legend-row { display: flex; align-items: center; gap: 9px;
  font-size: 0.95rem; }
.ring-dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.ring-label { color: var(--muted); }
.ring-legend .ring-value { margin-left: auto; font-weight: 600; }

/* ==========================================================================
   Habit log card: derived rows (built from gym/meal/weight evidence, not a
   habit tick). Added 2026-08-02.
   ========================================================================== */
.activity-derived { font-size: 11px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 1px 6px; margin-left: 6px; }
.activity-detail { font-size: 12px; color: var(--muted); margin-left: 6px; }
