/* Impact Ledger. 8px spacing grid; colours only from the tokens below. */
:root {
  --bg: #f6f8f8;
  --surface: #ffffff;
  --surface-muted: #eef2f3;
  --ink: #0f172a;
  --ink-muted: #475569;
  --ink-faint: #5b677a;
  --border: #d9e1e5;
  --border-faint: #e9eef0;
  --teal: #0f766e;
  --teal-strong: #1e40af;
  --teal-light: #e8f7f4;
  --blue: #0369a1;
  --blue-light: #eef7fd;
  --amber: #92400e;
  --amber-light: #fdf3e1;
  --rose: #be123c;
  --rose-light: #fff1f2;
  --on-teal: #ffffff;
  --toast-bg: #1e293b;
  --toast-ink: #ffffff;
  --toast-error-bg: #9f1239;
  --overlay: rgba(15, 23, 42, 0.45);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-up: 0 -8px 32px rgba(15, 23, 42, 0.16);
  --fab-shadow: 0 6px 16px rgba(15, 118, 110, 0.32);
  --pulse: rgba(37, 99, 235, 0.4);
  --pulse-0: rgba(37, 99, 235, 0);
  --toast-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  --focus-ring: 0 0 0 3px var(--teal-light);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --nav-height: 0px; /* no bottom nav: Settings opens from the gear in the header */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-total: calc(var(--nav-height) + var(--safe-bottom));
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0b1115;
  --surface: #131d22;
  --surface-muted: #1a272d;
  --ink: #f1f5f9;
  --ink-muted: #a8b6c7;
  --ink-faint: #93a1b5;
  --border: #2a3b43;
  --border-faint: #1f2e35;
  --teal: #2dd4bf;
  --teal-strong: #a8c8ff;
  --teal-light: #0f2b2a;
  --blue: #38bdf8;
  --blue-light: #0c2433;
  --amber: #fbbf24;
  --amber-light: #2b2008;
  --rose: #fb7185;
  --rose-light: #2a0f16;
  --on-teal: #042f2e;
  --toast-bg: #e2e8f0;
  --toast-ink: #0f172a;
  --toast-error-bg: #fecdd3;
  --overlay: rgba(0, 0, 0, 0.62);
  --shadow: none;
  --shadow-up: 0 -8px 32px rgba(0, 0, 0, 0.5);
  --fab-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

[hidden] { display: none !important; }

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--teal); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
svg { flex: none; }

.muted { color: var(--ink-muted); }
.warn { color: var(--amber); }

/* ---------- Header: read-only, compact ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  padding: calc(var(--safe-top) + 12px) 16px 8px;
}
.app-title {
  max-width: 1040px;
  margin: 0 auto;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 32px;
}

/* ---------- Main area ---------- */
.app-main {
  max-width: 1040px;
  margin: 0 auto;
  /* bottom: room for the nav, plus the "Log a deed" button floating above it */
  padding: 8px 16px calc(var(--nav-total) + 96px);
}
.tab-page { display: none; }
.tab-page.active { display: block; animation: fadeIn 0.15s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.page-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 24px; }
.page-col { min-width: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.card-empty, .card-note {
  font-size: 14px;
  color: var(--ink-muted);
}
.card-note { margin-top: 12px; }
.body-text { font-size: 14.5px; color: var(--ink-muted); margin-bottom: 8px; }
.body-text b { color: var(--ink); }

/* ---------- Home: summary ---------- */
.summary {
  background: var(--surface);
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 16px 16px 16px;
  margin-bottom: 16px;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.pill-goal { font-size: 12px; color: var(--ink-muted); text-align: center; }
.pill-bars { margin: 8px 0 4px; }
.month-count { font-size: 14px; color: var(--ink-muted); margin: 12px 0 0; }
.headline { margin-top: 0; }
.headline-big {
  font-size: 52px;
  line-height: 1.05;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.headline-big.is-words { font-size: 32px; line-height: 1.15; }
.headline-label { font-size: 18px; font-weight: 500; color: var(--ink); margin-top: 2px; }
.headline-sub { font-size: 14px; color: var(--ink-muted); }
.headline-sub:empty { display: none; }
.given-row {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.given-row:empty { display: none; }
.given-chip {
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface-muted);
  border-radius: 999px;
  padding: 4px 12px;
}

.empty-card { padding: 24px 20px; }
.empty-lead { font-size: 20px; line-height: 1.35; font-weight: 500; letter-spacing: -0.01em; }
.empty-hint { font-size: 15px; color: var(--ink-muted); margin-top: 8px; }
.empty-card .btn-text { margin: 8px 0 -8px -4px; }

.nudge-card { background: var(--blue-light); border-color: transparent; margin-top: 16px; }
.nudge-text { font-size: 14.5px; color: var(--ink); }
.nudge-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- Home: timeline ---------- */
.list-tools { margin-bottom: 8px; }
.search-box { margin-bottom: 8px; }
.search-box input { -webkit-appearance: none; appearance: none; }
.pill-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -16px;
  padding: 0 16px 4px;
}
.pill-row::-webkit-scrollbar { display: none; }
.pill-item {
  flex: none;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 500;
}
.pill-item.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.month-head {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-muted);
  margin: 8px 4px 8px;
}
.deed-list + .month-head { margin-top: 24px; }
.deed-list {
  background: var(--surface);
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.deed-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 12px 16px;
  background: transparent;
  border: 0;
  text-align: left;
}
.deed-row + .deed-row { border-top: 1px solid var(--border-faint); }
.deed-row:active { background: var(--surface-muted); }
.deed-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--teal-light);
  color: var(--teal);
  flex: none;
}
.deed-icon svg, .tile-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.deed-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.deed-name {
  font-size: 15.5px;
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.deed-line { font-size: 13.5px; color: var(--ink-muted); line-height: 1.4; margin-top: 2px; overflow-wrap: anywhere; }
.deed-date { flex: none; font-size: 13px; color: var(--ink-faint); align-self: flex-start; padding-top: 2px; }
.empty-filter { font-size: 14px; color: var(--ink-muted); text-align: center; padding: 24px 0; }

/* ---------- Impact tab ---------- */
.detail-list { margin-top: 8px; }
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 0;
}
.detail-row + .detail-row { border-top: 1px solid var(--border-faint); }
.detail-row dt { font-size: 14.5px; font-weight: 500; min-width: 0; }
.detail-note { display: block; font-size: 13px; font-weight: 400; color: var(--ink-muted); margin-top: 2px; }
.detail-row dd { text-align: right; flex: none; max-width: 45%; }
.detail-val { display: block; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.detail-val-words { font-size: 15px; line-height: 1.35; }
.detail-sub { display: block; font-size: 12.5px; color: var(--ink-muted); }
.detail-sub:empty { display: none; }

.bars { margin-top: 8px; }
.bar-row + .bar-row { margin-top: 12px; }
.bar-head { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 4px; }
.bar-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-val { flex: none; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.bar-track { height: 10px; border-radius: 5px; background: var(--surface-muted); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; background: var(--teal); }
.bar-fill.is-longshot { background: repeating-linear-gradient(135deg, var(--teal) 0 4px, transparent 4px 8px); }

.how-steps { padding-left: 20px; margin: 4px 0 12px; font-size: 14.5px; color: var(--ink-muted); }
.how-steps li { margin-bottom: 6px; }
.how-steps b { color: var(--ink); font-weight: 500; }

.sample-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}
.sample-row + .sample-row { border-top: 1px solid var(--border-faint); }
.sample-text { flex: 1 1 auto; min-width: 0; }
.sample-name { font-size: 14.5px; font-weight: 500; overflow-wrap: anywhere; }
.sample-meta { font-size: 13px; color: var(--ink-muted); }

/* ---------- Settings ---------- */
.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}
.seg-btn {
  flex: 1 1 0;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 14.5px;
  font-weight: 500;
}
.seg-btn[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: var(--shadow); }
.stack-btns { display: grid; gap: 8px; margin-top: 12px; }
.link-list { list-style: none; }
.link-list a { display: flex; align-items: center; min-height: 44px; font-size: 14.5px; }

/* ---------- Buttons ---------- */
.btn-solid, .btn-outline {
  min-height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  font-size: 15.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.btn-solid { background: var(--teal); color: var(--on-teal); border: 0; }
.btn-solid:active { background: var(--teal-strong); }
.btn-solid:disabled { opacity: 0.55; cursor: default; }
.btn-outline { background: var(--surface); color: var(--ink); border: 1px solid var(--border); }
.btn-outline:active { background: var(--surface-muted); }
.btn-block { width: 100%; }
.btn-tall { min-height: 52px; font-size: 16.5px; }
.btn-small { min-height: 44px; padding: 0 16px; font-size: 14.5px; }
.btn-quiet, .btn-text, .btn-link {
  min-height: 44px;
  padding: 0 4px;
  background: transparent;
  border: 0;
  font-size: 14.5px;
}
.btn-quiet { color: var(--ink-muted); font-weight: 500; padding: 0 12px; border-radius: var(--radius-md); }
.btn-quiet:active { background: var(--surface-muted); }
.btn-danger { color: var(--rose); }
.btn-text { color: var(--teal); font-weight: 500; }
.btn-link { color: var(--teal); text-decoration: underline; text-underline-offset: 3px; text-align: left; }

.icon-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-muted);
  display: grid;
  place-items: center;
}
.icon-button:active { background: var(--surface-muted); color: var(--ink); }
.icon-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- "Log a deed": in the thumb zone, above the nav ---------- */
.fab {
  position: fixed;
  right: max(16px, calc((100vw - 1040px) / 2 + 16px));
  bottom: calc(var(--nav-total) + 16px);
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 22px 0 18px;
  border: 0;
  border-radius: 28px;
  background: var(--teal);
  color: var(--on-teal);
  font-size: 16px;
  font-weight: 500;
  box-shadow: var(--fab-shadow);
}
.fab:active { background: var(--teal-strong); transform: scale(0.98); }
.fab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }

/* ---------- Modals and sheets ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: var(--overlay);
  padding-top: calc(var(--safe-top) + 16px);
}
.modal-overlay.open { display: flex; }
.modal-sheet {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px 16px calc(16px + var(--safe-bottom));
  box-shadow: var(--shadow-up);
  animation: slideUp 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes slideUp { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.modal-title { font-size: 18px; font-weight: 500; margin-bottom: 8px; }
.modal-body {
  font-size: 14.5px;
  color: var(--ink-muted);
  margin-bottom: 16px;
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.modal-note { font-size: 13px; color: var(--ink-muted); margin-bottom: 16px; }
.modal-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.modal-btns .btn-solid { flex: 1 1 auto; }
.import-preview { white-space: normal; }
.import-preview p { margin-bottom: 8px; }
.import-preview ul { padding-left: 20px; margin-bottom: 8px; }
.import-preview b { color: var(--ink); }
.fix-list { font-size: 13px; }

/* The deed sheet: head, scrolling body, Save always at the bottom */
.deed-sheet {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  height: auto;
}
.sheet-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
  padding: 12px 8px 4px;
  flex: none;
}
.sheet-head::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  width: 36px;
  height: 4px;
  margin-left: -18px;
  border-radius: 2px;
  background: var(--border);
}
.sheet-head #sheetBackBtn { grid-column: 1; }
.sheet-title { grid-column: 2; text-align: center; font-size: 17px; font-weight: 500; overflow-wrap: anywhere; }
.sheet-head #sheetCloseBtn { grid-column: 3; }
.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 16px 16px;
}
.sheet-foot {
  flex: none;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--border-faint);
  background: var(--surface);
}

/* Step 1: tiles */
.tile-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding-bottom: 8px; }
.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 112px;
  padding: 12px 10px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
}
.tile:active { background: var(--surface-muted); transform: scale(0.98); }
.tile-text { display: flex; flex-direction: column; gap: 4px; }
.tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--teal-light);
  color: var(--teal);
  margin-bottom: 4px;
}
.tile-label { font-size: 15px; font-weight: 500; line-height: 1.25; overflow-wrap: anywhere; }
.tile-sub { font-size: 12.5px; color: var(--ink-muted); line-height: 1.35; }

/* Step 2: form */
.field-group { margin-bottom: 16px; }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; margin-bottom: 4px; }
.field-label { font-size: 14.5px; font-weight: 500; color: var(--ink); }
.optional { font-weight: 400; color: var(--ink-muted); }
.field-hint { font-size: 13px; color: var(--ink-muted); margin-top: 4px; line-height: 1.45; }
.help-dot {
  flex: none;
  width: 44px;
  height: 44px;
  margin: -8px -10px -8px 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle, var(--surface-muted) 0 12px, transparent 12.5px);
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 600;
}
.help-dot:active { background: radial-gradient(circle, var(--border) 0 12px, transparent 12.5px); }

.input-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: text;
}
.input-box:focus-within { border-color: var(--teal); box-shadow: var(--focus-ring); }
.input-box.invalid { border-color: var(--rose); }
.input-box input, .input-box select {
  flex: 1 1 auto;
  min-width: 0;
  height: 50px;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 16px; /* 16px stops phones zooming in on focus */
  color: var(--ink);
}
.input-box select { -webkit-appearance: none; appearance: none; cursor: pointer; }
.input-box:has(select) { background-image: linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%), linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input-box input::placeholder { color: var(--ink-faint); opacity: 1; }
.unit { flex: none; font-size: 15px; color: var(--ink-muted); }
.unit-pre { color: var(--ink); font-weight: 500; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 15px;
  color: var(--ink);
}
/* Yes/no switch and two-option segmented control (drawn by theme-neu.css) */
.toggle-head { min-height: 44px; }
.toggle-text { display: flex; align-items: center; gap: 8px; min-width: 0; }
.field-group .field-seg { display: flex; width: 100%; }
.field-group .field-seg > .seg-opt { flex: 1 1 0; padding: 0 12px; font-size: 15px; }
.chip[aria-pressed="true"] { background: var(--teal-light); border-color: var(--teal); color: var(--teal-strong); font-weight: 500; }

.result-line {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--teal-light);
  margin-bottom: 8px;
}
.result-kicker { font-size: 13px; color: var(--ink-muted); }
.result-text { font-size: 17px; font-weight: 500; line-height: 1.35; color: var(--ink); overflow-wrap: anywhere; }
.result-sub { font-size: 13px; color: var(--ink-muted); }

.form-problems {
  background: var(--rose-light);
  color: var(--rose);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 8px;
}
.warn-list { list-style: none; display: grid; gap: 8px; margin-bottom: 8px; }
.warn-item { font-size: 14px; line-height: 1.45; padding: 10px 14px; border-radius: var(--radius-md); }
.warn-item.is-warn { background: var(--amber-light); color: var(--amber); }
.warn-item.is-bad { background: var(--rose-light); color: var(--rose); }

.fold { border-top: 1px solid var(--border-faint); margin-top: 8px; }
.fold > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  font-size: 15px;
  font-weight: 500;
  color: var(--teal);
  cursor: pointer;
  user-select: none;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.15s;
}
.fold[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.fold-body { padding: 4px 0 8px; }
.card .fold { margin-top: 4px; }
.why-text {
  font-size: 14px;
  color: var(--ink-muted);
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 16px;
}

/* "Let AI estimate them": the second action in the sheet, below the fields. */
.ai-card { margin: 8px 0 8px; }
.ai-start {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow);
}
.ai-start:active { background: var(--surface-muted); }
.ai-icon { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-light); color: var(--blue); }
.ai-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.ai-start-text { display: flex; flex-direction: column; min-width: 0; }
.ai-start-title { font-size: 15px; font-weight: 500; line-height: 1.3; }
.ai-start-sub { font-size: 14px; color: var(--blue); font-weight: 500; line-height: 1.3; }
.ai-paste { min-height: 96px; margin-bottom: 12px; }
.ai-result { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 8px 8px 14px; border-radius: var(--radius-md); background: var(--blue-light); font-size: 14px; line-height: 1.45; color: var(--ink); }
.ai-result p { flex: 1 1 auto; min-width: 0; }

/* "Something else": a word in the text suggests a type with a real number. */
.suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: -4px 0 16px; padding: 10px 12px 10px 14px; border-radius: var(--radius-md); background: var(--blue-light); }
.suggest-text { flex: 1 1 160px; font-size: 14px; line-height: 1.45; color: var(--ink); }

/* Edge cases under More detail */
.flag-box { margin: 8px 0 16px; padding-top: 8px; border-top: 1px solid var(--border-faint); }
.fold-subhead { font-size: 15px; font-weight: 500; margin-bottom: 12px; color: var(--ink); }
.flag-note { margin: -8px 0 16px; }

.textarea {
  display: block;
  width: 100%;
  min-height: 88px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  resize: vertical;
  outline: none;
  margin-top: 4px;
}
.textarea:focus { border-color: var(--teal); box-shadow: var(--focus-ring); }
.code-box { font-family: var(--font-mono); font-size: 13px; min-height: 120px; margin-bottom: 12px; }

.how-formula { font-family: var(--font-mono); font-size: 13px; color: var(--ink-muted); margin-bottom: 8px; overflow-wrap: anywhere; }
.waterfall { margin-bottom: 12px; }
.waterfall-step {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(48px, 1fr) auto;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 4px 0;
}
.waterfall-label { color: var(--ink-muted); }
.waterfall-bar { height: 6px; border-radius: 3px; background: var(--surface-muted); overflow: hidden; display: block; }
.waterfall-fill { display: block; height: 100%; background: var(--teal); border-radius: 3px; }
.waterfall-val { font-family: var(--font-mono); font-size: 13px; text-align: right; min-width: 40px; }

.sheet-extra {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
  padding-top: 8px;
  border-top: 1px solid var(--border-faint);
}

/* After saving */
.celebrate-sheet { text-align: center; padding-top: 32px; }
.celebrate-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--teal-light);
  color: var(--teal);
  display: grid;
  place-items: center;
  animation: pop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.celebrate-mark svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
.celebrate-title { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.celebrate-line { font-size: 17px; line-height: 1.45; color: var(--ink); margin: 8px auto 24px; max-width: 34ch; }
.celebrate-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 8px; margin-bottom: 24px; }
.cel-stat { display: flex; flex-direction: column; background: var(--surface-muted); border-radius: var(--radius-md); padding: 12px 8px; }
.cel-val { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cel-label { font-size: 13px; color: var(--ink-muted); line-height: 1.3; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--nav-total) + 88px);
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--toast-bg);
  color: var(--toast-ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  pointer-events: none;
  box-shadow: var(--toast-shadow);
}
.toast.is-error { background: var(--toast-error-bg); color: var(--toast-ink); }
.toast.has-action { pointer-events: auto; }
.toast-action {
  min-height: 44px;
  min-width: 44px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}
/* While a sheet is open at the bottom, show messages at the top instead */
.modal-open .toast { bottom: auto; top: calc(var(--safe-top) + 12px); }

/* ---------- Tablet: two columns instead of a narrow strip ---------- */
@media (min-width: 760px) {
  .app-header, .app-main { padding-left: 32px; padding-right: 32px; }
  .page-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .modal-overlay { align-items: center; padding: 32px; }
  .modal-sheet { border-radius: var(--radius-xl); padding-bottom: 20px; }
  .sheet-foot { padding-bottom: 16px; }
  .deed-sheet { max-height: min(820px, 100%); }
  .fab { right: max(32px, calc((100vw - 1040px) / 2 + 32px)); }
}

/* ---------- Landscape phone: compact header and nav ---------- */
@media (orientation: landscape) and (max-height: 500px) {
  .app-header { padding-top: calc(var(--safe-top) + 4px); padding-bottom: 4px; }
  .app-title { font-size: 17px; line-height: 28px; }
  .tile { min-height: 88px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Fit with theme-neu.css (loaded after this file) ---------- */
/* The box is the inset pill; the input inside it stays flat. */
.input-box input:not([type="checkbox"]):not([type="radio"]), .input-box select {
  box-shadow: none; background: transparent; border-radius: 0; padding: 0; min-height: 0; width: auto;
}
.card .theme-seg { display: flex; }
.card .theme-seg > .seg-btn { flex: 1 1 0; padding: 0 8px; }
.result-line { box-shadow: var(--neu-inset, none); }
.celebrate-sheet .celebrate-mark { display: flex; width: 64px; height: 64px; }
.celebrate-sheet .celebrate-mark svg { width: 32px; height: 32px; }

/* "Your impact in detail": a fold at the bottom of Home, closed until tapped. */
.fold-card { padding: 0; margin-top: 16px; }
.fold-card > :not(summary) { margin-left: 16px; margin-right: 16px; }
.fold-card > :last-child { margin-bottom: 16px; }
.fold-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 0 16px; cursor: pointer; list-style: none; }
.fold-summary::-webkit-details-marker { display: none; }
.fold-summary .card-title { margin: 0; }
.fold-chev { width: 22px; height: 22px; flex: none; fill: none; stroke: var(--ink-muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.fold-card[open] .fold-chev { transform: rotate(180deg); }

/* Header: title, gear (Home) or back arrow (Settings) */
.header-row { max-width: 1040px; margin: 0 auto; display: flex; align-items: center; gap: 8px; }
.header-row .app-title { flex: 1 1 auto; margin: 0; min-width: 0; }
.header-btn { flex: none; width: 44px; height: 44px; }
#headerBack { margin-left: -10px; }
#headerGear { margin-right: -6px; }

/* Sections inside the detail fold */
.fold-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-faint); }
.fold-sub { font-size: 16px; font-weight: 600; margin: 0 0 8px; }

/* At-a-glance bars: one colour per measure */
.pill-people { --fill-a: #e8455f; --fill-b: #ff9a7a; }
.pill-co2    { --fill-a: #12965f; --fill-b: #5fd68f; }
.pill-hours  { --fill-a: #6d3fe0; --fill-b: #b18cff; }
.pill-money  { --fill-a: #d97706; --fill-b: #fbbf24; }
.pill-bar .pill-fill { background: linear-gradient(0deg, var(--fill-a), var(--fill-b)); }
.given-row:empty { display: none; }

/* AI help: its own step in the sheet */
.ai-start { position: relative; }
.ai-go { width: 22px; height: 22px; margin-left: auto; flex: none; fill: none; stroke: var(--ink-muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ai-intro { font-size: 15px; color: var(--ink-muted); margin: 4px 0 16px; }
.ai-flow { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 20px; }
.ai-step { display: flex; gap: 14px; align-items: flex-start; }
.ai-num { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 15px; color: var(--ink); background: var(--surface); box-shadow: var(--neu-raised-sm, none); }
.ai-step-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ai-step-title { font-size: 16px; font-weight: 600; margin: 4px 0 0; }
.ai-step-note { font-size: 14px; color: var(--ink-muted); margin: 0; }
.ai-question { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.45; margin: 8px 0 0; padding: 12px; border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--neu-inset, none); max-height: 260px; overflow-y: auto; }
.kb-open .fab { display: none; }

/* "Your log" on Home: newest few deeds + See all */
.log-section { margin-top: 8px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 4px 8px; }
.section-title { font-size: 17px; font-weight: 600; margin: 0; }
.section-link { min-height: 44px; padding: 0 4px; }
.page-narrow { max-width: 640px; margin: 0 auto; }
.on-settings .fab { display: none; }

/* ---------- Auth Overlay & Card ---------- */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.auth-overlay[hidden] {
  display: none !important;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 32px 24px;
  background: var(--surface);
  border-radius: var(--radius-lg, 16px);
  box-shadow: var(--shadow-lg, 0 10px 25px rgba(0,0,0,0.1));
  display: flex;
  flex-direction: column;
}
.auth-icon {
  font-size: 40px;
  text-align: center;
  margin-bottom: 8px;
}
.auth-title {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  margin: 0 0 6px;
  color: var(--ink);
}
.auth-sub {
  font-size: 14px;
  text-align: center;
  color: var(--ink-muted);
  margin: 0 0 20px;
  line-height: 1.45;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-error {
  padding: 10px 14px;
  border-radius: var(--radius-md, 8px);
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 12px;
}
.auth-toggle-row {
  margin-top: 18px;
  text-align: center;
}

/* ---------- Badge Section ---------- */
/* ---------- Top Navigation ---------- */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border-faint);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.brand-icon {
  font-size: 24px;
}
.brand-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--ink);
}

.public-nav, .app-nav {
  display: flex;
  align-items: center;
  gap: 14px;
}
.nav-link {
  color: var(--ink-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover {
  color: var(--ink);
  background: var(--surface-muted);
}
.nav-tab {
  background: transparent;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}
.nav-tab:hover {
  color: var(--ink);
  background: var(--surface-muted);
}
.nav-tab.active {
  color: var(--teal);
  background: var(--teal-light);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 8px;
}
.btn-add-deed {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-pill);
}
.btn-add-deed svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-muted);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  cursor: pointer;
}
.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--teal);
  color: var(--on-teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.brand-title { white-space: nowrap; }
.nav-tabs { display: flex; align-items: center; gap: 4px; }
.nav-tab { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; min-height: 40px; }
.nav-tab-icon { display: none; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-tab .lbl-short { display: none; }

/* Narrow screens: tabs drop into a bottom bar, header keeps brand, + button and avatar. */
@media (max-width: 960px) {
  .nav-container { padding: 10px 16px; gap: 10px; }
  .public-nav .nav-link { display: none; }
  .public-nav, .app-nav { gap: 10px; }
  .nav-btn { min-height: 44px; padding: 0 16px; font-size: 14px; }
}
@media (max-width: 900px) {
  :root { --nav-height: 64px; }
  /* backdrop-filter would trap the fixed tab bar inside the header */
  .top-nav { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .nav-tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    height: var(--nav-total);
    padding: 0 4px var(--safe-bottom);
    gap: 0; justify-content: space-around; align-items: stretch;
    background: var(--surface);
    box-shadow: 0 -2px 10px var(--neu-dark, rgba(0,0,0,.12));
  }
  .nav-tab {
    flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; gap: 2px;
    padding: 6px 2px; font-size: 12px; border-radius: var(--radius-sm);
  }
  .nav-tab:hover { background: transparent; }
  .nav-tab.active { background: transparent; color: var(--teal); font-weight: 700; box-shadow: inset 0 3px 0 var(--teal); border-radius: 0; }
  .nav-tab-icon { display: block; }
  .nav-tab .lbl-full { display: none; }
  .nav-tab .lbl-short { display: inline; }
  .nav-actions { margin-left: 0; gap: 8px; }
  .user-email-tag { display: none; }
  .user-chip { padding: 0; width: 44px; height: 44px; justify-content: center; }
  .user-avatar { width: 32px; height: 32px; font-size: 14px; }
}
@media (max-width: 480px) {
  /* hero has its own big "Start Tracking Free" button right below */
  .nav-signup { display: none; }
  .btn-add-deed { width: 44px; height: 44px; min-height: 44px; padding: 0; justify-content: center; }
  .btn-add-deed .add-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .btn-add-deed svg { width: 20px; height: 20px; }
}

/* ---------- Public Landing Page ---------- */
.public-landing {
  overflow-x: hidden;
}
.hero-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 24px 50px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 48px;
  align-items: center;
}
@media (max-width: 900px) {
  .hero-section {
    grid-template-columns: minmax(0, 1fr);
    padding: 36px 20px 40px;
    gap: 32px;
  }
}
.badge-pill-pill {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--teal-light);
  color: var(--teal);
  margin-bottom: 16px;
}
.hero-headline {
  font-size: 42px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.8px;
  color: var(--ink);
  margin-bottom: 20px;
}
@media (max-width: 600px) {
  .hero-headline { font-size: 32px; }
}
.hero-gradient {
  background: linear-gradient(135deg, var(--teal), #0284c7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-subtitle {
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink-muted);
  margin-bottom: 28px;
  max-width: 580px;
}
.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.btn-hero {
  padding: 12px 26px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius-pill);
}
.hero-trust {
  font-size: 13px;
  color: var(--ink-faint);
}

.hero-badge-card {
  padding: 24px;
  border-radius: var(--radius-xl);
}
.card-badge-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}
.hero-card-desc {
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 18px;
}
.hero-badge-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.badge-showcase-item {
  padding: 12px;
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.badge-type-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-svg-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 0;
}

/* Sections */
.landing-section {
  padding: 70px 24px;
}
.landing-section:nth-child(even) {
  background: var(--surface-muted);
}
.section-container {
  max-width: 1100px;
  margin: 0 auto;
}
.section-heading {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}
.section-subheading {
  font-size: 16px;
  color: var(--ink-muted);
  margin-bottom: 40px;
}
.text-center { text-align: center; }

/* 3-Steps Grid */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
@media (max-width: 768px) {
  .steps-grid { grid-template-columns: 1fr; }
}
.step-card {
  padding: 28px 24px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}
.step-num {
  position: absolute;
  top: 18px;
  right: 20px;
  font-size: 13px;
  font-weight: 800;
  color: var(--teal);
  background: var(--teal-light);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-icon {
  font-size: 32px;
}
.step-title {
  font-size: 18px;
  font-weight: 700;
}
.step-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-muted);
}

/* Interactive Calculator */
.demo-calc-card {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px;
  border-radius: var(--radius-xl);
}
.demo-calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
}
@media (max-width: 768px) {
  .demo-calc-grid { grid-template-columns: 1fr; }
}
.calc-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  display: block;
  margin-bottom: 8px;
}
.demo-type-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.demo-pill {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  transition: all 0.15s;
}
.demo-pill.active {
  background: var(--teal-light);
  color: var(--teal);
  border-color: var(--teal);
}
.demo-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 18px;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 12px;
}
.quick-presets {
  display: flex;
  gap: 8px;
}
.preset-btn {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
}
.preset-btn.active {
  background: var(--teal);
  color: var(--on-teal);
}
.demo-calc-result {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.result-box {
  padding: 22px;
  background: var(--surface-muted);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--teal);
}
.result-badge-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--teal);
  letter-spacing: 0.5px;
}
.result-big-val {
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  margin: 6px 0;
}
.result-sub-val {
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 10px;
}
.result-math-callout {
  font-size: 12px;
  color: var(--ink-faint);
  border-top: 1px solid var(--border-faint);
  padding-top: 10px;
  line-height: 1.45;
}

/* Badges Showcase Grid */
.badges-showcase-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
@media (max-width: 900px) {
  .badges-showcase-grid { grid-template-columns: minmax(0, 1fr); }
}
.showcase-card, .hero-content, .hero-preview-col { min-width: 0; }
.showcase-preview-frame svg, .badge-svg-frame svg { max-width: 100%; height: auto; }
.showcase-card {
  padding: 24px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.showcase-preview-frame {
  padding: 24px 12px;
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
}
.code-snippet-box {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 8px 10px;
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  overflow-x: auto;
  white-space: nowrap;
}

/* Public Footer */
.public-footer {
  background: var(--surface);
  border-top: 1px solid var(--border-faint);
  padding: 48px 24px 32px;
}
.footer-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 24px;
}
.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.footer-logo { font-size: 20px; }
.footer-name { font-size: 16px; font-weight: 700; }
.footer-desc { font-size: 13px; color: var(--ink-muted); }
.footer-links {
  display: flex;
  gap: 18px;
}
.footer-links a {
  font-size: 13px;
  color: var(--ink-muted);
  text-decoration: none;
}
.footer-links a:hover { color: var(--teal); }
.footer-bottom {
  max-width: 1100px;
  margin: 0 auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-faint);
  font-size: 12px;
  color: var(--ink-faint);
}

/* ---------- App Layout (Signed-in) ---------- */
.dashboard-container, .studio-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.impact-headline-card {
  padding: 28px 32px;
  border-radius: var(--radius-xl);
}
.impact-headline-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}
.section-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--teal);
}
.headline-badge-peek {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
@media (max-width: 600px) {
  .headline-badge-peek { align-items: flex-start; }
}
.peek-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.headline-badge-peek { min-width: 0; max-width: 100%; }
.peek-badge-wrap {
  max-width: 100%;
  box-sizing: border-box;
  padding: 8px 14px;
  background: var(--surface-muted);
  border-radius: var(--radius-md);
}
.peek-badge-wrap img {
  display: block;
  height: auto;
  max-height: 28px;
  max-width: 100%;
}
.peek-placeholder {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
}

/* 4 Core Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
  .stats-grid { grid-template-columns: 1fr; }
}
.stat-card {
  padding: 22px 20px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.stat-card-icon {
  font-size: 24px;
  margin-bottom: 2px;
}
.stat-card-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
}
.stat-card-val {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--ink);
}
.stat-card-sub {
  font-size: 12px;
  color: var(--ink-faint);
}

/* ---------- Badges Studio ---------- */
.page-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}
.page-subtitle {
  font-size: 15px;
  color: var(--ink-muted);
}
.studio-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 800px) {
  .studio-grid { grid-template-columns: 1fr; }
}
.studio-customizer-card, .studio-preview-card {
  padding: 26px;
  border-radius: var(--radius-xl);
}
.style-choice-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 12px;
}
.style-btn {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.15s;
}
.style-btn.active {
  border-color: var(--teal);
  background: var(--teal-light);
}
.style-btn-icon { font-size: 18px; }
.style-btn-title { font-size: 14px; font-weight: 700; color: var(--ink); }
.style-btn-desc { font-size: 12px; color: var(--ink-muted); }

.theme-pill-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.badge-theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  transition: all 0.15s;
}
.badge-theme-btn.active {
  border-color: var(--teal);
  background: var(--teal-light);
  color: var(--teal);
}
.theme-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.studio-badge-stage {
  padding: 32px 16px;
  background: var(--surface-muted);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  margin-bottom: 20px;
}
.studio-badge-stage img {
  max-width: 100%;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.1));
}
.embed-code-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Milestone Badges Grid */
.milestones-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}
@media (max-width: 768px) {
  .milestones-grid { grid-template-columns: 1fr; }
}
.milestone-badge-item {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  display: flex;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--border-faint);
  transition: all 0.2s;
}
.milestone-badge-item.unlocked {
  background: var(--surface);
  border-color: var(--teal);
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.08);
}
.milestone-badge-item.locked {
  opacity: 0.65;
}
.milestone-icon {
  font-size: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.milestone-badge-item.unlocked .milestone-icon {
  background: var(--teal-light);
}
.milestone-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.milestone-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.milestone-req {
  font-size: 12px;
  color: var(--ink-muted);
}
.milestone-status {
  font-size: 11px;
  font-weight: 700;
  margin-top: 4px;
}
.milestone-badge-item.unlocked .milestone-status {
  color: #10b981;
}
.milestone-badge-item.locked .milestone-status {
  color: var(--ink-faint);
}

/* Modal Close Icon */
.modal-close-icon {
  position: absolute;
  top: 16px;
  right: 18px;
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 50%;
}
.modal-close-icon:hover {
  color: var(--ink);
  background: var(--surface-muted);
}

/* SVG Icon & Brand Visuals */
.brand-sprout {
  width: 22px;
  height: 22px;
  color: var(--teal);
  flex: none;
}
.brand-sprout path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.step-svg-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--teal-light);
  color: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.step-svg-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--teal);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.stat-card-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--teal);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}
.style-svg-icon {
  margin-bottom: 4px;
}
.style-svg-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--teal);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}
.auth-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--teal-light);
  color: var(--teal);
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-icon-wrap svg {
  width: 28px;
  height: 28px;
}
.footer-logo-row {
  display: flex;
  align-items: center;
  gap: 8px;
}



