/* portal.css — Reades Portal
   Brand: purple #4B2B7A, orange #E8760A, Arial.
   Matches the terms page / team dashboard design language:
   tabs anchored to header bottom, orange active underline. */

:root {
  --reades-blue: #194f90;
  --reades-blue-dark: #123c6e;
  --reades-orange: #f68c22;
  --ink: #2b2b2b;
  --ink-soft: #5c5c66;
  --paper: #f4f6fa;
  --card: #ffffff;
  --line: #dbe3ef;
  --error: #b3261e;
  --ok: #1a7f37;
}

* { box-sizing: border-box; }

html, body { overflow-x: clip; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

/* ── Header with anchored tabs ──────────────────────────────── */
.site-header {
  background: var(--reades-blue);
  color: #fff;
  padding: 16px 0 0;
  /* (d) sticky: navigation stays available while scrolling long documents */
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(18, 60, 110, 0.25);
}
.header-row {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 61px; /* card-text line: 32px main + 1px border + 28px card pad */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
}
.brand {
  font-size: 22px;
  font-weight: bold;
  letter-spacing: 2px;
}
.brand small {
  display: block;
  font-size: 11px;
  font-weight: normal;
  letter-spacing: 1px;
  opacity: 0.75;
  margin-top: 2px;
}
.header-actions { display: flex; align-items: center; gap: 14px; }
.btn-signout {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  font: inherit;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
}
.btn-signout:hover { border-color: #fff; }

.tab-bar {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 47px; /* + 14px tab padding = tab TEXT on the 61px card-text line */
  display: flex;
  gap: 4px;
  /* Hidden until portal.js has applied entitlements — prevents tabs the
     user isn't entitled to flashing up before they're removed */
  visibility: hidden;
}
.tab-bar.ready { visibility: visible; }
.tab {
  appearance: none;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.8);
  font: inherit;
  font-size: 13.5px;
  padding: 8px 14px;
  cursor: pointer;
  border-radius: 0; /* sharp corners by design */
  line-height: 1.4;
  display: block;
  height: 100%;
}
/* No shaded surround at rest or when selected — the hover rectangle and
   the breadcrumb trail carry the state */
.tab:hover { color: #fff; background: rgba(255,255,255,0.14); }
.tab[aria-selected="true"] { color: #fff; font-weight: bold; background: transparent; }
.tab-item:hover .tab { color: #fff; background: rgba(255,255,255,0.14); }

/* ── Hover menu (subsections revealed over the content) ─────── */
.tab-item { position: relative; display: flex; align-items: stretch; }
/* the bar itself owns no bottom padding: the hover rectangle meets the
   header's bottom edge exactly */
.tab-bar { padding-bottom: 0; align-items: stretch; }
.tab-item--right { margin-left: auto; }
.tab-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  /* solid equivalent of the hover rectangle (14% white over #194f90),
     so tab highlight and menu read as one continuous surface */
  background: #3968a0;
  border: none;
  box-shadow: 0 10px 28px rgba(15, 30, 55, 0.3);
  padding: 6px 0;
  z-index: 60;
}
/* hover/focus menus are a mouse-and-keyboard concept: on touch, iOS
   emulates :hover and :focus-within STICKILY on tapped elements, so these
   rules must never apply there — the tap-driven .menu-open class is the
   only mechanism on coarse pointers */
@media (hover: hover) {
.tab-item:hover .tab-menu,
.tab-item:focus-within .tab-menu { display: block; }
}
.tab-menu button {
  display: block;
  width: 100%;
  text-align: left;
  appearance: none;
  background: none;
  border: none;
  font: inherit;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.88);
  padding: 9px 16px;
  cursor: pointer;
}
.tab-menu button:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.tab-menu button[aria-current="true"] { color: #fff; font-weight: bold; }
.tab:focus-visible {
  outline: 2px solid rgba(255,255,255,0.9);
  outline-offset: -2px;
}

/* ── Greeting (in the header, right of the logo) ────────────── */
.header-greeting {
  flex: 1;
  min-width: 0;
  margin-left: 20px;
  margin-right: 16px;
  text-align: right;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.6s ease;
}
.header-greeting.fading { opacity: 0; }

/* ── Main / panels ──────────────────────────────────────────── */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 32px 64px;
}
.panel[hidden] { display: none; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px 28px;
  margin-bottom: 18px;
}
.card h2 {
  margin: 0 0 10px;
  font-size: 19px;
  color: var(--reades-blue);
}
.card p { line-height: 1.55; color: var(--ink-soft); }
.placeholder-note {
  border-left: 4px solid var(--reades-orange);
  background: #fdf3e8;
  padding: 12px 16px;
  font-size: 14px;
  color: #7a4a12;
  border-radius: 0 6px 6px 0;
}

/* ── Login ──────────────────────────────────────────────────── */
.login-wrap {
  max-width: 420px;
  margin: 56px auto;
  padding: 0 20px;
}
.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 32px;
}
.login-card h1 {
  font-size: 22px;
  color: var(--reades-blue);
  margin: 0 0 6px;
  text-align: center;
}
.login-card .sub { font-size: 14px; color: var(--ink-soft); margin: 0 0 22px; text-align: center; }
label { display: block; font-size: 13px; font-weight: bold; margin-bottom: 6px; }
input[type="email"], input[type="text"] {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 11px 12px;
  border: 1px solid #c3cfe2;
  border-radius: 6px;
}
input:focus-visible {
  outline: 2px solid var(--reades-orange);
  outline-offset: 1px;
  border-color: var(--reades-orange);
}
.code-input { letter-spacing: 10px; text-align: center; font-size: 22px; }
.btn-primary {
  width: 100%;
  margin-top: 16px;
  background: var(--reades-blue);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: bold;
  border: none;
  border-radius: 6px;
  padding: 12px;
  cursor: pointer;
}
.btn-primary:hover { background: var(--reades-blue-dark); }
.btn-primary:disabled { opacity: 0.55; cursor: default; }
.form-msg { min-height: 20px; font-size: 13.5px; margin-top: 12px; }
.form-msg.error { color: var(--error); }
.form-msg.ok { color: var(--ok); }
.back-link {
  display: inline-block;
  margin-top: 14px;
  font-size: 13px;
  color: var(--reades-blue);
}

/* ── Contact fallback ───────────────────────────────────────── */
.contact-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; margin-top: 18px; }
.contact-grid .card { margin: 0; }
.contact-grid a { color: var(--reades-blue); font-weight: bold; text-decoration: none; }
.contact-grid a:hover { text-decoration: underline; }

/* ── Team dashboard extras ──────────────────────────────────── */
.changelog li { margin-bottom: 8px; line-height: 1.5; }
.doc-list { list-style: none; padding: 0; margin: 0; }
.doc-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.doc-list li:last-child { border-bottom: none; }
.doc-list a { color: var(--reades-blue); font-weight: bold; text-decoration: none; }
.doc-list a:hover { text-decoration: underline; }
.version-tag {
  font-size: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* ── Embedded Terms of Business document ────────────────────── */
.terms-embed-card { padding: 0; overflow: hidden; }
.terms-embed-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
}
.terms-embed-head h2 { margin: 0; }
.terms-embed-sub { margin: 4px 0 0; font-size: 13px; color: var(--ink-soft); }
.terms-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 300px);
  min-height: 520px;
  border: none;
}

/* ── Terms of Business document ─────────────────────────────── */
.terms { color: var(--ink); }
.terms .doc-meta {
  font-size: 13px;
  color: var(--ink-soft);
  border-bottom: 2px solid var(--reades-blue);
  padding-bottom: 12px;
  margin-bottom: 22px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.terms h3 {
  font-size: 16px;
  color: var(--reades-blue);
  margin: 26px 0 8px;
}
.terms ol.clauses {
  counter-reset: clause;
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.terms ol.clauses > li {
  counter-increment: clause;
  padding-left: 40px;
  position: relative;
  line-height: 1.6;
  margin-bottom: 10px;
  font-size: 14.5px;
}
.terms ol.clauses > li::before {
  content: attr(data-section) "." counter(clause);
  position: absolute;
  left: 0;
  font-weight: bold;
  color: var(--reades-blue);
  font-size: 13.5px;
}
.terms table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 4px;
  font-size: 14px;
}
.terms th {
  text-align: left;
  background: var(--reades-blue);
  color: #fff;
  padding: 9px 12px;
  font-size: 13px;
}
.terms td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}
.terms tr:nth-child(even) td { background: var(--paper); }

@media (max-width: 640px) {
  .contact-grid { grid-template-columns: 1fr; }
  .tab { padding: 12px 12px 10px; font-size: 14px; }
  .greeting h1 { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .greeting h1 { transition: none; }
}

/* ── Client access management (team) ────────────────────────── */
.access-search { display: flex; gap: 8px; margin-bottom: 8px; }
.access-search input { flex: 1; }
.btn-small {
  background: var(--reades-blue);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: bold;
  border: none;
  border-radius: 6px;
  padding: 9px 14px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-small:hover { background: var(--reades-blue-dark); }
.btn-danger { background: #8f1d1d; }
.btn-danger:hover { background: #6e1414; }
.access-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.access-row:last-child { border-bottom: none; }
.access-who { font-size: 14px; line-height: 1.5; }
.access-actions { display: flex; gap: 8px; flex-shrink: 0; }
.access-reason { font-size: 12.5px; color: var(--reades-orange); }
.access-meta { font-size: 12px; color: var(--ink-soft); }
.access-empty { font-size: 13.5px; color: var(--ink-soft); }
.access-found { border-top: 1px solid var(--line); margin-top: 10px; }
.access-grant-form {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin: 10px 0 4px;
}
.access-grant-form input[type="text"] { width: 160px; }
.access-grant-form label { font-size: 13.5px; font-weight: normal; display: flex; align-items: center; gap: 5px; margin: 0; }

@media (max-width: 640px) {
  .access-row { flex-direction: column; align-items: flex-start; }
}

.state-tag { border-color: var(--reades-orange); color: #7a4a12; background: #fdf3e8; margin-left: 6px; }

.live-indicator {
  font-size: 12px;
  font-weight: normal;
  color: var(--ink-soft);
  margin-left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  vertical-align: middle;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  animation: livepulse 2s ease-in-out infinite;
}
@keyframes livepulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.access-row.row-changed { animation: rowflash 2.5s ease-out; }
@keyframes rowflash {
  0% { background: #fdf3e8; }
  100% { background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
  .access-row.row-changed { animation: none; background: #fdf3e8; }
}

/* ── Brand logo ─────────────────────────────────────────────── */
.brand-logo { height: 42px; width: auto; display: block; }
.brand small {
  display: block;
  margin-top: 5px;
  width: calc(42px * 305.9 / 127.09); /* = rendered logo width */
  font-size: 9px;
  text-transform: uppercase;
  text-align: center;
  text-align-last: justify; /* letters span edge-to-edge under the logo */
  letter-spacing: 1px;
  opacity: 0.8;
}
.login-logo { height: 74px; width: auto; display: block; margin: 0 auto 18px; }

.side-content { width: 100%; }
.side-content > section[hidden] { display: none; }
.doc-viewing-note {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 10px;
}
.doc-viewing-note a { color: var(--reades-blue); font-weight: bold; }


/* ── Microsoft-branded sign-in (per MS identity guidelines) ── */
.btn-ms {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 14px;
  padding: 11px;
  background: #fff;
  border: 1px solid #8C8C8C;
  border-radius: 6px;
  color: #5E5E5E;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn-ms:hover { background: #f5f5f5; }
.btn-ms svg { flex: 0 0 auto; }
.ms-caption {
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 6px 0 0;
}

/* ── Skeleton loading shimmer ───────────────────────────────── */
.skeleton-row {
  height: 44px;
  border-radius: 6px;
  margin: 8px 0;
  background: linear-gradient(90deg, var(--paper) 25%, #e9edf4 42%, var(--paper) 60%);
  background-size: 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
@media (prefers-reduced-motion: reduce) { .skeleton-row { animation: none; background: var(--paper); } }

.count-badge { font-weight: normal; color: var(--ink-soft); font-size: 15px; }
#live-updated { font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  .header-row { flex-wrap: wrap; }
  .header-greeting { order: 3; flex: 1 1 100%; margin: 8px 0 0; }
  .site-header { padding: 12px 0 0; }
  .header-row { padding: 0 45px; }
  .tab-bar { padding: 0 31px; } /* + 14px tab padding = 45px card-text line */
  main { padding: 16px 16px 48px; }
}

/* My Reades sits apart on the far right of the tab bar */
/* right-alignment handled by .tab-item--right */

/* Anti-twitch: buttons reserve their bold width via a hidden bold copy of
   their label, so the bold active state never shifts neighbours */
.tab { text-align: center; }
.tab::after {
  content: attr(data-label);
  display: block;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-weight: bold;
}

.brand-link { display: block; line-height: 0; }

/* ── My dashboard tiles ─────────────────────────────────────── */
.mydash-title {
  font-size: 23px;
  color: var(--reades-blue);
  margin: 4px 0 18px;
}
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.tile { margin-bottom: 0; }
.tile h2 a { color: var(--reades-blue); text-decoration: none; }
.tile h2 a:hover { text-decoration: underline; }
.tile-msg { margin: 6px 0 10px; font-size: 14.5px; color: var(--ink-soft); line-height: 1.55; }
.tile-msg a { color: var(--reades-blue); font-weight: bold; }
.tile-counts { list-style: none; padding: 0; margin: 0; }
.tile-counts li { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.tile-counts li:last-child { border-bottom: none; }
.tile-counts a { color: var(--reades-blue); text-decoration: none; font-weight: bold; }
.tile-counts a:hover { text-decoration: underline; }
.tile-counts strong { color: var(--reades-orange); }

/* ── Activity feeds ─────────────────────────────────────────── */
.activity-list--expanded {
  max-height: 420px;           /* ~14 rows; the rest scroll */
  overflow-y: auto;
  border-bottom: 1px solid #eee;
}
.activity-more {
  margin-top: 10px;
  background: none;
  border: 1px solid var(--purple, #4B2B7A);
  color: var(--purple, #4B2B7A);
  border-radius: 6px;
  padding: 5px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.activity-more:hover { background: #f4effa; }
.activity-more + .activity-more { margin-left: 8px; }

.activity-row {
  display: grid;
  grid-template-columns: 130px 230px 1fr 120px;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  align-items: baseline;
}
.activity-row:last-child { border-bottom: none; }
.activity-when { color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.activity-what { color: var(--reades-blue); font-weight: bold; }
.activity-who { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-ip { color: var(--ink-soft); text-align: right; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  .activity-row { grid-template-columns: 1fr 1fr; }
  .activity-ip { text-align: left; }
}

/* Client portal: subtitle centred rather than edge-justified */
.brand small.brand-sub--center {
  text-align: center;
  text-align-last: center;
  letter-spacing: 1.5px;
}
/* A lone tab is no navigation: hide the bar until there's a choice */
.tab-bar.tab-bar--solo { display: none; }

/* ── Instructions form ──────────────────────────────────────── */
.ins-form { display: flex; flex-direction: column; gap: 10px; }
.ins-form input[type="text"], .ins-form input[type="email"], .ins-form select {
  font: inherit; font-size: 13.5px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 6px; width: 100%;
}
.ins-signer-row { display: flex; gap: 8px; margin-bottom: 6px; }
.ins-signer-row .btn-small { flex: 0 0 auto; }
.ins-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; align-items: end; }
.ins-grid label { font-size: 12.5px; font-weight: bold; color: var(--ink-soft); display: flex; flex-direction: column; gap: 4px; }
.ins-grid label:has(input[type="checkbox"]) { flex-direction: row; align-items: center; font-weight: normal; font-size: 13.5px; color: var(--ink); }
#ins-send { align-self: flex-start; }

.sign-task {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.sign-task:last-child { border-bottom: none; }
.sign-task .btn-small { text-decoration: none; }
@media (max-width: 640px) { .sign-task { flex-direction: column; align-items: flex-start; } }

/* ── Instruction form refinements ───────────────────────────── */
/* Single fields (and field+button pairs) cap at half the card width */
.ins-form .field-half { width: 100%; max-width: 50%; }
.ins-form .access-search.field-half input { min-width: 0; flex: 1; }

/* Numbered landlord rows */
.ins-signer-num {
  flex: 0 0 82px; font-size: 12.5px; font-weight: bold;
  color: var(--ink-soft); align-self: center;
}

/* Bank details stack vertically, labels above inputs */
.ins-stack { display: flex; flex-direction: column; gap: 10px; max-width: 50%; }
.ins-stack label {
  font-size: 12.5px; font-weight: bold; color: var(--ink-soft);
  display: flex; flex-direction: column; gap: 4px;
}

@media (max-width: 720px) {
  .ins-form .field-half, .ins-stack { max-width: 100%; }
  .ins-signer-num { flex-basis: 100%; align-self: flex-start; }
  .ins-signer-row { flex-wrap: wrap; }
}

/* ── Instruction form: tightened layout (overrides earlier rules) ── */
.ins-form { max-width: 660px; }
.ins-form .field-half { max-width: 100%; }
.ins-sec {
  font-size: 13px; font-weight: bold; color: var(--reades-blue);
  margin: 10px 0 0;
}
.ins-sec span { font-weight: normal; color: var(--ink-soft); }
.ins-grid { grid-template-columns: repeat(2, 1fr); }
.ins-checks { display: flex; flex-wrap: wrap; column-gap: 22px; row-gap: 8px; align-items: center; font-size: 13.5px; }
.ins-checks label { display: flex; align-items: center; gap: 6px; }
.ins-checks .ins-inline-num input { width: 56px; }
.ins-stack { max-width: 100%; }
.ins-signer-num { flex: 0 0 72px; }
@media (max-width: 720px) { .ins-grid { grid-template-columns: 1fr; } }

/* ── Instruction form: section title polish ─────────────────── */
/* Titles in Reades orange */
.ins-form .ins-sec { color: var(--reades-orange); }
/* Section 6's title lives inside #ins-bank, outside the form's flex gap —
   give the wrapper the same internal rhythm so title→content spacing is
   uniform across all six sections */
#ins-bank { display: flex; flex-direction: column; gap: 10px; }

/* ── Instruction status: RAG chips, tables, confirmation dialog ── */
.ins-table-title {
  font-size: 13px; font-weight: bold; color: var(--reades-orange);
  margin: 14px 0 4px; text-transform: uppercase; letter-spacing: 0.4px;
}
.ins-signers-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 4px; }
.ins-signer-chip { display: inline-flex; align-items: center; gap: 6px; }
.rag {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  font-size: 11.5px; font-weight: bold;
}
.rag-red   { background: #fbe9e7; color: #8f1d1d; }
.rag-amber { background: #fff3d6; color: #8a5a00; }
.rag-green { background: #e3f3e6; color: #1d6f2b; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 30, 55, 0.45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
/* display:flex overrides the hidden attribute's UA display:none —
   restate it explicitly so [hidden] always wins */
.modal-overlay[hidden] { display: none; }
.modal-box {
  background: #fff; border-radius: 10px; padding: 22px 26px;
  max-width: 420px; width: calc(100% - 48px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.modal-box h2 { color: var(--reades-blue); margin: 0 0 10px; font-size: 18px; }
.modal-box p { font-size: 14px; margin: 0 0 10px; }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; }

/* ── Instruction form as a modal ────────────────────────────── */
.ins-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-box--form { max-width: 720px; max-height: 88vh; overflow-y: auto; }
.modal-box--form .ins-form { max-width: 100%; }

/* ── Breadcrumbs (below the solid header) ───────────────────── */
.crumbs {
  position: sticky;
  top: var(--header-h, 118px); /* measured by JS; fallback approximate */
  z-index: 40; /* under the header (50), over content */
  /* Full-bleed background WITHOUT 100vw (which includes the scrollbar and
     caused a few pixels of horizontal overflow): the bar itself stays a
     normal centred block; the background is painted outward with a spread
     shadow and clipped — pure paint, zero layout width */
  background: var(--paper);
  box-shadow: 0 0 0 100vmax var(--paper);
  clip-path: inset(0 -100vmax);
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 61px 8px; /* the shared card-text line */
  font-size: 12.5px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
}
.crumb-link {
  appearance: none; background: none; border: none; padding: 0;
  font: inherit; font-size: 12.5px; color: var(--ink-soft); cursor: pointer;
}
.crumb-link:hover { color: var(--reades-blue); text-decoration: underline; }
.crumb-sep { color: var(--ink-soft); }
.crumb-here { color: var(--reades-blue); font-weight: bold; }
@media (max-width: 640px) { .crumbs { padding: 10px 45px 2px; } .panel > h1 { margin-left: 29px; } }


/* Panel titles sit on the card-text line (main 32px + card 29px) */
.panel > h1 { margin-left: 29px; }

/* ── Stacked field groups: uniform control heights, sensible width ── */
.ins-stack { max-width: 340px; }
.ins-form .ins-stack input[type="text"],
.ins-form .ins-stack input[type="email"],
.ins-form .ins-stack input[type="date"],
.ins-form .ins-stack select {
  font: inherit;
  font-size: 13.5px;
  padding: 0 10px;
  height: 38px;            /* one height for text, date, and select */
  line-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 100%;
  background: #fff;
  color: var(--ink);
}

/* ── Instruction modal header & intro ───────────────────────── */
.modal-box--form .ins-header { margin-bottom: 12px; align-items: flex-start; }
.modal-box--form .ins-header .btn-small { margin-left: 24px; flex: 0 0 auto; }
.ins-intro {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 0 0 4px;
  max-width: 480px; /* stops short of the button's column; wraps to two lines */
}

/* Marketing & commencement: one option per line */
.ins-checks--stack { flex-direction: column; align-items: flex-start; gap: 10px; }

/* Remittance fields match Plan & rent exactly */
#ins-bank .ins-stack { max-width: 340px; }

/* Team-network login: Microsoft button leads, with room to breathe */
body.team-network h1 { margin-bottom: 26px; }
body.team-network .btn-ms { margin-top: 10px; }
body.team-network .ms-caption { margin-top: 14px; }
#show-client-signin {
  display: block;
  margin: 26px 0 10px;
  font-size: 12.5px;
  color: var(--ink-soft);
  text-decoration: underline;
  text-align: center;
}
#show-client-signin[hidden] { display: none; }

/* Owners without an email in Street: the field is visibly not the remedy */
.ins-form input.ins-email:disabled {
  background: #eef0f4;
  color: var(--ink-soft);
  cursor: not-allowed;
  border-style: dashed;
}

/* ── Street search: in-flight spinner + found flash ─────────── */
.ins-search-status {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 4px; font-size: 13px; color: var(--ink-soft);
}
.ins-spinner {
  width: 15px; height: 15px; flex: 0 0 auto;
  border: 2px solid var(--line);
  border-top-color: var(--reades-orange);
  border-radius: 50%;
  animation: ins-spin 0.7s linear infinite;
}
@keyframes ins-spin { to { transform: rotate(360deg); } }
.ins-found { color: var(--ok); font-weight: bold; animation: ins-found-pop 0.4s ease; }
@keyframes ins-found-pop {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ins-spinner { animation: none; border-top-color: var(--line); }
  .ins-found { animation: none; }
}

/* ── Login splash: the brand holds the stage while the network check
     decides which sign-in to present ─────────────────────────── */
#login-splash {
  min-height: 152px; /* approximates the client form, so the reveal doesn't jump */
  display: flex;
  align-items: center;
  justify-content: center;
}
#login-splash[hidden] { display: none; }
/* While deciding, the logo's own orange underline draws itself */
#logo-underline {
  transform-box: fill-box;
  transform-origin: left center;
}
.login-card.deciding #logo-underline {
  animation: logo-draw 1.15s ease-in-out infinite;
}
@keyframes logo-draw {
  0% { transform: scaleX(0); }
  60% { transform: scaleX(1); }
  100% { transform: scaleX(1); } /* draw, hold a beat, again */
}
@media (prefers-reduced-motion: reduce) {
  .login-card.deciding #logo-underline { animation: none; }
}

/* ── Batch: access filter, archived identity, changelog size, grid ── */

/* A1: after a menu selection, hover can't resurrect the menu until the
   pointer has genuinely left the tab */
.tab-item.menu-suppressed .tab-menu { display: none !important; }

/* A5/A6: compact filter — an icon that unfolds into a field */
.filter-note { font-weight: normal; font-size: 12.5px; color: var(--ink-soft); margin-left: 8px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head--tools { justify-content: flex-end; margin-bottom: 8px; }
/* filter as its own row: left-aligned with card text, breathing room both sides */
.filter-ctl--row {
  margin: 14px 0 16px 20px; /* 20px = card padding, so it aligns with card text */
}
.panel-head h1 { margin: 0; }
.filter-ctl { display: flex; align-items: center; gap: 6px; }
.filter-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-soft);
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.filter-btn:hover { color: var(--reades-blue); border-color: var(--reades-blue); }
.filter-field { display: inline-flex; align-items: center; gap: 4px; }
.filter-field[hidden] { display: none; }
.filter-field input {
  width: 220px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  font-size: 13px;
}
.filter-field #access-filter-clear {
  background: transparent; border: none; cursor: pointer;
  font-size: 17px; line-height: 1; color: var(--ink-soft);
  padding: 2px 4px; visibility: hidden;
}
.filter-field.has-value #access-filter-clear { visibility: visible; }
.filter-field #access-filter-clear:hover { color: var(--error); }

/* A7: archived banner — unmissable, not shouty */
.doc-viewing-note.archived-banner[hidden] { display: none; } /* display:flex must not override hidden */
.doc-viewing-note.archived-banner {
  margin: 0 20px 12px;
  padding: 10px 14px;
  background: #fdecea;
  border-left: 4px solid var(--error);
  border-radius: 6px;
  color: #8f1d1d;
  display: flex;
  align-items: center;
  gap: 10px;
}
.doc-viewing-note.archived-banner a { color: var(--reades-blue); }

/* A8: changelog matches the standard text size */
.changelog li { font-size: 13.5px; }

/* A9: pill parity + the red archived family */
.version-tag { font-size: 12px; }
.version-tag--archived {
  background: #fdecea;
  border-color: #f2b8b5;
  color: #8f1d1d;
  font-weight: bold;
}

/* A11: instructions layout — block rows, fixed slots, calm sizing */
.access-row.ins-row { display: block; font-size: 13px; }
.ins-line-1 {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
  align-items: baseline;
}
.ins-col-prop { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ins-line-2 {
  margin: 5px 0 2px 140px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.ins-signer-line {
  display: grid;
  grid-template-columns: 220px 200px 1fr;
  gap: 10px;
  align-items: center;
  margin: 6px 0 0 140px;
  font-size: 12.5px;
  color: var(--ink-soft);
}
@media (max-width: 820px) {
  .ins-line-1 { grid-template-columns: 1fr; gap: 2px; }
  .ins-line-2, .ins-signer-line { margin-left: 0; }
  .ins-signer-line { grid-template-columns: 1fr; gap: 4px; }
  .ins-col-prop { white-space: normal; }
}

/* Terms embed: with the title bar gone, the frame IS the card */
.terms-embed-card { padding: 0; }
.terms-frame { border-radius: 12px; display: block; }

/* Document switch: quiet text, brand underline on the active document */
.doc-switch {
  display: flex;
  gap: 22px;
  padding: 14px 20px 0;
}
.doc-switch-btn {
  background: none;
  border: none;
  padding: 0 0 8px;
  font-size: 13.5px;
  color: var(--ink-soft);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.doc-switch-btn:hover { color: var(--reades-blue); }
.doc-switch-btn[aria-selected="true"] {
  color: var(--reades-blue);
  font-weight: bold;
  border-bottom-color: var(--reades-orange);
}
.doc-switch-note { font-weight: normal; font-size: 11.5px; color: var(--ink-soft); }
.terms-frame { border-radius: 0 0 12px 12px; }

/* Touch: the menu opens by class, not hover */
.tab-item.menu-open .tab-menu { display: block; }

/* No rubber-band bounce when scrolling over non-scrolling regions */
html, body { overscroll-behavior: none; }
.terms-frame { overscroll-behavior: contain; }

/* Instructions orientation note */
.intro-note p { font-size: 13.5px; line-height: 1.6; margin: 0 0 10px; color: var(--ink); }
.intro-note p:last-child { margin-bottom: 0; }
.intro-note strong { color: var(--reades-blue); }
.intro-note a { color: var(--reades-blue); }

/* Overseas payment toggle */
.overseas-toggle { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; font-size: 13px; }
.overseas-block[hidden] { display: none; }

/* ── Help tooltips: discreet ? that reveals guidance on demand ── */
.help-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; margin-left: 6px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  font-size: 11px; font-weight: bold; line-height: 1;
  cursor: pointer; vertical-align: middle;
  padding: 0;
}
.help-dot:hover, .help-dot[aria-expanded="true"] {
  border-color: var(--reades-blue); color: var(--reades-blue);
}
.help-pop {
  position: absolute; z-index: 1000; /* above the instruction modal (100) — popover is body-appended */
  max-width: 320px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
  padding: 12px 14px;
  font-size: 12.5px; line-height: 1.55; color: var(--ink);
  font-weight: normal;
}
.help-pop[hidden] { display: none; }
.help-pop em { color: var(--reades-blue); font-style: normal; font-weight: bold; }

/* Touch fallback for the Part 1 specimen (iOS can't scroll PDFs in iframes) */
.doc-frame-fallback { padding: 40px 24px; text-align: center; }
.doc-frame-fallback p { font-size: 14px; color: var(--ink-soft); margin: 0 0 16px; }
.doc-frame-fallback[hidden] { display: none; }

/* ── Read-only shadow treatment ─────────────────────────────── */
.shadow-bar {
  position: sticky; top: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  background: #c0392b; color: #fff;
  font-size: 13px; font-weight: 600;
  padding: 8px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.shadow-bar strong { font-weight: 800; }
.shadow-bar button {
  background: #fff; color: #c0392b;
  border: none; border-radius: 6px;
  padding: 4px 14px; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.shadow-bar button:hover { background: #ffe9e6; }
/* red viewport surround while shadowing */
body.shadowing { box-shadow: inset 0 0 0 4px #c0392b; min-height: 100vh; }
.shadow-identity { color: #ffdad5 !important; font-weight: 800; }

/* ── Portal confirm dialog ──────────────────────────────── */
.confirm-overlay {
  position: fixed; inset: 0; background: rgba(15, 30, 55, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 3000; /* above .modal-overlay (100) so it stacks over the instruction modal */
}
.confirm-box {
  background: #fff; border-radius: 10px; padding: 20px 24px;
  max-width: 440px; width: calc(100% - 48px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}
.confirm-box h3 { margin: 0 0 8px; color: var(--reades-blue); font-size: 16.5px; }
.confirm-box p { margin: 0 0 16px; font-size: 13.5px; color: var(--ink); line-height: 1.5; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }
