/* Kairos Web UI — Gallery-premium editorial (Demo)
   Cooler bone · near-black ink · black-red tip · quiet sage.
   Museum restraint; tip only as live punctuation. Structure unchanged.
*/

:root {
  /* Gallery-premium: cooler bone, tighter ink */
  --paper: #f6f5f2;
  --paper-2: #eceae5;
  --sheet: #fafaf8;
  --ink: #141312;
  --ink-soft: #56524c;
  --ink-mute: #8a857c;
  --seize: #7a1a22;

  --mist: var(--paper);
  --mist-2: var(--paper-2);
  --veil: var(--sheet);
  --plinth: var(--sheet);
  --bone: var(--paper);
  --indigo: #242220;
  --obsidian: #0e0d0c;
  --copper: var(--ink);
  --copper-bright: #242220;
  --copper-deep: #0e0d0c;
  --copper-soft: rgba(20, 19, 18, 0.06);
  --now: var(--ink);
  --observed: #3a6554;

  --bg: var(--paper);
  --surface: var(--sheet);
  --surface-2: var(--paper-2);
  --text: var(--ink);
  --text-2: var(--ink-soft);
  --text-3: #6e6a63;
  --accent: var(--ink);
  --accent-soft: rgba(20, 19, 18, 0.06);
  --success: var(--observed);
  --warning: #7a6528;
  --danger: #7a1a22;
  --border: rgba(20, 19, 18, 0.09);
  --hairline: rgba(20, 19, 18, 0.09);
  --radius: 12px;
  --radius-sm: 8px;
  /* Elevation = surface shift, not soft clay */
  --ground: none;
  --ground-sm: none;
  --channel: inset 0 0 0 1px var(--hairline);
  --press: inset 0 1px 2px rgba(20, 19, 18, 0.08);
  --shadow-raised: none;
  --shadow-raised-sm: none;
  --shadow-inset: var(--channel);
  --shadow-inset-sm: var(--channel);
  --shadow: none;
  --shadow-lg: none;
  --neu-dark: #d2d0ca;
  --neu-light: #fafaf8;
  --font: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Instrument Serif", "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --transition: 0.22s cubic-bezier(0.22, 1, 0.36, 1);

  /* Layout rhythm — tidy desktop journal, not magazine voids */
  --space-row: 0.65rem;
  --space-block: 1.15rem;
  --space-section: 1.75rem;
  --page-gutter: clamp(24px, 3.5vw, 48px);
  --page-max: 1220px;
}

body.dark {
  --paper: #121110;
  --paper-2: #181716;
  --sheet: #1a1917;
  --ink: #f3f1ec;
  --ink-soft: #a49f96;
  --ink-mute: #6a655e;
  --seize: #c44d58;
  --mist: var(--paper);
  --mist-2: var(--paper-2);
  --veil: var(--sheet);
  --plinth: var(--sheet);
  --bone: var(--paper);
  --indigo: #d2d0ca;
  --obsidian: #080807;
  --copper: var(--ink);
  --copper-bright: #ffffff;
  --copper-deep: #d2d0ca;
  --copper-soft: rgba(243, 241, 236, 0.08);
  --now: var(--ink);
  --observed: #64967e;
  --bg: #0c0b0a;
  --surface: var(--sheet);
  --surface-2: var(--paper-2);
  --text: var(--ink);
  --text-2: var(--ink-soft);
  --text-3: #b4afa6;
  --accent: var(--ink);
  --accent-soft: rgba(243, 241, 236, 0.08);
  --success: var(--observed);
  --warning: #b89650;
  --danger: #c44d58;
  --border: rgba(243, 241, 236, 0.1);
  --hairline: rgba(243, 241, 236, 0.1);
  --channel: inset 0 0 0 1px var(--hairline);
  --press: inset 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: none;
  --shadow-lg: none;
  --ground: none;
  --ground-sm: none;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}

::selection {
  background: rgba(185, 28, 44, 0.18);
}

body.dark ::selection {
  background: rgba(199, 58, 72, 0.28);
}

.hidden { display: none !important; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 400;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 6px;
}
.skip-link:focus {
  left: 8px;
}

/* ── Top bar ─────────────────────────────────────────── */

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--top-bar-height, 56px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 var(--page-gutter);
  background: var(--bg);
  color: var(--text);
  backdrop-filter: none;
  border-bottom: none;
  box-shadow: var(--ground-sm);
  z-index: 100;
}
.top-bar::before, .top-bar::after { display: none; }

body.in-app-chrome {
  --titlebar-pad-top: 28px;
  --top-bar-height: calc(56px + var(--titlebar-pad-top));
  --traffic-light-inset: 78px;
}
body.in-app-chrome .top-bar {
  height: var(--top-bar-height);
  padding-top: var(--titlebar-pad-top);
  padding-left: max(calc(var(--traffic-light-inset) + 10px), var(--page-gutter));
  padding-right: var(--page-gutter);
  background: var(--bg);
  backdrop-filter: none;
  align-items: center;
  box-sizing: border-box;
}
body.in-app-chrome .top-bar-right { gap: 6px; padding-right: 2px; }
body.in-app-chrome .content { top: var(--top-bar-height); }

.top-bar-left { display: flex; align-items: center; justify-self: start; }
.top-bar-center {
  display: flex;
  gap: 2px;
  justify-self: center;
  background: var(--bg);
  padding: 4px;
  border-radius: 999px;
  border: none;
  box-shadow: var(--shadow-inset-sm);
}
.top-bar-right { display: flex; gap: 4px; align-items: center; justify-self: end; }

.tab-btn {
  padding: 7px 16px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.tab-btn:hover:not(:disabled) { color: var(--text); }
.tab-btn.active {
  color: var(--copper, var(--now));
  background: var(--bg);
  box-shadow: var(--shadow-raised-sm);
}
body.dark .tab-btn.active {
  color: var(--copper, var(--now));
  background: var(--bg);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--text);
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font: inherit;
  border-radius: 4px;
  transition: color 0.12s ease, opacity 0.12s ease;
}
.brand:hover {
  color: var(--ink-soft);
  opacity: 0.82;
}
.brand-mark {
  flex-shrink: 0;
  color: var(--text);
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}
.brand-mark svg { opacity: 1; }
.brand-name, .logo {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--text);
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-2);
  font-size: 16px;
  cursor: pointer;
  box-shadow: var(--shadow-raised-sm);
  transition: all var(--transition);
}
.icon-btn:hover:not(:disabled) {
  color: var(--text);
  box-shadow: var(--shadow-inset-sm);
  background: var(--bg);
  border: none;
}
.icon-btn .icon-svg { display: block; }

/* ── Content ─────────────────────────────────────────── */

.content {
  position: fixed;
  top: var(--top-bar-height, 56px);
  left: 0;
  right: 0;
  bottom: 0;
}

.tab-content {
  display: none;
  height: 100%;
}

.tab-content.active { display: flex; flex-direction: column; }

.tab-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px var(--page-gutter) 112px;
  width: 100%;
  max-width: none;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  /* Allow WebKit rubber-band where the engine supports it; JS adds a fallback. */
  overscroll-behavior-y: auto;
  /* End-of-scroll feedback is the bounce — keep chrome clean without a persistent rail. */
  scrollbar-width: none;
}

.tab-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* Nested lists still get a thin thumb when they scroll on their own. */
.privacy-audit-log,
.installed-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(20, 22, 28, 0.28) transparent;
}
body.dark .privacy-audit-log,
body.dark .installed-list {
  scrollbar-color: rgba(235, 232, 225, 0.22) transparent;
}

.privacy-audit-log::-webkit-scrollbar,
.installed-list::-webkit-scrollbar { width: 10px; }
.privacy-audit-log::-webkit-scrollbar-thumb,
.installed-list::-webkit-scrollbar-thumb {
  background: rgba(20, 22, 28, 0.18);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
body.dark .privacy-audit-log::-webkit-scrollbar-thumb,
body.dark .installed-list::-webkit-scrollbar-thumb {
  background: rgba(235, 232, 225, 0.14);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* Full-bleed scroll hit-testing: gutters left/right still scroll.
   The reading column stays capped — not the scroller itself. */
.today-shell,
.settings-shell,
.health-shell,
.recall-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
}

.today-shell > *,
.settings-shell > *,
.health-shell > *,
.recall-shell > * {
  width: 100%;
  max-width: var(--page-max);
  box-sizing: border-box;
}

/* Soft rubber-band stretch while overscrolling (JS drives --scroll-rubber). */
.tab-scroll.is-rubbering {
  scroll-behavior: auto;
  will-change: transform;
}

/* ── Cards (week / shared; Today day-view avoids these) ─ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: var(--space-block);
  box-shadow: none;
  position: relative;
}

.week-grid .card:first-child {
  border-top: none;
}

.card-title {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--text-2);
  margin-bottom: 12px;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-3);
  margin: -6px 0 14px;
  line-height: 1.4;
}

/* ── Today journal layout ────────────────────────────── */

.today-header { margin-bottom: 28px; }

.today-header-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.today-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.2vw, 2.75rem);
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin-top: 8px;
  color: var(--ink);
}

.today-view-toggle {
  display: flex;
  gap: 16px;
  width: fit-content;
  background: none;
  padding: 0;
  border-radius: 0;
}

.view-toggle-btn {
  padding: 0 0 4px;
  border: none;
  border-bottom: 1.5px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text-3);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}

.view-toggle-btn:hover:not(.active) {
  color: var(--ink-soft);
}
.view-toggle-btn.active {
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  border-bottom-color: var(--ink);
}

.stats-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--text-2);
  padding-bottom: 6px;
  max-width: 28rem;
  line-height: 1.45;
}

.stat { display: inline; }
.stat + .stat::before {
  content: " · ";
  color: var(--text-3);
}
.stat-value {
  font-family: var(--font);
  font-weight: 600;
  color: var(--text);
  font-size: inherit;
  font-variant-numeric: tabular-nums;
}

.today-journal {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.today-journal-body {
  display: block;
  min-width: 0;
}

.today-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  width: 100%;
}

.today-aside {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem 2.5rem;
  min-width: 0;
  width: 100%;
  margin-top: 0.15rem;
  padding-top: 0.25rem;
  border-top: none;
  align-items: start;
}

.today-aside-story,
.today-aside-rail {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-width: 0;
}

/* Advanced lives in the rail — never force full-width under the story. */
.today-aside > .today-advanced,
.today-aside-rail > .today-advanced {
  grid-column: auto;
  margin-top: 0;
}

@media (min-width: 960px) {
  .today-aside {
    grid-template-columns: minmax(0, 1.35fr) minmax(16rem, 0.9fr);
    gap: 1.5rem 2.75rem;
    padding-top: 24px;
  }

  .week-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px 40px;
  }
}

@media (min-width: 900px) and (max-width: 959px) {
  .week-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px 40px;
  }
}

.insights-section,
.attention-section {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.insights-section .card-title,
.attention-section .card-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
  margin-bottom: 8px;
}

.insight-row,
.attention-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.insight-item {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

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

.insight-item .insight-row {
  border-bottom: none;
  padding: 0;
}

.insight-row:last-child,
.attention-row:last-child {
  border-bottom: none;
}

.insight-label,
.attention-app {
  color: var(--text);
}

.insight-value,
.attention-time {
  color: var(--text-2);
}

.week-grid {
  display: grid;
  gap: var(--space-block);
  grid-template-columns: 1fr;
}

.week-span { grid-column: 1 / -1; }

/* ── Now strip (active focus) ────────────────────────── */

.now-strip {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0 0 4px;
  border-bottom: 1px solid color-mix(in srgb, var(--now) 28%, var(--border));
}

.now-strip.hidden { display: none; }

#live-focus-body {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  flex-wrap: wrap;
}

.now-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--now);
  flex-shrink: 0;
}

.now-app {
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
}

.now-duration {
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}

/* ── Timeline (journal) ──────────────────────────────── */

.journal-timeline {
  min-height: 200px;
}

.timeline-view-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.timeline-view-toggle {
  display: inline-flex;
  gap: 2px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.timeline-view-btn {
  padding: 5px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.timeline-view-btn:hover:not(.active) {
  color: var(--ink);
}
.timeline-view-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.timeline-entry.kb-focus {
  outline: 2px solid var(--now);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Swimlane Day Canvas ─────────────────────────────── */

.timeline-swimlane {
  min-height: 160px;
  padding-bottom: 8px;
}

.swimlane-canvas {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.swimlane-axis {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}

.swimlane-axis-track {
  position: relative;
  height: 18px;
}

.swimlane-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  white-space: nowrap;
}

.swimlane-plot-wrap {
  position: relative;
}

.swimlane-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.swimlane-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 26px;
}

.swimlane-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.swimlane-track {
  position: relative;
  height: 22px;
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  border-radius: 5px;
  overflow: hidden;
}

.swimlane-overlays {
  position: absolute;
  left: 120px; /* 110px label + 10px gap */
  right: 0;
  top: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 3;
}

.swimlane-gridline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  transform: translateX(-50%);
}

.swimlane-idle {
  position: absolute;
  top: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 4px,
    color-mix(in srgb, var(--ink) 4%, transparent) 4px,
    color-mix(in srgb, var(--ink) 4%, transparent) 5px
  );
  border-radius: 2px;
  opacity: 0.7;
}

.swimlane-now-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--now);
  transform: translateX(-50%);
  opacity: 0.85;
  z-index: 4;
}

.swimlane-now-tag {
  position: absolute;
  top: -2px;
  left: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--now);
  white-space: nowrap;
}

.swimlane-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 12px;
  margin-left: -6px;
  pointer-events: auto;
  cursor: ew-resize;
  z-index: 5;
}

.swimlane-playhead-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--now) 75%, var(--ink));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--paper) 55%, transparent);
}

.swimlane-playhead-knob {
  position: absolute;
  left: 50%;
  top: -2px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--now);
  padding: 0;
  cursor: grab;
  box-shadow: 0 1px 3px rgba(20, 22, 28, 0.25);
}

.swimlane-playhead-knob:active {
  cursor: grabbing;
}

.swimlane-selection {
  position: absolute;
  top: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--now) 14%, transparent);
  border-left: 1px solid color-mix(in srgb, var(--now) 55%, transparent);
  border-right: 1px solid color-mix(in srgb, var(--now) 55%, transparent);
  z-index: 2;
}

.swimlane-block {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border: none;
  border-radius: 3px;
  padding: 0 4px;
  cursor: pointer;
  opacity: 0.92;
  min-width: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity var(--transition), filter var(--transition), box-shadow var(--transition);
  z-index: 1;
}

.swimlane-block-label {
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  pointer-events: none;
}

.swimlane-block:hover,
.swimlane-block.is-live,
.swimlane-block.is-selected {
  opacity: 1;
  filter: brightness(1.08);
  z-index: 2;
}

.swimlane-block.is-live {
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--now) 65%, transparent);
}

.swimlane-block.is-selected {
  box-shadow: 0 0 0 2px var(--ink);
}

.swimlane-peek-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 92%, var(--ink) 3%);
  border: 1px solid var(--border);
}

.swimlane-peek-time {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  min-width: 4.2rem;
  padding-top: 2px;
}

.swimlane-peek {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 1;
  min-height: 1.4rem;
}

.swimlane-moment {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.swimlane-moment[hidden] {
  display: none !important;
}

.swimlane-moment-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.swimlane-moment-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--text-2);
}

.swimlane-moment-meta strong {
  color: var(--text);
  font-size: 13px;
}

.swimlane-moment-also {
  color: var(--text-2);
  font-size: 11px;
}

.swimlane-moment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.swimlane-moment-dismiss {
  opacity: 0.75;
}

.swimlane-moment-forget:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.swimlane-legend {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-3);
}

.timeline-hour {
  display: none;
}

.timeline-entry {
  display: grid;
  grid-template-columns: 72px 10px minmax(0, 1fr);
  column-gap: 12px;
  align-items: start;
  padding: 11px 0;
  border-bottom: 1px solid rgba(20, 22, 28, 0.06);
  border-radius: 0;
  cursor: pointer;
  transition: background var(--transition);
}

body.dark .timeline-entry {
  border-bottom-color: rgba(235, 232, 225, 0.07);
}

.timeline-entry:hover { background: transparent; }
.timeline-entry:hover .timeline-app { color: var(--now); }

.timeline-entry.expanded {
  background: transparent;
  border-bottom-color: transparent;
}

.timeline-entry.is-now .timeline-app {
  color: var(--ink);
}

.timeline-time {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.timeline-gutter {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding-top: 2px;
  min-width: 0;
}

.timeline-gutter-meta {
  font-size: 10px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  text-align: right;
  line-height: 1.2;
}

.timeline-ask {
  font-size: 11px;
  padding: 0;
  margin: 0;
  line-height: 1.2;
}

.timeline-entry.is-now .timeline-time {
  color: var(--now);
  font-weight: 600;
}

.timeline-color {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 7px;
  flex-shrink: 0;
  background: var(--ink-soft) !important;
  opacity: 0.45;
}

.timeline-entry.is-now .timeline-color {
  background: var(--now) !important;
  opacity: 1;
}

.timeline-main {
  min-width: 0;
}

.timeline-row-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.timeline-app {
  font-weight: 500;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  letter-spacing: -0.01em;
}

.timeline-entry.is-now .timeline-app {
  font-weight: 600;
}

.timeline-duration {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.timeline-forget-btn {
  flex-shrink: 0;
  margin-left: 6px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-3);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.timeline-entry:hover .timeline-forget-btn,
.timeline-entry:focus-within .timeline-forget-btn {
  opacity: 1;
}

.timeline-forget-btn:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.privacy-audit-log {
  max-height: 280px;
  overflow-y: auto;
  margin-top: 8px;
}

.privacy-audit-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

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

.privacy-audit-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 2px;
}

.privacy-audit-cat {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
}

.privacy-audit-when {
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.privacy-audit-desc {
  font-size: 13px;
  color: var(--text-1);
  line-height: 1.35;
}

.recall-session-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 0;
  border: none;
  background: transparent;
}

.recall-session-row .recall-session-main {
  flex: 1;
  min-width: 0;
}

.recall-forget-btn {
  flex-shrink: 0;
  align-self: center;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-3);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}

.recall-forget-btn:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.timeline-kind {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--text-3);
  flex-shrink: 0;
}

.timeline-color-agent {
  background: var(--ink) !important;
  opacity: 0.28;
  border-radius: 1px;
  width: 5px;
  height: 5px;
}

.timeline-entry-agent {
  cursor: default;
}

.timeline-entry-agent .timeline-app {
  font-weight: 500;
  font-style: italic;
}

.agent-grade {
  border-bottom: 1px dotted var(--text-3);
  cursor: help;
}

.agent-file-details ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.timeline-row-meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-3);
}

.timeline-moment-sessions {
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid var(--border, rgba(0,0,0,0.08));
}

.timeline-moment-session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
  padding: 2px 0;
}

.timeline-moment-session .timeline-forget-btn {
  opacity: 1;
  margin-left: 0;
}

.timeline-active-dot { display: none; }

.timeline-details {
  grid-column: 3;
  padding: 6px 0 8px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.6;
}

.timeline-details ul {
  margin: 6px 0 0;
  padding-left: 1.1rem;
}

.timeline-empty {
  text-align: left;
  padding: 24px 0;
  color: var(--text-3);
  font-size: 14px;
}

.timeline-empty p {
  margin: 0 0 8px;
}

.timeline-empty-hint {
  font-size: 12px;
  line-height: 1.45;
  max-width: 28rem;
  margin: 0 !important;
}

/* ── Highlights (quiet margin) ───────────────────────── */

.highlights-stack,
.highlights-grid {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.highlight-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.highlight-card h3 {
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 650;
  text-transform: none;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 0.45rem;
}

.highlight-card p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
}

.highlight-card .highlight-body {
  white-space: normal;
  margin: 0;
}

.highlight-card .highlight-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.highlight-card .highlight-label {
  font-size: 12px;
  color: var(--text-3);
}

.health-advanced {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.health-advanced summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  list-style: none;
}
.health-advanced summary::-webkit-details-marker { display: none; }
.health-advanced[open] summary { margin-bottom: 10px; color: var(--ink); }

.engine-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.engine-row:last-child {
  border-bottom: none;
}

.engine-name {
  color: var(--text);
  font-weight: 500;
}

.engine-stat {
  color: var(--text-2);
  text-align: right;
  flex-shrink: 0;
}

.engine-stat.ok {
  color: var(--observed);
}

.engine-stat.warn {
  color: var(--warning);
}

.engine-stat.error {
  color: var(--now);
}

.health-engines-ok {
  margin: 0;
  color: var(--observed);
  font-size: 13px;
  font-weight: 600;
}

.week-summary {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 8px;
}

.week-bar-block {
  padding: 0;
}

.week-bar-block.today .week-bar-day {
  color: var(--ink);
  font-weight: 600;
}

.week-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px 8px 0;
  margin: 0 -6px 0 0;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.12s ease;
}
.week-bar-row:hover {
  background: color-mix(in srgb, var(--ink) 5%, transparent);
}

.week-bar-day {
  width: 52px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  flex-shrink: 0;
}

.week-bar-detail {
  font-size: 11px;
  color: var(--text-3);
  padding-left: 62px;
  margin-top: -2px;
  line-height: 1.35;
}

.week-bar-detail.muted {
  font-style: italic;
}

.week-bar-track {
  flex: 1;
  height: 24px;
  background: var(--surface-2);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.week-bar-fill {
  height: 100%;
  border-radius: 6px;
  display: flex;
  overflow: hidden;
  transition: width 0.5s ease;
  background: transparent;
  position: relative;
}

.week-bar-fill.today {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--now) 35%, transparent);
}

.week-bar-seg {
  display: block;
  height: 100%;
  min-width: 2px;
}

.week-bar-fill-label {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  pointer-events: none;
  white-space: nowrap;
}

.week-bar-away {
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 4px,
    var(--surface-2) 4px,
    var(--surface-2) 6px
  );
  opacity: 0.6;
}

.week-bar-value {
  font-size: 12px;
  color: var(--text-3);
  width: 60px;
  text-align: right;
  flex-shrink: 0;
}

.week-app-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--space-row) 0;
  border-bottom: 1px solid var(--border);
}

.week-app-row:last-child { border-bottom: none; }

.week-app-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.week-app-name {
  font-weight: 500;
  font-size: 13px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.week-app-time {
  font-size: 12px;
  color: var(--text-2);
  flex-shrink: 0;
}

.week-app-pct {
  font-size: 12px;
  color: var(--text-3);
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}

.pattern-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.pattern-item:last-child { border-bottom: none; }
.pattern-label { color: var(--text-2); }
.pattern-value { font-weight: 600; color: var(--text); }
.pattern-item-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  min-width: 0;
  flex: 1 1 auto;
}
.pattern-meta { font-size: 12px; font-weight: 400; color: var(--text-2); white-space: nowrap; }
.pattern-stats { font-size: 11px; color: var(--text-3); text-align: right; white-space: nowrap; margin-left: auto; }

/* ── Week comparison ────────────────────────────────── */

.week-comparison-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-top: 12px;
}

.week-comparison-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.week-comparison-label {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}


/* ── Recall ──────────────────────────────────────────── */

.recall-shell {
  display: flex;
  justify-content: center;
}

.recall-panel {
  width: 100%;
  max-width: 720px;
  padding-top: 48px;
}

.recall-kicker,
.health-kicker,
.settings-kicker {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--now);
}

.recall-heading {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 3vw, 2.5rem);
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 24px;
}

.recall-mode-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 16px;
}

.recall-advanced-toggle {
  margin-left: auto;
}

.recall-mode-toggle {
  display: flex;
  gap: 2px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.recall-advanced-toggle {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.recall-advanced-toggle:hover {
  color: var(--ink);
  border-color: var(--ink-soft);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}

.recall-advanced-toggle.active {
  color: var(--now);
  border-color: color-mix(in srgb, var(--now) 45%, var(--border));
  background: var(--accent-soft);
}

.recall-mode-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.recall-mode-btn:hover:not(.active) {
  color: var(--ink);
}
.recall-mode-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.recall-input-row {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-bottom: 10px;
  align-items: center;
}

.recall-input-anchor {
  position: relative;
  flex: 1;
  min-width: 0;
}

.kql-field {
  position: relative;
  width: 100%;
}

.kql-highlight {
  display: none;
  position: absolute;
  inset: 0;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.45;
  white-space: pre;
  overflow: hidden;
  color: var(--text);
  pointer-events: none;
  z-index: 0;
}

.kql-field.kql-active .kql-highlight {
  display: block;
}

.kql-verb {
  color: var(--now);
  font-weight: 600;
}

.recall-input-row input {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 44px;
  padding: 12px 16px;
  border: var(--line, 1.5px) solid var(--border);
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  outline: none;
  box-shadow: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.kql-field.kql-active input {
  background: transparent;
  color: transparent;
  caret-color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
}

.recall-input-row input:focus {
  border-color: var(--now);
  box-shadow: none;
}

.recall-typeahead {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  max-height: 240px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 4px;
}

.recall-typeahead-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.recall-typeahead-item:hover,
.recall-typeahead-item.active {
  background: var(--surface-2);
}

.recall-typeahead-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.recall-kql-status {
  margin: 6px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
}

.recall-kql-status.ok { color: var(--success); }
.recall-kql-status.err { color: var(--danger); }
.recall-kql-status.muted { color: var(--text-3); }

.kql-result-pre {
  margin: 0;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  overflow: auto;
  max-height: 420px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-2);
}

.recall-hint {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 24px;
}

.recall-hint kbd,
.shortcuts-list kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
  padding: 3px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-2);
  min-width: 1.2em;
  text-align: center;
}

.recall-result {
  width: 100%;
}

.recall-result-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.recall-result-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.recall-result-meta {
  font-size: 12px;
  color: var(--text-3);
}

.recall-result-section {
  margin: 0 0 1.35rem;
  padding-top: 1.15rem;
  border-top: 1.5px solid var(--ink);
}
.recall-result-section:first-child {
  border-top: none;
  padding-top: 0.25rem;
}

.recall-result-section h3 {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  font-family: var(--font);
  font-size: 1.15rem;
  font-weight: 650;
  font-style: normal;
  letter-spacing: -0.025em;
  text-transform: none;
  color: var(--ink);
  margin: 0 0 0.65rem;
  padding-bottom: 0;
  border-bottom: none;
  line-height: 1.2;
}

.recall-result-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  color: inherit;
  font: inherit;
}

.recall-result-item:hover { background: var(--surface-2); }

.recall-result-color {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.recall-result-time {
  font-size: 12px;
  color: var(--text-3);
  width: 64px;
  flex-shrink: 0;
  padding-top: 1px;
}

.recall-result-body { flex: 1; min-width: 0; }

.recall-result-title {
  font-weight: 500;
  font-size: 13px;
  margin-bottom: 2px;
}

.recall-result-sub {
  font-size: 12px;
  color: var(--text-2);
}

.recall-active {
  color: var(--accent);
  font-weight: 500;
}

.recall-ask-result {
  width: 100%;
  text-align: left;
}

.recall-ask-source-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.recall-ask-source {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.recall-ask-source-live {
  color: var(--warning);
}

.recall-ask-mode {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.recall-ask-source-sub {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--text-3);
  text-transform: none;
  letter-spacing: 0;
  font-family: inherit;
  font-weight: 400;
}

.recall-ask-conf-badge {
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-3);
  max-width: min(280px, 48vw);
  text-align: right;
  line-height: 1.35;
}

.recall-ask-asked {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--ink-mute);
}

.recall-ask-answer {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 16px;
  color: var(--text);
  white-space: pre-wrap;
}

.recall-ask-analysis {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 16px;
}

.recall-ask-analysis p {
  margin-bottom: 4px;
}

.recall-ask-confidence {
  font-size: 12px;
  color: var(--text-3);
  font-style: italic;
  margin-top: 8px;
}

.recall-ask-section {
  margin-bottom: 16px;
}

.recall-ask-section h4 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.recall-ask-evidence {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  font-size: 13px;
  color: var(--text-2);
  padding: 8px 0;
  border: none;
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
  background: transparent;
  text-align: left;
  font: inherit;
}

button.recall-ask-evidence {
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

button.recall-ask-evidence:hover {
  background: var(--surface-2);
  color: var(--text);
}

.recall-ask-evidence-main { flex: 1; min-width: 0; }
.recall-ask-evidence-meta {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--text-3);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

.recall-ask-evidence:last-child { border-bottom: none; }

.timeline-entry.timeline-flash {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  background: var(--surface-2);
}

.timeline-moment-session.timeline-flash {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: 4px;
  background: var(--surface-2);
}

.recall-ask-alt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.recall-ask-alt:last-child { border-bottom: none; }

.recall-ask-alt-desc { color: var(--text-2); flex: 1; }

.recall-ask-alt-conf {
  font-size: 12px;
  color: var(--text-3);
  flex-shrink: 0;
  margin-left: 8px;
}

.recall-ask-grade {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  font-size: 0.65rem;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--text-3);
  vertical-align: middle;
}

.recall-ask-unknowns ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.45;
}

.recall-ask-unknowns li {
  margin: 0.25rem 0;
}
.recall-ask-feedback {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  margin: 0.85rem 0 0;
  padding-top: 0.65rem;
  border-top: 1px solid var(--hairline);
}
.recall-ask-feedback-label {
  font-family: var(--font);
  font-size: 0.75rem;
  color: var(--ink-mute);
  margin-right: 0.4rem;
}
.recall-ask-feedback-btn {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-mute);
  box-shadow: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  line-height: 0;
  transition: color var(--transition), background var(--transition);
}
.recall-ask-feedback-btn .icon-svg { display: block; }
.recall-ask-feedback-btn[data-fb="down"] .icon-svg { transform: rotate(180deg); }
.recall-ask-feedback-btn:hover:not(:disabled) {
  color: var(--ink);
  background: transparent;
  border: none;
}
.recall-ask-feedback-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.recall-ask-feedback-btn.is-picked {
  color: var(--ink);
}
.recall-ask-feedback-btn.is-dim {
  opacity: 0.35;
}
.recall-ask-feedback-btn:disabled {
  cursor: default;
}

.recall-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-3);
  font-size: 14px;
  width: 100%;
  line-height: 1.5;
}

.recall-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 0.75rem 0 1.25rem;
}

.recall-suggestion {
  appearance: none;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.12));
  background: transparent;
  color: var(--text-2, inherit);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
  border-radius: 0.35rem;
  cursor: pointer;
}

.recall-suggestion:hover {
  border-color: var(--text-3, rgba(0, 0, 0, 0.28));
  color: var(--text-1, inherit);
}

.recall-result-window {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--text-3);
}

/* ── Today secondary band (under timeline) ───────────── */

.today-what-changed {
  padding: 12px 0 4px;
  border: none;
  border-radius: 0;
  background: transparent;
}

.today-what-changed .card-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
  margin-bottom: 8px;
}

.what-changed-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 6px 8px 2px;
  margin: 0 -6px 0 -2px;
  border-bottom: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  transition: background 0.12s ease;
}
.what-changed-row:hover {
  background: color-mix(in srgb, var(--ink) 5%, transparent);
}
.what-changed-row:last-child { border-bottom: none; }

.what-changed-icon {
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 2px;
  width: 16px;
  text-align: center;
}

.delta-up { color: var(--danger); }
.delta-down { color: var(--observed); }
.delta-flat { color: var(--text-3); }

.what-changed-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.what-changed-app {
  font-weight: 500;
  color: var(--text);
}

.what-changed-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin: 2px 0 4px;
}

.what-changed-when {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-3);
  white-space: nowrap;
}

.what-changed-delta {
  font-size: 12px;
  color: var(--text-2);
}

.what-changed-ask {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 650;
  padding: 0;
  margin: 0;
  color: var(--seize);
  text-decoration: none;
}
.what-changed-ask:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* ── Health ──────────────────────────────────────────── */

/* Block layout, not flex: a stretched flex item swallows its own and the
   scroll container's bottom padding once content overflows, leaving the
   last section flush against the page end. margin:auto centers instead. */
.health-panel {
  width: 100%;
  max-width: var(--page-max, 1220px);
  margin: 0 auto;
  padding-top: 1.1rem;
  padding-bottom: 2.5rem;
}

.health-panel > .health-section:last-child,
.health-panel > details.health-advanced:last-child {
  margin-bottom: 0;
}

.health-heading {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 3vw, 2.5rem);
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 10px;
}

.health-lede {
  max-width: 36rem;
  margin: 0 0 24px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-2);
}

.health-bridge {
  margin: 4px 0 18px;
  font-size: 13px;
  color: var(--text-2);
}

.linkish {
  border: none;
  background: none;
  padding: 0;
  color: var(--now);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.linkish:hover { color: var(--ink); }

.health-dashboard {
  width: 100%;
}

.health-pulse-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.health-status-strip {
  padding: 1rem 1.15rem;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(0,0,0,.12));
  margin-bottom: 0.85rem;
  background: color-mix(in srgb, var(--success, #2f5d50) 8%, var(--surface, #fff));
}
.health-status-strip.health-status-medium {
  background: color-mix(in srgb, var(--warning, #b56a1b) 10%, var(--surface, #fff));
}
.health-status-strip.health-status-high {
  background: color-mix(in srgb, var(--danger, #b91c2c) 10%, var(--surface, #fff));
}
.health-status-label {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 1.45rem;
  line-height: 1.2;
  margin: 0 0 0.25rem;
}
.health-status-sentence {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-secondary, #5c616b);
  line-height: 1.45;
}

.health-vitals-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px 12px;
  margin: 0 0 1rem;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.health-vital {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding-right: 8px;
}
.health-vital-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  font-weight: 600;
}
.health-vital-value {
  font-size: 1.2rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.health-vital-sub {
  font-size: 0.76rem;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.health-vital-bar {
  margin-top: 4px;
  height: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 80%, transparent);
  overflow: hidden;
}
.health-vital-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
  opacity: 0.85;
}
.health-vital-bar-fill.health-pulse-low { background: var(--observed); }
.health-vital-bar-fill.health-pulse-medium { background: var(--warning); }
.health-vital-bar-fill.health-pulse-high { background: var(--now); }


.health-calm {
  padding: 0.75rem 0;
}
.health-calm-text {
  margin: 0;
  color: var(--text-secondary, #5c616b);
  font-size: 0.95rem;
}

.health-quit-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0.55rem 0 0.7rem;
}
.health-quit-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  font-size: 0.92rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}
.health-quit-row:last-child { border-bottom: none; }
.health-quit-name {
  flex: 1 1 7rem;
  min-width: 0;
  font-weight: 550;
  color: var(--text);
}
.health-quit-mode {
  display: inline-flex;
  gap: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: var(--line, 1.5px) solid var(--border);
  box-shadow: none;
  flex: 0 0 auto;
}
.health-quit-mode-btn {
  appearance: none;
  border: none;
  border-right: var(--line, 1.5px) solid var(--border);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 550;
  line-height: 1.2;
  padding: 0.35rem 0.7rem;
  border-radius: 0;
  cursor: pointer;
  white-space: nowrap;
}
.health-quit-mode-btn:last-child { border-right: none; }
.health-quit-mode-btn:hover:not(.is-active) {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}
.health-quit-mode-btn.is-active {
  background: var(--ink);
  color: var(--bg);
  box-shadow: none;
  font-weight: 600;
}
.health-quit-mode-btn.is-active[data-quit-mode="always"] {
  background: var(--now);
  color: #fff;
}
.health-quit-remove {
  flex: 0 0 auto;
  margin-left: auto;
}
.health-quit-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.health-quit-add-row .modal-input {
  flex: 1;
  min-width: 0;
}

.health-kairos-rows {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.5rem 0 0.65rem;
}
.health-kairos-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
}

@media (min-width: 800px) {
  .health-pulse-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.health-pulse-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.health-pulse-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 4px;
}

.health-pulse-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.health-pulse-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

.health-pulse-bar {
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}

.health-pulse-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

.health-volume-list {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.health-volume-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: baseline;
  font-size: 12px;
  color: var(--text-2);
  padding: 4px 0;
  border-top: 1px solid var(--border);
}

.health-volume-mount {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.health-volume-pct {
  font-weight: 600;
  color: var(--text);
}

.health-volume-free {
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.health-pulse-low { color: var(--success); }
.health-pulse-low.health-pulse-bar-fill { background: var(--success); }
.health-pulse-medium { color: var(--warning); }
.health-pulse-medium.health-pulse-bar-fill { background: var(--warning); }
.health-pulse-high { color: var(--danger); }
.health-pulse-high.health-pulse-bar-fill { background: var(--danger); }

.health-section {
  background: var(--surface);
  border: none;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-raised-sm);
}

.health-section h3 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 10px;
}

.health-proc-list, .health-activity-list {
  display: flex;
  flex-direction: column;
}

.health-proc-row, .health-activity-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.health-proc-row:last-child, .health-activity-row:last-child { border-bottom: none; }

.health-proc-color, .health-activity-color {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.health-proc-name, .health-activity-app {
  flex: 1;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-proc-cpu, .health-proc-mem {
  font-size: 12px;
  color: var(--text-2);
  flex-shrink: 0;
  width: 64px;
  text-align: right;
}

.health-activity-dur {
  font-size: 12px;
  color: var(--text-2);
  flex-shrink: 0;
  width: 48px;
  text-align: right;
}

.health-activity-time {
  font-size: 12px;
  color: var(--text-3);
  flex-shrink: 0;
  width: 48px;
  text-align: right;
}

.health-note {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 8px 0;
}

.health-note p {
  font-size: 13px;
  color: var(--text-2);
  font-style: italic;
}

.health-result {
  width: 100%;
}

.health-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-3);
  font-size: 14px;
  width: 100%;
}

.health-temporal-list, .health-crash-list {
  display: flex;
  flex-direction: column;
}

.health-temporal-caption {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--text-2);
}

.health-temporal-row, .health-crash-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.health-temporal-row:last-child, .health-crash-row:last-child { border-bottom: none; }

.health-repeated-row {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}
.health-repeated-row:last-child { border-bottom: none; }

.health-incident-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.health-incident-card {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2, var(--surface));
  border: 1px solid var(--border);
}
.health-incident-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  font-size: 13px;
}
.health-incident-when {
  font-size: 12px;
  color: var(--text-secondary, #5c616b);
  white-space: nowrap;
}
.health-incident-summary {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-secondary, #5c616b);
  line-height: 1.4;
}
.health-incident-steps {
  margin: 8px 0 0 18px;
  padding: 0;
  font-size: 12px;
  color: var(--text);
  line-height: 1.45;
}

.health-temporal-icon {
  font-size: 14px;
  flex-shrink: 0;
  width: 16px;
  text-align: center;
  margin-top: 2px;
}

.health-temporal-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.health-temporal-headline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.health-temporal-app {
  flex: 1;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-temporal-metric {
  font-size: 12px;
  color: var(--text-2);
  flex-shrink: 0;
  width: 64px;
}

.health-temporal-delta {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.35;
}

.health-temporal-time {
  font-size: 11px;
  color: var(--text-3, var(--text-2));
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.health-temporal-spark {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.health-temporal-spark-label {
  font-size: 10px;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text-3, var(--text-2));
  width: 72px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.health-temporal-spark-track {
  position: relative;
  flex: 1;
  height: 8px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--border) 70%, transparent);
  overflow: hidden;
}

.health-temporal-spark-before,
.health-temporal-spark-after {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 2px;
  max-width: 100%;
}

.health-temporal-spark-before {
  background: color-mix(in srgb, var(--text-2) 35%, transparent);
  opacity: 0.85;
}

.health-temporal-spark-after {
  opacity: 0.9;
}

.health-temporal-spark-after.health-pulse-high { background: var(--danger); }
.health-temporal-spark-after.health-pulse-low { background: var(--success); }
.health-temporal-spark-after.health-pulse-medium { background: var(--warning); }

/* When Kairos was running (runtime coverage) */
.health-section-hint {
  font-size: 12px;
  color: var(--text-3);
  margin: -4px 0 10px;
}

.runtime-list { display: flex; flex-direction: column; }

.today-coverage {
  margin: 0 0 14px;
  padding: 0 0 8px;
}
.today-coverage .card-title { margin-bottom: 4px; }
.today-connect {
  margin: 0 0 14px;
  padding: 8px 0 10px;
  border-bottom: 1px solid var(--border);
}
.today-connect-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.today-connect-copy {
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
  max-width: 42rem;
}
.connect-watch-fields {
  display: flex;
  gap: 8px;
  align-items: center;
}
.connect-watch-fields input {
  min-width: 16rem;
  font: inherit;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}
.connect-watch-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.connect-watch-chip {
  font-size: 12px;
  color: var(--text-2);
  background: var(--fill-2, rgba(0,0,0,0.04));
  padding: 3px 8px;
  border-radius: 999px;
}
.connect-mcp-snippet {
  font-size: 12px;
  max-width: 42rem;
  overflow: auto;
  padding: 8px 10px;
  background: var(--fill-2, rgba(0,0,0,0.04));
  border-radius: 6px;
}
.review-debt-list {
  margin: 8px 0 0;
  padding-left: 0;
  list-style: none;
}
.review-debt-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
}
.review-debt-project {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--text-2);
}
.review-debt-agent {
  margin: 14px 0 0;
  font-size: 15px;
  font-weight: 600;
}
.review-debt-actions {
  display: flex;
  gap: 16px;
  margin-top: 12px;
}
.review-queue-file {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 8px 0 0;
}
.review-queue-reason {
  display: block;
  margin-top: 12px;
}
.review-queue-reason input {
  display: block;
  width: 100%;
  max-width: 36rem;
  margin-top: 4px;
  padding: 6px 8px;
  font: inherit;
  background: var(--fill-2, rgba(0,0,0,0.04));
  border: 1px solid var(--border);
  border-radius: 6px;
  color: inherit;
}
.review-queue-keys {
  flex-wrap: wrap;
}
.today-return-beat {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: var(--text-1);
}
.today-morning-brief .today-return-beat {
  margin-bottom: 6px;
}
.week-letter-line {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--text-1);
}
.connect-advanced {
  margin-top: 12px;
}
.connect-advanced summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
}
.today-review-debt {
  margin: 12px 0 20px;
}
.today-watch-prompt {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-2);
}

.runtime-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.runtime-row:last-child { border-bottom: none; }

.runtime-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  align-self: center;
}

.runtime-on .runtime-dot { background: var(--success); }
.runtime-off .runtime-dot { background: var(--text-3); }

.runtime-range {
  flex-shrink: 0;
  min-width: 130px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.runtime-label { color: var(--text-2); }
.runtime-off .runtime-range,
.runtime-off .runtime-label { color: var(--text-3); }

.health-crash-name {
  flex: 1;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-crash-time {
  font-size: 12px;
  color: var(--text-2);
  flex-shrink: 0;
}

/* ── Settings ────────────────────────────────────────── */

.settings-header {
  margin-bottom: 28px;
}

.settings-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 3vw, 2.5rem);
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.settings-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .settings-grid {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  .settings-span {
    grid-column: 1 / -1;
  }
}

.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 0;
  box-shadow: none;
}

.trust-panel {
  border: var(--line, 1.5px) solid var(--border);
  background: var(--surface-2);
  box-shadow: none;
}

.trust-lead {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.45;
}

.trust-never {
  margin: 0;
}

.settings-section h2 {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--copper-deep, var(--now));
  background: transparent;
  padding: 0;
  border-radius: 0;
  margin-bottom: 14px;
  box-shadow: none;
}
.settings-section h2::before {
  content: "";
  display: inline-block;
  width: 1.1rem;
  height: 1px;
  margin-right: 0.45rem;
  vertical-align: middle;
  background: var(--copper, var(--now));
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.settings-row:last-child { border-bottom: none; }
.settings-row label { color: var(--text-2); }

.threshold-editor {
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--border);
}
.threshold-group { margin: 10px 0 14px; }
.threshold-group h4 {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.threshold-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px 16px;
}
.threshold-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}
.threshold-field input {
  width: 110px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  text-align: right;
  outline: none;
}
.threshold-field input:focus { border-color: var(--accent); }
.threshold-editor-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.threshold-editor + .muted { margin-top: 6px; }

.settings-row input[type="password"] {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  width: 260px;
}

.settings-row input[type="password"]:focus { border-color: var(--accent); }

.import-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-input {
  font-size: 12px;
  color: var(--text-2);
  max-width: 180px;
}

.file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.file-picker-label {
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  padding: 6px 10px;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.12));
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-2, transparent);
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-picker-label:hover {
  border-color: var(--text-3, rgba(0, 0, 0, 0.28));
}

.import-summary {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
}

.import-summary.hidden { display: none; }

.import-summary .error { color: var(--danger); }
.import-summary .success { color: var(--green); }

.danger-zone-card {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.danger-zone {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  background: rgba(255, 59, 48, 0.04);
}

.danger-zone-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
  margin-bottom: 4px;
}

.danger-icon { font-size: 14px; }

.danger-zone-desc {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 12px;
  line-height: 1.4;
}

.danger-btn-lg {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--danger);
  border-radius: 6px;
  background: transparent;
  color: var(--danger);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.danger-btn-lg:hover:not(:disabled) { background: var(--danger); color: #ffffff; }

.remove-choice {
  margin-top: 14px;
  padding: 14px 16px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.remove-choice h3 {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 650;
}
.remove-choice p {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-2);
}
.remove-choice .danger-btn-lg,
.remove-choice .small-btn { width: auto; }
.remove-choice-danger {
  border-color: var(--danger);
  background: rgba(255, 59, 48, 0.04);
}
.remove-os-tabs { margin-bottom: 10px; }
.remove-cmd {
  margin: 0 0 10px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-2, rgba(20, 19, 18, 0.04));
  border-radius: 6px;
  overflow-x: auto;
}

.privacy-mode-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.privacy-mode-option {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
}

.privacy-mode-option:hover {
  border-color: var(--ink-soft);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}
.privacy-mode-option.active { border-color: var(--accent); background: var(--accent-soft); }

.privacy-mode-radio {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  position: relative;
  margin-bottom: 2px;
}

.privacy-mode-option.active .privacy-mode-radio {
  border-color: var(--accent);
}

.privacy-mode-option.active .privacy-mode-radio::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.privacy-mode-label { font-weight: 600; font-size: 13px; }
.privacy-mode-desc { color: var(--text-2); font-size: 11px; }

.excluded-app-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

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

.excluded-app-remove {
  color: var(--danger);
  background: none;
  border: none;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font);
}

.add-exclusion-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.add-exclusion-row input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
}

.add-exclusion-row input:focus { border-color: var(--accent); }

.exclusion-empty {
  text-align: center;
  padding: 16px 12px;
  color: var(--text-3);
  font-size: 12px;
}

.exclusion-empty-hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-3);
  opacity: 0.9;
}

.installed-retry {
  margin-top: 10px;
}

.settings-hint {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 10px;
}

.sub-device-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  max-width: min(100%, 28rem);
  overflow-wrap: anywhere;
  word-break: break-all;
  white-space: normal;
  display: inline-block;
  vertical-align: middle;
  color: var(--text-2);
}

.sub-license-row {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.sub-license-row[hidden] {
  display: none !important;
}

.sub-have-key {
  opacity: 0.85;
}

.sub-license-label {
  color: var(--text-2);
  font-size: 13px;
}

.sub-activate-row {
  width: 100%;
  min-width: 0;
  flex-wrap: wrap;
}

.sub-activate-row input {
  flex: 1 1 200px;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  outline: none;
}

.sub-activate-row input:focus { border-color: var(--accent); }

.sub-activate-row input::placeholder {
  color: var(--text-3);
  font-family: var(--font);
}

.sub-actions .import-row {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.app-category-add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.app-category-add-row input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
}

.app-category-add-row input:focus { border-color: var(--accent); }

.app-category-add-row select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
}

.installed-picker {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  overflow: hidden;
}

.installed-picker.hidden { display: none; }

.installed-picker input {
  width: 100%;
  box-sizing: border-box;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
}

.installed-list {
  max-height: 220px;
  overflow-y: auto;
}

.installed-app-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}

.installed-app-row:last-child { border-bottom: none; }
.installed-app-row:hover { background: var(--accent-soft); }

.installed-app-add {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.app-category-list {
  display: flex;
  flex-direction: column;
}

.app-category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
}

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

.app-category-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.app-category-name {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-category-source {
  font-size: 11px;
  color: var(--text-3);
}

.app-category-select {
  flex-shrink: 0;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.app-category-item.cat-public .app-category-select { border-color: var(--success); }
.app-category-item.cat-semi .app-category-select { border-color: var(--warning); }
.app-category-item.cat-private .app-category-select { border-color: var(--danger); }
.app-category-item.cat-default .app-category-select { border-color: var(--border); }

.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Buttons ─────────────────────────────────────────── */

.primary-btn {
  min-height: 44px;
  padding: 10px 20px;
  border: none;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bone, #f3f1ec);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  box-shadow: var(--ground-sm);
  transition: box-shadow var(--transition), transform var(--transition), background var(--transition);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  position: relative;
  overflow: hidden;
}
.primary-btn::before, .primary-btn::after { display: none; }
.primary-btn:hover:not(:disabled) {
  color: #fff;
  filter: none;
  transform: none;
  box-shadow: none;
}
.primary-btn:active:not(:disabled) {
  transform: scale(0.985);
  box-shadow: var(--shadow-inset-sm);
}

.recall-new-question {
  appearance: none;
  flex-shrink: 0;
  min-height: 44px;
  padding: 10px 16px;
  margin: 0;
  border: none;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 550;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-inset-sm);
  transition: box-shadow var(--transition), color var(--transition);
}
.recall-new-question:hover {
  color: var(--text);
  box-shadow: var(--shadow-raised-sm);
  background: var(--bg);
  border: none;
}
.recall-new-question:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.small-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-raised-sm);
  transition: all var(--transition);
}
.small-btn:hover:not(:disabled) {
  box-shadow: var(--shadow-inset-sm);
  color: var(--copper-deep, var(--now));
  border: none;
}

.retention-select {
  padding: 6px 12px;
  border: none;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-inset-sm);
}

.retention-controls,
.history-range-fields {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}
.retention-custom-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.retention-custom-row.hidden { display: none; }
.retention-custom-row input {
  width: 90px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
.history-range-delete {
  margin: 8px 0 12px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--danger) 24%, var(--border));
  border-radius: 8px;
}
.history-range-fields label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}
.history-range-fields input[type="date"] {
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.danger-outline {
  border-color: color-mix(in srgb, var(--danger) 65%, var(--border));
  color: var(--danger);
}

.small-btn:hover:not(:disabled) { color: var(--accent); box-shadow: var(--shadow-inset-sm); }

.danger-btn {
  border: var(--line, 1.5px) solid var(--danger);
  color: var(--danger);
  box-shadow: none;
}

.danger-btn:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--danger);
  box-shadow: none;
}

.toggle-btn {
  padding: 4px 12px;
  border: var(--line, 1.5px) solid var(--border);
  border-radius: 0;
  background: var(--surface);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  box-shadow: none;
  transition: all var(--transition);
}
.toggle-btn:hover:not(.active) {
  color: var(--ink);
  border-color: var(--ink-soft);
  background: color-mix(in srgb, var(--ink) 5%, var(--surface));
}

.toggle-btn.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  box-shadow: none;
}

/* Keyboard focus + disabled — mouse users unchanged; keyboard gets a clear ring. */
.tab-btn:focus-visible,
.icon-btn:focus-visible,
.small-btn:focus-visible,
.primary-btn:focus-visible,
.toggle-btn:focus-visible,
.danger-btn:focus-visible,
.danger-btn-lg:focus-visible,
.view-toggle-btn:focus-visible,
.sse-status-chip:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
body.dark .tab-btn:focus-visible,
body.dark .icon-btn:focus-visible,
body.dark .small-btn:focus-visible,
body.dark .primary-btn:focus-visible,
body.dark .toggle-btn:focus-visible,
body.dark .danger-btn:focus-visible,
body.dark .danger-btn-lg:focus-visible,
body.dark .view-toggle-btn:focus-visible,
body.dark .sse-status-chip:focus-visible {
  outline-color: var(--text);
}

.tab-btn:disabled,
.icon-btn:disabled,
.small-btn:disabled,
.primary-btn:disabled,
.toggle-btn:disabled,
.danger-btn:disabled,
.danger-btn-lg:disabled,
.view-toggle-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

::placeholder {
  color: var(--text-3);
  opacity: 1;
}

/* ── Collapsible long lists ──────────────────────────── */

.list-collapsed-item { display: none !important; }
.list-collapse-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 6px;
  padding: 4px 8px 4px 4px;
  margin-left: -4px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-2);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.list-collapse-toggle:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}
.list-collapse-arrow { font-size: 9px; line-height: 1; }
.journal-timeline > .list-collapse-toggle {
  margin: 10px 0 4px;
  width: 100%;
  justify-content: flex-start;
}
.installed-list-more {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-3);
}
.health-vital-link {
  display: block;
  margin-top: 2px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-family: var(--font);
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.health-vital-link:hover { color: var(--accent); text-decoration: underline; }

/* ── Status badge ────────────────────────────────────── */

.status-badge {
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
}

.status-badge.online {
  background: rgba(52, 199, 89, 0.1);
  color: var(--success);
}

.status-badge.offline {
  background: var(--surface-2);
  color: var(--text-3);
}

/* ── SSE / live connection chip ─────────────────────── */

.sse-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  border-radius: 999px;
  padding: 3px 8px 3px 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: default;
  line-height: 1;
  height: 26px;
}
.sse-status-chip.disconnected,
.sse-status-chip.connecting {
  cursor: pointer;
}
.sse-status-chip.disconnected:hover,
.sse-status-chip.connecting:hover {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--ink) 28%, transparent);
}
.sse-status-label { white-space: nowrap; }
.sse-status-chip.connected { color: var(--success); }
.sse-status-chip.connecting { color: var(--warning); }
.sse-status-chip.disconnected { color: var(--text-3); }

.sse-status-dot,
.sse-status-chip .sse-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: background 0.3s ease;
  cursor: default;
  flex-shrink: 0;
}

.sse-status-dot.connected,
.sse-status-chip.connected .sse-status-dot {
  background: var(--success);
  box-shadow: none;
}

.sse-status-dot.disconnected,
.sse-status-chip.disconnected .sse-status-dot {
  background: var(--text-3);
}

.sse-status-dot.connecting,
.sse-status-chip.connecting .sse-status-dot {
  background: #ff9500;
  animation: sse-pulse 1s ease-in-out infinite;
}

@keyframes sse-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Toast ───────────────────────────────────────────── */

.app-footer {
  position: fixed;
  bottom: 14px;
  right: 18px;
  z-index: 50;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-3);
  opacity: 0.72;
  pointer-events: none;
  user-select: none;
}

.toast-root {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(420px, 92vw);
  padding: 10px 12px 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s ease;
  pointer-events: auto;
}

.toast.error { background: var(--danger); color: #ffffff; }
.toast.toast-out { animation: toast-out 0.22s ease forwards; }
.toast-msg { flex: 1; min-width: 0; }
.toast-dismiss {
  border: none;
  background: transparent;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}
.toast-dismiss:hover { opacity: 1; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(8px); }
}

.copy-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 6px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
}
.copy-btn:hover { color: var(--text); border-color: color-mix(in srgb, var(--text) 28%, transparent); }
.heatmap-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px auto auto; gap: 8px; align-items: center; }
.heatmap-row .copy-btn { justify-self: end; }
.offline-retry {
  margin-top: 12px;
  display: inline-flex;
}
.modal-input-confirm {
  width: 100%;
  margin-top: 8px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .tab-scroll { scroll-behavior: auto; }
  .sse-status-dot.connecting { animation: none; }
}

/* ── Loading spinner ───────────────────────────────────── */

.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 20px;
  color: var(--text-3);
  font-size: 13px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* ── Error state ───────────────────────────────────────── */

.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 20px;
  color: var(--text-3);
}

.error-icon {
  font-size: 28px;
  margin-bottom: 8px;
  opacity: 0.6;
}

.error-message {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 4px;
}

.error-suggestion {
  font-size: 12px;
  color: var(--text-3);
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 840px) {
  :root {
    --top-bar-height: 52px;
  }
  body.in-app-chrome {
    --top-bar-height: calc(52px + var(--titlebar-pad-top));
  }
  .top-bar {
    display: flex;
    justify-content: space-between;
    height: var(--top-bar-height, 52px);
  }

  .top-bar-center {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    justify-content: space-between;
    gap: 0;
    padding: 4px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-lg);
    z-index: 120;
  }

  .top-bar-center .tab-btn {
    flex: 1;
    text-align: center;
    padding: 11px 8px;
    font-size: 12px;
  }

  .content {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .tab-scroll {
    padding: 18px var(--page-gutter) 96px;
  }

  .brand-name { font-size: 1.2rem; }

  .today-header-top {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .recall-panel,
  .health-panel {
    padding-top: 12px;
  }

  .recall-input-row {
    flex-direction: column;
  }

  .recall-input-row .primary-btn {
    width: 100%;
    min-height: 44px;
  }

  .recall-input-row .recall-new-question {
    width: 100%;
    min-height: 44px;
  }

  .recall-mode-row {
    flex-wrap: wrap;
  }

  .swimlane-axis,
  .swimlane-row {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .swimlane-overlays {
    left: 82px; /* 72px label + 10px gap */
  }

  .stats-row {
    flex-wrap: wrap;
    gap: 12px 20px;
  }

  .health-pulse-grid {
    grid-template-columns: 1fr 1fr;
  }

  .privacy-mode-desc { display: none; }
  .privacy-mode-list { grid-template-columns: 1fr; }

  .toast-root {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 480px) {
  .brand-name { display: none; }
  .tab-scroll { padding: 14px var(--page-gutter) 88px; }
}

/* ── Today / Health issue diagnosis card ─────────────── */
.today-issue {
  margin: 0 0 1.25rem;
}
.today-issue.hidden { display: none; }

/* Evening Recall — in-Today Ask invite (no push notification) */
.evening-recall {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border, rgba(0,0,0,.12));
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent, #2563eb) 6%, var(--surface, #fff));
}
.evening-recall.hidden { display: none; }
.evening-recall-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.evening-recall-hint {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  color: var(--text-2, #555);
}
.evening-recall-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.privacy-first-glance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border, rgba(0,0,0,.12));
  border-radius: 10px;
  background: color-mix(in srgb, var(--success, #15803d) 7%, var(--surface, #fff));
}
.privacy-first-glance.hidden { display: none; }
.privacy-first-glance-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.privacy-first-glance-hint {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  color: var(--text-2, #555);
  max-width: 42rem;
}
.privacy-first-glance-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.issue-card {
  padding: 1rem 1.15rem 1.1rem;
  border: 1px solid var(--border, rgba(0,0,0,.12));
  border-radius: 10px;
  background: color-mix(in srgb, var(--now, #b91c2c) 6%, var(--surface, #fff));
}
#today-issue .issue-card {
  padding: 0.75rem 0;
  border: none;
  border-radius: 0;
  border-top: 1.5px solid var(--ink);
  background: transparent;
  margin: 0 0 var(--space-block);
}
#today-issue .issue-card-title {
  font-size: 1rem;
  font-weight: 600;
}
#today-issue .issue-pressure-compact {
  margin: 0.15rem 0 0.35rem;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ink-soft);
  font-weight: 300;
}
.issue-card[data-pressure-muted] {
  background: var(--surface-2, #f7f7f5);
  border-color: var(--border, rgba(0,0,0,.12));
}
#today-issue .issue-card[data-pressure-muted] {
  background: transparent;
  border-color: transparent;
  border-top-color: var(--ink);
}
.issue-muted-note {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  color: var(--text-secondary, #5c616b);
  font-style: italic;
}
.issue-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0.35rem;
}
.issue-card-title {
  margin: 0;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1.25;
}
.issue-when, .issue-explain, .issue-context, .issue-pressure, .issue-footer {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
  color: var(--text-secondary, #5c616b);
  line-height: 1.45;
}
.issue-reasons {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.9rem;
  color: var(--text-secondary, #5c616b);
}
.issue-vital-list {
  margin: 0.45rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink-soft, var(--text-secondary, #5c616b));
}
.issue-vital-list li {
  margin: 0.2rem 0;
  padding: 0;
}
.issue-vital-list strong {
  color: var(--ink, #1a1a1a);
  font-weight: 600;
}
.score-breakdown {
  display: none; /* retired — opaque score bars confused users */
}
.score-breakdown-title {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary, #5c616b);
}
.score-breakdown-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  margin: 3px 0;
}
.score-breakdown-label { width: 74px; color: var(--text-secondary, #5c616b); }
.score-breakdown-track {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--border, rgba(0,0,0,.08));
  overflow: hidden;
}
.score-breakdown-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--warn, #c66a2c);
}
.score-breakdown-val {
  width: 22px;
  text-align: right;
  color: var(--text, #1a1d21);
  font-variant-numeric: tabular-nums;
}
.issue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0.85rem;
}
.issue-more {
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border, rgba(0,0,0,.08));
}
.issue-more-label {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary, #5c616b);
}
.issue-more-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-size: 0.9rem;
  padding: 0.25rem 0;
}

/* ── Keyboard shortcuts overlay ──────────────────────── */
.shortcuts-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.shortcuts-overlay.hidden { display: none; }
.shortcuts-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 16, 0.45);
}
body.dark .shortcuts-backdrop {
  background: rgba(0, 0, 0, 0.55);
}
.shortcuts-panel {
  position: relative;
  width: min(420px, 100%);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.2rem 1.3rem 1.1rem;
  box-shadow: var(--shadow-lg);
}
.shortcuts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.shortcuts-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 400;
  font-style: italic;
}
.shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}
.shortcuts-list > div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}
.shortcuts-list dt {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.shortcuts-list dd {
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
}

/* ── Modal (wipe / feedback) ─────────────────────────── */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-root.hidden { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 16, 0.45);
}
.modal-panel {
  position: relative;
  width: min(440px, 100%);
  max-height: min(90vh, 640px);
  overflow: auto;
  background: var(--surface, #f7f5f1);
  color: var(--text, #1c1b19);
  border-radius: 12px;
  padding: 1.35rem 1.4rem 1.2rem;
  box-shadow: 0 18px 48px rgba(0,0,0,.18);
}
.modal-title {
  margin: 0 0 0.75rem;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 1.5rem;
  font-weight: 400;
}
.modal-body { display: flex; flex-direction: column; gap: 0.45rem; }
.modal-label { font-size: 0.88rem; margin-top: 0.35rem; }
.modal-input, .modal-textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  font: inherit;
  border: 1px solid var(--border, rgba(0,0,0,.15));
  border-radius: 8px;
  background: var(--bg, #fff);
  color: inherit;
}
.modal-textarea { resize: vertical; min-height: 110px; }
.modal-file { font-size: 0.85rem; }
.modal-warn { margin: 0; color: var(--danger, #b91c2c); font-size: 0.95rem; }
.modal-error { margin: 0.35rem 0 0; color: var(--danger, #b91c2c); font-size: 0.9rem; }
.modal-error.hidden { display: none; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 1.1rem;
}
.fb-preview { margin-top: 0.35rem; }
.fb-preview.hidden { display: none; }

/* ── First-run tour ──────────────────────────────────── */
.tour-root {
  position: fixed;
  inset: 0;
  z-index: 1300;
  pointer-events: none;
}
.tour-root.hidden { display: none; }
.tour-backdrop {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--ink) 38%, transparent);
  pointer-events: auto;
}
.tour-root.has-target .tour-backdrop {
  background: transparent;
}
.tour-spotlight {
  position: fixed;
  z-index: 1301;
  border: 2px solid color-mix(in srgb, var(--now) 88%, white 12%);
  border-radius: 12px;
  box-shadow:
    0 0 0 9999px color-mix(in srgb, var(--ink) 48%, transparent),
    0 0 0 4px color-mix(in srgb, var(--now) 16%, transparent),
    0 10px 34px rgba(0, 0, 0, 0.22);
  pointer-events: none;
  transition: left 0.18s ease, top 0.18s ease, width 0.18s ease, height 0.18s ease;
}
.tour-feature-target {
  scroll-margin: calc(var(--top-bar-height, 56px) + 28px) 20px 220px;
}
.tour-panel {
  position: fixed;
  /* Dock before JS runs — without this the panel paints top-left then jumps. */
  right: 16px;
  bottom: 16px;
  z-index: 1302;
  width: min(410px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.3rem 1.35rem 1.15rem;
  box-shadow: var(--shadow-lg);
  animation: tour-in 0.28s ease;
  pointer-events: auto;
}
@keyframes tour-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.tour-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0.45rem;
}
.tour-kicker {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--now);
}
.tour-progress {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.67rem;
  color: var(--text-3);
}
.tour-title {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.tour-body {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--text-2);
}
.tour-use {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.75rem;
  border-left: 2px solid var(--now);
  background: color-mix(in srgb, var(--now) 6%, transparent);
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.45;
}
.tour-progress-track {
  height: 3px;
  margin: 1rem 0 0.95rem;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.tour-progress-track > span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--now);
  border-radius: inherit;
  transition: width 0.2s ease;
}
.tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.tour-actions-main {
  display: flex;
  gap: 8px;
  align-items: center;
}
.tour-actions .linkish {
  padding-left: 0;
  white-space: nowrap;
}
.tour-settings-row {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 720px) {
  body.tour-active .tab-scroll {
    /* Extra temporary scroll room keeps the final card in a long tab visible
       above the guided-tour bottom sheet. Removed as soon as the tour closes. */
    padding-bottom: min(52vh, 440px);
  }
  .tour-panel {
    left: 12px;
    right: 12px;
    bottom: 12px;
    top: auto;
    width: auto;
    max-height: min(48vh, 430px);
    padding: 1rem 1.05rem 0.95rem;
  }
  .tour-title { font-size: 1.3rem; }
  .tour-body { font-size: 0.9rem; }
  .tour-use { font-size: 0.8rem; padding: 0.5rem 0.6rem; }
  .tour-spotlight { border-radius: 9px; }
}
.fb-preview img {
  max-width: 100%;
  max-height: 160px;
  border-radius: 8px;
  object-fit: contain;
}

/* ── Insight cards (Focus Flow, Unlock, Journal, Week extras) ─ */
.today-insight-card {
  margin: 0 0 1rem;
  padding: 0.85rem 0.95rem;
  border-top: 1px solid var(--border);
}
.today-aside .today-insight-card {
  margin: 0;
  padding: 0.15rem 0 0.35rem;
  border-top: none;
}
.today-hero,
.today-glance {
  margin: 0 0 var(--space-section);
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}
.today-hero-narrative {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ink-soft);
  font-weight: 300;
}
.today-hero-narrative strong {
  color: var(--ink);
  font-weight: 500;
}

/* Above-fold day glance — facts, not a card stack */
.today-glance-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 2rem;
  margin: 0;
  padding: 0.85rem 0 0;
  border-top: 1px solid var(--hairline);
}
.today-glance-fact {
  min-width: 0;
}
.today-glance-fact dt {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 0.2rem;
}
.today-glance-fact dd {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--ink);
  font-weight: 450;
  overflow-wrap: anywhere;
}
.today-glance-empty {
  margin: 0;
  padding: 0.75rem 0 0;
  border-top: 1px solid var(--hairline);
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-soft);
  font-weight: 300;
}
.today-glance-ask {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
@media (max-width: 640px) {
  .today-glance-facts {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

.today-insights-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  padding: 0;
}
.today-insights-stack:empty {
  display: none;
}
.today-insight-card-item {
  background: transparent;
  border: none;
  border-top: 1px solid var(--hairline);
  border-radius: 0;
  padding: 0.75rem 0;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}
.today-insight-card-icon {
  flex-shrink: 0;
  font-size: 1.15rem;
  line-height: 1.4;
  width: 1.5rem;
  text-align: center;
}
.today-insight-card-body {
  flex: 1;
  min-width: 0;
}
.today-insight-card-title {
  font-size: 1.05rem;
  font-weight: 650;
  text-transform: none;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 0.35rem;
}
.today-insight-card-text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
}
.today-insight-card-item.empty-state-card {
  background: color-mix(in srgb, var(--accent) 4%, transparent);
  border-color: color-mix(in srgb, var(--accent) 15%, var(--border));
}
.today-insight-card-item.empty-state-card .today-insight-card-title {
  color: var(--accent);
}
.today-details {
  margin: 0.75rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}
.today-details > summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.35rem 0;
  user-select: none;
}
.today-details[open] > summary {
  margin-bottom: 0.5rem;
}
.today-details .today-aside {
  padding: 0;
}
.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}
.card-title-row .card-title { margin: 0; }
.insight-narrative {
  margin: 0 0 0.55rem;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text-2);
}
.insight-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  margin-bottom: 0.5rem;
}
.insight-metric {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--text-2);
}
.insight-metric strong {
  color: var(--text);
  font-weight: 600;
}
.insight-metric.quality-deep { color: var(--now); }
.insight-metric.quality-fragmented { color: var(--danger, #b91c2c); }
.insight-metric.quality-heavy { color: var(--danger, #b91c2c); }
.insight-metric.quality-light { color: var(--text-2); }
.insight-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.insight-chip {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface) 80%, var(--ink) 4%);
}
.insight-chip.btnish {
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.unlock-fires ul {
  margin: 0.25rem 0 0.5rem;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  color: var(--text-2);
}
.unlock-issue-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
.unlock-issue-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.unlock-issue-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.unlock-issue-label {
  font-size: 13px;
  color: var(--text);
}
.unlock-issue-when {
  font-size: 11px;
  color: var(--text-3);
}
.unlock-issue-ask {
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--seize);
  text-decoration: none;
}
.unlock-issue-ask:hover {
  color: var(--ink);
  text-decoration: underline;
}
.journal-honesty-hint {
  margin-top: 0.5rem;
}
.journal-note {
  margin-bottom: 0.65rem;
}
.journal-note p {
  margin: 0 0 0.2rem;
  font-size: 0.9rem;
  line-height: 1.4;
}
.pattern-lib-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  font-size: 0.85rem;
}
.tiny-btn {
  flex-shrink: 0;
  font: inherit;
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
.tiny-btn:hover { color: var(--text); border-color: var(--text-2); }
.muted.tiny { font-size: 0.78rem; color: var(--text-2); }

.past-day-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid color-mix(in srgb, var(--accent, #a33) 35%, var(--border));
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent, #a33) 8%, var(--surface));
  font-size: 0.9rem;
}
.past-day-banner.hidden { display: none; }

.demo-ask-banner {
  margin: 0.5rem 1rem 0;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent, #b84a2a) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent, #b84a2a) 35%, transparent);
  font-size: 0.9rem;
  color: var(--text-1, inherit);
}
.demo-ask-banner.hidden { display: none; }

/* Website demo — Health teaser / FOMO gate (centered in the Health tab) */
body.kairos-web-demo #tab-health.demo-health-tab {
  position: relative;
}
body.kairos-web-demo .demo-health-shell > .health-panel {
  filter: blur(7px);
  opacity: 0.45;
  pointer-events: none;
  user-select: none;
  transform: scale(1.01);
}
body.kairos-web-demo #tab-health > .demo-health-gate {
  position: absolute;
  inset: 0;
  z-index: 6;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.25rem;
  box-sizing: border-box;
  background:
    radial-gradient(ellipse 70% 55% at 50% 45%, color-mix(in srgb, var(--surface, #f2efe8) 88%, transparent), transparent 70%),
    color-mix(in srgb, var(--bg, #e9e7e1) 35%, transparent);
  pointer-events: auto;
}
.demo-health-gate-card {
  width: min(26rem, 100%);
  text-align: center;
  padding: 1.5rem 1.35rem 1.35rem;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--ink, #1a1916) 14%, transparent);
  background: color-mix(in srgb, var(--surface, #f7f5f0) 92%, transparent);
  box-shadow: 0 18px 48px color-mix(in srgb, var(--ink, #1a1916) 12%, transparent);
}
.demo-health-gate-kicker {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--now, #b91c2c);
}
.demo-health-gate-card h2 {
  margin: 0 0 0.65rem;
  font-size: 1.35rem;
  line-height: 1.25;
  font-weight: 650;
  color: var(--ink, #1a1916);
}
.demo-health-gate-copy {
  margin: 0 0 1.15rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-2, #5c5954);
}
.demo-health-gate-copy em { font-style: italic; }
.demo-health-gate-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.15rem;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 650;
  text-decoration: none;
  color: var(--bg, #e9e7e1);
  background: var(--ink, #1a1916);
}
.demo-health-gate-cta:hover { opacity: 0.9; }
body.dark .demo-health-gate-cta {
  color: var(--ink, #1a1916);
  background: var(--bg, #f2efe8);
}
.demo-health-gate-sub {
  margin: 0.85rem 0 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text-3, #8a8680);
}

.update-banner {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid color-mix(in srgb, var(--accent, #a33) 30%, var(--border));
  background: color-mix(in srgb, var(--accent, #a33) 10%, var(--surface));
  padding: 0.55rem 1rem 0.45rem;
}
.update-banner.hidden { display: none; }
.update-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  max-width: 1100px;
  margin: 0 auto;
}
.update-banner-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  font-size: 0.88rem;
  color: var(--text-2);
}
.update-banner-copy strong {
  color: var(--text);
  font-weight: 600;
}
.update-banner-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}
.update-banner-actions .small-btn.primary {
  background: var(--ink, #1a1a1a);
  color: var(--surface, #fff);
  border-color: transparent;
}
.update-banner-progress {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  max-width: 1100px;
  margin: 0.4rem auto 0;
}
.update-banner-progress.hidden { display: none; }
.update-banner-progress-track {
  flex: 1;
  min-width: 0;
  height: 4px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--ink) 12%, transparent);
  overflow: hidden;
}
.update-banner-bar {
  height: 100%;
  width: 0%;
  background: var(--accent, #a33);
  transition: width 0.2s ease;
}
.update-banner-percent {
  flex-shrink: 0;
  min-width: 2.6em;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--text-2);
  text-align: right;
}
.settings-row-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.time-machine {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 92%, var(--ink) 3%);
}
.time-machine.hidden { display: none; }
.time-machine-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem 0.75rem;
  margin-bottom: 0.55rem;
}
.tm-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.72rem;
  color: var(--text-2);
}
.tm-field input[type="date"],
.tm-field input[type="time"] {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.28rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
.time-machine-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
  font-size: 0.8rem;
}
.time-machine-row input[type="range"] {
  width: 100%;
  accent-color: var(--now);
}
.time-machine-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  min-width: 3.2rem;
  text-align: right;
}
.time-machine-peek {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
  min-height: 1.4rem;
}
.tm-chip {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
  background: color-mix(in srgb, var(--c, var(--ink)) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--c, var(--border)) 40%, transparent);
}
.tm-chip.file {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}

.energy-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 88px;
  margin-top: 0.5rem;
}
.energy-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
}
.energy-fill {
  width: 100%;
  max-width: 14px;
  border-radius: 3px 3px 0 0;
  background: color-mix(in srgb, var(--now) 70%, var(--ink) 10%);
  min-height: 2px;
}
.energy-col span {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text-2);
  margin-top: 0.2rem;
  height: 0.7rem;
}

.heatmap-list { margin-top: 0.4rem; }
.heatmap-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 2fr auto auto;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
}
.heatmap-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}
.heatmap-track {
  height: 8px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  overflow: hidden;
}
.heatmap-fill {
  height: 100%;
  border-radius: 4px;
  background: color-mix(in srgb, var(--now) 55%, var(--ink) 15%);
}
.heatmap-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-2);
}
.dep-list { margin: 0.4rem 0 0.65rem; }
.dep-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.5rem;
  font-size: 0.85rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.dep-row-name {
  font-weight: 500;
  flex-shrink: 0;
}
.dep-row-meta {
  display: inline-flex;
  gap: 0.3rem;
  font-size: 0.72rem;
  color: var(--text-3);
  flex-shrink: 0;
}
.dep-row-depth {
  padding: 0 4px;
  border-radius: 4px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
}
.dep-row-depth-direct {
  background: color-mix(in srgb, var(--accent, #a33) 12%, transparent);
  color: color-mix(in srgb, var(--accent, #a33) 80%, var(--text));
}
.dep-row-depth-indirect {
  background: color-mix(in srgb, var(--text-3) 10%, transparent);
  color: var(--text-3);
}
.dep-row-pid {
  font-family: var(--font-mono);
}
.dep-row-evts {
  font-family: var(--font-mono);
}
.dep-list-details {
  margin: 0.5rem 0 0.75rem;
  font-size: 0.85rem;
}
.dep-list-details summary {
  cursor: pointer;
  color: var(--text-2);
  margin-bottom: 0.35rem;
}
.dep-scrub {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 0.45rem 0 0.65rem;
}
.dep-scrub-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.dep-scrub-presets .small-btn.active {
  border-color: var(--accent, #a33);
  color: var(--ink);
  background: color-mix(in srgb, var(--accent, #a33) 12%, var(--surface));
}
.dep-scrub-custom {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.45rem 0.65rem;
}
.dep-diagram-wrap {
  margin: 0.35rem 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 94%, var(--ink) 4%);
  overflow: hidden;
}
.dep-diagram {
  display: block;
  width: 100%;
  height: auto;
  max-height: 420px;
  color: var(--text-3);
  cursor: grab;
}
.dep-graph-svg {
  touch-action: none;
  user-select: none;
}
.dep-edge {
  stroke: color-mix(in srgb, var(--text-3) 70%, transparent);
  stroke-width: 1.4;
  fill: none;
  transition: opacity 0.15s ease, stroke-width 0.15s ease;
}
.dep-edge-highlight {
  stroke-width: 2.5;
  opacity: 1;
}
.dep-edge-dim {
  opacity: 0.12;
}
.dep-edge-label {
  font-size: 10px;
  fill: var(--text-3);
  text-anchor: middle;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.dep-edge-label-dim {
  opacity: 0.12;
}
.dep-edge-spawns { stroke: color-mix(in srgb, var(--accent, #a33) 55%, var(--text-3)); }
.dep-edge-feeds { stroke: color-mix(in srgb, #3a6b4a 50%, var(--text-3)); }
.dep-edge-blocks { stroke: color-mix(in srgb, #8a5a2a 55%, var(--text-3)); }
.dep-edge-contends { stroke: color-mix(in srgb, #5a4a7a 50%, var(--text-3)); }
.dep-node circle {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 1.5;
  transition: stroke 0.15s ease;
}
.dep-node-root circle {
  fill: color-mix(in srgb, var(--accent, #a33) 14%, var(--surface));
  stroke: color-mix(in srgb, var(--accent, #a33) 55%, var(--border));
  stroke-width: 2;
}
.dep-node-direct circle {
  stroke: color-mix(in srgb, var(--accent, #a33) 35%, var(--border));
}
.dep-node-indirect circle {
  stroke-dasharray: 3 2;
  opacity: 0.75;
}
.dep-node text {
  font-size: 10px;
  fill: var(--text);
  text-anchor: middle;
  pointer-events: none;
}
.dep-node-badge {
  font-size: 8px;
  fill: var(--text-3);
  text-anchor: middle;
  pointer-events: none;
}
.dep-node:hover circle {
  stroke: var(--accent, #a33);
  stroke-width: 2;
}
.dep-node-dim {
  opacity: 0.2;
  transition: opacity 0.15s ease;
}
.dep-legend-text {
  font-size: 8px;
  fill: var(--text-3);
  pointer-events: none;
}
.dep-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.35rem;
}
/* Dependency skeleton loading ─────────────────────────────────────────── */
@keyframes dep-pulse {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.6; }
}
.dep-skeleton circle {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 1;
  animation: dep-pulse 1.8s ease-in-out infinite;
}
.dep-skeleton-root {
  stroke-width: 1.5;
}
.dep-skeleton line {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  opacity: 0.2;
}
.dep-loading-msg {
  text-align: center;
  margin: 0.2rem 0 0;
}
.dep-help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text-3) 25%, transparent);
  color: var(--text-2);
  font-size: 10px;
  font-weight: 600;
  cursor: help;
  vertical-align: middle;
  margin-left: 0.3rem;
  line-height: 1;
  position: relative;
  top: -1px;
}
.dep-cancel {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.3rem;
}
.dep-stale-badge {
  display: inline-block;
  font-size: 10px;
  color: var(--text-3);
  background: color-mix(in srgb, var(--text-3) 10%, transparent);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 0.4rem;
  cursor: pointer;
}
.dep-stale-badge:hover {
  color: var(--text-2);
  border-color: var(--text-3);
}
.dep-inline-ask {
  margin-top: 0.6rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 92%, var(--ink) 4%);
}
.dep-inline-ask-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}
.dep-inline-ask-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.dep-inline-ask-source {
  font-size: 10px;
  color: var(--text-3);
}
.dep-inline-ask-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
}
.dep-inline-ask-loading {
  font-size: 12px;
  color: var(--text-3);
  font-style: italic;
}
.dep-inline-ask-low-conf {
  border-style: dashed;
  opacity: 0.9;
}
.dep-inline-ask-low-conf .dep-inline-ask-body {
  color: var(--text-2);
}
.dep-inline-ask-disclaimer {
  font-size: 0.7rem;
  color: var(--text-3);
  font-style: italic;
  margin: 0.25rem 0 0;
}
.recall-ask-answer-low-conf {
  color: var(--text-2);
  border-left: 2px dashed var(--border);
  padding-left: 0.75rem;
}
.recall-ask-low-conf-note {
  font-size: 0.7rem;
  color: var(--text-3);
  font-style: italic;
  margin: 0.25rem 0 0.5rem;
}

/* Process detail panel ────────────────────────────────────────────────── */
.dep-node-detail {
  margin-top: 0.4rem;
}
.dep-node-detail:empty {
  display: none;
}
.dep-node-detail-loading {
  font-size: 11px;
  color: var(--text-3);
  padding: 0.3rem 0;
}
.dep-node-detail-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  font-size: 12px;
  line-height: 1.5;
}
.dep-node-detail-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.dep-node-detail-header strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dep-node-detail-status {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.dep-node-detail-status.alive {
  background: color-mix(in srgb, var(--green, #2d8a4e) 20%, transparent);
  color: var(--green, #2d8a4e);
}
.dep-node-detail-status.dead {
  background: color-mix(in srgb, var(--text-3) 15%, transparent);
  color: var(--text-3);
}
.dep-node-detail-close {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-3);
  padding: 0 2px;
  line-height: 1;
}
.dep-node-detail-close:hover {
  color: var(--text);
}
.dep-node-detail-meta {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 0.2rem;
}
.dep-detail-live {
  display: inline-block;
  font-size: 11px;
  color: var(--text-2);
  margin-top: 0.15rem;
}
.dep-node-detail-sessions {
  margin-top: 0.3rem;
}
.dep-node-detail-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  display: block;
  margin-bottom: 0.1rem;
}
.dep-node-detail-session {
  font-size: 11px;
  color: var(--text-2);
  font-family: var(--font-mono);
}

.today-advanced,
.week-advanced {
  margin-top: 0.75rem;
}
.today-advanced > summary,
.week-advanced > summary {
  cursor: pointer;
  /* Size/weight come from shared section hierarchy (Health parity). */
  font-family: var(--font);
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.025em;
  text-transform: none;
  color: var(--ink);
  padding: 0.35rem 0;
}
.today-advanced[open] > summary,
.week-advanced[open] > summary {
  color: var(--text);
}
.advanced-caption {
  margin: 0.25rem 0 0.75rem;
  font-style: italic;
}
.week-advanced-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}
#week-view .week-advanced-grid > .card {
  margin: 0 !important;
  padding: 0.85rem 0 0.25rem !important;
  border: none !important;
  border-top: 1px solid color-mix(in srgb, var(--ink) 22%, transparent) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}
#week-view .week-advanced-grid > .card:first-child {
  border-top: none !important;
  padding-top: 0.25rem !important;
}

/* Anomaly watermark — subtle, non-alerting */
.timeline-anomaly {
  margin-left: 0.4rem;
  font-size: 0.6rem;
  color: color-mix(in srgb, var(--now) 65%, var(--text-2));
  vertical-align: middle;
  cursor: help;
  opacity: 0.75;
}
.timeline-entry.has-anomaly .timeline-color {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--now) 45%, transparent);
}

/* What's stored — inventory always visible; expands on findings too */
.pii-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
}
.pii-bar-status {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--ink-soft);
  font-weight: 400;
}
#settings-personal-data.is-pii-ok .pii-bar-status {
  color: var(--ink);
}
#settings-personal-data.is-pii-review .pii-bar-status {
  color: var(--ink);
  font-weight: 500;
}
.pii-bar #btn-pii-audit {
  flex: 0 0 auto;
}
.pii-audit {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--hairline);
}
.pii-audit[hidden] {
  display: none !important;
}
.pii-inventory {
  margin: 0 0 0.85rem;
}
.pii-inventory-title {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.pii-inventory-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--ink-soft);
}
.pii-inventory-list li::before {
  content: "· ";
  color: var(--ink);
}
.pii-lede {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ink-soft);
  font-weight: 300;
}
.pii-findings {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin: 0 0 0.25rem;
}
.pii-finding {
  padding: 0.55rem 0 0;
  border-top: 1px solid var(--hairline);
}
.pii-finding:first-child {
  border-top: none;
  padding-top: 0;
}
.pii-finding-info .pii-finding-title {
  font-weight: 550;
  color: var(--text-2);
}
.pii-finding-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 0.2rem;
}
.pii-finding-why {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-2);
}
.pii-sample-list {
  margin: 0 0 0.4rem;
  padding-left: 1.05rem;
  font-size: 0.8rem;
  color: var(--text-2);
}
.pii-sample-list code {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  word-break: break-all;
}
.pii-finding-go { margin-top: 0.1rem; }
.pii-footnote { margin: 0.35rem 0 0; line-height: 1.4; }

/* Legacy leftovers (safe if older markup briefly appears) */
.pii-head { display: none; }
.pii-verdict,
.pii-headline,
.pii-scanned,
.pii-idle { margin: 0; }

/* ── Health advanced tools ───────────────────────────── */
.health-tool-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.7rem 0;
}
.health-tool-controls input,
.health-tool-controls select {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  padding: 0.45rem 0.55rem;
}
.health-tool-controls input {
  flex: 1 1 190px;
}
.health-tool-controls select {
  flex: 0 0 auto;
}
.health-tool-candidates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.55rem 0;
}
.health-tool-candidates > .list-collapse-toggle {
  flex: 1 0 100%;
}
.health-evidence-guard {
  margin: 0.55rem 0 0.75rem;
  padding: 0.45rem 0.6rem;
  border-left: 2px solid var(--text-2);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
  color: var(--text-2);
  font-size: 0.76rem;
  line-height: 1.45;
}
.health-evidence-guard.observed {
  border-left-color: color-mix(in srgb, var(--now) 65%, var(--text-2));
}

.ancestry-tree {
  overflow-x: auto;
  padding: 0.25rem 0 0.5rem;
}
.ancestry-tree ul {
  position: relative;
  margin: 0;
  padding-left: 1.35rem;
  list-style: none;
}
.ancestry-tree > ul {
  padding-left: 0;
}
.ancestry-tree li {
  position: relative;
  padding: 0.3rem 0 0 1rem;
  animation: ancestryFadeIn 0.25s ease both;
}
.ancestry-tree li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 0.75rem;
  height: 1.05rem;
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.ancestry-tree > ul > li {
  padding-left: 0;
}
.ancestry-tree > ul > li::before {
  display: none;
}
.ancestry-node {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  max-width: 280px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
}
.ancestry-node small {
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  white-space: nowrap;
}
.ancestry-node.is-seed {
  border-color: var(--now);
  box-shadow: inset 3px 0 0 var(--now);
}
.ancestry-node.is-seed {
  border-color: var(--now);
  box-shadow: inset 3px 0 0 var(--now);
  animation: ancestryPulse 3s ease-in-out 3;
}
.ancestry-node:hover {
  border-color: var(--text-2);
}
.ancestry-cycle {
  cursor: default;
  color: var(--text-2);
}
.ancestry-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  vertical-align: middle;
  margin-right: 0.15rem;
}
.ancestry-dot.alive {
  background: #3a9a5a;
  box-shadow: 0 0 4px #3a9a5a80;
}
.ancestry-dot.dead {
  background: var(--text-3);
  opacity: 0.5;
}
.ancestry-age {
  font-size: 0.6rem;
  color: var(--text-3);
  font-family: var(--font-mono);
}
.ancestry-cross-link {
  font-size: 0.6rem;
  padding: 0 4px;
  margin-left: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.ancestry-node:hover + .ancestry-cross-link,
.ancestry-cross-link:hover {
  opacity: 1;
}

/* Ancestry view toggle (Tree / Timeline) */
.ancestry-view-toggle {
  display: flex;
  gap: 4px;
  margin: 0 0 0.35rem;
}
.ancestry-view-toggle .small-btn {
  font-size: 0.7rem;
  padding: 2px 10px;
}
.ancestry-view-toggle .small-btn.active {
  background: var(--accent, #a33);
  color: #fff;
  border-color: var(--accent, #a33);
}

/* Ancestry timeline view */
.ancestry-timeline {
  margin-top: 0.5rem;
  overflow-x: auto;
}
.ancestry-tl-header {
  display: flex;
  align-items: stretch;
  margin-bottom: 4px;
}
.ancestry-tl-header-label {
  width: var(--label-width, 150px);
  flex-shrink: 0;
}
.ancestry-tl-header-track {
  position: relative;
  flex: 1;
  height: 18px;
  border-bottom: 1px solid var(--border);
}
.ancestry-tl-tick {
  position: absolute;
  bottom: 2px;
  transform: translateX(-50%);
  font-size: 0.55rem;
  color: var(--text-3);
  white-space: nowrap;
  font-family: var(--font-mono);
}
.ancestry-tl-body {
  position: relative;
}
.ancestry-tl-lane {
  display: flex;
  align-items: center;
  height: var(--lane-height, 32px);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.ancestry-tl-lane.is-seed {
  background: color-mix(in srgb, var(--accent, #a33) 6%, transparent);
}
.ancestry-tl-lane:hover {
  background: color-mix(in srgb, var(--accent, #a33) 12%, transparent);
}
.ancestry-tl-label {
  width: var(--label-width, 150px);
  flex-shrink: 0;
  font-size: 0.7rem;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 6px;
}
.ancestry-tl-track {
  position: relative;
  flex: 1;
  height: 100%;
}
.ancestry-tl-bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 14px;
  border-radius: 3px;
  opacity: 0.8;
}
.ancestry-tl-bar.alive {
  opacity: 1;
}
.ancestry-tl-arrows {
  position: absolute;
  top: 0;
  left: var(--label-width, 150px);
  width: calc(100% - var(--label-width, 150px));
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.ancestry-tl-arrow {
  stroke: var(--text-3);
  stroke-width: 1.2;
  stroke-dasharray: 4 3;
  fill: none;
  opacity: 0.6;
  animation: ancestryDrawArrow 0.6s ease-out both;
}
.ancestry-tl-arrow:nth-child(1) { animation-delay: 0.1s; }
.ancestry-tl-arrow:nth-child(2) { animation-delay: 0.2s; }
.ancestry-tl-arrow:nth-child(3) { animation-delay: 0.3s; }
.ancestry-tl-arrow:nth-child(4) { animation-delay: 0.4s; }
.ancestry-tl-arrow:nth-child(5) { animation-delay: 0.5s; }
.ancestry-tl-arrow:nth-child(n+6) { animation-delay: 0.6s; }

/* ── Ancestry animations (keyframes) ────────────────────── */
@keyframes ancestryFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes ancestryPulse {
  0%, 100% { box-shadow: inset 3px 0 0 var(--now); }
  50%      { box-shadow: inset 3px 0 0 var(--now), 0 0 8px var(--now); }
}
@keyframes ancestryDrawArrow {
  from { stroke-dashoffset: 200; }
  to   { stroke-dashoffset: 0; }
}

/* ── Ancestry edge toggle (#5 richer edge types) ────────── */
.ancestry-edge-toggle {
  display: flex;
  gap: 3px;
  margin: 0.25rem 0 0.15rem;
}
.ancestry-edge-btn {
  font-size: 0.65rem;
  padding: 2px 8px;
}
.ancestry-edge-btn.active {
  background: var(--accent, #a33);
  color: #fff;
  border-color: var(--accent, #a33);
}

/* ── Ancestry legend ────────────────────────────────────── */
.ancestry-legend {
  display: flex;
  gap: 12px;
  margin: 0.15rem 0 0.25rem;
  font-size: 0.6rem;
  color: var(--text-3);
}
.ancestry-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ancestry-legend-swatch {
  display: inline-block;
  width: 12px;
  height: 3px;
  border-radius: 1px;
}
.ancestry-legend-swatch.edge-spawns {
  background: color-mix(in srgb, var(--accent, #a33) 55%, var(--text-3));
}
.ancestry-legend-swatch.edge-feeds {
  background: color-mix(in srgb, #3a6b4a 50%, var(--text-3));
}
.ancestry-legend-swatch.edge-blocks {
  background: color-mix(in srgb, #8a5a2a 55%, var(--text-3));
}

/* Timeline arrows with edge type colors */
.ancestry-tl-arrow.edge-feeds {
  stroke: color-mix(in srgb, #3a6b4a 50%, var(--text-3));
}
.ancestry-tl-arrow.edge-blocks {
  stroke: color-mix(in srgb, #8a5a2a 55%, var(--text-3));
}

/* ── Cross-time comparison (#4) ─────────────────────────── */
.ancestry-compare-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0.15rem 0;
  font-size: 0.65rem;
}
.ancestry-compare-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
}
.ancestry-compare-check {
  accent-color: var(--accent, #a33);
}
.ancestry-compare-label {
  color: var(--text-2);
}

/* Time travel slider */
.ancestry-time-travel {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.ancestry-time-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border, #444);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  min-width: 60px;
  max-width: 180px;
}
.ancestry-time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent, #a33);
  border: 2px solid var(--surface, #222);
  cursor: pointer;
  transition: transform 0.1s ease;
}
.ancestry-time-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}
.ancestry-time-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent, #a33);
  border: 2px solid var(--surface, #222);
  cursor: pointer;
}
.ancestry-time-label {
  font-size: 0.6rem;
  color: var(--text-2);
  font-family: var(--font-mono);
  white-space: nowrap;
  min-width: 48px;
}
.ancestry-slider-spinner {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  display: none;
}
.ancestry-time-travel.loading .ancestry-slider-spinner {
  display: inline-block;
  background: var(--accent, #a33);
  animation: ancestrySliderPulse 0.6s ease-in-out infinite alternate;
  box-shadow: 0 0 4px var(--accent, #a33);
}
@keyframes ancestrySliderPulse {
  from { opacity: 0.3; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}

.ancestry-snapshot-count {
  font-size: 0.55rem;
  color: var(--text-3, #888);
  font-family: var(--font-mono);
  background: var(--surface-2, rgba(255,255,255,0.04));
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
  cursor: help;
}

/* Diff annotations */
.ancestry-node-diff-new {
  border-left: 3px solid #3a9a5a !important;
  background: rgba(58, 154, 90, 0.06) !important;
}
.ancestry-node-diff-new::after {
  content: "new";
  font-size: 0.55rem;
  color: #3a9a5a;
  font-weight: 600;
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.ancestry-node-diff-gone {
  border-left: 3px solid #c44 !important;
  background: rgba(204, 68, 68, 0.06) !important;
  opacity: 0.7;
}
.ancestry-node-diff-gone::after {
  content: "gone";
  font-size: 0.55rem;
  color: #c44;
  font-weight: 600;
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ── Timeline diff annotations (#4) ─────────────────────── */
.ancestry-tl-lane.tl-diff-new {
  background: rgba(58, 154, 90, 0.04);
}
.ancestry-tl-lane.tl-diff-new .ancestry-tl-label::after {
  content: " ✦new";
  font-size: 0.55rem;
  color: #3a9a5a;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.ancestry-tl-bar.tl-diff-new {
  box-shadow: 0 0 6px rgba(58, 154, 90, 0.5);
}
.ancestry-tl-lane.tl-diff-gone {
  opacity: 0.6;
  background: rgba(204, 68, 68, 0.04);
}
.ancestry-tl-lane.tl-diff-gone .ancestry-tl-label::after {
  content: " ✦gone";
  font-size: 0.55rem;
  color: #c44;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.ancestry-tl-bar.tl-diff-gone {
  opacity: 0.5;
}

/* ── Ancestry group node ────────────────────────────────── */
.ancestry-group-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px dashed var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
}
.ancestry-group-btn:hover {
  border-color: var(--text-2);
}
.ancestry-group-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--text-3);
  color: var(--surface);
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1;
}

/* ── Ancestry detail panel ──────────────────────────────── */
.ancestry-detail-panel {
  margin: 0.5rem 0 0.5rem 2rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  font-size: 0.78rem;
  max-width: 400px;
}
.ancestry-detail-panel h4 {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  color: var(--text);
}
.ancestry-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-2);
}
.ancestry-detail-row:last-child {
  border-bottom: none;
}
.ancestry-detail-row span:first-child {
  color: var(--text-3);
}
.ancestry-detail-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.ancestry-detail-actions .small-btn {
  font-size: 0.7rem;
  padding: 2px 8px;
}

/* ── Resource bar overlay ───────────────────────────────── */
.ancestry-res-bar {
  display: inline-block;
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  vertical-align: middle;
  margin-left: 4px;
  overflow: hidden;
}
.ancestry-res-bar-fill {
  display: block;
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}
.ancestry-res-bar-fill.high { background: var(--color-high, #b91c2c); }
.ancestry-res-bar-fill.medium { background: var(--color-mid, #b56a1b); }
.ancestry-res-bar-fill.low { background: var(--color-low, #2f5d50); }

/* ── Ancestry icon ──────────────────────────────────────── */
.ancestry-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: contain;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ── Ancestry context menu ──────────────────────────────── */
.ancestry-context-menu {
  position: fixed;
  z-index: 1000;
  min-width: 160px;
  padding: 0.25rem 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.ancestry-context-menu button {
  display: block;
  width: 100%;
  padding: 0.4rem 0.75rem;
  border: none;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.75rem;
  text-align: left;
  cursor: pointer;
}
.ancestry-context-menu button:hover {
  background: var(--surface-2);
}
.ancestry-context-menu button.destructive {
  color: var(--color-high, #b91c2c);
}

/* ── Ancestry breadcrumb ────────────────────────────────── */
.ancestry-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
  margin-bottom: 0.35rem;
  font-size: 0.7rem;
}
.ancestry-breadcrumbs button {
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 0.7rem;
  cursor: pointer;
}
.ancestry-breadcrumbs button:hover {
  border-color: var(--text-2);
  color: var(--text);
}
.ancestry-breadcrumbs .sep {
  color: var(--text-3);
  font-size: 0.6rem;
}
.ancestry-breadcrumbs .current {
  color: var(--text-3);
  font-size: 0.7rem;
}

/* ── Ancestry export ────────────────────────────────────── */
.ancestry-export-btn {
  font-size: 0.65rem;
  padding: 2px 8px;
  margin-left: auto;
}

.ancestry-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.correlation-selected {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid color-mix(in srgb, var(--now) 45%, var(--border));
  border-radius: 8px;
}
.correlation-selected span {
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-align: right;
}
.correlation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.correlation-grid section {
  min-width: 0;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.correlation-grid h4 {
  margin: 0 0 0.45rem;
  font-size: 0.76rem;
  font-weight: 600;
}
.correlation-row {
  display: flex;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.22rem 0;
  font-size: 0.78rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.correlation-row:last-child {
  border-bottom: 0;
}
.correlation-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.correlation-row small {
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .correlation-grid {
    grid-template-columns: 1fr;
  }
  .correlation-selected {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ── Responsive safety net (all platforms) ───────────────
   The window can shrink to 720px (min size on every shell). Content must
   reflow instead of being clipped by the tab-scroll overflow-x guard. */

/* Media and embedded drawings scale down with their container. */
.tab-scroll img,
.tab-scroll svg,
.tab-scroll canvas,
.tab-scroll video {
  max-width: 100%;
}

/* Raw output and long identifiers wrap instead of pushing the layout out. */
.tab-scroll pre,
.tab-scroll code {
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tab-scroll table {
  max-width: 100%;
}
.tab-scroll td,
.tab-scroll th {
  overflow-wrap: anywhere;
}

/* Narrow windows: tighten chrome so the tab pills and controls still fit. */
@media (max-width: 860px) {
  .tab-scroll {
    padding-left: var(--page-gutter);
    padding-right: var(--page-gutter);
  }
  .tab-btn {
    padding: 7px 11px;
    font-size: 12.5px;
  }
  .top-bar-center { gap: 2px; }
  .brand-name { display: none; }
}



/* ── Calm editorial chrome (Demo) ─────────────────────── */

html, body {
  background: var(--bg);
  color: var(--text);
}
body::before, body::after { display: none !important; content: none !important; }
.content { background: transparent; }

.top-bar {
  background: color-mix(in srgb, var(--sheet) 82%, transparent);
  border-bottom: 1px solid var(--hairline);
  box-shadow: none !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.top-bar-center {
  background: var(--paper);
  border: 1px solid var(--hairline);
  box-shadow: none !important;
  padding: 3px;
}
.tab-btn {
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink-mute);
}
.tab-btn:hover:not(:disabled) { color: var(--ink); }
.tab-btn.active {
  color: var(--sheet) !important;
  background: transparent !important;
  box-shadow: none !important;
  font-weight: 550;
}

.brand-name {
  font-weight: 400;
  letter-spacing: -0.03em;
}
.brand-mark .orbit { animation: none; }
.brand-mark .tip {
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--seize) 45%, transparent));
}

.icon-btn {
  background: transparent !important;
  border: 1px solid var(--hairline) !important;
  box-shadow: none !important;
  color: var(--ink-soft) !important;
  border-radius: 999px;
}
.icon-btn:hover:not(:disabled) {
  background: var(--ink) !important;
  color: var(--sheet) !important;
  border-color: var(--ink) !important;
  box-shadow: none !important;
}

/* Sheets — white cards on warm paper, hairline only */
.card,
.settings-section,
.today-aside .today-insight-card,
.week-advanced,
.privacy-first-glance,
.modal,
.paywall-card,
.health-section,
.health-pulse-card {
  background: var(--sheet) !important;
  border: 1px solid var(--hairline) !important;
  border-radius: var(--radius) !important;
  box-shadow: none !important;
}

.heatmap-track,
.week-bar-track,
.energy-bars {
  background: var(--paper) !important;
  box-shadow: none !important;
  border: 1px solid var(--hairline) !important;
  border-radius: 999px;
}

.insight-chip, .btnish {
  background: transparent !important;
  border: 1px solid var(--hairline) !important;
  box-shadow: none !important;
  border-radius: 999px;
  color: var(--ink-soft);
}
.insight-chip:hover, .btnish:hover {
  background: var(--ink) !important;
  color: var(--sheet) !important;
  border-color: var(--ink) !important;
}

.demo-ask-banner {
  margin: 0.75rem clamp(1rem, 3vw, 1.75rem) 0 !important;
  padding: 0.45rem 1rem !important;
  border-radius: 999px !important;
  background: transparent !important;
  border: 1px solid var(--hairline) !important;
  box-shadow: none !important;
  font-family: var(--font-mono) !important;
  font-size: 0.65rem !important;
  font-weight: 400 !important;
  letter-spacing: 0.16em !important;
  text-transform: uppercase !important;
  color: var(--ink-mute) !important;
}

.primary-btn {
  background: var(--ink) !important;
  color: var(--sheet) !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 999px !important;
  font-weight: 550 !important;
  letter-spacing: 0.01em;
}
.primary-btn:hover:not(:disabled) {
  background: #242220 !important;
  color: var(--sheet) !important;
  box-shadow: none !important;
  filter: none !important;
}
body.dark .primary-btn {
  background: var(--ink) !important;
  color: #0c0b0a !important;
}
body.dark .primary-btn:hover:not(:disabled) {
  background: #ffffff !important;
  color: #0c0b0a !important;
}

.recall-input-row input {
  background: var(--sheet) !important;
  border: 1px solid var(--hairline) !important;
  box-shadow: none !important;
  border-radius: 999px !important;
  min-height: 48px;
}
.recall-input-row input:focus {
  border-color: var(--ink) !important;
  box-shadow: 0 0 0 3px rgba(26, 25, 23, 0.06) !important;
}

.toggle-btn {
  border-radius: 999px !important;
  border: 1px solid var(--hairline) !important;
  background: transparent !important;
  box-shadow: none !important;
}
.toggle-btn.active {
  background: var(--ink) !important;
  color: var(--sheet) !important;
  border-color: var(--ink) !important;
}

.health-quit-mode {
  background: var(--paper) !important;
  border: 1px solid var(--hairline) !important;
  box-shadow: none !important;
  border-radius: 999px !important;
}
.health-quit-mode-btn.is-active {
  color: var(--sheet) !important;
  background: transparent !important;
}

::selection {
  background: color-mix(in srgb, var(--ink) 10%, transparent);
}

/* ── Sliding thumbs (calm punctuation) ────────────────── */
.seg-thumb {
  position: absolute;
  top: 0; left: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: 999px;
  background: var(--ink);
  box-shadow: none;
  opacity: 0;
  transition:
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.2s ease;
  will-change: transform, width;
}
.seg-thumb.seg-thumb--instant { transition: none !important; }
.has-seg-thumb { position: relative; }
.has-seg-thumb > .tab-btn,
.has-seg-thumb > .timeline-view-btn,
.has-seg-thumb > .recall-mode-btn,
.has-seg-thumb > .view-toggle-btn,
.has-seg-thumb > .health-quit-mode-btn {
  position: relative;
  z-index: 1;
  background: transparent !important;
  box-shadow: none !important;
}
.has-seg-thumb > .tab-btn.active,
.has-seg-thumb > .timeline-view-btn.active,
.has-seg-thumb > .recall-mode-btn.active,
.has-seg-thumb > .health-quit-mode-btn.is-active {
  color: var(--sheet) !important;
  background: transparent !important;
  box-shadow: none !important;
}
body.dark .has-seg-thumb > .tab-btn.active,
body.dark .has-seg-thumb > .timeline-view-btn.active,
body.dark .has-seg-thumb > .recall-mode-btn.active,
body.dark .has-seg-thumb > .health-quit-mode-btn.is-active {
  color: #0c0b0a !important;
}

.today-view-toggle.has-seg-thumb { gap: 1.25rem; }
.today-view-toggle .seg-thumb {
  top: auto; bottom: 0;
  height: 1px !important;
  border-radius: 0;
  background: var(--ink);
}
.today-view-toggle > .view-toggle-btn {
  border-bottom-color: transparent !important;
  color: var(--ink-mute);
  font-weight: 500;
}
.today-view-toggle > .view-toggle-btn:hover:not(.active) {
  color: var(--ink-soft);
}
.today-view-toggle > .view-toggle-btn.active {
  color: var(--ink) !important;
  font-weight: 550;
}

.timeline-view-btn, .recall-mode-btn { border-radius: 999px; }

.primary-btn, .icon-btn, .small-btn, .tab-btn,
.recall-mode-btn, .timeline-view-btn, .view-toggle-btn {
  transition: color var(--transition), background var(--transition),
    border-color var(--transition), transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.primary-btn:active:not(:disabled),
.small-btn:active:not(:disabled) { transform: scale(0.98); }
.icon-btn:active:not(:disabled) { transform: scale(0.94); }

@media (prefers-reduced-motion: reduce) {
  .seg-thumb { transition: none !important; }
  .primary-btn:active:not(:disabled),
  .icon-btn:active:not(:disabled),
  .small-btn:active:not(:disabled) { transform: none; }
}

/* ══════════════════════════════════════════════════════════
   STRUCTURAL redesign (Demo) — not a recolor.
   Same palette; different composition, grid, and type hierarchy.
   The day is an editorial LEDGER, not a dot-list.
   Symmetric reading column (no magazine left void).
   ══════════════════════════════════════════════════════════ */

/* 1 — Symmetric reading column: equal gutters, wider usable width */
#tab-today .today-shell,
#tab-recall .recall-shell,
#tab-health .health-shell,
#tab-settings .settings-shell {
  align-items: stretch;
}
#tab-today .today-shell > *,
#tab-recall .recall-shell > *,
#tab-health .health-shell > *,
#tab-settings .settings-shell > * {
  max-width: var(--page-max);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  padding-left: 0;
  padding-right: 0;
}

/* 2 — Header as a masthead: rule above, oversized date, stats as a line below */
.tab-scroll { padding-top: 1.1rem; }

.today-header {
  margin-bottom: var(--space-section);
  padding-top: 1.15rem;
  border-top: 1.5px solid var(--ink);
  position: relative;
}
.today-header::before {
  /* masthead eyebrow anchored to the top rule */
  content: "JOURNAL";
  position: absolute;
  top: -0.72rem;
  left: 0;
  background: var(--bg);
  padding-right: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.32em;
  color: var(--ink-mute);
}
.today-header-top {
  display: block;   /* was flex row → stack, editorial */
}
.today-view-toggle { margin-bottom: 0.85rem; }
.today-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5.2vw, 4rem);   /* big, owns the page */
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.045em;
  line-height: 0.98;
  color: var(--ink);
  text-wrap: balance;
}
/* stats become a thin editorial standfirst under the date */
#today-stats.stats-row {
  margin-top: var(--space-block);
  max-width: 46rem;
  font-family: var(--font);
  font-size: 1.02rem;
  font-weight: 300;
  line-height: 1.7;
  color: var(--ink-soft);
}
#today-stats .stat-value {
  font-weight: 400;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* 3 — THE LEDGER: kill the dot-list; time numeral is the spine */
.journal-timeline::before { display: none; }   /* no faux rail */

.timeline-entry {
  grid-template-columns: minmax(88px, 110px) 1fr auto !important;
  column-gap: clamp(16px, 2.5vw, 32px) !important;
  align-items: baseline !important;
  padding: var(--space-row) 0 !important;
  border-bottom: 1px solid var(--hairline) !important;
  background: transparent !important;
  box-shadow: none !important;
}
.timeline-entry:first-child { padding-top: 0.25rem !important; }
.timeline-entry:last-child { border-bottom: none !important; }

/* hide the colored dot column entirely — the time is the anchor now */
.timeline-color { display: none !important; }

/* time = large, thin, editorial numeral (the KPI-restraint move) */
.timeline-gutter {
  align-items: flex-start !important;
  padding-top: 0 !important;
  gap: 0.15rem !important;
}
.timeline-time {
  font-family: var(--font-display) !important;
  font-size: clamp(1.35rem, 2.1vw, 1.85rem) !important;
  font-weight: 400 !important;
  font-style: italic;
  letter-spacing: -0.03em !important;
  line-height: 1 !important;
  color: var(--ink) !important;
  text-align: left !important;
  font-variant-numeric: tabular-nums;
}
.timeline-gutter-meta {
  font-family: var(--font-mono) !important;
  font-size: 0.62rem !important;
  letter-spacing: 0.12em !important;
  text-transform: uppercase;
  color: var(--ink-mute) !important;
  text-align: left !important;
}
.timeline-ask {
  font-family: var(--font) !important;
  font-size: 0.82rem !important;
  font-weight: 650 !important;
  letter-spacing: -0.01em !important;
  text-transform: none !important;
  color: var(--seize) !important;
  text-decoration: none !important;
}
.timeline-ask:hover {
  color: var(--ink) !important;
  text-decoration: underline !important;
}

/* app name = the headline of each ledger line */
.timeline-main { padding-top: 0.1rem; }
.timeline-app {
  font-size: 1.05rem !important;
  font-weight: 500 !important;
  letter-spacing: -0.02em !important;
  color: var(--ink) !important;
}
.timeline-row-meta {
  margin-top: 0.2rem;
  font-size: 0.84rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

/* "now" = a solid ink cap on the left numeral, no wash box */
.timeline-entry.is-now {
  background: transparent !important;
  margin: 0 !important;
  padding-left: 0 !important;
}
.timeline-entry.is-now .timeline-time {
  color: var(--ink) !important;
}
.timeline-entry.is-now .timeline-time::after {
  content: "";
  display: inline-block;
  width: 0.44rem; height: 0.44rem;
  margin-left: 0.4rem;
  border-radius: 50%;
  background: var(--seize);   /* the one accent — a live pulse, editorially placed */
  vertical-align: 0.15em;
}
.timeline-entry:hover .timeline-app { color: var(--ink); }
.timeline-entry:hover {
  background: color-mix(in srgb, var(--ink) 4%, transparent) !important;
}

/* 4 — Recall / Health openings reuse the masthead grammar */
.editorial-open {
  margin: 0 0 var(--space-section);
  padding-top: 1.15rem;
  padding-bottom: 0;
  border-top: 1.5px solid var(--ink);
  border-bottom: none;
  max-width: 34rem;
  position: relative;
}
.editorial-open::before {
  content: attr(data-eyebrow);
  position: absolute;
  top: -0.72rem; left: 0;
  background: var(--bg);
  padding-right: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.32em;
  color: var(--ink-mute);
}
.editorial-open .recall-kicker,
.editorial-open .health-kicker { display: none; }  /* eyebrow replaces kicker */
.editorial-open .recall-heading,
.editorial-open .health-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 5vw, 3.9rem);
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.045em;
  line-height: 1;
  color: var(--ink);
  text-wrap: balance;
}
.editorial-open .health-lede {
  margin: 1.25rem 0 0;
  max-width: 32rem;
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.7;
  color: var(--ink-soft);
}

.recall-panel { padding-top: 3rem !important; max-width: 40rem; }
.recall-hint {
  max-width: 32rem;
  font-size: 0.92rem;
  font-weight: 300;
  line-height: 1.7;
  color: var(--ink-soft);
}

/* 5 — Settings header gets the same top-rule masthead */
.settings-header {
  padding-top: 1.15rem;
  border-top: 1.5px solid var(--ink);
  position: relative;
  margin-bottom: var(--space-section);
}
.settings-header::before {
  content: "PREFERENCES";
  position: absolute;
  top: -0.72rem; left: 0;
  background: var(--bg);
  padding-right: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.32em;
  color: var(--ink-mute);
}
.settings-header .settings-kicker { display: none; }
.settings-header h1 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2.4rem, 4.5vw, 3.4rem);
  letter-spacing: -0.045em;
  margin: 0;
}

/* now-strip aligns to the ledger, not a card */
.now-strip {
  padding: 1rem 0 1.1rem !important;
  border: none !important;
  border-bottom: 1.5px solid var(--ink) !important;
  background: transparent !important;
  border-radius: 0 !important;
  margin-bottom: 0.6rem;
}
.now-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--seize);
}
.now-app { font-size: 1.15rem; font-weight: 500; letter-spacing: -0.02em; }


/* ══════════════════════════════════════════════════════════
   SIGNATURE pass — instrument, not app shell.
   (1) chrome demotion  (2) living time filament  (3) Ask is the one object
   ══════════════════════════════════════════════════════════ */

/* ── 1. Chrome demotion: the frame stops announcing itself ── */
.top-bar {
  background: color-mix(in srgb, var(--bg) 88%, transparent) !important;
  border-bottom: none !important;
}
/* nav is text, not a pill tray */
.top-bar-center {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  gap: clamp(0.9rem, 2vw, 1.9rem) !important;
}
.top-bar-center .tab-btn {
  padding: 0.35rem 0 !important;
  border-radius: 0 !important;
  font-size: 0.82rem;
  font-weight: 450;
  letter-spacing: 0.01em;
  color: var(--ink-mute) !important;
  background: transparent !important;
}
.top-bar-center .tab-btn:hover:not(:disabled) { color: var(--ink-soft) !important; }
.top-bar-center .tab-btn.active,
.top-bar-center.has-seg-thumb > .tab-btn.active,
body.dark .top-bar-center.has-seg-thumb > .tab-btn.active {
  color: var(--ink) !important;
  font-weight: 550;
  background: transparent !important;
}
/* the nav thumb becomes a hairline underline, not a filled slab */
.top-bar-center .seg-thumb {
  top: auto !important;
  bottom: 0 !important;
  height: 1.5px !important;
  border-radius: 0 !important;
  background: var(--ink) !important;
}

/* icon buttons: bare glyphs */
.icon-btn {
  border: none !important;
  background: transparent !important;
  color: var(--ink-mute) !important;
}
.icon-btn:hover:not(:disabled) {
  background: transparent !important;
  color: var(--ink) !important;
  border: none !important;
}

/* cards stop being boxes; they become ruled sections */
.card,
.settings-section,
.today-aside .today-insight-card,
.week-advanced,
.health-section,
.health-pulse-card {
  background: transparent !important;
  border: none !important;
  border-top: 1px solid var(--hairline) !important;
  border-radius: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
/* true overlays keep their surface */
.modal, .paywall-card, .privacy-first-glance {
  background: var(--sheet) !important;
  border: 1px solid var(--hairline) !important;
  border-radius: var(--radius) !important;
}
.card-title {
  font-family: var(--font-mono);
  font-size: 0.62rem !important;
  font-weight: 400 !important;
  letter-spacing: 0.2em !important;
  text-transform: uppercase;
  color: var(--ink-mute) !important;
}

/* ── 2. The day filament: time as the hero material ── */
.day-filament {
  position: fixed;
  top: var(--top-bar-height, 56px);
  left: 0;
  right: 0;
  height: 1px;
  background: var(--hairline);
  overflow: visible;
  z-index: 60;
  pointer-events: none;
}
.day-filament-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--day-progress, 0%);
  background: var(--ink);
  opacity: 0.55;
  transition: width 1.2s linear;
}
.day-filament-tip {
  position: absolute;
  top: 50%;
  left: var(--day-progress, 0%);
  width: 5px; height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: var(--seize);
  transition: left 1.2s linear;
}
.day-filament-tip::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: var(--seize);
  opacity: 0.18;
  animation: filament-breathe 4.5s ease-in-out infinite;
}
@keyframes filament-breathe {
  0%, 100% { transform: scale(0.7); opacity: 0.1; }
  50%      { transform: scale(1.25); opacity: 0.24; }
}

/* "now" in the ledger breathes with the same pulse */
.timeline-entry.is-now .timeline-time::after {
  animation: filament-breathe 4.5s ease-in-out infinite;
}

/* ── 3. Ask is the one object with physical presence ── */
.recall-input-anchor .kql-field,
.recall-input-row .kql-field {
  background: var(--paper-2) !important;
  border: 1px solid transparent !important;
  border-radius: 999px !important;
  box-shadow:
    inset 0 2px 4px color-mix(in srgb, var(--ink) 10%, transparent),
    inset 0 -1px 0 color-mix(in srgb, var(--sheet) 70%, transparent) !important;
  transition: box-shadow var(--transition), background var(--transition);
}
.recall-input-anchor .kql-field:focus-within,
.recall-input-row .kql-field:focus-within {
  background: var(--sheet) !important;
  box-shadow:
    inset 0 1px 3px color-mix(in srgb, var(--ink) 8%, transparent),
    0 0 0 1px color-mix(in srgb, var(--ink) 22%, transparent) !important;
}
.recall-input-row input,
.recall-input-row .kql-field input {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  min-height: 54px !important;
  padding-left: 1.35rem !important;
  padding-right: 1.35rem !important;
  font-size: 1rem !important;
}
.recall-input-row input:focus,
.recall-input-row .kql-field input:focus {
  border: none !important;
  box-shadow: none !important;
}
.recall-input-row input::placeholder { color: var(--ink-mute) !important; }

/* Compose actions must match the recessed field height (not sit low). */
.recall-input-row {
  align-items: center !important;
}
.recall-input-row .primary-btn,
.recall-input-row #recall-submit,
.recall-input-row .recall-new-question {
  box-sizing: border-box !important;
  min-height: 54px !important;
  height: 54px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0;
}

/* Ask “helpful” votes — bare glyphs, never Safari’s default beige buttons. */
.recall-ask-feedback-btn {
  -webkit-appearance: none !important;
  appearance: none !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: var(--ink-mute) !important;
}
.recall-ask-feedback-btn:hover:not(:disabled) {
  color: var(--ink) !important;
  background: transparent !important;
}
.recall-ask-feedback-btn.is-picked { color: var(--ink) !important; }

/* Safety: an unplaced thumb must never leave its active label invisible */
.seg-thumb-idle > .tab-btn.active,
.seg-thumb-idle > .timeline-view-btn.active,
.seg-thumb-idle > .recall-mode-btn.active,
.seg-thumb-idle > .view-toggle-btn.active,
.seg-thumb-idle > .health-quit-mode-btn.is-active,
body.dark .seg-thumb-idle > .tab-btn.active,
body.dark .seg-thumb-idle > .timeline-view-btn.active,
body.dark .seg-thumb-idle > .recall-mode-btn.active,
body.dark .seg-thumb-idle > .health-quit-mode-btn.is-active {
  color: var(--ink) !important;
}

@media (prefers-reduced-motion: reduce) {
  .day-filament-fill, .day-filament-tip { transition: none !important; }
  .day-filament-tip::after,
  .timeline-entry.is-now .timeline-time::after { animation: none !important; }
}

/* ══════════════════════════════════════════════════════════
   BALANCED SIGNATURE — every surface has a purpose.
   Week = folio · Health = diagnostic aperture · Settings = control ledger.
   ══════════════════════════════════════════════════════════ */

/* ── Week: a folio, not Today with charts underneath ─────── */
.today-shell.is-week-view .today-header {
  margin-bottom: var(--space-block);
}
.today-shell.is-week-view .today-header::before {
  content: "WEEKLY FOLIO";
}
.today-shell.is-week-view .today-header h1,
.today-shell.is-week-view #today-stats {
  display: none;
}

#week-masthead-content {
  padding: 0.35rem 0 var(--space-block);
}

#week-wrap-section {
  display: grid;
  grid-template-columns: minmax(9rem, 0.32fr) minmax(0, 1fr);
  column-gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
  margin-bottom: var(--space-section);
}
#week-wrap-section > .card-title,
#week-wrap-section > .card-subtitle {
  grid-column: 1;
}
#week-wrap-section > .card-subtitle {
  margin-top: 0.6rem;
  line-height: 1.55;
}
#week-wrap {
  grid-column: 2;
  grid-row: 1 / span 3;
}
#week-wrap .insight-narrative {
  margin: -0.15rem 0 var(--space-block);
  max-width: 36rem;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 2.7vw, 2.25rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--ink);
}
#week-wrap .insight-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2.4rem;
}
#week-wrap .insight-metric {
  display: grid;
  gap: 0.15rem;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
#week-wrap .insight-metric strong {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.03em;
  text-transform: none;
  color: var(--ink);
}

#week-bars .week-bar-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 60px;
  gap: 10px;
  align-items: center;
  min-height: 2.35rem;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  border-radius: 4px;
  padding-left: 4px;
  margin-left: -4px;
  transition: background 0.12s ease;
}
#week-bars .week-bar-row:hover {
  background: color-mix(in srgb, var(--ink) 5%, transparent);
}
#week-bars .week-bar-row:last-of-type { border-bottom: none; }
#week-bars .week-bar-day {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
#week-bars .week-bar-track {
  height: 24px;
  border: none !important;
  border-radius: 6px;
  background: var(--paper) !important;
}
#week-bars .week-bar-fill,
#week-bars .week-bar-seg {
  border-radius: 6px;
}
#week-bars .week-bar-detail {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: -0.2rem 70px 0 62px;
  padding: 0 0 0.65rem;
  line-height: 1.35;
  color: var(--ink-mute);
}
#week-bars .week-bar-names {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#week-bars .week-bar-more {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
#week-bars .week-bar-expand {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 550;
  letter-spacing: -0.01em;
  line-height: inherit;
  text-transform: none;
  color: var(--seize);
  cursor: pointer;
  text-decoration: none;
  user-select: none;
}
#week-bars .week-bar-expand:hover,
#week-bars .week-bar-expand:focus-visible,
#week-bars .week-bar-row:hover + .week-bar-detail .week-bar-expand {
  color: var(--ink);
  text-decoration: underline;
}
#week-bars .week-bar-expand:focus-visible {
  outline: 2px solid var(--seize);
  outline-offset: 2px;
}
#week-bars .week-bar-apps {
  display: none;
  margin: 0 0 0.5rem 62px;
  padding: 6px 0;
  border-top: 1px solid var(--hairline);
}
#week-bars .week-bar-apps.open {
  display: block;
}
#week-bars .week-bar-app-row {
  display: grid;
  grid-template-columns: 2px 1fr auto 40px minmax(40px, 80px);
  gap: 8px;
  align-items: center;
  padding: 4px 0;
  font-size: 11px;
}
#week-bars .week-bar-app-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}
#week-bars .week-bar-app-value {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-2);
  text-align: right;
}
#week-bars .week-bar-app-pct {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-soft);
  text-align: right;
}
#week-bars .week-bar-app-bar {
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}
#week-bars .week-bar-app-bar div {
  height: 100%;
  border-radius: 2px;
}
#week-bars .week-bar-fill-label {
  font-size: 10px;
  font-weight: 600;
}
#week-bars .week-bar-away {
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 3px,
    var(--surface-2) 3px,
    var(--surface-2) 5px
  );
  opacity: 0.5;
}

.week-app-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.week-app-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

/* ── Week deep/quiet strip (comparison bars removed) ─── */
.week-deep-quiet-card {
  padding: 0.85rem 1.1rem;
}
#week-deep-quiet {
  overflow: hidden;
}
.week-dq-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-block) 2rem;
  align-items: flex-start;
}
.week-dq-item {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  word-wrap: break-word;
  min-width: min(100%, 16rem);
  flex: 1 1 14rem;
}
.week-dq-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.52rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 2px;
}
.week-dq-body {
  display: inline;
  font-weight: 450;
}

/* ── Week landscape (rhythms / day-shape tide) ─── */
#week-landscape {
  width: 100%;
  overflow: hidden;
}
#week-landscape svg.week-tide-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 110px;
}
.week-tide {
  display: flex;
  flex-direction: column;
  gap: var(--space-block);
}
.week-tide-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}
.week-tide-card {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: transparent;
}
.week-tide-card.is-dominant {
  border-color: var(--ink);
  background: color-mix(in srgb, var(--seize) 8%, transparent);
}
.week-tide-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.week-tide-pct {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.65rem;
  line-height: 1.1;
  color: var(--ink);
}
.week-tide-range {
  font-size: 11px;
  color: var(--text-3);
}
.week-tide-shape-kicker {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 0.35rem;
}
.week-tide-pulses {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.week-tide-pulse {
  display: grid;
  grid-template-columns: 2.4rem 1fr 2.4rem;
  align-items: center;
  gap: 0.5rem;
}
.week-tide-pulse-day {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-soft);
  text-transform: uppercase;
}
.week-tide-pulse-track {
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}
.week-tide-pulse-fill {
  display: block;
  height: 100%;
  background: var(--ink);
  opacity: 0.55;
  border-radius: 3px;
}
.week-tide-pulse.is-peak .week-tide-pulse-day {
  color: var(--seize);
  font-weight: 600;
}
.week-tide-pulse.is-loud .week-tide-pulse-fill {
  opacity: 0.9;
  background: var(--seize);
}
.week-tide-pulse.is-quiet .week-tide-pulse-fill {
  opacity: 0.25;
}
.week-tide-pulse.is-quiet .week-tide-pulse-day {
  opacity: 0.65;
}
.week-tide-pulse-h {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-2);
  text-align: right;
}
.week-landscape-summary {
  font-size: 12px;
  color: var(--text-2);
  margin: var(--space-row) 0 0;
  text-align: left;
  line-height: 1.5;
}
.week-landscape-summary strong {
  color: var(--ink);
  font-weight: 550;
}

@media (max-width: 680px) {
  .week-tide-cards {
    grid-template-columns: 1fr;
  }
}

/* ── Observation lounge ─── */
.week-observation-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}
.week-observation-item {
  padding: 0.75rem 0;
}
.week-observation-kicker {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 4px;
}
.week-observation-body {
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
}
.week-observation-meta {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink-soft);
  margin-top: 2px;
}

/* ── Whisper row (two quiet lines) ─── */
.week-whisper-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 0.25rem 0 0.5rem;
}
.week-whisper {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
}
.week-whisper strong {
  font-weight: 500;
  color: var(--ink);
}

/* ── Week close row ─── */
.week-close-row {
  display: grid;
  gap: 0.4rem;
  padding: 0.25rem 0;
}
.week-close-item {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
}
.week-close-item strong {
  font-weight: 500;
  color: var(--ink);
}

/* ── Pattern cards ─── */
.pattern-card {
  display: flex;
  gap: 10px;
  align-items: stretch;
  padding: var(--space-row) 0;
  border-bottom: 1px solid var(--hairline);
}
.pattern-card:last-of-type {
  border-bottom: none;
}
.pattern-card-accent {
  width: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}
.pattern-card-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
  align-self: center;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.pattern-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.pattern-card-app {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.pattern-card-time {
  font-size: 11px;
  color: var(--text-2);
}
.pattern-card-meta {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ── Week stacked app bar ─── */
.week-stacked-bar {
  display: flex;
  height: 22px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
  gap: 2px;
  background: var(--surface-2);
}
.week-stacked-seg {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: 2px;
}
.week-app-spark {
  display: inline-flex;
  gap: 2px;
  align-items: flex-end;
  height: 16px;
}
.week-app-spark-dot {
  width: 4px;
  border-radius: 1px;
  min-height: 2px;
}

/* ── Week masthead ─── */
#week-masthead-content {
  padding: 0.35rem 0 var(--space-block);
}
.week-masthead-range {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.25rem;
}
.week-masthead-total {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-style: italic;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.15;
}
.week-masthead-meta {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 0.25rem;
}

/* ── Week deep/quiet strip ─── */
.week-deep-quiet-card {
  padding: 0.85rem 1.1rem;
}
#week-deep-quiet {
  overflow: hidden;
}
.week-dq-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-block) 2rem;
  align-items: flex-start;
}
.week-dq-item {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  word-wrap: break-word;
  min-width: min(100%, 16rem);
  flex: 1 1 14rem;
}
.week-dq-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.52rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 2px;
}
.week-dq-body {
  display: inline;
  font-weight: 450;
}

/* ── Health: diagnostic aperture, not a generic paywall ─── */
#health-result {
  counter-reset: health-register;
}
#health-result > .health-section {
  counter-increment: health-register;
}

/* ══════════════════════════════════════════════════════════
   Shared section hierarchy — Health · Today · Week · Settings
   Readable ink titles + ink rules (not whisper mono labels).
   ══════════════════════════════════════════════════════════ */

#health-result > .health-section,
#health-result > details.health-advanced,
#week-view > .card,
#week-view > section.card,
#week-view > details,
#day-view #today-focus-flow.today-insight-card,
#day-view details.today-details,
.settings-section:not(.trust-panel) {
  margin: 0 0 0.35rem !important;
  padding: 1.45rem 0 1.1rem !important;
  border-top: 1.5px solid var(--ink) !important;
  border-bottom: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}
#health-result > .health-section:first-child,
#health-result > details.health-advanced:first-child,
#week-view > .card:first-child,
#week-view > section.card:first-child,
#week-view > details:first-child {
  margin-top: 0.5rem !important;
  border-top: none !important;
  padding-top: 0.35rem !important;
}
#day-view #today-focus-flow.today-insight-card {
  border-top: 1.5px solid var(--ink) !important;
  margin-top: 1rem !important;
  padding-top: 1.25rem !important;
}
#day-view details.today-details {
  border: none !important;
  border-top: 1.5px solid var(--ink) !important;
  padding: 1.25rem 0 0.5rem !important;
  margin: 1.25rem 0 0.5rem !important;
}

/* Section titles — same weight/size everywhere */
#health-result .health-section > .card-title,
#health-result .health-section .card-title,
#health-result details.health-advanced > summary.card-title,
#health-result details.health-advanced > summary,
#week-view > .card > .card-title,
#week-view > section.card > .card-title,
#week-view > details > summary,
#week-view .week-advanced-grid .card-title,
#day-view #today-focus-flow > .card-title,
#day-view .today-aside section > .card-title,
#day-view .today-aside section > .card-title-row .card-title,
#day-view .today-aside details.today-advanced > summary,
#day-view .today-aside details.today-advanced .card-title,
#day-view details.today-details > summary,
#day-view .highlight-card h3,
#day-view .today-insight-card-title,
.settings-section > h2 {
  display: flex !important;
  align-items: baseline;
  gap: 0.65rem;
  font-family: var(--font) !important;
  font-size: 1.15rem !important;
  font-weight: 650 !important;
  font-style: normal !important;
  letter-spacing: -0.025em !important;
  text-transform: none !important;
  color: var(--ink) !important;
  margin: 0 0 0.65rem !important;
  line-height: 1.2 !important;
}
/* Hairline after *static* titles only — expanders must not stack a second rule. */
#health-result .health-section > .card-title::after,
#week-view > .card > .card-title::after,
#week-view > section.card > .card-title::after,
#week-view .week-advanced-grid .card-title::after,
#day-view #today-focus-flow > .card-title::after,
#day-view .today-aside section > .card-title-row .card-title::after,
.settings-section > h2::after {
  content: "";
  flex: 1;
  height: 1px;
  margin-left: 0.15rem;
  background: color-mix(in srgb, var(--ink) 18%, transparent);
  align-self: center;
}

/* Story / rail: quiet breaks inside columns — not a barcode */
#day-view .today-aside-story > section + section,
#day-view .today-aside-rail > section + details,
#day-view .today-aside-rail > details.today-advanced {
  border-top: 1px solid color-mix(in srgb, var(--ink) 22%, transparent);
  padding-top: 0.85rem;
  margin-top: 0.15rem;
}
#day-view .today-aside details.today-advanced > summary,
#day-view details.today-details > summary,
#week-view > details > summary,
#health-result details.health-advanced > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.35rem 0.5rem 0.35rem 0.2rem;
  margin-left: -0.2rem;
  width: calc(100% + 0.2rem);
  box-sizing: border-box;
}
#day-view .today-aside details.today-advanced > summary::-webkit-details-marker,
#day-view details.today-details > summary::-webkit-details-marker,
#week-view > details > summary::-webkit-details-marker,
#health-result details.health-advanced > summary::-webkit-details-marker {
  display: none;
}

/* Expand / collapse — chevron so they read as controls before hover. */
details > summary {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  cursor: pointer;
  user-select: none;
  width: 100%;
  box-sizing: border-box;
  border-radius: 4px;
  list-style: none;
  transition: background 0.12s ease, color 0.12s ease;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: "";
  flex: 0 0 0.45rem;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.15rem;
  align-self: center;
  border-right: 1.5px solid var(--ink-soft);
  border-bottom: 1.5px solid var(--ink-soft);
  transform: rotate(-45deg);
  transform-origin: 50% 50%;
  transition: transform 0.15s ease, border-color 0.12s ease;
}
details[open] > summary::before {
  transform: rotate(45deg);
  border-color: var(--ink);
}
details > summary:hover {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}
details > summary:hover::before {
  border-color: var(--ink);
}
details > summary:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--seize) 50%, transparent);
  outline-offset: 2px;
}
#health-result details.health-advanced > summary:hover,
#week-view > details > summary:hover,
#day-view details.today-details > summary:hover,
#day-view .today-aside details.today-advanced > summary:hover {
  color: var(--ink) !important;
}
.dep-list-details > summary {
  padding: 0.2rem 0.35rem 0.2rem 0.15rem;
  margin-left: -0.15rem;
  border-radius: 4px;
}
@media (min-width: 960px) {
  #day-view .today-aside-rail {
    border-left: 1.5px solid var(--ink);
    padding-left: 1.35rem;
  }
}

#health-result .health-section-hint,
#health-result .health-temporal-caption,
#week-view .card-subtitle,
#week-view .advanced-caption,
.settings-section > .settings-hint {
  margin: 0 0 0.75rem;
  max-width: 40rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink-soft);
  font-weight: 300;
}
#health-result details.health-advanced[open] > summary,
#week-view > details[open] > summary {
  margin-bottom: 0.75rem !important;
}

/* Don't restack a rule under an open expander title. */
#day-view details.today-details[open] > summary {
  border-bottom: none;
}

.health-section h3 {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  color: var(--ink-mute);
}
.health-section h3::before {
  content: counter(health-register, decimal-leading-zero);
  color: var(--seize);
  letter-spacing: 0.04em;
}
.health-proc-color,
.health-activity-color {
  width: 2px;
  height: 1.25rem;
  border-radius: 0;
}

body.kairos-web-demo .demo-health-shell > .health-panel {
  filter: blur(4px);
  opacity: 0.25;
  transform: none;
}
body.kairos-web-demo #tab-health > .demo-health-gate {
  isolation: isolate;
  overflow: hidden;
  background: color-mix(in srgb, var(--bg) 76%, transparent);
}
body.kairos-web-demo #tab-health > .demo-health-gate::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background:
    linear-gradient(
      90deg,
      transparent 8%,
      var(--hairline) 28%,
      var(--ink-mute) 49.8%,
      var(--hairline) 50.2%,
      var(--hairline) 72%,
      transparent 92%
    );
}
body.kairos-web-demo #tab-health > .demo-health-gate::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: calc(50% - 3px);
  top: calc(50% - 3px);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--seize);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--seize) 10%, transparent);
  animation: health-aperture-pulse 4.5s ease-in-out infinite;
}
@keyframes health-aperture-pulse {
  0%, 100% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--seize) 7%, transparent); }
  50% { box-shadow: 0 0 0 13px color-mix(in srgb, var(--seize) 13%, transparent); }
}
.demo-health-gate-card {
  position: relative;
  z-index: 2;
  width: min(32rem, 100%);
  padding: 3rem clamp(1.5rem, 5vw, 3.4rem);
  border: none;
  border-top: 1.5px solid var(--ink);
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  background: var(--bg);
  box-shadow: none;
}
.demo-health-gate-card::before {
  content: "";
  position: absolute;
  top: -3px;
  left: calc(50% - 3px);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--seize);
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--seize) 10%, transparent);
  animation: health-aperture-pulse 4.5s ease-in-out infinite;
}
.demo-health-gate-kicker {
  margin-bottom: 1rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.24em;
  color: var(--seize);
}
.demo-health-gate-card h2 {
  margin-bottom: 1rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.035em;
}
.demo-health-gate-copy {
  margin-bottom: 1.5rem;
  font-size: 0.94rem;
  font-weight: 300;
  line-height: 1.65;
}
.demo-health-gate-cta {
  border-radius: 999px;
  padding: 0.72rem 1.25rem;
  font-weight: 550;
}

/* ── Settings: numbered register + Health-weight titles ─── */
.settings-grid {
  counter-reset: settings-register;
  gap: 2.4rem clamp(2.5rem, 6vw, 5.5rem);
}
.settings-section {
  counter-increment: settings-register;
  position: relative;
}
.settings-section > h2 {
  /* Title size/weight from shared hierarchy above; keep register number. */
  margin-bottom: 1rem !important;
}
.settings-section > h2::before {
  content: counter(settings-register, decimal-leading-zero);
  width: auto;
  height: auto;
  margin: 0;
  background: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--seize);
  letter-spacing: 0.04em;
  text-transform: none;
  flex: 0 0 auto;
}
.trust-panel {
  padding-bottom: 1.7rem !important;
  background: transparent !important;
  border-top: 1.5px solid var(--ink) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  margin: 0 0 0.35rem !important;
  padding-top: 1.45rem !important;
}
.trust-panel .trust-lead {
  max-width: 39rem;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.025em;
}
.settings-row {
  min-height: 2.9rem;
}
.settings-row > span:first-child,
.settings-row > label:first-child,
.settings-row > div:first-child > span:first-child {
  font-weight: 500;
  color: var(--ink);
}

@media (max-width: 680px) {
  .week-observation-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  .week-whisper-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  .week-dq-strip {
    flex-direction: column;
    gap: 0.85rem;
  }
  #week-masthead-content .week-masthead-total {
    font-size: 1.6rem;
  }
  .demo-health-gate-card {
    padding: 2.2rem 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.kairos-web-demo #tab-health > .demo-health-gate::after,
  .demo-health-gate-card::before {
    animation: none;
  }
}

/* kairos-web-demo-chrome */
.demo-install-link {
  margin-left: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--bg, #e9e7e1);
  background: var(--ink, #1a1916);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.2;
}
.demo-install-link:hover {
  opacity: 0.88;
  text-decoration: none;
}
body.dark .demo-install-link {
  color: var(--ink, #1a1916);
  background: var(--bg, #f2efe8);
}
