/* tinker — chrome styles */

:root {
  --color-background: #fffdf7;
  --color-foreground: #2d2a26;
  --color-muted: #6f6a65;
  --color-card: #fff9f0;
  --color-border: #ede8e0;
  --color-accent: #a5b4fc;
  --color-accent-dim: #eef2ff;
  --color-accent-strong: #6366f1;
  --color-surface: #ffffff;
  --color-surface-alt: #fff9f0;
  --color-hover: #fff9f0;

  --color-forest: #2d5a3d;
  --color-leaf: #7bc47a;
  --color-sprout: #5aad58;
  --color-ink: #1a1a1a;
  --color-cream: #f5f3ef;
  --color-parchment: #f7f0e3;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;

  --sidebar-width: 252px;
  --shadow-soft: 0 1px 2px rgba(45, 90, 61, 0.05), 0 4px 16px rgba(45, 90, 61, 0.06);
  --shadow-purple: 0 1px 2px rgba(99, 102, 241, 0.18), 0 6px 18px rgba(99, 102, 241, 0.22);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100vh;
  /* Dynamic viewport height matches the *actually visible* area on
     iOS standalone PWAs, where 100vh otherwise resolves to the
     largest viewport (home-indicator area included) and the welcome
     form ends up sitting below the visual centre on initial load. */
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font-sans);
  color: var(--color-foreground);
  background: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body { display: flex; flex-direction: row; }

::selection { background-color: rgba(123, 196, 122, 0.32); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #c9c2b6; }

button { font: inherit; color: inherit; cursor: pointer; border: none; background: transparent; }
input, textarea { font: inherit; color: inherit; }
input:focus, button:focus, textarea:focus { outline: none; }

/* ── Sidebar ───────────────────────────────────────────────────────── */

/* Sidebar now feels like the main screen — same background, same
   density. The parchment gradient is gone; the only separator is a
   subtle right-border. The home-list (seeds) lives here. */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-background);
  border-right: 1px solid var(--color-border);
  user-select: none;
  position: relative;
  -webkit-app-region: drag;
  /* Keep the bottom rows (Receipts + footer) above the iOS home
     indicator when running as an installed PWA / Capacitor app. */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.sidebar__top {
  padding: 52px 12px 8px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}
html.on-capacitor .sidebar__top,
html.on-web .sidebar__top {
  padding-top: calc(env(safe-area-inset-top, 0px) + 14px);
}

.sidebar__brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 4px 6px 4px 4px;
  border-radius: 10px;
  -webkit-app-region: no-drag;
  cursor: pointer;
  min-width: 0;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px) url(#liquid-glass) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 0;
  box-shadow: none;
  transition: background 0.2s ease, transform 0.15s ease;
}
.sidebar__brand:hover { background: rgba(255, 255, 255, 0.16); }
.sidebar__brand:active { transform: scale(0.985); }

.sidebar__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.005em;
  color: var(--color-foreground);
}

.sidebar__footer {
  padding: 10px 12px 14px;
  font-size: 13px;
  color: var(--color-muted);
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  -webkit-app-region: no-drag;
}
.sidebar__footer-copy { padding: 0 6px; font-size: 12px; }

.sidebar__account {
  padding: 8px 8px 10px;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  -webkit-app-region: no-drag;
}
.sidebar__account-head {
  margin: 0;
  padding: 6px 10px 4px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.sidebar__account-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar__account-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-foreground);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}
.sidebar__account-item:hover { background: var(--color-hover); }
.sidebar__account-icon { color: var(--color-muted); flex-shrink: 0; }
.sidebar__account-flash {
  margin-left: auto;
  font-size: 12px;
  color: var(--color-muted);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.sidebar__account-flash.is-visible { opacity: 1; }

/* ── Sidebar pitch-deck tree (v0.103) ─────────────────────────────
 *
 * Mirrors pitch-deck.md inside the sidebar. The top tier rows hold one
 * of the eleven slide titles; the inner rows hold verbatim phrases
 * lifted from the founder's own writings. Both reuse
 * `.sidebar__account-item` for sizing/hover/spacing so the surface is
 * visually continuous with the Account block below. The nav is hidden
 * (via the [hidden] attribute) on cold-start — no placeholder, no CTA.
 */

.sidebar__tree {
  padding: 8px 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  -webkit-app-region: no-drag;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.sidebar__tree-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar__deck-heading-row { display: contents; }
.sidebar__deck-heading {
  /* Top-tier row carries the deck-slide title — a fixed literal from
   * the renderer's const. The label sits flush with the Account
   * block's items to read as continuous chrome. */
  font-weight: 600;
}
.sidebar__deck-heading-num {
  /* Deck-position number (1.–11.) — sits left of the heading label so
   * the founder can see which slide of the eleven they're looking at,
   * even when only some have been touched. Width fits a two-digit
   * label like "11." with tabular-nums so the column stays aligned
   * regardless of which headings are showing. */
  flex-shrink: 0;
  min-width: 22px;
  font-variant-numeric: tabular-nums;
  color: var(--color-muted);
  font-weight: 600;
}
.sidebar__deck-heading[aria-expanded="false"] .sidebar__account-label,
.sidebar__deck-heading[aria-expanded="false"] .sidebar__deck-heading-num {
  color: var(--color-muted);
}
.sidebar__deck-heading[data-active] {
  background: var(--color-hover);
}
.sidebar__phrase-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar__phrase {
  /* Allow the row's flex container to shrink so wrapping text doesn't
   * push the row past the sidebar's width. */
  align-items: flex-start;
}
.sidebar__phrase .sidebar__account-label {
  font-size: 13px;
  color: var(--color-muted);
  display: block;
  /* Founder writing wraps instead of truncating — every phrase is a
   * verbatim slice of their own text, and clipping it hides the words
   * they wrote. Long phrases break on word boundaries first, then
   * break out of long unbroken runs as a last resort. */
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}
.sidebar__phrase[data-active] {
  background: var(--color-hover);
}
.sidebar__phrase[data-active] .sidebar__account-label {
  color: var(--color-foreground);
}
.sidebar__tree-retry {
  margin-left: auto;
  font-size: 14px;
  color: var(--color-muted);
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
}
.sidebar__tree-retry:hover { background: var(--color-hover); color: var(--color-foreground); }

/* ── Pitch-progress bar ────────────────────────────────────────────
 *
 * Sits at the top of the sidebar tree, above the eleven deck-heading
 * rows. Shows how many of the eleven headings have at least one
 * resolvable phrase. Hidden alongside the tree on cold-start; visible
 * the moment the classifier lands its first hit.
 */
.sidebar__tree-progress {
  padding: 4px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar__tree-progress-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.sidebar__tree-progress-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.sidebar__tree-progress-count {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-muted);
}
.sidebar__tree-progress-track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--color-border);
  overflow: hidden;
}
.sidebar__tree-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: var(--color-accent-strong);
  transition: width 0.3s ease;
}

/* ── In-flight / strengthened / off-pitch states ──────────────────── */
/* The "stay tuned…" label sits inline alongside the "N / 8" count and
   is swapped in only while the classifier is reading the just-published
   writing. Both spans live inside [data-audit-ignore] so the visible-
   string audit (sidebar-tree.js:554) is unaffected. */
.sidebar__tree-progress-count-num {
  display: inline-block;
  transform-origin: center right;
}
.sidebar__tree-progress-count-flight {
  display: none;
  color: var(--color-muted);
  font-style: italic;
  font-weight: 500;
  font-variant-numeric: normal;
  letter-spacing: 0.01em;
}
[data-tree-progress-state="classifying"] .sidebar__tree-progress-count-num {
  display: none;
}
[data-tree-progress-state="classifying"] .sidebar__tree-progress-count-flight {
  display: inline-block;
}

/* Brand globe spins (and dims) only while a fresh classify is in flight.
   The selector matches the body-level mirror of the state attribute. */
[data-rainbow-logo] {
  transition: opacity 0.4s ease;
  transform-origin: 50% 50%;
}
body[data-tree-progress-state="classifying"] [data-rainbow-logo] {
  animation: tinker-spin 2.5s linear infinite;
  opacity: 0.4;
}

@keyframes tinker-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Strengthened: the covered count just grew. Count text bumps, bar
   fill briefly brightens. Lasts ~800ms then returns to idle. */
@keyframes tinker-count-bump {
  0%   { transform: scale(1); color: var(--color-muted); }
  35%  { transform: scale(1.4); color: var(--color-accent-strong); }
  100% { transform: scale(1); color: var(--color-muted); }
}
@keyframes tinker-bar-flash {
  0%   { filter: brightness(1) saturate(1); }
  35%  { filter: brightness(1.6) saturate(1.4); }
  100% { filter: brightness(1) saturate(1); }
}
[data-tree-progress-state="strengthened"] .sidebar__tree-progress-count-num {
  animation: tinker-count-bump 800ms ease-out;
}
[data-tree-progress-state="strengthened"] .sidebar__tree-progress-fill {
  animation: tinker-bar-flash 900ms ease-out;
}

/* Off-pitch: the just-published writing didn't grow the main pitch
   count. The secondary "Other founder journeys" bar pulses while its
   width animates outward to its new resting position. */
@keyframes tinker-secondary-pulse {
  0%   { filter: brightness(1); }
  40%  { filter: brightness(1.5); }
  100% { filter: brightness(1); }
}
[data-tree-progress-state="off-pitch"] .sidebar__tree-progress-secondary-fill {
  animation: tinker-secondary-pulse 900ms ease-out;
}

/* Secondary bar — slow-fill nod to founder journeys that don't tie to
   the pitch currently being assembled. Thinner, dimmer, italic label. */
.sidebar__tree-progress-secondary {
  margin-top: 10px;
}
.sidebar__tree-progress-secondary-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
}
.sidebar__tree-progress-secondary-label {
  font-size: 0.7rem;
  color: var(--color-muted);
  font-style: italic;
  letter-spacing: 0.02em;
  opacity: 0.85;
}
.sidebar__tree-progress-secondary-track {
  position: relative;
  height: 3px;
  border-radius: 999px;
  background: var(--color-border);
  overflow: hidden;
  opacity: 0.8;
}
.sidebar__tree-progress-secondary-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: var(--color-muted);
  transition: width 0.6s ease;
}

/* ── Welcome (empty state on main when no draft/read is active) ──── */

.stage > .welcome.feed[data-active] {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  /* Fluid padding tuned so the form sits visually centred with the
     same breathing room as the login pill on the auth-gate. The
     auth-gate pill has 16px outer padding + 8px inner pill padding
     before the input border — ~24px effective on mobile. Without a
     pill wrapper here, we lean harder on outer padding (40px min on
     small screens) to land in the same visual neighbourhood. */
  padding: clamp(40px, 6vh, 64px) clamp(40px, 10vw, 96px);
  background: var(--color-background);
  position: relative;
  overflow: hidden;
}
/* Indigo right-triangle hugging the top-left corner of the welcome
 * page. Sized large enough to fully encase the floating drawer-toggle
 * (48px button at 12px inset) on mobile, while reading as a deliberate
 * corner flag on desktop where the toggle is hidden. */
.stage > .welcome.feed[data-active]::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: clamp(140px, 22vw, 220px);
  height: clamp(140px, 22vw, 220px);
  background: var(--color-accent-strong);
  clip-path: polygon(0 0, 100% 0, 0 100%);
  pointer-events: none;
  z-index: 0;
}
.welcome .welcome__inner { position: relative; z-index: 1; }
.welcome__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  max-width: 480px;
  width: 100%;
}
.welcome__logo {
  opacity: 0.85;
  margin-bottom: 4px;
}
.welcome__logo svg rect { display: none; }
.welcome__question {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--color-foreground);
  line-height: 1.25;
}
.welcome__sub {
  margin: -4px 0 0;
  font-size: 15px;
  color: var(--color-muted);
  line-height: 1.4;
}
.welcome__prompt {
  margin: 10px 0 2px;
  font-size: 15px;
  color: var(--color-foreground);
  font-weight: 600;
  line-height: 1.3;
}
.welcome__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: min(380px, 88%);
  margin: 6px auto 0;
}
.welcome__tile {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 12px;
  min-height: 72px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
  color: var(--color-foreground);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.06s ease, background 0.15s ease;
}
.welcome__tile:hover {
  border-color: var(--color-accent-strong);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}
.welcome__tile:active { transform: scale(0.98); }
.welcome__tile[aria-pressed="true"] {
  border-color: var(--color-accent-strong);
  background: rgba(99, 102, 241, 0.08);
}
.welcome__tile-label {
  font-size: 15px;
  font-weight: 600;
}
.welcome__form {
  display: flex;
  gap: 8px;
  width: 100%;
  /* Cap form width at 88% of the inner column AND a 380px ceiling so
     the input + Start button stop spanning the full available width.
     With the section's clamp padding outside this, total visual margin
     from the screen edge ends up roughly 56-72px on mobile — matches
     the breathing room of the auth-gate pill. */
  max-width: min(380px, 88%);
  margin-left: auto;
  margin-right: auto;
  margin-top: 6px;
}
.welcome__form[hidden] { display: none; }
.welcome__input {
  flex: 1;
  padding: 14px 18px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  font: inherit;
  font-size: 16px;
  background: var(--color-surface);
  color: var(--color-foreground);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-width: 0;
}
.welcome__input::placeholder {
  color: var(--color-muted);
}
.welcome__input:focus {
  border-color: var(--color-accent-strong);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
  outline: none;
}
.welcome__submit {
  padding: 0 18px;
  height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--color-accent-strong);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.06s ease;
  white-space: nowrap;
}
.welcome__submit:hover { background: #4f46e5; }
.welcome__submit:active { transform: scale(0.98); }
.welcome__hint {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--color-muted);
  line-height: 1.5;
}

@media (max-width: 540px) {
  /* Horizontal + vertical padding handled by the clamp() on .welcome
     so it scales the same across mobile and narrow-desktop widths.
     Only the layout + type knobs change here. */
  .welcome__question { font-size: 22px; }
  .welcome__tile { min-height: 64px; padding: 14px 10px; }
  .welcome__form { flex-direction: column; gap: 10px; }
  .welcome__submit { width: 100%; height: 46px; }
}

/* ── Loading bar ───────────────────────────────────────────────────── */

.loadbar {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px; overflow: hidden; pointer-events: none;
  opacity: 0; transition: opacity 0.2s ease;
}
.loadbar[data-active] { opacity: 1; }
.loadbar span {
  display: block; height: 100%; width: 30%;
  background: linear-gradient(90deg, var(--color-leaf), var(--color-forest), var(--color-leaf));
  animation: loadbar-slide 1.2s ease-in-out infinite;
}
@keyframes loadbar-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(380%); }
}

/* ── Stage ─────────────────────────────────────────────────────────── */

.stage {
  flex: 1; position: relative;
  background: var(--color-background);
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.stage > section {
  position: absolute;
  inset: 0;
  background: var(--color-background);
  overflow: auto;
}

.stage > .feed { display: none; }
.stage > .feed[data-active] { display: block; }

/* ── Feed ──────────────────────────────────────────────────────────── */

.feed {
  padding: 32px 24px 80px;
  background:
    radial-gradient(circle at 20% 0%, rgba(123, 196, 122, 0.08), transparent 38%),
    radial-gradient(circle at 90% 5%, rgba(165, 180, 252, 0.10), transparent 40%),
    var(--color-background);
}

.feed__inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.feed__label {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  padding-left: 4px;
}

.feed__list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feed-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 18px 20px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.06s ease, box-shadow 0.15s ease;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.feed-card:hover { border-color: var(--color-accent); box-shadow: var(--shadow-soft); }
.feed-card:active { transform: scale(0.997); }
.feed-card:focus { outline: none; border-color: var(--color-accent-strong); box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15); }

.feed-card__head {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: var(--color-muted);
}
.feed-card__avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, #6ee7b7, #7dd3fc);
}
.feed-card__author { font-weight: 600; color: var(--color-foreground); }
.feed-card__dot { color: var(--color-muted); }
.feed-card__when { color: var(--color-muted); font-size: 12px; }

.feed-card__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--color-foreground);
}

.feed-card__preview {
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-foreground);
}
.feed-card__preview p {
  margin: 0 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.feed-card__preview p:nth-child(2) { display: none; }
.feed-card:hover .feed-card__preview p:nth-child(2) { display: -webkit-box; }

.feed-card__more {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-accent-strong);
}

.feed__empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--color-muted);
  font-style: italic;
}

/* ── Writing flow ──────────────────────────────────────────────────── */

.writing[hidden] { display: none !important; }
.writing {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 8%, rgba(123, 196, 122, 0.08), transparent 38%),
    radial-gradient(circle at 88% 4%, rgba(165, 180, 252, 0.10), transparent 38%),
    var(--color-background);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.writing__top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 28px;
  border-bottom: 1px solid rgba(237, 232, 224, 0.6);
}
.writing__close {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-foreground);
  transition: background 0.15s ease;
}
.writing__close:hover { background: rgba(45, 90, 61, 0.08); }

.writing__progress {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}
.progress-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--color-border);
  transition: background 0.2s ease, transform 0.2s ease;
}
.progress-dot[data-done] { background: var(--color-leaf); }
.progress-dot[data-active] { background: var(--color-accent-strong); transform: scale(1.4); }

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

.writing__body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 24px 24px;
}

.writing__stage {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
}

.writing-card {
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: fade-up 0.28s ease;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.writing-question {
  margin: 0;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--color-foreground);
}

.writing-input {
  width: 100%;
  min-height: 220px;
  padding: 18px 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  font-size: 17px;
  line-height: 1.65;
  color: var(--color-foreground);
  resize: vertical;
  font-family: var(--font-sans);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.writing-input:focus {
  border-color: var(--color-accent-strong);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}
.writing-input::placeholder { color: var(--color-muted); }

.writing-note {
  font-size: 13px;
  color: var(--color-muted);
}
.writing-note code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  background: rgba(45, 42, 38, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
}

.writing-card--loading {
  align-items: flex-start;
  flex-direction: row;
  gap: 14px;
  padding: 40px 0;
  color: var(--color-muted);
  font-size: 15px;
}
.writing-loading__text { font-family: var(--font-display); }

.thinking-dots { display: inline-flex; gap: 4px; align-items: center; height: 22px; }
.thinking-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--color-accent-strong);
  animation: thinking-bounce 1.2s ease-in-out infinite;
}
.thinking-dot:nth-child(2) { animation-delay: 0.18s; }
.thinking-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes thinking-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.writing-card--error .writing-error {
  white-space: pre-wrap;
  background: #fdf0eb;
  border: 1px solid #f0d3c5;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: #8b3a1a;
}

.writing__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 28px 22px;
  border-top: 1px solid rgba(237, 232, 224, 0.6);
}
.writing__end, .writing__next {
  height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s ease, transform 0.05s ease, color 0.15s ease, border-color 0.15s ease;
}
/* "This is everything" — same pill shape and footer position as Next,
 * but a soft outlined treatment so the two buttons don't fight. */
.writing__end {
  background: var(--color-surface);
  color: var(--color-foreground);
  border: 1px solid var(--color-border);
}
.writing__end:not(:disabled):hover {
  border-color: var(--color-accent-strong);
  color: var(--color-accent-strong);
  background: var(--color-accent-dim);
}
.writing__end:active { transform: scale(0.98); }
.writing__end:disabled { opacity: 0.45; cursor: default; }
.writing__end[hidden] { display: none; }

.writing__next {
  background: var(--color-accent-strong);
  color: #fff;
  box-shadow: var(--shadow-purple);
}
.writing__next:hover { background: #4f46e5; }
.writing__next:active { transform: scale(0.98); }
.writing__next:disabled { opacity: 0.5; cursor: default; }
.writing__next[hidden] { display: none; }

/* ── Review screen ─────────────────────────────────────────────────── */

.writing-card--review { gap: 24px; }
.writing-review__head {
  display: flex; flex-direction: column; gap: 4px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 14px;
}
.writing-review__crumb {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--color-forest);
}
.writing-review__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--color-foreground);
  outline: none;
  border-radius: 6px;
  padding: 4px 6px;
  margin-left: -6px;
  transition: background 0.15s ease;
}
.writing-review__title:hover { background: rgba(45, 90, 61, 0.04); }
.writing-review__title:focus { background: rgba(99, 102, 241, 0.06); }

.writing-review__answers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: 12px;
}
.writing-review__answer {
  text-align: left;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "q edit" "a edit";
  gap: 4px 12px;
  padding: 8px;
  border-radius: 8px;
  background: transparent;
  transition: background 0.12s ease;
}
.writing-review__answer:hover { background: rgba(99, 102, 241, 0.06); }
.writing-review__answer-q {
  grid-area: q;
  font-size: 12px; font-weight: 600;
  color: var(--color-muted);
  letter-spacing: 0.02em;
}
.writing-review__answer-a {
  grid-area: a;
  font-size: 13px;
  color: var(--color-foreground);
  line-height: 1.5;
}
.writing-review__answer-edit {
  grid-area: edit;
  align-self: center;
  font-size: 12px; font-weight: 600;
  color: var(--color-accent-strong);
}

.writing-review__essay-input {
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.75;
  color: var(--color-foreground);
  min-height: 360px;
  padding: 20px 22px;
}

.writing-review__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.writing-action {
  height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  background: var(--color-surface);
  color: var(--color-foreground);
  border: 1px solid var(--color-border);
  transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}
.writing-action:hover { background: var(--color-hover); }
.writing-action--primary {
  background: var(--color-accent-strong);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-purple);
}
.writing-action--primary:hover { background: #4f46e5; }
.writing-action--primary:active { transform: scale(0.98); }

/* ── Read view ─────────────────────────────────────────────────────── */

.read[hidden] { display: none !important; }
.read {
  display: flex;
  flex-direction: column;
  background: var(--color-background);
  position: relative;
}

.read__delete {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 18px);
  right: 24px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}
.read__delete:hover {
  background: rgba(196, 64, 64, 0.08);
  color: #b23a3a;
}

.read__body {
  width: 100%;
  max-width: 720px;
  margin: 0;
  padding: 56px 32px 80px;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.75;
  color: var(--color-foreground);
  text-align: left;
}
.read__head { margin-bottom: 24px; }
.read__author {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-forest);
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}
.read__title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.read__body p { margin: 0 0 1em; }

/* ── Category feed (seed → category landing page) ───────────────── */
/* ── Writing-fit (post-publish) ───────────────────────────────────── */

.writing-fit[hidden] { display: none !important; }
.writing-fit {
  display: flex;
  flex-direction: column;
  background: var(--color-background);
  min-height: 100%;
  overflow-y: auto;
}
.writing-fit__inner {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 32px 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.writing-fit__crumb {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-forest);
}
.writing-fit__headline {
  margin: 0;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--color-foreground);
}
.writing-fit__sub {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-muted);
}
.writing-fit__slot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
}
.writing-fit__slot--miss {
  background: var(--color-surface-alt);
  border-style: dashed;
}
.writing-fit__slot-num {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}
.writing-fit__slot-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--color-foreground);
}
.writing-fit__phrase {
  margin: 6px 0 0;
  padding: 12px 16px;
  border-left: 3px solid var(--color-accent-strong);
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.5;
  color: var(--color-foreground);
  background: var(--color-surface-alt);
  border-radius: 0 8px 8px 0;
}
.writing-fit__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 12px;
}
.writing-fit__loading {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 80px 0;
  color: var(--color-muted);
}
.writing-fit__loading-text {
  font-family: var(--font-display);
  font-size: 16px;
}

@media (max-width: 539px) {
  .writing-fit__inner { padding: 32px 18px 60px; }
  .writing-fit__headline { font-size: 26px; }
  .writing-fit__slot { padding: 18px 18px; }
  .writing-fit__slot-heading { font-size: 24px; }
  .writing-fit__phrase { font-size: 16px; }
}

/* ── LinkedIn fits (quiet review of essays for LinkedIn-worthiness) ── */

.linkedin-fit[hidden] { display: none !important; }
.linkedin-fit {
  display: flex;
  flex-direction: column;
  background: var(--color-background);
  min-height: 100%;
  overflow-y: auto;
}
.linkedin-fit__inner {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 32px 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.linkedin-fit__head {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.linkedin-fit__crumb {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-forest);
}
.linkedin-fit__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--color-foreground);
}
.linkedin-fit__sub {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-muted);
}
.linkedin-fit__head-actions {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.linkedin-fit__check-all {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-accent-strong);
  background: var(--color-accent-strong);
  color: #ffffff;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.linkedin-fit__check-all:hover { background: #4f46e5; }
.linkedin-fit__check-all:disabled { opacity: 0.55; cursor: default; }

/* Image-first preview. The stitched draft renders as one or more
 * tinker-branded PNGs; the page shows them stacked so the founder
 * sees exactly what saves to camera roll. */
.linkedin-fit__draft {
  display: block;
}
.linkedin-fit__previews {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}
.linkedin-fit__preview-frame {
  width: 100%;
  max-width: 540px;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.linkedin-fit__preview {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(45, 90, 61, 0.08);
}
.linkedin-fit__preview-caption {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--color-muted);
  letter-spacing: 0.02em;
}

.linkedin-fit__loading {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

.linkedin-fit__meta {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--color-muted);
}

/* Verdict labels carry over for the error state on the draft surface. */
.linkedin-fit__verdict-label {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.linkedin-fit__verdict-label--err { color: #b23a3a; }
.linkedin-fit__verdict-reason {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--color-foreground);
}

/* "Copy to clipboard" sits in a quieter register than the primary
 * "Stitch a new draft" action. Borderless until hover. */
.linkedin-fit__check {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.linkedin-fit__check:hover {
  background: var(--color-hover);
  color: var(--color-foreground);
  border-color: var(--color-accent);
}
.linkedin-fit__check:disabled { opacity: 0.55; cursor: default; }
.linkedin-fit__post {
  border-color: transparent;
}
.linkedin-fit__post:hover {
  border-color: var(--color-accent);
}
.linkedin-fit__post[hidden] { display: none; }

/* Copy pill — a compact icon + truncated verbatim preview. Click
 * copies the full verbatim string. The icon previews the action; the
 * snippet previews the words that will land in the clipboard. */
.linkedin-fit__copy-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 320px;
  padding: 7px 14px 7px 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.3;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.linkedin-fit__copy-pill:hover {
  background: var(--color-hover);
  color: var(--color-foreground);
  border-color: var(--color-accent);
}
.linkedin-fit__copy-pill[hidden] { display: none; }
.linkedin-fit__copy-pill svg {
  flex: 0 0 auto;
}
.linkedin-fit__copy-preview {
  display: inline-block;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: italic;
}

.linkedin-fit__empty {
  margin: 0;
  padding: 40px 0;
  text-align: center;
  font-size: 14px;
  color: var(--color-muted);
}

@media (max-width: 539px) {
  .linkedin-fit__inner { padding: 32px 18px 60px; }
  .linkedin-fit__title { font-size: 26px; }
  .linkedin-fit__draft { font-size: 16px; padding: 20px 0; }
}

.category-feed[hidden] { display: none !important; }
.category-feed {
  display: flex;
  flex-direction: column;
  background: var(--color-background);
}
.category-feed__head {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 32px 16px;
}
.category-feed__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--color-foreground);
}
.category-feed__sub {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--color-muted);
}
.category-feed__list {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 32px 80px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Status composer — single textarea + Post. Sits above the feed list
 * inside the same 720px column. Designed for short, top-of-mind notes
 * that don't justify an essay. */
.status-composer {
  width: 100%;
  max-width: 720px;
  margin: 16px auto 0;
  padding: 0 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.status-composer[hidden] { display: none !important; }
.status-composer__input {
  width: 100%;
  resize: vertical;
  min-height: 76px;
  padding: 14px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-foreground);
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.status-composer__input::placeholder { color: var(--color-muted); }
.status-composer__input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--focus-ring);
}
.status-composer__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.status-composer__hint {
  font-size: 12px;
  color: var(--color-muted);
}
.status-composer__post {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-accent-strong);
  background: var(--color-accent-strong);
  color: #ffffff;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}
.status-composer__post:hover:not(:disabled) { background: var(--color-accent-press); }
.status-composer__post:active:not(:disabled) { transform: scale(0.98); }
.status-composer__post:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.category-feed__card--status .category-feed__card-body {
  color: var(--color-foreground);
  font-size: 15px;
}
.category-feed__card {
  text-align: left;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  font-family: var(--font-sans);
}
.category-feed__card:hover { background: var(--color-surface-alt); }
.category-feed__card:active { transform: scale(0.99); }
.category-feed__card-author {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-forest);
}
.category-feed__card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--color-foreground);
}
.category-feed__card-body {
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-muted);
}
.category-feed__card-body p { margin: 0 0 1em; }
.category-feed__card-body p:last-child { margin-bottom: 0; }
.category-feed__empty {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 32px 80px;
  font-size: 14px;
  color: var(--color-muted);
  font-style: italic;
}

/* ── Auth gate (web only) ─────────────────────────────────────────── */
/*
 * Mirrors the welcome page: pill-shaped input with an embedded pill
 * submit button, floated over the same warm cream + radial-gradient
 * backdrop. Uses the same brand mark, type ramp and accent colours.
 */

html.auth-gating, html.auth-gating body { overflow: hidden; }
@media (max-width: 539px) {
  html.auth-gating, html.auth-gating body { overflow: visible; }
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding:
    max(20px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(circle at 20% 12%, rgba(123, 196, 122, 0.10), transparent 42%),
    radial-gradient(circle at 88% 18%, rgba(165, 180, 252, 0.12), transparent 38%),
    radial-gradient(circle at 50% 110%, rgba(253, 186, 116, 0.08), transparent 50%),
    var(--color-background);
}

.auth-gate__inner {
  max-width: 560px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-top: 4vh;
}

.auth-gate__brand { display: flex; align-items: center; justify-content: center; }
.auth-gate__brand svg { width: 44px; height: 44px; }

.auth-gate__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-foreground);
  text-align: center;
}

.auth-gate__lede {
  margin: 0;
  max-width: 420px;
  color: var(--color-muted);
  font-size: 15px;
  line-height: 1.55;
  text-align: center;
}
.auth-gate__lede strong { color: var(--color-foreground); font-weight: 600; }

.auth-gate__pill {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  padding: 8px;
  gap: 8px;
  border-radius: 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  align-items: center;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-gate[hidden],
.auth-gate__pill[hidden] { display: none !important; }

.auth-gate__pill:focus-within {
  border-color: var(--color-accent-strong);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18), var(--shadow-soft);
}

.auth-gate__cc {
  font-weight: 600;
  font-size: 16px;
  color: var(--color-muted);
  flex-shrink: 0;
  padding-left: 8px;
  letter-spacing: 0.01em;
}

.auth-gate__pill input {
  flex: 1 1 200px;
  min-width: 0;
  height: 48px;
  padding: 0 12px;
  background: transparent;
  border: none;
  font-size: 16px;
  color: var(--color-foreground);
}
.auth-gate__pill input::placeholder { color: var(--color-muted); }

.auth-gate__pill--pin input {
  flex-basis: 100%;
  font-feature-settings: "tnum";
  font-size: 22px;
  letter-spacing: 0.55em;
  padding-right: 0.55em;
  text-align: center;
}

.auth-gate__begin {
  flex: 1 1 100%;
  height: 52px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--color-accent-strong);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-purple);
}
.auth-gate__begin:hover { background: #4f46e5; }
.auth-gate__begin:active { transform: scale(0.98); }

.auth-gate__status {
  min-height: 1.2em;
  font-size: 13px;
  color: var(--color-muted);
  text-align: center;
}
.auth-gate__status[data-kind="error"] { color: #b3261e; }
.auth-gate__status[data-kind="ok"]    { color: var(--color-forest); }

.auth-gate__link {
  font-size: 14px;
  color: var(--color-muted);
  background: transparent;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  transition: color 0.15s ease, background 0.15s ease;
}
.auth-gate__link:hover {
  color: var(--color-foreground);
  background: rgba(45, 90, 61, 0.06);
}

.auth-gate__fineprint {
  margin: 4px 0 0;
  max-width: 360px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--color-muted);
  text-align: center;
}

@media (min-width: 540px) {
  .auth-gate { align-items: center; }
  .auth-gate__inner {
    gap: 18px;
    padding-top: 0;
    margin-top: -6vh;
  }
  .auth-gate__brand svg { width: 48px; height: 48px; }
  .auth-gate__title { font-size: 32px; }

  .auth-gate__pill {
    flex-wrap: nowrap;
    max-width: 520px;
    height: 56px;
    padding: 0 6px 0 20px;
    border-radius: 999px;
  }
  .auth-gate__cc { padding-left: 0; }
  .auth-gate__pill input {
    flex: 1 1 auto;
    height: auto;
    padding: 0;
  }
  .auth-gate__pill--pin { padding-left: 28px; }
  .auth-gate__pill--pin input {
    flex: 1 1 auto;
    height: auto;
    font-size: 18px;
  }
  .auth-gate__begin {
    flex: 0 0 auto;
    height: 44px;
    padding: 0 22px;
    font-size: 14px;
  }
  .auth-gate__link { min-height: auto; padding: 6px 10px; font-size: 13px; }
}

@media (min-width: 720px) {
  .auth-gate__title { font-size: 38px; }
}

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

@media (max-width: 720px) {
  :root { --sidebar-width: 220px; }
  .writing-question { font-size: 24px; }
  .read__title { font-size: 28px; }
  .feed-card__title { font-size: 18px; }
}

@media (max-width: 540px) {
  :root { --sidebar-width: 64px; }
  .sidebar__name,
  .sidebar__new span,
  .sidebar__home span,
  .sidebar__label,
  .sidebar__footer,
  .sidebar__account,
  .session__title,
  .session__close { display: none; }
  .sidebar__new, .sidebar__home {
    margin: 6px 8px;
    padding: 10px;
    justify-content: center;
  }
  .session { padding: 8px; justify-content: center; }
  .feed { padding: 16px 14px 56px; }
  .writing__top { padding: 14px 16px; }
  .writing__body { padding: 24px 16px calc(env(safe-area-inset-bottom, 0px) + 24px); }
  .writing__foot { padding: 14px 16px calc(env(safe-area-inset-bottom, 0px) + 18px); }
  .read__body { padding: 32px 18px 60px; }
  .read__delete { top: calc(env(safe-area-inset-top, 0px) + 14px); right: 14px; padding: 0 8px; }
  .read__delete span { display: none; }
  .category-feed__head { padding: 32px 18px 12px; }
  .category-feed__list { padding: 12px 18px 60px; }
  .category-feed__empty { padding: 8px 18px 60px; }
  .category-feed__title { font-size: 28px; }
  .status-composer { padding: 0 18px; }
}

/* ── Seed pre-prompt (Instagram tag-style head, regular textarea) ── */
.writing-seed__head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.writing-seed__pin {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: block;
}
.writing-seed__skip {
  align-self: flex-start;
  background: none;
  border: 0;
  padding: 4px 0;
  margin-top: 2px;
  font: inherit;
  font-size: 14px;
  color: var(--color-muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.writing-seed__skip:hover { color: var(--color-foreground); }
.writing-seed__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--color-foreground);
  margin: 8px 0 -8px;
}
.writing-seed__input {
  min-height: 0;
  height: auto;
  padding: 14px 16px;
  font-size: 16px;
  line-height: 1.4;
  resize: none;
}
.writing-seed__label .writing-seed__pin {
  width: 20px;
  height: 20px;
}

.writing-recall {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 0 2px;
  font-size: 14px;
  font-style: italic;
  line-height: 1.55;
  color: var(--color-muted);
  white-space: pre-wrap;
}
.writing-recall__line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.writing-recall__pin {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 3px;
  display: block;
}
.writing-recall__label {
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 4px;
  flex-shrink: 0;
  opacity: 0.7;
}
.writing-recall__text { min-width: 0; }

/* ── Add-transactions modal (opened from the home top-bar + button) ── */
.txn-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.txn-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 42, 38, 0.45);
  backdrop-filter: blur(2px);
}
.txn-modal__card {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #ede8e0);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(45, 42, 38, 0.25);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.txn-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.txn-modal__title {
  margin: 0;
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.txn-modal__close {
  background: none;
  border: 0;
  font-size: 24px;
  line-height: 1;
  color: var(--color-muted, #6f6a65);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.txn-modal__close:hover { background: var(--color-hover, #f5f3ef); }
.txn-modal__note {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-muted, #6f6a65);
}
.txn-modal__section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.txn-modal__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted, #6f6a65);
}
.txn-modal__count { text-transform: none; letter-spacing: 0; font-weight: 500; opacity: 0.8; }
.txn-modal__paste {
  width: 100%;
  font: 13px/1.5 ui-monospace, "SF Mono", Menlo, monospace;
  padding: 10px 12px;
  border: 1px solid var(--color-border, #ede8e0);
  border-radius: 10px;
  resize: vertical;
  background: var(--color-bg, #fffdf7);
}
.txn-modal__row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.txn-modal__btn {
  padding: 8px 14px;
  background: var(--color-hover, #f5f3ef);
  border: 1px solid var(--color-border, #ede8e0);
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.txn-modal__btn:hover { background: var(--color-border, #ede8e0); }
.txn-modal__btn--primary {
  background: var(--color-accent-strong, #4f46e5);
  color: #fff;
  border-color: transparent;
}
.txn-modal__btn--primary:hover { background: #4338ca; }
.txn-modal__msg { font-size: 12px; }
.txn-modal__msg[data-kind="ok"] { color: var(--color-forest, #2d5a3d); }
.txn-modal__msg[data-kind="err"] { color: #b03a2e; }
.txn-modal__manual {
  display: grid;
  grid-template-columns: 130px 1fr 100px 130px auto;
  gap: 8px;
  align-items: center;
}
.txn-modal__input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-border, #ede8e0);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
}
.txn-modal__input--num { text-align: right; }
.txn-modal__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--color-border, #ede8e0);
  border-radius: 10px;
  padding: 6px;
  background: var(--color-bg, #fffdf7);
}
.txn-modal__empty { padding: 14px; font-size: 13px; color: var(--color-muted, #6f6a65); }
.txn-modal__item {
  display: grid;
  grid-template-columns: 90px 1fr 80px 110px 24px;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
}
.txn-modal__item:hover { background: var(--color-hover, #f5f3ef); }
.txn-modal__item-date { color: var(--color-muted, #6f6a65); font-variant-numeric: tabular-nums; }
.txn-modal__item-merchant { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn-modal__item-amount { text-align: right; font-variant-numeric: tabular-nums; }
.txn-modal__item-category { color: var(--color-muted, #6f6a65); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn-modal__item-del {
  background: none;
  border: 0;
  color: var(--color-muted, #6f6a65);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
}
.txn-modal__item-del:hover { background: rgba(176, 58, 46, 0.1); color: #b03a2e; }
.txn-modal__foot { display: flex; justify-content: flex-end; }
html.txn-modal-open { overflow: hidden; }
@media (max-width: 720px) {
  .txn-modal__manual { grid-template-columns: 1fr 1fr; }
  .txn-modal__item { grid-template-columns: 70px 1fr 70px 24px; }
  .txn-modal__item-category { display: none; }
}

/* ── Home view (seeds list) ──────────────────────────────────────────
 *
 * Light theme — tinker palette. Top bar pattern mirrors Claude Code
 * mobile (☰ on the left, title in the middle, + on the right) but
 * styled to fit the rest of the app. No filter chips on this view;
 * the list is a simple time-grouped feed of previous seeds.
 */

#welcome.feed[data-active] {
  background: var(--color-background);
  display: flex;
  flex-direction: column;
  padding: 0;
}

.home-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 12px 8px 40px;
}
.home-list__section { display: flex; flex-direction: column; gap: 2px; }
.home-list__group-head {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 8px 10px 4px;
}
.home-list__group {
  margin: 0;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.home-list__group-sub {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--color-muted);
  opacity: 0.85;
}
.home-list__group--loading {
  color: var(--color-muted);
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  font-size: 13px;
  animation: home-group-pulse 1.4s ease-in-out infinite;
}
.home-list__group--awaiting {
  color: var(--color-muted);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  font-size: 13px;
}
.home-list__section--awaiting .home-card {
  opacity: 0.78;
}
.home-list__section--awaiting .home-card__meta { font-style: italic; }

/* Nested (sub-category) sections sit inset under their parent and
   carry a small indigo rail so the eye reads them as "more specific
   inside this thread" rather than a sibling top-level. */
.home-list__section--nested {
  position: relative;
  padding-left: 10px;
  margin-left: 6px;
}
.home-list__section--nested::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
  background: var(--color-accent-strong);
  opacity: 0.30;
}
.home-list__group--nested {
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-foreground);
}
.home-list__crumb { display: inline; }
.home-list__crumb--leaf { color: var(--color-accent-strong); }
.home-list__crumb-sep {
  display: inline-block;
  margin: 0 5px;
  color: var(--color-muted);
  font-weight: 400;
}
@keyframes home-group-pulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 0.9; }
}
/* Seed card */
.home-card {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: transparent;
  border: 0;
  border-radius: 7px;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s ease;
}
.home-card:hover { background: rgba(99, 102, 241, 0.08); }
.home-card:active { background: rgba(99, 102, 241, 0.14); }
.home-card__avatar {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: #2d2a26;
  flex-shrink: 0;
}
/* Body stacks the seed name above the writing title (when one
   exists). Single-line row when no writing is anchored yet. */
.home-card__body {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  line-height: 1.25;
}
.home-card__name {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--color-foreground);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.home-card--has-writing .home-card__name { font-weight: 600; }
.home-card__sub {
  font-size: 12px;
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.home-card__sub--title {
  font-style: italic;
  color: var(--color-muted);
}

/* ── Add-seed modal (light, tinker-styled) ──────────────────────── */
.seed-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.seed-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 42, 38, 0.45);
  backdrop-filter: blur(2px);
}
.seed-modal__card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(45, 42, 38, 0.25);
  padding: 22px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.seed-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.seed-modal__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-foreground);
}
.seed-modal__close {
  background: none;
  border: 0;
  font-size: 24px;
  line-height: 1;
  color: var(--color-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.seed-modal__close:hover { background: var(--color-hover); }
.seed-modal__sub {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-muted);
}
.seed-modal__input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
  background: var(--color-bg, var(--color-background));
  color: var(--color-foreground);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.seed-modal__input:focus {
  border-color: var(--color-accent-strong);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
  outline: none;
}
.seed-modal__msg { font-size: 12px; min-height: 1em; }
.seed-modal__msg[data-kind="err"] { color: #b03a2e; }
.seed-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.seed-modal__btn {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-hover);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-foreground);
  cursor: pointer;
  transition: background 0.12s ease;
}
.seed-modal__btn:hover { background: var(--color-border); }
.seed-modal__btn--primary {
  background: var(--color-accent-strong);
  border-color: transparent;
  color: #fff;
}
.seed-modal__btn--primary:hover { background: #4f46e5; }
html.seed-modal-open { overflow: hidden; }

