/**
 * Graici design system
 *
 * Layered on purpose:
 *   1. Tokens               — brand values, plus the legacy --graici-* aliases
 *   2. DaisyUI "graici"     — an opt-in theme, applied with data-theme="graici"
 *   3. Shared helpers       — the .graici-* classes used across the app
 *   4. Component layer      — .g-* primitives, authored MOBILE FIRST
 *   5. Scoped DaisyUI map   — makes stock .card/.input/.btn/.modal match the
 *                             component layer inside data-theme="graici" only
 *
 * MOBILE FIRST: base rules are the phone. Only min-width queries relax the
 * layout upward. Do not add max-width queries to this file.
 *
 * The theme is opt-in so a redesign lands page by page: a template sets
 * {% block body_data %} data-theme="graici"{% endblock %} and everything under
 * it picks up both the palette and the DaisyUI mapping. Pages that have not
 * opted in still render on data-theme="light" exactly as before.
 */

/* ============================================================
   1. Tokens
   ============================================================ */
:root {
  /* Brand Colors */
  --graici-text: #232C27;
  --graici-primary: #2F4858;
  --graici-secondary: #497D7E;
  --graici-white: #FFFFFF;
  --graici-border: #DCDCDC;
  --graici-gold: #A4872E;

  /* Background Colors */
  --graici-page-bg: #EDF2EC;
  --graici-light-bg: #F8F9F9;
  --graici-field-bg: #FFFCF8;
  --graici-card-bg: var(--graici-white);

  /* Chat surfaces */
  --graici-chat-canvas: #F0F4F2;
  --graici-chat-chrome: #FFFFFF;
  --graici-chat-hover: #DCE8E3;
  --graici-chat-border: #BCCDC5;
  --graici-chat-message-bubble: #3D6B6C;

  /* Text Colors */
  --graici-secondary-text: #6B7280;
  --graici-placeholder: #9CA3AF;

  /* Controls */
  --graici-control-bg: var(--graici-white);
  --graici-control-text: var(--graici-text);
  --graici-control-muted: var(--graici-secondary-text);
  --graici-control-border: var(--graici-border);

  /* Hover States */
  --graici-secondary-hover: #3D6B6C;

  /* Typography */
  --main-fontFamily-primary: 'Jost', sans-serif;

  /* --- design-system scale (new) --- */
  --g-ink: #232C27;
  --g-ink-2: #4A554D;
  /* Every tint in the flow is a background for this colour, so it is picked
     against the WORST of them, not against white. #68736B cleared AA on white
     (4.94:1) but fell to 4.37:1 on --g-teal-050, which is the selected state
     of .g-radiocard and .g-choice, and 4.42:1 on --g-idle-050 under .g-source
     and .g-pill--idle. #606B62 is 4.93:1 on the worst of them and 5.56:1 on
     white, so secondary text passes AA wherever it lands. */
  --g-ink-3: #606B62;
  --g-primary: #2F4858;
  --g-primary-600: #253A47;
  --g-teal: #497D7E;
  --g-teal-600: #3D6B6C;
  --g-teal-050: #EAF3F2;
  --g-gold: #A4872E;
  --g-canvas: #F4F7F3;
  --g-surface: #FFFFFF;
  --g-field: #FFFCF8;
  --g-line: #E4E8E3;
  --g-line-strong: #CBD3CB;
  --g-ok: #2F7D5B;
  /* --g-ok is a fill (the meter, the done segments) and only has to clear
     3:1. As a text colour on its own tint it is 4.42:1, so labels use the
     darker step: 5.78:1 on --g-ok-050. */
  --g-ok-700: #28694D;
  --g-ok-050: #E8F4EE;
  --g-warn: #8C6212;
  --g-warn-050: #FBF3E3;
  --g-danger: #B0413E;
  --g-idle: #606B62;
  --g-idle-050: #F1F3F0;

  --g-r: 12px;
  --g-r-lg: 16px;
  --g-sh-1: 0 1px 2px rgba(35, 44, 39, .05), 0 1px 3px rgba(35, 44, 39, .04);
  --g-sh-up: 0 -8px 28px -8px rgba(35, 44, 39, .18);
  --g-focus: 0 0 0 3px rgba(73, 125, 126, .26);

  /* Mobile-first sizing. --g-tap is the minimum size of anything tappable. */
  --g-tap: 52px;
  --g-gut: 16px;
  --g-bar-h: 56px;
  --g-safe-b: env(safe-area-inset-bottom, 0px);

  /* Page width, app-wide. The wallet, shop, support, financial, healthcare
     and terms pages all read this through .app-container, and the coach theme
     hard-codes the same 500px, so the renewal flow has to honour it too: the
     Summary links straight out to Financial and Healthcare connect, and a
     600px step page either side of a 500px connect page shows as the content
     column jumping wider and back. Phones are unaffected either way, since
     .app-container is width: 100% and only this cap can bind. */
  --app-max-width: 500px;
}

/* ============================================================
   2. DaisyUI "graici" theme

   DaisyUI 5 consumes complete CSS colors instead of v4's bare OKLCH
   components. Keeping the source colors explicit makes the theme usable by
   both DaisyUI's components and its color utilities.

   Source hex is in the comment beside each value. Regenerate with the
   sRGB -> OKLCH conversion if the brand palette changes.
   ============================================================ */
[data-theme="graici"] {
  --color-primary: oklch(38.83% 0.041 237.32);        /* #2F4858 primary */
  --color-primary-content: oklch(100% 0 0);           /* white */
  --color-secondary: oklch(55.39% 0.056 197.25);      /* #497D7E secondary */
  --color-secondary-content: oklch(100% 0 0);
  --color-accent: oklch(63.40% 0.111 90.45);          /* #A4872E accent */
  --color-accent-content: oklch(100% 0 0);
  --color-neutral: oklch(28.27% 0.015 160.93);        /* #232C27 neutral */
  --color-neutral-content: oklch(100% 0 0);
  --color-base-100: oklch(100% 0 0);                  /* #FFFFFF surface */
  --color-base-200: oklch(97.57% 0.006 137.77);       /* #F5F8F4 raised */
  --color-base-300: oklch(94.47% 0.008 139.44);       /* #EAEEE9 sunken */
  --color-base-content: oklch(28.27% 0.015 160.93);   /* #232C27 base content */
  --color-success: oklch(53.18% 0.094 161.68);        /* #2F7D5B success */
  --color-success-content: oklch(100% 0 0);
  --color-warning: oklch(52.73% 0.104 77.36);         /* #8C6212 warning */
  --color-warning-content: oklch(100% 0 0);
  --color-error: oklch(52.85% 0.146 24.97);           /* #B0413E error */
  --color-error-content: oklch(100% 0 0);
  --radius-box: 16px;
  --radius-field: 12px;
  --radius-selector: 999px;
  --border: 1px;
  --depth: 0;
  --noise: 0;

  /* the theme brings its own canvas, gutters and reading width */
  --graici-border: var(--g-line);
  --graici-page-bg: var(--g-canvas);
  --graici-secondary-text: var(--g-ink-3);
  /* 4.58:1 on the white field. #A7B0A8 was 2.23:1; the SSN and phone fields
     carry real format hints ("XXX-XX-XXXX"), so this is content, not decoration.
     Hierarchy against a typed value still holds: --g-ink is 13.9:1. */
  --graici-placeholder: #6E7870;

  background-color: var(--g-canvas);
  color: var(--g-ink);
  /* The theme only defines light surfaces. Without this, a phone in dark
     mode renders native UI dark against them: the <select> popup, the date
     picker and form autofill all come out dark-on-light. */
  color-scheme: light;
}

/* Only the gutter grows with the viewport. The width is --app-max-width and
   is deliberately not widened here; see the token. */
@media (min-width: 640px) {
  [data-theme="graici"] { --g-gut: 24px; }

  /* Profile is intentionally a phone-shaped workflow even when it is opened
     on a wide browser. A narrower rail keeps questions, choices and actions
     in the same visual relationship people learn on mobile. Home shares the
     rail so moving between Home and Summary keeps one column width. */
  [data-theme="graici"].profile-body,
  [data-theme="graici"].home-body {
    --app-max-width: 430px;
    --g-gut: 18px;
  }
}

/* ============================================================
   3. Shared helpers (unchanged behaviour, used across the app)
   ============================================================ */
html {
  font-family: var(--main-fontFamily-primary, 'Jost', sans-serif);
}

body {
  font-family: var(--main-fontFamily-primary, 'Jost', sans-serif);
  font-size: 16px;
  font-weight: 400;
  line-height: 28px;
}

/* Native controls do not inherit typography consistently across browsers.
   Keep every piece of the main app on the same Jost foundation as its page. */
button,
input,
optgroup,
select,
textarea {
  font-family: inherit;
}

.graici-page-surface { background-color: var(--graici-page-bg) !important; }
.graici-card-surface { background-color: var(--graici-card-bg) !important; }
.graici-light-surface { background-color: var(--graici-light-bg) !important; }
.graici-border-color { border-color: var(--graici-border) !important; }

.graici-secondary-button {
  background-color: var(--graici-secondary) !important;
  border-color: var(--graici-secondary) !important;
  color: var(--graici-white) !important;
}

.graici-secondary-button:hover:not(:disabled) {
  background-color: var(--graici-secondary-hover) !important;
  border-color: var(--graici-secondary-hover) !important;
}

.graici-auth-button {
  background: var(--graici-secondary) !important;
  background-color: var(--graici-secondary) !important;
  border-color: var(--graici-secondary) !important;
  color: var(--graici-white) !important;
}

.graici-auth-button:hover:not(:disabled) {
  background: var(--graici-secondary-hover) !important;
  background-color: var(--graici-secondary-hover) !important;
  border-color: var(--graici-secondary-hover) !important;
}

.graici-auth-link { color: var(--graici-secondary) !important; }

.graici-place-autocomplete {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: var(--g-tap);
  box-sizing: border-box;
  padding: 0;
  background-color: var(--graici-white) !important;
  border: 1.5px solid var(--g-line-strong);
  border-radius: var(--g-r);
  color: var(--graici-text) !important;
  color-scheme: light !important;
  font-family: var(--main-fontFamily-primary, 'Jost', sans-serif);
  font-size: 16px;
  line-height: 1.4;
  -webkit-text-fill-color: var(--graici-text) !important;
}

.graici-place-autocomplete:focus-within {
  border-color: var(--g-teal);
  box-shadow: var(--g-focus);
}

.graici-place-autocomplete::part(input) {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background-color: transparent !important;
  color: var(--graici-text) !important;
  font-family: inherit;
  -webkit-text-fill-color: var(--graici-text) !important;
  caret-color: var(--graici-text) !important;
}

.graici-place-autocomplete::part(prediction-list) {
  width: 100%;
  max-width: 100%;
  max-height: min(18rem, 45vh);
  box-sizing: border-box;
  overflow-y: auto;
  background-color: var(--graici-white) !important;
  border: 1.5px solid var(--g-line-strong);
  border-radius: var(--g-r);
  color: var(--graici-text) !important;
  box-shadow: 0 12px 28px rgb(32 48 41 / 16%);
}

.graici-place-autocomplete-field {
  position: relative;
}

.graici-place-predictions {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  z-index: 60;
  max-height: min(18rem, 45vh);
  overflow-y: auto;
  background: var(--graici-white);
  border: 1.5px solid var(--g-line-strong);
  border-radius: var(--g-r);
  box-shadow: 0 12px 28px rgb(32 48 41 / 16%);
}

.graici-place-prediction {
  display: block;
  width: 100%;
  min-height: var(--g-tap);
  padding: 10px 14px;
  color: var(--graici-text);
  font: inherit;
  line-height: 1.35;
  text-align: left;
  background: var(--graici-white);
  border: 0;
  border-top: 1px solid var(--g-line);
}

.graici-place-prediction:first-child {
  border-top: 0;
}

.graici-place-prediction:hover,
.graici-place-prediction:focus-visible {
  background: var(--graici-field-bg);
  outline: none;
}

.graici-place-autocomplete::part(prediction-item) {
  color: var(--graici-secondary-text) !important;
  font-family: inherit;
}

.graici-place-autocomplete::part(prediction-item-main-text),
.graici-place-autocomplete::part(prediction-item-match) {
  color: var(--graici-text) !important;
}

.graici-place-autocomplete::part(prediction-item-selected) {
  background-color: var(--graici-field-bg) !important;
  color: var(--graici-text) !important;
}

/* The transcript messages use DaisyUI's chat component. */
.workspace-chat-transcript {
  background: var(--graici-chat-canvas);
  scrollbar-color: var(--graici-chat-border) transparent;
}

.workspace-chat-composer {
  border-color: var(--graici-chat-border);
  border-radius: 1.5rem;
  background: var(--graici-chat-chrome);
  box-shadow: 0 1px 2px rgb(47 72 88 / 8%);
}

.workspace-dictation-toggle[data-state="recording"] {
  background: #fef2f2;
  color: #b91c1c;
  box-shadow: inset 0 0 0 1px #fecaca;
}

.workspace-dictation-toggle[data-state="transcribing"] {
  background: var(--graici-light-bg);
  cursor: wait;
}

/* App container. Width now comes from a token so a theme can widen it. */
.app-container {
  max-width: var(--app-max-width);
  margin: 0 auto;
  width: 100%;
}

/* ============================================================
   4. Component layer — .g-* primitives, authored mobile first
   ============================================================ */

/* --- page scaffold -------------------------------------------------
   .g-page grows into whatever height <main> has left (see the flex chain
   on <main> below) and its .g-actions bar takes the slack, which anchors
   the bar to the bottom of the viewport.

   That anchoring is not only cosmetic: the Ask Graici launcher is fixed
   to the bottom-right corner, so a bar left floating mid-page on short
   content ends up underneath it. Deriving the height from the flex chain
   rather than subtracting the topbar and step header by hand also keeps
   the bar flush when those change height (longer translations, larger
   text settings). */
.g-page {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding-inline: var(--g-gut);
  padding-top: 20px;
  line-height: 1.5;
}
.g-page > .g-actions { margin-top: auto; }

.g-page h1, .g-page h2, .g-page h3, .g-page legend { line-height: 1.3; }

.g-title { font-size: 22px; font-weight: 600; }
.g-lede { margin-top: 6px; font-size: 15px; color: var(--g-ink-3); }
.g-intro { display: flex; align-items: flex-start; gap: 12px; }
.g-intro .g-intro__mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--g-primary);
  color: var(--g-surface);
}
.g-question > .g-intro { font-weight: 600; }
.profile-question > .g-intro__aside { padding-left: 46px; font-size: 15px; color: var(--g-teal-600); }
.g-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--g-ink-3);
}

/* --- step header: segments, never a scrolling chip row ------------ */
.g-stephead {
  position: sticky;
  top: var(--g-bar-h);
  z-index: 30;
  padding: 10px var(--g-gut) 12px;
  background: rgba(244, 247, 243, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--g-line);
}
.g-stephead__row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.g-stephead__now { font-size: 15px; font-weight: 600; }
.g-stephead__count { font-size: 13px; font-weight: 500; color: var(--g-ink-3); font-variant-numeric: tabular-nums; }
.g-segs { display: flex; gap: 5px; margin-top: 10px; }
.g-segs > a, .g-segs > button, .g-segs > span {
  flex: 1 1 0;
  height: 4px;
  border-radius: 999px;
  background: var(--g-line-strong);
  transition: background 300ms;
}
.g-segs > button {
  padding: 0;
  border: 0;
  appearance: none;
  cursor: pointer;
}
/* the tap target is taller than the 4px it paints */
.g-segs > a, .g-segs > button { position: relative; }
.g-segs > a::after, .g-segs > button::after { content: ""; position: absolute; inset: -14px 0; }
.g-segs > a:focus-visible, .g-segs > button:focus-visible { outline: none; box-shadow: var(--g-focus); }
.g-segs .is-done { background: var(--g-ok); }
.g-segs .is-current { background: var(--g-teal); }

/* --- section block -------------------------------------------------
   On a phone a section bleeds to the screen edges: a card inside a
   card wastes 32px of a 390px viewport. It becomes a real card at
   640px, where there is room for one. */
.g-sect {
  background: var(--g-surface);
  border-top: 1px solid var(--g-line);
  border-bottom: 1px solid var(--g-line);
  padding: 20px var(--g-gut);
  margin-inline: calc(var(--g-gut) * -1);
}
.g-sect + .g-sect { border-top: 0; }
.g-sect__h { font-size: 17px; font-weight: 600; }

/* The question itself, not a label about it. It was rendering at 14px in the
   muted colour in the Income & Employment steps, which read as helper text
   next to the answer buttons rather than as the thing being asked. */
.g-question {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--g-ink);
}
.g-question + .g-choice,
.g-question + .g-help + .g-choice { margin-top: 14px; }
.profile-question > .g-note,
.profile-question > .g-note + .g-choice { margin-top: 14px; }
.profile-radio-input__label { color: var(--graici-text); }
.g-sect__p { margin-top: 4px; font-size: 14.5px; color: var(--g-ink-3); }

/* --- tax filer ----------------------------------------------------
   The final household step can contain several people. Each filer owns one
   bordered panel so the name stays attached to their answers while the
   questions retain the same shared controls as the rest of the flow. */
.g-tax-filer-form { gap: 16px; }
.g-tax-filer {
  overflow: hidden;
  background: var(--g-surface);
  border: 1px solid var(--g-line);
  border-radius: var(--g-r-lg);
  box-shadow: var(--g-sh-1);
}
.g-tax-filer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: var(--g-idle-050);
  border-bottom: 1px solid var(--g-line);
}
.g-tax-filer__title {
  min-width: 0;
  font-size: 21px;
  font-weight: 600;
  color: var(--g-ink);
  overflow-wrap: anywhere;
}
.g-tax-filer__tag {
  flex: none;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--g-teal-050);
  color: var(--g-teal-600);
  font-size: 13px;
  font-weight: 600;
}
.g-tax-filer__body {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 20px 18px;
}
.g-tax-filer [data-tax-filer-followups] {
  padding-top: 24px;
  border-top: 1px solid var(--g-line);
}
.g-tax-filer__detail {
  padding: 14px;
  border-radius: var(--g-r);
  background: var(--g-idle-050);
  color: var(--g-ink);
}

@media (min-width: 640px) {
  .g-tax-filer__header { padding: 18px 22px; }
  .g-tax-filer__body { padding: 24px 22px; }
}

/* A nested block must not bleed again: two levels of the negative inline
   margin push the content a full gutter off the left of the screen. The inner
   one becomes a plain group and lets the outer block own the edges. */
.g-sect .g-sect {
  margin-inline: 0;
  padding-inline: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

@media (min-width: 640px) {
  .g-sect {
    margin-inline: 0;
    border: 1px solid var(--g-line);
    border-radius: var(--g-r-lg);
    box-shadow: var(--g-sh-1);
  }
  .g-sect + .g-sect { margin-top: 16px; border-top: 1px solid var(--g-line); }
}

/* --- tappable row: the core mobile primitive ----------------------
   The whole row is one target. Do not nest buttons inside it. */
.g-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--g-tap);
  padding: 12px var(--g-gut);
  background: var(--g-surface);
  text-align: left;
  border-bottom: 1px solid var(--g-line);
  margin-inline: calc(var(--g-gut) * -1);
  -webkit-tap-highlight-color: transparent;
  transition: background 120ms;
}
.g-row:active { background: #F1F4F1; }
.g-row:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--g-teal); }
.g-row__body { flex: 1 1 auto; min-width: 0; }
.g-row__t { display: block; font-size: 15.5px; font-weight: 600; line-height: 1.3; }
/* two lines keeps a list scannable on a phone; a third pushes the next
   row past the fold */
.g-row__m {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--g-ink-3);
}
.g-rows { border-top: 1px solid var(--g-line); }

@media (min-width: 640px) {
  .g-row {
    margin-inline: 0;
    padding: 12px 14px;
    border: 1px solid var(--g-line);
    border-radius: var(--g-r);
  }
  .g-row + .g-row { margin-top: 8px; }
  .g-row:hover { background: #FAFCFA; border-color: var(--g-line-strong); }
  .g-rows { border-top: 0; }
}

.g-tile {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--g-teal-050);
  color: var(--g-teal);
}
.g-tile--warn { background: var(--g-warn-050); color: var(--g-warn); }
.g-tile--mono { background: var(--g-idle-050); color: var(--g-ink-2); font-weight: 600; font-size: 13.5px; }

/* --- status + progress -------------------------------------------- */
.g-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.g-pill::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.g-pill--ok { background: var(--g-ok-050); color: var(--g-ok-700); }
.g-pill--wip { background: var(--g-warn-050); color: var(--g-warn); }
/* "not started" reads as neutral, not as a failure */
.g-pill--idle { background: var(--g-idle-050); color: var(--g-idle); }

.g-meter { height: 5px; border-radius: 999px; background: var(--g-line); overflow: hidden; }
.g-meter > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--g-teal);
  transition: width 400ms cubic-bezier(.4, 0, .2, 1);
}
.g-meter--ok > i { background: var(--g-ok); }

/* --- cards ---------------------------------------------------------
   Every boxed thing in the renewal flow uses one of these three, so a new
   card never needs new styling:

     .g-card        a record or a panel      (saved job, a stored value)
     .g-card--tap   the whole card opens it  (adds press/hover/focus)
     .g-card--dash  a dashed placeholder     (nothing saved yet)
     .g-card--sel   the one in effect now    (read-only, already chosen)
     .g-radiocard   one selectable option    (which of these is yours)

   The label/value stack inside a card is .g-kv, which gives it row
   dividers and a type hierarchy so it reads as a record rather than a
   till receipt. Do not reach for `border rounded-lg p-4` again: that is
   what left cards transparent, so the page canvas showed through and
   they looked grey instead of white. */
.g-card {
  background: var(--g-surface);
  border: 1px solid var(--g-line);
  border-radius: var(--g-r);
  padding: 14px;
}
.g-card + .g-card { margin-top: 10px; }
.g-card--tap {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 140ms, background 140ms;
}
.g-card--tap:hover { border-color: var(--g-line-strong); }
.g-card--tap:active { background: #FAFCFA; }
.g-card--tap:focus-visible { outline: none; box-shadow: var(--g-focus); }
.g-card--dash {
  border-style: dashed;
  border-color: var(--g-line-strong);
  background: transparent;
  color: var(--g-ink-3);
}
/* The selected state, for a card that has no radio of its own to key off.
   Matches .g-radiocard:has(input:checked) exactly so "this is the one in
   effect" looks the same whether or not it is still selectable. The fact
   selection sheets used to hand-roll this as an inline
   background-color: #F4FFFB; border-color: #232C27, which put the
   provenance line on an untokenised tint and made the border a near-black
   hairline instead of the teal selected edge. */
.g-card--sel {
  border-color: var(--g-teal);
  background: var(--g-teal-050);
  box-shadow: inset 0 0 0 1px var(--g-teal);
}
.g-card__h { font-size: 15.5px; font-weight: 600; line-height: 1.3; }
.g-card__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--g-ink-3);
  margin-bottom: 2px;
}

/* --- person list ---------------------------------------------------
   Household people use one record card on every step. Rows can be links,
   checkboxes, or edit targets without changing the list's visual rhythm. */
.g-person-list {
  padding: 0;
  overflow: hidden;
  border-radius: var(--g-r-lg);
}
.g-person-list > * + * { border-top: 1px solid var(--g-line); }
.g-person-list__row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--g-tap);
  padding: 16px 14px;
  background: var(--g-surface);
  text-align: left;
}
.g-person-list__row--action,
.g-person-list__row--choice {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 120ms;
}
.g-person-list__row--action:hover,
.g-person-list__row--choice:hover { background: #FAFCFA; }
.g-person-list__row--action:active,
.g-person-list__row--choice:active { background: #F1F4F1; }
.g-person-list__row--action:focus-visible,
.g-person-list__row--choice:has(input:focus-visible) {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--g-teal);
}
.g-person-list__row--choice .label-text {
  font-size: 15.5px;
  font-weight: 500;
  color: var(--g-ink);
}
.g-person-list__main {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}
.g-person-list__main:focus-visible {
  outline: none;
  border-radius: 8px;
  box-shadow: 0 0 0 2px var(--g-teal);
}
.g-person-list .g-person-list__more {
  margin-inline: 0;
  padding-inline: 14px;
}
.g-person-list__empty {
  padding: 14px;
  font-size: 14px;
  color: var(--g-ink-3);
}

.g-kv { display: grid; }
.g-kv > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 9px 0;
  border-top: 1px solid var(--g-line);
  font-size: 14px;
  line-height: 1.4;
}
.g-kv > div:first-child { border-top: 0; padding-top: 2px; }
.g-kv > div:last-child { padding-bottom: 0; }
.g-kv > div > :first-child { flex: none; color: var(--g-ink-3); }
.g-kv > div > :last-child {
  font-weight: 500;
  text-align: right;
  color: var(--g-ink);
  font-variant-numeric: tabular-nums;
}
.g-kv--inset { padding-top: 4px; }

/* --- provenance chip and callouts --------------------------------- */
.g-source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--g-idle-050);
  color: var(--g-ink-3);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}
.g-note {
  display: flex;
  gap: 10px;
  padding: 14px;
  border-radius: var(--g-r);
  background: var(--g-teal-050);
  border: 1px solid #CFE2E0;
}
.g-note--warn { background: var(--g-warn-050); border-color: #EFD9AE; }
/* Same reason as .g-add.hidden: .g-note's display outranks the layered .hidden. */
.g-note.hidden { display: none; }
.g-note > .g-ico { flex: none; margin-top: 1px; color: var(--g-teal-600); }
.g-note--quiet { background: var(--g-canvas); border-color: var(--g-line); }
.g-note__h { font-size: 14.5px; font-weight: 600; color: var(--g-teal-600); }
.g-note--warn .g-note__h { color: var(--g-warn); }
.g-note--quiet .g-note__h { color: var(--g-ink); }
.g-note__p { margin-top: 2px; font-size: 13.5px; color: var(--g-ink-2); }
.g-note--quiet .g-note__p { color: var(--g-teal-600); }

/* --- fields -------------------------------------------------------
   16px text is deliberate: anything smaller makes iOS Safari zoom the
   viewport on focus, which then strands the sticky action bar. */
.g-field { display: block; }
.g-field + .g-field { margin-top: 16px; }
.g-field__label {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--g-ink);
}
.g-field__opt { font-weight: 400; font-size: 13px; color: var(--g-ink-3); }
.g-help { margin-top: 6px; font-size: 13px; line-height: 1.45; color: var(--g-ink-3); }
.g-fieldmsg {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--g-danger);
}
/* The symbol's offset and the input's left padding come off one value. Set
   separately they drift, and the symbol ends up printed over the number. */
.g-prefix { position: relative; display: block; --g-prefix-w: 26px; }
.g-prefix > .g-prefix__sym {
  position: absolute;
  z-index: 1;
  left: 14px;
  top: 50%;
  translate: 0 -50%;
  width: var(--g-prefix-w);
  color: var(--g-ink-3);
  pointer-events: none;
}

/* field pairs only go side by side once there is room for them */
.g-pair { display: grid; gap: 16px; }
@media (min-width: 480px) { .g-pair { grid-template-columns: 1fr 1fr; } }

@media (min-width: 640px) {
  /* A 430px Profile rail still has phone-sized form composition. */
  [data-theme="graici"].profile-body .g-pair { grid-template-columns: 1fr; }
}

/* --- segmented choice: thumb-sized yes/no ------------------------- */
.g-choice { display: flex; gap: 10px; }
.g-choice input { position: absolute; opacity: 0; pointer-events: none; }
.g-choice label {
  flex: 1 1 0;
  min-height: var(--g-tap);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  background: var(--g-surface);
  border: 1.5px solid var(--g-line-strong);
  border-radius: var(--g-r);
  -webkit-tap-highlight-color: transparent;
  transition: border-color 140ms, background 140ms, color 140ms, box-shadow 140ms;
}
.g-choice input:checked + label {
  border-color: var(--g-teal);
  background: var(--g-teal-050);
  color: var(--g-teal-600);
  box-shadow: inset 0 0 0 1px var(--g-teal);
}
.g-choice input:focus-visible + label { box-shadow: var(--g-focus); }

/* --- buttons ------------------------------------------------------ */
.g-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--g-tap);
  padding: 0 20px;
  border-radius: var(--g-r);
  font-weight: 600;
  font-size: 16px;
  border: 1.5px solid transparent;
  -webkit-tap-highlight-color: transparent;
  transition: background 140ms, border-color 140ms, color 140ms, box-shadow 140ms;
}
.g-btn:focus-visible { outline: none; box-shadow: var(--g-focus); }
.g-btn--block { width: 100%; }
.g-btn-primary { background: var(--g-primary); color: #fff; }
.g-btn-primary:hover:not(:disabled), .g-btn-primary:active { background: var(--g-primary-600); color: #fff; }
/* #C3CCC5 left its white label at 1.65:1. A disabled control still has to be
   readable, so the fill is darkened to carry white text at 4.52:1; it reads as
   inactive through the flat, desaturated hue rather than through low contrast. */
.g-btn-primary:disabled { background: #6F7971; color: #fff; cursor: not-allowed; }
.g-btn-outline { background: #fff; border-color: var(--g-line-strong); color: var(--g-ink); }
.g-btn-outline:hover, .g-btn-outline:active { border-color: var(--g-teal); background: var(--g-teal-050); color: var(--g-teal-600); }
.g-btn-ghost { background: transparent; color: var(--g-ink-2); }
.g-btn-ghost:hover, .g-btn-ghost:active { background: var(--g-idle-050); color: var(--g-ink); }
/* Secondary modal actions still need to read as controls beside the filled
   primary action. Keep ghost styling elsewhere, but give dialog actions a
   defined edge and surface. */
[data-theme="graici"] .modal-action .g-btn-ghost {
  border-color: var(--g-line-strong);
  background: var(--g-surface);
  color: var(--g-ink);
}
[data-theme="graici"] .modal-action .g-btn-ghost:hover,
[data-theme="graici"] .modal-action .g-btn-ghost:active {
  border-color: var(--g-teal);
  background: var(--g-teal-050);
  color: var(--g-teal-600);
}
@media (max-width: 479px) {
  [data-theme="graici"] .modal-action:has(> .g-btn:nth-child(3)) {
    gap: 8px;
    padding-inline: 16px;
  }
  [data-theme="graici"] .modal-action:has(> .g-btn:nth-child(3)) > .g-btn {
    min-height: 44px;
    padding-inline: 12px;
    font-size: 14px;
    white-space: nowrap;
  }
}
.g-btn-link { background: transparent; color: var(--g-teal-600); }
.g-btn-danger { background: transparent; color: var(--g-danger); }

.g-iconbtn {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--g-ink-2);
  background: transparent;
  border: 0;
  -webkit-tap-highlight-color: transparent;
}
.g-iconbtn:hover, .g-iconbtn:active { background: var(--g-idle-050); color: var(--g-ink); }
.g-iconbtn:focus-visible { outline: none; box-shadow: var(--g-focus); }
.g-iconbtn--boxed {
  width: var(--g-tap);
  height: var(--g-tap);
  border: 1.5px solid var(--g-line-strong);
  background: #fff;
}

.g-add {
  width: 100%;
  min-height: var(--g-tap);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15.5px;
  color: var(--g-teal-600);
  background: transparent;
  border: 1.5px dashed var(--g-line-strong);
  border-radius: var(--g-r);
  -webkit-tap-highlight-color: transparent;
  transition: border-color 140ms, background 140ms, border-style 140ms;
}
.g-add:hover, .g-add:active { background: var(--g-teal-050); border-color: var(--g-teal); border-style: solid; }
.g-add:focus-visible { outline: none; box-shadow: var(--g-focus); }
/* This file is unlayered, so .g-add's display would beat Tailwind's layered
   .hidden and the tile showed before anyone answered Yes. Steps reveal it with
   an !important group-has variant, which still wins over this. */
.g-add.hidden { display: none; }

/* --- thumb-zone action bar ---------------------------------------- */
.g-actions {
  position: sticky;
  bottom: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px var(--g-gut) calc(12px + var(--g-safe-b));
  margin-inline: calc(var(--g-gut) * -1);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--g-line);
  box-shadow: var(--g-sh-up);
}
.g-actions > .g-btn-primary, .g-actions > .g-actions__grow { flex: 1 1 auto; }
.g-actions__back,
.g-actions__cancel { flex: none; }
/* Visually flat, but still bottom anchored so it cannot slide under the
   Ask Graici launcher. */
.g-actions--inline {
  position: sticky;
  margin-inline: 0;
  /* the safe-area pad matters here too: the button sits flush with the
     bottom of the viewport, which on an iPhone is the home indicator */
  padding: 18px 0 calc(12px + var(--g-safe-b));
  background: none;
  backdrop-filter: none;
  box-shadow: none;
  border-top: 1px solid var(--g-line);
}

/* The Summary uses a real form for CSRF submission. Make both that wrapper and
   its control span the footer so breakpoint flex rules cannot shrink the CTA. */
.g-actions--summary > .g-actions__form {
  display: flex;
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
}
.g-actions--summary > .g-btn-primary,
.g-actions--summary > .g-actions__form > .g-btn-primary {
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
  max-width: none;
}

/* above 640 it stops being a floating bar and becomes a footer row */
@media (min-width: 640px) {
  .g-actions {
    position: static;
    margin-inline: 0;
    padding: 18px 0 0;
    background: none;
    backdrop-filter: none;
    box-shadow: none;
    border-radius: 0;
    justify-content: flex-end;
  }
  .g-actions > .g-btn-primary, .g-actions > .g-actions__grow { flex: 0 0 auto; min-width: 180px; }
  .g-actions > .g-btn--block { width: auto; }
  .g-actions__back,
  .g-actions__cancel { margin-right: auto; }
  .g-page > .g-actions { margin-top: 16px; }
}

/* --- loading + motion --------------------------------------------- */
.g-swap { transition: opacity 180ms ease-out, transform 180ms ease-out; }
.g-swap.htmx-swapping { opacity: 0; transform: translateY(-4px); }
.g-swap.htmx-added { opacity: 0; transform: translateY(6px); }

.g-btn[aria-busy="true"] { pointer-events: none; color: transparent; position: relative; }
.g-btn[aria-busy="true"]::after {
  content: "";
  position: absolute;
  width: 19px;
  height: 19px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  animation: g-spin .6s linear infinite;
}
@keyframes g-spin { to { transform: rotate(360deg); } }

.g-skel {
  background: var(--g-idle-050);
  border-radius: 10px;
}

@media (prefers-reduced-motion: reduce) {
  .g-swap, .g-meter > i, .g-segs > a, .g-segs > button, .g-segs > span { transition-duration: .01ms; }
  .g-btn[aria-busy="true"]::after { animation-duration: .01ms; }
}

/* --- icons: one sprite, inherits currentColor ---------------------- */
.g-ico {
  width: 20px;
  height: 20px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.g-ico--sm { width: 16px; height: 16px; }
.g-ico--lg { width: 24px; height: 24px; }

/* --- visually hidden ---------------------------------------------- */
.g-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   5. Scoped DaisyUI map
   Everything below only applies inside data-theme="graici".
   It exists so templates that still use stock DaisyUI classes
   (.input, .label, .modal, .card) pick up the new design without
   every line of markup having to change at once. Pages that have
   not opted into the theme are untouched.
   ============================================================ */

/* --- form controls ------------------------------------------------ */
[data-theme="graici"] .input,
[data-theme="graici"] .input-bordered,
[data-theme="graici"] .select,
[data-theme="graici"] .select-bordered,
[data-theme="graici"] .textarea,
[data-theme="graici"] .textarea-bordered,
[data-theme="graici"] .g-input,
[data-theme="graici"] .g-select {
  min-height: var(--g-tap);
  height: auto;
  padding: 13px 14px;
  font-size: 16px;
  line-height: 1.4;
  color: var(--g-ink);
  /* White, not the warm --g-field tint: fields sit on white section
     blocks, where a cream fill reads as discoloured rather than warm.
     The 1.5px border is what separates the field from the surface. */
  background-color: var(--g-surface);
  border: 1.5px solid var(--g-line-strong);
  border-radius: var(--g-r);
  transition: border-color 120ms, box-shadow 120ms, background-color 120ms;
}

[data-theme="graici"] .input::placeholder,
[data-theme="graici"] .textarea::placeholder {
  color: var(--graici-placeholder);
}

[data-theme="graici"] .input:focus,
[data-theme="graici"] .input:focus-within,
[data-theme="graici"] .select:focus,
[data-theme="graici"] .textarea:focus,
[data-theme="graici"] .g-input:focus,
[data-theme="graici"] .g-select:focus {
  outline: none;
  border-color: var(--g-teal);
  box-shadow: var(--g-focus);
}

[data-theme="graici"] .input[aria-invalid="true"],
[data-theme="graici"] .input.input-error,
[data-theme="graici"] .select[aria-invalid="true"],
[data-theme="graici"] .select.select-error,
[data-theme="graici"] .textarea[aria-invalid="true"],
[data-theme="graici"] .textarea.textarea-error,
[data-theme="graici"] .g-input[aria-invalid="true"],
[data-theme="graici"] .g-select[aria-invalid="true"] {
  border-color: var(--g-danger);
  background-color: var(--g-surface);
}

/* native select needs its own chevron once the border is restyled */
[data-theme="graici"] .select,
[data-theme="graici"] .g-select {
  appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23606B62' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 8 10 12.5 14.5 8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 20px;
}

/* Support the v5 fieldset partials and remaining v4 form-control markup. */
[data-theme="graici"] .form-control + .form-control,
[data-theme="graici"] .fieldset + .fieldset { margin-top: 16px; }
[data-theme="graici"] .form-control > .label,
[data-theme="graici"] .fieldset > .label { padding: 0 0 6px; }
[data-theme="graici"] .form-control > .label:last-child,
[data-theme="graici"] .fieldset > .label:last-child { padding: 6px 0 0; }
[data-theme="graici"] .label-text,
[data-theme="graici"] .fieldset-legend {
  font-size: 14px;
  font-weight: 600;
  color: var(--g-ink);
}
[data-theme="graici"] .label-text-alt,
[data-theme="graici"] .fieldset-label { font-size: 13px; line-height: 1.45; }
[data-theme="graici"] .label-text-alt.text-error,
[data-theme="graici"] .fieldset-label.text-error {
  color: var(--g-danger);
  font-weight: 500;
}

[data-theme="graici"] .radio,
[data-theme="graici"] .checkbox {
  width: 22px;
  height: 22px;
  border-width: 1.5px;
  border-color: var(--g-line-strong);
}
[data-theme="graici"] .radio:checked,
[data-theme="graici"] .radio:focus-visible,
[data-theme="graici"] .checkbox:checked {
  border-color: var(--g-teal);
  background-color: var(--g-teal);
}
[data-theme="graici"] .radio:focus-visible,
[data-theme="graici"] .checkbox:focus-visible {
  outline: none;
  box-shadow: var(--g-focus);
}
/* radios and checkboxes are usually inside a <label>; give the pair a
   52px row so the tap target matches the rest of the flow */
[data-theme="graici"] .label.cursor-pointer { min-height: var(--g-tap); }

/* --- buttons ------------------------------------------------------ */
[data-theme="graici"] .btn {
  min-height: var(--g-tap);
  height: auto;
  padding-inline: 20px;
  font-size: 16px;
  font-weight: 600;
  text-transform: none;
  -webkit-tap-highlight-color: transparent;
}
[data-theme="graici"] .btn-sm { min-height: 40px; padding-inline: 14px; font-size: 14px; }
[data-theme="graici"] .btn-square,
[data-theme="graici"] .btn-circle { padding-inline: 0; }
/* The 52px .btn min-height stretched the menu button into an oval on hover. */
[data-theme="graici"] .navbar .btn-circle { min-height: 0; height: var(--size); }
[data-theme="graici"] .btn:focus-visible { outline: none; box-shadow: var(--g-focus); }
[data-theme="graici"] .btn-outline {
  background-color: #fff;
  border-color: var(--g-line-strong);
  color: var(--g-ink);
}
[data-theme="graici"] .btn-outline:hover {
  background-color: var(--g-teal-050);
  border-color: var(--g-teal);
  color: var(--g-teal-600);
}
[data-theme="graici"] .link { color: var(--g-teal-600); }

/* --- surfaces ----------------------------------------------------- */
[data-theme="graici"] .card {
  background-color: var(--g-surface);
  border: 1px solid var(--g-line);
  border-radius: var(--g-r-lg);
  box-shadow: var(--g-sh-1);
}
[data-theme="graici"] .card > .card-body { padding: 20px var(--g-gut); gap: 0; }
/* DaisyUI sets flex-grow: 1 on paragraphs in .card-body so a card's text
   pushes .card-actions to the bottom. On a step page that stretches the one
   line of intro copy into a tall block and strands the question's controls
   at the bottom of the screen, far from the question itself. */
[data-theme="graici"] .card-body p { flex-grow: 0; }
[data-theme="graici"] .card-title { font-size: 17px; font-weight: 600; line-height: 1.3; }
[data-theme="graici"] .divider { margin-block: 12px; }
[data-theme="graici"] .divider::before,
[data-theme="graici"] .divider::after { background-color: var(--g-line); height: 1px; }

/* A card that is a direct child of the page bleeds to the screen edges
   on a phone. At 640px it becomes a normal card again. */
[data-theme="graici"] .g-page > .card {
  margin-inline: calc(var(--g-gut) * -1);
  border-inline: 0;
  border-radius: 0;
  box-shadow: none;
}
@media (min-width: 640px) {
  [data-theme="graici"] .g-page > .card {
    margin-inline: 0;
    border-inline: 1px solid var(--g-line);
    border-radius: var(--g-r-lg);
    box-shadow: var(--g-sh-1);
  }
}

[data-theme="graici"] .alert {
  border-radius: var(--g-r);
  border: 1px solid transparent;
  font-size: 14.5px;
  line-height: 1.45;
}
[data-theme="graici"] .alert-error {
  background-color: #FCEEED;
  border-color: #EFCFCD;
  color: var(--g-danger);
}

/* --- modals become bottom sheets on a phone -----------------------
   Base rule is the sheet; the centered dialog comes back at 640px.
   Padding is deliberately untouched: some .modal-box instances use
   p-0 and lay out their own header/body/footer. */
[data-theme="graici"] .modal {
  align-items: flex-end;
  padding-bottom: var(--g-safe-b);
}
[data-theme="graici"] .modal-box {
  width: 100%;
  max-width: none;
  max-height: 88dvh;
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform .26s cubic-bezier(.32, .72, 0, 1);
}
[data-theme="graici"] .modal[open] .modal-box,
[data-theme="graici"] .modal-open .modal-box,
[data-theme="graici"] .modal:target .modal-box {
  transform: translateY(0);
}
/* the grab handle that tells people this panel is a sheet */
[data-theme="graici"] .modal-box::before {
  content: "";
  display: block;
  width: 40px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 999px;
  background: var(--g-line-strong);
}

@media (min-width: 640px) {
  [data-theme="graici"] .modal { align-items: center; padding-bottom: 0; }
  [data-theme="graici"] .modal-box {
    width: 91.666667%;
    max-width: 32rem;
    max-height: calc(100dvh - 5em);
    border-radius: var(--radius-box);
    transform: scale(.96);
  }
  [data-theme="graici"] .modal[open] .modal-box,
  [data-theme="graici"] .modal-open .modal-box,
  [data-theme="graici"] .modal:target .modal-box { transform: scale(1); }
  [data-theme="graici"] .modal-box::before { display: none; }

  /* Profile dialogs follow the same rail as their launching page instead of
     expanding into a separate desktop-sized interface. */
  [data-theme="graici"].profile-body .profile-modal .modal-box {
    width: min(calc(100% - 32px), var(--app-max-width));
    max-width: var(--app-max-width);
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-theme="graici"] .modal-box { transition-duration: .01ms; }
}

/* --- navbar ------------------------------------------------------
   The sticky step header sits directly under the navbar, so the two
   heights have to agree. --g-bar-h is the single source of truth.
   DaisyUI's default .navbar is 64px; the theme tightens it to 56px to
   give a phone back 8px of content. */
[data-theme="graici"] .navbar {
  min-height: var(--g-bar-h);
  padding: 0 8px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--g-line);
  box-shadow: none;
}

/* --- step page chrome --------------------------------------------
   The topbar, the sticky step header and the page are siblings inside
   <main>, so making <main> the flex column is what lets .g-page--step
   grow into whatever height is left. */
[data-theme="graici"] main {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.g-stephead__back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
  padding: 4px 6px 4px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--g-ink-3);
}
.g-stephead__back:hover { color: var(--g-ink); }
.g-stephead__back:focus-visible { outline: none; box-shadow: var(--g-focus); border-radius: 6px; }

/* --- action bar contents -----------------------------------------
   Step templates put a back link and then either a submit button or a
   small group of buttons inside the bar. The trailing control is the
   primary action, so on a phone it takes the remaining width. */
.g-actions > .hidden { display: none; }
.g-actions > :last-child { flex: 1 1 auto; margin-left: auto; }
.g-actions > a.btn:not(:last-child),
.g-actions > a.g-btn:not(:last-child) { flex: 0 0 auto; margin-left: 0; }
.g-actions > div:last-child {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}
.g-actions > div:last-child > .btn:last-child,
.g-actions > div:last-child > .g-btn:last-child { flex: 1 1 auto; }

/* The three fact-selection sheets hand-roll a sticky footer inside a p-0
   .modal-box instead of using .modal-action, so they opt out of the rule
   above. On a phone the trailing control is still the primary action and
   still has to fill the thumb zone. */
[data-theme="graici"] .modal-action.sticky {
  gap: 10px;
  background: var(--g-surface);
  box-shadow: 0 -8px 20px rgba(22, 36, 29, .08);
  isolation: isolate;
}
[data-theme="graici"] .modal-action.sticky > .g-btn:last-child { flex: 1 1 auto; }

/* Fact selectors have a fixed header and footer around one scroll region.
   The sticky current-selection surface deliberately overlaps the scroll
   region's top padding so scrolled candidate text can never show above it. */
[data-theme="graici"] .profile-selection-modal__box {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
[data-theme="graici"] .profile-selection-modal__layout {
  flex: 1 1 auto;
  min-height: 0;
}
[data-theme="graici"] .profile-selection-modal__header {
  position: relative;
  z-index: 20;
  flex: none;
  background: var(--g-surface);
  isolation: isolate;
}
[data-theme="graici"] .profile-selection-modal__scroll {
  position: relative;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-color: var(--g-line-strong) var(--g-idle-050);
  isolation: isolate;
}
[data-theme="graici"] .profile-selection-modal__scroll:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--g-teal);
}
[data-theme="graici"] .profile-selection-modal__current {
  position: sticky;
  top: -1rem;
  z-index: 20;
  margin: -1rem -1.5rem 0;
  padding: 1rem 1.5rem;
  background: var(--g-surface);
  box-shadow: 0 1px 0 var(--g-line);
  isolation: isolate;
}
[data-theme="graici"] .profile-selection-modal__actions {
  position: relative;
  z-index: 20;
  flex: none;
}

/* The bar has to sit flush with the bottom of the card, not above the
   card's own bottom padding: that gap shows as a white strip under the bar
   and puts the Ask Graici launcher on the bar instead of above it. Matched
   at any depth because most step templates nest the bar inside their form. */
[data-theme="graici"] .g-page--step .g-actions:last-child { margin-bottom: 0; }
/* The card markup carries Tailwind's mb-6. It used to separate the card from
   whatever followed it; now the card is the only thing in the page, and that
   24px keeps the action bar off the bottom of the screen. */
[data-theme="graici"] .g-page--step > .card { border-bottom: 0; margin-bottom: 0; }

@media (min-width: 640px) {
  .g-actions > :last-child { flex: 0 0 auto; }
  .g-actions > div:last-child > .btn:last-child,
  .g-actions > div:last-child > .g-btn:last-child { flex: 0 0 auto; }
  [data-theme="graici"] .g-page--step .g-actions:last-child { margin-bottom: 0; }
  [data-theme="graici"] .g-page--step > .card { border-bottom: 1px solid var(--g-line); }
}

/* --- Ask Graici must not sit on top of the action bar -------------
   The ChatKit launcher is position: fixed at bottom-6 right-4 with
   z-index 40, which on a phone lands exactly on the primary button in
   the thumb-zone bar. Inside the theme the launcher is lifted clear of
   the bar and the bar is raised above it. */
[data-theme="graici"] .g-actions { z-index: 45; }

/* On a page with an action bar the launcher moves INTO the bar, at its right
   edge, and the bar reserves that width. Lifting it above the bar instead
   only moved the problem: it then sat on whatever content was immediately
   above, which on these pages is the last thing someone needs to tap. */
[data-theme="graici"] [id$="-chatkit-toggle"] {
  right: 12px;
  z-index: 46;
}
[data-theme="graici"]:has(.g-actions) [id$="-chatkit-toggle"] {
  bottom: calc(12px + var(--g-safe-b));
}
[data-theme="graici"] [id$="-chatkit-popover"] {
  bottom: calc(var(--g-actions-h) + 16px + var(--g-safe-b));
}
[data-theme="graici"] .g-actions { padding-right: calc(var(--g-fab-h) + 22px); }

/* On a phone the bar has to hold a back control, a primary button and the
   launcher. "Back to Summary" plus "Save & Continue" plus the launcher do not
   fit in 390px: the primary cannot shrink below its own text, so it overflowed
   the reserved width and the launcher sat on it. The shared outline button
   becomes a chevron-only square. font-size: 0 hides the label visually while
   leaving it in the accessibility tree, so the button keeps its name. */
[data-theme="graici"] .g-actions__back {
  width: var(--g-tap);
  min-width: var(--g-tap);
  padding: 0;
  gap: 0;
  font-size: 0;
}
[data-theme="graici"] .g-actions__back .g-ico,
[data-theme="graici"] .g-actions__back svg { width: 22px; height: 22px; }
[data-theme="graici"] .g-actions__cancel {
  min-width: var(--g-tap);
  padding-inline: 6px;
  font-size: 13px;
}

@media (min-width: 640px) {
  /* Ordinary step-to-step navigation can show its label when there is room.
     A return to Summary keeps the same compact caret used on mobile so the
     same destination never changes visual treatment between viewports. */
  [data-theme="graici"] .g-actions__back:not(.g-actions__back--compact) {
    width: auto;
    min-width: 0;
    padding: 0 16px;
    gap: 8px;
    font-size: 16px;
  }
  [data-theme="graici"] .g-actions__back:not(.g-actions__back--compact) .g-ico,
  [data-theme="graici"] .g-actions__back:not(.g-actions__back--compact) svg {
    width: 16px;
    height: 16px;
  }
  [data-theme="graici"] .g-actions__cancel {
    min-width: 0;
    padding-inline: 16px;
    font-size: 16px;
  }
}

/* Any page with an action bar lifts the launcher, inline or sticky. An
   inline bar is the last thing on the page, so on a short page it lands
   in the bottom-right corner where the launcher would otherwise be. */
[data-theme="graici"] { --g-actions-h: 0px; }
[data-theme="graici"]:has(.g-actions) { --g-actions-h: 76px; }


@media (min-width: 640px) {
  /* above 640 the bar is a static footer row, so the launcher goes back to
     resting in the corner and the bar needs no reserved width */
  [data-theme="graici"]:has(.g-actions) { --g-actions-h: 0px; }
  [data-theme="graici"]:has(.g-actions) [id$="-chatkit-toggle"] { bottom: 1.5rem; }
  [data-theme="graici"] .g-actions { padding-right: 0; }
}

/* --- stretching a step page to the bottom of the viewport ---------
   Step templates nest their button row inside the card (often inside
   the form as well), so .g-page--step > .g-actions { margin-top: auto }
   never matches. Stretch the card and the form instead, then let the
   bar claim the slack wherever it ends up.

   !important is here to beat Tailwind's space-y-* utility, which sets
   margin-top on every sibling with higher specificity than a class. */
[data-theme="graici"] .g-page--step > .card { flex: 1 1 auto; }
/* :not(.g-actions) matters. Five step templates make the action bar itself a
   <form> (it posts Save & Continue), and it is the last form in the card.
   Without the exclusion that bar became a full-height flex column: the back
   link stretched to full width and the submit button grew into a giant block. */
/* Whatever holds the action bar has to be part of the flex chain, or
   margin-top: auto on the bar has no flex parent to take the slack from and
   the bar sits wherever the content happens to end. Templates nest the bar
   one or two levels inside .card-body, hence the two selectors. */
[data-theme="graici"] .g-page--step > .card > .card-body > *:has(.g-actions):not(.g-actions),
[data-theme="graici"] .g-page--step > .card > .card-body > * > *:has(.g-actions):not(.g-actions) {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  /* keeps the last piece of content off the bar when the page is full */
  gap: 20px;
}
[data-theme="graici"] .g-page--step .g-actions:last-child { margin-top: auto !important; }

@media (min-width: 640px) {
  [data-theme="graici"] .g-page--step > .card { flex: 0 0 auto; }
  [data-theme="graici"] .g-page--step .g-actions:last-child { margin-top: 18px !important; }
}

/* --- step page: card becomes the page, groups become the blocks -----
   Step templates wrap everything in one .card. On a phone that reads as a
   single white slab: the questions inside it have no edges of their own, so
   a sparse page is a wall of white with text floating in it.

   Dropping the card's own chrome and its padding lets each question group
   (marked .g-sect) bleed to the screen edges as its own block, separated by
   canvas, which is what the mock does. Nothing outside the groups moves: with
   card-body padding at 0, the card's content box lines up with the page's, so
   unwrapped content like the intro line keeps the page gutter. */
[data-theme="graici"] .g-page--step > .card {
  background: transparent;
  border: 0;
  box-shadow: none;
  /* The card is no longer a surface, so it must not bleed: the groups inside
     it do that themselves, and two negative gutters put everything a full
     gutter off the left of the screen. */
  margin-inline: 0;
}
[data-theme="graici"] .g-page--step > .card > .card-body {
  padding: 0;
  gap: 16px;
}
/* the groups supply their own separation, so the utility margins between
   them would double up */
[data-theme="graici"] .g-page--step .g-sect + .g-sect { margin-top: 0; }
/* A .divider between two blocks is redundant now that each block has its own
   edges, and it renders as an empty white strip between them. Dividers inside
   a block still do their job. */
[data-theme="graici"] .g-page--step .g-sect ~ .divider,
[data-theme="graici"] .g-page--step .divider:has(+ .g-sect) { display: none; }

/* --- menu drawer -------------------------------------------------- */
[data-theme="graici"] .drawer-side aside a,
[data-theme="graici"] .drawer-side aside button {
  border-color: var(--g-line);
}

/* a compact button for use inside notes and rows */
.g-btn--sm {
  /* still the minimum touch target, just tighter padding than a full button */
  min-height: 44px;
  padding: 0 14px;
  font-size: 14px;
  border-radius: 10px;
}

/* --- Ask Graici clearance -----------------------------------------
   The launcher is fixed above the bottom-right corner, so any page
   without a sticky bar has to reserve room or the launcher sits on the
   last thing in the page. */
[data-theme="graici"] { --g-fab-h: 56px; }
@media (min-width: 640px) {
  [data-theme="graici"] .g-page { padding-bottom: 32px; }
}

/* --- Summary row density -------------------------------------------
   Only the Summary's section rows drop their description on a phone:
   title + status is what someone returning to the flow is scanning for,
   and the "why we ask" copy pushes the third section under the fold. It
   comes back as soon as there is room. Detail lines on job and household
   rows are load-bearing, so they are untouched. */
.g-row--section .g-row__m { display: none; }
@media (min-width: 640px) {
  .g-row--section .g-row__m {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* --- segmented choice, nested-input form --------------------------
   The step templates put the radio *inside* its <label>, so the
   input:checked + label selector in .g-choice above cannot see it.
   :has() covers that shape without restructuring the markup, which
   keeps the JS hooks (data-working-no and friends) where they are. */
.g-choice > label { flex: 1 1 0; }
.g-choice label input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.g-choice label:has(input:checked) {
  border-color: var(--g-teal);
  background: var(--g-teal-050);
  color: var(--g-teal-600);
  box-shadow: inset 0 0 0 1px var(--g-teal);
}
.g-choice label:has(input:focus-visible) { box-shadow: var(--g-focus); }
/* beat DaisyUI's .label, which is space-between with its own padding */
.g-choice > label.label {
  justify-content: center;
  padding: 0 16px;
  gap: 0;
}
.g-choice > label > .fieldset-legend { margin-inline: 0; }
.g-choice .label-text { font-size: 16px; font-weight: 500; color: inherit; }
/* Four insurance types cannot share one phone row at a readable size, so
   each button keeps its label's width and the row wraps. */
.g-choice--wrap { flex-wrap: wrap; gap: 8px; }
.g-choice--wrap > label { flex: 0 0 auto; min-height: 44px; }

/* --- inline checkboxes --------------------------------------------
   A short pick-any list inside a sheet, such as who a policy covers.
   Names sit side by side and wrap, so a small household takes one line. */
.g-checks { display: flex; flex-wrap: wrap; gap: 0 20px; }
.g-checks__item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 16px;
  font-weight: 500;
  color: var(--g-ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* --- bottom sheet footer ------------------------------------------
   In sheet form the submit button would otherwise sit at the end of a
   long scroll. Pinning .modal-action keeps it in the thumb zone.
   Sticky and inline action rows use DaisyUI's normal layout instead. */
[data-theme="graici"] .modal-action:not(.sticky):not(.modal-action--inline) {
  position: sticky;
  bottom: 0;
  z-index: 10;
  flex-direction: row-reverse;
  gap: 10px;
  margin: 24px -1.5rem -1.5rem;
  padding: 12px 1.5rem calc(12px + var(--g-safe-b));
  background: var(--g-surface);
  border-top: 1px solid var(--g-line);
  box-shadow: 0 -12px 24px rgba(22, 36, 29, .08);
  isolation: isolate;
}
[data-theme="graici"] .profile-modal__actions > .g-btn {
  min-width: 0;
  white-space: nowrap;
}
[data-theme="graici"] .modal-action:not(.sticky):not(.modal-action--inline) > .btn:first-child,
[data-theme="graici"] .modal-action:not(.sticky):not(.modal-action--inline) > .g-btn:first-child { flex: 1 1 auto; }

@media (min-width: 640px) {
  [data-theme="graici"] .modal-action:not(.sticky):not(.modal-action--inline) {
    position: static;
    margin: 24px 0 0;
    padding: 16px 0 0;
  }
  [data-theme="graici"] .modal-action:not(.sticky):not(.modal-action--inline) > .btn:first-child,
  [data-theme="graici"] .modal-action:not(.sticky):not(.modal-action--inline) > .g-btn:first-child { flex: 0 0 auto; }
}

/* --- profile form modals -----------------------------------------
   Personal-info edit forms get one explicit scrolling region so the title
   and actions remain visible at every viewport size. */
[data-theme="graici"] .profile-form-modal__box {
  display: flex;
  flex-direction: column;
  max-height: min(88dvh, 52rem);
  padding: 0;
  overflow: hidden;
}
[data-theme="graici"] .modal.profile-form-sheet {
  align-items: flex-end;
  padding-bottom: 0;
}
[data-theme="graici"] .modal.profile-form-sheet .profile-form-modal__box {
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
}
[data-theme="graici"] .modal.profile-form-sheet[open] .profile-form-modal__box,
[data-theme="graici"] .modal-open.profile-form-sheet .profile-form-modal__box,
[data-theme="graici"] .modal.profile-form-sheet:target .profile-form-modal__box {
  transform: translateY(0);
}
/* The box has no padding, so the sheet's grab handle needs its own gap from
   the top edge. */
[data-theme="graici"] .profile-form-modal__box::before { flex: none; margin-top: 8px; }
[data-theme="graici"] .profile-form-modal__header {
  flex: none;
  padding: 12px 24px 16px;
  border-bottom: 1px solid var(--g-line);
}
/* The close button sits beside the title; its 44px target overhangs the
   header's padding instead of pushing the title down. */
[data-theme="graici"] .profile-form-modal__header--closable {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding-right: 12px;
}
[data-theme="graici"] .profile-form-modal__header--closable > .g-iconbtn { margin-top: -8px; }
[data-theme="graici"] .profile-form-modal__form {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}
[data-theme="graici"] .profile-form-modal__scroll {
  flex: 1 1 auto;
  min-height: 0;
  padding: 20px 18px 28px 24px;
  overflow-y: scroll;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-color: var(--g-line-strong) var(--g-idle-050);
  scrollbar-width: auto;
}
[data-theme="graici"] .profile-form-modal__scroll::-webkit-scrollbar { width: 12px; }
[data-theme="graici"] .profile-form-modal__scroll::-webkit-scrollbar-track {
  background: var(--g-idle-050);
}
[data-theme="graici"] .profile-form-modal__scroll::-webkit-scrollbar-thumb {
  border: 3px solid var(--g-idle-050);
  border-radius: 999px;
  background: var(--g-line-strong);
}
[data-theme="graici"] .profile-form-modal__scroll:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--g-teal);
}
[data-theme="graici"] .profile-form-modal__identity-grid {
  display: grid;
  gap: 16px;
}
/* .modal-box is in the selector to outweigh the pinned bottom-sheet footer
   rule above, whose :not() chain is otherwise more specific and pulls this
   footer out to the box edges with its negative margins. */
[data-theme="graici"] .modal-box .modal-action.profile-modal__actions--contained {
  position: static;
  flex: none;
  margin: 0;
  padding: 12px 24px calc(12px + var(--g-safe-b));
  border-top: 1px solid var(--g-line);
  background: var(--g-surface);
  box-shadow: 0 -8px 20px rgba(22, 36, 29, .08);
}
/* The footer is a full-width bar at every size, so the primary action keeps
   filling it on desktop instead of shrinking into the bar's left corner. */
[data-theme="graici"] .modal-box .modal-action.profile-modal__actions--contained > .g-btn:first-child { flex: 1 1 auto; }

@media (min-width: 640px) {
  [data-theme="graici"] .profile-form-modal__box {
    width: min(calc(100% - 32px), var(--app-max-width));
    max-width: var(--app-max-width);
    max-height: min(calc(100dvh - 3rem), 52rem);
  }
  [data-theme="graici"] .modal-box .modal-action.profile-modal__actions--contained { padding-bottom: 16px; }
}

/* --- compact form sheet --------------------------------------------
   A sheet of many short fields, such as an insurance policy, has to read
   as one card on a phone. DaisyUI pads each label into a 44px row and the
   theme sizes each control at 52px, which leaves about 50px between a
   label and its field. Inside the scroll region the controls drop to a
   44px target and labels sit right on their fields; the footer keeps the
   full-size buttons. */
[data-theme="graici"] .profile-form-modal__box--compact::before { margin-bottom: 4px; }
[data-theme="graici"] .profile-form-modal__box--compact .profile-form-modal__header { padding-bottom: 14px; }
[data-theme="graici"] .profile-form-modal__box--compact .profile-form-modal__scroll {
  --g-tap: 44px;
  padding-top: 16px;
}
/* A .group wraps a field and the follow-up it reveals, so its children keep
   the same rhythm as the fields around them. */
[data-theme="graici"] .profile-form-modal__box--compact .profile-form-modal__scroll > * + *,
[data-theme="graici"] .profile-form-modal__box--compact .profile-form-modal__scroll > .group > * + * { margin-top: 18px; }
[data-theme="graici"] .profile-form-modal__box--compact .fieldset { padding-block: 0; gap: 8px; }
[data-theme="graici"] .profile-form-modal__box--compact .fieldset > .label { padding: 0; }
[data-theme="graici"] .profile-form-modal__box--compact .fieldset-legend {
  padding-block: 0;
  margin-bottom: 0;
  line-height: 1.35;
}
/* A fieldset's <legend> sits outside its grid, so the gap above does not
   reach it. */
[data-theme="graici"] .profile-form-modal__box--compact legend.fieldset-legend { margin-bottom: 8px; }
[data-theme="graici"] .profile-form-modal__box--compact .input { padding-block: 9px; }

/* --- list row with a trailing control and a disclosure -------------
   .g-row--stack lays out [tap target][delete][details] so the primary
   area is one large button and the destructive action keeps its own
   44px target, without nesting a button inside a button. */
.g-row--stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  padding: 0 var(--g-gut);
}
.g-row__main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--g-tap);
  padding: 12px 0;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.g-row__main:active { opacity: .7; }
.g-row__main:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--g-teal); border-radius: 8px; }

.g-row__more {
  grid-column: 1 / -1;
  border-top: 1px solid var(--g-line);
  margin-inline: calc(var(--g-gut) * -1);
  padding-inline: var(--g-gut);
}
.g-row__more > summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--g-teal-600);
  cursor: pointer;
  list-style: none;
}
.g-row__more > summary::-webkit-details-marker { display: none; }
.g-row__more > summary::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  rotate: -45deg;
  transition: rotate 160ms;
}
.g-row__more[open] > summary::before { rotate: 45deg; }

@media (min-width: 640px) {
  .g-row--stack { padding: 0 14px; }
  .g-row__more { margin-inline: -14px; padding-inline: 14px; }
}

/* --- key/value pairs ---------------------------------------------- */
.g-dl { display: grid; padding-bottom: 12px; }
.g-dl > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-top: 1px solid var(--g-line);
  font-size: 14px;
}
.g-dl > div:first-child { border-top: 0; }
.g-dl dt { color: var(--g-ink-3); }
.g-dl dd { font-weight: 500; text-align: right; color: var(--g-ink); }

/* --- form flow -----------------------------------------------------
   Wraps the sections of a step so the <form> can grow and hand the
   slack to the trailing .g-actions bar. Replaces the old
   card > card-body > form nesting. */
.g-flow {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 16px;
  margin-top: 16px;
}
.g-flow > .g-actions { margin-top: auto; }
.g-page--step > .g-sect:first-of-type { margin-top: 16px; }

/* a saved value, shown read-only */
.g-value { margin-top: 2px; font-size: 19px; font-weight: 500; }
.g-value--compact { font-size: 16px; }

/* --- selectable card ----------------------------------------------
   For "which of these is yours" choices, where each option needs more
   than a line of text and a provenance chip. */
.g-radiocard {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  min-height: var(--g-tap);
  padding: 14px;
  border: 1.5px solid var(--g-line-strong);
  border-radius: var(--g-r);
  background: var(--g-surface);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 140ms, background 140ms, box-shadow 140ms;
}
.g-radiocard:has(input:checked) {
  border-color: var(--g-teal);
  background: var(--g-teal-050);
  box-shadow: inset 0 0 0 1px var(--g-teal);
}
.g-radiocard:has(input:focus-visible) { box-shadow: var(--g-focus); }

/* --- Ask Graici launcher ------------------------------------------
   Generic app surfaces keep the compact floating launcher. Profile steps
   turn it into the middle item in the bottom action bar below. */
[data-theme="graici"] .chatkit-popover__header-control {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
}
[data-theme="graici"] .chatkit-popover__header-control img {
  flex: none;
  width: 20px;
  height: 20px;
}

[data-theme="graici"] [id$="-chatkit-toggle"] {
  width: 56px;
  height: 56px;
  min-height: 56px;
  padding: 0;
  gap: 0;
  border-radius: 999px;
  font-size: 0;
}
[data-theme="graici"] [id$="-chatkit-toggle"] img { width: 26px; height: 26px; }

/* The profile base owns one launcher for the entire HTMX flow. Shared visual
   treatment lives here; placement and sizing stay inside their breakpoints. */
[data-theme="graici"] .g-profile-shell--chatkit > .chatkit-toggle--profile-action {
  border: 1.5px solid var(--g-teal);
  background: var(--g-teal-050) !important;
  color: var(--g-teal-600);
  box-shadow: none;
}
[data-theme="graici"] .g-profile-shell--chatkit > .chatkit-toggle--profile-action:hover,
[data-theme="graici"] .g-profile-shell--chatkit > .chatkit-toggle--profile-action:active {
  border-color: var(--g-teal-600);
  background: var(--graici-chat-hover) !important;
  color: var(--g-primary);
}
[data-theme="graici"] .g-profile-shell--chatkit > .chatkit-toggle--profile-action img {
  filter: none;
}

@media (max-width: 639px) {
  /* Keep the profile action rail attached to the viewport. A sticky rail can
     remain below the fold on long steps while the fixed ChatKit trigger is
     already visible, which makes the trigger look like it is floating through
     the form. Fixed positioning makes the rail and trigger one stable unit. */
  [data-theme="graici"] .g-profile-shell--chatkit .g-actions {
    position: fixed;
    right: auto;
    bottom: 0;
    left: 50%;
    width: min(100%, var(--app-max-width));
    margin-inline: 0;
    transform: translateX(-50%);
    /* Once fixed, the rail floats over scrolling content, including the
       Summary's .g-actions--inline bar, which is otherwise flat with no
       background. Without a surface the cards show through behind the
       Ask Graici and primary buttons. */
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(12px);
    box-shadow: var(--g-sh-up);
  }
  [data-theme="graici"] .g-profile-shell--chatkit .g-page:has(.g-actions) {
    padding-bottom: calc(100px + var(--g-safe-b));
  }
  [data-theme="graici"]
    .g-profile-shell--chatkit:has(.profile-form-actions > div:last-child)
    .g-page:has(.g-actions) {
    padding-bottom: calc(162px + var(--g-safe-b));
  }

  /* On phones the action space is always split into Back, Ask Graici and the
     primary action. Keeping those columns on every profile page prevents the
     launcher from shifting horizontally between steps. */
  [data-theme="graici"] .g-profile-shell--chatkit > .chatkit-toggle--profile-action {
    position: fixed;
    right: auto;
    bottom: calc(12px + var(--g-safe-b));
    left: calc(12px + var(--g-tap) + 10px);
    z-index: 46;
    width: calc((100vw - 24px - var(--g-tap) - 20px) * 0.4);
    min-width: 0;
    height: var(--g-tap);
    min-height: var(--g-tap);
    padding: 0 10px;
    gap: 0;
    transform: none;
    border-radius: var(--g-r);
    font-size: 14px;
  }
  [data-theme="graici"] .g-profile-shell--chatkit > .chatkit-toggle--profile-action img {
    display: none;
  }
  [data-theme="graici"] .g-profile-shell--chatkit .g-actions {
    display: grid;
    grid-template-columns: var(--g-tap) minmax(0, 2fr) minmax(0, 3fr);
    gap: 10px;
    padding-inline: 12px;
  }
  [data-theme="graici"] .g-profile-shell--chatkit .g-actions--summary {
    grid-template-columns: var(--g-tap) minmax(0, 2fr) minmax(0, 3fr);
  }
  [data-theme="graici"] .g-profile-shell--chatkit .g-actions > .g-actions__back {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }
  [data-theme="graici"] .g-profile-shell--chatkit .g-actions > .g-actions__cancel {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }
  [data-theme="graici"] .g-profile-shell--chatkit .g-actions > :last-child,
  [data-theme="graici"] .g-profile-shell--chatkit .g-actions > form.contents > :last-child {
    grid-column: 3;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }
  [data-theme="graici"] .g-profile-shell--chatkit .g-actions--summary > :last-child {
    grid-column: 3;
  }
  [data-theme="graici"] .g-profile-shell--chatkit .g-actions > div:last-child {
    display: contents;
  }
  [data-theme="graici"] .g-profile-shell--chatkit .g-actions > div:last-child > :last-child {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
  }
  [data-theme="graici"] .g-profile-shell--chatkit .g-actions
    > :not(input[type="hidden"]):not(.hidden):not(.g-actions__back):not(.g-actions__cancel):not(:last-child),
  [data-theme="graici"] .g-profile-shell--chatkit .g-actions > div:last-child > :not(:last-child) {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
  }
  [data-theme="graici"] .g-profile-shell--chatkit .g-actions .g-btn-primary {
    width: 100%;
    max-width: none;
    padding-inline: 14px;
    font-size: 15px;
    line-height: 1.15;
    white-space: normal;
  }

  /* Forms with a secondary action use a full-width first row. Navigation and
     Ask Graici stay in their usual bottom row, so the launcher never moves. */
  [data-theme="graici"]
    .g-profile-shell--chatkit
    .profile-form-actions:has(> div:last-child)
    > .g-actions__back {
    grid-row: 2;
  }
  [data-theme="graici"]
    .g-profile-shell--chatkit
    .profile-form-actions:has(> div:last-child)
    > div:last-child
    > :last-child {
    grid-column: 3;
    grid-row: 2;
  }
  [data-theme="graici"]
    .g-profile-shell--chatkit
    .profile-form-actions:has(> div:last-child)
    > div:last-child
    > :not(:last-child) {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    justify-self: stretch;
  }
}

@media (min-width: 640px) {
  [data-theme="graici"] [id$="-chatkit-toggle"] {
    width: auto;
    height: auto;
    min-height: var(--g-tap);
    padding: 0 20px;
    gap: 8px;
    border-radius: var(--g-r);
    font-size: 16px;
  }
  [data-theme="graici"] .g-profile-shell--chatkit > .chatkit-toggle--profile-action {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    left: auto;
    z-index: 46;
    transform: none;
    width: auto;
    min-width: 132px;
  }
  [data-theme="graici"] .g-profile-shell--chatkit > .chatkit-toggle--profile-action img {
    display: block;
    width: 20px;
    height: 20px;
  }
}

/* --- Summary hero -------------------------------------------------- */
.g-hero { display: flex; align-items: flex-start; gap: 12px; }
.g-hero__h {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 27px;
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -.01em;
}
.g-hero__due { flex: none; margin-top: 5px; }
.g-footnote { margin-top: 18px; text-align: center; font-size: 13.5px; color: var(--g-ink-3); }
.g-row__count { font-size: 13px; font-weight: 500; color: var(--g-ink-3); }
.g-row__next { display: block; margin-top: 4px; font-size: 13.5px; color: var(--g-ink-2); }
.g-progress { margin-top: 18px; display: flex; align-items: center; gap: 12px; }
.g-progress > .g-meter { flex: 1 1 auto; }
.g-progress__count {
  flex: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--g-ink-3);
  font-variant-numeric: tabular-nums;
}

/* --- Summary section rows -----------------------------------------
   These are separated cards rather than the full-bleed hairline list
   used elsewhere: there are only three of them, they are the main
   thing on the screen, and the gaps make each one read as its own
   tappable object. */
.g-row--section {
  margin-inline: 0;
  padding: 14px;
  border: 1px solid var(--g-line);
  border-radius: var(--g-r);
  background: var(--g-surface);
  box-shadow: var(--g-sh-1);
  align-items: center;
}
.g-row--section + .g-row--section { margin-top: 10px; }
.g-rows:has(.g-row--section) { border-top: 0; }
.g-row--section .g-row__t { font-size: 16.5px; }
.g-row__status { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.g-row__go { color: var(--g-ink-3); }
.g-row--section:active { background: #FAFCFA; }

/* Native controls inherit the light scheme explicitly, since the popup is
   drawn by the OS rather than by anything above. */
[data-theme="graici"] select,
[data-theme="graici"] option,
[data-theme="graici"] input[type="date"] {
  color-scheme: light;
  background-color: var(--g-surface);
  color: var(--g-ink);
}

/* --- currency prefix padding --------------------------------------
   Must come after the DaisyUI input map above: that rule sets `padding`
   as a shorthand at equal specificity, so declaring padding-left any
   earlier in this file gets wiped and the $ prints over the number.
   The offset and the padding both derive from --g-prefix-w. */
[data-theme="graici"] .g-prefix > .g-input,
[data-theme="graici"] .g-prefix > .input,
[data-theme="graici"] .g-prefix > input,
[data-theme="graici"] .g-prefix > .input-bordered {
  padding-left: calc(14px + var(--g-prefix-w));
}

/* --- HTMX profile shell -------------------------------------------
   The swapped profile region sits between <main> and each step page. Keep it
   in the flex-height chain so every step hands unused space to the same
   bottom action bar, including when the form itself is short. */
.g-profile-shell {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}

/* Profile question groups are cards, not edge-to-edge bands. Keeping the
   page gutter visible on both sides gives every step the same content frame. */
.g-profile-shell .g-page--step .g-sect {
  margin-inline: 0;
  border: 1px solid var(--g-line);
  border-radius: var(--g-r-lg);
  background: var(--g-surface);
  box-shadow: var(--g-sh-1);
}
.g-profile-shell .g-page--step .g-sect + .g-sect { margin-top: 16px; }

/* Nested groups are content within a card and should not become a second
   bordered card or add another horizontal inset. */
.g-profile-shell .g-page--step .g-sect .g-sect {
  margin-inline: 0;
  padding-inline: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* The primary action fills everything left after Back. Without ChatKit the
   ordinary flex footer keeps its standard gutter; the shell-level ChatKit
   state switches mobile footers to the three-column grid defined above. */
.g-profile-shell .g-page--step > .card { flex: 1 1 auto; }
.g-profile-shell .g-page--step .g-actions:last-child { margin-top: auto !important; }
.g-profile-shell:not(.g-profile-shell--chatkit) .g-actions {
  padding-right: var(--g-gut);
}
.g-profile-shell
  .g-actions
  > .g-btn-primary,
.g-profile-shell
  .g-actions
  > .g-actions__grow,
.g-profile-shell
  .g-actions
  > :last-child,
.g-profile-shell
  .g-actions
  > div:last-child
  > .g-btn-primary:last-child {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  max-width: none;
}

@media (min-width: 640px) {
  .g-profile-shell:not(.g-profile-shell--chatkit) .g-actions {
    padding-right: 0;
  }
}

@media (max-width: 639px) {
  [data-theme="graici"]
    .g-profile-shell--chatkit
    .g-actions
    > div:last-child
    > .g-btn-primary:last-child {
    width: 100%;
  }
}

/* Home (wallet), from the prototype's GS-H2v1 screen. */
[data-theme="graici"] {
  --g-home-accent: #FF8847;
}

/* Theme-scoped to outrank the 640px .g-page padding and clear the Ask Graici bar. */
[data-theme="graici"] .g-home-page { padding-bottom: 128px; }
.g-home-hello { margin-top: 8px; font-size: 17px; font-weight: 600; color: var(--g-teal-600); }
/* Members without a first name see their username, which is often an email. */
.g-home-name { font-size: 38px; font-weight: 700; line-height: 1.1; color: var(--g-ink); overflow-wrap: anywhere; }
.g-home-h { margin: 28px 0 12px; font-size: 21px; font-weight: 600; color: var(--g-ink); }

.g-home-card {
  padding: 20px;
  border-radius: var(--g-r-lg);
  background: var(--g-surface);
  box-shadow: 0 4px 18px -6px rgba(35, 44, 39, .16);
}
.g-home-card__head { display: flex; align-items: flex-start; gap: 12px; }
.g-home-card__ico {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #F4F1EB;
  color: var(--g-ink-2);
}
.g-home-card__title { font-size: 19px; font-weight: 600; line-height: 1.25; color: var(--g-ink); }
.g-home-card__sub { margin-top: 2px; font-size: 15px; color: var(--g-teal-600); }
.g-home-pill {
  flex: none;
  margin-left: auto;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.g-home-pill--active { background: var(--g-home-accent); color: #040404; }
.g-home-pill--idle { background: var(--g-idle-050); color: var(--g-idle); }

/* Laid out for exactly three phases (build_renewal_card in wallet/services/home.py):
   edge-aligned ends and a centred middle. --g-home-fill (0-100) is set inline. */
.g-home-steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 22px 0 20px;
}
.g-home-steps::before,
.g-home-steps::after {
  content: "";
  position: absolute;
  top: 15px;
  left: 16px;
  height: 2px;
}
.g-home-steps::before { right: 16px; background: var(--g-line-strong); }
.g-home-steps::after { width: calc((100% - 32px) * var(--g-home-fill, 0) / 100); background: var(--g-primary); }
.g-home-step { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; text-align: center; }
.g-home-step:first-child { align-items: flex-start; text-align: left; }
.g-home-step:last-child { align-items: flex-end; text-align: right; }
.g-home-dot {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 2px solid var(--g-line-strong);
  background: var(--g-surface);
  color: #fff;
}
.g-home-step--done .g-home-dot { border-color: var(--g-primary); background: var(--g-primary); }
.g-home-step--current .g-home-dot {
  border: 4px solid var(--g-border, #DCDCDC);
  background: var(--g-home-accent);
}
.g-home-step__label { margin-top: 8px; font-size: 15px; font-weight: 600; color: var(--g-teal-600); }
.g-home-step--current .g-home-step__label { color: var(--g-ink); }
.g-home-step--upcoming .g-home-step__label { font-weight: 500; }
.g-home-step__detail { font-size: 14px; color: var(--g-teal-600); }
.g-home-step--current .g-home-step__detail { font-weight: 600; }

.g-home-card .g-home-cta { width: 100%; min-height: 52px; font-size: 17px; }
.g-home-link { display: block; margin-top: 12px; text-align: center; font-size: 15px; font-weight: 600; color: var(--g-teal-600); }

.g-home-list { padding: 4px 20px; border-radius: var(--g-r-lg); background: var(--g-surface); box-shadow: 0 4px 18px -6px rgba(35, 44, 39, .16); }
.g-home-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  font-size: 17px;
  font-weight: 600;
  color: var(--g-ink);
}
.g-home-list > li + li { border-top: 1px solid var(--g-line); }
.g-home-item::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--g-home-accent);
}
.g-home-item__t { flex: 1 1 auto; min-width: 0; }
.g-home-item .g-ico { flex: none; color: var(--g-ink-2); }

.g-home-item--done::before { background: var(--g-ok); }
.g-home-item__d { display: block; font-size: 14px; font-weight: 500; color: var(--g-teal-600); }
.g-home-item__cta { flex: none; font-size: 15px; font-weight: 600; color: var(--g-teal-600); }
.g-home-item--done { padding-block: 10px; }

/* Member onboarding ("Getting started"), one phone-width column at every size. */
.g-onb {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--g-surface);
}
.g-onb__bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  padding: 6px 8px;
  border-bottom: 1px solid var(--g-line);
  background: var(--g-surface);
}
.g-onb__icon-btn { display: grid; place-items: center; width: 48px; height: 48px; color: var(--g-ink); }
.g-onb__title { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--g-ink); }
.g-onb__progress { width: 104px; height: 3px; overflow: hidden; border-radius: 999px; background: var(--g-line); }
.g-onb__progress > span { display: block; height: 100%; background: var(--g-primary); }
.g-onb__form { display: flex; flex: 1; flex-direction: column; }
.g-onb__body { flex: 1; padding: 28px 20px 24px; }
.g-onb__avatar {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 24px;
  border-radius: 14px;
  background: var(--g-primary);
  color: #fff;
}
.g-onb__h { font-size: 24px; font-weight: 700; line-height: 1.25; color: var(--g-ink); }
.g-onb__h--xl { font-size: 32px; }
.g-onb__lede { margin-top: 10px; font-size: 16px; line-height: 1.5; color: var(--g-teal-600); }
.g-onb__panel { margin-top: 24px; padding: 16px; border: 1px solid var(--g-line); border-radius: var(--g-r-lg); }
.g-onb__panel--sand { border-color: transparent; background: #F4F1EB; }
.g-onb__eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--g-teal-600); }
.g-onb__points { display: grid; gap: 12px; margin-top: 12px; font-size: 15px; color: var(--g-ink); }
.g-onb__points li { display: flex; align-items: flex-start; gap: 12px; }
.g-onb__points .g-ico { flex: none; margin-top: 3px; }
.g-onb__dot { flex: none; width: 14px; height: 14px; margin-top: 4px; border-radius: 999px; background: var(--g-teal-600); }
.g-onb__check {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--g-line-strong);
  border-radius: 12px;
  font-size: 15px;
  color: var(--g-ink);
  cursor: pointer;
}
.g-onb__check a { font-weight: 700; text-decoration: underline; }
.g-onb__check input[type="checkbox"] {
  flex: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border: 2px solid var(--g-primary);
  border-radius: 4px;
  background: var(--g-surface) center / 16px no-repeat;
  cursor: pointer;
}
.g-onb__check input[type="checkbox"]:checked {
  background: var(--g-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5'/%3E%3C/svg%3E") center / 16px no-repeat;
}
.g-onb__check input[type="checkbox"]:focus-visible { outline: 2px solid var(--g-primary); outline-offset: 2px; }
.g-onb__label { display: block; margin-top: 28px; font-size: 17px; font-weight: 600; color: var(--g-ink); }
.g-onb__select {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 0 14px;
  border: 1px solid var(--g-line-strong);
  border-radius: 12px;
  color: var(--g-ink);
}
.g-onb__select select { flex: 1; min-height: 52px; border: 0; background: transparent; font-size: 16px; font-weight: 600; color: var(--g-ink); }
.g-onb__select select:focus { outline: none; }
.g-onb__select:focus-within { outline: 2px solid var(--g-primary); outline-offset: 2px; }
.g-onb__error { margin-top: 6px; font-size: 14px; color: var(--g-danger); }
.g-onb__actions {
  position: sticky;
  bottom: 0;
  padding: 12px 20px max(16px, env(safe-area-inset-bottom));
  background: var(--g-surface);
}
.g-onb__cta { width: 100%; }
.g-onb__doc { font-size: 15px; line-height: 1.6; }
.g-onb__choices { display: grid; gap: 10px; margin-top: 24px; }
.g-onb__choice {
  display: block;
  padding: 16px;
  border: 1px solid var(--g-line-strong);
  border-radius: 12px;
  cursor: pointer;
}
.g-onb__choice:has(input[type="radio"]:checked) { border-color: var(--g-primary); background: #F4F1EB; }
.g-onb__choice:has(input[type="radio"]:focus-visible) { outline: 2px solid var(--g-primary); outline-offset: 2px; }
.g-onb__choice-row { display: flex; align-items: center; gap: 12px; }
/* The card is the control; the native radio stays for keyboards and screen readers. */
.g-onb__choice input[type="radio"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.g-onb__choice-t { flex: 1; font-size: 16px; font-weight: 600; color: var(--g-ink); }
.g-onb__tick {
  display: none;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--g-primary);
  color: #fff;
}
.g-onb__choice:has(input[type="radio"]:checked) .g-onb__tick { display: grid; }
.g-onb__due { display: none; margin-top: 14px; }
.g-onb__choice:has(input[value="have_letter"]:checked) .g-onb__due { display: grid; gap: 8px; }
.g-onb__due-l { font-size: 15px; font-weight: 600; color: var(--g-ink); }
.g-onb__optional { font-weight: 500; color: var(--g-teal-600); }
.g-onb__due input[type="date"] {
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--g-line-strong);
  border-radius: 10px;
  background: var(--g-surface);
  font-size: 16px;
  color: var(--g-ink);
}
.g-onb__hint { font-size: 13px; color: var(--g-teal-600); }

/* Ask Graici docked under Home as a pill-shaped input. It sits
   in the same column as the page and opens the page's chat popover. */
.g-home-ask {
  position: fixed;
  bottom: 0;
  left: 50%;
  z-index: 40;
  width: min(100%, var(--app-max-width));
  padding: 24px var(--g-gut) calc(16px + var(--g-safe-b));
  transform: translateX(-50%);
  background: linear-gradient(to bottom, rgba(244, 247, 243, 0), var(--g-canvas) 24px);
}
.g-home-ask__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 64px;
  padding: 6px 6px 6px 24px;
  border: 1px solid var(--g-line-strong);
  border-radius: 999px;
  background: var(--g-surface);
}
.g-home-ask__bar:focus-within { border-color: var(--g-teal); box-shadow: var(--g-focus); }
.g-home-ask__input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 18px;
  color: var(--g-ink);
  outline: none;
}
.g-home-ask__input::placeholder { color: var(--g-teal-600); }
.g-home-ask__btn {
  display: grid;
  flex: none;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: var(--g-primary);
  color: #fff;
  transition: opacity 150ms ease-out;
}
.g-home-ask__btn svg { width: 22px; height: 22px; }
.g-home-ask__btn:hover { opacity: .9; }
.g-home-ask__btn:focus-visible { outline: none; box-shadow: var(--g-focus); }
.g-home-ask__btn[data-state="recording"] { background: var(--g-home-accent); color: #040404; }
.g-home-ask__btn[aria-busy="true"] { opacity: .6; }

/* Home's chat takes over the screen in the page's column instead of floating
   over it. --g-chat-top / --g-chat-h follow the visual viewport (set in
   home-ask.js) so the composer stays above a phone's keyboard. */
.g-chat-screen {
  position: fixed;
  inset: var(--g-chat-top, 0px) auto auto 50%;
  width: min(100%, var(--app-max-width));
  height: var(--g-chat-h, 100dvh);
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-inline: 1px solid var(--graici-chat-border);
  background: var(--graici-chat-canvas);
  transform: translateX(-50%);
}
@media (max-width: 639px) {
  .g-chat-screen { border-inline: 0; }
}
body:has(.g-chat-screen:popover-open) { overflow: hidden; }
.g-chat-screen__back {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 0 10px 0 4px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  color: var(--g-ink);
}
.g-chat-screen__back:hover { background: var(--graici-chat-hover); }
.g-chat-screen__back:focus-visible { outline: none; box-shadow: var(--g-focus); }
