:root {
  --bg: #eef4fb;
  --bg-strong: #e7eff8;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --surface-dark: #004eeb;
  --surface-deep: #1f2b3d;
  --line: rgba(70, 99, 126, 0.14);
  --line-strong: rgba(24, 139, 246, 0.2);
  --text: #2c3345;
  --muted: #607179;
  --muted-strong: #354860;
  --accent: #188bf6;
  --accent-deep: #004eeb;
  --ink: #1f2b3d;
  --success: #2f6f55;
  --warning: #9a5a27;
  --shadow-lg: 0 24px 80px rgba(32, 53, 76, 0.12);
  --shadow-md: 0 20px 40px rgba(51, 79, 106, 0.08);
  --radius-xl: 34px;
  --radius-lg: 26px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --max-width: 1360px;
  --serif: "Playfair Display", "Times New Roman", serif;
  --sans: "Poppins", "Avenir Next", sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body.portal-page {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  background:
    radial-gradient(circle at top left, rgba(24, 139, 246, 0.18), transparent 28%),
    radial-gradient(circle at 84% 18%, rgba(249, 243, 222, 0.88), transparent 24%),
    linear-gradient(180deg, #f4f8fc 0%, #eaf1f8 52%, #edf3f8 100%);
  overflow-x: hidden;
}

body.portal-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(24, 139, 246, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 139, 246, 0.045) 1px, transparent 1px);
  background-size: 120px 120px;
  mask-image: radial-gradient(circle at center, black 42%, transparent 84%);
  opacity: 0.42;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.portal-shell {
  position: relative;
  z-index: 1;
}

.portal-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(78px);
  opacity: 0.28;
  pointer-events: none;
  z-index: 0;
}

.portal-glow-left {
  top: -10rem;
  left: -10rem;
  width: 34rem;
  height: 34rem;
  background: rgba(24, 139, 246, 0.18);
}

.portal-glow-right {
  top: 20rem;
  right: -10rem;
  width: 30rem;
  height: 30rem;
  background: rgba(249, 243, 222, 0.82);
}

.portal-gridline {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(24, 139, 246, 0.05), transparent 35%),
    linear-gradient(315deg, rgba(249, 243, 222, 0.32), transparent 38%);
  z-index: 0;
}

.portal-chrome {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 1rem 1.25rem 0;
}

.portal-chrome-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.15rem;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow-md);
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.portal-brand img {
  width: 3rem;
  height: 3rem;
  border-radius: 1rem;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 10px 24px rgba(44, 51, 69, 0.12);
}

.portal-brand-copy {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.portal-brand strong {
  font-size: 0.98rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.portal-brand em {
  font-style: normal;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.portal-chrome-links {
  display: inline-flex;
  align-items: center;
  gap: 1.1rem;
  color: var(--muted-strong);
  font-size: 0.94rem;
}

.portal-chrome-links a {
  position: relative;
}

.portal-chrome-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.1rem;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease;
}

.portal-chrome-links a:hover::after,
.portal-chrome-links a:focus-visible::after {
  transform: scaleX(1);
}

.portal-app {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

.noscript-card {
  max-width: 44rem;
  margin: 3rem auto;
  padding: 1rem 1.2rem;
  border-radius: var(--radius-md);
  background: rgba(255, 244, 231, 0.96);
  border: 1px solid rgba(183, 147, 88, 0.24);
  color: var(--muted-strong);
}

.auth-layout,
.workspace-grid,
.summary-grid,
.document-grid,
.activity-grid,
.page-preview-grid,
.processor-queue,
.security-grid,
.assignment-grid {
  display: grid;
  gap: 1.35rem;
}

.auth-layout {
  grid-template-columns: 1.1fr 0.9fr;
  align-items: stretch;
  padding-top: 2rem;
}

/* ── Loading skeleton ── */

.portal-loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
}

.portal-loading-inner {
  display: grid;
  gap: 1rem;
  justify-items: center;
  text-align: center;
  max-width: 280px;
}

.portal-loading-logo img {
  width: 4rem;
  height: 4rem;
  border-radius: 1.1rem;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 8px 24px rgba(44, 51, 69, 0.1);
}

.portal-loading-bar {
  width: 180px;
  height: 4px;
  border-radius: 999px;
  background: rgba(70, 99, 126, 0.12);
  overflow: hidden;
}

.portal-loading-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  animation: portal-loading-sweep 1.4s ease-in-out infinite;
  width: 40%;
}

@keyframes portal-loading-sweep {
  0%   { transform: translateX(-150%); }
  100% { transform: translateX(400%); }
}

.portal-loading-text {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

/* ── Centered auth layout (production login) ── */

.auth-layout-centered {
  display: grid;
  gap: 1.5rem;
  justify-items: center;
  padding-top: 4rem;
  padding-bottom: 4rem;
  min-height: 70vh;
}

.auth-hero-card {
  width: 100%;
  max-width: 420px;
  display: grid;
  gap: 1.2rem;
  padding: 2rem 1.8rem;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.82));
  box-shadow: var(--shadow-lg);
}

.auth-hero-branding {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
  text-align: center;
}

.auth-hero-logo {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 1.2rem;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 10px 28px rgba(44, 51, 69, 0.12);
  margin-bottom: 0.5rem;
}

.auth-hero-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text);
}

.auth-hero-subtitle {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-deep);
  font-weight: 600;
}

.auth-submit-button {
  width: 100%;
}

.auth-google-btn {
  width: 100%;
  background: #ffffff;
  border: 1px solid rgba(70, 99, 126, 0.2);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  font-weight: 600;
}

.auth-google-btn:hover,
.auth-google-btn:focus-visible {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  border-color: rgba(70, 99, 126, 0.3);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(70, 99, 126, 0.14);
}

.auth-success {
  background: rgba(16, 148, 102, 0.07);
  border: 1px solid rgba(16, 148, 102, 0.18);
  border-radius: 1rem;
  padding: 1rem 1.1rem;
  color: var(--success);
  font-size: 0.92rem;
  line-height: 1.55;
  text-align: center;
}

.auth-hero-footer {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.auth-demo-toggle {
  width: 100%;
  max-width: 420px;
}

.auth-demo-summary {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(244, 248, 252, 0.82);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.auth-demo-summary:hover {
  border-color: rgba(24, 139, 246, 0.2);
}

.auth-demo-toggle .demo-grid {
  margin-top: 0.85rem;
}

.auth-story,
.auth-card,
.panel,
.workspace-rail {
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.72));
  box-shadow: var(--shadow-lg);
}

.auth-story,
.auth-card {
  border-radius: var(--radius-xl);
  padding: 2rem;
}

.auth-eyebrow,
.section-kicker,
.meta-kicker,
.queue-chip,
.mini-kicker {
  margin: 0 0 0.65rem;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.auth-title,
.workspace-title,
.section-title,
.panel-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 0.95;
  color: var(--text);
}

.auth-title {
  font-size: clamp(3.4rem, 5vw, 5.4rem);
  max-width: 10ch;
}

.auth-copy,
.section-copy,
.panel-copy,
.mini-copy,
.detail-copy,
.timeline-copy {
  line-height: 1.7;
  color: var(--muted);
}

.trust-list,
.detail-list,
.safe-list,
.metric-list,
.timeline-list {
  display: grid;
  gap: 0.9rem;
  padding: 0;
  margin: 1.25rem 0 0;
  list-style: none;
}

.trust-list li,
.detail-list li,
.safe-list li,
.metric-list li {
  padding: 1rem 1rem 1rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.48);
}

.demo-grid {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.5rem;
}

.demo-card {
  display: grid;
  gap: 0.6rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(244, 248, 252, 0.82);
}

.demo-card strong,
.queue-card strong,
.stat-value,
.summary-value,
.rail-title {
  color: var(--text);
}

.demo-role {
  color: var(--muted);
  font-size: 0.92rem;
}

.demo-cta {
  justify-self: start;
}

.auth-card {
  display: grid;
  gap: 1.2rem;
}

.auth-card-topline,
.section-head,
.panel-head,
.workspace-title-row,
.control-head,
.document-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.auth-card-title {
  margin: 0;
  font-size: 1.35rem;
}

.auth-form,
.custom-form {
  display: grid;
  gap: 1rem;
}

.auth-label,
.field-label,
.control-label,
.input-label {
  display: grid;
  gap: 0.45rem;
  font-size: 0.92rem;
  color: var(--muted-strong);
}

.auth-input,
.field-control,
.control-select,
.control-note,
.custom-form input,
.custom-form select,
.custom-form textarea {
  width: 100%;
  border: 1px solid rgba(70, 99, 126, 0.14);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  padding: 0.9rem 1rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.auth-input:focus,
.field-control:focus,
.control-select:focus,
.control-note:focus,
.custom-form input:focus,
.custom-form select:focus,
.custom-form textarea:focus {
  outline: none;
  border-color: rgba(24, 139, 246, 0.32);
  box-shadow: 0 0 0 4px rgba(24, 139, 246, 0.1);
}

.field-control,
.control-note,
.custom-form textarea {
  min-height: 3.2rem;
}

textarea.field-control,
.control-note,
.custom-form textarea {
  min-height: 6.4rem;
  resize: vertical;
}

.button-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.82rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
}

.button-primary {
  background: linear-gradient(135deg, var(--accent-deep), var(--accent));
  color: #ffffff;
  box-shadow: 0 18px 30px rgba(24, 139, 246, 0.24);
}

.button-secondary {
  background: rgba(255, 255, 255, 0.74);
  border-color: rgba(70, 99, 126, 0.12);
  color: var(--text);
}

.button-ghost {
  background: rgba(24, 139, 246, 0.08);
  border-color: rgba(24, 139, 246, 0.16);
  color: var(--accent-deep);
}

.auth-error,
.flash-card {
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  font-size: 0.94rem;
}

.auth-error {
  background: rgba(167, 97, 43, 0.08);
  border: 1px solid rgba(167, 97, 43, 0.18);
  color: var(--warning);
}

.auth-note,
.login-note,
.muted-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.workspace {
  display: grid;
  gap: 1.25rem;
  padding-top: 1.5rem;
}

.borrower-workspace {
  gap: 1rem;
}

.workspace-header {
  display: grid;
  gap: 1rem;
}

.workspace-title-row {
  padding: 1.4rem 1.5rem 1.3rem;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.78);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(248, 252, 255, 0.84));
  box-shadow: var(--shadow-md);
}

.workspace-kicker {
  margin: 0 0 0.7rem;
  color: var(--accent-deep);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.74rem;
}

.workspace-title {
  font-size: clamp(2.7rem, 4.5vw, 4.3rem);
  margin-bottom: 0.5rem;
}

.workspace-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.workspace-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: flex-end;
}

.workspace-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.workspace-nav-button {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid rgba(70, 99, 126, 0.12);
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted-strong);
  padding: 0.8rem 1rem;
  border-radius: 999px;
  font-weight: 700;
}

.workspace-nav-button.has-tone.status-complete:not(.is-active) {
  border-color: rgba(66, 140, 110, 0.28);
  background: rgba(232, 244, 237, 0.94);
  color: #2f6f55;
}

.workspace-nav-button.has-tone.status-pending:not(.is-active) {
  border-color: rgba(24, 139, 246, 0.18);
  background: rgba(232, 243, 255, 0.88);
  color: var(--accent-deep);
}

.workspace-nav-button.has-tone.status-warning:not(.is-active) {
  border-color: rgba(183, 135, 49, 0.22);
  background: rgba(255, 248, 232, 0.92);
  color: var(--warning);
}

.workspace-nav-button.has-tone.status-review:not(.is-active) {
  border-color: rgba(24, 139, 246, 0.22);
  background: rgba(232, 243, 255, 0.92);
  color: var(--accent-deep);
}

.workspace-nav-button.has-tone.status-awaiting:not(.is-active) {
  border-color: rgba(217, 164, 44, 0.24);
  background: rgba(255, 248, 225, 0.92);
  color: #8a6914;
}

.workspace-nav-button.is-active {
  background: linear-gradient(135deg, var(--accent-deep), var(--accent));
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 16px 30px rgba(24, 139, 246, 0.22);
}

.workspace-nav-button.is-active .nav-status-dot {
  background: rgba(255, 255, 255, 0.88);
}

.nav-status-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 999px;
  background: rgba(70, 99, 126, 0.24);
  flex-shrink: 0;
}

.nav-status-dot.status-complete {
  background: #4d9b75;
}

.nav-status-dot.status-pending {
  background: #d09a4d;
}

.nav-status-dot.status-review {
  background: var(--accent);
}

.nav-status-dot.status-awaiting {
  background: #d4a82c;
}

.workspace-grid {
  grid-template-columns: 320px minmax(0, 1fr);
  align-items: start;
}

.borrower-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(260px, 0.82fr);
  gap: 1rem;
  align-items: stretch;
}

.borrower-hero-copy,
.borrower-hero-side {
  display: grid;
  gap: 0.9rem;
}

/* ── Compact borrower hero (production) ── */

.borrower-hero-compact {
  display: grid;
  gap: 0.85rem;
  padding: 1.2rem 1.4rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 252, 255, 0.86));
  box-shadow: var(--shadow-md);
}

.borrower-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.borrower-hero-info {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.borrower-hero-property {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text);
}

.borrower-hero-deal-id {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.borrower-progress-bar {
  display: grid;
  gap: 0.4rem;
}

.borrower-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.borrower-progress-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

.borrower-progress-count {
  font-size: 0.82rem;
  color: var(--muted);
}

.borrower-next-step {
  margin: 0;
  padding: 0.65rem 0.85rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(24, 139, 246, 0.14);
  background: rgba(232, 243, 255, 0.7);
  color: var(--accent-deep);
  font-size: 0.9rem;
  font-weight: 600;
}

.button-sm {
  min-height: 2.4rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
}

.borrower-nav {
  margin-top: -0.1rem;
}

.borrower-main {
  display: grid;
  gap: 1.2rem;
}

.page-main {
  display: grid;
  gap: 1.2rem;
}

.deal-queue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1rem;
}

.queue-card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.queue-card-copy {
  margin: 0;
}

.deal-queue-card strong {
  font-size: 1.2rem;
}

.workspace-rail,
.panel {
  border-radius: var(--radius-lg);
  padding: 1.3rem;
}

.workspace-rail {
  position: sticky;
  top: 6.5rem;
  display: grid;
  gap: 1rem;
}

.rail-title {
  margin: 0;
  font-size: 1.15rem;
}

.rail-copy,
.queue-card p,
.timeline-meta,
.upload-meta,
.visibility-copy {
  color: var(--muted);
  line-height: 1.6;
}

.queue-stack,
.control-stack {
  display: grid;
  gap: 0.85rem;
}

.requirement-group-stack {
  display: grid;
  gap: 1rem;
}

.queue-card,
.control-card,
.document-card,
.mini-card,
.field-card,
.timeline-item,
.security-step {
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(244, 248, 252, 0.82);
}

.queue-card {
  display: grid;
  gap: 0.55rem;
  text-align: left;
}

.queue-card.is-active {
  border-color: rgba(24, 139, 246, 0.34);
  background: rgba(232, 243, 255, 0.92);
  box-shadow: inset 0 0 0 1px rgba(24, 139, 246, 0.16);
}

.queue-card.is-complete {
  border-color: rgba(66, 140, 110, 0.2);
  background:
    linear-gradient(180deg, rgba(248, 253, 249, 0.96), rgba(236, 247, 240, 0.94)),
    linear-gradient(135deg, rgba(66, 140, 110, 0.06), transparent 55%);
}

.queue-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.panel {
  display: grid;
  gap: 1.1rem;
}

.panel-title {
  font-size: 2.2rem;
}

.panel-subtitle {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.72rem;
  border-radius: 999px;
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.source-lead {
  background: rgba(47, 111, 85, 0.08);
  color: #2c6a52;
}

.source-transcript {
  background: rgba(24, 139, 246, 0.1);
  color: var(--accent-deep);
}

.source-rep {
  background: rgba(249, 243, 222, 1);
  color: var(--text);
}

.source-verified {
  background: rgba(44, 51, 69, 0.08);
  color: var(--muted-strong);
}

.source-borrower {
  background: rgba(118, 91, 46, 0.08);
  color: #7a5f38;
}

.source-warning,
.status-warning {
  background: rgba(154, 90, 39, 0.1);
  color: var(--warning);
}

.status-pending {
  background: rgba(249, 243, 222, 1);
  color: var(--text);
}

.status-review {
  background: rgba(24, 139, 246, 0.1);
  color: var(--accent-deep);
}

.status-complete {
  background: rgba(47, 111, 85, 0.1);
  color: var(--success);
}

.status-awaiting {
  background: rgba(217, 164, 44, 0.14);
  color: #8a6914;
}

.status-muted {
  background: rgba(58, 54, 47, 0.07);
  color: var(--muted);
}

.stat-grid,
.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card,
.summary-card {
  padding: 1rem 1.05rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(244, 248, 252, 0.9);
}

.stat-label,
.summary-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-value,
.summary-value {
  font-size: 1.14rem;
  font-weight: 800;
}

.progress-card {
  display: grid;
  gap: 0.75rem;
}

.page-command-panel {
  border-color: rgba(24, 139, 246, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(236, 245, 255, 0.9)),
    radial-gradient(circle at top right, rgba(249, 243, 222, 0.74), transparent 38%);
}

.page-quick-actions {
  flex-wrap: wrap;
}

.page-quick-actions .button {
  flex: 1 1 12rem;
}

.progress-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.progress-track {
  height: 0.75rem;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(70, 99, 126, 0.1);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--surface-dark));
}

.list-stack {
  display: grid;
  gap: 0.85rem;
}

.list-row {
  display: grid;
  gap: 0.45rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(244, 248, 252, 0.82);
}

.list-row-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.list-title {
  margin: 0;
  font-size: 1rem;
}

.list-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.empty-state {
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(24, 139, 246, 0.24);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.5);
}

.intake-section-stack {
  display: grid;
  gap: 1rem;
}

.section-block {
  display: grid;
  gap: 1rem;
  padding-top: 0.2rem;
}

.celebration-panel {
  border-color: rgba(24, 139, 246, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(236, 246, 255, 0.86)),
    radial-gradient(circle at top right, rgba(249, 243, 222, 0.75), transparent 38%);
}

.task-section.is-complete,
.term-sheet-card.is-complete {
  border-color: rgba(66, 140, 110, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(235, 246, 239, 0.9)),
    radial-gradient(circle at top right, rgba(77, 155, 117, 0.08), transparent 36%);
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.field-grid,
.control-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-card {
  display: grid;
  gap: 0.7rem;
}

.field-card.is-missing {
  border-color: rgba(24, 139, 246, 0.24);
  background: rgba(249, 243, 222, 0.84);
}

.field-card.is-approved {
  border-color: rgba(66, 140, 110, 0.18);
  background: rgba(236, 247, 240, 0.92);
}

.field-card.is-needs-update {
  border-color: rgba(183, 135, 49, 0.22);
  background: rgba(255, 248, 232, 0.94);
}

.field-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.field-name {
  margin: 0;
  font-size: 0.96rem;
}

.field-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.91rem;
  line-height: 1.55;
}

.field-review-controls {
  display: grid;
  gap: 0.65rem;
  padding-top: 0.2rem;
}

.field-review-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.field-review-actions {
  flex-wrap: wrap;
}

.field-review-actions .button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.borrower-approval-controls {
  border-top: 1px solid rgba(70, 99, 126, 0.08);
  padding-top: 0.75rem;
}

.field-approval-copy {
  margin: 0;
  color: var(--success);
  font-size: 0.92rem;
  font-weight: 600;
}

.inline-field-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
}

.field-inline-button {
  min-height: 2.7rem;
  padding: 0.72rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(24, 139, 246, 0.16);
  background: rgba(24, 139, 246, 0.08);
  color: var(--accent-deep);
  font-weight: 700;
}

.field-inline-button:hover,
.field-inline-button:focus-visible {
  transform: translateY(-1px);
}

.document-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.task-summary-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.task-list-stack {
  display: grid;
  gap: 0.9rem;
}

.task-inline-detail {
  display: grid;
  gap: 1rem;
}

.notification-panel {
  display: grid;
  gap: 1rem;
}

.notification-stack {
  display: grid;
  gap: 0.85rem;
}

.notification-button {
  width: 100%;
  display: grid;
  gap: 0.65rem;
  padding: 1rem 1.05rem;
  text-align: left;
  border-radius: var(--radius-md);
  border: 1px solid rgba(24, 139, 246, 0.16);
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.98), rgba(241, 246, 252, 0.92));
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.notification-button:hover,
.notification-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(24, 139, 246, 0.28);
  box-shadow: 0 12px 28px rgba(24, 139, 246, 0.1);
}

.notification-button.status-warning {
  border-color: rgba(183, 135, 49, 0.22);
  background: linear-gradient(180deg, rgba(255, 251, 242, 0.98), rgba(250, 242, 222, 0.94));
}

.notification-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.9rem;
}

.notification-meta {
  margin: 0 0 0.35rem;
  color: var(--accent-deep);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.notification-button h3 {
  margin: 0;
}

.notification-copy {
  margin: 0;
  color: var(--muted-strong);
}

.notification-action {
  color: var(--accent-deep);
  font-size: 0.93rem;
  font-weight: 700;
}

.task-row {
  width: 100%;
  display: block;
  text-align: left;
  padding: 1rem 1.05rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(70, 99, 126, 0.1);
  background: rgba(244, 248, 252, 0.86);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.task-row:hover,
.task-row:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(24, 139, 246, 0.2);
  box-shadow: 0 10px 24px rgba(24, 139, 246, 0.08);
}

.task-row.is-active {
  border-color: rgba(24, 139, 246, 0.34);
  background: rgba(232, 243, 255, 0.92);
  box-shadow: inset 0 0 0 1px rgba(24, 139, 246, 0.14);
}

.task-row.is-complete {
  border-color: rgba(66, 140, 110, 0.18);
  background: rgba(232, 244, 237, 0.94);
}

.task-row-copy {
  display: grid;
  gap: 0.35rem;
}

.task-row-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}

.task-row-topline h3 {
  margin: 0;
  font-size: 1rem;
}

.task-row-meta {
  margin: 0;
  color: var(--accent-deep);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.task-summary-card {
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(70, 99, 126, 0.1);
  background: rgba(244, 248, 252, 0.86);
}

.task-summary-card.is-complete {
  border-color: rgba(66, 140, 110, 0.18);
  background: rgba(232, 244, 237, 0.92);
}

.task-summary-label {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.uploaded-doc-stack,
.entity-party-stack {
  display: grid;
  gap: 1rem;
}

.uploaded-doc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 1.2rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(70, 99, 126, 0.1);
  background: rgba(244, 248, 252, 0.9);
}

.uploaded-doc-row.is-complete {
  border-color: rgba(66, 140, 110, 0.18);
  background: rgba(232, 244, 237, 0.94);
}

.uploaded-doc-row.is-complete .icon-button {
  border-color: rgba(66, 140, 110, 0.18);
  color: #2f6f55;
  background: rgba(255, 255, 255, 0.96);
}

.uploaded-doc-row.is-awaiting {
  border-color: rgba(217, 164, 44, 0.2);
  background: rgba(255, 248, 225, 0.88);
}

.uploaded-doc-row.is-awaiting .icon-button {
  border-color: rgba(217, 164, 44, 0.2);
  color: #8a6914;
  background: rgba(255, 255, 255, 0.96);
}

.uploaded-doc-copy {
  display: grid;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
}

.uploaded-doc-copy h3,
.uploaded-doc-topline {
  margin: 0;
}

.uploaded-doc-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.icon-button {
  width: 2.4rem;
  height: 2.4rem;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(24, 139, 246, 0.18);
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent-deep);
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(24, 139, 246, 0.08);
}

.icon-button:hover,
.icon-button:focus-visible {
  transform: translateY(-1px);
}

.address-field {
  display: grid;
}

.term-sheet-stack {
  display: grid;
  gap: 1rem;
}

.task-detail-panel {
  display: grid;
  gap: 1rem;
}

.document-card {
  display: grid;
  gap: 0.8rem;
}

.processor-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.processor-meta-line span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.processor-meta-line span::before {
  content: "";
  width: 0.32rem;
  height: 0.32rem;
  border-radius: 999px;
  background: rgba(24, 139, 246, 0.34);
}

.page-note-banner {
  margin: 0;
  padding: 0.8rem 0.9rem;
  border-radius: 1rem;
  border: 1px solid rgba(183, 135, 49, 0.2);
  background: rgba(255, 248, 232, 0.92);
  color: var(--muted-strong);
}

.document-card.is-review-ready {
  border-color: rgba(66, 140, 110, 0.2);
  background:
    linear-gradient(180deg, rgba(248, 253, 249, 0.96), rgba(236, 247, 240, 0.94)),
    linear-gradient(135deg, rgba(66, 140, 110, 0.06), transparent 55%);
}

.document-card.is-review-active {
  box-shadow: inset 0 0 0 1px rgba(24, 139, 246, 0.18);
}

.document-card.is-sensitive {
  border-color: rgba(44, 51, 69, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(244, 248, 252, 0.88)),
    linear-gradient(135deg, rgba(31, 43, 61, 0.04), transparent 50%);
}

.document-meta,
.detail-grid {
  display: grid;
  gap: 0.6rem;
}

.detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-item dt {
  margin-bottom: 0.25rem;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-item dd {
  margin: 0;
  color: var(--muted-strong);
}

.upload-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.82rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(70, 99, 126, 0.12);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  font-weight: 700;
}

.upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.upload-meta {
  margin: 0;
  font-size: 0.92rem;
}

.secure-note {
  color: var(--accent-deep);
}

.document-pill-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}

.review-ready-copy {
  color: #3d6a54;
  font-weight: 600;
}

.button-inline {
  min-height: 2.4rem;
  padding: 0.62rem 0.9rem;
  font-size: 0.9rem;
}

.document-card-actions,
.document-review-actions {
  justify-content: flex-start;
}

.page-section-actions {
  margin-top: 0.9rem;
}

.processor-stage-panel {
  display: grid;
  gap: 1rem;
}

.processor-stage-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
}

.processor-stage-chip {
  display: grid;
  gap: 0.35rem;
  padding: 0.95rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(70, 99, 126, 0.1);
  background: rgba(232, 243, 255, 0.9);
  text-align: left;
}

.processor-stage-chip strong {
  font-size: 0.96rem;
}

.processor-stage-chip.is-clickable {
  width: 100%;
  appearance: none;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.processor-stage-chip.is-clickable:hover,
.processor-stage-chip.is-clickable:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(24, 139, 246, 0.24);
  box-shadow: 0 10px 20px rgba(24, 139, 246, 0.08);
}

.processor-stage-chip.is-available {
  border-color: rgba(24, 139, 246, 0.18);
  background: rgba(232, 243, 255, 0.94);
  box-shadow: inset 0 0 0 1px rgba(24, 139, 246, 0.1);
}

.processor-stage-chip.is-selected {
  border-color: rgba(66, 140, 110, 0.22);
  background: rgba(236, 247, 240, 0.95);
  box-shadow: inset 0 0 0 1px rgba(66, 140, 110, 0.14);
}

.processor-stage-step,
.processor-stage-state {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.processor-stage-step {
  color: var(--accent-deep);
}

.processor-stage-state {
  color: var(--muted);
}

.page-review-panel {
  display: grid;
  gap: 1rem;
}

.upload-zone {
  display: grid;
  gap: 0.55rem;
  justify-items: center;
  padding: 1rem;
  border-radius: 1.2rem;
  border: 1.5px dashed rgba(24, 139, 246, 0.28);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(240, 245, 250, 0.86));
  text-align: center;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.upload-zone strong {
  color: var(--muted-strong);
}

.upload-zone-mobile-text {
  display: none;
}

.upload-zone span {
  color: var(--muted);
  font-size: 0.92rem;
}

.upload-zone.is-dragging {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(232, 243, 255, 0.98), rgba(240, 245, 250, 0.96));
  transform: translateY(-1px);
}

.upload-zone-button {
  width: 100%;
}

.record-list {
  display: grid;
  gap: 0.65rem;
}

.record-strip {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.8rem 0.9rem;
  border-radius: 1rem;
  border: 1px solid rgba(70, 99, 126, 0.1);
  background: rgba(255, 255, 255, 0.78);
}

.record-file {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.file-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.7rem;
  min-height: 2.7rem;
  padding: 0.3rem 0.45rem;
  border-radius: 0.95rem;
  background: linear-gradient(135deg, rgba(24, 139, 246, 0.14), rgba(0, 78, 235, 0.08));
  color: var(--accent-deep);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(24, 139, 246, 0.12);
}

.record-copy {
  display: grid;
  gap: 0.18rem;
}

.third-party-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.third-party-card {
  gap: 0.95rem;
}

.third-party-fields {
  display: grid;
  gap: 0.8rem;
}

.third-party-field {
  display: grid;
  gap: 0.4rem;
}

.third-party-field span {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted-strong);
}

.third-party-input {
  min-height: 3.1rem;
}

.entity-party-card {
  padding: 1.2rem;
}

.checkbox-row.is-disabled {
  opacity: 0.62;
}

.checkbox-row.is-disabled input {
  cursor: not-allowed;
}

.message-thread {
  display: grid;
  gap: 0.8rem;
}

.message-bubble {
  display: grid;
  gap: 0.35rem;
  max-width: 48rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}

.message-bubble strong {
  color: var(--muted-strong);
}

.message-bubble p,
.message-bubble span {
  margin: 0;
}

.message-bubble span {
  color: var(--muted);
  font-size: 0.88rem;
}

.message-bubble.is-team {
  background: rgba(255, 255, 255, 0.76);
}

.message-bubble.is-borrower {
  justify-self: end;
  background: rgba(232, 243, 255, 0.92);
  border-color: rgba(24, 139, 246, 0.2);
}

.security-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.security-step h3,
.timeline-item h3,
.control-card h3,
.document-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.activity-grid {
  grid-template-columns: 1.05fr 0.95fr;
}

.page-preview-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.timeline-list {
  margin-top: 0;
}

.timeline-item {
  display: grid;
  gap: 0.35rem;
}

.timeline-meta {
  font-size: 0.9rem;
}

.control-card {
  display: grid;
  gap: 0.9rem;
}

.requirement-group-panel .panel-title {
  font-size: 1.5rem;
}

.control-row {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(0, 0.84fr) minmax(0, 0.9fr);
}

.visibility-badge {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: rgba(58, 54, 47, 0.08);
  color: var(--muted-strong);
  font-size: 0.79rem;
  font-weight: 700;
}

.assignment-grid {
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: start;
}

.mini-card {
  display: grid;
  gap: 0.35rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted-strong);
}

.checkbox-row-block {
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(24, 139, 246, 0.14);
  background: rgba(244, 248, 252, 0.84);
}

.checkbox-row input {
  width: 1rem;
  height: 1rem;
}

.return-top-shell {
  display: flex;
  justify-content: center;
  padding: 1.1rem 1rem 0;
}

.return-top-button {
  min-width: 12rem;
  box-shadow: 0 16px 28px rgba(24, 139, 246, 0.12);
  background: rgba(255, 255, 255, 0.94);
}

.flash-card {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 40;
  background: rgba(23, 23, 23, 0.96);
  color: #f8f2ea;
  box-shadow: var(--shadow-md);
}

.inline-code {
  padding: 0.2rem 0.42rem;
  border-radius: 0.45rem;
  background: rgba(58, 54, 47, 0.08);
  font-family: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, monospace;
  font-size: 0.9em;
}

/* ── Hamburger menu toggle (hidden on desktop) ── */

.mobile-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid rgba(70, 99, 126, 0.12);
  border-radius: 0.85rem;
  background: rgba(244, 248, 252, 0.86);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 160ms ease;
}

.mobile-menu-toggle:active {
  background: rgba(24, 139, 246, 0.1);
}

.mobile-menu-icon {
  position: relative;
  display: block;
  width: 1.2rem;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: background 200ms ease;
}

.mobile-menu-icon::before,
.mobile-menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 200ms ease, top 200ms ease;
}

.mobile-menu-icon::before {
  top: -6px;
}

.mobile-menu-icon::after {
  top: 6px;
}

.mobile-menu-toggle[aria-expanded="true"] .mobile-menu-icon {
  background: transparent;
}

.mobile-menu-toggle[aria-expanded="true"] .mobile-menu-icon::before {
  top: 0;
  transform: rotate(45deg);
}

.mobile-menu-toggle[aria-expanded="true"] .mobile-menu-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

/* ── Reduced motion ── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ── Responsive breakpoints ── */

@media (max-width: 1120px) {
  .auth-layout,
  .workspace-grid,
  .activity-grid,
  .page-preview-grid,
  .assignment-grid {
    grid-template-columns: 1fr;
  }

  .workspace-rail {
    position: static;
  }

  .stat-grid,
  .summary-grid,
  .security-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .borrower-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  /* ── Header becomes compact with hamburger ── */
  .portal-chrome {
    padding: 0.75rem 0.75rem 0;
  }

  .portal-chrome-inner {
    padding: 0.7rem 0.9rem;
    border-radius: 1.2rem;
    flex-wrap: wrap;
  }

  .mobile-menu-toggle {
    display: inline-flex;
  }

  .portal-chrome-links {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--line);
    margin-top: 0.5rem;
  }

  .portal-chrome-links.is-open {
    display: flex;
  }

  .portal-chrome-links a {
    padding: 0.6rem 0.4rem;
    border-radius: 0.75rem;
    -webkit-tap-highlight-color: transparent;
  }

  .portal-chrome-links a:active {
    background: rgba(24, 139, 246, 0.06);
  }

  /* ── General spacing reduction ── */
  .portal-app {
    padding: 1rem 0.75rem 3rem;
  }

  .auth-story,
  .auth-card,
  .workspace-title-row,
  .workspace-rail,
  .panel {
    padding: 1.1rem;
    border-radius: var(--radius-md);
  }

  /* ── Grids to single column ── */
  .field-grid,
  .control-grid,
  .document-grid,
  .third-party-grid,
  .detail-grid,
  .control-row {
    grid-template-columns: 1fr;
  }

  /* ── Typography scales down ── */
  .workspace-title {
    font-size: clamp(2.2rem, 9vw, 3rem);
  }

  .panel-title {
    font-size: 1.7rem;
  }

  .auth-card-title {
    font-size: 1.2rem;
  }

  /* ── Stacking layouts ── */
  .record-strip {
    grid-template-columns: 1fr;
    display: grid;
  }

  .task-row-topline,
  .notification-topline,
  .uploaded-doc-row,
  .uploaded-doc-topline {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  /* ── Upload zone: touch-friendly ── */
  .upload-zone {
    padding: 1.5rem 1rem;
    border-width: 2px;
    min-height: 7rem;
  }

  .upload-zone strong {
    font-size: 1rem;
  }

  .upload-zone-desktop-text {
    display: none;
  }

  .upload-zone-mobile-text {
    display: block;
  }

  /* ── Message bubbles: less max-width ── */
  .message-bubble {
    max-width: 100%;
  }

  /* ── Workspace nav: scrollable row ── */
  .workspace-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.2rem;
  }

  .workspace-nav::-webkit-scrollbar {
    display: none;
  }

  .workspace-nav-button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  /* ── Decorative backgrounds: reduce on tablet ── */
  .portal-glow {
    opacity: 0.14;
  }

  body.portal-page::before {
    opacity: 0.2;
  }

  /* ── Workspace rail sidebar: card style on mobile ── */
  .workspace-rail {
    position: static;
    border-radius: var(--radius-md);
  }

  /* ── Auth centered layout: tighter on tablet ── */
  .auth-layout-centered {
    padding-top: 1.5rem;
    min-height: auto;
  }

  .auth-hero-card {
    padding: 1.3rem 1.2rem;
    gap: 1rem;
  }

  .auth-hero-logo {
    width: 3rem;
    height: 3rem;
    margin-bottom: 0.2rem;
  }

  .auth-hero-title {
    font-size: 1.1rem;
  }

  .auth-hero-branding {
    gap: 0.2rem;
  }

  .auth-form {
    gap: 0.8rem;
  }

  .auth-hero-card {
    max-width: none;
    margin: 0 0.5rem;
  }

  .auth-demo-toggle {
    max-width: none;
    margin: 0 0.5rem;
  }

  /* ── Borrower compact hero: stack on mobile ── */
  .borrower-hero-compact {
    padding: 1rem;
    border-radius: var(--radius-md);
  }

  .borrower-hero-property {
    font-size: clamp(1.2rem, 5vw, 1.6rem);
  }
}

@media (max-width: 620px) {
  .auth-title {
    font-size: clamp(2.2rem, 12vw, 3rem);
  }

  .button-row {
    align-items: stretch;
  }

  .button,
  .upload-label {
    width: 100%;
  }

  .stat-grid,
  .summary-grid,
  .security-grid {
    grid-template-columns: 1fr;
  }

  .workspace-meta {
    gap: 0.45rem;
  }

  .inline-field-control,
  .task-summary-grid {
    grid-template-columns: 1fr;
  }

  .return-top-button,
  .field-inline-button {
    width: 100%;
  }

  .flash-card {
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
  }

  /* ── Upload zone: emphasize tap button on small screens ── */
  .upload-zone {
    padding: 1.2rem 0.9rem;
  }

  .upload-zone-button {
    width: 100%;
    min-height: 3.2rem;
    font-size: 1rem;
  }

  /* ── Borrower hero: tighter ── */
  .borrower-hero-copy .workspace-title {
    font-size: clamp(1.8rem, 8vw, 2.4rem);
  }

  /* ── Pills wrap better ── */
  .pill {
    font-size: 0.72rem;
    padding: 0.38rem 0.6rem;
  }

  /* ── Deal queue cards: full width ── */
  .deal-queue-grid {
    grid-template-columns: 1fr;
  }

  /* ── Progress card spacing ── */
  .progress-topline {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  /* ── Section headings ── */
  .section-head,
  .panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  /* ── Auth layout padding ── */
  .auth-story,
  .auth-card {
    padding: 1.2rem;
    border-radius: var(--radius-lg);
  }
}

/* ── Small phones (iPhone SE, older Android) ── */

@media (max-width: 420px) {
  .portal-chrome {
    padding: 0.5rem 0.5rem 0;
  }

  .portal-chrome-inner {
    padding: 0.6rem 0.7rem;
    border-radius: 1rem;
  }

  .portal-brand img {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 0.7rem;
  }

  .portal-brand strong {
    font-size: 0.85rem;
  }

  .portal-brand em {
    font-size: 0.68rem;
  }

  .portal-app {
    padding: 0.75rem 0.55rem 2.5rem;
  }

  .auth-story,
  .auth-card,
  .workspace-title-row,
  .workspace-rail,
  .panel {
    padding: 0.9rem;
    border-radius: 1rem;
  }

  .workspace-title {
    font-size: clamp(1.6rem, 8vw, 2.2rem);
    line-height: 1.05;
  }

  .panel-title {
    font-size: 1.35rem;
  }

  .auth-title {
    font-size: clamp(1.8rem, 11vw, 2.6rem);
  }

  /* ── Tighter card padding ── */
  .queue-card,
  .control-card,
  .document-card,
  .mini-card,
  .field-card,
  .timeline-item,
  .security-step,
  .task-row,
  .notification-button,
  .stat-card,
  .summary-card {
    padding: 0.8rem;
  }

  /* ── Remove decorative backgrounds entirely ── */
  .portal-glow,
  .portal-gridline {
    display: none;
  }

  body.portal-page::before {
    display: none;
  }

  /* ── Buttons: ensure comfortable tap targets ── */
  .button {
    min-height: 2.9rem;
    padding: 0.75rem 0.9rem;
    font-size: 0.92rem;
  }

  .icon-button {
    width: 2.6rem;
    height: 2.6rem;
  }

  /* ── Flash notification: full width at bottom ── */
  .flash-card {
    left: 0.5rem;
    right: 0.5rem;
    bottom: 0.5rem;
    border-radius: 0.85rem;
  }

  /* ── Uploaded doc rows: compact ── */
  .uploaded-doc-row {
    padding: 0.9rem;
  }

  /* ── Message composer ── */
  .message-bubble {
    padding: 0.8rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   KATE AI — INLINE TYPING INDICATOR
   ═══════════════════════════════════════════════════════════════════════════ */

.kate-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0.15rem 0;
}

.kate-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: kate-bounce 1.2s infinite;
}

.kate-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.kate-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes kate-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.55; }
  30% { transform: translateY(-5px); opacity: 1; }
}
