/*
 * The client portal (Services plan 2026-09-19-004 U10; origin spec §14.1, §14.2).
 *
 * ONE fixed layout. A provider's brand reaches it ONLY through the custom
 * properties the server computes from three tenant-selected colour seeds (src/services/brand.ts,
 * `brandCssVariables`) and writes into #runtime-brand-style:
 *
 *   --brand-primary  --brand-on-primary  --brand-accent  --brand-on-accent
 *   --brand-soft     --brand-border      --brand-hover   --brand-pressed
 *   --brand-ink
 *
 * The tenant's attention seed drives "your move". Item status semantics remain
 * platform-owned. The values below are fallbacks for a page served without a
 * resolved tenant or Service brand.
 *
 * Neutrals (text, surfaces, lines), spacing, shapes and typefaces are fixed
 * here and are not brand inputs.
 */
@font-face { font-family: "DM Sans"; src: url("/fonts/DMSans-Variable.ttf") format("truetype"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/IBMPlexMono-Regular.ttf") format("truetype"); font-weight: 400 700; font-style: normal; font-display: swap; }

:root {
  --brand-primary: #14b8a6;
  --brand-on-primary: #000000;
  --brand-accent: #f4b942;
  --brand-on-accent: #000000;
  --brand-soft: #e8f8f6;
  --brand-soft-on-surface: #e8f8f6;
  --brand-border: #b9eae4;
  --brand-hover: #12a292;
  --brand-pressed: #109082;
  --brand-ink: #0b6b61;
  --brand-canvas: #f5f7f8;
  --brand-on-canvas: #000000;
  --brand-surface: #ffffff;
  --brand-on-surface: #000000;
  --brand-muted: #566273;
  --brand-surface-muted: #566273;
  --brand-line: #dfe4ea;
  --brand-ink-on-surface: #0b6b61;
  --brand-focus: #1a4fd6;
  --brand-focus-on-surface: #1a4fd6;
  --brand-attention: var(--brand-accent);
  --brand-on-attention: var(--brand-on-accent);
  --your-move: var(--brand-attention);
  --your-move-ink: #ffffff;
  --status-accepted: #1f7a4d;
  --status-returned: #b3261e;
  --status-checking: #5b6472;
  --status-requested: #a86608;

  --portal-text: var(--brand-on-canvas);
  --portal-muted: var(--brand-muted);
  --portal-line: var(--brand-line);
  --portal-surface: var(--brand-surface);
  --portal-surface-text: var(--brand-on-surface);
  --portal-surface-muted: var(--brand-surface-muted);
  --portal-page: var(--brand-canvas);
  --portal-danger: #b3261e;
  --portal-radius: 8px;
  --portal-focus: var(--brand-focus);
  --portal-focus-on-surface: var(--brand-focus-on-surface);
  --portal-warm-line: var(--brand-line);
  --portal-warm-muted: var(--brand-surface-muted);
  --portal-warm-soft: color-mix(in srgb, var(--portal-surface-text) 3%, var(--portal-surface));
  --portal-shadow: color-mix(in srgb, var(--portal-text) 8%, transparent);
  /* The app's type system (plan 2026-09-26-002 KTD7), self-hosted (KTD1).
     The older names stay as aliases for request-view.css and other rules. */
  --font-sans: "DM Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --font-ui: var(--font-sans);
  --font-display: var(--font-sans);
  --font-label: var(--font-mono);
  --portal-card-radius: 18px;
  --portal-tile-radius: 16px;
  --portal-control-radius: 10px;
  --portal-soft: color-mix(in srgb, var(--portal-surface-text) 3%, var(--portal-surface));
  --portal-track: color-mix(in srgb, var(--portal-surface-text) 8%, var(--portal-surface));
  --portal-card-shadow: 0 18px 40px -24px color-mix(in srgb, var(--portal-text) 22%, transparent);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--portal-page);
  color: var(--portal-text);
  font: 15px/1.55 var(--font-sans);
}

[hidden] { display: none !important; }

/* The service workspace keeps one readable list, with compact status/actions. */
.rv-service-list .rv-list-head { gap: 20px; align-items: center; margin-bottom: 24px; }
.rv.rv-service-list .rv-list-head h1 { font-family: var(--font-ui); font-size: clamp(1.5rem, 2.4vw, 1.875rem); max-width: 900px; }
.rv.rv-service-list h2 { font-family: var(--font-ui); font-size: 1.25rem; margin-bottom: 8px; }
.rv-service-list .rv-list-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0; }
.rv-service-list .rv-list-filters { display: flex; flex-wrap: wrap; gap: 4px; }
.rv-service-list .rv-list-filters button,
.rv-service-list select { font: inherit; font-size: .8125rem; min-height: 40px; border: 1px solid var(--portal-line); border-radius: 6px; padding: 8px 12px; color: var(--portal-surface-text); background: var(--portal-surface); cursor: pointer; }
.rv-service-list .rv-list-filters button[aria-pressed="true"] { background: var(--brand-primary); color: var(--brand-on-primary); border-color: var(--brand-primary); }
.rv-service-list .rv-list-filters span { margin-left: 5px; font-variant-numeric: tabular-nums; }
.rv-service-list .rv-engagement-filter { display: flex; align-items: center; gap: 8px; }
.rv-service-list select { max-width: 280px; }
.rv-service-list .rv-table th:nth-child(1) { width: 40%; }
.rv-service-list .rv-table th:nth-child(2) { width: 23%; }
.rv-service-list .rv-table th:nth-child(3) { width: 22%; }
.rv-service-list .rv-table th:nth-child(4) { width: 15%; }
.rv-service-list .rv-status-detail { display: block; color: var(--portal-surface-muted); margin-top: 6px; }
.rv-service-list .rv-footnote { margin-top: 16px; }
.rv.rv-service-list .rv-view-btn { background: var(--portal-surface); color: var(--brand-ink-on-surface); border: 1px solid var(--portal-line); }
.rv.rv-service-list .rv-view-btn:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .rv-service-list .rv-list-head { align-items: flex-start; flex-direction: column; }
  .rv-service-list .rv-engagement-filter { width: 100%; }
  .rv-service-list select { min-width: 0; flex: 1; }
  .rv.rv-service-list .rv-table td { padding: 0; }
  .rv.rv-service-list .rv-table tr { padding: 20px; }
}

h1, h2, h3 { line-height: 1.3; margin: 0 0 12px; }
h1, h2 { font-family: var(--font-display); font-weight: 650; }
h1 { font-size: clamp(1.75rem, 3vw, 2.25rem); letter-spacing: -0.025em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 12px; }

a { color: var(--brand-ink); }

:focus-visible {
  outline: 3px solid var(--portal-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.portal-skip {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 10;
  padding: 8px 12px;
  background: var(--portal-surface);
  color: var(--portal-surface-text);
  --portal-focus: var(--portal-focus-on-surface);
  border-radius: 6px;
}
.portal-skip:focus { top: 8px; }
.portal-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Header ───────────────────────────────────────────────────────── */

.portal-header {
  background: var(--portal-surface);
  border-bottom: 1px solid var(--portal-line);
}
.portal-header, .portal-panel, .portal-card {
  color: var(--portal-surface-text);
  --portal-muted: var(--portal-surface-muted);
  --portal-focus: var(--portal-focus-on-surface);
  --brand-ink: var(--brand-ink-on-surface);
}
.portal-header-inner {
  width: 100%;
  min-height: 64px;
  padding: 10px clamp(20px, 2.5vw, 40px);
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.portal-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.portal-brand .logo-mark {
  width: 30px;
  height: 30px;
  object-fit: contain;
  border-radius: 6px;
  flex: none;
}
.portal-brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.portal-brand-text .logo-text { font-family: var(--font-display); font-size: 1rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-brand-sub { font-size: .75rem; color: var(--portal-muted); }

.portal-nav { display: flex; gap: 4px; margin-left: auto; }
/* Plan 2026-11-06-001 R8: no signed-in navigation for a signed-out visitor. */
.portal-signed-out .portal-nav { display: none; }
.portal-signed-out #portal-sign-in-open, .portal-signed-out #portal-account { margin-left: auto; }
.portal-nav a {
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--portal-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: .8125rem;
}
.portal-nav a:hover { background: var(--brand-soft-on-surface); color: var(--portal-surface-text); }
.portal-nav a[aria-current="page"] { color: var(--brand-ink-on-surface); background: var(--brand-soft-on-surface); }

.portal-account { position: relative; display: flex; align-items: center; color: var(--portal-muted); }
.portal-profile { height: 38px; display: flex; align-items: center; gap: 7px; padding: 0 9px 0 4px; border: 1px solid var(--portal-line); border-radius: 999px; background: var(--portal-surface); color: var(--portal-surface-text); cursor: pointer; }
.portal-profile:hover, .portal-profile[aria-expanded="true"] { border-color: var(--brand-border); background: var(--brand-soft-on-surface); }
.portal-avatar { width: 29px; height: 29px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--brand-soft-on-surface); color: var(--brand-ink-on-surface); font: 700 .64rem/1 var(--font-label); }
.portal-profile-chevron { width: 7px; height: 7px; border-right: 1.5px solid var(--portal-muted); border-bottom: 1.5px solid var(--portal-muted); transform: rotate(45deg) translateY(-2px); }
.portal-account-menu { position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; width: min(270px, calc(100vw - 28px)); padding: 7px; border: 1px solid var(--portal-line); border-radius: 10px; background: var(--portal-surface); box-shadow: 0 14px 36px var(--portal-shadow); color: var(--portal-surface-text); }
.portal-account-menu-head { display: flex; align-items: center; gap: 10px; padding: 9px; }
.portal-account-menu-head .portal-avatar { width: 34px; height: 34px; }
.portal-account-identity { min-width: 0; }
.portal-account-identity strong, .portal-account-identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-account-identity strong { font-size: .9rem; }
.portal-account-identity small { margin-top: 2px; color: var(--portal-muted); font-size: .76rem; }
.portal-account-menu-separator { height: 1px; margin: 5px; background: var(--portal-line); }
.portal-account-signout { width: 100%; min-height: 38px; display: flex; align-items: center; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--portal-danger); font: inherit; font-size: .86rem; text-align: left; cursor: pointer; }
.portal-account-signout:hover { background: color-mix(in srgb, var(--portal-danger) 7%, var(--portal-surface)); }

/* ── Main ─────────────────────────────────────────────────────────── */

.portal-main {
  flex: 1;
  width: 100%;
  padding: 28px clamp(20px, 2.5vw, 40px) 48px;
}
.portal-main:focus { outline: none; }

.portal-status { min-height: 0; margin: 0; color: var(--portal-muted); font-size: 0.9rem; }
.portal-status:not(:empty) { margin-bottom: 16px; }

.portal-panel {
  background: var(--portal-surface);
  border: 1px solid var(--portal-line);
  border-radius: var(--portal-radius);
  padding: 24px;
}
.portal-narrow { max-width: 460px; margin: 24px auto 0; }
/* Desk-like workspace: one table surface, not a panel around every panel. */
#portal-requests, #portal-request, #portal-engagement { background: transparent; border: 0; border-radius: 0; padding: 0; color: var(--portal-text); --portal-muted: var(--brand-muted); --portal-focus: var(--brand-focus); }
.rv-service-list .rv-list-filters { border-bottom: 1px solid var(--portal-line); gap: 14px; }
.rv-service-list .rv-list-filters button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--portal-muted); padding: 10px 2px; }
.rv-service-list .rv-list-filters button[aria-pressed="true"] { background: transparent; color: var(--portal-text); border-color: var(--brand-ink); }
.portal-catalog-head { margin-bottom: 28px; }
.portal-service-options { list-style: none; margin: 0; padding: 0; background: var(--portal-surface); border: 1px solid var(--portal-line); border-radius: 10px; overflow: hidden; }
.portal-service-options li + li { border-top: 1px solid var(--portal-line); }
.portal-service-option { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px; text-decoration: none; color: var(--portal-surface-text); --portal-focus: var(--portal-focus-on-surface); }
.portal-service-option:hover { background: var(--portal-warm-soft); }
.portal-service-option:focus-visible { outline-offset: -3px; }
.portal-service-option strong { display: block; font-size: 1rem; font-weight: 650; }
.portal-service-option-description { display: block; margin-top: 5px; max-width: 850px; color: var(--portal-surface-muted); overflow-wrap: anywhere; }
.portal-service-option-action { color: var(--brand-ink-on-surface); font-weight: 600; white-space: nowrap; }
.portal-catalog-empty { padding: 28px 0; }
@media (max-width: 560px) { .portal-service-option { align-items: flex-start; flex-direction: column; gap: 12px; padding: 20px; } }
.portal-center { max-width: 560px; margin: 48px auto 0; text-align: center; }

.portal-lede { color: var(--portal-muted); font-size: .95rem; }
.portal-kicker { margin: 0 0 8px; font-size: .75rem; font-weight: 600; letter-spacing: .04em; color: var(--portal-muted); }

/* Provider-branded entry (plan 2026-09-27-007 U3, R1): one plain card with
   the practice's logo and name. No Service or customer information and no
   promotional copy is exposed here. */
.portal-auth-active .portal-header, .portal-auth-active .portal-footer { display: none; }
.portal-auth-active .portal-main { max-width: none; padding: 0; }
.portal-auth { min-height: 100vh; display: grid; place-items: center; padding: clamp(24px, 5vw, 72px) 16px; background: var(--portal-page); }
.portal-auth-card { width: min(100%, 440px); padding: 36px; border-color: var(--portal-warm-line); border-radius: 16px; box-shadow: var(--portal-card-shadow); }
.portal-auth-brandmark { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; font: 650 1.125rem/1.25 var(--font-display); overflow-wrap: anywhere; }
.portal-auth-brandmark .logo-mark { width: 44px; height: 44px; flex: none; object-fit: contain; border-radius: 10px; background: var(--portal-surface); }
.portal-auth-card h1 { margin: 0 0 8px; font-size: 1.625rem; line-height: 1.2; letter-spacing: -.01em; }
.portal-auth-card .portal-lede { margin: 0 0 20px; }
.portal-auth-card .portal-button { width: 100%; }
/* Plan 2026-10-05-010: "or" between the email link and the Finney account. */
.portal-finney-sign-in { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.portal-finney-sign-in[data-placement="first"] { margin: 0 0 16px; }
.portal-finney-sign-in[hidden] { display: none; }
.portal-auth-or { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--portal-muted); font-size: .8rem; text-transform: lowercase; }
.portal-auth-or::before, .portal-auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--portal-warm-line); }
.portal-finney-sign-in[data-placement="first"] .portal-auth-or { order: 2; }
.portal-auth-alt { margin: 18px 0 0; text-align: center; font-size: .9rem; font-weight: 600; }
.portal-auth-alt a { color: var(--brand-ink); text-decoration: none; }
.portal-auth-alt a:hover { text-decoration: underline; }
.portal-auth-secured { margin: 24px 0 0; padding-top: 18px; border-top: 1px solid var(--portal-warm-line); color: var(--portal-muted); display: flex; align-items: center; justify-content: center; gap: 6px; font-size: .8rem; text-align: center; }
.portal-auth-secured img { width: 18px; height: 18px; object-fit: contain; }

/* ── The public catalogue (plan 2026-09-27-007 U3), now the landing drawn by
   request-view.css `.pl` (plan 2026-09-29-003 U3) ─────────────────────── */
.portal-directory-active .portal-header { display: none; }
.portal-directory-active .portal-main { padding: 0; }
.portal-directory { min-width: 0; }

/* "← All services" and the two screens after a signed-out send. */
.portal-back-row { margin: 0 0 16px; }
.portal-back-link { font-size: .875rem; font-weight: 600; color: var(--brand-ink); text-decoration: none; }
.portal-back-link:hover { text-decoration: underline; }
.portal-pending-panel { max-width: 640px; margin: 32px auto 0; padding: 32px; border-radius: 16px; display: flex; flex-direction: column; gap: 12px; }
.portal-pending-panel h1 { margin: 0; font-size: 1.5rem; }
.portal-pending-panel h1:focus { outline: none; }
.portal-pending-panel p { margin: 0; overflow-wrap: anywhere; }
.portal-pending-panel .portal-back-row { margin: 6px 0 0; }
.portal-pending-contact { margin: 0 0 8px; }
.portal-pending-contact > .portal-label { margin-bottom: 12px; }
.portal-pending-after { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.portal-pending-after p { margin: 0; }

/* ── The service page (plan 2026-09-26-002 U4): layout A ─────────────
   #portal-service is the view show() toggles; the grid lives on the inner
   wrapper so the "you are here" screen can replace it. */
.portal-service { min-width: 0; }
/* Plan 2026-11-06-001 U3: the details on the left, the form card on the
   right, capped so the details keep the room. */
.portal-service-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 560px);
  gap: clamp(32px, 3.4vw, 48px);
  align-items: start;
  padding-top: 28px;
}
.portal-label {
  margin: 0;
  font: 500 10.5px/1.4 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--portal-muted);
}
.portal-section-title { margin: 0 0 12px; font-size: 1.1rem; font-weight: 650; letter-spacing: -.01em; }
.portal-service-about { min-width: 0; display: flex; flex-direction: column; gap: 28px; }
.portal-service-about p, .portal-service-intro h1, .portal-service-intro p, .portal-chips li { overflow-wrap: anywhere; }
.portal-service-intro { display: flex; flex-direction: column; gap: 12px; padding-top: 6px; }
.portal-service-intro h1 { margin: 0; max-width: 22ch; font-size: clamp(1.8rem, 3.4vw, 2.6rem); line-height: 1.1; letter-spacing: -.02em; font-weight: 700; }
.portal-service-intro .portal-lede { margin: 0; max-width: 62ch; font-size: 1.05rem; line-height: 1.55; }
.portal-chips { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.portal-chips li { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--portal-muted); }
.portal-chips li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-ink); flex: none; }

/* What you send and what you get. */
.portal-sendget { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); background: var(--portal-surface); color: var(--portal-surface-text); border: 1px solid var(--portal-line); border-radius: 14px; overflow: hidden; }
.portal-sendget > div { padding: 18px 20px; min-width: 0; }
.portal-sendget > div + div { border-left: 1px solid var(--portal-line); }
.portal-sendget h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; color: var(--portal-surface-muted); }
.portal-sendget ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.portal-sendget li { overflow-wrap: anywhere; }
.portal-sendget-note { display: block; font-size: 13px; color: var(--portal-surface-muted); }
.portal-sendget-more { color: var(--portal-surface-muted); font-size: 14px; }

/* What happens after you send: the Service's steps as a timeline. */
.portal-how { background: transparent; border: 0; padding: 0; }
.portal-how-summary { margin: -4px 0 16px; font-size: 14px; color: var(--portal-muted); }
.portal-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.portal-steps li {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 14px;
  padding-bottom: 16px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--portal-muted);
}
.portal-steps li::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: 0; width: 2px; background: var(--brand-border); }
.portal-steps li:last-child::before { display: none; }
.portal-step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--brand-focus);
  background: var(--portal-surface);
  display: grid;
  place-items: center;
  font: 600 11px/1 var(--font-mono);
  color: var(--brand-ink-on-surface);
}
.portal-step-text { padding-top: 3px; min-width: 0; overflow-wrap: anywhere; }

/* Timing and Review. */
.portal-rows { margin: 0; }
.portal-rows > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-top: 1px solid var(--portal-line); }
.portal-rows > div:last-of-type { border-bottom: 1px solid var(--portal-line); }
.portal-rows > div[hidden] { display: none; }
.portal-rows dt { color: var(--portal-muted); }
.portal-rows dd { margin: 0; overflow-wrap: anywhere; }
.portal-rows:not(:has(> div:not([hidden]))) { display: none; }

.portal-disclosures { display: flex; flex-direction: column; border-top: 1px solid var(--portal-line); }
.portal-disclosures:not(:has(> :not([hidden]))) { display: none; }
.portal-disclosure { border-bottom: 1px solid var(--portal-line); padding: 14px 2px; }
.portal-disclosure summary { cursor: pointer; font-size: 14px; font-weight: 600; }
.portal-disclosure p { margin: 10px 0 0; font-size: 13px; line-height: 1.55; color: var(--portal-muted); white-space: pre-line; overflow-wrap: anywhere; }

.portal-card {
  background: var(--portal-surface);
  border: 1px solid var(--portal-line);
  border-radius: var(--portal-radius);
  padding: 24px;
  min-width: 0;
}
#portal-intake {
  padding: 0;
  border-radius: var(--portal-card-radius);
  box-shadow: var(--portal-card-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.portal-form-head { padding: 26px 36px 20px; display: flex; flex-direction: column; gap: 16px; border-bottom: 1px solid var(--portal-track); }
.portal-form-head:has(.portal-tabs:not([hidden])) { padding-bottom: 0; }
.portal-form-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
#portal-intake h2 { margin: 6px 0 0; font-size: 24px; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
.portal-progress-text { margin: 0; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.portal-progress { height: 6px; border-radius: 99px; background: var(--portal-track); overflow: hidden; }
.portal-progress-fill {
  display: block;
  height: 100%;
  width: max(var(--portal-progress, 0%), 6px);
  border-radius: 99px;
  background: var(--brand-ink-on-surface);
  transition: width .25s ease;
}

/* Tabs: one per question group. The row wraps rather than scrolls; a long
   label is shortened, with the full label in the tab's title. */
.portal-tabs { display: flex; flex-wrap: wrap; column-gap: 28px; margin: 4px 0 0; }
.portal-tab {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 2px 14px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--portal-surface-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.portal-tab[aria-selected="true"] { border-bottom-color: var(--brand-ink-on-surface); }
/* Plan 2026-11-06-001 R13: the groups read as a step bar: every step has a
   track, done and current steps fill it. */
.portal-tabs { column-gap: 8px; }
.portal-tab { flex: 1 1 0; border-bottom: 4px solid var(--portal-track); border-radius: 0 0 2px 2px; }
.portal-tab-complete { border-bottom-color: var(--brand-ink-on-surface); }
.portal-tab[aria-selected="false"]:not(.portal-tab-complete) .portal-tab-text { opacity: .78; }
.portal-tab:focus-visible { outline-offset: -2px; }
.portal-tab-mark {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--portal-line);
  color: var(--portal-muted);
  font: 600 11px/1 var(--font-mono);
}
.portal-tab-mark svg { display: none; }
.portal-tab-complete .portal-tab-mark { border-color: transparent; background: var(--portal-track); color: var(--portal-surface-text); }
.portal-tab-complete .portal-tab-number { display: none; }
.portal-tab-complete .portal-tab-mark svg { display: block; }
.portal-tab[aria-selected="true"] .portal-tab-mark { border-color: var(--brand-primary); background: var(--brand-primary); color: var(--brand-on-primary); }
.portal-tab-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.portal-tab-label { font-size: 13.5px; font-weight: 600; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-tab-sub { font-size: 11.5px; font-weight: 500; color: var(--portal-muted); }

#portal-request-form { display: flex; flex-direction: column; flex: 1; }
.portal-form-body { padding: 28px 36px; flex: 1; }
.portal-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 22px; align-content: start; }
.portal-form-body .portal-group > * { grid-column: span 1; margin: 0; min-width: 0; }
.portal-group > .portal-field-wide, .portal-group > .portal-fieldset { grid-column: 1 / -1; }
.portal-options { display: flex; flex-direction: column; gap: 10px; }
.portal-option {
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--portal-line);
  border-radius: 12px;
  background: var(--portal-surface);
}
.portal-option:has(input:checked) { border-color: var(--brand-ink-on-surface); box-shadow: inset 0 0 0 0.5px var(--brand-ink-on-surface); background: var(--portal-soft); }
.portal-option input { margin-top: 3px; }
.portal-option label { font-size: 15px; }

.portal-form-foot { padding: 18px 36px; border-top: 1px solid var(--portal-track); background: var(--portal-soft); display: flex; flex-direction: column; gap: 10px; }
.portal-form-foot .portal-error { margin: 0; }
.portal-form-actions { display: flex; align-items: center; gap: 12px; }
.portal-foot-note { margin: 0; font-size: 12.5px; color: var(--portal-muted); min-width: 0; }
.portal-form-actions .portal-button:not(.portal-button-secondary) { margin-left: auto; }
.portal-form-foot .portal-help { margin: 0; }
.portal-desk-row { margin: 0; }
/* One quiet line each for the returning client and the Finney account. */
#portal-pending-sign-in, #portal-desk-row .portal-button { min-height: 44px; border: 0; padding: 0; background: none; color: var(--brand-ink-on-surface); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; justify-content: flex-start; }

/* ── After submit: you are here (plan 2026-09-26-002 U6) ──────────── */

.portal-done { display: flex; flex-direction: column; gap: 32px; padding-top: 12px; }
.portal-done-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.portal-done-check {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--status-accepted) 14%, var(--portal-surface));
  color: var(--status-accepted);
}
.portal-done-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 360px; }
.portal-done-title .portal-label { font-size: 11px; letter-spacing: .1em; overflow-wrap: anywhere; }
.portal-done-title h1 { margin: 0; font-size: 34px; line-height: 1.12; letter-spacing: -.02em; font-weight: 700; }
.portal-done-title h1:focus { outline: none; }
.portal-done-head .portal-button { border-radius: 11px; }

.portal-done-steps {
  list-style: none;
  margin: 0;
  padding: 6px 0 0;
  display: grid;
  grid-template-columns: repeat(var(--portal-step-count, 5), minmax(0, 1fr));
  gap: 14px;
}
.portal-done-step {
  min-width: 0;
  min-height: 210px;
  padding: 22px;
  border-radius: var(--portal-tile-radius);
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--portal-soft);
  color: var(--portal-surface-text);
  border: 1px dashed var(--portal-line);
  --portal-muted: var(--portal-surface-muted);
}
.portal-done-step-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.portal-done-step-number { font: 500 12px/1 var(--font-mono); color: var(--portal-muted); }
.portal-done-step-state { display: inline-flex; align-items: center; gap: 5px; font: 500 10.5px/1.3 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--portal-muted); }
.portal-done-step-title { margin: 0; font-size: 17px; line-height: 1.35; font-weight: 600; overflow-wrap: anywhere; }
.portal-done-step-note { margin: auto 0 0; font-size: 12.5px; color: var(--portal-muted); overflow-wrap: anywhere; }
.portal-done-step[data-step-state="done"] { background: var(--portal-surface); border-style: solid; }
.portal-done-step[data-step-state="done"] .portal-done-step-title { color: var(--portal-muted); }
.portal-done-step[data-step-state="done"] .portal-done-step-state { font: 700 11.5px/1.3 var(--font-sans); letter-spacing: 0; text-transform: none; color: var(--status-accepted); }
.portal-done-step[data-step-state="here"] {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border: 1px solid var(--brand-primary);
  box-shadow: 0 22px 44px -22px var(--portal-shadow);
  transform: translateY(-6px);
  --portal-muted: var(--brand-on-primary);
}
.portal-done-step[data-step-state="here"] .portal-done-step-number,
.portal-done-step[data-step-state="here"] .portal-done-step-note { opacity: .78; }
.portal-done-step[data-step-state="here"] .portal-done-step-title { font-size: 19px; line-height: 1.3; font-weight: 700; }
.portal-done-step[data-step-state="here"] .portal-done-step-state { background: var(--brand-on-primary); color: var(--brand-primary); padding: 4px 8px; border-radius: 6px; font-weight: 600; }

.portal-done-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: 24px; align-items: start; }
.portal-done-card {
  background: var(--portal-surface);
  color: var(--portal-surface-text);
  border: 1px solid var(--portal-line);
  border-radius: var(--portal-tile-radius);
  padding: 24px 28px;
  min-width: 0;
  --portal-muted: var(--portal-surface-muted);
  --brand-ink: var(--brand-ink-on-surface);
  --portal-focus: var(--portal-focus-on-surface);
}
.portal-done-card > .portal-label { margin-bottom: 14px; }
.portal-summary { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 28px; }
.portal-summary dt { font-size: 12.5px; color: var(--portal-muted); }
.portal-summary dd { margin: 3px 0 0; font-size: 14.5px; font-weight: 600; overflow-wrap: anywhere; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.portal-done-links { display: flex; flex-direction: column; gap: 12px; }
.portal-done-links > .portal-label { margin-bottom: 2px; }
.portal-done-gaps p { margin: 0 0 6px; font-size: 14px; }
.portal-done-gaps ul { margin: 0; padding-left: 20px; font-size: 14px; }
.portal-done-link { align-self: flex-start; padding: 2px 0; border: 0; background: none; font: inherit; font-size: 14.5px; font-weight: 600; color: var(--brand-ink); text-decoration: none; cursor: pointer; }
.portal-done-link:hover { text-decoration: underline; }

/* ── Forms ────────────────────────────────────────────────────────── */

.portal-field { margin: 0 0 16px; }
.portal-field label, .portal-fieldset legend { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.portal-required { color: var(--portal-muted); font-weight: 400; font-size: 0.85rem; }
.portal-help { font-size: 12.5px; color: var(--portal-muted); margin: 6px 0 0; }

.portal-field input[type="text"],
.portal-field input[type="email"],
.portal-field input[type="number"],
.portal-field input[type="date"],
.portal-field select,
.portal-field textarea {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--portal-surface);
  border: 1px solid var(--portal-line);
  border-radius: var(--portal-control-radius);
  min-height: 44px;
  padding: 10px 12px;
  font-size: 14px;
}
.portal-field textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
.portal-file { position: relative; }
.portal-file-drop {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  border: 1.5px dashed var(--portal-warm-muted);
  border-radius: 12px;
  background: var(--portal-warm-soft);
  color: var(--portal-muted);
}
.portal-file-drop > svg { flex: none; }
.portal-file-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.portal-file-body .portal-help { margin: 0; }
.portal-file-has .portal-file-drop { border-style: solid; border-color: var(--brand-ink-on-surface); }
.portal-file-has .portal-file-chosen { color: var(--portal-surface-text); font-weight: 600; }
.portal-field input:focus-visible, .portal-field select:focus-visible, .portal-field textarea:focus-visible {
  outline: 3px solid var(--portal-focus);
  outline-offset: 1px;
  border-color: var(--portal-focus);
}
.portal-field [aria-invalid="true"] { border-color: var(--portal-danger); }

.portal-fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.portal-choice { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }
.portal-choice input { margin-top: 5px; width: 18px; height: 18px; flex: none; accent-color: var(--brand-primary); }
.portal-choice label { font-weight: 600; margin: 0; font-size: 14px; }
.portal-choice .portal-help { margin-top: 2px; }

.portal-file-list { list-style: none; margin: 8px 0 0; padding: 0; font-size: 0.9rem; color: var(--portal-muted); }

.portal-error { color: var(--portal-danger); font-size: 0.92rem; margin: 0 0 12px; }
.portal-error:empty { display: none; }

.portal-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border: 0;
  border-radius: 6px;
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.portal-button:hover { background: var(--brand-hover); }
.portal-button:active { background: var(--brand-pressed); }
.portal-button[disabled] { opacity: 0.6; cursor: progress; }
.portal-form-actions .portal-button { min-height: 46px; padding: 0 26px; border-radius: 11px; font-weight: 600; }
.portal-button-secondary { background: var(--portal-surface); color: var(--portal-surface-text); border: 1px solid var(--portal-line); }
.portal-button-secondary:hover { background: var(--portal-soft); }
.portal-form-actions .portal-button-secondary { padding: 0 20px; }
.portal-button-quiet { background: transparent; color: var(--brand-ink); border: 1px solid var(--brand-border); min-height: 40px; padding: 8px 16px; }
.portal-button-quiet:hover { background: var(--brand-soft); }

.portal-link-button {
  border: 0;
  background: none;
  padding: 4px 0;
  font: inherit;
  color: var(--brand-ink);
  text-decoration: underline;
  cursor: pointer;
}

/* The customer's move follows the tenant-selected attention seed. */
.portal-your-move {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--your-move);
  color: var(--your-move-ink);
  font-size: 0.8rem;
  font-weight: 700;
}
.portal-status-accepted { color: var(--status-accepted); }
.portal-status-returned { color: var(--status-returned); }
.portal-status-checking { color: var(--status-checking); }
.portal-status-requested { color: var(--status-requested); }

/* ── Footer ───────────────────────────────────────────────────────── */

.portal-footer { width: 100%; padding: 20px clamp(20px, 2.5vw, 40px); display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--portal-muted); font-size: .75rem; }
.portal-powered { display: inline-flex; align-items: center; gap: 6px; }
.portal-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.portal-file .portal-file-picker { flex: none; margin: 0 0 0 auto; display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px; border: 1px solid var(--portal-line); border-radius: 9px; background: var(--portal-surface); color: var(--portal-surface-text); font-size: 13px; font-weight: 600; cursor: pointer; }
.portal-file-input:focus-visible + .portal-file-drop .portal-file-picker { outline: 3px solid var(--portal-focus); outline-offset: 2px; }
.portal-file-chosen { display: block; color: var(--portal-muted); font-size: 14px; overflow-wrap: anywhere; }
/* Plan 2026-11-06-001 R10: the Finney mark on a small white tile reads on any canvas. */
.portal-powered img { width: 22px; height: 22px; padding: 2px; border-radius: 6px; background: var(--brand-surface); border: 1px solid var(--brand-line); }
[data-brand-powered-by-off] [data-powered-by] { display: none !important; }

/* ── Narrow screens: one column, the form after the Service ───────── */

@media (max-width: 860px) {
  .portal-service-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; padding-top: 20px; }
  /* The service is named first, then the form, then the rest of the rail. */
  .portal-service-about { display: contents; }
  .portal-service-intro { order: -2; }
  #portal-intake { order: -1; }
  .portal-done-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-done-step { min-height: 0; }
  .portal-done-step[data-step-state="here"] { transform: none; }
  .portal-done-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  h1 { font-size: 1.5rem; }
  .portal-header-inner { padding: 10px 14px; gap: 10px; }
  .portal-nav { order: 3; width: 100%; margin-left: 0; }
  .portal-nav a { flex: 1; text-align: center; }
  .portal-account { margin-left: auto; }
  .portal-profile { padding-right: 4px; }
  .portal-profile-chevron { display: none; }
  #portal-sign-in-open { margin-left: auto; }
  .portal-main { padding: 18px 14px 36px; }
  .portal-sendget > div + div { border-left: 0; border-top: 1px solid var(--portal-line); }
  .portal-rows > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .portal-panel, .portal-card:not(#portal-intake) { padding: 18px; }
  .portal-narrow, .portal-center { margin-top: 12px; }
  .portal-auth { place-items: start center; padding: 24px 16px 44px; }
  .portal-auth-card { padding: 24px 20px; }
  .portal-pending-panel { margin-top: 12px; padding: 22px 18px; }
  .portal-service-intro h1, .portal-done-title h1 { font-size: 26px; }
  .portal-form-head { padding: 20px 18px 16px; }
  .portal-form-body { padding: 22px 18px; }
  .portal-form-foot { padding: 14px 18px; }
  .portal-group { grid-template-columns: minmax(0, 1fr); }
  .portal-group > * { grid-column: 1 / -1; }
  .portal-tabs { column-gap: 18px; }
  .portal-tab-label { max-width: 16ch; }
  .portal-form-actions { flex-wrap: wrap; }
  .portal-foot-note { flex: 1 1 100%; order: -1; }
  .portal-file-drop { flex-wrap: wrap; padding: 16px; }
  .portal-file .portal-file-picker { margin-left: 0; }
  .portal-done-head .portal-button { width: 100%; }
  .portal-done-steps { grid-template-columns: minmax(0, 1fr); }
  .portal-summary { grid-template-columns: minmax(0, 1fr); }
  .portal-done-card { padding: 20px; }
}

@media print {
  .portal-header, .portal-footer, .portal-status, .portal-skip { display: none !important; }
  body, .portal-main { background: var(--portal-surface); }
  .portal-main { max-width: none; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Read-only delivery viewer; native dialog provides modal keyboard navigation. */
.portal-file-viewer { width: min(1100px, calc(100vw - 32px)); height: min(900px, calc(100dvh - 32px)); max-width: none; max-height: none; padding: 0; border: 1px solid var(--portal-line); border-radius: 12px; background: var(--portal-surface); color: var(--portal-surface-text); }
.portal-file-viewer::backdrop { background: color-mix(in srgb, var(--portal-text) 55%, transparent); }
.portal-file-viewer[open] { display: flex; flex-direction: column; }
.portal-file-viewer > header { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--portal-line); }
.portal-file-viewer h2 { flex: 1 1 200px; min-width: 0; margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.portal-file-viewer .rv-preview { margin: 0; flex: 1; min-height: 0; overflow: auto; }
.portal-file-viewer iframe { display: block; width: 100%; height: 100%; border: 0; }
.portal-file-viewer img { display: block; max-width: 100%; max-height: 100%; margin: auto; object-fit: contain; }
.portal-file-viewer pre { padding: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
#portal-back-to-desk { white-space: nowrap; }

@media (max-width: 560px) {
  #portal-back-to-desk { padding: 8px; font-size: .75rem; }
  .portal-header-inner:has(#portal-back-to-desk:not([hidden])) .portal-brand { flex: 1 1 120px; }
  .portal-header-inner:has(#portal-back-to-desk:not([hidden])) .portal-brand-text { min-width: 0; }
  .portal-header-inner:has(#portal-back-to-desk:not([hidden])) .portal-account { margin-left: 0; }
}
.portal-file-viewer .rv-preview-preparing { padding: 20px; }

/* Plan 2026-10-24-003 U4: the document package uploader (public/request-package-upload.js). */
.package-upload { display: flex; flex-direction: column; gap: 8px; position: relative; }
.package-upload-status { margin: 0; }
.package-upload-bar { height: 8px; border-radius: 4px; background: rgba(127, 127, 127, 0.2); overflow: hidden; }
.package-upload-fill { display: block; height: 100%; width: 0; background: currentColor; transition: width 0.2s ease; }
.package-upload-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.package-upload-button { min-height: 36px; padding: 6px 14px; border-radius: 8px; border: 1px solid currentColor; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.package-upload-small { opacity: 0.75; }
@media (max-width: 640px) { .package-upload-actions { flex-direction: column; } .package-upload-button { width: 100%; } }

/* Plan 2026-11-15-005 U3: the server-drawn service facts (no JavaScript); removed when the script renders. */
.portal-ssr-service { max-width: 760px; margin: 0 auto 24px; display: grid; gap: 10px; overflow-wrap: anywhere; }
.portal-ssr-service h2 { font-size: 1rem; margin-top: 8px; }
.portal-ssr-service ul { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.portal-ssr-service .pd-req, .portal-ssr-service .pd-opt, .portal-ssr-service .pd-input-type, .portal-ssr-service .pd-input-help { font-size: .85em; opacity: .8; }
.portal-ssr-service .pd-inputs { list-style: none; padding: 0; }
.portal-ssr-service .pd-input-options, .portal-ssr-service .pd-input-help { display: block; }

/* ── Complete your request (plan 2026-11-15-010 U5) ────────────────── */
.portal-complete { max-width: 760px; margin: 24px auto 0; }
.portal-complete h1 { margin: 0 0 6px; }
.portal-complete-section { font-size: 1rem; margin: 24px 0 10px; }
.portal-complete-label { font-size: 13px; font-weight: 600; margin: 0 0 6px; }
.portal-complete-needed { border: 1px solid var(--portal-line); border-left: 4px solid var(--portal-danger); border-radius: var(--portal-control-radius); padding: 12px 16px; margin: 16px 0; background: var(--portal-soft); }
.portal-complete-needed ul { margin: 0; padding-left: 18px; }
.portal-complete-missing > label, .portal-complete-missing > .portal-complete-label { color: var(--portal-danger); }
.portal-complete-choices { display: flex; flex-direction: column; gap: 6px; }
.portal-complete-choice { font-weight: 400; display: flex; align-items: center; gap: 8px; }
.portal-complete-held { margin: 0 0 8px; padding-left: 18px; font-size: 14px; }
/* Plan 2026-11-16-004: the AI app's files, held until Send. */
.portal-complete-agent { border: 1px solid var(--portal-line); border-radius: var(--portal-control-radius); padding: 10px 14px; margin: 0 0 10px; background: var(--portal-soft); }
.portal-complete-agent .portal-complete-held { list-style: none; padding-left: 0; }
.portal-complete-agent-lede { margin: 0 0 12px; }
.portal-complete-form .portal-button { margin-top: 8px; }
@media (max-width: 640px) { .portal-complete { margin-top: 12px; } }
