/* ════════════════════════════════════════════════════════════════════
   ReplyFlow — Liquid Glass design system
   The one shipped stylesheet for tokens and shared primitives. Every page
   in public/ links this file; design-system/tokens.css imports it, so there
   is a single source of truth. Page-specific layout stays inline per page.

   The idea
   ────────
   A still field of light sits behind everything: gold where the review is
   (a customer's stars) and green where the reply is (yours). Interface is
   glass laid over that field — translucent, hairline-edged, with one fine
   specular line along the top edge. Sharp, not soft: small radii, 1px
   edges, tight type.

   Two kinds of surface, and the difference matters for speed:
     glass  real backdrop blur. Only for things content scrolls BEHIND:
            header, sidebar, topbar, modals, toasts, the hero demo.
     pane   tinted, no blur. Every content card. Over a smooth field a
            blur is indistinguishable from no blur, and a list of forty
            backdrop-filtered cards is not.

   Contrast rules that must survive any edit
     --accent        brand green. Fills, dots, graphics. Never body text.
     --accent-ink    the only green safe for text (≥ 4.5:1 on panes).
     --accent-strong button fill; --on-accent is the only text colour on it.
     --ink-faint     placeholders and decoration only — below 4.5:1.
   ════════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;

  /* ── The field ─────────────────────────────────────────────────── */
  --field: #EDF3F0;
  --bloom-reply:  15 164 127;   /* green — your reply */
  --bloom-review: 236 176 48;   /* gold — their stars */
  --bloom-depth:  64 156 214;   /* cool, for depth */
  --bloom-reply-a: .30;
  --bloom-review-a: .24;
  --bloom-depth-a: .17;

  /* ── Surfaces ──────────────────────────────────────────────────── */
  --glass-rgb: 255 255 255;  --glass-a: .56;    /* blurred chrome */
  --glass-hi-a: .80;                             /* modals, menus, toasts */
  --pane-rgb: 255 255 255;   --pane-a: .62;     /* content cards */
  --pane-hover-a: .78;
  --well: rgb(11 24 18 / .045);                  /* recessed fills: avatars, quiet buttons */
  --well-hover: rgb(11 24 18 / .085);
  --input: rgb(255 255 255 / .72);
  --scrim: rgb(9 20 15 / .38);

  --edge: rgb(11 24 18 / .09);                   /* hairline */
  --edge-strong: rgb(11 24 18 / .17);            /* inputs, toggles off */
  --spec: rgb(255 255 255 / .95);                /* specular top edge */
  --spec-soft: rgb(255 255 255 / .45);

  --blur: 22px;
  --glass-filter: blur(var(--blur)) saturate(170%);

  --glass-bg: rgb(var(--glass-rgb) / var(--glass-a));
  --glass-hi-bg: rgb(var(--glass-rgb) / var(--glass-hi-a));
  --pane-bg: rgb(var(--pane-rgb) / var(--pane-a));
  --pane-hover-bg: rgb(var(--pane-rgb) / var(--pane-hover-a));

  --shadow-rest:  inset 0 1px 0 var(--spec), 0 1px 2px rgb(9 28 21 / .05), 0 10px 26px -18px rgb(9 28 21 / .28);
  --shadow-float: inset 0 1px 0 var(--spec), 0 1px 2px rgb(9 28 21 / .06), 0 22px 48px -24px rgb(9 28 21 / .38);
  --shadow-knob:  0 1px 2px rgb(9 28 21 / .28), 0 0 0 .5px rgb(9 28 21 / .06);

  /* ── Ink ───────────────────────────────────────────────────────── */
  --ink: #0B1511;
  --ink-mid: #36433D;
  --ink-light: #4F5C56;
  --ink-faint: #8B9690;

  /* ── Accent ────────────────────────────────────────────────────── */
  --accent: #0FA47F;
  --accent-ink: #07624E;
  --accent-hi: #0A8366;        /* top of the button gradient */
  --accent-strong: #07705A;    /* bottom of it, and the hover fill */
  --on-accent: #FFFFFF;
  --accent-wash: rgb(15 164 127 / .12);
  --accent-wash-2: rgb(15 164 127 / .2);
  --accent-edge: rgb(15 164 127 / .32);
  --accent-glow: rgb(15 164 127 / .5);

  /* ── Semantic ──────────────────────────────────────────────────────
     Still no red on the web. A problem is carried by copy on amber.   */
  --star: #D9981A;
  --warn-wash: rgb(233 168 32 / .17);
  --warn-edge: rgb(190 132 12 / .3);
  --warn-ink: #73540A;

  /* ── Type ──────────────────────────────────────────────────────────
     Instrument Sans for everything that is interface or ours.
     Newsreader for a customer's words, and nothing else.             */
  --sans:  'Instrument Sans', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --serif: 'Newsreader', 'New York', ui-serif, Georgia, serif;

  /* ── Radii — concentric, and small on purpose ─────────────────────── */
  --r-xs: 6px;     /* tags, badges */
  --r-sm: 9px;     /* inputs, small buttons, nav rows */
  --r-md: 12px;    /* buttons, nested panes */
  --r-lg: 18px;    /* cards */
  --r-xl: 24px;    /* hero glass, modals, bands */
  --r-pill: 999px; /* toggles and dots only */

  /* ── Motion ────────────────────────────────────────────────────────
     Motion answers a person. Nothing enters on scroll.               */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --t: .16s var(--ease);

  /* ── Names the page scripts already use ────────────────────────────
     dashboard.html writes these into inline styles from JS. Keep them. */
  --accent-dark: var(--accent-ink);
  --accent-darker: var(--accent-strong);
  --accent-pale: var(--accent-wash);
  --accent-pale-2: var(--accent-wash-2);
  --surface: var(--pane-bg);
  --app-bg: var(--well);
  --fill: var(--well);
  --fill-hover: var(--well-hover);
  --line: var(--edge);
  --line-strong: var(--edge-strong);
  --warn-pale: var(--warn-wash);
  --display: var(--sans);
  --body: var(--sans);
}

/* ── Dark ──────────────────────────────────────────────────────────────
   Not an inverted light theme: the field goes to deep green-black, glass
   becomes smoked rather than frosted, and the button flips to mint with
   dark ink so it keeps its contrast. Light is the default; the OS
   preference applies unless the visitor chose explicitly (data-theme). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --field: #060D0A;
    --bloom-reply: 20 190 146;   --bloom-reply-a: .30;
    --bloom-review: 222 164 52;  --bloom-review-a: .13;
    --bloom-depth: 40 120 190;   --bloom-depth-a: .20;

    --glass-rgb: 20 31 27;  --glass-a: .58;  --glass-hi-a: .84;
    --pane-rgb: 40 56 49;   --pane-a: .44;   --pane-hover-a: .6;
    --well: rgb(255 255 255 / .06);
    --well-hover: rgb(255 255 255 / .11);
    --input: rgb(0 0 0 / .26);
    --scrim: rgb(0 0 0 / .55);

    --edge: rgb(255 255 255 / .09);
    --edge-strong: rgb(255 255 255 / .2);
    --spec: rgb(255 255 255 / .16);
    --spec-soft: rgb(255 255 255 / .06);

    --shadow-rest:  inset 0 1px 0 var(--spec), 0 10px 26px -18px rgb(0 0 0 / .7);
    --shadow-float: inset 0 1px 0 var(--spec), 0 24px 54px -22px rgb(0 0 0 / .8);
    --shadow-knob:  0 1px 2px rgb(0 0 0 / .5);

    --ink: #EEF5F1;
    --ink-mid: #B7C5BE;
    --ink-light: #9AA8A1;
    --ink-faint: #6C7973;

    --accent: #2FD3A6;
    --accent-ink: #6BE6C2;
    --accent-hi: #55E6BD;
    --accent-strong: #2CCDA1;
    --on-accent: #03241B;
    --accent-wash: rgb(47 211 166 / .13);
    --accent-wash-2: rgb(47 211 166 / .22);
    --accent-edge: rgb(47 211 166 / .34);
    --accent-glow: rgb(47 211 166 / .4);

    --star: #F2BE4A;
    --warn-wash: rgb(242 190 74 / .13);
    --warn-edge: rgb(242 190 74 / .3);
    --warn-ink: #F1CF85;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --field: #060D0A;
  --bloom-reply: 20 190 146;   --bloom-reply-a: .30;
  --bloom-review: 222 164 52;  --bloom-review-a: .13;
  --bloom-depth: 40 120 190;   --bloom-depth-a: .20;

  --glass-rgb: 20 31 27;  --glass-a: .58;  --glass-hi-a: .84;
  --pane-rgb: 40 56 49;   --pane-a: .44;   --pane-hover-a: .6;
  --well: rgb(255 255 255 / .06);
  --well-hover: rgb(255 255 255 / .11);
  --input: rgb(0 0 0 / .26);
  --scrim: rgb(0 0 0 / .55);

  --edge: rgb(255 255 255 / .09);
  --edge-strong: rgb(255 255 255 / .2);
  --spec: rgb(255 255 255 / .16);
  --spec-soft: rgb(255 255 255 / .06);

  --shadow-rest:  inset 0 1px 0 var(--spec), 0 10px 26px -18px rgb(0 0 0 / .7);
  --shadow-float: inset 0 1px 0 var(--spec), 0 24px 54px -22px rgb(0 0 0 / .8);
  --shadow-knob:  0 1px 2px rgb(0 0 0 / .5);

  --ink: #EEF5F1;
  --ink-mid: #B7C5BE;
  --ink-light: #9AA8A1;
  --ink-faint: #6C7973;

  --accent: #2FD3A6;
  --accent-ink: #6BE6C2;
  --accent-hi: #55E6BD;
  --accent-strong: #2CCDA1;
  --on-accent: #03241B;
  --accent-wash: rgb(47 211 166 / .13);
  --accent-wash-2: rgb(47 211 166 / .22);
  --accent-edge: rgb(47 211 166 / .34);
  --accent-glow: rgb(47 211 166 / .4);

  --star: #F2BE4A;
  --warn-wash: rgb(242 190 74 / .13);
  --warn-edge: rgb(242 190 74 / .3);
  --warn-ink: #F1CF85;
}

/* ── Solid fallbacks ───────────────────────────────────────────────────
   No backdrop-filter, or the visitor asked for less transparency: every
   surface goes opaque and the blur is dropped. Text contrast is then
   measured against a flat colour instead of whatever is behind the glass. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --glass-a: .97 !important; --glass-hi-a: 1 !important; --pane-a: .94 !important; --pane-hover-a: 1 !important; }
}
@media (prefers-reduced-transparency: reduce) {
  :root {
    --glass-a: 1 !important; --glass-hi-a: 1 !important;
    --pane-a: 1 !important; --pane-hover-a: 1 !important;
    --glass-filter: none !important;
    --bloom-reply-a: .1 !important; --bloom-review-a: .06 !important; --bloom-depth-a: .05 !important;
  }
}
@media (prefers-contrast: more) {
  :root {
    --glass-a: 1 !important; --glass-hi-a: 1 !important; --pane-a: 1 !important; --pane-hover-a: 1 !important;
    --edge: var(--edge-strong) !important;
    --ink-light: var(--ink-mid) !important;
  }
}

/* ══ Base ══════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--field);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.55;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
/* The field. Fixed, so glass moves over still light. Static: no animation,
   nothing to repaint on scroll. */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(62vmax 44vmax at 4% -8%,   rgb(var(--bloom-reply) / var(--bloom-reply-a)), transparent 64%),
    radial-gradient(50vmax 38vmax at 98% 2%,   rgb(var(--bloom-review) / var(--bloom-review-a)), transparent 62%),
    radial-gradient(72vmax 48vmax at 62% 110%, rgb(var(--bloom-depth) / var(--bloom-depth-a)), transparent 64%),
    var(--field);
}
::selection { background: var(--accent-wash-2); color: var(--ink); }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { color: var(--ink); }
input, textarea, select, button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
summary::-webkit-details-marker { display: none; }

.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;
}

/* ══ Surfaces ══════════════════════════════════════════════════════════ */
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
  border: 1px solid var(--edge);
  box-shadow: var(--shadow-float);
}
.pane {
  background: var(--pane-bg);
  border: 1px solid var(--edge);
  box-shadow: var(--shadow-rest);
}
/* A specular rim that catches light at the top-left and bottom-right
   corners. For the few surfaces that are meant to be looked at. */
.rim { position: relative; }
.rim::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(138deg, var(--spec) 0%, transparent 30%, transparent 66%, var(--spec-soft) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}

/* ══ Brand ═════════════════════════════════════════════════════════════ */
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); }
.brand svg { width: 26px; height: 26px; display: block; flex-shrink: 0; }
.brand svg g { fill: var(--accent); }
.brand span { font-size: 17px; font-weight: 650; letter-spacing: -.03em; color: var(--ink); }

/* ══ Buttons ═══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 15px; border: 1px solid transparent; border-radius: var(--r-md);
  font-family: var(--sans); font-size: 14px; font-weight: 600; line-height: 1.25; letter-spacing: -.005em;
  white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background var(--t), border-color var(--t), box-shadow var(--t), color var(--t), transform var(--t);
}
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Primary. A lit green key: gradient fill, specular top, coloured shadow. */
.btn-accent, .btn-dark, .btn-gold {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent-strong));
  color: var(--on-accent); border-color: rgb(0 0 0 / .1);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .34), 0 1px 2px rgb(4 40 30 / .3), 0 8px 18px -10px var(--accent-glow);
}
.btn-accent:hover:not(:disabled), .btn-dark:hover:not(:disabled), .btn-gold:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--accent-strong), var(--accent-strong)); color: var(--on-accent);
}
/* Secondary. A small pane of glass. */
.btn-grey, .btn-quiet, .btn-outline, .btn-google {
  background: var(--pane-bg); color: var(--ink); border-color: var(--edge-strong);
  box-shadow: inset 0 1px 0 var(--spec), 0 1px 2px rgb(9 28 21 / .05);
}
.btn-grey:hover:not(:disabled), .btn-quiet:hover:not(:disabled),
.btn-outline:hover:not(:disabled), .btn-google:hover:not(:disabled) { background: var(--pane-hover-bg); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-mid); }
.btn-ghost:hover:not(:disabled) { background: var(--well-hover); color: var(--ink); }
.btn-xs { padding: 6px 11px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-lg { padding: 13px 22px; font-size: 15.5px; border-radius: 14px; }

/* ══ Theme toggle ══════════════════════════════════════════════════════ */
.rf-theme-toggle {
  width: 36px; height: 36px; padding: 0; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--pane-bg); color: var(--ink-mid);
  border: 1px solid var(--edge-strong); border-radius: var(--r-sm);
  box-shadow: inset 0 1px 0 var(--spec);
  cursor: pointer; line-height: 0;
  transition: color var(--t), background var(--t);
}
.rf-theme-toggle:hover { color: var(--ink); background: var(--pane-hover-bg); }
.rf-theme-toggle .rf-sun { display: none; }
:root[data-theme="dark"] .rf-theme-toggle .rf-sun { display: block; }
:root[data-theme="dark"] .rf-theme-toggle .rf-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .rf-theme-toggle .rf-sun  { display: block; }
  :root:not([data-theme="light"]) .rf-theme-toggle .rf-moon { display: none; }
}

/* ══ Small shared parts ════════════════════════════════════════════════ */
.dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--accent-wash-2);
  animation: rf-pulse 1.8s ease-in-out infinite;
}
.stars { color: var(--star); letter-spacing: 1.5px; white-space: nowrap; }
/* A customer's words are the only thing set in the serif. */
.quote { font-family: var(--serif); font-optical-sizing: auto; }

@keyframes rf-pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: .4;  transform: scale(.8); }
}
@keyframes rf-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* ══ Document pages — /privacy, /terms, /support ═══════════════════════
   One sheet of glass, set for reading. The three pages share this block
   so their markup stays exactly as legal reviewed it.                   */
.doc-top {
  position: sticky; top: 12px; z-index: 20;
  max-width: 820px; margin: 12px auto 0; padding: 9px 10px 9px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-radius: var(--r-lg);
}
.doc-top nav { display: flex; align-items: center; gap: 4px; }
.doc-top nav a { font-size: 13.5px; font-weight: 500; color: var(--ink-mid); padding: 7px 10px; border-radius: var(--r-sm); transition: background var(--t), color var(--t); }
.doc-top nav a:hover, .doc-top nav a[aria-current="page"] { color: var(--ink); background: var(--well); }
.doc-wrap { padding: 28px 16px 64px; }
.legal-inner {
  max-width: 820px; margin: 0 auto; padding: 44px 56px 36px;
  background: var(--pane-bg); border: 1px solid var(--edge); border-radius: var(--r-xl);
  box-shadow: var(--shadow-rest);
}
.legal-head { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: 10px; }
.legal-back { font-size: 13.5px; font-weight: 500; color: var(--ink-light); }
.legal-back:hover { color: var(--ink); }
.legal-inner h1 { font-size: clamp(30px, 4.4vw, 40px); font-weight: 650; letter-spacing: -.035em; line-height: 1.08; margin: 0; }
.legal-date { font-size: 13px; color: var(--ink-light); margin: 0 0 30px; }
.legal-inner h2 { font-size: 18px; font-weight: 650; letter-spacing: -.02em; line-height: 1.3; margin: 34px 0 10px; }
.legal-inner h3 { font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; margin: 22px 0 6px; }
.legal-inner p, .legal-inner li { font-size: 15.5px; color: var(--ink-mid); line-height: 1.7; max-width: 72ch; }
.legal-inner p { margin: 0 0 12px; }
.legal-inner ul, .legal-inner ol { margin: 0 0 12px; padding-left: 20px; }
.legal-inner li { margin-bottom: 6px; }
.legal-inner strong { color: var(--ink); font-weight: 600; }
.legal-inner a { color: var(--accent-ink); text-decoration: underline; text-decoration-color: var(--accent-edge); text-underline-offset: 3px; }
.legal-inner a:hover { color: var(--ink); }
.legal-inner a.legal-back { color: var(--ink-light); text-decoration: none; }
.legal-inner a.legal-back:hover { color: var(--ink); }
.legal-inner code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .88em;
  background: var(--well); border: 1px solid var(--edge); border-radius: 5px; padding: 1px 5px;
}
.callout {
  background: var(--accent-wash); border: 1px solid var(--accent-edge);
  border-radius: var(--r-md); padding: 16px 18px; margin: 16px 0 12px;
  box-shadow: inset 0 1px 0 var(--spec-soft);
}
.callout p { color: var(--ink); }
.callout p:last-child { margin-bottom: 0; }
.legal-inner footer {
  margin-top: 44px; padding-top: 20px; border-top: 1px solid var(--edge);
  font-size: 13px; color: var(--ink-faint);
}
.legal-inner footer a { color: var(--ink-light); text-decoration: none; }
.legal-inner footer a:hover { color: var(--ink); }
@media (max-width: 640px) {
  .doc-top { margin: 8px 8px 0; top: 8px; }
  .doc-top nav a.doc-hide { display: none; }
  .doc-wrap { padding: 16px 8px 40px; }
  .legal-inner { padding: 28px 22px 26px; border-radius: var(--r-lg); }
}
@media print {
  body::before, .doc-top { display: none; }
  .legal-inner { background: #fff; border: 0; box-shadow: none; padding: 0; }
}

/* ══ Motion preferences ════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
