/* Impact Ledger neumorphism theme. Load AFTER style.css.
   Accessible: soft raised/inset surfaces, text >=4.5:1, visible focus rings,
   one accent hue (teal #7797a3, chosen by Arash 2026-11-08) for the primary action and progress fills.

   Class hooks expected (add any that are missing in the markup):
     .card .tile .input-box (or bare input/select/textarea) .bottom-nav .fab .btn-primary .btn
     .tile.active / [aria-pressed="true"] = inset.  .bottom-nav [aria-current="page"] = inset.

   New components (pure CSS, driven by --value 0..100 set via a class-free attribute is
   not possible without inline style, so set it from JS: el.style.setProperty('--value', n)
   or add classes/attributes in your own sheet):

   .icon-circle  raised round icon holder, 48px
     <span class="icon-circle" aria-hidden="true"><svg>...</svg></span>

   .ring  donut progress; --value 0-100; centre is inset and holds the label
     <div class="ring" role="img" aria-label="70% of weekly goal"><span>70%</span></div>

   .pill-bars / .pill-bar  vertical inset tracks, fill height = --value
     <div class="pill-bars">
       <div class="pill-bar"><div class="pill-track"><div class="pill-fill"></div></div>
         <span class="pill-label">People</span><span class="pill-value">82%</span></div>
     </div>   (set --value on .pill-bar)

   .progress  slim inset track with gradient fill, optional bubble
     <div class="progress" role="progressbar" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">
       <div class="progress-fill"><span class="progress-tip">50%</span></div></div>   (--value on .progress)

   .segmented  raised container, accent-filled active segment
     <div class="segmented" role="group"><button aria-pressed="true">One-off</button><button aria-pressed="false">Monthly</button></div>
     (active = [aria-pressed="true"], [aria-selected="true"], [aria-checked="true"] or .active)

   .toggle  pill track + raised knob, accent track when on
     <button class="toggle" role="switch" aria-checked="true" aria-label="Still giving"></button>
     (or <input type="checkbox" class="toggle" role="switch">)
*/
:root {
  --bg: #eef0f5;
  --surface: #eef0f5;
  --surface-muted: #e3e7ee;
  --ink: #1c2433;
  --ink-muted: #3f4a5c;
  --ink-faint: #4b5668;
  --border: transparent;
  --border-faint: transparent;
  --teal: #3f5f6a;               /* text/icons in the accent hue: #7797a3 deepened to pass 4.5:1 */
  --teal-light: #eef0f5;
  --teal-strong: #5f808c;        /* pressed state of the teal */
  --blue: #3f5f6a; --blue-light: #e2eaed;
  --teal-border: transparent;
  --on-teal: #ffffff;            /* white text on the #567784 fill = 4.8:1 (on the old #7797a3 it was 3.1:1) */
  --radius-sm: 16px;
  --radius-md: 20px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --accent-a: #567784;           /* the highlight colour: #7797a3 deepened so white text passes 4.5:1 */
  --accent-b: #567784;
  --fill-a: #6a8b97;             /* decorative fills (no text on them) */
  --fill-b: #9fbcc6;
  --accent-grad: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  --fill-grad: linear-gradient(90deg, var(--fill-a), var(--fill-b));
  --fill-grad-v: linear-gradient(0deg, var(--fill-a), var(--fill-b));

  --neu-light: #ffffff;
  --neu-dark: #c5ccd8;
  /* Tight, small shadows: crisp edges, no smears. */
  --neu-raised: 4px 4px 10px var(--neu-dark), -4px -4px 10px var(--neu-light);
  --neu-raised-sm: 2px 2px 6px var(--neu-dark), -2px -2px 6px var(--neu-light);
  --neu-inset: inset 2px 2px 4px var(--neu-dark), inset -2px -2px 4px var(--neu-light);
  --neu-glow: 0 0 0 transparent;
  --neu-focus: #3f5f6a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #262b36; --surface: #262b36; --surface-muted: #1f232c;
    --ink: #eef1f6; --ink-muted: #b9c2d0; --ink-faint: #a2adbd;
    --teal: #9dbcc7; --teal-light: #262b36; --on-teal: #ffffff; --teal-strong: #8fb0bc; --blue: #9dbcc7; --blue-light: #26343b;
    --accent-a: #567784; --accent-b: #567784;
    --fill-a: #7797a3; --fill-b: #a7c2cb;
    --neu-light: #3a4152; --neu-dark: #101318;
    --neu-glow: 0 0 0 transparent;
    --neu-focus: #9dbcc7;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #262b36; --surface: #262b36; --surface-muted: #1f232c;
  --ink: #eef1f6; --ink-muted: #b9c2d0; --ink-faint: #a2adbd;
  --teal: #9dbcc7; --teal-light: #262b36; --on-teal: #ffffff; --teal-strong: #8fb0bc; --blue: #9dbcc7; --blue-light: #26343b;
  --accent-a: #567784; --accent-b: #567784;
  --fill-a: #7797a3; --fill-b: #a7c2cb;
  --neu-light: #3a4152; --neu-dark: #101318;
  --neu-glow: 0 0 0 transparent;
  --neu-focus: #9dbcc7;
  color-scheme: dark;
}

body { background: var(--bg); color: var(--ink); }

/* Raised surfaces */
.card, .tile, .btn {
  background: var(--surface); color: var(--ink); border: 0; box-shadow: var(--neu-raised);
}
.card { border-radius: var(--radius-lg); }
.tile { border-radius: var(--radius-md); box-shadow: var(--neu-raised-sm); }
/* Pill buttons */
.btn { border-radius: var(--radius-pill); min-height: 44px; padding: 0 24px; font: inherit; font-weight: 500; cursor: pointer; }
.btn:active, .tile:active, .tile.active, .tile[aria-pressed="true"], .btn[aria-pressed="true"] { box-shadow: var(--neu-inset); }

/* Pill inputs, inset */
.input-box, input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  background: var(--surface); color: var(--ink); border: 0;
  border-radius: var(--radius-pill); box-shadow: var(--neu-inset); min-height: 48px; font: inherit;
}
textarea { border-radius: var(--radius-md); }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { padding: 10px 20px; width: 100%; }
::placeholder { color: var(--ink-muted); opacity: 1; }
.input-box input, .input-box select, .input-box textarea { box-shadow: none; background: transparent; }

/* Primary action: gradient pill */
.btn-primary {
  background: var(--accent-grad); color: var(--on-teal); border: 0;
  border-radius: var(--radius-pill); min-height: 48px; padding: 0 28px;
  font: inherit; font-weight: 600; cursor: pointer;
  box-shadow: var(--neu-raised-sm);
}
.btn-primary:active { box-shadow: inset 3px 3px 8px rgba(0,0,0,.35), inset -2px -2px 6px rgba(255,255,255,.15); }
.fab {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--accent-grad); color: var(--on-teal); border: 0;
  font-size: 32px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--neu-raised-sm); animation: none;
}
.fab:active { box-shadow: inset 2px 2px 5px rgba(0,0,0,.35); }

/* Icon circle */
.icon-circle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; min-width: 44px; min-height: 44px; border-radius: 50%;
  background: var(--surface); color: var(--teal); box-shadow: var(--neu-raised-sm);
}
.icon-circle svg { width: 22px; height: 22px; }

/* Donut ring */
.ring {
  --value: 0; --size: 150px; --thick: 16px;
  position: relative; width: var(--size); height: var(--size); border-radius: 50%;
  background: conic-gradient(var(--fill-a), var(--fill-b) calc(var(--value) * 1%), transparent 0);
  box-shadow: var(--neu-raised); display: grid; place-items: center;
}
.ring::before { /* inset track visible past the arc */
  content: ""; position: absolute; inset: 0; border-radius: 50%; z-index: 0;
  background: conic-gradient(transparent calc(var(--value) * 1%), var(--surface-muted) 0);
}
.ring::after { /* inset centre */
  content: ""; position: absolute; inset: var(--thick); border-radius: 50%;
  background: var(--surface); box-shadow: var(--neu-inset); z-index: 1;
}
.ring > * { position: relative; z-index: 2; font-weight: 600; font-size: 1.4rem; color: var(--ink); text-align: center; }

/* Pill bars */
.pill-bars { display: flex; gap: 14px; justify-content: space-between; align-items: flex-end; }
.pill-bar { --value: 0; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.pill-track {
  position: relative; width: 100%; max-width: 44px; height: 140px; border-radius: var(--radius-pill);
  background: var(--surface); box-shadow: var(--neu-inset); overflow: hidden;
}
.pill-fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--value) * 1%);
  border-radius: var(--radius-pill); background: var(--fill-grad-v);
}
.pill-label { font-size: 0.8rem; color: var(--ink-muted); text-align: center; overflow-wrap: anywhere; }
.pill-value { font-size: 0.9rem; font-weight: 600; color: var(--ink); }

/* Slim progress */
.progress {
  --value: 0; position: relative; height: 12px; border-radius: var(--radius-pill);
  background: var(--surface); box-shadow: var(--neu-inset); margin-top: 40px;
}
.progress-fill {
  position: relative; height: 100%; width: calc(var(--value) * 1%); min-width: 12px;
  border-radius: var(--radius-pill); background: var(--fill-grad);
}
.progress-tip {
  position: absolute; right: 0; bottom: calc(100% + 12px); transform: translateX(50%);
  padding: 4px 12px; border-radius: 12px; background: var(--surface); color: var(--ink);
  font-size: 0.85rem; font-weight: 500; box-shadow: var(--neu-raised-sm); white-space: nowrap;
}
.progress-tip::after {
  content: ""; position: absolute; left: 50%; top: 100%; margin-left: -6px;
  border: 6px solid transparent; border-top-color: var(--surface);
}

/* Segmented control */
.segmented {
  display: inline-flex; gap: 4px; padding: 5px; border-radius: var(--radius-pill);
  background: var(--surface); box-shadow: var(--neu-raised-sm);
}
.segmented > * {
  min-height: 44px; min-width: 44px; padding: 0 20px; border: 0; border-radius: var(--radius-pill);
  background: transparent; color: var(--ink); font: inherit; font-weight: 500; cursor: pointer;
}
.segmented > [aria-pressed="true"], .segmented > [aria-selected="true"],
.segmented > [aria-checked="true"], .segmented > .active {
  background: var(--accent-grad); color: var(--on-teal); box-shadow: 1px 1px 3px rgba(0,0,0,.18);
}

/* Toggle */
.toggle {
  appearance: none; -webkit-appearance: none; position: relative; flex: none;
  width: 64px; height: 44px; padding: 0; border: 0; border-radius: var(--radius-pill);
  background: var(--surface); box-shadow: var(--neu-inset); cursor: pointer;
}
.toggle::after {
  content: ""; position: absolute; top: 6px; left: 6px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--neu-raised-sm);
}
.toggle[aria-checked="true"], .toggle:checked { background: var(--accent-grad); box-shadow: inset 2px 2px 6px rgba(0,0,0,.3); }
.toggle[aria-checked="true"]::after, .toggle:checked::after { left: 26px; background: #ffffff; box-shadow: 2px 2px 6px rgba(0,0,0,.35); }

/* Focus: always visible */
:focus-visible { outline: 3px solid var(--neu-focus); outline-offset: 3px; }
.input-box:focus-within { outline: 2px solid var(--neu-focus); outline-offset: 1px; box-shadow: var(--neu-inset); }
.input-box input:focus-visible, .input-box select:focus-visible, .input-box textarea:focus-visible { outline: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media (prefers-reduced-motion: no-preference) {
  .card, .tile, .btn, .btn-primary, .fab, input, select, textarea, .toggle, .toggle::after, .pill-fill, .progress-fill { transition: box-shadow .15s ease, left .15s ease, height .3s ease, width .3s ease; }
}

/* Selected choice chips: same as the segmented control (teal fill, dark text). */
.chip[aria-pressed="true"] { background: var(--accent-a); color: var(--on-teal); border-color: transparent; box-shadow: 1px 1px 3px rgba(0,0,0,.18); }

/* ---------- Audit fixes 2026-11-09: contrast ---------- */
:root { --err-ink: #a61b1b; --err-bg: #fbe3e3; --ok-ink: #0f6b45; --hero-blue: #035a8a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --err-ink: #ffb4b4; --err-bg: #3d2226; --ok-ink: #7fe0b3; --hero-blue: #8fd3f7; }
}
:root[data-theme="dark"] { --err-ink: #ffb4b4; --err-bg: #3d2226; --ok-ink: #7fe0b3; --hero-blue: #8fd3f7; }

.auth-error { background: var(--err-bg); color: var(--err-ink); font-size: 14px; font-weight: 500; }
.milestone-badge-item.unlocked .milestone-status { color: var(--ok-ink); font-weight: 700; }
.milestone-badge-item.locked .milestone-status, .milestone-badge-item.locked .milestone-req { color: var(--ink-muted); }
.hero-gradient { color: var(--teal); background: linear-gradient(135deg, var(--teal), var(--hero-blue)); -webkit-background-clip: text; background-clip: text; }
/* accent fills carry white text (--on-teal), so they use the accent fill, never the light-on-dark --teal */
.preset-btn.active, .user-avatar, .btn-solid, .fab { background: var(--accent-a); color: var(--on-teal); }
.btn-primary { background: var(--accent-grad); }
/* outline buttons need a visible edge in dark mode */
.btn-outline { box-shadow: var(--neu-raised-sm); border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent); }
/* toasts sit just above the bottom edge (or the phone tab bar), not over page headings */
.toast { bottom: calc(var(--nav-total) + 20px); }
/* no lone words at the end of headings */
h1, h2, h3, .hero-headline, .section-heading, .hero-card-desc, .section-subheading { text-wrap: balance; }
.seg-btn { white-space: nowrap; }
#tab-log .page-title, #tab-settings > .page-title { margin: 8px 0 16px; }

/* Site logo: original navy-to-teal on light; lighter ends in dark mode so the navy half stays visible */
:root { --logo-a: #052352; --logo-b: #06b8a5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --logo-a: #8fb4e8; --logo-b: #3fe0cc; } }
:root[data-theme="dark"] { --logo-a: #8fb4e8; --logo-b: #3fe0cc; }
.brand-logo { height: 24px; width: auto; aspect-ratio: 562.6 / 273.4; flex: none; display: block; }
.auth-icon-wrap { width: auto; height: auto; padding: 12px 16px; border-radius: 999px; }
.auth-icon-wrap .brand-logo { height: 26px; width: auto; }
@media (max-width: 360px) {
  .nav-brand .brand-logo { height: 20px; }
  .brand-title { font-size: 17px; }
}

/* ---------- Badges, About (2026-11-09) ---------- */
.demo-badge { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.showroom-cta { display: flex; justify-content: center; margin-top: 32px; }
.about-container { max-width: 960px; }
.about-card { padding: clamp(24px, 5vw, 44px); display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 48px); align-items: center; }
@media (max-width: 760px) { .about-card { grid-template-columns: minmax(0, 1fr); } }
.about-text .section-heading { text-align: left; margin: 6px 0 12px; }
.about-text .body-text { line-height: 1.6; font-size: 17px; }
.about-text strong { color: var(--teal); }
.about-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.about-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--radius-pill);
  background: var(--surface); box-shadow: var(--neu-raised-sm); color: var(--ink); text-decoration: none; font-weight: 600; }
.about-link svg { width: 18px; height: 18px; }
.about-link:hover { color: var(--teal); }
.about-count { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.about-count-label { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-muted); }
.about-count img { display: block; max-width: 100%; height: auto; }
.about-goal .progress { margin-top: 6px; }
.about-goal-text { margin-top: 8px; font-size: 14px; color: var(--ink-muted); }
.badge-name { margin-top: 16px; }
.badge-name-label { display: block; font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.badge-name-row { display: flex; gap: 10px; align-items: center; }
.badge-name-row input { flex: 1 1 auto; min-width: 0; }
.badge-name-row .btn { flex: none; min-height: 48px; }
.badge-name-hint { margin-top: 8px; font-size: 13px; color: var(--ink-muted); }
#studioPreviewImg { max-width: 100%; height: auto; }

/* "Want a bigger number?" box: GiveWell / Charity Navigator */
.give-container { max-width: 760px; }
.give-nudge { padding: clamp(20px, 4vw, 32px); }
.give-dash { margin-top: 24px; }
.give-title { font-size: 20px; font-weight: 700; margin: 0 0 8px; color: var(--ink); }
.give-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 14px; }
.give-link { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: var(--radius-md);
  background: var(--surface); box-shadow: var(--neu-raised-sm); color: var(--ink); text-decoration: none; }
.give-link:hover .give-name { text-decoration: underline; }
.give-name { font-weight: 700; color: var(--teal); }
.give-name::after { content: " ↗"; font-weight: 400; }
.give-desc { font-size: 14px; color: var(--ink-muted); line-height: 1.45; }
.give-note { margin-top: 12px; font-size: 13px; color: var(--ink-muted); }
/* small labels: never under 12px */
.milestone-status, .badge-type-tag, .peek-label, .result-badge-tag, .section-eyebrow { font-size: 12px; }

/* about.html */
.about-page .nav-brand { text-decoration: none; color: inherit; }
.about-page main { min-height: 60vh; display: flex; align-items: center; }
.about-page main > section { width: 100%; }
.footer-links a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.about-home-btn { text-decoration: none; white-space: nowrap; }
/* one background for the whole landing page: no grey bands between sections */
.landing-section:nth-child(even) { background: transparent; }

/* Footer is shared by the landing page and the app. In the app, the landing-page links go nowhere. */
.signed-in:not(.viewing-landing) .footer-landing-link { display: none; }
.signed-in .app-main { padding-bottom: 40px; }
@media (max-width: 900px) {
  /* keep the footer above the phone tab bar */
  .signed-in .public-footer { padding-bottom: calc(var(--nav-total) + 24px); }
}

/* Badges Studio: which numbers to show */
.metric-checks { display: flex; flex-wrap: wrap; gap: 10px; }
.metric-check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px 0 12px; border-radius: var(--radius-pill);
  background: var(--surface); box-shadow: var(--neu-raised-sm); cursor: pointer; font-weight: 500; color: var(--ink); }
.metric-check input { width: 20px; height: 20px; min-height: 0; margin: 0; padding: 0; accent-color: var(--accent-a); box-shadow: none; }
.metric-check:has(input:checked) { box-shadow: var(--neu-inset); color: var(--teal); font-weight: 600; }
/* AI prompt card: stands out from the form (teal fill, white text; white on #2a7a75 = 5:1) */
.ai-start, .ai-start.card { background: linear-gradient(135deg, #3f6b78, #2a7a75); color: #fff; border: 0; box-shadow: var(--neu-raised); }
.ai-start:hover { filter: brightness(1.06); }
.ai-start .ai-start-text { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.ai-start .ai-start-title { color: #fff; font-size: 16px; font-weight: 700; }
.ai-start .ai-start-sub { color: #f1fbf9; font-weight: 500; }
.ai-start .ai-icon { background: rgba(255, 255, 255, .18); color: #fff; box-shadow: none; }
.ai-start .ai-go { color: #fff; stroke: #fff; }
.ai-rec { display: inline-block; padding: 1px 9px; border-radius: 999px; background: #fff; color: #23555f; font-size: 12px; font-weight: 700; letter-spacing: .2px; }

/* Delete my account */
.delete-account { margin-top: 8px; padding-top: 12px; border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); }
.delete-panel { margin-top: 4px; }
.delete-panel .body-text { margin-bottom: 12px; line-height: 1.5; }
.btn-danger-solid { background: var(--err-ink); color: #fff; border: 0; min-height: 48px; padding: 0 18px; border-radius: var(--radius-pill); font: inherit; font-weight: 600; cursor: pointer; flex: none; }
:root[data-theme="dark"] .btn-danger-solid { background: #b3261e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-danger-solid { background: #b3261e; } }
.btn-danger-solid:disabled { opacity: .45; cursor: not-allowed; }
/* privacy.html */
.privacy-container { max-width: 760px; }
.privacy-card { padding: clamp(24px, 5vw, 44px); }
.privacy-card .section-heading { text-align: left; margin: 6px 0 4px; }
.privacy-updated { font-size: 13px; color: var(--ink-muted); margin-bottom: 8px; }
.privacy-card h2 { font-size: 18px; font-weight: 700; margin: 26px 0 8px; color: var(--ink); }
.privacy-card p, .privacy-card li { line-height: 1.6; color: var(--ink-muted); }
.privacy-card ul { padding-left: 20px; display: grid; gap: 6px; }
.privacy-card strong { color: var(--ink); }
.privacy-card a { color: var(--teal); }
.privacy-page main { align-items: flex-start; }
.privacy-card ul + p { margin-top: 14px; }
/* Dashboard "Your badge": show the chosen style at its real size (card badges are ~120px tall) */
.peek-badge-wrap img { max-height: 140px; max-width: 100%; height: auto; width: auto; }

/* Badges Studio: where a badge click goes */
.public-page-link { display: flex; flex-direction: column; gap: 2px; margin: 12px 0 4px; padding: 12px 16px; border-radius: var(--radius-md);
  background: var(--surface); box-shadow: var(--neu-inset); color: var(--ink-muted); text-decoration: none; font-size: 14px; }
.public-page-link strong { color: var(--teal); font-weight: 600; overflow-wrap: anywhere; }
.public-page-link:hover strong { text-decoration: underline; }
/* Badges Studio code boxes: label above, plain rectangular box, full width */
.embed-code-section .input-box { display: block; padding: 0; background: transparent; box-shadow: none; border-radius: 0; outline: none; min-height: 0; }
.embed-code-section .input-box:focus-within { outline: none; }
.embed-code-section label { display: block; font-size: 14px; font-weight: 600; color: var(--ink); margin: 0 0 8px; }
.embed-code-section textarea.badge-code { display: block; width: 100%; min-height: 92px; padding: 12px 14px; border-radius: var(--radius-md); box-shadow: var(--neu-inset);
  font-size: 13px; line-height: 1.45; word-break: break-all; resize: vertical; }
.embed-code-section .btn { margin-top: 10px; }
