/* Take Interest · erin product demo · v2 2026-05-29
   Warm-neutral paper base + deep Puget-Sound teal accent + warm-clay secondary.
   Photography-forward, editorial, community-first — tuned to referencesite.com's feel,
   raised to product grade. No external deps. System fonts only. Works from disk. */

:root {
  /* --- warm-neutral base --- */
  --bg: #f7f4ee;
  --surface: #ffffff;
  --surface-2: #f3eee5;          /* warm sand */
  --surface-3: #ecf3f1;          /* palest teal tint, for teal-accented surfaces */
  --paper: #fffdf8;              /* warm-white card surface (light); flips dark below */
  --bg-warm: #efe7d9;            /* warm band background (light); flips dark below */
  --text: #191c1b;
  --text-dim: #585d5b;
  --text-dimmer: #767a72;        /* darkened from #8b8f8b for AA small-text on cream (~3.0:1 → ~4.6:1) */

  /* --- teal: the hero accent (Puget Sound) --- */
  --accent: #0a5852;             /* darkened from #0d6e68 for WCAG AA small-text on cream (~4.3:1 → ~5.6:1) */
  --accent-deep: #073f3b;        /* nudged darker to stay distinct from the new --accent */
  --accent-soft: rgba(10, 88, 82, 0.14);
  --accent-pale: rgba(10, 88, 82, 0.06);
  --accent-bright: #0d6e68;      /* the original lighter teal, kept for solid fills (white text already passes) */

  /* --- clay: the warm secondary (human + community touches) --- */
  --gold: #bd7544;
  --gold-deep: #9c5d33;
  --gold-soft: rgba(189, 117, 68, 0.13);
  --gold-pale: rgba(189, 117, 68, 0.07);

  --subtle: #cdbfa9;
  --border: #e7dfd1;
  --border-soft: #f0e9dc;
  --border-teal: rgba(10, 88, 82, 0.18);

  --ok: #2f7d5b;
  --warn: #a8443e;
  --info: #356285;              /* nudged darker from #3a6b8c for AA small-text on cream */

  /* hardcoded mint behind .step.done — tokenized so dark mode can swap it */
  --ok-wash: #f1f8f4;

  --shadow-sm: 0 1px 2px rgba(25, 28, 27, 0.04);
  --shadow: 0 6px 22px rgba(25, 28, 27, 0.07);
  --shadow-lg: 0 16px 48px rgba(25, 28, 27, 0.10);
  --shadow-teal: 0 10px 30px rgba(13, 110, 104, 0.14);

  --radius: 14px;
  --radius-lg: 22px;
  --radius-sm: 9px;

  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;

  --space: 24px;
}

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

html, body { background: var(--bg); color: var(--text); }

body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

/* ===== Editorial type scale ===== */

h1, h2, h3, h4, .serif { font-family: var(--serif); font-weight: 500; letter-spacing: -0.015em; color: var(--text); }
h1 { font-size: 44px; line-height: 1.08; }
h2 { font-size: 29px; line-height: 1.18; }
h3 { font-size: 20px; line-height: 1.3; }
h4 { font-size: 16px; }
.display { font-size: 56px; line-height: 1.02; letter-spacing: -0.025em; }

.eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--accent);
}
.muted { color: var(--text-dim); }
.dim { color: var(--text-dimmer); }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: -0.02em; }

a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-soft); padding-bottom: 1px; transition: border-color 0.15s, color 0.15s; }
a:hover { border-bottom-color: var(--accent); }

button { font-family: var(--sans); cursor: pointer; border: none; background: none; color: var(--text); }

/* ===== Photography placeholders — the #1 missing thing =====
   Elegant slot that signals where erin's real lifestyle/community photos go.
   Layered gradients + grain so it reads as a photo frame, not an empty box. */

.photo-frame {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 18% 12%, rgba(13,110,104,0.30), transparent 60%),
    radial-gradient(120% 120% at 90% 95%, rgba(189,117,68,0.32), transparent 55%),
    linear-gradient(135deg, #15514d 0%, #0d6e68 42%, #3a8e84 100%);
  border: 1px solid var(--border-teal);
  min-height: 180px;
  display: flex;
  align-items: flex-end;
  box-shadow: var(--shadow-sm);
}
/* film-grain + subtle vignette over the gradient */
.photo-frame::before {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.10) 0.5px, transparent 0.6px);
  background-size: 4px 4px;
  mix-blend-mode: overlay;
  opacity: 0.5;
}
.photo-frame .photo-label {
  position: relative;
  margin: 14px;
  padding: 7px 12px;
  background: rgba(255,255,255,0.92);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--accent-deep);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.photo-frame .photo-label::before { content: "❖"; font-size: 11px; }
.photo-frame.tall { min-height: 280px; }
.photo-frame.short { min-height: 132px; }
.photo-frame.warm {
  background:
    radial-gradient(120% 90% at 80% 10%, rgba(189,117,68,0.40), transparent 60%),
    linear-gradient(135deg, #9c5d33 0%, #bd7544 55%, #d59a6c 100%);
  border-color: var(--gold-soft);
}
.photo-frame.warm .photo-label { color: var(--gold-deep); }

/* a horizontal band of community/lifestyle frames */
.lifestyle-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: var(--space);
}
.lifestyle-band .photo-frame { min-height: 150px; }
.lifestyle-band .cap {
  position: absolute; left: 14px; bottom: 14px;
  color: #fff; font-size: 12px; font-weight: 600;
  text-shadow: 0 1px 6px rgba(0,0,0,0.35);
}

/* ===== App shell ===== */

.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}
.app-noshell { display: block; min-height: 100vh; }

aside.nav {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 18px 120px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.nav .brand {
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: -0.01em;
  color: var(--text);
  display: block;
  border: none;
  padding: 0;
  margin-bottom: 18px;
}

/* erin at the center: a profile block atop the shell */
.agent-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  margin-bottom: 22px;
  background: linear-gradient(135deg, var(--surface-3), var(--surface));
  border: 1px solid var(--border-teal);
  border-radius: var(--radius);
}
.agent-card .avatar {
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--gold) 130%);
  color: #fff;
  font-family: var(--serif);
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
}
.agent-card .who { line-height: 1.25; min-width: 0; }
.agent-card .who .name { font-family: var(--serif); font-size: 15px; color: var(--text); }
.agent-card .who .role { font-size: 11px; color: var(--text-dim); }
.agent-card .who .brand-line { font-size: 10px; letter-spacing: 0.6px; text-transform: uppercase; color: var(--accent); margin-top: 1px; }

.nav .day-chip {
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--accent); background: var(--accent-pale);
  padding: 3px 8px; border-radius: 5px; display: inline-block; margin-left: 6px;
}
.nav ul { list-style: none; }
.nav li { margin-bottom: 2px; }
.nav a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-dim); border: none;
  transition: background 0.14s, color 0.14s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.current { background: var(--accent-pale); color: var(--accent-deep); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }
.nav .badge { background: var(--accent); color: white; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }

.nav .section-label {
  font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--text-dimmer); margin: 24px 12px 8px;
}

.nav .pilot {
  position: absolute; bottom: 18px; left: 18px; right: 18px;
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--border-teal);
  border-radius: var(--radius); padding: 13px;
  font-size: 12px; color: var(--text-dim); line-height: 1.5;
}
.nav .pilot strong { color: var(--accent-deep); display: block; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 4px; }

main.content {
  padding: 44px 56px;
  max-width: 1080px;
  width: 100%;
}

/* ===== Hero — greeting + her presence + a lifestyle photo ===== */

.hero {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 28px;
  align-items: stretch;
  margin-bottom: 36px;
}
.hero .hero-copy { display: flex; flex-direction: column; justify-content: center; }
.hero .hero-copy h1 { font-size: 46px; margin: 8px 0 10px; }
.hero .hero-copy .sub { font-size: 17px; color: var(--text-dim); max-width: 42ch; }
.hero .hero-photo { min-height: 240px; }

/* ===== Header bar ===== */

.page-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 32px; flex-wrap: wrap; gap: 12px;
}
.page-header h1 { font-size: 36px; margin-top: 4px; }
.page-header .date { color: var(--text-dim); font-size: 14px; }

/* ===== Cards ===== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.card-tight { padding: 16px; }
.card h2, .card h3 { margin-bottom: 16px; }
.card-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.thread-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  cursor: pointer; border-bottom: none; display: block; color: var(--text);
}
.thread-card:hover { border-color: var(--border-teal); transform: translateY(-2px); box-shadow: var(--shadow); }
.thread-card .family { font-family: var(--serif); font-size: 19px; margin-bottom: 4px; }
.thread-card .stage { font-size: 13px; letter-spacing: 0.6px; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; font-weight: 700; }
.thread-card .next-action { font-size: 13px; color: var(--text-dim); border-top: 1px solid var(--border-soft); padding-top: 10px; }
.thread-card .next-action strong { color: var(--text); font-weight: 600; }

/* ===== Inbox + drafts ===== */

.inbox-item {
  display: grid; grid-template-columns: 110px 1fr auto; gap: 16px; align-items: center;
  padding: 13px 0; border-bottom: 1px solid var(--border-soft);
}
.inbox-item:last-child { border-bottom: none; }
.inbox-item .source { font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-dimmer); font-weight: 600; }
.inbox-item .body { color: var(--text); font-size: 14px; }
.inbox-item .action { font-size: 12px; color: var(--accent); white-space: nowrap; font-weight: 600; }
.inbox-item .tag { display: inline-block; background: var(--accent-pale); color: var(--accent-deep); font-size: 10px; letter-spacing: 1px; padding: 2px 7px; border-radius: 5px; margin-left: 6px; font-weight: 600; }

/* ===== Calendar ===== */

.calendar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.cal-row { display: flex; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border-soft); gap: 16px; }
.cal-row:last-child { border-bottom: none; }
.cal-time { font-family: var(--mono); font-size: 12px; color: var(--text-dim); width: 84px; flex-shrink: 0; }
.cal-body { flex: 1; font-size: 14px; }
.cal-tag { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--accent-deep); background: var(--accent-pale); padding: 2px 7px; border-radius: 5px; font-weight: 600; }

/* ===== Step progress ===== */

.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 18px 0 28px; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 14px; position: relative; }
.step.done { border-color: var(--ok); background: var(--ok-wash); }
.step.current { border-color: var(--accent); background: var(--accent-pale); }
.step.next { background: var(--surface-2); border-style: dashed; }
.step .num { font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--text-dimmer); margin-bottom: 4px; font-weight: 600; }
.step.done .num { color: var(--ok); }
.step.current .num { color: var(--accent); }
.step .label { font-size: 13px; color: var(--text); }
.step .check { position: absolute; top: 10px; right: 12px; color: var(--ok); font-size: 14px; }

/* ===== Timeline ===== */

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 1px; background: var(--subtle); }
.tl-item { position: relative; padding-bottom: 20px; }
.tl-item::before { content: ""; position: absolute; left: -22px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.tl-item .when { font-family: var(--mono); font-size: 11px; color: var(--text-dim); margin-bottom: 4px; display: block; }
.tl-item .what { font-size: 14px; color: var(--text); }
.tl-item .src { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-dimmer); margin-left: 6px; }

/* ===== Two-column layout ===== */

.two-col { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; }
.aside-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.aside-card h3 { font-size: 13px; margin-bottom: 13px; font-family: var(--sans); font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-dim); }
.aside-card .row { font-size: 13px; color: var(--text-dim); padding: 7px 0; border-bottom: 1px solid var(--border-soft); }
.aside-card .row:last-child { border-bottom: none; }
.aside-card .row strong { color: var(--text); font-weight: 600; }

/* ===== Next action ===== */

.next-action-card { background: linear-gradient(135deg, var(--surface-3), var(--accent-pale)); border: 1px solid var(--border-teal); border-radius: var(--radius); padding: 20px; margin-top: 16px; }
.next-action-card .label { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; font-weight: 700; }
.next-action-card .body { font-size: 15px; color: var(--text); }
.next-action-card .meta { font-size: 12px; color: var(--text-dim); margin-top: 8px; }

/* ===== Onboarding ===== */

.onboard-wrap { max-width: 660px; margin: 0 auto; padding: 72px 32px; min-height: 100vh; }
.onboard-wrap .brand { font-family: var(--serif); font-size: 24px; margin-bottom: 56px; text-align: center; display: block; }
.onboard-wrap h1 { text-align: center; margin-bottom: 10px; font-size: 42px; }
.onboard-wrap .lede { text-align: center; color: var(--text-dim); margin-bottom: 48px; font-size: 17px; }
.onboard-step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.onboard-step .num { font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.onboard-step h2 { font-size: 23px; margin-bottom: 6px; }
.onboard-step .help { color: var(--text-dim); font-size: 14px; margin-bottom: 18px; }
.tool-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--border-soft); }
.tool-row:last-child { border-bottom: none; }
.tool-row .name { font-size: 14px; }
.tool-row .status { font-size: 12px; font-weight: 600; }
.tool-row .status.connected { color: var(--ok); }
.tool-row .status.pending { color: var(--accent); }
.tool-row .status.later { color: var(--text-dimmer); }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.4px; color: var(--text-dim); margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius-sm); padding: 11px 13px; font-size: 14px; font-family: var(--sans); color: var(--text); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-pale); }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 6px 13px; font-size: 12px; color: var(--text-dim); cursor: pointer; transition: all 0.14s; }
.chip.on { background: var(--accent-pale); border-color: var(--border-teal); color: var(--accent-deep); font-weight: 600; }

.primary-cta { display: inline-block; background: var(--accent); color: white; padding: 13px 26px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; border: none; cursor: pointer; box-shadow: var(--shadow-teal); transition: background 0.15s, transform 0.15s; }
.primary-cta:hover { background: var(--accent-deep); transform: translateY(-1px); }
.secondary-cta { display: inline-block; background: var(--surface); color: var(--text); padding: 13px 26px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; border: 1px solid var(--border); cursor: pointer; }

/* ===== Day-30 patterns ===== */

.pattern { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 16px 20px; margin-bottom: 11px; }
.pattern .label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; font-weight: 700; }
.pattern .body { font-size: 14px; color: var(--text); }

/* ===== Week view ===== */

.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 20px; }
.day-col h4 { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-dimmer); text-align: center; margin-bottom: 6px; font-family: var(--sans); font-weight: 700; }
.day-col .date { font-family: var(--serif); font-size: 18px; text-align: center; margin-bottom: 12px; color: var(--text); }
.day-col .event { background: var(--accent-pale); border-left: 2px solid var(--accent); padding: 7px 8px; font-size: 11px; border-radius: 5px; margin-bottom: 4px; color: var(--text); }
.day-col .event.personal { border-left-color: var(--gold); background: var(--gold-pale); color: var(--text-dim); }
.day-col .event .family-tag { display: block; font-size: 9px; color: var(--text-dimmer); letter-spacing: 1px; text-transform: uppercase; margin-top: 2px; }

/* ===== Branch toggle ===== */

.branch-toggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; font-size: 12px; }
.branch-toggle button { padding: 7px 15px; border-radius: 999px; color: var(--text-dim); font-weight: 600; transition: all 0.14s; }
.branch-toggle button.on { background: var(--accent); color: white; }

/* ===== Footer ===== */

.page-footer { margin-top: 44px; padding: 20px 0; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-dimmer); letter-spacing: 0.4px; text-align: center; }
.page-footer .promise { display: inline-flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.page-footer .promise span::before { content: "✓ "; color: var(--ok); }

/* ===== Responsive ===== */

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  aside.nav { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); padding-bottom: 24px; }
  aside.nav .pilot { position: static; margin-top: 18px; }
  main.content,
  .card,
  .ti-shell-nav,
  .ti-rail { min-width: 0; max-width: 100%; }
  .card { overflow-x: auto; }
  .hero { grid-template-columns: 1fr; }
  .two-col,
  .two-col[style] { grid-template-columns: 1fr !important; }
  .two-col > *,
  .card > * { min-width: 0; }
  .card > div[style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .week-grid { grid-template-columns: 1fr; }
  .lifestyle-band { grid-template-columns: 1fr; }
  main.content { padding: 26px; }
}

/* ============================================================
   DARK THEME — warm evergreen-ink, NOT a cold gray invert.
   Keeps the lively teal + clay character. Maps onto every
   token defined in :root above.

   Three control paths:
     1. :root[data-theme="dark"]              → manual force-dark (theme.js / localStorage)
     2. :root[data-theme="light"]             → manual force-light (re-asserts the cream defaults)
     3. @media (prefers-color-scheme: dark)   → follow the OS, but ONLY when the
        user has not manually forced light (:root:not([data-theme="light"]))
   ============================================================ */

/* shared dark token set — declared once, applied by the selectors below */
:root[data-theme="dark"] {
  /* --- warm-dark base (deep evergreen-ink, never black) --- */
  --bg: #13201d;
  --surface: #1b2a26;
  --surface-2: #22332e;          /* warm-dark sand counterpart */
  --surface-3: #1f302c;          /* teal-leaning dark surface */
  --paper: #20302b;              /* card surface, warm-dark (was the cream fallback that stayed light) */
  --bg-warm: #1a2723;            /* warm band background, dark */
  --text: #eef3f0;
  --text-dim: #a9b6b1;
  --text-dimmer: #7f8d87;        /* AA on the dark surfaces */

  /* --- teal hero accent, brightened so it carries on dark + passes AA --- */
  --accent: #3fb3a8;
  --accent-deep: #2a9a90;
  --accent-soft: rgba(63, 179, 168, 0.16);
  --accent-pale: rgba(63, 179, 168, 0.10);
  --accent-bright: #4cc4b8;      /* solid-fill teal; dark ink text rides on top */

  /* --- clay secondary, warmed up for dark --- */
  --gold: #d9935f;
  --gold-deep: #c47a45;
  --gold-soft: rgba(217, 147, 95, 0.18);
  --gold-pale: rgba(217, 147, 95, 0.10);

  --subtle: #4a5a53;
  --border: #33433d;
  --border-soft: #2a3934;
  --border-teal: rgba(63, 179, 168, 0.26);

  --ok: #4bbf86;
  --warn: #e0786f;               /* lightened so warnings read on dark */
  --info: #6fa7cc;               /* lightened so info reads on dark */
  --ok-wash: rgba(75, 191, 134, 0.12);

  /* shadows lean on near-black ink so depth still reads on a dark base */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow: 0 6px 22px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.50);
  --shadow-teal: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* manual force-light re-asserts the cream defaults (identical to :root) so a
   light override always beats OS dark below */
:root[data-theme="light"] {
  --bg: #f7f4ee;
  --surface: #ffffff;
  --surface-2: #f3eee5;
  --surface-3: #ecf3f1;
  --paper: #fffdf8;
  --bg-warm: #efe7d9;
  --text: #191c1b;
  --text-dim: #585d5b;
  --text-dimmer: #767a72;

  --accent: #0a5852;
  --accent-deep: #073f3b;
  --accent-soft: rgba(10, 88, 82, 0.14);
  --accent-pale: rgba(10, 88, 82, 0.06);
  --accent-bright: #0d6e68;

  --gold: #bd7544;
  --gold-deep: #9c5d33;
  --gold-soft: rgba(189, 117, 68, 0.13);
  --gold-pale: rgba(189, 117, 68, 0.07);

  --subtle: #cdbfa9;
  --border: #e7dfd1;
  --border-soft: #f0e9dc;
  --border-teal: rgba(10, 88, 82, 0.18);

  --ok: #2f7d5b;
  --warn: #a8443e;
  --info: #356285;
  --ok-wash: #f1f8f4;

  --shadow-sm: 0 1px 2px rgba(25, 28, 27, 0.04);
  --shadow: 0 6px 22px rgba(25, 28, 27, 0.07);
  --shadow-lg: 0 16px 48px rgba(25, 28, 27, 0.10);
  --shadow-teal: 0 10px 30px rgba(13, 110, 104, 0.14);
}

/* follow the OS into dark, unless the user has manually forced light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #13201d;
    --surface: #1b2a26;
    --surface-2: #22332e;
    --surface-3: #1f302c;
    --paper: #20302b;
    --bg-warm: #1a2723;
    --text: #eef3f0;
    --text-dim: #a9b6b1;
    --text-dimmer: #7f8d87;

    --accent: #3fb3a8;
    --accent-deep: #2a9a90;
    --accent-soft: rgba(63, 179, 168, 0.16);
    --accent-pale: rgba(63, 179, 168, 0.10);
    --accent-bright: #4cc4b8;

    --gold: #d9935f;
    --gold-deep: #c47a45;
    --gold-soft: rgba(217, 147, 95, 0.18);
    --gold-pale: rgba(217, 147, 95, 0.10);

    --subtle: #4a5a53;
    --border: #33433d;
    --border-soft: #2a3934;
    --border-teal: rgba(63, 179, 168, 0.26);

    --ok: #4bbf86;
    --warn: #e0786f;
    --info: #6fa7cc;
    --ok-wash: rgba(75, 191, 134, 0.12);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30);
    --shadow: 0 6px 22px rgba(0, 0, 0, 0.38);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.50);
    --shadow-teal: 0 10px 30px rgba(0, 0, 0, 0.45);
  }
}

/* ----- dark-mode surface touch-ups (the few spots tokens can't reach alone) ----- */

/* the white photo pills + agent avatar text were tuned for vivid photo gradients;
   on dark we keep the gradients (they're meant to read as photos in both themes)
   but soften the pill so it doesn't glare. */
:root[data-theme="dark"] .photo-frame .photo-label,
:root:not([data-theme="light"]) .photo-frame .photo-label {
  background: rgba(20, 32, 29, 0.86);
  color: #eef3f0;
}
:root[data-theme="dark"] .photo-frame.warm .photo-label,
:root:not([data-theme="light"]) .photo-frame.warm .photo-label {
  color: #f6e7da;
}

/* solid teal fills (CTAs, badges, current-nav rail, branch toggle, avatars)
   use the brighter teal in dark so they stay lively and keep white/ink legible */
:root[data-theme="dark"] .primary-cta,
:root[data-theme="dark"] .nav .badge,
:root[data-theme="dark"] .branch-toggle button.on {
  background: var(--accent-bright);
  color: #07201d;
}
:root[data-theme="dark"] .primary-cta:hover { background: var(--accent); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .primary-cta,
  :root:not([data-theme="light"]) .nav .badge,
  :root:not([data-theme="light"]) .branch-toggle button.on {
    background: var(--accent-bright);
    color: #07201d;
  }
  :root:not([data-theme="light"]) .primary-cta:hover { background: var(--accent); }
}

/* focus ring + input fills already ride on tokens; nothing else hardcoded.
   .step.done / .step.current pick up --ok-wash / --accent-pale automatically. */

/* ============================================================
   THEME TOGGLE BUTTON (injected by theme.js, bottom-LEFT)
   Bottom-left keeps clear of gate.js's bottom-center chip + the
   top nav. On-brand: surface pill, teal ring on hover/focus.
   ============================================================ */

.ti-theme-toggle {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 2147483000;           /* above app chrome, below nothing it needs to */
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border-teal);
  box-shadow: var(--shadow);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.16s ease, box-shadow 0.16s ease,
              background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.ti-theme-toggle:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-teal);
}
.ti-theme-toggle:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-pale), var(--shadow);
}
.ti-theme-toggle .ti-theme-glyph { display: block; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .ti-theme-toggle { transition: none; }
  .ti-theme-toggle:hover { transform: none; }
}

/* nudge off the very corner on phones so it never sits under a thumb-rest */
@media (max-width: 560px) {
  .ti-theme-toggle { left: 14px; bottom: 14px; width: 42px; height: 42px; }
}
