/* ── Agent IV theme ───────────────────────────────────────────────────────
   Palette taken from the Caras Group office: charcoal ink Austin skyline on
   warm plaster, walnut and brass. Light is the default; dark switches on the
   device setting. `[data-theme]` beats the media query by specificity, so a
   manual override can win in either direction later.

   Agent branding (logo + colors from the Branding page) applies to the
   generated PDFs, which are rendered server-side. It has never driven the app
   chrome — the old --brand-* vars were referenced but never set, so every
   page always used the literal fallback. The chrome is Agent IV's own.
   ------------------------------------------------------------------------ */
:root {
  /* Native control chrome (date-picker glyph, checkboxes, scrollbars)
     follows this; without it dark mode paints a black icon on a black
     field (#48). Per block, so a manual [data-theme] wins too. */
  color-scheme: light;
  --ground:       #EDE7DA;
  --ink:          #2A2522;
  --muted:        #6E6558;
  --faint:        #635B4E;
  --panel:        #FBF9F4;
    --panel-glass:  rgba(251, 249, 244, .86);
    --panel-edge:   #C7BA9C;
  --panel-line:   #DED5C2;
  --panel-shadow: 0 1px 2px rgba(42,37,34,.07), 0 14px 38px rgba(42,37,34,.13);
  --field:        #FFFFFF;
  --field-line:   #D8D0BE;
  --soft:         #F2EDE2;
  --soft-line:    #E2DBCA;
  --accent:       #82632B;
  --on-accent:    #FBF9F4;
  --btn-bg:       #2A2522;
  --btn-bg-hover: #3D3733;
  --btn-fg:       #FBF9F4;
    --danger:       #C0392B;
  --success:      #2E7D32;
--warn:         #A8730C;
  /* Mortgage Calculator's balance chart: brass for the loan as entered, and
     verdigris (brass's own patina) for the dashed standard schedule, the
     nearest hue that stays apart from brass for colour-blind readers. */
  --chart-1:      #866110;
  --chart-ref:    #008472;
  --pill:         #E0D8C6;
  --pill-fg:      #2A2522;
  --overlay:      rgba(42,37,34,.62);
  --sky:          url("/skyline-light.svg");
    --base: linear-gradient(to bottom,
                          rgba(155,150,141,0) var(--floor),
                          #9B968D calc(var(--floor) + 150px), #9B968D 100%);
  --footfade: linear-gradient(to bottom,
                          rgba(237,231,218,0) calc(var(--floor) + 190px),
                          #EDE7DA calc(var(--floor) + 420px), #EDE7DA 100%);
  --veil: linear-gradient(180deg, #EDE7DA 0,
                          rgba(237,231,218,.70) calc(var(--band) * .34),
                          rgba(237,231,218,.60) calc(var(--band) * .72),
                          rgba(237,231,218,.60) 100%);
  --grain:        url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNDAiIGhlaWdodD0iMjQwIj48ZmlsdGVyIGlkPSJwIj48ZmVUdXJidWxlbmNlIHR5cGU9ImZyYWN0YWxOb2lzZSIgYmFzZUZyZXF1ZW5jeT0iMC44NSIgbnVtT2N0YXZlcz0iNCIgc2VlZD0iNCIvPjxmZUNvbG9yTWF0cml4IHR5cGU9InNhdHVyYXRlIiB2YWx1ZXM9IjAiLz48L2ZpbHRlcj48cmVjdCB3aWR0aD0iMjQwIiBoZWlnaHQ9IjI0MCIgZmlsdGVyPSJ1cmwoI3ApIiBvcGFjaXR5PSIuMDU1Ii8+PC9zdmc+");
  --grain-blend:  multiply;
  --band:         min(96vh, 760px);
  --sky-h:        calc(var(--band) * 3200 / 620);
  --floor:        700px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
           "Times New Roman", serif;

  /* Aliases still referenced by a few inline page styles. */
  --gold: var(--accent);
  --grey: var(--muted);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground:       #131110;
    --ink:          #F2EDE2;
    --muted:        #AFA598;
    --faint:        #9A9086;
    --panel:        #262220;
      --panel-glass:  rgba(45, 41, 38, .92);
    --panel-edge:   #7A7165;
  --panel-line:   #3A3430;
    --panel-shadow: 0 1px 2px rgba(0,0,0,.40), 0 16px 40px rgba(0,0,0,.66);
    --field:        #1F1C1A;
    --field-line:   #453E39;
    --soft:         #221F1D;
    --soft-line:    #3A3430;
    --accent:       #C9A24B;
    --on-accent:    #131110;
    --btn-bg:       #C9A24B;
    --btn-bg-hover: #D9B463;
    --btn-fg:       #131110;
      --danger:       #E06C5F;
  --success:      #6FBF7A;
--warn:         #F0B429;
  --chart-1:      #B88E2E;
  --chart-ref:    #008472;
  --pill:         rgba(237,231,218,.10);
    --pill-fg:      #F2EDE2;
    --overlay:      rgba(10,9,8,.78);
    --sky:          url("/skyline-dark.svg");
      --base: linear-gradient(to bottom,
                          rgba(84,81,77,0) var(--floor),
                          #54514D calc(var(--floor) + 150px), #54514D 100%);
  --footfade: linear-gradient(to bottom,
                          rgba(19,17,16,0) calc(var(--floor) + 190px),
                          #131110 calc(var(--floor) + 420px), #131110 100%);
  --veil: linear-gradient(180deg, rgba(19,17,16,.95) 0,
                          rgba(19,17,16,.72) calc(var(--band) * .34),
                          rgba(19,17,16,.60) calc(var(--band) * .72),
                          rgba(19,17,16,.60) 100%);
    --grain:        url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNDAiIGhlaWdodD0iMjQwIj48ZmlsdGVyIGlkPSJwIj48ZmVUdXJidWxlbmNlIHR5cGU9ImZyYWN0YWxOb2lzZSIgYmFzZUZyZXF1ZW5jeT0iMC44NSIgbnVtT2N0YXZlcz0iNCIgc2VlZD0iOSIvPjxmZUNvbG9yTWF0cml4IHR5cGU9InNhdHVyYXRlIiB2YWx1ZXM9IjAiLz48L2ZpbHRlcj48cmVjdCB3aWR0aD0iMjQwIiBoZWlnaHQ9IjI0MCIgZmlsdGVyPSJ1cmwoI3ApIiBvcGFjaXR5PSIuMDciLz48L3N2Zz4=");
    --grain-blend:  overlay;
  }
}


:root[data-theme="light"] {
  color-scheme: light;
  --ground:       #EDE7DA;
  --ink:          #2A2522;
  --muted:        #6E6558;
  --faint:        #635B4E;
  --panel:        #FBF9F4;
    --panel-glass:  rgba(251, 249, 244, .86);
    --panel-edge:   #C7BA9C;
  --panel-line:   #DED5C2;
  --panel-shadow: 0 1px 2px rgba(42,37,34,.07), 0 14px 38px rgba(42,37,34,.13);
  --field:        #FFFFFF;
  --field-line:   #D8D0BE;
  --soft:         #F2EDE2;
  --soft-line:    #E2DBCA;
  --accent:       #82632B;
  --on-accent:    #FBF9F4;
  --btn-bg:       #2A2522;
  --btn-bg-hover: #3D3733;
  --btn-fg:       #FBF9F4;
    --danger:       #C0392B;
  --success:      #2E7D32;
--warn:         #A8730C;
  --chart-1:      #866110;
  --chart-ref:    #008472;
  --pill:         #E0D8C6;
  --pill-fg:      #2A2522;
  --overlay:      rgba(42,37,34,.62);
  --sky:          url("/skyline-light.svg");
    --base: linear-gradient(to bottom,
                          rgba(155,150,141,0) var(--floor),
                          #9B968D calc(var(--floor) + 150px), #9B968D 100%);
  --footfade: linear-gradient(to bottom,
                          rgba(237,231,218,0) calc(var(--floor) + 190px),
                          #EDE7DA calc(var(--floor) + 420px), #EDE7DA 100%);
  --veil: linear-gradient(180deg, #EDE7DA 0,
                          rgba(237,231,218,.70) calc(var(--band) * .34),
                          rgba(237,231,218,.60) calc(var(--band) * .72),
                          rgba(237,231,218,.60) 100%);
  --grain:        url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNDAiIGhlaWdodD0iMjQwIj48ZmlsdGVyIGlkPSJwIj48ZmVUdXJidWxlbmNlIHR5cGU9ImZyYWN0YWxOb2lzZSIgYmFzZUZyZXF1ZW5jeT0iMC44NSIgbnVtT2N0YXZlcz0iNCIgc2VlZD0iNCIvPjxmZUNvbG9yTWF0cml4IHR5cGU9InNhdHVyYXRlIiB2YWx1ZXM9IjAiLz48L2ZpbHRlcj48cmVjdCB3aWR0aD0iMjQwIiBoZWlnaHQ9IjI0MCIgZmlsdGVyPSJ1cmwoI3ApIiBvcGFjaXR5PSIuMDU1Ii8+PC9zdmc+");
  --grain-blend:  multiply;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
           "Times New Roman", serif;

  /* Aliases still referenced by a few inline page styles. */
  --gold: var(--accent);
  --grey: var(--muted);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ground:       #131110;
  --ink:          #F2EDE2;
  --muted:        #AFA598;
  --faint:        #9A9086;
  --panel:        #262220;
    --panel-glass:  rgba(45, 41, 38, .92);
    --panel-edge:   #7A7165;
  --panel-line:   #3A3430;
  --panel-shadow: 0 1px 2px rgba(0,0,0,.40), 0 16px 40px rgba(0,0,0,.66);
  --field:        #1F1C1A;
  --field-line:   #453E39;
  --soft:         #221F1D;
  --soft-line:    #3A3430;
  --accent:       #C9A24B;
  --on-accent:    #131110;
  --btn-bg:       #C9A24B;
  --btn-bg-hover: #D9B463;
  --btn-fg:       #131110;
    --danger:       #E06C5F;
  --success:      #6FBF7A;
--warn:         #F0B429;
  --chart-1:      #B88E2E;
  --chart-ref:    #008472;
  --pill:         rgba(237,231,218,.10);
  --pill-fg:      #F2EDE2;
  --overlay:      rgba(10,9,8,.78);
  --sky:          url("/skyline-dark.svg");
    --base: linear-gradient(to bottom,
                          rgba(84,81,77,0) var(--floor),
                          #54514D calc(var(--floor) + 150px), #54514D 100%);
  --footfade: linear-gradient(to bottom,
                          rgba(19,17,16,0) calc(var(--floor) + 190px),
                          #131110 calc(var(--floor) + 420px), #131110 100%);
  --veil: linear-gradient(180deg, rgba(19,17,16,.95) 0,
                          rgba(19,17,16,.72) calc(var(--band) * .34),
                          rgba(19,17,16,.60) calc(var(--band) * .72),
                          rgba(19,17,16,.60) 100%);
  --grain:        url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNDAiIGhlaWdodD0iMjQwIj48ZmlsdGVyIGlkPSJwIj48ZmVUdXJidWxlbmNlIHR5cGU9ImZyYWN0YWxOb2lzZSIgYmFzZUZyZXF1ZW5jeT0iMC44NSIgbnVtT2N0YXZlcz0iNCIgc2VlZD0iOSIvPjxmZUNvbG9yTWF0cml4IHR5cGU9InNhdHVyYXRlIiB2YWx1ZXM9IjAiLz48L2ZpbHRlcj48cmVjdCB3aWR0aD0iMjQwIiBoZWlnaHQ9IjI0MCIgZmlsdGVyPSJ1cmwoI3ApIiBvcGFjaXR5PSIuMDciLz48L3N2Zz4=");
  --grain-blend:  overlay;
}


*, *::before, *::after { box-sizing: border-box; }

/* Platform wordmark shown on every page (agent brand stays the headline). */
.powered {
  text-align: center;
  color: var(--faint);
  font-size: 0.78rem;
  letter-spacing: 0.3px;
  margin: 1.4rem 0 0.5rem;
}
.powered b { color: var(--accent); font-weight: 700; }

/* The `hidden` attribute must win over element display rules below. */
[hidden] { display: none !important; }

/* A calculator page (and the Investment Analysis) shows nothing until
   auth.js has checked the account's plan (data-plan-gate; owner decision
   2026-10-05 — nothing opens before an application is approved, the
   calculators included). Laid out but unseen, so nothing can be typed into
   and nothing moves when it appears. */
html[data-plan-gate] main,
html[data-plan-gate] body > .wrap { visibility: hidden; }

/* The access rule (owner 2026-10-14): a tool page whose account isn't
   charged and verified shows ONE card in place of the tool — what's locked,
   why, and the step that lifts it (auth.js showLock). The page's own parts
   are taken out of it, not hidden: nothing of the tool is seen or typed
   into, page styles or none (access review 4 #6). */
.aiv-lock { text-align: center; }
.aiv-lock .aiv-lock-home { text-align: left; margin-bottom: 0.5rem; }
.aiv-lock .aiv-lock-home a { color: var(--muted); text-decoration: none; font-size: 0.85rem; }
.aiv-lock .aiv-lock-tool {
  margin: 0.4rem 0 0.2rem; color: var(--accent); font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
}
.aiv-lock .aiv-lock-badge {
  display: inline-block; margin: 0.35rem 0 0.9rem; background: var(--pill); color: var(--pill-fg);
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.22rem 0.6rem; border-radius: 999px;
}
.aiv-lock h1 { font-size: 1.55rem; }
.aiv-lock .aiv-lock-detail {
  color: var(--muted); font-size: 0.95rem; line-height: 1.6; margin: 0.6rem 0 0;
  overflow-wrap: anywhere;
}
.aiv-lock .aiv-lock-go { margin-top: 1.4rem; }

/* NOT LEGAL ADVICE (legal N9, owner approved 2026-10-28). Texas keeps software out of the
   practice of law only if it "clearly and conspicuously" says it is not a substitute for the
   advice of an attorney (Gov't Code §81.101(c)), so the research's exact words sit at the top
   of the screens that touch the law — the CMA Generator, Review & Sign and Branding — on every
   visit, with no close button. */
.legal-banner {
  margin: 0 0 1.1rem; padding: 0.6rem 0.8rem; border-radius: 6px;
  background: var(--soft); border: 1px solid var(--soft-line); border-left: 3px solid var(--accent);
  color: var(--muted); font-size: 0.85rem; line-height: 1.5; text-align: left;
}
.legal-banner b { color: var(--ink); letter-spacing: 0.04em; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  /* A COLUMN: the card and the "Powered by" footer stack, card centered
     horizontally, the pair centered vertically. As a row, anything wider than
     a phone (iPad, laptop) put the footer BESIDE the card and nudged the card
     off-center; phones already stacked, and that is the look on every size. */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ink);
  padding: 1.5rem;

  /* Three layers, top to bottom: plaster grain, the fade that lifts content
     off the art, then the skyline itself. The skyline is a band anchored to
     the top of the document — sized to the full page it would sit below the
     fold. Each building runs to the bottom of its artboard and the veil fades
     it out, so there is no hard edge where the band ends. */
  background-color: var(--ground);
  background-image: var(--grain), var(--footfade), var(--veil),
                    var(--base), var(--sky);
  background-repeat: repeat, no-repeat, no-repeat, no-repeat, no-repeat;
  background-size: 240px 240px, 100% 100%, 100% var(--sky-h),
                   100% 100%, auto var(--sky-h);
  background-position: top left, top center, top center,
                       top center, top center;
  background-blend-mode: var(--grain-blend), normal, normal, normal, normal;
}

/* Flex items default to min-width:auto, so they refuse to shrink below their
   content. Every page but the landing one lays its body out as flex, which
   meant a single wide child — a seven-column table, a long unbroken string —
   stretched past the viewport and scrolled the WHOLE page sideways instead of
   overflowing inside itself. Letting body's children shrink confines the
   overflow to the element that actually has it. */
body > * { min-width: 0; }

.card {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 3px;
  box-shadow: var(--panel-shadow);
  padding: 2.5rem;
  width: 100%;
  max-width: 480px;
  text-align: center;
  border-top: 3px solid var(--accent);
}

h1 {
  margin: 0 0 0.35rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.9rem;
  letter-spacing: 0.3px;
}

.tagline {
  color: var(--muted);
  margin: 0 0 1.75rem;
  font-size: 0.95rem;
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

input, select {
  padding: 0.85rem 1rem;
  font-size: 1rem;
  border: 1.5px solid var(--field-line);
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s;
  background: var(--field);
  color: var(--ink);
}

input:focus, select:focus { border-color: var(--accent); }

/* Date and time boxes on an iPad or iPhone (Safari): the box keeps a wide minimum of its own
   and ignored its column, so side by side it spilled into the next box (owner's photo of his
   mom's iPad, Open House, 2026-11-08). It now fits its column like the other boxes, with its
   text on the left, and stays their height while empty. A row's columns may shrink to fit.
   Only where a box is given its column's width — a form's .field, Listings' .f, a listing
   video's open-house rows (sweep 11 C3): a box sized by its own width (the team appointment
   editors' width:auto) keeps Safari's own date box, which an empty plain box shrinks to a sliver. */
:where(.field, .f, .lv-ov-row) :where(input[type="date"], input[type="time"], input[type="month"],
  input[type="datetime-local"]) {
  -webkit-appearance: none; appearance: none;
  min-width: 0; max-width: 100%;
}
.field :where(input[type="date"], input[type="time"], input[type="month"], input[type="datetime-local"]) {
  min-height: calc(2.95rem + 3px);
}
:where(.field, .f, .lv-ov-row) :where(input[type="date"], input[type="time"], input[type="month"],
  input[type="datetime-local"])::-webkit-date-and-time-value { text-align: left; min-height: 1.2em; }
.row2 > * { min-width: 0; }

/* File inputs have a wide intrinsic minimum (button + filename text) and, as
   flex children, refuse to shrink — which overflows the card on phones.
   min-width:0 lets them shrink to the container. */
input[type="file"] { width: 100%; min-width: 0; max-width: 100%; }

button {
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

button:hover:not(:disabled) { background: var(--btn-bg-hover); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.status {
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 1.2em;
}

.status.error { color: var(--danger); }

.download {
  display: inline-block;
  margin-top: 1.25rem;
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
}

.download:hover { filter: brightness(1.05); }

/* Share PDF (share.js): next to Download, the phone's own share sheet — the
   home-screen app has no Safari share button. Outlined: Download stays the
   main action. */
.download.share-pdf {
  margin-left: 0.5rem;
  border: 0;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--accent);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}
.download.share-pdf:hover:not(:disabled) { filter: none; background: transparent; }
@media (hover: hover) {
  .download.share-pdf:hover:not(:disabled) { background: var(--soft); }
}
.download.share-pdf:disabled { opacity: 0.7; cursor: default; }
/* Phones: Share on its own line under Download (at 430–480px both would
   otherwise fit on one line, touching). */
@media (max-width: 480px) {
  .download.share-pdf { display: block; width: fit-content; margin: 0.6rem auto 0; }
}

/* ---- Auth: dev capture modal + header account widget -------------------- */
.cs-auth-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--overlay);
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.cs-auth-card {
  background: var(--panel); border-radius: 3px; width: 100%; max-width: 380px;
  padding: 1.8rem 1.7rem; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  border-top: 3px solid var(--accent); text-align: left;
}
.cs-auth-card h3 { margin: 0 0 0.3rem; color: var(--ink); font-size: 1.3rem;
  font-family: var(--serif); font-weight: 400; }
.cs-auth-card p { margin: 0 0 1.1rem; color: var(--muted); font-size: 0.9rem; }
.cs-auth-card label {
  display: block; font-size: 0.78rem; font-weight: 600;
  color: var(--ink); margin: 0.6rem 0 0.25rem;
}
.cs-auth-card input {
  width: 100%; padding: 0.7rem 0.8rem; font-size: 1rem;
  border: 1.5px solid var(--field-line); border-radius: 6px;
}
.cs-auth-card input:focus { border-color: var(--accent); outline: none; }
.cs-auth-card #cs-go {
  width: 100%; margin-top: 1.1rem; padding: 0.8rem; font-size: 1rem;
  font-weight: 700; color: var(--btn-fg); background: var(--btn-bg);
  border: none; border-radius: 6px; cursor: pointer;
}
.cs-auth-card #cs-go:hover { background: var(--btn-bg-hover); }
.cs-auth-card .cs-link {
  display: block; width: 100%; margin-top: 0.5rem; background: none;
  border: none; color: var(--muted); font-size: 0.85rem; cursor: pointer;
}
.cs-auth-err { color: var(--danger); font-size: 0.82rem; margin-top: 0.5rem; }

/* The welcome tour video (tour.js, beta "tour_video"): the same card, wider, with the poster
   on top; playing, as wide as the screen's height lets a 16:9 video be. */
.aiv-tour .cs-auth-card { position: relative; max-width: 460px; max-height: calc(100vh - 2rem);
  overflow-y: auto; padding-top: 2.6rem; }
.aiv-tour.playing .cs-auth-card { max-width: min(860px, calc((100vh - 10rem) * 16 / 9)); }
.aiv-tour .aiv-tour-x { position: absolute; top: 0.35rem; right: 0.4rem; width: 2.5rem; height: 2.5rem;
  margin: 0; padding: 0; border: none; background: none; color: var(--muted); font-size: 1.6rem;
  line-height: 1; cursor: pointer; border-radius: 50%; }
.aiv-tour .aiv-tour-x:hover { color: var(--ink); background: var(--soft); }
.aiv-tour .cs-link:hover:not(:disabled) { background: none; color: var(--ink); }
.aiv-tour .aiv-tour-poster:hover:not(:disabled) { background: none; }
/* content-box: the 16:9 is the area inside the 1px border, so a 16:9 video fills it with no black
   sliver along one edge (border-box letterboxed it by about 1.5px). */
.aiv-tour-frame { position: relative; aspect-ratio: 16 / 9; margin: 0 0 1.1rem; border-radius: 3px;
  overflow: hidden; background: #EDE7DA; border: 1px solid var(--panel-line); box-sizing: content-box; }
.aiv-tour-poster { display: block; width: 100%; height: 100%; margin: 0; padding: 0; border: none;
  background: none; cursor: pointer; position: relative; }
.aiv-tour-poster img { display: block; width: 100%; height: 100%; object-fit: cover; }
.aiv-tour-play { position: absolute; left: 50%; top: 78%; width: 3.1rem; height: 3.1rem;
  transform: translate(-50%, -50%); border-radius: 50%; background: var(--btn-bg);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); transition: transform .15s; }
.aiv-tour-play::after { content: ""; position: absolute; left: 54%; top: 50%; transform: translate(-50%, -50%);
  border-style: solid; border-width: 0.55rem 0 0.55rem 0.9rem;
  border-color: transparent transparent transparent var(--btn-fg); }
.aiv-tour-poster:hover .aiv-tour-play { transform: translate(-50%, -50%) scale(1.06); }
.aiv-tour-poster:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* scale: a hair of overscan inside the frame's overflow:hidden. The browser snaps the video's picture
   to whole device pixels, which left a 1px black row along one edge (the bottom in Chrome, the top in
   WebKit); 1.2% more covers it on every screen from 280px wide (0.6% left WebKit's on phones). */
.aiv-tour-video { display: block; width: 100%; height: 100%; background: #000; transform: scale(1.012); }
.aiv-tour.playing #aiv-tour-p, .aiv-tour.playing .aiv-tour-go { display: none; }
.aiv-tour.playing h3 { text-align: center; }
@media (max-width: 480px) {
  .aiv-tour { padding: 1rem; }
  .aiv-tour .cs-auth-card { padding: 2.5rem 1.2rem 1.3rem; }
  /* A tool's how-to video (the help guide's "Watch how"): a phone gives the video more width. */
  .aiv-tour.aiv-howto.playing { padding: 0.5rem; }
  .aiv-tour.aiv-howto.playing .cs-auth-card { padding: 2.6rem 0.6rem 0.9rem; }
}
/* A phone turned sideways (a tool's how-to video only, never the welcome tour): the video as big as the
   short screen lets a 16:9 be, with no card scroll; its title and the Close link give way, the x stays.
   pointer: coarse = a touch screen, so a short desktop window (or a laptop zoomed in) stays as it was. */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .aiv-tour.aiv-howto.playing { padding: 0.5rem; }
  .aiv-tour.aiv-howto.playing .cs-auth-card { max-width: calc((100vh - 5rem) * 16 / 9); padding: 2.6rem 0.6rem 0.6rem; }
  .aiv-tour.aiv-howto.playing .aiv-tour-frame { margin-bottom: 0; }
  .aiv-tour.aiv-howto.playing h3, .aiv-tour.aiv-howto.playing .aiv-tour-later { display: none; }
}
@media (prefers-reduced-motion: reduce) { .aiv-tour-play { transition: none; } }

.cs-account {
  position: absolute; top: 1.25rem; left: 1.5rem;
  font-size: 0.85rem; color: var(--faint);
}
.cs-account .cs-email { color: var(--ink); font-weight: 600; }
.cs-account a { color: var(--faint); text-decoration: none; font-weight: 600; }
.cs-account a:hover { color: var(--ink); }

/* ---- E&O review gate (AI reports: check before download) ---------------- */
.review-gate {
  display: flex; gap: 0.55rem; align-items: flex-start;
  margin: 1.1rem 0 0.35rem; padding: 0.75rem 0.9rem; border-radius: 6px;
  background: var(--soft); border: 1px solid var(--soft-line); font-size: 0.85rem;
  line-height: 1.4; color: var(--ink); text-align: left; cursor: pointer;
}
.review-gate input { margin-top: 0.15rem; flex-shrink: 0; cursor: pointer; }
/* Shown only when the affirmation couldn't be saved — the download stays
   shut in that case, so the agent needs to know why. */
#review-err { flex: 1 1 100%; margin-top: 0.4rem; color: var(--danger);
  font-weight: 600; font-size: 0.8rem; }

/* ---- In-browser PDF preview -------------------------------------------- */
.preview-box { margin: 1.1rem 0 0.25rem; text-align: left; }
.preview-head { display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.8rem; font-weight: 700; color: var(--ink); margin-bottom: 0.35rem; }
.preview-head a { font-weight: 600; color: var(--accent); text-decoration: none;
  font-size: 0.78rem; }
.preview-head a:hover { text-decoration: underline; }
/* The PDF itself is always a white page — keep its frame white in both themes
   so a dark surround doesn't read as part of the document. */
.preview-frame { width: 100%; height: 460px; border: 1px solid var(--field-line);
  border-radius: 6px; background: #fff; }

/* ---- Full-screen modal preview (My Reports) ---------------------------- */
.preview-modal { position: fixed; inset: 0; z-index: 1000;
  background: var(--overlay); display: flex; align-items: center;
  justify-content: center; padding: 1rem; }
/* Grid, not flex: Safari won't stretch an <iframe> flex child, so `flex: 1`
   collapses it to its intrinsic ~150px and the PDF shows as a sliver. A grid
   row of `1fr` sizes it correctly everywhere. */
.preview-modal-card { background: var(--panel); border-radius: 6px; width: 100%;
  max-width: 1100px; height: 94vh; display: grid; grid-template-rows: auto 1fr;
  overflow: hidden; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5); }
.preview-modal-head { display: flex; justify-content: space-between;
  align-items: center; padding: 0.7rem 1rem; border-bottom: 1px solid var(--soft-line);
  font-weight: 700; color: var(--ink); font-size: 0.95rem; gap: 1rem; }
.preview-modal-actions { display: flex; align-items: center; gap: 1rem; flex-shrink: 0; }
.preview-modal-head a { color: var(--accent); text-decoration: none;
  font-weight: 600; font-size: 0.82rem; }
.preview-modal-head button { background: none; border: none; font-size: 1.2rem;
  line-height: 1; cursor: pointer; color: var(--muted); padding: 0.2rem; }
.preview-modal-head button:hover { color: var(--ink); }
.preview-modal-frame { display: block; width: 100%; height: 100%;
  min-height: 0; border: none; background: #fff; }

/* A table that cannot fit a phone scrolls inside itself rather than widening
   the whole page. display:block keeps the cells' table roles (the browser
   generates an anonymous table box) so the columns still line up. A page that
   wants a nicer treatment opts out with .stack — admin.html turns its Teams
   table into labelled blocks that way. */
@media (max-width: 640px) {
  table:not(.stack) {
    display: block; width: 100%; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* On phones in portrait, side-by-side form columns don't fit — stack them.
   Landscape phones / tablets (>640px) keep the two-column layout. */
@media (max-width: 640px) {
  /* Larger screens center the card + footer stack vertically; on a phone the
     stack starts at the top so the heading is never pushed below the fold. */
  body { justify-content: flex-start; }
  /* The signed-in avatar is bigger than the old "Sign in" link — pinning it
     over the corner crowds page headings on a narrow screen. Let it flow. */
  .cs-account { position: static; order: -1; align-self: flex-start;
    padding: 0 0 0.75rem; }
  /* Same reasoning as the landing nav: the account link is a 16px text box,
     which is too small to hit accurately on a phone. */
  .cs-account a { display: inline-flex; align-items: center; min-height: 44px; }
  .row2, .previews { flex-direction: column; gap: 0.75rem; }
  .preview-modal-card { max-width: 100%; height: 100vh; border-radius: 0; }
}

/* Phones: Compare Homes' thin frame on every page (polish sweep 7, P7-10).
   A 1.5rem body around a card's 2.5rem left a 390-px iPhone a 260-px column,
   so titles, the two-choice switches and labels broke onto two lines; this
   leaves ~337 px. A page's own full-bleed maps run out by the card's 1rem. */
@media (max-width: 560px) {
  body { padding: 0.75rem 0.6rem; }
  .card { padding: 1.4rem 1rem 1.2rem; }
}

/* ---- Calculator "Advanced" disclosure -----------------------------------
   Every calculator tucks its optional inputs (seller credits, escrow, lender
   ratios…) behind a <details class="adv">. It used to be a small 0.85rem line
   agents scrolled straight past; now it's a full-width, button-like bar with
   a brass chevron and a SHOW / HIDE cue so nobody misses that those fields
   exist. Shared here so all five pages stay identical. */
details.adv {
  margin: 0.25rem 0 1rem; text-align: left;
  border: 1.5px solid var(--accent); border-radius: 10px;
  background: var(--soft);
}
details.adv > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.85rem 1rem; min-height: 48px; box-sizing: border-box;
  font-size: 1rem; font-weight: 700; color: var(--ink);
  border-radius: 9px;
}
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary:hover { background: var(--pill); }
details.adv > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Brass chevron — points right when closed, down when open. */
details.adv > summary::before {
  content: ""; flex: none; width: 0.5rem; height: 0.5rem;
  margin: 0 0.2rem 0 0.1rem;
  border-right: 2.5px solid var(--accent); border-bottom: 2.5px solid var(--accent);
  transform: rotate(-45deg); transition: transform .15s ease;
}
details.adv[open] > summary::before { transform: rotate(45deg); margin-bottom: 0.25rem; }
details.adv > summary::after {
  content: "Show"; margin-left: auto; flex: none;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--accent);
}
details.adv[open] > summary::after { content: "Hide"; }
details.adv[open] > summary {
  border-bottom: 1px solid var(--soft-line); border-radius: 9px 9px 0 0;
}
details.adv[open] { padding-bottom: 0.9rem; }
details.adv > :not(summary) { margin-left: 1rem; margin-right: 1rem; }
details.adv .row2 { margin-top: 0.6rem; }
/* The boxes keep their own width but never poke past the brass border: the
   panel's margins leave 2rem less room than the card, and on a narrow phone
   (the folded iPhone Duo beside the app's column) a number box's natural
   width is wider than what's left (owner's screenshot, 2026-10-29). */
details.adv input, details.adv select { max-width: 100%; }
details.adv .row2 .field { min-width: 0; }

/* A form's boxes fill their column (polish sweep 7, P7-11). The calculators,
   Branding, Verify and Open House set no width, so each box kept the
   browser's ~200 px (Loan Term ~55 px) and stopped short of the buttons and
   tiles around it. A checkbox, radio or colour swatch keeps its own size,
   and :where() lets a page's own width rule still win. Side by side (wider
   than a phone), a pair's boxes line up even when one label wraps. */
.field :where(input:not([type="checkbox"], [type="radio"], [type="color"]), select, textarea) { width: 100%; }
@media (min-width: 641px) { .row2 { align-items: flex-end; } }

/* Address autofill (address.js): suggestions under the #address box — on the
   calculator pages too, as wide as the box (P7-11). */
.addr-wrap { position: relative; display: block; width: 100%; }
.addr-wrap > input { width: 100%; box-sizing: border-box; }
.addr-suggest { position: absolute; z-index: 950; left: 0; right: 0; top: calc(100% + 4px);
  margin: 0; padding: 0.25rem 0; list-style: none; text-align: left;
  background: var(--panel); border: 1.5px solid var(--panel-line); border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18); max-height: 18rem; overflow-y: auto; }
.addr-suggest li { padding: 0.6rem 0.9rem; cursor: pointer; font-size: 0.92rem;
  color: var(--ink); line-height: 1.35; }
.addr-suggest li span { color: var(--muted); font-size: 0.85rem; }
.addr-suggest li.on, .addr-suggest li[data-i]:hover { background: var(--soft); }
.addr-suggest li.addr-by { cursor: default; font-size: 0.7rem; color: var(--faint);
  padding: 0.35rem 0.9rem 0.2rem; border-top: 1px solid var(--soft-line); }
