:root {
  --ink: #152536;
  /* ID 474: #647386 only reached 4.33:1 on --soft / 4.14:1 on
     --tp-accent-soft, so helper copy and compact labels on those panels failed
     WCAG AA in the Tenant Portal axe pass. */
  --muted: #5c6b7c;
  --navy: #17324d;
  /* Read by listkit.css, not by this file: var(--color-primary, var(--blue)). */
  --blue: #2667a8;
  --surface: #ffffff;
  --soft: #eef3f7;
  --line: #dce5ec;
  --success: #18794e;
  --danger: #b42318;
  --text-inverse: #ffffff;
  --tp-accent: #17324d;
  --tp-accent-contrast: #ffffff;
  --tp-accent-soft: #e8eef3;
  --tp-accent-text: #17324d;
  --field-bg: #ffffff;
  --field-border: #b8c7d2;
  --field-focus-ring: var(--tp-accent-soft);
  --focus-ring: #9cc6ec;
  --hover-surface: #f8fbfd;
  --hover-border: #91b8d8;
  --alert-text: #7a271a;
  --alert-bg: #fef3f2;
  --success-alert-text: #0f5132;
  --success-alert-bg: #edf8f2;
  --pill-ok-text: #14633d;
  --pill-ok-bg: #e5f4eb;
  --pill-ok-border: #b7dcc4;
  --pill-info-text: #31506b;
  --pill-info-bg: #eef4f8;
  --pill-info-border: #cfd8e0;
  --pill-warn-text: #7a4b12;
  --pill-warn-bg: #fff2d8;
  --pill-warn-border: #f0d69a;
  --pill-bad-text: #9c1c1c;
  --pill-bad-bg: #fde4e4;
  --pill-bad-border: #f0b8b8;
  --scrim: rgba(10, 25, 39, .72);
  --shadow-card: 0 12px 35px rgba(22,50,77,.06);
  --shadow-panel: 0 8px 24px rgba(22,50,77,.045);
  --shadow-inbox: 0 12px 28px rgba(21,37,54,.16);
  --shadow-modal: 0 28px 80px rgba(0,0,0,.32);
  /* #4564: the Tenant Portal renders a door code, which has to be monospaced so
     ambiguous glyph pairs (0/O, 1/l) are readable when someone is copying it
     onto a keypad. style.css already owns this token for the Owner Portal, but
     the Tenant Portal does not load style.css, so it needs its own copy --
     defined here rather than left as an inline var() fallback, because a
     fallback literal silently stops following the theme (tests/contrast.unit.js
     fails the build on exactly that). Keep this value in step with style.css --
     #4603 added tests/locksAndDoorCodes4564.unit.js's byte-identical assertion,
     so drift here now fails a real test, not just this comment. */
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--soft);
}

/* Task List ID 751 -- Tenant Portal dark theme.
   Applied by the inline bootstrap in tenant.html's <head>, before first paint.
   Equal specificity to :root, so it has to stay below it.

   The values are not a new palette. Every role that also exists in the Owner
   and Admin portals takes THEIR dark value verbatim (--surface = style.css
   --color-surface, --soft = --color-bg, --ink = --color-text, --muted =
   --color-text-muted, --navy = --color-brand-navy, --success/--danger =
   --color-success/--color-error, and the four pill tints are the matching
   --color-*-highlight pairs). Only the tenant-specific roles below -- the
   accent defaults, the field chrome, --blue -- had no counterpart to copy.
   The token NAMES stay tenant-local: renaming 292 lines of shipping CSS to
   the --color-* scheme is a bigger, riskier change than this row is.

   Measured ratios for every pair are in the ID 751 writeup. */
[data-theme='dark'] {
  --ink: #e7e9ec;
  --muted: #98a1ac;
  --navy: #6d84d6;
  --blue: #7fa9e0;
  --surface: #181c22;
  --soft: #12151a;
  --line: #333a44;
  --success: #6fbf7c;
  --danger: #e07a7a;
  --text-inverse: #12151a;
  --tp-accent: #17324d;
  --tp-accent-contrast: #ffffff;
  --tp-accent-soft: #18202b;
  --tp-accent-text: #7f8e9d;
  --field-bg: #1d2128;
  --field-border: #656f80;
  /* The accent tint is near-black here, so it cannot double as a focus ring
     the way it does in light. */
  --field-focus-ring: #9cc6ec;
  --focus-ring: #9cc6ec;
  --hover-surface: #1d2128;
  --hover-border: #4d5b6b;
  --alert-text: #e07a7a;
  --alert-bg: #3a2222;
  --success-alert-text: #6fbf7c;
  --success-alert-bg: #1f3324;
  --pill-ok-text: #6fbf7c;
  --pill-ok-bg: #1f3324;
  --pill-ok-border: #2f5138;
  --pill-info-text: #9db4d4;
  --pill-info-bg: #1d2733;
  --pill-info-border: #2e3d4d;
  --pill-warn-text: #d9a53f;
  --pill-warn-bg: #3a2f18;
  --pill-warn-border: #55461f;
  --pill-bad-text: #e07a7a;
  --pill-bad-bg: #3a2222;
  --pill-bad-border: #573030;
  --scrim: rgba(0, 0, 0, .72);
  --shadow-card: 0 12px 35px rgba(0,0,0,.45);
  --shadow-panel: 0 8px 24px rgba(0,0,0,.4);
  --shadow-inbox: 0 12px 28px rgba(0,0,0,.5);
  --shadow-modal: 0 28px 80px rgba(0,0,0,.6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.skip-link { position: fixed; left: 1rem; top: -4rem; z-index: 100; display: inline-flex; align-items: center; min-height: 44px; padding: .75rem 1rem; background: var(--surface); color: var(--navy); }
.skip-link:focus { top: 1rem; }
.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 1.1fr) minmax(360px, .9fr); }
.brand-panel { display: flex; flex-direction: column; justify-content: space-between; padding: clamp(2rem, 6vw, 5.5rem); color: var(--tp-accent-contrast); background: var(--tp-accent); }
.brand-panel img { width: min(240px, 65%); max-height: 88px; object-fit: contain; object-position: left center; }
/* #6768: a custom org logo is drawn at author-chosen colors we don't
   control, so it can't be blended into an arbitrary accent-colored panel
   (unlike the default Return Grid wordmark, which the JS inverts to pure
   white). Give it the same safe, neutral backdrop the authenticated
   header already uses (--surface, mirroring .portal-header) instead of
   sitting directly on --tp-accent, which is unreadable for accent/logo
   combinations like a dark teal panel with a dark-green wordmark. */
.brand-panel img:not(.default-brand-logo) { background: #fff; border-radius: 10px; padding: .6rem .9rem; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.brand-panel h1 { max-width: 660px; font-size: clamp(2.2rem, 5vw, 4.8rem); line-height: 1.02; letter-spacing: -.045em; margin: .8rem 0 1.2rem; }
.brand-panel p:last-child { max-width: 560px; font-size: 1.1rem; line-height: 1.7; color: inherit; opacity: .82; }
.eyebrow { margin: 0; color: var(--tp-accent-text); font-size: .75rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.brand-panel .eyebrow { color: inherit; opacity: .76; }
.auth-card { display: flex; flex-direction: column; justify-content: center; padding: clamp(2rem, 7vw, 7rem); background: var(--surface); }
.auth-card > section { width: min(100%, 440px); }
.org-label { margin-bottom: 2.5rem; color: var(--tp-accent-text); font-weight: 800; }
h1, h2, p { margin-top: 0; }
.auth-card h2 { margin-bottom: .65rem; font-size: 2rem; letter-spacing: -.03em; }
.muted { color: var(--muted); line-height: 1.55; }
form { display: grid; gap: 1.15rem; margin-top: 1.8rem; }
label { display: grid; gap: .45rem; font-size: .9rem; font-weight: 700; }
input, textarea, select { width: 100%; border: 1px solid var(--field-border); border-radius: 9px; padding: .8rem .9rem; color: var(--ink); background: var(--field-bg); }
input:not([type="checkbox"]):not([type="radio"]), select { min-height: 44px; }
input:focus, textarea:focus, select:focus { outline: 3px solid var(--field-focus-ring); border-color: var(--tp-accent); }
button { border: 0; border-radius: 9px; min-height: 44px; padding: .82rem 1.1rem; font-weight: 800; color: var(--tp-accent-contrast); background: var(--tp-accent); }
button:hover { filter: brightness(.9); }
button:focus-visible, a:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
.secondary { color: var(--navy); background: var(--surface); border: 1px solid var(--line); }
.secondary:hover { background: var(--soft); }
.alert { margin: 1rem 0; padding: .8rem 1rem; border-left: 4px solid var(--danger); color: var(--alert-text); background: var(--alert-bg); }
.password-hint { margin: -.45rem 0 0; color: var(--muted); font-size: .82rem; }
/* #304: sits outside the auth forms, so it borrows their spacing by hand. */
.org-code-row { display: grid; gap: .45rem; margin-top: 1.8rem; }
.org-code-row label { font-size: .9rem; font-weight: 700; }
.org-code-row .muted { margin: 0; font-size: .82rem; }
.portal-layout { min-width: 0; min-height: 100vh; display: grid; grid-template: auto 1fr auto / 240px minmax(0, 1fr); }
.portal-header { grid-column: 1 / -1; position: sticky; top: 0; z-index: 60; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; row-gap: .6rem; min-height: 82px; padding: 1rem 2rem; border-bottom: 1px solid var(--line); background: var(--surface); }
/* #5063: impersonation notice now lives inside .portal-header (a flex row)
   instead of a standalone block placed ahead of it in the .portal-layout
   grid -- that placement had no grid-column span of its own, so it
   auto-placed into the 240px sidebar track and rendered as a tall narrow
   block wedged in the corner instead of a banner. As a header child it
   takes the full width on its own line (order pushes it below the brand +
   actions row within the same sticky header) and scrolls with the header,
   which is now sticky so the notice and nav stay visible together. */
.portal-impersonation-banner { order: 3; flex: 1 1 100%; display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap; margin: 0 -2rem -1rem; padding: .65rem 2rem; background: #7a1f1f; color: #fff; font-size: .95rem; line-height: 1.35; text-align: center; }
.portal-impersonation-exit-btn { background: #fff; color: #7a1f1f; border: 0; border-radius: 6px; padding: .35rem .8rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.portal-brand { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.portal-brand img { width: auto; max-width: 170px; height: 42px; object-fit: contain; object-position: left center; }
/* #6769: .portal-header sits on var(--surface), which is white in light
   theme (safe for any org logo, confirmed by #6768's investigation) but
   flips to a near-black #181c22 in dark theme -- a dark custom logo (e.g.
   Crossroads' dark-teal wordmark, measured at 2.31:1 against this exact
   dark surface, below even the 3:1 AA large-text floor) goes unreadable
   the same way the login page's brand-panel logo did before #6768. Unlike
   the login page, --surface is *already* safe in light mode, so this only
   adds a backdrop in dark theme -- a light mode chip would be an unwanted
   visual change for the common case that was never broken. */
[data-theme='dark'] .portal-brand img { background: #fff; border-radius: 8px; padding: .35rem .6rem; }
.portal-header strong { display: block; margin-top: .25rem; font-size: 1.15rem; }
.portal-nav { display: flex; flex-direction: column; gap: .3rem; padding: 1.5rem 1rem; color: var(--tp-accent-contrast); background: var(--tp-accent); }
.portal-nav a, .portal-nav span { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 44px; padding: .8rem .9rem; border-radius: 8px; color: inherit; text-decoration: none; }
.portal-nav .active { background: rgba(255,255,255,.13); font-weight: 800; }
/* ID 474: disabled nav links are intentionally still readable text, not merely
   decorative chrome. #7f93a8 measured 4.15:1 on --tp-accent; this slate clears
   AA while still reading as disabled beside the active white links. */
.portal-nav a.is-disabled { color: #8a9eb2; pointer-events: none; cursor: not-allowed; }
.portal-nav span { color: #aebecd; }
.portal-nav small { font-size: .65rem; white-space: nowrap; }
.portal-main { padding: clamp(2rem, 5vw, 5rem); }
.portal-main h1 { margin: .6rem 0 .8rem; font-size: clamp(2rem, 4vw, 3.5rem); letter-spacing: -.04em; }
.lede { max-width: 680px; color: var(--muted); font-size: 1.1rem; line-height: 1.65; }
.status-card { display: flex; gap: 1rem; max-width: 700px; margin-top: 2rem; padding: 1.4rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-card); }
.status-card h2 { margin-bottom: .35rem; }
.status-card p { margin-bottom: 0; color: var(--muted); }
.status-icon { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; border-radius: 50%; color: var(--text-inverse); background: var(--success); font-weight: 900; }
.portal-main > section { width: min(100%, 900px); }
.portal-card { margin-top: 1.25rem; padding: 1.4rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-panel); }
/* #5626: brief pulse so a notification-bell deep-link is visibly "the card that
   responded to your click", not just a silent scroll. Self-removing (tenant.js
   strips the class after the animation), so it never needs a hidden-state
   toggle of its own. */
.portal-card.deep-link-highlight { animation: portal-card-deep-link-pulse 1.6s ease-out 1; }
@keyframes portal-card-deep-link-pulse {
  0% { box-shadow: 0 0 0 3px var(--blue); }
  100% { box-shadow: var(--shadow-panel); }
}
/* #5661/#5663: same pulse, applied to a single ledger row (rent-ledger /
   deposit-ledger ?entryId= deep links) rather than a whole card -- reuses
   the identical keyframe and self-removal behavior in tenant.js. */
.payment-item.deep-link-highlight { animation: portal-card-deep-link-pulse 1.6s ease-out 1; border-radius: 8px; }
.portal-card h2 { margin: .25rem 0 .8rem; }
/* #5135: gray skeleton + spinner shown on #move-inspection-card /
   #move-out-inspection-card while their initial status fetch is in flight,
   so a slow network reads as "still loading" rather than "nothing here".
   Skeleton rows approximate the real card's line heights so there's no
   layout jump when real content swaps in. */
.portal-card--skeleton { display: flex; align-items: center; gap: .9rem; }
.portal-card--skeleton .skeleton-spinner {
  flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--tp-accent-text);
  animation: portalCardSkeletonSpin .8s linear infinite;
}
.portal-card--skeleton .skeleton-lines { flex: 1; display: grid; gap: .55rem; }
.portal-card--skeleton .skeleton-line { height: .85rem; border-radius: 5px; background: var(--line); opacity: .6; }
.portal-card--skeleton .skeleton-line--wide { width: 70%; }
.portal-card--skeleton .skeleton-line--narrow { width: 40%; }
@media (prefers-reduced-motion: reduce) {
  .portal-card--skeleton .skeleton-spinner { animation: none; }
}
@keyframes portalCardSkeletonSpin { to { transform: rotate(360deg); } }
.card-label { margin: 0; color: var(--tp-accent-text); font-size: .75rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.pre-line { margin-bottom: 0; white-space: pre-line; line-height: 1.65; }
.item-list { display: grid; gap: .65rem; }
.payment-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.payment-item:first-child { border-top: 0; }
.payment-item div { display: grid; gap: .25rem; }
.payment-item span { color: var(--muted); font-size: .84rem; }
.payment-item-value { justify-items: end; text-align: right; }
.payment-item-value > strong { font-size: 1.1rem; }
.pay-invoice { min-height: 44px; margin-top: .35rem; padding: .55rem .85rem; }
.invoice-line-items { display: grid; gap: .35rem; margin: .5rem 0 0; padding: 0; list-style: none; }
.invoice-line-items li { display: flex; justify-content: space-between; gap: 1.25rem; color: var(--muted); font-size: .84rem; }
.invoice-line-items strong { color: var(--ink); font-variant-numeric: tabular-nums; }
/* #390: the joint-and-several explanation under a shared invoice. Deliberately
   quieter than the amount but not muted grey -- it is the sentence that stops a
   co-signer assuming they owe half, so it has to survive being skimmed. */
.invoice-liability { margin: .6rem 0 0; padding: .55rem .7rem; border-left: 3px solid var(--tp-accent); background: rgba(0, 0, 0, .035); border-radius: 0 6px 6px 0; color: var(--ink); font-size: .84rem; line-height: 1.45; }
.policy-details summary { min-height: 44px; padding: .35rem 0; color: var(--tp-accent-text); font-weight: 800; cursor: pointer; }
.policy-summary { padding-top: .8rem; border-top: 1px solid var(--line); }
.policy-summary dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin: 0; }
.policy-summary dl div { padding: .75rem; border-radius: 9px; background: var(--soft); }
.policy-summary dt { color: var(--muted); font-size: .75rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.policy-summary dd { margin: .25rem 0 0; font-weight: 750; }
.late-fee-item.is-waived .payment-item-value > strong { color: var(--muted); text-decoration: line-through; }
/* #6422: Rent & Invoices at-a-glance summary strip -- balance owed, monthly
   rent, lease end. Reuses .portal-card for the outer frame (same border/
   shadow/radius as every other card on this page) and adds only the
   internal 3-up grid; matches .policy-summary's grid/soft-tile pattern
   above rather than introducing a new visual language. */
.rent-summary-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.rent-summary-stat { padding: .9rem 1rem; border-radius: 9px; background: var(--soft); }
.rent-summary-value { margin: .3rem 0 0; font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.rent-summary-value[data-tone='owed'] { color: var(--danger); }
.rent-summary-value[data-tone='clear'] { color: var(--success); }
.rent-summary-sub { margin: .2rem 0 0; font-size: .8rem; }

/* Deposit card (ID 148) */
.deposit-body { display: grid; gap: 1rem; }
.deposit-status { margin: 0; padding: .7rem .9rem; border-radius: 10px; font-weight: 750; }
.deposit-status.returned { color: var(--pill-ok-text); background: var(--pill-ok-bg); border: 1px solid var(--pill-ok-border); }
.deposit-status.held { color: var(--pill-info-text); background: var(--pill-info-bg); border: 1px solid var(--pill-info-border); }
/* #5909: an unpaid or part-paid deposit. Warn tone, not bad -- money that is
   simply not collected yet is not the same as a missed deadline, which is what
   .pending.urgent below is reserved for. */
.deposit-status.due { color: var(--pill-warn-text); background: var(--pill-warn-bg); border: 1px solid var(--pill-warn-border); }
.deposit-status.pending { border: 1px solid transparent; }
.deposit-status.pending.ok { color: var(--pill-info-text); background: var(--pill-info-bg); border-color: var(--pill-info-border); }
.deposit-status.pending.warning { color: var(--pill-warn-text); background: var(--pill-warn-bg); border-color: var(--pill-warn-border); }
.deposit-status.pending.urgent { color: var(--pill-bad-text); background: var(--pill-bad-bg); border-color: var(--pill-bad-border); }
.deposit-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .7rem; margin: 0; }
.deposit-facts div { padding: .8rem; border-radius: 10px; background: var(--soft); }
.deposit-facts dt { margin: 0; color: var(--muted); font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.deposit-facts dd { margin: .3rem 0 0; font-weight: 750; overflow-wrap: anywhere; }
.deposit-facts dd .muted { color: var(--muted); font-size: .8rem; font-weight: 600; }
/* #6783: the citation preview/expand toggle -- a plain inline text button so
   it reads as part of the same sentence as the truncated citation, not as a
   separate card action. */
.citation-toggle { padding: 0; border: 0; background: none; color: var(--blue); font-size: .8rem; font-weight: 700; text-decoration: underline; cursor: pointer; }
.citation-toggle:hover, .citation-toggle:focus-visible { color: var(--navy); }
.deposit-subhead { margin: .5rem 0 .4rem; font-size: 1rem; font-weight: 800; }
.deposit-itemization { width: 100%; border-collapse: collapse; }
.deposit-itemization th, .deposit-itemization td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); font-size: .9rem; text-align: left; }
.deposit-itemization thead th { color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.deposit-itemization tbody td:first-child { text-transform: capitalize; font-weight: 700; }
.deposit-itemization tfoot td { padding-top: .8rem; border-bottom: none; font-size: .95rem; }
.deposit-receipt { display: flex; align-items: center; gap: .8rem; }
.deposit-notes { margin: 0; padding: .7rem .9rem; border-radius: 8px; background: var(--soft); font-size: .88rem; line-height: 1.5; }
.deposit-dispute-cta { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding-top: .3rem; }
.deposit-dispute-cta button { min-height: 44px; padding: .55rem 1rem; color: var(--tp-accent-contrast); background: var(--tp-accent); border: 1px solid var(--tp-accent); border-radius: 8px; font-weight: 800; cursor: pointer; }
.deposit-dispute-cta button:hover { filter: brightness(1.05); }
.deposit-dispute-cta button:disabled { color: var(--muted); background: var(--soft); border-color: var(--line); cursor: not-allowed; }
.deposit-dispute-status { padding: .8rem 1rem; border-radius: 10px; border: 1px solid var(--line); background: var(--soft); }
.deposit-dispute-status.under-review { color: var(--pill-warn-text); background: var(--pill-warn-bg); border-color: var(--pill-warn-border); }
.deposit-dispute-status.resolved { color: var(--pill-ok-text); background: var(--pill-ok-bg); border-color: var(--pill-ok-border); }
.deposit-dispute-status p { margin: .35rem 0 0; font-size: .85rem; line-height: 1.5; }
.dispute-late-fee { min-height: 44px; margin-top: .4rem; padding: .55rem .85rem; color: var(--tp-accent-text); background: var(--surface); border: 1px solid var(--line); }
.receipt-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--tp-accent-text); font-size: .85rem; font-weight: 800; }
.empty-list { display: grid; gap: .3rem; padding: 1.1rem 0; color: var(--muted); }
.empty-list strong { color: var(--ink); }
.loading-state { padding: 1rem 0; color: var(--muted); }
.compact-form { grid-template-columns: minmax(150px, 1fr) minmax(110px, .6fr) auto; align-items: end; }
.compact-form button { min-height: 44px; }
.compact-button { min-height: 44px; padding: .55rem .8rem; }
/* #6408 -- a same-day-completed home task keeps its button in place (no
   layout jump against the neighbouring due-pill/last-done line above it) but
   must not read as an unclicked action, mirroring .deposit-dispute-cta's own
   disabled treatment above rather than inventing a second convention. */
.home-task-mark-done:disabled { color: var(--muted); background: var(--soft); border-color: var(--line); cursor: not-allowed; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
/* #6693: page-level heading row for a view that also has a top-of-page
   primary action ("+ New request"/"+ New message"), replacing the old
   .maintenance-layout two-column split that squeezed the list into less
   than half the page. Title block wraps first (min-width: 0 on the sibling
   lets the flex row shrink instead of overflowing) so the button never
   pushes off-screen at narrow widths; below 520px it drops to its own row
   full width, matching the .compact-button min-height:44px tap target. */
.portal-view-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.portal-view-heading > div:first-child { min-width: 0; }
.portal-view-heading > button { flex: 0 0 auto; white-space: nowrap; }
@media (max-width: 520px) {
  .portal-view-heading { flex-direction: column; align-items: stretch; }
  .portal-view-heading > button { width: 100%; }
}
.maintenance-form { margin-top: 1rem; }
.maintenance-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.checkbox-label { display: flex; align-items: center; gap: .65rem; min-height: 44px; }
.checkbox-label input { width: 18px; height: 18px; }
.maintenance-ticket-list { display: grid; gap: .7rem; }
.maintenance-ticket { width: 100%; display: grid; gap: .6rem; min-height: 44px; padding: 1rem; color: var(--ink); text-align: left; border: 1px solid var(--line); background: var(--surface); }
.maintenance-ticket:hover { border-color: var(--hover-border); background: var(--hover-surface); }
.maintenance-ticket strong { align-self: center; }
.maintenance-ticket-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.maintenance-ticket-meta { color: var(--muted); font-size: .82rem; font-weight: 600; }
.maintenance-status { display: inline-flex; flex: 0 0 auto; align-items: center; min-height: 28px; padding: .25rem .55rem; border-radius: 999px; color: var(--pill-info-text); background: var(--pill-info-bg); font-size: .75rem; font-weight: 800; }
/* #4564: door code list reuses .maintenance-ticket as a plain (non-button)
   card -- the code value and reveal control sit on their own row. */
.door-code-value { font-family: var(--font-mono); font-size: 1.05rem; letter-spacing: .06em; font-weight: 700; }
.maintenance-status.status-resolved, .maintenance-status.status-closed { color: var(--pill-ok-text); background: var(--pill-ok-bg); }
.maintenance-status.status-waiting_on_tenant { color: var(--pill-warn-text); background: var(--pill-warn-bg); }
/* #6312: "Your home tasks" urgency pills, same .maintenance-status shape as
   the ticket status pill above -- overdue reads as an alert, due-this-month/
   due-in-90-days as a warning, everything else (a future or no-due-date
   reminder) as neutral info. */
.maintenance-status.status-home-task-overdue { color: var(--pill-bad-text); background: var(--pill-bad-bg); }
.maintenance-status.status-home-task-due-soon { color: var(--pill-warn-text); background: var(--pill-warn-bg); }
.maintenance-status.status-home-task-future { color: var(--pill-info-text); background: var(--pill-info-bg); }
.home-tasks-counts { color: var(--muted); font-size: .85rem; font-weight: 600; margin-bottom: .5rem; }
.maintenance-detail { position: relative; }
.maintenance-detail > .compact-button { position: absolute; top: 1.1rem; right: 1.1rem; }
.maintenance-detail-heading { padding-right: 8rem; }
.maintenance-detail-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.maintenance-detail-heading h2 { margin-bottom: .4rem; }
.maintenance-description { color: var(--muted); line-height: 1.6; white-space: pre-wrap; }
.maintenance-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .8rem; margin: 1rem 0 0; }
.maintenance-facts div { padding: .8rem; border-radius: 10px; background: var(--soft); }
.maintenance-facts dt { color: var(--muted); font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.maintenance-facts dd { margin: .25rem 0 0; font-weight: 750; }
.maintenance-thread { display: grid; gap: .75rem; margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.thread-message { max-width: 78%; padding: .85rem 1rem; border-radius: 12px; background: var(--soft); }
.thread-message.thread-tenant { justify-self: end; color: var(--tp-accent-contrast); background: var(--tp-accent); }
.thread-message > div { display: flex; justify-content: space-between; gap: 1rem; font-size: .8rem; }
.thread-message time { opacity: .72; }
.thread-message p { margin: .45rem 0 0; white-space: pre-wrap; }
.maintenance-reply-form { grid-template-columns: 1fr auto; align-items: end; }
.maintenance-reply-form button { min-height: 44px; margin-bottom: 1px; }
.landlord-card-intro { margin: -.3rem 0 1rem; }
/* #5175: Dashboard/Documents lease switcher -- a simple flex row (label +
   select), matching the New Request/New Message lease pickers' control
   styling rather than the stacked grid `label` default used elsewhere. */
.lease-switcher { display: flex; align-items: center; gap: .6rem; margin: 0 0 1.25rem; }
.lease-switcher label { display: inline; margin: 0; font-size: .85rem; font-weight: 700; color: var(--muted); }
.lease-switcher select { width: auto; min-width: 220px; }
.landlord-contact { color: var(--muted); }
.landlord-contact a { color: var(--tp-accent-text); font-weight: 800; }
.landlord-identification { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8rem; margin: 0; }
.landlord-identification-item { display: grid; gap: .25rem; min-width: 0; padding: .8rem; border: 1px solid var(--line); border-radius: 9px; background: var(--soft); }
.landlord-identification-item dt { color: var(--muted); font-size: .75rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.landlord-identification-item dd { margin: 0; color: var(--ink); font-weight: 700; overflow-wrap: anywhere; }
.branding-contact-card { max-width: 700px; }
.branding-contact-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8rem; }
.branding-contact-item { display: grid; gap: .2rem; padding: .8rem; border: 1px solid var(--line); border-radius: 9px; background: var(--soft); }
.branding-contact-item span { color: var(--muted); font-size: .75rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.branding-contact-item a, .branding-contact-item strong { color: var(--ink); overflow-wrap: anywhere; }
.branding-contact-item a { font-weight: 800; text-decoration-color: var(--tp-accent-text); text-underline-offset: 3px; }
.document-list { display: grid; gap: .65rem; margin-top: 1rem; }
.document-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.document-item:first-child { border-top: 0; }
.document-item > div { display: grid; gap: .25rem; min-width: 0; }
.document-item strong, .document-item span { overflow-wrap: anywhere; }
.document-item > div > span:last-child { color: var(--muted); font-size: .84rem; }
.document-type { color: var(--tp-accent-text); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
/* #124: "Delivered to your portal on <date>" line under a served-notice
   document -- deliberately styled the same muted way as the upload date, not
   a badge/pill, so it reads as informational rather than as an official
   stamp of legal service. */
.document-item > div > span.document-service-note { display: block; color: var(--muted); font-size: .84rem; }
.success-alert { border-left-color: var(--success); color: var(--success-alert-text); background: var(--success-alert-bg); }
.setting-status { margin: .9rem 0 0; }
.sms-consent-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 1rem; margin-top: 1rem; }
.sms-consent-form label { display: block; margin-bottom: .35rem; font-weight: 700; }
.sms-consent-form input { width: 100%; }
.link-button { min-height: auto; padding: 0; margin-top: .6rem; border: 0; color: var(--tp-accent-text); font-weight: 700; text-decoration: underline; background: transparent; }
.link-button:hover { filter: none; opacity: .8; }
.mfa-method-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1rem 0; border-top: 1px solid var(--line); }
.mfa-method-row:first-of-type { border-top: 0; padding-top: 0; }
.mfa-method-row strong { display: block; }
.mfa-enroll-panel { display: grid; gap: .8rem; max-width: 420px; padding: 1rem; margin: -.4rem 0 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.mfa-secret-key { padding: .6rem .8rem; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font-family: 'SFMono-Regular', Consolas, Menlo, monospace; font-size: 1rem; font-weight: 700; letter-spacing: .12em; overflow-wrap: anywhere; }
.mfa-enroll-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.mfa-backup-codes-display { padding: 1rem; margin-top: 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
#mfa-backup-codes-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .5rem; margin: .8rem 0 0; padding: 0; list-style: none; font-family: 'SFMono-Regular', Consolas, Menlo, monospace; font-weight: 700; letter-spacing: .06em; }
#mfa-backup-codes-list li { padding: .5rem .6rem; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); text-align: center; }
.notification-push-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .8rem .9rem; margin: 1rem 0; border: 1px solid var(--line); border-radius: 9px; background: var(--soft); }
.notification-preferences-table { display: grid; gap: .35rem; margin-top: 1rem; overflow-x: auto; }
.notification-preferences-head, .notification-preferences-row { display: grid; grid-template-columns: minmax(150px, 1.4fr) repeat(4, minmax(64px, .7fr)); align-items: center; gap: .5rem; padding: .65rem 0; border-top: 1px solid var(--line); }
.notification-preferences-head { border-top: 0; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.insurance-status { margin: 0 0 1.1rem; padding: .7rem .9rem; border-radius: 10px; font-weight: 750; border: 1px solid transparent; }
.insurance-status.ok { color: var(--pill-ok-text); background: var(--pill-ok-bg); border-color: var(--pill-ok-border); }
.insurance-status.warning { color: var(--pill-warn-text); background: var(--pill-warn-bg); border-color: var(--pill-warn-border); }
.insurance-status.urgent { color: var(--pill-bad-text); background: var(--pill-bad-bg); border-color: var(--pill-bad-border); }
.insurance-status.unset { color: var(--pill-info-text); background: var(--pill-info-bg); border-color: var(--pill-info-border); }
.insurance-document { margin: 1.1rem 0; color: var(--muted); font-size: .88rem; }
.insurance-document a { color: var(--tp-accent-text); font-weight: 800; }
.insurance-upload-form { margin-top: .5rem; }
.notification-preferences-row:first-of-type { border-top: 1px solid var(--line); }
.notification-preferences-row span.event-label { font-weight: 700; overflow-wrap: anywhere; }
.notification-preferences-row .channel-cell { display: flex; justify-content: center; }
.notification-preferences-row .channel-cell input[type="checkbox"] { width: 18px; height: 18px; }
.notification-preferences-row.is-locked .channel-cell input[type="checkbox"] { accent-color: var(--muted); opacity: .55; cursor: not-allowed; }
.notification-preferences-row.is-locked span.event-label::after { content: " (always on)"; color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: none; letter-spacing: 0; }
@media (max-width: 620px) {
  .sms-consent-form { grid-template-columns: 1fr; align-items: stretch; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.portal-header-actions { display: flex; align-items: center; gap: .9rem; }
/* ID 751. Overrides the filled `button` rule above: this is icon chrome, not a
   primary action, so it must not carry the org accent. Sized to match the
   notification bell it sits beside. */
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 42px; height: 42px; min-height: 0; padding: 0; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); background: var(--surface); }
.theme-toggle:hover { color: var(--ink); background: var(--soft); filter: none; }
.theme-toggle svg { width: 18px; height: 18px; }
.notification-bell-wrap { position: relative; }
.notification-bell-button { position: relative; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 1.1rem; cursor: pointer; display: grid; place-items: center; }
.notification-bell-button:hover { background: var(--soft); }
.notification-unread-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: var(--text-inverse); font-size: .68rem; font-weight: 800; line-height: 18px; text-align: center; }
.notification-inbox-panel { position: absolute; top: calc(100% + .6rem); right: 0; width: 320px; max-height: 380px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-inbox); z-index: 40; }
.notification-inbox-head { padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.notification-inbox-list { padding: .4rem; }
.notification-inbox-empty { padding: 1rem .6rem; color: var(--muted); text-align: center; margin: 0; }
.notification-inbox-item { display: block; width: 100%; text-align: left; padding: .7rem .7rem; border: 0; color: var(--ink); background: transparent; border-radius: 8px; cursor: pointer; }
.notification-inbox-item:hover { background: var(--soft); }
.notification-inbox-item.is-unread { background: var(--tp-accent-soft); }
.notification-inbox-item .notification-inbox-subject { font-weight: 700; font-size: .88rem; }
.notification-inbox-item .notification-inbox-meta { display: block; margin-top: .2rem; color: var(--muted); font-size: .74rem; }
@media (max-width: 640px) { .notification-inbox-panel { position: fixed; top: 90px; right: .6rem; left: .6rem; width: auto; } }
.modal-backdrop { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 1rem; background: var(--scrim); overflow-y: auto; }
.esign-modal { width: min(100%, 720px); max-height: calc(100vh - 2rem); overflow-y: auto; padding: clamp(1.4rem, 4vw, 2.25rem); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-modal); }
.esign-modal h2 { margin: .55rem 0 .7rem; font-size: clamp(1.7rem, 4vw, 2.25rem); letter-spacing: -.03em; }
.esign-disclosures { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin: 1.2rem 0; }
.esign-disclosures section { padding: .9rem; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.esign-disclosures h3 { margin: 0 0 .35rem; font-size: .95rem; }
.esign-disclosures p { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.esign-confirm { margin: 1rem 0; padding: .8rem; border: 1px solid var(--line); border-radius: 9px; }
.esign-modal > button { width: 100%; min-height: 48px; }
.esign-modal > button:disabled { cursor: not-allowed; opacity: .5; }
.modal-fine-print { margin: .8rem 0 0; color: var(--muted); text-align: center; font-size: .75rem; }
/* #6480: payment-method toggle + live fee summary in the Rent & Invoices
   "Make a payment" modal. Two mutually-exclusive buttons (aria-pressed
   marks the active one) rather than radios, matching this modal's existing
   button-forward visual language instead of introducing a new form-control
   style. */
.payment-method-toggle { display: flex; gap: .6rem; margin: 1rem 0; }
.payment-method-toggle button { flex: 1 1 0; min-height: 44px; padding: .5rem .75rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font-size: .88rem; cursor: pointer; }
.payment-method-toggle button[aria-pressed="true"] { border-color: var(--tp-accent); background: var(--soft); font-weight: 600; }
.payment-fee-summary { margin: 0 0 1rem; padding: .8rem .9rem; border: 1px solid var(--line); border-radius: 9px; background: var(--soft); }
.payment-fee-summary dl { display: grid; grid-template-columns: 1fr auto; gap: .35rem .5rem; margin: 0; }
.payment-fee-summary dt { color: var(--muted); font-size: .86rem; }
.payment-fee-summary dd { margin: 0; text-align: right; font-size: .86rem; }
.payment-fee-summary .payment-fee-total dt, .payment-fee-summary .payment-fee-total dd { padding-top: .5rem; margin-top: .35rem; border-top: 1px solid var(--line); font-weight: 700; font-size: .95rem; }
.payment-fee-summary .payment-fee-total { display: contents; }
.portal-footer { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: .65rem 1.5rem; flex-wrap: wrap; padding: 1rem 2rem; border-top: 1px solid var(--line); color: var(--muted); background: var(--surface); text-align: right; font-size: .8rem; }
[hidden] { display: none !important; }
@media (max-width: 760px) {
  .auth-layout { grid-template-columns: 1fr; }
  .brand-panel { min-height: 270px; padding: 2rem; }
  .brand-panel h1 { font-size: 2.35rem; }
  .brand-panel p:last-child { display: none; }
  .auth-card { padding: 2.2rem 1.4rem 3.5rem; }
  .portal-layout { grid-template: auto auto 1fr auto / minmax(0, 1fr); }
  .portal-header, .portal-nav, .portal-main, .portal-footer { min-width: 0; }
  .portal-nav { flex-direction: row; flex-wrap: wrap; overflow-x: visible; padding: .65rem; }
  .portal-nav a, .portal-nav span { flex: 1 1 calc(33.333% - .3rem); justify-content: center; min-width: 0; }
  .portal-nav small { display: none; }
  .portal-main { padding: 2rem 1.2rem; }
  .payment-item { align-items: flex-start; }
  .compact-form { grid-template-columns: 1fr; }
  .maintenance-form-row, .maintenance-reply-form { grid-template-columns: 1fr; }
  .esign-disclosures { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .portal-header { gap: .65rem; padding: .85rem 1rem; }
  .portal-brand { flex: 1 1 auto; }
  .portal-header strong { max-width: 140px; font-size: 1rem; overflow-wrap: anywhere; }
  .portal-header-actions { gap: .45rem; }
  .portal-header-actions .secondary { padding: .7rem .8rem; }
  .portal-brand img { max-width: 110px; height: 34px; }
  .payment-item { display: grid; }
  .payment-item-value { justify-items: start; text-align: left; }
  .portal-card { padding: 1.1rem; }
  .maintenance-ticket-top { display: grid; }
  .maintenance-ticket .maintenance-status { justify-self: start; }
  .thread-message { max-width: 92%; }
  .maintenance-detail > .compact-button { position: static; margin-bottom: 1rem; }
  .maintenance-detail-heading { padding-right: 0; }
  .document-item { align-items: flex-start; flex-direction: column; }
  .portal-footer { justify-content: flex-start; text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Per-screen documentation deep link (Task List ID 793). The "?" beside a
   view's <h1> opens the section of /docs/tenant covering that view -- the nav
   entry from PR #38 only reaches the top of the guide. Hrefs come from the
   SURFACES registry in scripts/dev/build-docs-coverage.js and are pinned by
   tests/docs-checks/portalHelpAnchors.unit.js.

   The anchor is a sibling of the <h1> rather than a child so it stays out of
   the heading's accessible name; :has() is what puts it back on the same line
   without changing any other heading. */
h1:has(+ .help-anchor) {
  display: inline-block;
  vertical-align: middle;
}
.help-anchor {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  margin-left: .5rem;
  vertical-align: middle;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}
.help-anchor:hover,
.help-anchor:focus-visible {
  border-color: var(--blue);
  color: var(--blue);
}

/* #796: the .message-history-* rules that used to style the #166 flat
   renderer's own DOM (note/controls/item/head/meta/reason/body/html/frame)
   were removed here -- that markup no longer exists; the Tenant Portal's
   message history mounts the shared communicationsView.js component (#795)
   instead, which is styled by the .comms-view-* rules alongside the Owner
   Portal's mount of the same component. #message-history-list (the ID, not
   a class of this name) is still live in tenant.html as the mount point. */
