:root {
  color-scheme: dark;
  --bg: #0e1116;
  --bg-deep: #0e1116;
  --surface: #161b22;
  --surface-2: #1c2129;
  --surface-3: #222934;
  --border: #262c36;
  --border-soft: rgba(255,255,255,.075);
  --text: #e6eaf0;
  --text-2: #9ba4b4;
  --muted: #6b7480;
  --brand: #4a9eff;
  --brand-soft: rgba(74,158,255,.13);
  --success: #3fb950;
  --success-soft: rgba(63,185,80,.13);
  --warning: #d9a441;
  --warning-soft: rgba(217,164,65,.13);
  --danger: #f0616d;
  --danger-soft: rgba(240,97,109,.12);
  --purple: #a371f7;
  --purple-soft: rgba(163,113,247,.13);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --sidebar: 250px;
  --shadow: 0 20px 45px rgba(0,0,0,.2);
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f4f7;
  --bg-deep: #e7ebf0;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eef1f5;
  --border: #d8dde5;
  --border-soft: rgba(14,17,22,.08);
  --text: #171b22;
  --text-2: #586272;
  --muted: #7f8996;
  --brand-soft: rgba(43,125,221,.1);
  --success-soft: rgba(38,147,62,.1);
  --warning-soft: rgba(191,126,11,.11);
  --danger-soft: rgba(213,53,68,.09);
  --purple-soft: rgba(113,62,195,.1);
  --shadow: 0 20px 45px rgba(20,30,45,.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
video { max-width: 100%; display: block; }
svg { flex: 0 0 auto; }
::selection { background: rgba(74,158,255,.28); }
:focus-visible { outline: 3px solid rgba(74,158,255,.5); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; scroll-margin-top: 90px; }
p { text-wrap: pretty; }
.skip-link { position: fixed; z-index: 200; left: 12px; top: 10px; padding: 10px 14px; border-radius: 8px; background: var(--brand); color: #07182b; font-weight: 700; transform: translateY(-150%); transition: transform .16s ease; }
.skip-link:focus { transform: translateY(0); }

.icon { display: inline-block; vertical-align: middle; }
.muted { color: var(--muted); }
.text-secondary { color: var(--text-2); }
.mono, .money { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.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; }

/* Entry screen */
.role-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(74,158,255,.15), transparent 31%),
    radial-gradient(circle at 93% 75%, rgba(163,113,247,.11), transparent 34%),
    var(--bg-deep);
}
.role-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 48px 0; }
.brand-lockup { display: flex; align-items: center; gap: 12px; letter-spacing: .12em; }
.brand-lockup > span:last-child { display: grid; gap: 1px; }
.brand-lockup strong { font-size: 13px; letter-spacing: .18em; }
.brand-lockup small { color: var(--muted); font-size: 8px; letter-spacing: .09em; text-transform: uppercase; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px;
  border: 1px solid var(--border); border-radius: 9px; color: var(--brand);
  font: 600 17px/1 Georgia, serif; background: var(--surface);
}
.role-intro { padding: 11vh 0 64px; max-width: 800px; }
.eyebrow { color: var(--brand); font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.role-intro h1 { margin: 18px 0 24px; font-size: clamp(45px, 7vw, 88px); line-height: .98; letter-spacing: -.055em; font-weight: 540; }
.role-intro h1 em { font-family: Georgia, "Times New Roman", serif; font-weight: 400; color: var(--text-2); }
.role-intro p { max-width: 650px; margin: 0; color: var(--text-2); font-size: 18px; }
.role-grid { display: grid; grid-template-columns: repeat(2, 1fr); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.role-card { position: relative; min-height: 330px; padding: 34px; display: flex; flex-direction: column; justify-content: space-between; transition: background .2s ease, transform .2s ease; }
.role-card + .role-card { border-left: 1px solid var(--border); }
.role-card:hover { background: var(--surface-2); }
.role-number { position: absolute; right: 28px; top: 22px; color: var(--border); font: 500 68px/1 var(--mono); }
.role-kicker { color: var(--muted); text-transform: uppercase; letter-spacing: .13em; font-size: 10px; font-weight: 700; }
.role-card h2 { margin: 12px 0 14px; font-size: 32px; letter-spacing: -.035em; }
.role-card p { max-width: 440px; margin: 0; color: var(--text-2); font-size: 15px; }
.role-link { display: flex; justify-content: space-between; align-items: center; color: var(--brand); font-weight: 600; }
.role-link span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid currentColor; transition: transform .2s ease; }
.role-card:hover .role-link span { transform: translateX(4px); }
.role-note { margin: 18px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

/* App shell */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) 1fr; }
.sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; width: var(--sidebar); display: flex; flex-direction: column; padding: 22px 14px 16px; background: var(--bg-deep); border-right: 1px solid var(--border-soft); }
.sidebar .brand-lockup { padding: 0 10px 24px; }
.sidebar-nav { display: grid; gap: 4px; }
.sidebar-nav button, .sidebar-nav a {
  width: 100%; min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 0; border-radius: 9px; background: transparent; color: var(--text-2); cursor: pointer; text-align: left;
}
.sidebar-nav button:hover, .sidebar-nav a:hover { background: var(--surface); color: var(--text); }
.sidebar-nav button.active, .sidebar-nav a.active { color: #fff; background: linear-gradient(135deg, #317ccc, #2564ac); }
:root[data-theme="light"] .sidebar-nav button.active, :root[data-theme="light"] .sidebar-nav a.active { color: #fff; }
.nav-section { margin: 20px 12px 7px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: 9px; font-weight: 700; }
.sidebar-bottom { margin-top: auto; display: grid; gap: 8px; }
.sidebar-project {
  padding: 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface);
}
.sidebar-project small { color: var(--muted); }
.sidebar-project strong { display: block; margin: 3px 0 9px; font-size: 12px; }
.mini-progress, .progress-track { height: 6px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.mini-progress span, .progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), #79b8ff); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 9px; border-radius: 10px; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #345c85, #253b56); color: #dceeff; font-size: 11px; font-weight: 700; }
.avatar.warm { background: linear-gradient(135deg, #986f45, #59432e); color: #fff5e9; }
.sidebar-user strong { display: block; font-size: 12px; }
.sidebar-user small { color: var(--muted); font-size: 10px; }
.main-shell { grid-column: 2; min-width: 0; overflow-x: hidden; }
.topbar { height: 72px; position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 32px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(16px); border-bottom: 1px solid var(--border-soft); }
.topbar-left, .topbar-actions { display: flex; align-items: center; gap: 10px; }
.breadcrumb { color: var(--muted); font-size: 12px; }
.breadcrumb strong { color: var(--text); font-weight: 600; }
.mobile-menu { display: none !important; }
.icon-button { min-width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.icon-button:hover { background: var(--surface-2); }
.notification-button { position: relative; }
.notification-dot { position: absolute; right: 9px; top: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 3px var(--surface); }
.project-switcher { min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }
.content { width: min(1440px, 100%); margin: 0 auto; padding: 30px 32px 64px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-heading h1 { margin: 5px 0 0; font-size: clamp(28px, 3vw, 42px); line-height: 1.1; letter-spacing: -.045em; }
.page-heading p { color: var(--text-2); margin: 7px 0 0; }
.page-kicker { color: var(--brand); font-size: 10px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; }
.button:hover { background: var(--surface-2); }
.button.primary { border-color: transparent; background: var(--brand); color: #07182b; }
.button.primary:hover { background: #70aff7; }
.button.danger { color: var(--danger); }
.button.small { min-height: 36px; padding: 0 12px; font-size: 12px; }
.button.ghost { background: transparent; }

/* Shared content */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--border-soft); }
.card-header h2, .card-header h3 { margin: 0; font-size: 14px; letter-spacing: -.01em; }
.card-body { padding: 20px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 32px 0 14px; }
.section-title h2 { margin: 0; font-size: 19px; letter-spacing: -.025em; }
.section-title a, .text-button { color: var(--brand); background: none; border: 0; padding: 4px; cursor: pointer; font-weight: 600; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric-card { padding: 18px; }
.metric-card .label { color: var(--text-2); font-size: 11px; }
.metric-card strong { display: block; margin-top: 9px; font-size: 24px; letter-spacing: -.035em; }
.metric-card small { display: block; margin-top: 5px; color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 3px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 10px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.success, .status-complete, .status-accepted { color: var(--success); background: var(--success-soft); }
.badge.warning, .status-delay { color: var(--warning); background: var(--warning-soft); }
.badge.purple, .status-review { color: var(--purple); background: var(--purple-soft); }
.badge.blue, .status-progress { color: var(--brand); background: var(--brand-soft); }
.badge.danger { color: var(--danger); background: var(--danger-soft); }
.status-planned { color: var(--text-2); }
.alert { padding: 17px 18px; display: flex; align-items: flex-start; gap: 14px; border: 1px solid; border-radius: var(--radius); }
.alert.warning { border-color: rgba(217,164,65,.35); background: var(--warning-soft); }
.alert.purple { border-color: rgba(163,113,247,.35); background: var(--purple-soft); }
.alert strong { display: block; margin-bottom: 3px; }
.alert p { margin: 0; color: var(--text-2); }
.empty-state { display: grid; place-items: center; min-height: 240px; padding: 28px; text-align: center; color: var(--text-2); }
.empty-state .empty-icon { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 13px; border-radius: 14px; background: var(--surface-3); color: var(--muted); }

/* Client */
.client-hero { position: relative; overflow: hidden; min-height: 300px; padding: 28px; display: flex; align-items: flex-end; border: 1px solid var(--border); border-radius: var(--radius-lg); background:
  linear-gradient(90deg, rgba(6,10,15,.96) 0%, rgba(8,13,19,.72) 50%, rgba(8,13,19,.28) 100%),
  radial-gradient(circle at 82% 26%, rgba(132,177,219,.5), transparent 22%),
  linear-gradient(145deg, #172839 0 38%, #263843 38% 55%, #17231c 55% 100%);
}
.client-hero::before { content: ""; position: absolute; right: 6%; bottom: -3px; width: 48%; height: 70%; opacity: .7; clip-path: polygon(8% 35%, 44% 5%, 91% 26%, 100% 83%, 81% 83%, 81% 53%, 58% 53%, 58% 83%, 8% 83%); background: linear-gradient(145deg, #bec7c9, #5c737e 55%, #32434a); border-bottom: 12px solid #24352d; }
.hero-copy { position: relative; z-index: 2; max-width: 650px; }
.hero-copy h1 { margin: 11px 0 8px; font-size: clamp(34px, 4vw, 55px); letter-spacing: -.055em; line-height: 1; }
.hero-copy p { margin: 0; color: #b9c3ce; }
.hero-meta { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.hero-meta span { padding: 7px 10px; border: 1px solid rgba(255,255,255,.16); border-radius: 7px; background: rgba(10,14,19,.38); color: #dce3eb; font-size: 11px; backdrop-filter: blur(6px); }
.dashboard-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 14px; }
.progress-card { padding: 22px; }
.progress-top { display: flex; justify-content: space-between; gap: 20px; }
.progress-number { font-size: 54px; font-weight: 620; line-height: 1; letter-spacing: -.065em; }
.progress-number span { font-size: 24px; color: var(--brand); }
.progress-details { text-align: right; }
.progress-details strong { display: block; }
.progress-details span { color: var(--muted); font-size: 11px; }
.progress-card .progress-track { height: 9px; margin: 22px 0 12px; }
.progress-footer { display: flex; justify-content: space-between; color: var(--text-2); font-size: 11px; }
.camera-card { position: relative; overflow: hidden; min-height: 174px; padding: 18px; display: flex; flex-direction: column; justify-content: space-between; background: linear-gradient(155deg, #1f2d3d, #10151d 60%); }
.camera-card::after { content: ""; position: absolute; inset: 40% 0 0; background: linear-gradient(170deg, transparent 10%, rgba(40,70,55,.55)); }
.camera-top, .camera-bottom { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; }
.live { color: #8de89e; font-size: 10px; font-weight: 700; letter-spacing: .1em; }
.live::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px rgba(63,185,80,.11); }
.camera-bottom { color: #d6dce4; font-size: 11px; }
.urgent-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 14px; padding: 18px 20px; border: 1px solid rgba(163,113,247,.35); border-radius: var(--radius); background: linear-gradient(100deg, var(--purple-soft), transparent); }
.urgent-card h3 { margin: 3px 0; font-size: 15px; }
.urgent-card p { margin: 0; color: var(--text-2); font-size: 12px; }
.urgent-label { color: var(--purple); text-transform: uppercase; letter-spacing: .12em; font-size: 9px; font-weight: 800; }
.event-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.event-card { padding: 17px; }
.event-card small { color: var(--muted); }
.event-card strong { display: block; margin: 10px 0 4px; }
.event-date { color: var(--brand); font: 600 12px var(--mono); }
.photo-grid { display: grid; grid-template-columns: 1.4fr repeat(2, 1fr); grid-template-rows: 125px 125px; gap: 8px; }
.photo-tile { position: relative; overflow: hidden; border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2); }
.photo-tile:first-child { grid-row: span 2; }
.photo-art { position: absolute; inset: 0; background:
  linear-gradient(160deg, transparent 30%, rgba(8,12,16,.75)),
  linear-gradient(25deg, #1a2b24 0 22%, #694e34 22% 31%, #a6b1af 31% 48%, #3a4b55 48% 62%, #718292 62% 70%, #b7c9d4 70% 100%);
  transition: transform .35s ease;
}
.photo-tile:nth-child(2) .photo-art { filter: sepia(.2); }
.photo-tile:nth-child(3) .photo-art { filter: brightness(.75) saturate(.8); }
.photo-tile:nth-child(4) .photo-art { filter: sepia(.35) brightness(.82); }
.photo-tile:hover .photo-art { transform: scale(1.04); }
.photo-tile:nth-child(2):hover .photo-art, .photo-tile:nth-child(4):hover .photo-art { transform: scale(1.04); }
.photo-caption { position: absolute; z-index: 1; inset: auto 12px 11px; color: #fff; font-size: 11px; }
.finance-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.finance-summary > div { padding: 18px; background: var(--surface); }
.finance-summary small { display: block; color: var(--muted); margin-bottom: 7px; }
.finance-summary strong { font: 600 17px var(--mono); }
.weather-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.weather-day { padding: 14px 10px; text-align: center; border-radius: 10px; background: var(--surface-2); }
.weather-day .icon { color: var(--brand); margin: 10px 0; }
.weather-day strong { display: block; }
.weather-day small { color: var(--muted); font-size: 9px; }
.team-row { display: grid; gap: 9px; }
.team-person { display: flex; align-items: center; gap: 10px; }
.team-person > div:nth-child(2) { min-width: 0; flex: 1; }
.team-person strong, .team-person small { display: block; }
.team-person small { color: var(--muted); }
.two-column { display: grid; grid-template-columns: 1fr 360px; gap: 14px; }

/* Timeline and gantt */
.view-toggle { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.view-toggle button { min-height: 34px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); cursor: pointer; }
.view-toggle button.active { background: var(--surface); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.timeline { position: relative; padding-left: 25px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 5px; bottom: 5px; width: 1px; background: var(--border); }
.phase-block + .phase-block { margin-top: 22px; }
.phase-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.phase-heading h3 { margin: 0; font-size: 13px; }
.stage-row { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 14px; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--surface-2); }
.stage-row + .stage-row { margin-top: 7px; }
.stage-row::before { content: ""; position: absolute; left: -22px; top: 20px; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 4px var(--surface); }
.stage-row.status-review::before { background: var(--purple); }
.stage-row.status-delay::before { background: var(--warning); }
.stage-row.status-complete::before, .stage-row.status-accepted::before { background: var(--success); }
.stage-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.stage-meta { display: flex; gap: 14px; margin-top: 6px; color: var(--muted); font-size: 10px; }
.stage-percent { font: 600 13px var(--mono); }
.delay-note { margin-top: 9px; padding: 8px 10px; border-radius: 7px; background: var(--warning-soft); color: var(--warning); font-size: 10px; }
.gantt { overflow-x: auto; padding-bottom: 10px; }
.gantt-grid { min-width: 820px; }
.gantt-scale { display: grid; grid-template-columns: 210px repeat(var(--gantt-labels, 8), 1fr); color: var(--muted); font-size: 9px; border-bottom: 1px solid var(--border); }
.urgent-stack > div { width: 100%; }
.urgent-stack article { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 18px; padding: 14px 0; border-top: 1px solid rgba(217,164,65,.24); }
.urgent-stack article:first-of-type { margin-top: 8px; }
.phase-block > summary { cursor: pointer; list-style: none; min-height: 44px; }
.phase-block > summary::-webkit-details-marker { display: none; }
.admin-portal .gantt-bar { cursor: grab; touch-action: none; }
.admin-portal .gantt-bar:active { cursor: grabbing; }
.admin-portal .gantt-bar.is-selected { outline: 2px solid var(--brand); outline-offset: 3px; }
.gantt-scale span { padding: 8px; border-left: 1px solid var(--border-soft); }
.gantt-row { display: grid; grid-template-columns: 210px 1fr; min-height: 54px; border-bottom: 1px solid var(--border-soft); }
.gantt-label { padding: 10px 12px 10px 0; }
.gantt-label strong { display: block; font-size: 11px; }
.gantt-label small { color: var(--muted); }
.gantt-track { position: relative; background: repeating-linear-gradient(90deg, transparent 0 calc(12.5% - 1px), var(--border-soft) calc(12.5% - 1px) 12.5%); }
.gantt-bar { position: absolute; top: 15px; height: 20px; min-width: 28px; border-radius: 5px; background: var(--brand); opacity: .82; overflow: hidden; }
.gantt-bar::after { content: ""; display: block; width: var(--progress); height: 100%; background: rgba(255,255,255,.24); }
.gantt-bar.review { background: var(--purple); }
.gantt-bar.delay { background: var(--warning); }
.gantt-bar.complete { background: var(--success); }

/* Documents and finance */
.document-list, .payment-list { display: grid; gap: 7px; }
.document-row, .payment-row { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; padding: 13px; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--surface-2); }
.file-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 9px; background: var(--brand-soft); color: var(--brand); font-size: 10px; font-weight: 800; }
.document-row strong, .document-row small { display: block; }
.document-row small { color: var(--muted); margin-top: 3px; }
.document-actions { display: flex; gap: 6px; }
.new-tag { margin-left: 5px; color: var(--brand); font-size: 8px; font-weight: 800; }
.payment-row { grid-template-columns: 1fr 160px 150px; }
.payment-title strong, .payment-title small { display: block; }
.payment-title small { color: var(--muted); }
.payment-amount { font: 600 13px var(--mono); text-align: right; }
.payment-status { text-align: right; }
.change-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border-soft); }
.change-row:last-child { border-bottom: 0; }
.change-row small { display: block; color: var(--muted); }

/* Reports */
.report-list { display: grid; gap: 12px; }
.report-card { overflow: hidden; display: grid; grid-template-columns: 270px 1fr; }
.report-visual { min-height: 190px; position: relative; background: linear-gradient(35deg, #263b31 0 28%, #6a5037 28% 39%, #9da9ac 39% 56%, #384954 56% 69%, #afc2cc 69%); }
.report-visual::after { content: attr(data-count); position: absolute; right: 12px; bottom: 12px; padding: 5px 8px; border-radius: 7px; background: rgba(5,8,12,.7); color: white; font-size: 10px; }
.report-content { padding: 20px; }
.report-content h3 { margin: 7px 0 10px; font-size: 17px; }
.report-content p { color: var(--text-2); }
.report-meta { display: flex; gap: 8px; color: var(--muted); font-size: 10px; }

/* Admin */
.admin-sidebar { --sidebar: 232px; }
.admin-content { max-width: 1600px; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; }
.search-field { position: relative; min-width: 260px; }
.search-field .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.field, .search-field input, .filter-row select {
  width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text);
}
.search-field input { padding-left: 40px; }
.filter-row select { width: auto; min-width: 150px; }
.project-table-wrap { overflow-x: auto; }
.project-table { width: 100%; min-width: 1050px; border-collapse: collapse; }
.project-table th { padding: 12px 14px; color: var(--muted); font-size: 9px; letter-spacing: .09em; text-transform: uppercase; text-align: left; font-weight: 700; border-bottom: 1px solid var(--border); }
.project-table td { padding: 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.project-table tr:hover td { background: var(--surface-2); }
.project-table tr:last-child td { border-bottom: 0; }
.project-name { display: flex; align-items: center; gap: 11px; }
.project-thumb { width: 52px; height: 42px; border-radius: 8px; background: linear-gradient(145deg, #b5c2c6 0 43%, #4a5a50 43% 61%, #203229 61%); border: 1px solid var(--border); }
.project-name strong, .project-name small { display: block; }
.project-name small { color: var(--muted); max-width: 250px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table-progress { width: 110px; }
.table-progress .progress-track { margin-top: 5px; }
.attention { display: flex; gap: 5px; }
.attention span { min-width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; background: var(--warning-soft); color: var(--warning); font: 600 10px var(--mono); }
.stale { color: var(--danger); }
.fresh { color: var(--success); }
.admin-project-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.admin-project-title { display: flex; align-items: center; gap: 13px; }
.back-button { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.admin-project-title h1 { margin: 0; font-size: 28px; letter-spacing: -.035em; }
.admin-project-title p { margin: 3px 0 0; color: var(--muted); }
.tabs { display: flex; gap: 2px; overflow-x: auto; margin-bottom: 16px; padding: 4px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }
.tabs button { flex: 0 0 auto; min-height: 38px; padding: 0 13px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); cursor: pointer; }
.tabs button.active { color: var(--text); background: var(--surface-3); }
.admin-overview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.admin-overview .card { padding: 18px; }
.admin-overview small { color: var(--muted); }
.admin-overview strong { display: block; margin-top: 8px; font-size: 18px; }
.stage-builder { display: grid; grid-template-columns: 330px 1fr; min-height: 620px; overflow: hidden; }
.stage-tree { border-right: 1px solid var(--border); background: var(--bg-deep); }
.stage-tree-head { padding: 15px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.tree-phase { border-bottom: 1px solid var(--border-soft); }
.tree-phase-title { padding: 12px 14px 7px; display: flex; justify-content: space-between; color: var(--text-2); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.tree-stage { width: calc(100% - 14px); min-height: 40px; margin: 2px 7px; padding: 8px 9px; display: flex; justify-content: space-between; gap: 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); text-align: left; cursor: pointer; }
.tree-stage:hover, .tree-stage.active { background: var(--surface-2); color: var(--text); }
.tree-stage span:last-child { color: var(--muted); font: 600 10px var(--mono); }
.tree-add { width: calc(100% - 28px); margin: 6px 14px 12px; min-height: 36px; border: 1px dashed var(--border); border-radius: 8px; background: transparent; color: var(--brand); cursor: pointer; }
.stage-editor { padding: 22px; }
.editor-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.editor-heading h2 { margin: 0; font-size: 19px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
.form-group { display: grid; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { color: var(--text-2); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.form-group input, .form-group select, .form-group textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); color: var(--text); }
.form-group textarea { min-height: 105px; resize: vertical; }
.form-group input[type="range"] { padding: 0; accent-color: var(--brand); }
.form-help { color: var(--muted); font-size: 10px; }
.toggle-row { min-height: 44px; display: flex; align-items: center; gap: 10px; }
.toggle-row input { width: 18px; height: 18px; accent-color: var(--brand); }
.editor-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border-soft); }
.upload-drop { min-height: 180px; display: grid; place-items: center; padding: 25px; text-align: center; border: 1px dashed var(--border); border-radius: 12px; background: var(--surface-2); cursor: pointer; }
.upload-drop:hover { border-color: var(--brand); }
.upload-drop .upload-icon { width: 52px; height: 52px; display: grid; place-items: center; margin: 0 auto 10px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); }
.upload-drop p { margin: 3px 0; color: var(--text-2); }
.upload-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.preview-chip { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--surface-3); font-size: 10px; }
.journal-list { display: grid; }
.journal-row { display: grid; grid-template-columns: 155px 160px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border-soft); }
.journal-row:last-child { border-bottom: 0; }
.journal-row time, .journal-row small { color: var(--muted); }

/* Dialog */
.modal { width: min(760px, calc(100% - 28px)); max-height: calc(100vh - 40px); padding: 0; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.modal, .modal-body { overscroll-behavior: contain; }
.modal::backdrop { background: rgba(3,6,10,.72); backdrop-filter: blur(5px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-body { padding: 22px; overflow-y: auto; max-height: calc(100vh - 190px); }
.modal-foot { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-top: 1px solid var(--border); }
.wizard-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-bottom: 22px; }
.wizard-step { padding: 8px; border-radius: 7px; background: var(--surface-2); color: var(--muted); font-size: 9px; text-align: center; }
.wizard-step.active { background: var(--brand-soft); color: var(--brand); }
.wizard-pane[hidden] { display: none; }
.toast-region { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: grid; gap: 8px; pointer-events: none; }
.toast { max-width: 350px; padding: 12px 15px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-3); box-shadow: var(--shadow); transform: translateY(12px); opacity: 0; transition: transform .2s ease, opacity .2s ease; }
.toast.is-visible { transform: translateY(0); opacity: 1; }
.toast.success { border-color: rgba(63,185,80,.35); }
.toast.error { border-color: rgba(240,97,109,.35); }
.notifications-panel { position: fixed; z-index: 35; right: 22px; top: 65px; width: min(390px, calc(100% - 28px)); padding: 8px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow); }
.notification-item { padding: 12px; border-radius: 8px; }
.notification-item + .notification-item { border-top: 1px solid var(--border-soft); }
.notification-item.unread { background: var(--brand-soft); }
.notification-item strong { display: block; font-size: 11px; }
.notification-item small { color: var(--muted); }
[hidden] { display: none !important; }
.report-content, .document-row > div, .payment-title, .stage-row > div, .journal-row > span { min-width: 0; overflow-wrap: anywhere; }

/* Responsive */
@media (max-width: 1080px) {
  :root { --sidebar: 210px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .two-column { grid-template-columns: 1fr; }
  .admin-overview { grid-template-columns: repeat(2, 1fr); }
  .stage-builder { grid-template-columns: 280px 1fr; }
}

@media (max-width: 820px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .role-grid { grid-template-columns: 1fr; }
  .role-card + .role-card { border-left: 0; border-top: 1px solid var(--border); }
  .role-card { min-height: 280px; }
  .app-shell { display: block; }
  .sidebar { transform: translateX(-102%); transition: transform .25s ease; box-shadow: var(--shadow); }
  .sidebar.is-open { transform: translateX(0); }
  .main-shell { grid-column: 1; width: 100%; max-width: 100vw; }
  .topbar, .content { width: 100%; max-width: 100vw; }
  .mobile-menu { display: grid !important; }
  .content { padding: 24px 18px 52px; }
  .topbar { padding: 0 18px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .event-grid { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: 1fr 1fr; }
  .photo-tile:first-child { grid-column: span 2; grid-row: auto; }
  .finance-summary { grid-template-columns: 1fr; }
  .report-card { grid-template-columns: 1fr; }
  .stage-builder { grid-template-columns: 1fr; }
  .stage-tree { border-right: 0; border-bottom: 1px solid var(--border); max-height: 310px; overflow: auto; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-field { min-width: 0; }
  .project-switcher { max-width: 170px; }
}

@media (max-width: 560px) {
  .role-shell { width: min(100% - 24px, 1180px); padding-top: 24px; }
  .role-intro { padding: 70px 0 36px; }
  .role-intro p { font-size: 15px; }
  .role-card { padding: 24px; min-height: 260px; }
  .role-card h2 { font-size: 26px; }
  .topbar { height: 64px; padding: 0 12px; }
  .topbar-left, .topbar-actions { gap: 6px; min-width: 0; }
  .topbar-actions .project-switcher { width: 158px; max-width: 158px; min-width: 0; padding: 0 8px; }
  .topbar-actions #theme-button { display: none; }
  .breadcrumb, .topbar .button-label { display: none; }
  .content { padding: 20px 12px 46px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading h1 { font-size: 29px; }
  .client-hero { min-height: 360px; padding: 20px; min-width: 0; }
  .hero-copy, .urgent-card > div { min-width: 0; }
  .progress-top, .progress-footer { flex-wrap: wrap; gap: 10px; }
  .progress-details { text-align: left; }
  .client-hero::before { width: 88%; opacity: .45; }
  .hero-copy h1 { font-size: 37px; }
  .urgent-card { align-items: flex-start; flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr; }
  .weather-row { grid-template-columns: repeat(2, 1fr); }
  .photo-grid { grid-template-rows: 180px 110px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: auto; }
  .payment-row { grid-template-columns: 1fr auto; }
  .payment-status { grid-column: 1 / -1; text-align: left; }
  .document-row { grid-template-columns: 42px 1fr; }
  .document-actions { grid-column: 1 / -1; }
  .admin-project-header { flex-direction: column; }
  .admin-overview { grid-template-columns: 1fr; }
  .stage-editor { padding: 15px; }
  .journal-row { grid-template-columns: 1fr; gap: 3px; }
  .wizard-steps { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Nordville architectural identity — editorial client portal + technical studio console */
:root {
  --display: "Iowan Old Style", "Baskerville", Georgia, serif;
  --radius-sm: 2px;
  --radius: 3px;
  --radius-lg: 4px;
  --drawing: rgba(74,158,255,.095);
}

body:not(.role-page)::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--drawing) 1px, transparent 1px),
    linear-gradient(90deg, var(--drawing) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(90deg, transparent, #000 32%, #000 68%, transparent);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 0;
  color: var(--text);
  background:
    linear-gradient(135deg, transparent 0 46%, var(--brand) 47% 51%, transparent 52%),
    var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
  font: 700 10px/1 var(--mono);
  letter-spacing: -.08em;
}

.brand-lockup strong { font-size: 12px; letter-spacing: .28em; }
.brand-lockup small { letter-spacing: .16em; }
h1, .hero-copy h1, .role-card h2, .section-title h2, .admin-project-title h1 { font-family: var(--display); font-weight: 400; }
.page-heading h1 { letter-spacing: -.025em; }
.page-kicker, .eyebrow { font-family: var(--mono); letter-spacing: .18em; }
.card, .button, .icon-button, .project-switcher, .field, .search-field input, .filter-row select,
.form-group input, .form-group select, .form-group textarea, .tabs, .back-button, .upload-drop,
.document-row, .payment-row, .sidebar-project, .modal, .notifications-panel { border-radius: 2px; }
.card { box-shadow: inset 0 1px rgba(255,255,255,.018); }
.button { border-radius: 0; padding-inline: 18px; text-transform: uppercase; letter-spacing: .075em; font: 600 10px/1 var(--font); }
.button.primary { color: #08111b; box-shadow: inset 0 -3px rgba(0,0,0,.16); }
.icon-button { border-radius: 0; }
.badge { border-radius: 2px; text-transform: uppercase; letter-spacing: .055em; }
.badge::before { display: none; content: none; }
.progress-track, .mini-progress { height: 3px; border-radius: 0; }
.progress-track span, .mini-progress span { border-radius: 0; background: var(--brand); }

/* Entry — architectural dossier */
.brand-entry {
  background:
    linear-gradient(90deg, transparent calc(50% - .5px), var(--border-soft) 50%, transparent calc(50% + .5px)),
    linear-gradient(var(--drawing) 1px, transparent 1px),
    linear-gradient(90deg, var(--drawing) 1px, transparent 1px),
    var(--bg-deep);
  background-size: 100% 100%, 72px 72px, 72px 72px, auto;
}
.brand-entry .role-shell { width: min(1380px, calc(100% - 72px)); padding-top: 36px; }
.brand-entry .role-brand { padding-bottom: 30px; border-bottom: 1px solid var(--border); }
.brand-entry .role-intro { position: relative; max-width: 980px; padding: 13vh 0 76px; }
.brand-entry .role-intro::after {
  content: "NORDVILLE / DIGITAL ESTATE";
  position: absolute;
  right: -26%;
  top: 44%;
  color: var(--muted);
  font: 9px/1 var(--mono);
  letter-spacing: .25em;
  transform: rotate(90deg);
}
.brand-entry .role-intro h1 { max-width: 900px; font-size: clamp(52px, 7.2vw, 104px); line-height: .88; letter-spacing: -.045em; }
.brand-entry .role-intro h1 em { color: var(--brand); }
.brand-entry .role-grid { border-radius: 0; background: rgba(14,17,22,.8); }
.brand-entry .role-card { min-height: 300px; border-top: 3px solid transparent; }
.brand-entry .role-card:hover { border-top-color: var(--brand); transform: none; }
.brand-entry .role-number { top: 26px; font-size: 13px; color: var(--brand); letter-spacing: .14em; }
.brand-entry .role-card h2 { max-width: 390px; font-size: 42px; }
.brand-entry .role-link span { border-radius: 0; transform: rotate(-45deg); }
.brand-entry .role-card:hover .role-link span { transform: rotate(-45deg) translate(3px, 3px); }

/* Client — calm editorial residence dossier */
.client-portal .app-shell { display: block; }
.client-portal .sidebar {
  position: sticky;
  inset: 0 0 auto;
  width: 100%;
  height: 96px;
  padding: 0 30px;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  background: color-mix(in srgb, var(--bg-deep) 95%, transparent);
  border: 0;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}
.client-portal .sidebar .brand-lockup { padding: 0; }
.client-portal .sidebar-nav { display: flex; align-items: stretch; height: 100%; gap: 0; overflow-x: auto; }
.client-portal .sidebar-nav button {
  width: auto;
  min-width: 72px;
  min-height: 96px;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  padding: 0 11px;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  font-size: 9px;
  white-space: nowrap;
}
.client-portal .sidebar-nav button:hover { background: transparent; color: var(--text); border-bottom-color: var(--border); }
.client-portal .sidebar-nav button.active { background: transparent; color: var(--brand); border-bottom-color: var(--brand); }
.client-portal .sidebar-bottom { margin: 0; display: flex; }
.client-portal .sidebar-project { display: none; }
.client-portal .main-shell { grid-column: auto; }
.client-portal .topbar { height: 58px; padding: 0 38px; background: var(--bg); }
.client-portal .content { padding: 38px 38px 72px; }
.client-portal .client-hero {
  min-height: 410px;
  padding: 42px;
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(7,10,14,.98) 0%, rgba(7,10,14,.88) 45%, rgba(7,10,14,.18) 100%),
    linear-gradient(135deg, #1b2c36 0 34%, #53646a 34% 35%, #213036 35% 58%, #18251f 58%);
}
.client-portal .client-hero::before {
  right: 5%;
  bottom: 8%;
  width: 48%;
  height: 74%;
  opacity: .9;
  clip-path: polygon(5% 34%, 42% 7%, 94% 25%, 94% 88%, 5% 88%);
  background:
    repeating-linear-gradient(90deg, transparent 0 62px, rgba(255,255,255,.16) 63px 64px),
    repeating-linear-gradient(0deg, transparent 0 46px, rgba(255,255,255,.1) 47px 48px),
    rgba(112,137,148,.25);
  border: 1px solid rgba(214,228,235,.48);
}
.client-portal .client-hero::after {
  content: "OBJECT 01 / 2026";
  position: absolute;
  right: 28px;
  top: 28px;
  color: rgba(255,255,255,.65);
  font: 9px/1 var(--mono);
  letter-spacing: .22em;
}
.client-portal .hero-copy { max-width: 720px; }
.client-portal .hero-copy h1 { font-size: clamp(48px, 6vw, 82px); line-height: .92; letter-spacing: -.035em; }
.client-portal .hero-meta span { border-radius: 0; font-family: var(--mono); letter-spacing: .04em; }
.client-portal .dashboard-grid { grid-template-columns: 1.45fr .55fr; gap: 1px; background: var(--border); border: 1px solid var(--border); }
.client-portal .dashboard-grid > .card { border: 0; }
.client-portal .progress-number { font-family: var(--display); font-weight: 400; font-size: 72px; }
.client-portal .photo-tile, .client-portal .report-visual { border-radius: 0; }

/* Admin — compact technical instrument rail */
.admin-portal .admin-sidebar { --sidebar: 86px; }
.admin-portal .sidebar { width: 86px; padding: 18px 10px 14px; align-items: center; background: var(--bg-deep); border-right-color: var(--border); }
.admin-portal .sidebar .brand-lockup { padding: 0 0 30px; }
.admin-portal .sidebar .brand-lockup > span:last-child { display: none; }
.admin-portal .sidebar-nav { width: 100%; gap: 8px; }
.admin-portal .sidebar-nav button { justify-content: center; padding: 0; border-radius: 0; border-left: 2px solid transparent; }
.admin-portal .sidebar-nav button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.admin-portal .sidebar-nav button:hover { background: var(--surface); }
.admin-portal .sidebar-nav button.active { background: var(--brand-soft); color: var(--brand); border-left-color: var(--brand); }
.admin-portal .nav-section { display: none; }
.admin-portal .sidebar-bottom { width: 100%; }
.admin-portal .sidebar-user { justify-content: center; padding: 8px 0; border-top: 1px solid var(--border); }
.admin-portal .sidebar-user > span:last-child { display: none; }
.admin-portal .topbar { height: 64px; padding: 0 26px; }
.admin-portal .content { padding: 28px 28px 64px; }
.admin-portal .page-heading { padding: 12px 0 24px; border-bottom: 1px solid var(--border); }
.admin-portal .page-heading h1 { font-family: var(--font); font-size: 32px; font-weight: 540; letter-spacing: -.03em; }
.admin-portal .metric-grid { gap: 1px; border: 1px solid var(--border); background: var(--border); }
.admin-portal .metric-card { border: 0; border-radius: 0; padding: 20px; }
.admin-portal .metric-card strong { font-family: var(--mono); font-weight: 500; }
.admin-portal .project-table-wrap { border-radius: 0; }
.admin-portal .project-table th { background: var(--bg-deep); }
.admin-portal .project-table td { height: 72px; }
.admin-portal .project-thumb { border-radius: 0; filter: saturate(.65); }
.admin-portal .tabs { padding: 0; border-inline: 0; background: transparent; border-radius: 0; }
.admin-portal .tabs button { border-radius: 0; border-bottom: 2px solid transparent; }
.admin-portal .tabs button.active { background: transparent; color: var(--brand); border-bottom-color: var(--brand); }
.admin-portal .stage-builder { border-radius: 0; }
.admin-portal .stage-tree { background-image: linear-gradient(var(--border-soft) 1px, transparent 1px); background-size: 100% 44px; }

@media (max-width: 1180px) {
  .client-portal .sidebar { grid-template-columns: 54px minmax(0, 1fr) auto; padding-inline: 18px; }
  .client-portal .sidebar .brand-lockup > span:last-child { display: none; }
  .client-portal .sidebar-nav button { min-width: 64px; padding-inline: 8px; }
  .client-portal .sidebar-nav button span { display: none; }
}

@media (max-width: 820px) {
  .client-portal .sidebar,
  .admin-portal .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    height: 100vh;
    padding: 22px 14px 16px;
    display: flex;
    align-items: stretch;
    transform: translateX(-102%);
  }
  .client-portal .sidebar.is-open,
  .admin-portal .sidebar.is-open { transform: translateX(0); }
  .client-portal .sidebar .brand-lockup,
  .admin-portal .sidebar .brand-lockup { padding: 0 8px 24px; }
  .client-portal .sidebar .brand-lockup > span:last-child,
  .admin-portal .sidebar .brand-lockup > span:last-child { display: grid; }
  .client-portal .sidebar-nav,
  .admin-portal .sidebar-nav { display: grid; height: auto; overflow: visible; }
  .client-portal .sidebar-nav button,
  .admin-portal .sidebar-nav button { width: 100%; min-height: 46px; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; border: 0; border-left: 2px solid transparent; }
  .client-portal .sidebar-nav button span,
  .admin-portal .sidebar-nav button span { display: inline; position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .client-portal .sidebar-bottom,
  .admin-portal .sidebar-bottom { margin-top: auto; display: grid; }
  .client-portal .sidebar-project { display: block; }
  .client-portal .sidebar-user,
  .admin-portal .sidebar-user { justify-content: flex-start; }
  .admin-portal .sidebar-user > span:last-child { display: inline; }
  .client-portal .topbar,
  .admin-portal .topbar { height: 66px; padding-inline: 16px; }
  .client-portal .content,
  .admin-portal .content { padding: 24px 16px 52px; }
  .client-portal .client-hero { min-height: 390px; padding: 24px; }
}

@media (max-width: 560px) {
  .brand-entry .role-shell { width: calc(100% - 24px); }
  .brand-entry .role-intro { padding-block: 72px 42px; }
  .brand-entry .role-intro h1 { font-size: 48px; }
  .brand-entry .role-intro::after { display: none; }
  .brand-entry .role-card h2 { font-size: 34px; }
  .client-portal .client-hero { min-height: 430px; }
  .client-portal .client-hero::before { width: 92%; opacity: .55; }
  .client-portal .hero-copy h1 { font-size: 44px; }
  .client-portal .dashboard-grid { display: grid; grid-template-columns: 1fr; gap: 1px; }
}

/* Reference direction from the approved brief screenshot */
:root[data-theme="light"] {
  --bg: #f5f6f8;
  --bg-deep: #eef0f3;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #edf0f4;
  --border: #dfe3e8;
  --border-soft: rgba(35,40,50,.08);
  --text: #292d38;
  --text-2: #5e6470;
  --muted: #8a92a2;
  --brand: #1596ed;
  --brand-soft: rgba(21,150,237,.1);
  --success: #21b579;
  --warning: #d99524;
  --danger: #e6535e;
  --purple: #8a63d2;
  --shadow: 0 7px 24px rgba(35,42,55,.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

.client-portal,
.admin-portal { background: var(--bg); font-size: 14px; }
.client-portal::before,
.admin-portal::before { display: none; }
.client-portal h1,
.client-portal .hero-copy h1,
.client-portal .section-title h2,
.admin-portal h1,
.admin-portal .section-title h2,
.admin-portal .admin-project-title h1 { font-family: var(--font); font-weight: 700; }

.client-portal .app-shell,
.admin-portal .app-shell {
  --sidebar: 286px;
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
}
.client-portal .sidebar,
.admin-portal .sidebar {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  height: 100vh;
  padding: 20px 0 16px;
  display: flex;
  align-items: stretch;
  color: #f2f3f5;
  background: #1d1e20;
  border-right: 0;
  box-shadow: none;
}
.client-portal .sidebar .brand-lockup,
.admin-portal .sidebar .brand-lockup {
  min-height: 66px;
  margin: 0 20px 16px;
  padding: 0 0 18px;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.client-portal .sidebar .brand-lockup > span:last-child,
.admin-portal .sidebar .brand-lockup > span:last-child { display: grid; }
.client-portal .brand-mark,
.admin-portal .brand-mark { color: white; background-color: #151617; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.client-portal .brand-lockup strong,
.admin-portal .brand-lockup strong { color: white; }
.client-portal .brand-lockup small,
.admin-portal .brand-lockup small { color: #8f9298; }
.client-portal .sidebar-nav,
.admin-portal .sidebar-nav { width: 100%; display: grid; height: auto; gap: 2px; overflow: visible; }
.client-portal .sidebar-nav button,
.admin-portal .sidebar-nav button {
  width: 100%;
  min-height: 46px;
  justify-content: flex-start;
  flex-direction: row;
  gap: 12px;
  padding: 10px 22px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0;
  color: #a6a9af;
  font-size: 13px;
  text-transform: none;
}
.client-portal .sidebar-nav button span,
.admin-portal .sidebar-nav button span { display: inline; position: static; width: auto; height: auto; overflow: visible; clip: auto; }
.client-portal .sidebar-nav button:hover,
.admin-portal .sidebar-nav button:hover { color: white; background: #27282a; border-bottom-color: transparent; }
.client-portal .sidebar-nav button.active,
.admin-portal .sidebar-nav button.active { color: white; background: #2b2c2e; border-left-color: var(--brand); border-bottom-color: transparent; }
.client-portal .nav-section,
.admin-portal .nav-section { display: block; margin: 18px 22px 8px; color: #777b82; }
.client-portal .sidebar-bottom,
.admin-portal .sidebar-bottom { width: auto; margin: auto 16px 0; display: grid; }
.client-portal .sidebar-project { display: block; border-color: rgba(255,255,255,.1); background: #252628; }
.client-portal .sidebar-project small { color: #92969d; }
.client-portal .sidebar-project strong { color: white; }
.client-portal .sidebar-user,
.admin-portal .sidebar-user { justify-content: flex-start; color: white; border-top: 1px solid rgba(255,255,255,.08); }
.client-portal .sidebar-user > span:last-child,
.admin-portal .sidebar-user > span:last-child { display: inline; }

.client-portal .main-shell,
.admin-portal .main-shell { grid-column: 2; width: 100%; min-width: 0; background: var(--bg); }
.client-portal .topbar,
.admin-portal .topbar {
  height: 64px;
  padding: 0 26px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 28px;
  color: var(--text);
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(25,30,40,.04);
}
.global-nav { min-width: 0; display: flex; align-self: stretch; align-items: center; justify-content: center; gap: clamp(18px, 3vw, 42px); overflow: hidden; }
.global-nav a { position: relative; height: 100%; display: flex; align-items: center; color: #4d515a; white-space: nowrap; }
.global-nav a::after { content: ""; position: absolute; inset: auto 0 0; height: 2px; background: var(--brand); transform: scaleX(0); transition: transform .18s ease; transform-origin: center; }
.global-nav a:hover { color: var(--brand); }
.global-nav a:hover::after,
.global-nav a:focus-visible::after { transform: scaleX(1); }
.client-portal .breadcrumb,
.admin-portal .breadcrumb { color: var(--muted); }
.client-portal .icon-button,
.admin-portal .icon-button,
.client-portal .project-switcher,
.admin-portal .project-switcher,
.client-portal .button,
.admin-portal .button {
  color: var(--text);
  background: white;
  border-color: var(--border);
  border-radius: 8px;
  text-transform: none;
  letter-spacing: 0;
  font: 600 12px/1 var(--font);
  box-shadow: none;
}
.client-portal .button.primary,
.admin-portal .button.primary { color: white; background: var(--brand); border-color: var(--brand); }
.client-portal .button:hover,
.admin-portal .button:hover,
.client-portal .icon-button:hover,
.admin-portal .icon-button:hover { border-color: #b9c1cc; background: #f7f8fa; }
.client-portal .button.primary:hover,
.admin-portal .button.primary:hover { background: #087fce; border-color: #087fce; }

.client-portal .content,
.admin-portal .content { width: min(1580px, 100%); max-width: none; padding: 28px 30px 64px; }
.client-portal .card,
.admin-portal .card { border: 1px solid var(--border); border-radius: 14px; background: white; box-shadow: var(--shadow); }
.client-portal .card-header,
.admin-portal .card-header { border-bottom-color: var(--border-soft); }
.client-portal .page-heading,
.admin-portal .page-heading { margin-bottom: 22px; padding: 0; border: 0; }
.client-portal .page-heading h1,
.admin-portal .page-heading h1 { font-size: clamp(28px, 3vw, 38px); color: var(--text); }
.client-portal .page-kicker,
.admin-portal .page-kicker { color: var(--brand); font-family: var(--font); letter-spacing: .08em; }

.client-portal .urgent-card { border-color: #ffd596; background: #fffaf0; box-shadow: none; }
.client-portal .client-hero {
  min-height: 310px;
  padding: 30px;
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(22,29,37,.96) 0%, rgba(25,34,43,.78) 43%, rgba(23,30,37,.08) 78%),
    linear-gradient(165deg, #f6b9a9 0 26%, #8e9faa 27% 40%, #36464d 41% 57%, #243a31 58%);
  box-shadow: var(--shadow);
}
.client-portal .client-hero::before {
  right: 3%;
  bottom: 0;
  width: 55%;
  height: 78%;
  opacity: 1;
  clip-path: polygon(2% 40%, 32% 8%, 91% 24%, 100% 92%, 0 92%);
  background:
    linear-gradient(90deg, transparent 0 12%, rgba(21,29,34,.75) 12% 15%, transparent 15% 38%, rgba(21,29,34,.72) 38% 43%, transparent 43% 67%, rgba(21,29,34,.75) 67% 73%, transparent 73%),
    linear-gradient(#dfe4e4 0 62%, #89969a 62% 66%, #d6dbd9 66% 100%);
  border: 0;
  border-bottom: 14px solid #274033;
}
.client-portal .client-hero::after { content: "ВИЗУАЛИЗАЦИЯ ОБЪЕКТА"; top: 22px; right: 24px; color: rgba(255,255,255,.86); }
.client-portal .hero-copy h1 { max-width: 650px; font-family: var(--font); font-size: clamp(36px, 4vw, 54px); font-weight: 700; line-height: 1.02; letter-spacing: -.045em; }
.client-portal .hero-copy h1 { color: #ffffff; text-shadow: 0 1px 12px rgba(0,0,0,.18); }
.client-portal .hero-copy p { color: rgba(255,255,255,.78); }
.client-portal .hero-meta span { border-radius: 6px; font-family: var(--font); }
.client-portal .dashboard-grid { grid-template-columns: 1.35fr .65fr; gap: 14px; border: 0; background: transparent; }
.client-portal .dashboard-grid > .card { border: 1px solid var(--border); }
.client-portal .progress-number { font-family: var(--font); font-size: 58px; font-weight: 600; }
.client-portal .section-title h2,
.admin-portal .section-title h2 { font-size: 21px; }
.client-portal .photo-tile,
.client-portal .report-visual { border-radius: 9px; }

.admin-portal .metric-grid { gap: 12px; border: 0; background: transparent; }
.admin-portal .metric-card { padding: 20px; border: 1px solid var(--border); border-radius: 12px; }
.admin-portal .metric-card strong { color: var(--text); font-family: var(--font); font-weight: 600; }
.admin-portal .project-table-wrap { border-radius: 12px; }
.admin-portal .project-table th { background: #fafbfc; color: #7f8795; }
.admin-portal .project-table td { height: 72px; background: white; }
.admin-portal .project-table tr:hover td { background: #f7fbff; }
.admin-portal .project-thumb { border-radius: 7px; filter: none; }
.admin-portal .tabs { padding: 4px; border: 1px solid var(--border); border-radius: 9px; background: white; }
.admin-portal .tabs button { border-radius: 6px; border: 0; }
.admin-portal .tabs button.active { color: var(--brand); background: var(--brand-soft); border: 0; }
.admin-portal .stage-builder { border-radius: 12px; }
.admin-portal .stage-tree { background: #fafbfc; }
.admin-portal .form-group input,
.admin-portal .form-group select,
.admin-portal .form-group textarea,
.client-portal .form-group input,
.client-portal .form-group select,
.client-portal .form-group textarea { color: var(--text); background: white; border-radius: 7px; }
.admin-portal .modal,
.client-portal .modal { background: white; border-radius: 14px; }
.admin-portal .upload-drop { background: #f8fbfe; border-radius: 10px; }
.admin-portal .document-row,
.client-portal .document-row,
.admin-portal .payment-row,
.client-portal .payment-row { background: #fafbfc; border-radius: 9px; }

.brand-entry { color: var(--text); background: #f5f6f8; background-image: linear-gradient(#e7eaf0 1px, transparent 1px), linear-gradient(90deg, #e7eaf0 1px, transparent 1px); background-size: 72px 72px; }
.brand-entry .role-brand { border-bottom-color: var(--border); }
.brand-entry .role-intro h1 em { color: var(--brand); }
.brand-entry .role-grid { background: white; border-color: var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.brand-entry .role-card { border-top: 0; }
.brand-entry .role-card:hover { border-top-color: transparent; background: #f8fbfe; }
.brand-entry .role-card + .role-card { border-color: var(--border); }
.brand-entry .role-number { color: var(--brand); }

@media (max-width: 1120px) {
  .client-portal .app-shell,
  .admin-portal .app-shell { --sidebar: 240px; }
  .global-nav { gap: 18px; }
  .global-nav a:nth-last-child(-n+2) { display: none; }
}

@media (max-width: 820px) {
  .client-portal .app-shell,
  .admin-portal .app-shell { display: block; }
  .client-portal .sidebar,
  .admin-portal .sidebar { width: min(300px, 86vw); transform: translateX(-102%); }
  .client-portal .sidebar.is-open,
  .admin-portal .sidebar.is-open { transform: translateX(0); }
  .client-portal .main-shell,
  .admin-portal .main-shell { grid-column: 1; }
  .client-portal .topbar,
  .admin-portal .topbar { grid-template-columns: auto 1fr auto; gap: 10px; padding-inline: 14px; }
  .global-nav { display: none; }
  .client-portal .content,
  .admin-portal .content { padding: 22px 16px 52px; }
}

@media (max-width: 560px) {
  .client-portal .topbar,
  .admin-portal .topbar { grid-template-columns: auto minmax(0, 1fr); }
  .client-portal .topbar-actions,
  .admin-portal .topbar-actions { justify-self: end; min-width: 0; }
  .client-portal .topbar-actions .project-switcher { width: min(158px, 43vw); }
  .client-portal .topbar-actions .notification-button,
  .admin-portal .topbar-actions .notification-button { display: none; }
  .client-portal .client-hero { min-height: 360px; padding: 22px; }
  .client-portal .client-hero::before { width: 96%; height: 68%; opacity: .62; }
  .client-portal .client-hero::after { display: none; }
  .client-portal .hero-copy h1 { font-size: 36px; }
  .client-portal .dashboard-grid { grid-template-columns: 1fr; }
  .brand-entry .role-grid { border-radius: 10px; }
}

/* Functional specification 1.1 additions */
.auth-page { min-height: 100vh; background: radial-gradient(circle at 78% 12%, rgba(74,158,255,.18), transparent 34%), var(--bg); }
.auth-shell { width: min(1120px, calc(100% - 32px)); min-height: 100vh; margin: 0 auto; padding: 32px 0; display: grid; grid-template-rows: auto 1fr; }
.auth-card { width: min(480px, 100%); margin: auto; padding: 34px; }
.auth-card h1 { margin: 10px 0; font-size: clamp(32px, 5vw, 48px); line-height: 1.02; }
.auth-card > p { color: var(--text-2); }
.auth-card form { display: grid; gap: 16px; margin-top: 26px; }
.auth-methods { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.auth-method { min-height: 40px; border: 0; border-radius: 6px; color: var(--text-2); background: transparent; cursor: pointer; }
.auth-method.active { color: var(--brand); background: var(--surface); box-shadow: var(--shadow); }
.auth-submit { width: 100%; }
.code-input-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: var(--border); }
.auth-note { text-align: center; font-size: 11px; }
.form-error { margin: 0; color: var(--danger); font-size: 12px; }

.stage-summary { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 14px; overflow: hidden; }
.stage-summary > div { padding: 18px 20px; }
.stage-summary > div + div { border-left: 1px solid var(--border); }
.stage-summary small, .stage-summary strong { display: block; }
.stage-summary small { color: var(--muted); }
.stage-summary strong { margin-top: 5px; }
.gantt-toolbar { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.gantt-phase-row { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 36px; padding: 0 12px; color: var(--text-2); background: var(--surface-2); border: 0; border-bottom: 1px solid var(--border); font: inherit; font-size: 11px; text-align: left; text-transform: uppercase; letter-spacing: .06em; cursor: pointer; }
.gantt-baseline { position: absolute; top: 10px; height: 4px; border-radius: 2px; background: var(--muted); opacity: .6; }
.client-gantt .gantt-bar { top: 22px; height: 18px; border: 0; cursor: pointer; }
.today-line { position: absolute; z-index: 3; inset: 0 auto 0 58%; width: 2px; background: var(--danger); opacity: .75; }
.payment-marker { position: absolute; z-index: 4; top: 39px; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--brand); font-size: 10px; transform: translateX(-50%); }
.gantt-legend { margin-top: 14px; }
.gantt-legend summary { color: var(--brand); cursor: pointer; }
.legend-items { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.acceptance-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0; }
.choice-card { min-height: 88px; padding: 14px; display: grid; gap: 4px; text-align: left; border: 1px solid var(--border); border-radius: 9px; color: var(--text); background: var(--surface); cursor: pointer; }
.choice-card span { color: var(--muted); font-size: 11px; }
.choice-card.active { border-color: var(--brand); background: var(--brand-soft); }
.compact-upload { min-height: 54px; margin-top: 8px; }

.bulk-actions { position: sticky; z-index: 10; top: 72px; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--brand); border-radius: 9px; background: var(--surface); box-shadow: var(--shadow); }
.bulk-actions strong { margin-right: auto; }
.project-table input[type="checkbox"] { width: 44px; height: 44px; margin: 0; display: grid; place-content: center; border: 0; background: transparent; appearance: none; cursor: pointer; }
.project-table input[type="checkbox"]::before { content: ""; width: 18px; height: 18px; display: grid; place-content: center; border: 1px solid var(--border); background: var(--surface); color: #07182b; font-size: 14px; font-weight: 800; line-height: 1; }
.project-table input[type="checkbox"]:checked::before { content: "✓"; border-color: var(--brand); background: var(--brand); }
.table-subline { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.manager-cell { display: flex; align-items: center; gap: 7px; }
.manager-cell .avatar { width: 28px; height: 28px; }
.warning-text { color: var(--warning); }
.project-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.project-tile { overflow: hidden; }
.project-tile-image { height: 170px; background: linear-gradient(155deg, #bfc9cd 0 42%, #657477 43% 57%, #31463a 58%); }
.project-tile-top { display: flex; justify-content: space-between; align-items: center; }
.project-tile h3 { margin: 16px 0 4px; font-size: 18px; }
.project-tile p { min-height: 42px; margin: 0 0 15px; color: var(--muted); }
.project-tile .button { margin-top: 16px; }
.calendar-month > header { display: flex; align-items: center; justify-content: center; gap: 20px; margin-bottom: 14px; }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); color: var(--text-muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-align: center; text-transform: uppercase; }
.calendar-weekdays span { padding: 10px 6px; border: 1px solid var(--border); border-bottom: 0; }
.calendar-days { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--border); }
.calendar-day { min-height: 110px; padding: 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.outside { background: var(--surface-2); }
.calendar-day > span { color: var(--muted); font-size: 11px; }
.calendar-day button { width: 100%; margin-top: 8px; padding: 6px; border: 0; border-left: 3px solid var(--brand); color: var(--text); background: var(--brand-soft); text-align: left; font-size: 10px; cursor: pointer; }
.title-status { display: flex; align-items: center; gap: 10px; }
.internal-field { padding: 12px; border: 1px solid rgba(217,164,65,.35); border-radius: 8px; background: var(--warning-soft); }
.tree-stage[draggable="true"] { cursor: grab; }
.tree-stage.is-dragging { opacity: .45; user-select: none; cursor: grabbing; }
.document-group { margin-bottom: 10px; overflow: hidden; }
.document-group > summary { padding: 16px 18px; display: flex; justify-content: space-between; cursor: pointer; }
.document-group > .document-list { padding: 0 16px 16px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.settings-row small { display: block; color: var(--muted); }
.notification-settings { display: grid; }
.notification-setting-head, .notification-setting { display: grid; grid-template-columns: minmax(180px,1fr) repeat(3, 70px); align-items: center; min-height: 48px; border-bottom: 1px solid var(--border-soft); }
.notification-setting-head { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.notification-setting input { justify-self: center; width: 18px; height: 18px; accent-color: var(--brand); }

:root[data-theme="dark"] .client-portal,
:root[data-theme="dark"] .admin-portal { --bg: #0e1116; --bg-deep: #0a0d12; --surface: #161b22; --surface-2: #1c2129; --surface-3: #222934; --border: #262c36; --border-soft: rgba(255,255,255,.075); --text: #e6eaf0; --text-2: #9ba4b4; --muted: #6b7480; --brand: #4a9eff; --success: #3fb950; --warning: #d9a441; --danger: #f0616d; --purple: #a371f7; --shadow: none; }
:root[data-theme="dark"] .client-portal .topbar,
:root[data-theme="dark"] .admin-portal .topbar { background: rgba(14,17,22,.96); color: var(--text); box-shadow: none; }
:root[data-theme="dark"] .client-portal .card,
:root[data-theme="dark"] .admin-portal .card,
:root[data-theme="dark"] .client-portal .button,
:root[data-theme="dark"] .admin-portal .button,
:root[data-theme="dark"] .client-portal .icon-button,
:root[data-theme="dark"] .admin-portal .icon-button,
:root[data-theme="dark"] .client-portal .project-switcher,
:root[data-theme="dark"] .admin-portal .project-switcher { color: var(--text); background: var(--surface); }
:root[data-theme="dark"] .admin-portal .project-table th,
:root[data-theme="dark"] .admin-portal .project-table td,
:root[data-theme="dark"] .admin-portal .stage-tree { background: var(--surface); }
:root[data-theme="dark"] .admin-portal .project-table tr:hover td { background: var(--surface-2); }
:root[data-theme="dark"] .admin-portal .form-group input,
:root[data-theme="dark"] .admin-portal .form-group select,
:root[data-theme="dark"] .admin-portal .form-group textarea,
:root[data-theme="dark"] .client-portal .form-group input,
:root[data-theme="dark"] .client-portal .form-group select,
:root[data-theme="dark"] .client-portal .form-group textarea { color: var(--text); background: var(--surface-2); }
:root[data-theme="dark"] .client-portal .button.primary,
:root[data-theme="dark"] .admin-portal .button.primary { color: #07182b; background: var(--brand); border-color: var(--brand); }
:root[data-theme="dark"] .client-portal .urgent-card { color: var(--text); border-color: rgba(217,164,65,.4); background: var(--warning-soft); }
:root[data-theme="dark"] .client-portal .urgent-card p { color: var(--text-2); }

@media (max-width: 920px) {
  .project-card-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 560px) {
  .auth-card { padding: 24px 18px; }
  .stage-summary { grid-template-columns: 1fr; }
  .stage-summary > div + div { border-left: 0; border-top: 1px solid var(--border); }
  .acceptance-actions { grid-template-columns: 1fr; }
  .project-card-grid { grid-template-columns: 1fr; }
  .bulk-actions { overflow-x: auto; }
  .bulk-actions strong { min-width: 90px; }
  .calendar-days, .calendar-weekdays { min-width: 720px; }
  .calendar-month { overflow-x: auto; }
  .notification-setting-head, .notification-setting { grid-template-columns: minmax(145px,1fr) repeat(3, 46px); }
  .settings-row { align-items: flex-start; flex-direction: column; }
  .quick-report-button { order: -1; }
}

/* Nordville specification palette — final cascade authority */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1116;
  --bg-deep: #0e1116;
  --surface: #161b22;
  --surface-2: #1c2129;
  --surface-3: #222934;
  --border: #262c36;
  --border-soft: rgba(230,234,240,.075);
  --text: #e6eaf0;
  --text-2: #9ba4b4;
  --muted: #6b7480;
  --brand: #4a9eff;
  --brand-soft: rgba(74,158,255,.13);
  --success: #3fb950;
  --success-soft: rgba(63,185,80,.13);
  --warning: #d9a441;
  --warning-soft: rgba(217,164,65,.13);
  --danger: #f0616d;
  --danger-soft: rgba(240,97,109,.12);
  --purple: #a371f7;
  --purple-soft: rgba(163,113,247,.13);
  --shadow: none;
}

:root[data-theme="dark"] body,
:root[data-theme="dark"] .role-page,
:root[data-theme="dark"] .auth-page,
:root[data-theme="dark"] .client-portal,
:root[data-theme="dark"] .admin-portal,
:root[data-theme="dark"] .client-portal .main-shell,
:root[data-theme="dark"] .admin-portal .main-shell {
  color: var(--text);
  background-color: var(--bg);
}

:root[data-theme="dark"] .brand-entry {
  background-color: var(--bg);
  background-image:
    linear-gradient(90deg, transparent calc(50% - .5px), var(--border-soft) 50%, transparent calc(50% + .5px)),
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 100% 100%, 72px 72px, 72px 72px;
}

:root[data-theme="dark"] .brand-entry .role-grid,
:root[data-theme="dark"] .brand-entry .role-card,
:root[data-theme="dark"] .auth-card,
:root[data-theme="dark"] .client-portal .card,
:root[data-theme="dark"] .admin-portal .card,
:root[data-theme="dark"] .client-portal .tabs,
:root[data-theme="dark"] .admin-portal .tabs,
:root[data-theme="dark"] .client-portal .modal,
:root[data-theme="dark"] .admin-portal .modal {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
  box-shadow: none;
}

:root[data-theme="dark"] .brand-entry .role-card:hover,
:root[data-theme="dark"] .brand-entry .role-card:focus-visible {
  background: var(--surface-2);
  border-top-color: var(--brand);
}

:root[data-theme="dark"] .client-portal .sidebar,
:root[data-theme="dark"] .admin-portal .sidebar,
:root[data-theme="dark"] .client-portal .topbar,
:root[data-theme="dark"] .admin-portal .topbar {
  color: var(--text);
  background: #0e1116;
  border-color: var(--border);
  box-shadow: none;
}

:root[data-theme="dark"] .client-portal .brand-mark,
:root[data-theme="dark"] .admin-portal .brand-mark {
  color: var(--brand);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}

:root[data-theme="dark"] .client-portal .sidebar-nav button,
:root[data-theme="dark"] .admin-portal .sidebar-nav button,
:root[data-theme="dark"] .global-nav a { color: var(--text-2); }

:root[data-theme="dark"] .client-portal .sidebar-nav button:hover,
:root[data-theme="dark"] .admin-portal .sidebar-nav button:hover { color: var(--text); background: var(--surface-2); }

:root[data-theme="dark"] .client-portal .sidebar-nav button.active,
:root[data-theme="dark"] .admin-portal .sidebar-nav button.active {
  color: #ffffff;
  background: var(--surface-2);
  border-left-color: var(--brand);
}

:root[data-theme="dark"] .client-portal .button,
:root[data-theme="dark"] .admin-portal .button,
:root[data-theme="dark"] .client-portal .icon-button,
:root[data-theme="dark"] .admin-portal .icon-button,
:root[data-theme="dark"] .client-portal .project-switcher,
:root[data-theme="dark"] .admin-portal .project-switcher,
:root[data-theme="dark"] .auth-page input {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

:root[data-theme="dark"] .client-portal .button:hover,
:root[data-theme="dark"] .admin-portal .button:hover,
:root[data-theme="dark"] .client-portal .icon-button:hover,
:root[data-theme="dark"] .admin-portal .icon-button:hover { color: var(--text); background: var(--surface-2); border-color: var(--brand); }

:root[data-theme="dark"] .client-portal .button.primary,
:root[data-theme="dark"] .admin-portal .button.primary,
:root[data-theme="dark"] .auth-page .button.primary {
  color: #07182b;
  background: var(--brand);
  border-color: var(--brand);
}

:root[data-theme="dark"] .admin-portal .project-table th,
:root[data-theme="dark"] .admin-portal .project-table td,
:root[data-theme="dark"] .admin-portal .stage-tree,
:root[data-theme="dark"] .admin-portal .upload-drop,
:root[data-theme="dark"] .admin-portal .document-row,
:root[data-theme="dark"] .client-portal .document-row,
:root[data-theme="dark"] .admin-portal .payment-row,
:root[data-theme="dark"] .client-portal .payment-row {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

:root[data-theme="dark"] .admin-portal .project-table th { color: var(--text-2); background: var(--surface-2); }
:root[data-theme="dark"] .admin-portal .project-table tr:hover td { background: var(--surface-2); }

:root[data-theme="dark"] .admin-portal .form-group input,
:root[data-theme="dark"] .admin-portal .form-group select,
:root[data-theme="dark"] .admin-portal .form-group textarea,
:root[data-theme="dark"] .client-portal .form-group input,
:root[data-theme="dark"] .client-portal .form-group select,
:root[data-theme="dark"] .client-portal .form-group textarea {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border);
}

/* Unified layout system: 8px rhythm, 12-column composition */
:root {
  --layout-unit: 8px;
  --layout-gap: 16px;
  --layout-section: 32px;
  --layout-page-max: 1472px;
}

.client-portal .content,
.admin-portal .content {
  width: 100%;
  max-width: var(--layout-page-max);
  min-height: calc(100svh - 64px);
  margin-inline: auto;
  padding: 32px;
}

#client-content,
#admin-content,
#project-tab-content {
  align-content: start;
  min-width: 0;
}

#client-content,
#admin-content,
#project-tab-content {
  display: flex;
  flex-direction: column;
  gap: var(--layout-gap);
}

#client-content > *,
#admin-content > *,
#project-tab-content > * { width: 100%; min-width: 0; }

.client-portal .page-heading,
.admin-portal .page-heading,
.admin-project-header,
.client-portal .urgent-card,
.admin-portal .tabs,
.client-portal .section-title,
.admin-portal .section-title,
.toolbar { margin: 0; }

.client-portal .page-heading,
.admin-portal .page-heading {
  min-height: 80px;
  align-items: flex-end;
  padding-bottom: 8px;
}

.client-portal .page-heading > div:first-child,
.admin-portal .page-heading > div:first-child,
.admin-project-title > div { min-width: 0; }

.client-portal .page-heading p,
.admin-portal .page-heading p { max-width: 760px; }

.client-portal .section-title,
.admin-portal .section-title {
  min-height: 40px;
  margin-top: 8px;
}

.client-portal .card,
.admin-portal .card { min-width: 0; }

.client-portal .card-body,
.admin-portal .card-body { padding: 24px; }

.metric-grid,
.admin-overview,
.event-grid,
.project-card-grid {
  align-items: stretch;
  gap: var(--layout-gap);
}

.metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.admin-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.event-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.project-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.metric-card,
.admin-overview .card,
.event-card,
.project-tile {
  height: 100%;
  min-height: 128px;
  padding: 20px;
}

.metric-card,
.admin-overview .card,
.event-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.metric-card small:last-child,
.admin-overview .card p:last-child,
.event-card .event-date { margin-top: auto; padding-top: 8px; }

.dashboard-grid {
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  align-items: stretch;
  gap: var(--layout-gap);
}

.dashboard-grid > .card { height: 100%; }

.two-column {
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  align-items: stretch;
  gap: var(--layout-gap);
}

.two-column > div {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}

.two-column .section-title { margin: 0; }
.two-column .card { height: 100%; }
.weather-card { padding: 16px; overflow: hidden; }

.weather-row {
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 10px;
}

.weather-day {
  min-width: 0;
  min-height: 148px;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.weather-day.current {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--border));
  background: var(--brand-soft);
}

.weather-day .icon { margin: 2px 0; color: var(--brand); }
.weather-day strong { font: 600 21px var(--mono); }
.weather-day > small:first-child { color: var(--text-2); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.weather-day > span:last-child { color: var(--muted); font-size: 11px; line-height: 1.35; text-align: center; }

.photo-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: repeat(2, 136px);
  gap: 8px;
}

.photo-grid > .photo-tile:first-child { grid-column: span 6; grid-row: span 2; }
.photo-grid > .photo-tile:nth-child(2),
.photo-grid > .photo-tile:nth-child(3) { grid-column: span 3; }
.photo-grid > .photo-tile:nth-child(4) { grid-column: span 6; }
.photo-grid:has(> .photo-tile:last-child:nth-child(3)) > .photo-tile:nth-child(n + 2) { grid-column: span 6; }

.team-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: var(--layout-gap);
}

.team-person {
  min-width: 0;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--surface-2);
}

.team-person .button,
.team-person .badge { margin-left: auto; }

.finance-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.finance-summary > div { min-height: 88px; display: flex; flex-direction: column; justify-content: center; padding: 20px; }

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
  gap: var(--layout-gap);
}

.search-field { width: 100%; min-width: 0; max-width: 520px; }
.filter-row { justify-content: flex-end; gap: 8px; }
.filter-row select { min-width: 160px; }

.document-list,
.payment-list,
.report-list { gap: 8px; }

.document-row,
.payment-row {
  min-height: 72px;
  padding: 12px 14px;
  gap: 12px;
}

.document-row { grid-template-columns: 42px minmax(0, 1fr) auto; }
.payment-row { grid-template-columns: minmax(0, 1fr) 180px 170px; }

.report-card {
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  min-height: 200px;
}

.report-content { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 24px; }
.report-content p { max-width: 820px; }

.stage-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.stage-summary > div { min-height: 80px; display: flex; flex-direction: column; justify-content: center; padding: 16px 20px; }

.stage-builder { grid-template-columns: minmax(280px, 320px) minmax(0, 1fr); }
.stage-editor { min-width: 0; padding: 24px; }
.form-grid { gap: 16px; }
.form-group { min-width: 0; align-content: start; }
.editor-heading { min-height: 48px; margin-bottom: 16px; }
.editor-actions { flex-wrap: wrap; margin-top: 24px; padding-top: 16px; }
.upload-drop { min-height: 160px; }

.admin-project-header { align-items: center; }
.admin-project-header .page-actions { justify-content: flex-end; }
.tabs { min-height: 48px; align-items: center; }
.tabs button { min-height: 40px; }

.calendar-month { min-width: 0; }

.gantt-grid { min-width: 820px; }

.modal-head,
.modal-body,
.modal-foot { padding-inline: 24px; }

@media (max-width: 1180px) {
  .client-portal .content,
  .admin-portal .content { padding: 24px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid,
  .two-column { grid-template-columns: 1fr; }
  .two-column > div { grid-template-rows: auto auto; }
  .admin-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .client-portal .content,
  .admin-portal .content { min-height: calc(100svh - 64px); padding: 24px 16px 48px; }

  #client-content,
  #admin-content,
  #project-tab-content { gap: 12px; }

  .client-portal .page-heading,
  .admin-portal .page-heading { min-height: 0; align-items: flex-start; padding-bottom: 4px; }

  .client-portal .section-title,
  .admin-portal .section-title { margin-top: 8px; }

  .toolbar { grid-template-columns: 1fr; }
  .search-field { max-width: none; }
  .filter-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); justify-content: stretch; }
  .filter-row select,
  .filter-row .button { width: 100%; min-width: 0; }

  .admin-project-header { align-items: flex-start; }
  .admin-project-header .page-actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-project-header .page-actions > :last-child { grid-column: 1 / -1; }

  .stage-builder { grid-template-columns: minmax(0, 1fr); }
  .stage-tree { width: 100%; border-right: 0; border-bottom: 1px solid var(--border); }
  .stage-editor { width: 100%; min-width: 0; }

  .weather-card { padding: 12px; }
  .weather-row {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
    overscroll-behavior-inline: contain;
  }
  .weather-day {
    flex: 0 0 148px;
    min-height: 152px;
    scroll-snap-align: start;
  }

  .team-row { grid-template-columns: 1fr; }
  .report-card { grid-template-columns: 1fr; }
  .report-visual { min-height: 220px; }
}

@media (max-width: 560px) {
  .client-portal .content,
  .admin-portal .content { padding: 20px 12px 40px; }

  .client-portal .card-body,
  .admin-portal .card-body { padding: 16px; }

  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric-card { min-height: 120px; padding: 16px; }
  .metric-card strong { font-size: 18px; overflow-wrap: anywhere; }
  .admin-overview,
  .event-grid,
  .project-card-grid { grid-template-columns: 1fr; gap: 8px; }

  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: 180px 120px; }
  .photo-grid > .photo-tile:first-child,
  .photo-grid > .photo-tile:nth-child(2),
  .photo-grid > .photo-tile:nth-child(3),
  .photo-grid > .photo-tile:nth-child(4),
  .photo-grid:has(> .photo-tile:last-child:nth-child(3)) > .photo-tile:nth-child(n + 2) { grid-column: auto; grid-row: auto; }
  .photo-grid > .photo-tile:first-child { grid-column: 1 / -1; }

  .finance-summary { grid-template-columns: 1fr; }
  .finance-summary > div { min-height: 76px; }

  .filter-row { grid-template-columns: 1fr; }
  .document-row { grid-template-columns: 42px minmax(0, 1fr); }
  .document-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .payment-row { grid-template-columns: minmax(0, 1fr) auto; }
  .payment-status { grid-column: 1 / -1; text-align: left; }

  .stage-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage-summary > div:last-child { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--border); }

  .admin-project-title { align-items: flex-start; }
  .title-status { align-items: flex-start; flex-direction: column; gap: 4px; }
  .admin-project-header .page-actions { grid-template-columns: 1fr; }
  .admin-project-header .page-actions > :last-child { grid-column: auto; }

  .modal-head,
  .modal-body,
  .modal-foot { padding-inline: 16px; }
}

/* Authoritative typography system: residential client UI + operational CMS */
:root {
  --font-client: "Avenir Next", Avenir, "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  --font-admin: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  --font-display-client: "Avenir Next", Avenir, "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  --font-display-admin: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Arial, sans-serif;
  --font-code: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
}

.role-page,
.auth-page,
.client-portal {
  --font: var(--font-client);
  font-family: var(--font-client);
}

.admin-portal,
.admin-auth-page {
  --font: var(--font-admin);
  font-family: var(--font-admin);
}

.client-portal :where(h1, h2, h3),
.role-page :where(h1, h2, h3),
.auth-page :where(h1, h2, h3) { font-family: var(--font-display-client); }

.admin-portal :where(h1, h2, h3),
.admin-auth-page :where(h1, h2, h3) { font-family: var(--font-display-admin); }

.role-page h1,
.auth-page h1,
.client-portal .hero-copy h1,
.client-portal .page-heading h1,
.admin-portal .page-heading h1,
.admin-portal .admin-project-title h1 {
  font-weight: var(--weight-bold);
  line-height: 1.08;
  letter-spacing: -.035em;
}

.role-page .role-intro h1,
.role-page .role-card h2,
.auth-page:not(.admin-auth-page) h1,
.client-portal .hero-copy h1,
.client-portal .page-heading h1,
.client-portal .section-title h2,
.client-portal .card-header :where(h2, h3),
.client-portal .report-content h3 { font-family: var(--font-display-client); }

.admin-auth-page h1,
.admin-portal .page-heading h1,
.admin-portal .section-title h2,
.admin-portal .admin-project-title h1,
.admin-portal .editor-heading h2,
.admin-portal .modal-head h2,
.admin-portal .card-header :where(h2, h3) { font-family: var(--font-display-admin); }

.role-page h2,
.client-portal .section-title h2,
.admin-portal .section-title h2,
.admin-portal .editor-heading h2,
.admin-portal .modal-head h2 {
  font-weight: var(--weight-bold);
  line-height: 1.2;
  letter-spacing: -.024em;
}

.client-portal :where(h3, .card-header h2, .card-header h3, .report-content h3),
.admin-portal :where(h3, .card-header h2, .card-header h3) {
  font-weight: var(--weight-semibold);
  line-height: 1.3;
  letter-spacing: -.012em;
}

.client-portal .page-heading h1,
.admin-portal .page-heading h1 { margin: 0; font-size: clamp(30px, 3vw, 40px); }

.client-portal .hero-copy h1 { font-size: clamp(42px, 5vw, 58px); }
.admin-portal .admin-project-title h1 { font-size: clamp(28px, 3vw, 36px); }
.client-portal .section-title h2,
.admin-portal .section-title h2 { font-size: clamp(20px, 2vw, 24px); }
.client-portal .card-header :where(h2, h3),
.admin-portal .card-header :where(h2, h3) { font-size: 16px; }
.client-portal h3,
.admin-portal h3 { font-size: 17px; }

.client-portal :where(p, li),
.admin-portal :where(p, li) { line-height: 1.6; }

.client-portal :where(strong, b),
.admin-portal :where(strong, b),
.role-page :where(strong, b),
.auth-page :where(strong, b) { font-weight: var(--weight-semibold); }

.client-portal :where(.button, .text-button, .sidebar-nav button),
.admin-portal :where(.button, .text-button, .sidebar-nav button),
.auth-page .button { font-weight: var(--weight-semibold); }

.client-portal :where(.badge, .label),
.admin-portal :where(.badge, .label) { font-weight: var(--weight-semibold); }

.client-portal .page-heading > div:first-child,
.admin-portal .page-heading > div:first-child {
  display: grid;
  align-content: start;
}

.client-portal .page-kicker,
.admin-portal .page-kicker { margin-bottom: 8px; line-height: 1.2; }

.client-portal .page-heading p,
.admin-portal .page-heading p {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.55;
}

.client-portal .section-title > div:first-child,
.admin-portal .section-title > div:first-child { display: grid; gap: 6px; }

.client-portal .section-title h2,
.admin-portal .section-title h2 { margin: 0; }

.client-portal .section-title p,
.admin-portal .section-title p {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
}

.hero-copy h1 { margin: 14px 0 10px; }
.hero-copy p { margin: 0; line-height: 1.55; }
.role-intro h1 { margin: 16px 0 18px; }
.role-intro h1 em { font-family: inherit; font-weight: inherit; }
.role-intro > p { margin: 0; line-height: 1.65; }
.role-card h2 { margin: 14px 0 10px; }
.role-card p { margin-top: 0; line-height: 1.6; }
.auth-card h1 { margin: 10px 0 12px; }
.auth-card > p { margin: 0; line-height: 1.6; }
#policy .document-sheet h1 { font-size: clamp(32px, 4vw, 44px); }
#policy .document-sheet h2 { font-size: 21px; font-weight: var(--weight-semibold); }
.admin-project-title > div { display: grid; gap: 8px; }
.admin-project-title .title-status { gap: 10px; }
.admin-project-title :where(h1, p) { margin: 0; }
.editor-heading > div,
.modal-head > div { display: grid; gap: 7px; }
.editor-heading .page-kicker,
.modal-head .page-kicker,
.editor-heading h2,
.modal-head h2 { margin: 0; }
.urgent-card h3 { margin: 5px 0 7px; }
.urgent-card p { margin: 0; }
.report-content h3 { margin: 9px 0 8px; }
.report-content p { margin: 0 0 14px; }
.project-tile h3 { margin: 16px 0 7px; }
.project-tile p { margin-top: 0; }

/* Amounts stay aligned without taking on a code-editor voice. */
.money,
.progress-number,
.finance-summary strong,
.metric-card strong,
.stage-summary strong,
.payment-amount,
.stage-percent,
.event-date,
.table-progress strong,
.weather-day strong,
time,
input[type="date"],
input[type="number"],
input[inputmode="numeric"] {
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: -.015em;
}

.mono,
.role-number,
.document-sheet-brand {
  font-family: var(--font-code);
  font-variant-numeric: tabular-nums slashed-zero;
  font-feature-settings: "tnum" 1, "zero" 1;
}

.page-kicker,
.eyebrow,
.urgent-label {
  font-family: inherit;
  font-size: 11px;
  font-weight: var(--weight-bold);
  line-height: 1.35;
  letter-spacing: .105em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 560px) {
  .client-portal .page-heading h1,
  .admin-portal .page-heading h1 { font-size: 30px; }
  .client-portal .page-heading p,
  .admin-portal .page-heading p { margin-top: 8px; font-size: 13px; }
  .client-portal .page-kicker,
  .admin-portal .page-kicker { margin-bottom: 7px; }
  .client-portal .section-title p,
  .admin-portal .section-title p { font-size: 12px; }
  .page-kicker,
  .eyebrow,
  .urgent-label { font-size: 11px; letter-spacing: .095em; }
}

/* Local documentary photography */
.client-portal .client-hero {
  background-image:
    linear-gradient(90deg, rgba(7,10,14,.94) 0%, rgba(7,10,14,.72) 46%, rgba(7,10,14,.12) 100%),
    url("images/house-main.jpg");
  background-size: cover;
  background-position: center 56%;
}

.client-portal .client-hero::before { display: none; }

.client-portal .camera-card {
  background-image:
    linear-gradient(180deg, rgba(8,12,17,.08), rgba(8,12,17,.5)),
    url("images/construction-frame.jpg");
  background-size: cover;
  background-position: center 58%;
}

.client-portal .camera-card::after { display: none; }

:root[data-theme="dark"] .client-portal .camera-card,
:root[data-theme="light"] .client-portal .camera-card {
  background-image:
    linear-gradient(180deg, rgba(8,12,17,.08), rgba(8,12,17,.5)),
    url("images/construction-frame.jpg");
  background-size: cover;
  background-position: center 58%;
}

.photo-art,
.report-visual,
.project-thumb,
.project-tile-image {
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
}

.construction-gallery .photo-tile:nth-child(1) .photo-art,
.construction-report-list .report-card:nth-child(1) .report-visual {
  background-image: linear-gradient(180deg, transparent 48%, rgba(5,8,12,.68)), url("images/construction-roof.jpg");
  background-position: center 42%;
}

.construction-gallery .photo-tile:nth-child(2) .photo-art,
.construction-report-list .report-card:nth-child(2) .report-visual {
  background-image: linear-gradient(180deg, transparent 48%, rgba(5,8,12,.68)), url("images/construction-interior.jpg");
  background-position: center;
}

.construction-gallery .photo-tile:nth-child(3) .photo-art,
.construction-report-list .report-card:nth-child(3) .report-visual {
  background-image: linear-gradient(180deg, transparent 48%, rgba(5,8,12,.68)), url("images/construction-frame.jpg");
  background-position: center 58%;
}

.visualization-gallery .photo-tile:nth-child(1) .photo-art {
  background-image: linear-gradient(180deg, transparent 48%, rgba(5,8,12,.7)), url("images/house-main.jpg");
  background-position: center 55%;
}

.visualization-gallery .photo-tile:nth-child(2) .photo-art {
  background-image: linear-gradient(180deg, transparent 48%, rgba(5,8,12,.7)), url("images/interior-living.jpg");
}

.visualization-gallery .photo-tile:nth-child(3) .photo-art {
  background-image: linear-gradient(180deg, transparent 48%, rgba(5,8,12,.7)), url("images/interior-bedroom.jpg");
}

.visualization-gallery .photo-tile:nth-child(4) .photo-art {
  background-image: linear-gradient(180deg, transparent 48%, rgba(5,8,12,.7)), url("images/plans.jpg");
}

.construction-gallery .photo-art,
.visualization-gallery .photo-art { filter: none; transform: none; }

.construction-gallery .photo-tile:hover .photo-art,
.construction-gallery .photo-tile:nth-child(2):hover .photo-art,
.construction-gallery .photo-tile:nth-child(4):hover .photo-art,
.visualization-gallery .photo-tile:hover .photo-art,
.visualization-gallery .photo-tile:nth-child(2):hover .photo-art,
.visualization-gallery .photo-tile:nth-child(4):hover .photo-art { transform: scale(1.035); }

.photo-caption { text-shadow: 0 1px 8px rgba(0,0,0,.75); }

.admin-portal .project-table tbody tr:nth-child(1) .project-thumb,
.admin-portal .project-card-grid .project-tile:nth-child(1) .project-tile-image {
  background-image: url("images/house-main.jpg");
  background-position: center 58%;
}

.admin-portal .project-table tbody tr:nth-child(2) .project-thumb,
.admin-portal .project-card-grid .project-tile:nth-child(2) .project-tile-image {
  background-image: url("images/house-istra.jpg");
  background-position: center;
}

.admin-portal .project-table tbody tr:nth-child(3) .project-thumb,
.admin-portal .project-card-grid .project-tile:nth-child(3) .project-tile-image {
  background-image: url("images/house-forest.jpg");
  background-position: center 46%;
}

/* Unified content rhythm: text, metadata and actions */
:root {
  --text-space-1: 4px;
  --text-space-2: 8px;
  --text-space-3: 12px;
  --text-space-4: 16px;
  --text-space-5: 24px;
}

.client-portal :where(h1, h2, h3, p),
.admin-portal :where(h1, h2, h3, p),
.role-page :where(h1, h2, h3, p),
.auth-page :where(h1, h2, h3, p) {
  margin-block: 0;
}

/* Page and section introductions */
.client-portal .page-heading > div:first-child,
.admin-portal .page-heading > div:first-child,
.editor-heading > div:first-child,
.modal-head > div:first-child {
  display: grid;
  align-content: start;
  gap: 0;
}

.client-portal .page-heading .page-kicker,
.admin-portal .page-heading .page-kicker,
.editor-heading .page-kicker,
.modal-head .page-kicker { margin: 0 0 var(--text-space-2); }

.client-portal .page-heading h1 + p,
.admin-portal .page-heading h1 + p { margin-top: 10px; }

.client-portal .section-title > div:first-child,
.admin-portal .section-title > div:first-child {
  display: grid;
  align-content: start;
  gap: 0;
}

.client-portal .section-title h2 + p,
.admin-portal .section-title h2 + p { margin-top: 6px; }

.card-header > div:first-child {
  display: grid;
  align-content: start;
  gap: var(--text-space-1);
}

.card-header :where(h2, h3, p, small) { margin: 0; }

/* Entry and authentication */
.role-intro .eyebrow { margin: 0 0 var(--text-space-4); }
.role-intro h1 { margin: 0 0 18px; }
.role-intro > p { margin: 0; }
.role-card > div:first-of-type { display: grid; align-content: start; gap: 0; }
.role-card .role-kicker { margin: 0 0 14px; }
.role-card h2 { margin: 0 0 10px; }
.role-card p { margin: 0; }
.role-card .role-link { margin-top: var(--text-space-5); }
.role-note { margin-top: 18px; }

.auth-card .eyebrow { margin: 0 0 10px; }
.auth-card h1 { margin: 0 0 var(--text-space-3); }
.auth-card > p { margin: 0; }
.auth-card form { margin-top: var(--text-space-5); gap: var(--text-space-4); }
.auth-divider { margin-block: 20px; }
.auth-note { margin: 0; }

/* Repeated card hierarchy: label, value, supporting copy */
.metric-card,
.admin-overview .card,
.event-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.metric-card > .label,
.admin-overview .card > small:first-child,
.event-card > small:first-child { margin: 0 0 var(--text-space-2); }

.metric-card > strong,
.admin-overview .card > strong,
.event-card > strong { margin: 0; }

.metric-card > small:last-child,
.admin-overview .card > p:last-child,
.event-card > .event-date {
  margin: auto 0 0;
  padding-top: var(--text-space-2);
}

.admin-overview .card > .progress-track { margin-top: var(--text-space-3); }

.finance-summary small,
.stage-summary small { margin: 0 0 var(--text-space-2); }
.finance-summary strong,
.stage-summary strong { margin: 0; }

.progress-details { display: grid; align-content: start; gap: var(--text-space-1); }
.progress-details :where(strong, span) { margin: 0; }

/* Rich cards, alerts and empty states */
.urgent-card .urgent-label { margin: 0 0 5px; }
.urgent-card h3 { margin: 0 0 7px; }
.urgent-card p { margin: 0; }

.alert > div:last-child { display: grid; align-content: start; gap: 0; }
.alert strong { margin: 0; }
.alert strong + p { margin-top: 5px; }

.empty-state > div { display: grid; justify-items: center; align-content: center; gap: 0; }
.empty-state .empty-icon { margin: 0 0 var(--text-space-3); }
.empty-state strong { margin: 0; }
.empty-state strong + p { margin-top: var(--text-space-2); }

.report-content { align-content: start; }
.report-meta { margin: 0 0 var(--text-space-2); }
.report-content h3 { margin: 0 0 var(--text-space-2); }
.report-content p { margin: 0; }
.report-content p + :is(button, .button, .badge) { margin-top: var(--text-space-4); }

.project-tile .card-body { display: flex; flex-direction: column; align-items: stretch; }
.project-tile h3 { margin: var(--text-space-4) 0 7px; }
.project-tile p { margin: 0; }
.project-tile p + .progress-track { margin-top: var(--text-space-4); }
.project-tile .progress-track + .button { margin-top: var(--text-space-4); }

/* Compact identity and metadata rows */
.team-person > div:nth-child(2),
.document-row > div:nth-child(2),
.payment-title,
.project-name > div,
.settings-row > div:first-child,
.notification-item,
.change-row > div:first-child {
  display: grid;
  align-content: start;
  gap: var(--text-space-1);
}

.team-person :where(strong, small),
.document-row :where(strong, small),
.payment-title :where(strong, small),
.project-name :where(strong, small),
.settings-row :where(strong, small),
.notification-item :where(strong, small),
.change-row :where(strong, small) { margin: 0; }

.stage-name + .stage-meta { margin-top: 7px; }
.stage-meta + .delay-note { margin-top: 10px; }
.journal-row :where(time, strong, span, small) { margin-block: 0; }

/* Forms: label, control, help/error */
.form-group { gap: 0; }
.form-group > label:not(.toggle-row) { margin: 0 0 7px; }
.form-group > :is(input, select, textarea) { margin: 0; }
.form-group > :is(input, select, textarea) + .form-help,
.form-group > .toggle-row + .form-help { margin-top: 7px; }
.form-group > .toggle-row + .toggle-row { margin-top: var(--text-space-2); }
.form-error { margin: 0; }

.upload-drop > div { display: grid; justify-items: center; align-content: center; gap: 0; }
.upload-drop .upload-icon { margin: 0 0 10px; }
.upload-drop strong { margin: 0; }
.upload-drop strong + p { margin-top: var(--text-space-2); }
.upload-drop p { margin-bottom: 0; }

.choice-card { align-content: center; gap: var(--text-space-1); }
.choice-card :where(strong, span) { margin: 0; }

/* Paragraph rhythm is limited to actual prose containers. */
.role-intro p + p,
.auth-card p + p,
.card-body > p + p,
.modal-body > p + p,
.report-content p + p { margin-top: var(--text-space-3); }

.modal-body > p:first-child { margin: 0 0 var(--text-space-4); }

@media (max-width: 560px) {
  .client-portal .page-heading h1 + p,
  .admin-portal .page-heading h1 + p { margin-top: var(--text-space-2); }

  .role-intro .eyebrow { margin-bottom: var(--text-space-3); }
  .role-intro h1 { margin-bottom: var(--text-space-4); }
  .role-card .role-link { margin-top: 20px; }
  .report-content p + :is(button, .button, .badge) { margin-top: var(--text-space-3); }
}

/* Functional viewers */
button.photo-tile {
  width: 100%;
  padding: 0;
  color: inherit;
  text-align: left;
  appearance: none;
  cursor: pointer;
}

button.photo-tile:focus-visible,
.viewer-thumb:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

.viewer-modal { width: min(980px, calc(100% - 28px)); }
.viewer-shell { display: grid; grid-template-rows: auto minmax(0, 1fr); max-height: calc(100vh - 42px); }
.viewer-body { overflow: auto; padding: 24px; }
.viewer-gallery,
.visual-viewer,
.camera-viewer,
.document-preview,
.viewer-form { display: grid; gap: 16px; }

.viewer-gallery-main,
.visual-viewer > img,
.camera-frame > img {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  object-fit: cover;
}

.viewer-gallery-main { height: min(58vh, 570px); }
.visual-viewer > img { max-height: 68vh; object-position: center; }
.viewer-gallery-thumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.viewer-thumb { overflow: hidden; height: 88px; padding: 0; border: 2px solid transparent; border-radius: 8px; background: var(--surface-2); cursor: pointer; }
.viewer-thumb.active { border-color: var(--brand); }
.viewer-thumb img { width: 100%; height: 100%; object-fit: cover; }
.viewer-copy { display: grid; justify-items: start; gap: 8px; }
.viewer-copy :where(p, small) { margin: 0; }
.viewer-copy p { color: var(--text-2); }
.viewer-copy small { color: var(--muted); }

.camera-frame { position: relative; overflow: hidden; min-height: 420px; border-radius: 12px; background: var(--bg-deep); }
.camera-frame > img { height: 100%; min-height: 420px; border: 0; }
.camera-frame .live { position: absolute; top: 16px; left: 16px; }
.camera-frame time { position: absolute; right: 16px; bottom: 16px; padding: 7px 9px; border-radius: 6px; color: white; background: rgba(7,10,14,.76); }
.camera-status-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 10px; }
.camera-status-grid > div { display: grid; gap: 5px; padding: 16px; }
.camera-status-grid > div + div { border-left: 1px solid var(--border); }
.camera-status-grid small { color: var(--muted); }
.camera-timeline { display: grid; gap: 8px; color: var(--text-2); }
.camera-timeline input { width: 100%; accent-color: var(--brand); }
.camera-card .live.offline { color: var(--danger); background: color-mix(in srgb, var(--danger) 15%, transparent); }
.weather-source { display: block; padding: 0 18px 14px; color: var(--muted); }

.document-preview { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.uploaded-document-frame { width: 100%; min-height: 70vh; border: 1px solid var(--border); border-radius: 8px; background: white; }
.uploaded-document-preview { width: 100%; max-height: 72vh; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-deep); }
.document-sheet { min-height: 500px; padding: clamp(24px, 5vw, 56px); border: 1px solid var(--border); border-radius: 8px; color: #1b2430; background: #fff; }
.document-sheet-brand { color: #4a9eff; font: 700 12px/1.4 var(--font-code); letter-spacing: .18em; }
.document-sheet h3 { margin: 36px 0 12px; font-size: clamp(25px, 4vw, 42px); }
.document-sheet > p { margin: 0; }
.document-sheet dl { display: grid; gap: 0; margin: 36px 0; border-top: 1px solid #dce2e9; }
.document-sheet dl div { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid #dce2e9; }
.document-sheet dt { color: #667180; }
.document-sheet dd { margin: 0; font-weight: 600; }
.viewer-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.viewer-gallery { overflow: auto; }
.viewer-gallery-main { cursor: zoom-in; transform-origin: center; transition: transform .2s ease; }
.viewer-gallery-main.is-zoomed { transform: scale(1.65); cursor: zoom-out; }
.timelapse-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 20px; flex-wrap: wrap; }
.version-history { margin-top: 7px; color: var(--text-2); }
.version-history summary { cursor: pointer; }
.version-history span { display: block; margin-top: 4px; font-size: 11px; }

.viewer-form fieldset { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; }
.viewer-form legend { margin-bottom: 8px; font-weight: 600; }
.viewer-form .choice-card { grid-template-columns: auto 1fr; align-items: center; }
.viewer-form .choice-card > span { display: grid; gap: 4px; }
.viewer-form .choice-card input { width: 18px; height: 18px; accent-color: var(--brand); }

/* Statuses are communicated by text and colour, without decorative diamonds. */
.badge::before { display: none; content: none; }
.badge { gap: 0; }

.inline-actions,
.stage-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-actions { margin-top: 16px; }
.stage-tools { margin-bottom: 12px; }
.actionable-card > .button { margin-top: 16px; }
.tree-phase-title button { min-width: 0; padding: 0; border: 0; color: inherit; background: transparent; font: inherit; text-align: left; cursor: pointer; }
.tree-phase-title button:hover { color: var(--brand); }
.payment-status { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.request-thread { display: grid; gap: 10px; }
.request-thread article { padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.request-thread article :where(p, small) { margin: 5px 0 0; }
.request-thread article p { color: var(--text-2); }
.request-thread article small { display: block; color: var(--muted); }
.attachment-list { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.attachment-list span { padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px; color: var(--text-2); background: var(--surface-2); font-size: 11px; }
.stage-detail { display: grid; gap: 18px; }
.stage-detail > p { margin: 0; color: var(--text-2); }
.stage-detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 10px; }
.stage-detail-grid > div { display: grid; gap: 6px; padding: 14px; }
.stage-detail-grid > div + div { border-left: 1px solid var(--border); }
.stage-detail-grid small { color: var(--muted); }
.detail-list { display: grid; gap: 6px; margin: 10px 0 0; padding-left: 20px; color: var(--text-2); }
.prose-card p { max-width: 820px; margin: 0; color: var(--text-2); line-height: 1.7; }
.completion-banner { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 14px; padding: 24px; border: 1px solid color-mix(in srgb, var(--success) 42%, var(--border)); border-radius: 14px; background: var(--success-soft); }
.readonly-banner { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding: 12px 16px; border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--border)); border-radius: 10px; color: var(--text); background: var(--warning-soft); }
.readonly-banner span { color: var(--text-2); }
.payment-order { display: grid; grid-template-columns: repeat(2, 44px); gap: 4px; }
.gantt-project-button { width: 100%; padding: 0; border: 0; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.role-preview { display: grid; gap: 6px; margin-bottom: 12px; color: var(--muted); font-size: 10px; }
.role-preview select { width: 100%; min-height: 38px; }
.completion-banner h2 { margin: 7px 0 8px; }
.completion-banner p { margin: 0; color: var(--text-2); }
.cross-sell-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cross-sell-grid .card { padding: 20px; }
.cross-sell-grid p { margin: 7px 0 0; color: var(--text-2); }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.tag-row span { padding: 5px 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); background: var(--surface-2); font-size: 10px; }

/* Every interactive target remains usable on a phone at the construction site. */
.button.small,
.view-toggle button,
.tabs button,
.tree-stage,
.tree-add,
.tree-phase-title button,
.auth-method,
.gantt-phase-row,
.role-preview select,
.text-button { min-height: 44px; }
.button.small { min-width: 44px; }
.calendar-day button { min-width: 44px; min-height: 44px; }
.tree-phase-title button,
.text-button { display: inline-flex; align-items: center; }
.gantt-project-button { min-height: 44px; }
.gantt-bar { --gantt-color: var(--brand); top: 5px; min-width: 44px; height: 44px; padding-block: 12px; border-radius: 0; background: transparent; background-clip: content-box; overflow: hidden; }
.gantt-bar::after { height: 100%; background: color-mix(in srgb, var(--gantt-color) 76%, white); }
.gantt-bar.review { --gantt-color: var(--purple); background-color: transparent; }
.gantt-bar.delay { --gantt-color: var(--warning); background-color: transparent; }
.gantt-bar.complete { --gantt-color: var(--success); background-color: transparent; }
.gantt-bar:not(.review, .delay, .complete) { background-image: linear-gradient(var(--gantt-color), var(--gantt-color)); }
.gantt-bar.review { background-image: linear-gradient(var(--purple), var(--purple)); }
.gantt-bar.delay { background-image: linear-gradient(var(--warning), var(--warning)); }
.gantt-bar.complete { background-image: linear-gradient(var(--success), var(--success)); }
.gantt-bar { background-repeat: no-repeat; background-position: 0 12px; background-size: 100% 20px; }
.client-gantt .gantt-bar { top: 5px; height: 44px; padding-block: 13px; background-position: 0 13px; background-size: 100% 18px; }
.compare-card { overflow: hidden; }
.director-contact { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 16px; }
.director-contact p { margin: 0 auto 0 0; color: var(--text-2); }
.report-visual { width: 100%; border: 0; cursor: pointer; text-align: left; }
.report-photo-mode { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.report-photo-mode .report-card { display: block; overflow: hidden; }
.report-photo-mode .report-content p,
.report-photo-mode .report-content .tag-row,
.report-photo-mode .report-content > .button { display: none; }
.team-assignment-list { display: grid; gap: 12px; }
.project-team-choice { display: grid; grid-template-columns: auto minmax(140px, 1fr) minmax(180px, 1fr) auto; align-items: center; gap: 12px; }
.compare-stage { --compare: 50%; position: relative; overflow: hidden; aspect-ratio: 16 / 8; min-height: 280px; background: var(--bg-deep); }
.compare-stage > img,
.compare-fact,
.compare-fact img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.compare-fact { width: var(--compare); overflow: hidden; border-right: 2px solid white; }
.compare-fact img { width: calc(100vw - var(--sidebar)); max-width: 1400px; }
.compare-label { position: absolute; top: 14px; padding: 6px 8px; border-radius: 5px; color: white; background: rgba(7,10,14,.72); font-size: 10px; }
.compare-label.before { left: 14px; }
.compare-label.after { right: 14px; }
.compare-control { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 16px; padding: 16px; color: var(--text-2); }
.compare-control input { width: 100%; accent-color: var(--brand); }

@media (max-width: 680px) {
  .viewer-body { padding: 16px; }
  .viewer-gallery-main { height: 42vh; }
  .viewer-thumb { height: 64px; }
  .camera-frame,
  .camera-frame > img { min-height: 280px; }
  .camera-status-grid { grid-template-columns: 1fr; }
  .camera-status-grid > div + div { border-top: 1px solid var(--border); border-left: 0; }
  .document-preview { grid-template-columns: 1fr; }
  .document-sheet { min-height: 420px; padding: 24px; }
  .document-sheet dl div { grid-template-columns: 1fr; gap: 4px; }
  .stage-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage-detail-grid > div:nth-child(3) { border-left: 0; border-top: 1px solid var(--border); }
  .stage-detail-grid > div:nth-child(4) { border-top: 1px solid var(--border); }
  .cross-sell-grid { grid-template-columns: 1fr; }
  .completion-banner { align-items: flex-start; flex-direction: column; }
  .payment-status { justify-content: flex-start; }
  .compare-stage { min-height: 230px; aspect-ratio: 4 / 3; }
  .compare-fact img { width: calc(100vw - 26px); }
  .compare-control { grid-template-columns: 1fr; gap: 8px; }
  .report-photo-mode { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-team-choice { grid-template-columns: auto 1fr; }
  .project-team-choice > input:not([type="checkbox"]), .project-team-choice > .toggle-row { grid-column: 2; }
  .director-contact { align-items: flex-start; flex-direction: column; }
  .director-contact p { margin: 0; }
}

@media (max-width: 520px) {
  .report-photo-mode { grid-template-columns: 1fr; }
}

.site-map { overflow: hidden; min-height: 320px; }
.site-map iframe { display: block; width: 100%; min-height: 320px; border: 0; filter: saturate(.72) contrast(.96); }
.coordinate-map-preview { min-height: 180px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; color: var(--muted); background: var(--surface-2); }
.coordinate-map-preview iframe { width: 100%; min-height: 180px; border: 0; }

@media (max-width: 820px) {
  .client-portal .app-shell,
  .admin-portal .app-shell { display: block !important; grid-template-columns: 1fr; }
  .client-portal .main-shell,
  .admin-portal .main-shell { width: 100%; margin-left: 0; grid-column: 1; }
  .client-portal .sidebar,
  .admin-portal .sidebar { width: min(300px, 86vw); transform: translateX(-102%); visibility: hidden; pointer-events: none; }
  .client-portal .sidebar.is-open,
  .admin-portal .sidebar.is-open { transform: translateX(0); visibility: visible; pointer-events: auto; }
}

/* Cross-page grid: one origin, one rhythm and stable brand geometry. */
:root {
  --page-gutter: 32px;
  --content-gutter: 32px;
  --app-sidebar: 304px;
  --brand-wide-width: 240px;
  --brand-wide-height: 48px;
  --public-content-max: 1472px;
}

.brand-logo {
  display: block;
  flex: 0 0 auto;
  line-height: 0;
}

.brand-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
}

/* Public, authentication and policy pages share the same outer columns. */
.role-shell,
.brand-entry .role-shell,
.auth-shell {
  width: 100%;
  max-width: none;
  margin-inline: 0;
  padding-inline: max(var(--page-gutter), env(safe-area-inset-left));
}

.role-shell,
.brand-entry .role-shell { padding-block: var(--page-gutter) 64px; }

.auth-shell { padding-block: var(--page-gutter); }

.role-brand,
.auth-shell > .brand-lockup {
  width: 100%;
  min-height: var(--brand-wide-height);
  align-items: center;
}

.brand-entry .role-brand { padding-bottom: 24px; }
.brand-entry .role-intro { padding-block: 96px 64px; }
.role-card { padding: 32px; }
.auth-card { padding: 32px; }

.role-brand .brand-logo-client,
.auth-shell > .brand-lockup .brand-logo-client,
.auth-shell > .brand-lockup .brand-logo-cms,
.client-portal .sidebar .brand-logo-client,
.admin-portal .sidebar .brand-logo-cms {
  width: var(--brand-wide-width);
  height: var(--brand-wide-height);
}

/* Client and company applications use the same rail, bar and content columns. */
.client-portal .app-shell,
.admin-portal .app-shell { --sidebar: var(--app-sidebar); }

.client-portal .sidebar,
.admin-portal .sidebar {
  width: var(--app-sidebar);
  padding: var(--page-gutter) 0 24px;
}

.client-portal .sidebar .brand-lockup,
.admin-portal .sidebar .brand-lockup {
  width: auto;
  min-height: 64px;
  margin: 0 var(--page-gutter) 16px;
  padding: 0 0 16px;
  align-items: center;
}

.client-portal .sidebar-nav button,
.admin-portal .sidebar-nav button { padding-inline: var(--page-gutter); }

.client-portal .nav-section,
.admin-portal .nav-section { margin-inline: var(--page-gutter); }

.client-portal .sidebar-bottom,
.admin-portal .sidebar-bottom { margin-inline: 24px; }

.client-portal .main-shell,
.admin-portal .main-shell { grid-column: 2; }

.client-portal .topbar,
.admin-portal .topbar {
  height: 64px;
  padding-inline: var(--content-gutter);
  gap: 24px;
}

.client-portal .content,
.admin-portal .content {
  width: 100%;
  max-width: none;
  padding: 32px var(--content-gutter) 64px;
}

#client-content,
#admin-content,
#project-tab-content { gap: var(--layout-gap); }

.client-portal .metric-grid,
.admin-portal .metric-grid,
.client-portal .dashboard-grid,
.admin-portal .dashboard-grid,
.client-portal .admin-overview,
.admin-portal .admin-overview,
.client-portal .event-grid,
.admin-portal .event-grid,
.client-portal .project-card-grid,
.admin-portal .project-card-grid,
.client-portal .two-column,
.admin-portal .two-column,
.client-portal .team-row,
.admin-portal .team-row,
.client-portal .report-photo-mode,
.admin-portal .report-photo-mode,
.client-portal .form-grid,
.admin-portal .form-grid { gap: var(--layout-gap); }

#policy .document-sheet {
  width: min(1180px, 100%);
  margin: 32px auto 0;
}

#policy .document-sheet h1 { margin: 8px 0 12px; }
#policy .document-sheet h2 { margin: 16px 0 4px; }
#policy .document-sheet p + h2 { margin-top: 16px; }
#policy .document-sheet > p:last-child { margin-top: 16px; }

@media (max-width: 1180px) {
  :root {
    --page-gutter: 24px;
    --content-gutter: 24px;
    --app-sidebar: 264px;
    --brand-wide-width: 216px;
    --brand-wide-height: 44px;
  }

  .client-portal .sidebar .brand-lockup,
  .admin-portal .sidebar .brand-lockup { min-height: 60px; }
}

@media (max-width: 820px) {
  :root {
    --page-gutter: 16px;
    --content-gutter: 16px;
  }

  .role-shell,
  .brand-entry .role-shell,
  .auth-shell {
    padding-top: max(24px, env(safe-area-inset-top));
    padding-right: max(var(--page-gutter), env(safe-area-inset-right));
    padding-left: max(var(--page-gutter), env(safe-area-inset-left));
  }

  .role-shell,
  .brand-entry .role-shell { padding-bottom: 48px; }
  .brand-entry .role-brand { padding-bottom: 24px; }
  .brand-entry .role-intro { padding-block: 64px 40px; }
  .role-card { padding: 24px; }
  .auth-card { padding: 24px; }

  .role-brand .brand-logo-client,
  .auth-shell > .brand-lockup .brand-logo-client,
  .client-portal .sidebar .brand-logo-client {
    width: 58px;
    height: 58px;
  }

  .auth-shell > .brand-lockup .brand-logo-cms,
  .admin-portal .sidebar .brand-logo-cms {
    width: 218px;
    height: 44px;
  }

  .client-portal .sidebar,
  .admin-portal .sidebar {
    width: min(304px, 88vw);
    padding-top: max(24px, env(safe-area-inset-top));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }

  .client-portal .sidebar .brand-lockup,
  .admin-portal .sidebar .brand-lockup {
    min-height: 68px;
    margin-inline: var(--page-gutter);
    padding-bottom: 16px;
  }

  .client-portal .sidebar-nav button,
  .admin-portal .sidebar-nav button { padding-inline: var(--page-gutter); }

  .client-portal .nav-section,
  .admin-portal .nav-section { margin-inline: var(--page-gutter); }

  .client-portal .sidebar-bottom,
  .admin-portal .sidebar-bottom { margin-inline: var(--page-gutter); }

  .client-portal .main-shell,
  .admin-portal .main-shell { grid-column: 1; }

  .client-portal .topbar,
  .admin-portal .topbar {
    padding-right: max(var(--content-gutter), env(safe-area-inset-right));
    padding-left: max(var(--content-gutter), env(safe-area-inset-left));
    gap: 8px;
  }

  .client-portal .content,
  .admin-portal .content {
    padding: 24px max(var(--content-gutter), env(safe-area-inset-right)) 48px max(var(--content-gutter), env(safe-area-inset-left));
  }

  #client-content,
  #admin-content,
  #project-tab-content { gap: var(--layout-gap); }

  #policy .document-sheet { margin-top: 24px; }
}

@media (max-width: 560px) {
  .client-portal .content,
  .admin-portal .content {
    padding-top: 20px;
    padding-bottom: 40px;
  }
}

/* Final grid alignment for project controls and responsive brand rails. */
@media (min-width: 821px) {
  .role-shell,
  .brand-entry .role-shell,
  .auth-shell {
    padding-right: max(var(--page-gutter), env(safe-area-inset-right));
    padding-left: max(var(--page-gutter), env(safe-area-inset-left));
  }

  .admin-portal .toolbar {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 8px 16px;
  }

  .admin-portal .toolbar > .search-field {
    grid-column: span 4;
    max-width: none;
  }

  .admin-portal .toolbar > .filter-row {
    grid-column: span 8;
    display: grid;
    grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) auto auto auto;
    align-items: stretch;
    gap: 8px;
    min-width: 0;
  }

  .admin-portal .toolbar > .filter-row > * {
    width: 100%;
    min-width: 0;
  }
}

@media (min-width: 821px) and (max-width: 1360px) {
  .admin-portal .toolbar > .search-field,
  .admin-portal .toolbar > .filter-row { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  .client-portal .sidebar .brand-lockup,
  .admin-portal .sidebar .brand-lockup { align-items: flex-start; }

  .admin-portal .section-title {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 12px;
  }

  .admin-portal .section-title > .page-actions {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    width: 100%;
    min-width: 0;
  }

  .admin-portal .section-title > .page-actions > .view-toggle {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
  }

  .admin-portal .section-title > .page-actions > .view-toggle button {
    min-width: 0;
    padding-inline: 8px;
  }

  .admin-portal .toolbar > .filter-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
  }

  .admin-portal .toolbar > .filter-row > * {
    width: 100%;
    min-width: 0;
  }

  .admin-portal .toolbar > .filter-row [data-action="save-filter"] { grid-column: 1 / -1; }
}

@media (max-width: 420px) {
  .admin-portal .section-title > .page-actions {
    grid-template-columns: 1fr;
  }

  .admin-portal .toolbar > .filter-row { grid-template-columns: 1fr; }
  .admin-portal .toolbar > .filter-row [data-action="save-filter"] { grid-column: auto; }
}

/* Critical responsive composition: timeline, actions, projects and payments. */
.client-portal .stage-content,
.client-portal .stage-actions { min-width: 0; }

.client-portal .stage-name { flex-wrap: wrap; align-items: flex-start; }
.client-portal .stage-name > span:first-child {
  flex: 1 1 180px;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
}
.client-portal .stage-meta { flex-wrap: wrap; row-gap: 4px; }
.client-portal .stage-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.client-portal .stage-row > div {
  overflow-wrap: normal;
  word-break: normal;
}

@media (max-width: 820px) {
  .admin-portal .project-primary-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-portal .project-primary-actions .publish-project-button { grid-column: 1 / -1; }

  .admin-portal .project-tabs {
    scroll-snap-type: x proximity;
    overscroll-behavior-inline: contain;
  }
  .admin-portal .project-tabs button { flex: 0 0 auto; scroll-snap-align: start; }
}

@media (max-width: 560px) {
  .client-portal .urgent-stack article {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    padding-block: 16px;
  }
  .client-portal .urgent-stack article > .button {
    width: 100%;
    justify-self: stretch;
  }

  .client-portal .timeline { padding-left: 18px; }
  .client-portal .stage-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 16px;
  }
  .client-portal .stage-row::before { left: -17px; }
  .client-portal .stage-name { gap: 8px 10px; }
  .client-portal .stage-name > span:first-child {
    flex-basis: 150px;
    font-size: 15px;
    line-height: 1.4;
  }
  .client-portal .stage-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-content: start;
    gap: 3px;
    font-size: 12px;
    line-height: 1.45;
  }
  .client-portal .stage-content .progress-track { margin-top: 10px; }
  .client-portal .stage-actions {
    justify-content: flex-start;
    padding-top: 12px;
    border-top: 1px solid var(--border-soft);
  }
  .client-portal .stage-actions .stage-percent { margin-right: auto; }
  .client-portal .stage-actions .button { flex: 1 1 108px; }

  .admin-portal .admin-project-header { gap: 14px; }
  .admin-portal .admin-project-title {
    width: 100%;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
  }
  .admin-portal .admin-project-title > div { min-width: 0; }
  .admin-portal .admin-project-title p {
    margin-top: 7px;
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: break-word;
  }
  .admin-portal .project-primary-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .admin-portal .project-primary-actions .button {
    min-width: 0;
    padding-inline: 10px;
  }
  .admin-portal .project-primary-actions .publish-project-button { grid-column: 1 / -1; }

  .admin-portal .payment-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "payment-title payment-order"
      "payment-amount payment-amount"
      "payment-status payment-status";
    align-items: start;
    gap: 10px 12px;
    padding: 14px;
  }
  .admin-portal .payment-order { grid-area: payment-order; }
  .admin-portal .payment-title { grid-area: payment-title; min-width: 0; }
  .admin-portal .payment-title strong {
    overflow-wrap: break-word;
    word-break: normal;
  }
  .admin-portal .payment-amount {
    grid-area: payment-amount;
    padding-top: 4px;
    color: var(--text);
    font-size: 18px;
    text-align: left;
  }
  .admin-portal .payment-status {
    grid-area: payment-status;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border-soft);
  }

  .admin-portal .project-card-grid .project-tile {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    min-height: 176px;
    overflow: hidden;
  }
  .admin-portal .project-card-grid .project-tile-image {
    width: 100%;
    min-height: 100%;
    aspect-ratio: auto;
  }
  .admin-portal .project-card-grid .project-tile .card-body { padding: 14px; }
  .admin-portal .project-card-grid .project-tile h3 {
    margin-top: 10px;
    font-size: 16px;
  }
  .admin-portal .project-card-grid .project-tile p {
    min-height: 0;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    font-size: 12px;
  }
  .admin-portal .project-card-grid .project-tile .button {
    min-height: 40px;
    margin-top: 12px;
  }
}

@media (max-width: 380px) {
  .admin-portal .project-card-grid .project-tile { grid-template-columns: 96px minmax(0, 1fr); }
}

/* Readability and contrast: muted decoration is not used for essential text. */
:root[data-theme="dark"] {
  --muted-brand: #6b7480;
  --muted: #8f98a8;
  --text-readable: #a7b0bf;
}

:root[data-theme="dark"] .client-portal,
:root[data-theme="dark"] .admin-portal,
:root[data-theme="dark"] .auth-page {
  --muted-brand: #6b7480;
  --muted: #8f98a8;
  --text-readable: #a7b0bf;
}

:root[data-theme="light"] {
  --muted-brand: #7f8996;
  --muted: #667180;
  --text-readable: #465261;
}

.client-portal,
.admin-portal { font-size: 14px; }

.client-portal :where(.metric-card .label, .progress-details span, .progress-footer, .camera-bottom),
.admin-portal :where(.metric-card .label, .progress-details span, .progress-footer) { font-size: 12px; line-height: 1.45; }

.client-portal :where(.document-row small, .payment-title small, .finance-summary small, .stage-summary small, .event-card small),
.admin-portal :where(.document-row small, .payment-title small, .finance-summary small, .stage-summary small, .event-card small) {
  color: var(--text-readable);
  font-size: 12px;
  line-height: 1.45;
}

.client-portal .stage-meta,
.admin-portal .stage-meta,
.client-portal .report-meta,
.admin-portal .report-meta { color: var(--muted); font-size: 12px; line-height: 1.45; }

.client-portal .delay-note,
.admin-portal .delay-note { font-size: 12px; line-height: 1.5; }

.client-portal .badge,
.admin-portal .badge {
  min-height: 26px;
  padding: 4px 8px;
  font-size: 11px;
  line-height: 1.2;
}

.admin-portal .nav-section,
.client-portal .nav-section { font-size: 11px; }
.admin-portal .sidebar-user small,
.client-portal .sidebar-user small { font-size: 12px; }

.admin-portal .project-table th {
  color: var(--text-readable) !important;
  font-size: 11px;
  line-height: 1.35;
}
.admin-portal .project-table td { color: var(--text); font-size: 13px; }
.admin-portal .project-table :where(.table-subline, td small) {
  color: var(--text-readable);
  font-size: 12px;
  line-height: 1.45;
}

.admin-portal .form-group > label:not(.toggle-row),
.client-portal .form-group > label:not(.toggle-row) {
  color: var(--text-readable);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none;
}

.admin-portal .toggle-row,
.client-portal .toggle-row,
.auth-page .toggle-row {
  color: var(--text-readable);
  font-size: 12px;
  font-weight: var(--weight-medium);
  line-height: 1.45;
}

.admin-portal .form-help,
.client-portal .form-help,
.auth-page .form-help { color: var(--muted); font-size: 12px; line-height: 1.5; }

.admin-portal :where(.tree-phase-title, .wizard-step, .notification-setting-head),
.client-portal .notification-setting-head { font-size: 11px; line-height: 1.4; }
.admin-portal .tree-stage span:last-child { color: var(--muted); font-size: 11px; }
.admin-portal .gantt-scale { font-size: 11px; line-height: 1.4; }

.client-portal :where(.money, .payment-amount, .finance-summary strong),
.admin-portal :where(.money, .payment-amount, .finance-summary strong, .metric-card strong) {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.client-portal .payment-amount,
.admin-portal .payment-amount { font-size: 15px; font-weight: var(--weight-semibold); }

.client-portal :where(.version-history span, .attachment-list span, .tag-row span),
.admin-portal :where(.version-history span, .attachment-list span, .tag-row span, .role-preview) {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.client-portal .weather-card .weather-day > small:first-child,
.client-portal .weather-card .weather-day > span:last-child {
  color: var(--text-readable);
  font-size: 12px;
}
.client-portal .weather-source { color: var(--muted); font-size: 12px; line-height: 1.5; }

.auth-page .auth-note,
.role-page .role-note { color: var(--muted); font-size: 12px; line-height: 1.5; }

@media (max-width: 560px) {
  .client-portal,
  .admin-portal { font-size: 15px; }
  .admin-portal .project-table td { font-size: 14px; }
  .client-portal .payment-amount,
  .admin-portal .payment-amount { font-size: 18px; }
}

/* Navigation, drawer and progressive filter disclosure. */
.client-portal .topbar,
.admin-portal .topbar {
  grid-template-columns: minmax(0, 1fr) auto;
}
.client-portal .topbar-left,
.admin-portal .topbar-left { min-width: 0; }
.client-portal .breadcrumb,
.admin-portal .breadcrumb {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-backdrop {
  position: fixed;
  z-index: 29;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(3, 6, 10, .66);
  backdrop-filter: blur(2px);
  cursor: pointer;
}
body.menu-open { overflow: hidden; }
.client-portal .sidebar,
.admin-portal .sidebar { overscroll-behavior: contain; }

.filter-disclosure { min-width: 0; }
.filter-disclosure > summary {
  min-height: 44px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  list-style: none;
}
.filter-disclosure > summary::-webkit-details-marker { display: none; }
.filter-disclosure > summary::after { content: "+"; color: var(--muted); font-size: 20px; font-weight: 400; }
.filter-disclosure[open] > summary::after { content: "−"; }
.filter-count {
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  margin-left: auto;
  border-radius: 999px;
  color: #07182b;
  background: var(--brand);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 821px) {
  .client-portal .toolbar > .filter-disclosure,
  .admin-portal .toolbar > .filter-disclosure { min-width: 0; }
  .admin-portal .toolbar > .filter-disclosure { grid-column: span 8; }
  .client-portal .filter-disclosure:not([open]) > .filter-row,
  .admin-portal .filter-disclosure:not([open]) > .filter-row { display: grid; }
  .client-portal .toolbar > .filter-disclosure .filter-row,
  .admin-portal .toolbar > .filter-disclosure .filter-row {
    display: grid;
    align-items: stretch;
    gap: 8px;
  }
  .client-portal .toolbar > .filter-disclosure .filter-row { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .admin-portal .toolbar > .filter-disclosure .filter-row { grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) auto auto auto; }
  .client-portal .toolbar > .filter-disclosure .filter-row > *,
  .admin-portal .toolbar > .filter-disclosure .filter-row > * { width: 100%; min-width: 0; }
}

@media (min-width: 821px) and (max-width: 1360px) {
  .admin-portal .toolbar > .filter-disclosure { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  .client-portal .topbar,
  .admin-portal .topbar { grid-template-columns: minmax(0, 1fr) auto; }
  .client-portal .breadcrumb,
  .admin-portal .breadcrumb {
    display: block;
    color: var(--text);
    font-size: 14px;
    font-weight: var(--weight-semibold);
  }
  .client-portal .breadcrumb-root,
  .admin-portal .breadcrumb-root { display: none; }
  .client-portal .topbar-actions,
  .admin-portal .topbar-actions { display: flex; }
  .client-portal .topbar-actions .notification-button,
  .admin-portal .topbar-actions .notification-button { display: grid; }
  .admin-portal .client-area-link { min-height: 44px; padding-inline: 12px; }
  .admin-portal .topbar .button-label { display: inline; }

  .filter-disclosure > summary { display: flex; }
  .client-portal .toolbar,
  .admin-portal .toolbar { gap: 10px; }
  .client-portal .toolbar > .filter-disclosure,
  .admin-portal .toolbar > .filter-disclosure { width: 100%; }
  .client-portal .filter-disclosure > .filter-row,
  .admin-portal .filter-disclosure > .filter-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding-top: 8px;
  }
  .client-portal .filter-disclosure > .filter-row > *,
  .admin-portal .filter-disclosure > .filter-row > * { width: 100%; min-width: 0; }
  .admin-portal .filter-disclosure > .filter-row [data-action="save-filter"] { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .client-portal .topbar,
  .admin-portal .topbar { padding-inline: 12px; }
  .client-portal .topbar-left,
  .admin-portal .topbar-left { gap: 10px; }
  .client-portal .topbar-actions .project-switcher { width: min(132px, 34vw); }
  .admin-portal .client-area-link { max-width: 112px; font-size: 12px; }
  .client-portal .filter-disclosure > .filter-row,
  .admin-portal .filter-disclosure > .filter-row { grid-template-columns: minmax(0, 1fr); }
  .admin-portal .filter-disclosure > .filter-row [data-action="save-filter"] { grid-column: auto; }
  .notifications-panel { right: 12px; top: 58px; width: calc(100% - 24px); }
}

/* Public and authentication surfaces use the same Nordville product language. */
.brand-entry {
  background:
    radial-gradient(circle at 84% 8%, rgba(74, 158, 255, .13), transparent 30%),
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 72px 72px, 72px 72px, auto;
}
.brand-entry .role-shell {
  width: 100%;
  max-width: 1504px;
  min-height: 100vh;
  margin-inline: auto;
  padding: 32px;
}
.brand-entry .role-brand {
  min-height: 64px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.brand-entry .role-intro {
  max-width: 930px;
  padding: clamp(72px, 10vh, 112px) 0 54px;
}
.brand-entry .role-intro::after { display: none; }
.brand-entry .role-intro h1 {
  max-width: 900px;
  margin: 0;
  font-size: clamp(52px, 6.1vw, 82px);
  line-height: .98;
  letter-spacing: -.05em;
}
.brand-entry .role-intro h1 em { color: var(--brand); font-style: normal; }
.brand-entry .role-intro p { max-width: 670px; color: var(--text-2); font-size: 18px; }
.brand-entry .role-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: transparent;
}
.brand-entry .role-card {
  isolation: isolate;
  min-height: 330px;
  overflow: hidden;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: #f4f7fb;
  background: var(--surface);
}
.brand-entry .role-card + .role-card { border-left: 1px solid var(--border); }
.brand-entry .role-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(90deg, rgba(7, 10, 14, .97), rgba(7, 10, 14, .74) 58%, rgba(7, 10, 14, .34));
}
.brand-entry .role-card-image {
  position: absolute;
  z-index: -2;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .32s ease;
}
.brand-entry .role-card:hover,
.brand-entry .role-card:focus-visible { border-color: color-mix(in srgb, var(--brand) 70%, var(--border)); background: var(--surface); }
.brand-entry .role-card:hover .role-card-image,
.brand-entry .role-card:focus-visible .role-card-image { transform: scale(1.025); }
.brand-entry .role-number { top: 25px; color: rgba(255, 255, 255, .46); font-size: 12px; }
.brand-entry .role-kicker { color: #aeb8c5; font-size: 11px; }
.brand-entry .role-card h2 { max-width: 430px; color: #fff; font-size: clamp(30px, 3vw, 40px); }
.brand-entry .role-card p { max-width: 460px; color: #c5ced9; }
.brand-entry .role-link { color: #7db9ff; }
.brand-entry .role-link span { border-radius: 50%; transform: none; }
.brand-entry .role-card:hover .role-link span { transform: translateX(3px); }
.brand-entry .role-note { color: var(--muted); }

.auth-page {
  min-height: 100vh;
  background-image:
    linear-gradient(90deg, rgba(9, 12, 16, .54), rgba(9, 12, 16, .9) 64%, rgba(9, 12, 16, .97)),
    url("images/house-main.jpg");
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
}
.auth-page.admin-auth-page {
  background-image:
    linear-gradient(90deg, rgba(9, 12, 16, .58), rgba(9, 12, 16, .9) 64%, rgba(9, 12, 16, .97)),
    url("images/construction-frame.jpg");
}
.auth-page .auth-shell {
  width: 100%;
  max-width: 1504px;
  margin-inline: auto;
  padding: 32px;
}
.auth-page .auth-card {
  width: min(480px, 100%);
  margin: auto clamp(0px, 5vw, 72px) auto auto;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(18px);
}
.auth-page .auth-card h1 { margin: 0 0 12px; font-size: clamp(34px, 4vw, 42px); line-height: 1.08; }
.auth-page .auth-card > p { color: var(--text-2); font-size: 15px; }
.auth-page .form-group > label:not(.toggle-row) {
  color: var(--text-readable);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.auth-page :where(input, select, textarea) { min-height: 48px; }
.auth-page .button {
  border-radius: 8px;
  font: 600 14px/1.25 var(--font-client);
  letter-spacing: 0;
  text-transform: none;
}
.admin-auth-page .button { font-family: var(--font-admin); }
.auth-page .auth-method { min-height: 44px; font-size: 13px; font-weight: 600; }
.auth-page .auth-note { margin-top: 16px; color: var(--muted); }

#policy.role-shell {
  width: 100%;
  max-width: 1504px;
  margin-inline: auto;
  padding: 32px;
}
#policy .document-sheet {
  width: min(78ch, 100%);
  min-height: 0;
  margin: 40px auto 0;
  padding: clamp(28px, 5vw, 56px);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
#policy .document-sheet h1 { margin: 10px 0 18px; }
#policy .document-sheet h2 { margin: 32px 0 8px; }
#policy .document-sheet p { margin: 0; color: var(--text-2); font-size: 15px; line-height: 1.75; }
#policy .document-sheet .policy-lead { color: var(--text); font-size: 17px; line-height: 1.7; }
.policy-notice {
  display: grid;
  gap: 6px;
  margin-top: 34px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--warning) 38%, var(--border));
  border-radius: 10px;
  background: var(--warning-soft);
}
.policy-notice p { color: var(--text-2); }

@media (max-width: 820px) {
  .brand-entry .role-shell,
  .auth-page .auth-shell,
  #policy.role-shell { padding: 24px 16px 48px; }
  .brand-entry .role-intro { padding: 64px 0 40px; }
  .brand-entry .role-intro h1 { font-size: clamp(44px, 12vw, 62px); }
  .brand-entry .role-grid { grid-template-columns: minmax(0, 1fr); }
  .brand-entry .role-card { min-height: 300px; padding: 24px; }
  .auth-page { background-position: 38% center; }
  .auth-page .auth-card { margin: auto; }
  #policy .document-sheet { margin-top: 28px; }
}

@media (max-width: 560px) {
  .brand-entry .role-brand { padding-bottom: 16px; }
  .brand-entry .role-intro { padding: 52px 0 34px; }
  .brand-entry .role-intro h1 { font-size: 42px; line-height: 1.02; }
  .brand-entry .role-intro p { font-size: 16px; }
  .brand-entry .role-card { min-height: 282px; }
  .auth-page .auth-shell { padding-top: 24px; }
  .auth-page .auth-card { padding: 24px 20px; }
  #policy .document-sheet { padding: 24px 20px; }
  #policy .document-sheet h1 { font-size: 30px; }
  #policy .document-sheet h2 { font-size: 20px; }
}

/* Interaction refinement: notifications, media, documents and profile */
.weather-source {
  display: block;
  margin-top: 18px;
  padding: 15px 2px 2px;
  border-top: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.photo-art { transition: transform .28s ease; }
.construction-gallery .photo-art,
.visualization-gallery .photo-art { transform: none; }
.construction-gallery .photo-tile:hover .photo-art,
.visualization-gallery .photo-tile:hover .photo-art { transform: scale(1.035); }

.notification-button.has-attention { color: var(--text); }
.notification-dot:not([hidden]) { display: block; }
.notifications-panel {
  width: min(440px, calc(100% - 28px));
  max-height: min(680px, calc(100dvh - 84px));
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(16, 24, 40, .2);
}
.notifications-head {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.notifications-head > div { display: grid; gap: 2px; }
.notifications-head .page-kicker { margin: 0; }
.notifications-head h2 { margin: 0; font-size: 20px; line-height: 1.2; }
.notifications-list {
  max-height: min(510px, calc(100dvh - 230px));
  display: grid;
  gap: 8px;
  padding: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
}
.notification-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(18, 28, 45, .04);
  transition: border-color .18s ease, background-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.notification-item + .notification-item { border-top: 1px solid var(--border); }
.notification-item.unread { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, var(--border)); }
.notification-item:hover {
  border-color: color-mix(in srgb, var(--text) 18%, var(--border));
  box-shadow: 0 10px 28px rgba(18, 28, 45, .07);
  transform: translateY(-1px);
}
.notification-icon,
.notification-empty-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: var(--brand);
  background: var(--brand-soft);
}
.notification-item.purple .notification-icon { color: var(--purple); background: var(--purple-soft); }
.notification-item.warning .notification-icon { color: var(--warning); background: var(--warning-soft); }
.notification-item.danger .notification-icon { color: var(--danger); background: var(--danger-soft); }
.notification-copy { min-width: 0; display: grid; gap: 3px; }
.notification-copy small { color: var(--muted); font-size: 11px; line-height: 1.3; text-transform: uppercase; letter-spacing: .06em; }
.notification-copy strong { font-size: 13px; line-height: 1.4; overflow-wrap: break-word; }
.notification-copy p { margin: 0; color: var(--text-2); font-size: 12px; line-height: 1.45; }
.notification-item > .button { min-width: 104px; }
.notifications-empty {
  min-height: 280px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 9px;
  padding: 34px;
  text-align: center;
  background: var(--bg);
}
.notifications-empty .notification-empty-icon { width: 48px; height: 48px; margin-bottom: 4px; color: var(--success); background: var(--success-soft); }
.notifications-empty strong { font-size: 15px; }
.notifications-empty p { max-width: 300px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.notifications-foot { display: flex; justify-content: flex-end; padding: 13px 18px; border-top: 1px solid var(--border); background: var(--surface); }

.document-row-actions,
.document-actions {
  min-width: max-content;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.document-row-actions .button,
.document-actions .button { min-width: 92px; }
.document-row.requires-attention {
  border-color: color-mix(in srgb, var(--purple) 36%, var(--border));
  box-shadow: inset 3px 0 0 var(--purple);
}
.attention-label {
  display: inline-flex;
  width: max-content;
  margin-top: 7px;
  color: var(--purple);
  font-size: 11px;
  font-weight: 700;
}
.contact-note {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-2);
  background: var(--surface);
}
.contact-note .icon { flex: 0 0 auto; color: var(--brand); }
.contact-note p { margin: 0; font-size: 13px; line-height: 1.5; }
.empty-inline { display: grid; gap: 5px; padding: 28px 16px; text-align: center; }
.empty-inline p { margin: 0; color: var(--muted); font-size: 12px; }

.client-portal .payment-row { grid-template-columns: minmax(220px, 1fr) minmax(145px, auto) minmax(220px, auto); }
.payment-amount { min-width: 0; white-space: nowrap; }
.payment-status { min-width: 0; flex-wrap: wrap; }
.payment-badges { min-width: 0; display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }

details > summary { user-select: none; }
.document-group > summary,
.version-history > summary,
.gantt-legend > summary,
.phase-heading { position: relative; }
.document-group > summary { justify-content: flex-start; gap: 12px; }
.document-group > summary strong { min-width: 0; overflow-wrap: anywhere; }
.document-group > summary .document-count {
  min-width: 32px;
  height: 28px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  margin-left: auto;
  padding-inline: 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.gantt-phase-row strong { display: inline-flex; align-items: center; gap: 8px; }
.gantt-phase-symbol { width: 14px; flex: 0 0 14px; color: var(--muted); text-align: center; }
.gantt-phase-content { width: 100%; transform-origin: top center; }
.version-history > summary,
.gantt-legend > summary { display: inline-flex; align-items: center; }
.phase-heading { justify-content: flex-start; gap: 10px; }
.phase-heading h3 { margin-right: auto; }
.document-group > summary::after,
.version-history > summary::after,
.gantt-legend > summary::after,
.phase-heading::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: 10px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform .2s ease;
}
.document-group[open] > summary::after,
.version-history[open] > summary::after,
.gantt-legend[open] > summary::after,
.phase-block[open] > .phase-heading::after { transform: rotate(225deg); }
.document-group[open] > .disclosure-content,
.version-history[open] > .disclosure-content,
.phase-block[open] > .stage-row,
.gantt-legend[open] > .legend-items,
.filter-disclosure[open] > .filter-row { animation: disclosure-enter .22s ease both; }
@keyframes disclosure-enter { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

@supports selector(details::details-content) {
  :root { interpolate-size: allow-keywords; }
  details::details-content {
    block-size: 0;
    overflow: clip;
    opacity: 0;
    transform: translateY(-5px);
    transform-origin: top center;
    transition: block-size .26s cubic-bezier(.22, 1, .36, 1), opacity .18s ease, transform .24s cubic-bezier(.22, 1, .36, 1), content-visibility .26s;
    transition-behavior: allow-discrete;
  }
  details[open]::details-content {
    block-size: auto;
    opacity: 1;
    transform: translateY(0);
  }
  .document-group[open] > .disclosure-content,
  .version-history[open] > .disclosure-content,
  .phase-block[open] > .stage-row,
  .gantt-legend[open] > .legend-items,
  .filter-disclosure[open] > .filter-row { animation: none; }
}

.modal {
  overflow: hidden;
  border-radius: 20px;
  box-shadow: 0 28px 90px rgba(3, 8, 18, .34);
}
.modal[open] { animation: modal-enter .22s ease both; }
.modal[open]::backdrop { animation: backdrop-enter .2s ease both; }
.notifications-panel:not([hidden]) { animation: popover-enter .18s cubic-bezier(.22, 1, .36, 1) both; transform-origin: top right; }
@keyframes modal-enter { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes backdrop-enter { from { opacity: 0; } to { opacity: 1; } }
@keyframes popover-enter { from { opacity: 0; transform: translateY(-6px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
.viewer-modal { width: min(780px, calc(100% - 32px)); max-height: calc(100dvh - 32px); }
.viewer-modal[data-layout="conversation"] { width: min(880px, calc(100% - 32px)); }
.viewer-modal[data-layout="document"] { width: min(960px, calc(100% - 32px)); }
.viewer-modal[data-layout="media"] { width: min(1080px, calc(100% - 32px)); }
.viewer-shell { max-height: calc(100dvh - 32px); background: var(--surface); }
.modal-head {
  position: sticky;
  z-index: 3;
  top: 0;
  min-height: 84px;
  padding-block: 18px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(16px);
}
.modal-head h2 { max-width: 760px; font-size: clamp(20px, 2.5vw, 26px); line-height: 1.22; text-wrap: balance; }
.modal-head > .icon-button { flex: 0 0 44px; }
.viewer-body { max-height: calc(100dvh - 116px); padding: 20px; background: var(--bg); }
.viewer-form,
.acknowledgement-viewer,
.request-viewer { width: 100%; max-width: none; margin: 0; }
.viewer-form {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.viewer-form .viewer-actions { padding-top: 4px; }
.viewer-form .viewer-actions .button.primary { min-width: 180px; }
.modal-foot { min-height: 72px; background: var(--surface); }
.acceptance-modal { width: min(720px, calc(100% - 28px)); }
.acceptance-modal .modal-body { display: grid; gap: 18px; padding-block: 24px; background: var(--bg); }
.acceptance-actions { gap: 12px; margin: 0; }
.choice-card { min-height: 108px; padding: 18px; border-radius: 12px; transition: border-color .18s ease, background-color .18s ease, transform .18s ease; }
.choice-card:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--border)); transform: translateY(-1px); }
.choice-card.active { box-shadow: inset 0 0 0 1px var(--brand); }
.privacy-modal .modal-body { background: var(--bg); }

.document-viewer { display: grid; gap: 16px; }
.document-preview-canvas {
  min-height: 420px;
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vw, 30px);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg) 78%, var(--border));
}
.document-preview-canvas .uploaded-document-frame { min-height: min(68dvh, 720px); }
.document-preview-canvas .document-sheet { width: min(820px, 100%); min-height: 0; margin: 0; padding: clamp(28px, 5vw, 54px); box-shadow: 0 16px 46px rgba(24, 34, 48, .12); }
.document-sheet > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 42px; }
.document-sheet > .page-kicker { color: #667180; }
.document-sheet h3 { margin: 10px 0 12px; font-size: clamp(26px, 4vw, 42px); line-height: 1.12; text-wrap: balance; }
.viewer-commandbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.viewer-commandbar > div { min-width: 0; display: grid; gap: 3px; }
.viewer-commandbar strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-commandbar small { color: var(--muted); }
.viewer-commandbar .button { flex: 0 0 auto; min-width: 150px; }
.document-unavailable { display: grid; justify-items: center; gap: 8px; text-align: center; color: var(--text-2); }
.document-unavailable .icon { color: var(--brand); }
.document-unavailable p { margin: 0; color: var(--muted); }

.viewer-gallery { overflow: visible; }
.viewer-gallery-stage {
  position: relative;
  overflow: hidden;
  min-height: 360px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #0c1118;
}
.viewer-gallery-main {
  width: 100%;
  height: min(58dvh, 590px);
  object-fit: contain;
  cursor: default;
  transform: none;
  transition: transform .25s ease;
}
.viewer-gallery-stage:hover .viewer-gallery-main { transform: scale(1.012); }
.viewer-gallery-main.is-zoomed { transform: none; cursor: default; }
.gallery-arrow {
  position: absolute;
  z-index: 2;
  top: 50%;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  color: white;
  background: rgba(8,12,18,.66);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transform: translateY(-50%);
}
.gallery-arrow:hover { background: rgba(8,12,18,.9); }
.gallery-arrow.previous { left: 14px; }
.gallery-arrow.next { right: 14px; }
.gallery-arrow.previous .icon { transform: rotate(180deg); }
.gallery-counter { position: absolute; z-index: 2; right: 14px; bottom: 14px; padding: 6px 9px; border-radius: 999px; color: white; background: rgba(8,12,18,.72); font-size: 12px; font-variant-numeric: tabular-nums; }
.viewer-gallery-thumbs {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  max-height: 196px;
  padding: 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.viewer-thumb { height: 84px; border-radius: 9px; opacity: .68; transition: opacity .18s ease, border-color .18s ease; }
.viewer-thumb:hover,
.viewer-thumb.active { opacity: 1; }
.gallery-description { grid-template-columns: minmax(0, 1fr) auto; align-items: end; justify-items: stretch; gap: 18px; }
.gallery-description > div:first-child { display: grid; justify-items: start; gap: 8px; }
.gallery-description .viewer-actions { align-self: end; }

.request-viewer { display: grid; gap: 16px; }
.request-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.request-summary > div { display: flex; align-items: center; gap: 10px; }
.request-summary small { color: var(--muted); }
.request-thread { gap: 12px; padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.request-thread article { width: min(86%, 620px); display: grid; gap: 8px; padding: 14px 16px; border: 0; border-radius: 12px; }
.request-thread article.from-client { justify-self: end; background: var(--brand-soft); }
.request-thread article.from-team { justify-self: start; background: var(--surface-2); }
.request-thread article > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.request-thread article :where(p, small) { margin: 0; }
.request-thread article p { color: var(--text); line-height: 1.55; }
.request-attachments { display: grid; gap: 9px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.request-composer { display: grid; gap: 12px; padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.request-composer textarea { min-height: 118px; }

.acknowledgement-viewer { display: grid; gap: 18px; padding: 24px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.acknowledgement-summary { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 14px; align-items: center; }
.acknowledgement-summary h3 { margin: 4px 0 5px; font-size: 20px; line-height: 1.3; }
.acknowledgement-summary p,
.acknowledgement-copy { margin: 0; color: var(--text-2); line-height: 1.55; }
.security-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; color: var(--brand); background: var(--brand-soft); }

.profile-overview-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 14px; align-items: stretch; }
.profile-card { display: grid; gap: 22px; }
.profile-identity { display: flex; align-items: center; gap: 14px; }
.profile-identity > div { min-width: 0; display: grid; gap: 3px; }
.profile-identity h2 { margin: 0; font-size: 22px; }
.profile-identity small { color: var(--muted); }
.avatar.large { width: 58px; height: 58px; flex: 0 0 58px; font-size: 16px; }
.profile-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.profile-fields .form-group:first-child { grid-column: 1 / -1; }
.verified-field { position: relative; }
.verified-field input { padding-right: 112px; }
.verified-field > span { position: absolute; right: 12px; bottom: 13px; color: var(--success); font-size: 11px; font-weight: 700; pointer-events: none; }
.profile-card-actions { display: flex; justify-content: flex-end; padding-top: 4px; }
.security-card { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.security-card > div { display: grid; gap: 7px; }
.security-card h2 { margin: 0; font-size: 20px; }
.security-card p { margin: 0; color: var(--text-2); line-height: 1.55; }
.security-card > .button { width: 100%; margin-top: auto; }
.preference-list { overflow: hidden; }
.preference-row {
  min-height: 74px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  cursor: pointer;
}
.preference-row + .preference-row { border-top: 1px solid var(--border-soft); }
.preference-row > span { min-width: 0; display: grid; gap: 3px; }
.preference-row small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.switch-control {
  position: relative;
  width: 46px;
  height: 26px;
  margin: 0;
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-3);
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease;
}
.switch-control::before { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .18s ease, background-color .18s ease; }
.switch-control:checked { border-color: var(--brand); background: var(--brand); }
.switch-control:checked::before { background: white; transform: translateX(20px); }
.switch-control:disabled { cursor: not-allowed; opacity: .62; }
.switch-control:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.profile-data-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

@media (max-width: 1080px) {
  .client-portal .payment-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "payment-title payment-amount" "payment-status payment-status";
  }
  .client-portal .payment-title { grid-area: payment-title; }
  .client-portal .payment-amount { grid-area: payment-amount; }
  .client-portal .payment-status { grid-area: payment-status; justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--border-soft); }
  .profile-overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .notifications-panel { right: 8px; top: 58px; width: calc(100% - 16px); max-height: calc(100dvh - 66px); border-radius: 14px; }
  .notifications-list { max-height: calc(100dvh - 250px); }
  .notification-item { grid-template-columns: 38px minmax(0, 1fr); align-items: start; }
  .notification-item > .button { grid-column: 1 / -1; width: 100%; min-width: 0; }
  .notifications-empty { min-height: 260px; padding-inline: 24px; }

  .client-portal .document-row:has(.document-row-actions),
  .client-portal .document-row:has(.document-actions) { grid-template-columns: 42px minmax(0, 1fr); }
  .document-row-actions,
  .document-actions { grid-column: 1 / -1; width: 100%; min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .document-row-actions .badge { grid-column: 1 / -1; width: max-content; }
  .document-row-actions .button,
  .document-actions .button { width: 100%; min-width: 0; }

  .client-portal .payment-row { grid-template-columns: minmax(0, 1fr); grid-template-areas: "payment-title" "payment-amount" "payment-status"; }
  .client-portal .payment-amount { padding-top: 4px; text-align: left; }
  .client-portal .payment-status { align-items: flex-start; flex-direction: column; }
  .payment-badges { justify-content: flex-start; }

  .viewer-modal,
  .viewer-modal[data-layout] { width: 100%; max-width: none; max-height: calc(100dvh - 8px); margin: auto 0 0; border-radius: 20px 20px 0 0; }
  .viewer-shell { max-height: calc(100dvh - 8px); }
  .viewer-body { max-height: calc(100dvh - 84px); padding: 14px; }
  .modal-head { min-height: 76px; padding: 14px 16px; }
  .modal-head h2 { font-size: 20px; }
  .viewer-form,
  .acknowledgement-viewer { padding: 18px; }
  .viewer-form .viewer-actions .button.primary { width: 100%; min-width: 0; }
  .document-preview-canvas { min-height: 320px; padding: 10px; }
  .document-preview-canvas .document-sheet { padding: 26px 20px; }
  .document-sheet > header { margin-bottom: 30px; }
  .document-sheet dl div { grid-template-columns: 92px minmax(0, 1fr); }
  .viewer-commandbar { align-items: stretch; flex-direction: column; }
  .viewer-commandbar .button { width: 100%; min-width: 0; }
  .viewer-gallery-stage { min-height: 250px; }
  .viewer-gallery-main { height: 40dvh; }
  .gallery-arrow.previous { left: 8px; }
  .gallery-arrow.next { right: 8px; }
  .viewer-gallery-thumbs { grid-template-columns: repeat(4, minmax(0, 1fr)); max-height: 154px; }
  .viewer-thumb { height: 68px; }
  .gallery-description { grid-template-columns: 1fr; align-items: start; }
  .gallery-description .viewer-actions { width: 100%; display: grid; grid-template-columns: 1fr; }
  .request-summary { align-items: flex-start; flex-direction: column; }
  .request-thread { padding: 12px; }
  .request-thread article { width: 94%; }
  .request-thread article > div { align-items: flex-start; flex-direction: column; gap: 2px; }
  .acknowledgement-summary { grid-template-columns: 42px minmax(0, 1fr); }
  .security-icon { width: 42px; height: 42px; }
  .profile-fields { grid-template-columns: 1fr; }
  .profile-fields .form-group:first-child { grid-column: auto; }
  .profile-card-actions .button,
  .profile-data-actions .button { width: 100%; }
  .profile-data-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .preference-row { min-height: 78px; padding: 14px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  details::details-content { transition-duration: .01ms !important; }
  .gantt-phase-content { transform: none !important; }
}

/* Authentication — fixed viewport, flat professional form */
.auth-root,
.auth-root body { height: 100%; overflow: hidden; }

.auth-root .auth-page {
  width: 100%;
  height: 100svh;
  min-height: 0;
  overflow: hidden;
  background-attachment: scroll;
}

.auth-root .auth-shell {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template: minmax(0, 1fr) / repeat(2, minmax(0, 1fr));
  align-items: center;
  justify-items: center;
  padding: 0;
}

.auth-root .auth-shell::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 0 50%;
  border-left: 1px solid var(--border);
  background: var(--surface);
}

.auth-root .auth-shell > .brand-lockup {
  position: absolute;
  z-index: 2;
  top: max(clamp(24px, 4.5vh, 48px), env(safe-area-inset-top));
  left: max(clamp(24px, 4.5vw, 64px), env(safe-area-inset-left));
  width: auto;
  min-height: 0;
}

.auth-root .auth-card {
  z-index: 1;
  grid-column: 2;
  width: min(440px, calc(100% - 64px));
  max-height: calc(100svh - 64px);
  margin: 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.auth-root .auth-card::-webkit-scrollbar { display: none; }
.auth-root .auth-card .page-kicker { display: block; margin: 0 0 7px; }
.auth-root .auth-card h1 {
  max-width: 390px;
  margin: 0;
  font-size: clamp(30px, 3vw, 36px);
  line-height: 1.08;
  letter-spacing: -.035em;
}

.auth-root .auth-card form {
  gap: 12px;
  margin-top: 20px;
}

.auth-root .auth-card .form-group > label:not(.toggle-row) { margin-bottom: 6px; }
.auth-root .auth-card :where(input, select, textarea) {
  min-height: 48px;
  border-radius: 7px;
  background: var(--surface-2);
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}
.auth-root .auth-card :where(input, select, textarea):hover { border-color: color-mix(in srgb, var(--text) 22%, var(--border)); }
.auth-root .auth-card :where(input, select, textarea):focus-visible {
  border-color: var(--brand);
  background: var(--surface);
  outline: 2px solid color-mix(in srgb, var(--brand) 22%, transparent);
  outline-offset: 1px;
}

.auth-root .auth-methods {
  gap: 3px;
  padding: 3px;
  border-radius: 8px;
  background: var(--surface-2);
}
.auth-root .auth-method {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  transition: color .16s ease, border-color .16s ease, background-color .16s ease;
}
.auth-root .auth-method:hover { color: var(--text); background: color-mix(in srgb, var(--surface) 55%, transparent); }
.auth-root .auth-method.active {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
  box-shadow: none;
}
.auth-root .auth-method:disabled { cursor: not-allowed; opacity: .48; }

.password-control { position: relative; min-width: 0; }
.password-control > input { padding-right: 54px; }
.password-visibility {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: color .16s ease, background-color .16s ease;
}
.password-visibility:hover { color: var(--text); background: var(--surface-3); }
.password-visibility:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.password-visibility .password-eye-hidden { display: none; }
.password-visibility[aria-pressed="true"] .password-eye-visible { display: none; }
.password-visibility[aria-pressed="true"] .password-eye-hidden { display: block; }
.password-caps { margin-top: 6px; color: var(--warning); font-size: 12px; line-height: 1.35; }

.auth-error-region { min-height: 19px; }
.auth-error-region .form-error { line-height: 1.45; }
.auth-root .auth-submit {
  min-height: 48px;
  border-radius: 7px;
  box-shadow: none;
}
.auth-root .auth-submit { position: relative; color: #fff; }
.auth-root .auth-submit:hover { background: #168bd8; }
.auth-submit-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.42);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin .7s linear infinite;
}
.auth-submit.is-loading .auth-submit-spinner { display: block; }
.auth-submit.is-loading { cursor: wait; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

.auth-root .auth-divider { margin-block: 15px; }
.auth-root .auth-divider span { font-size: 12px; }

@media (max-width: 820px) {
  .auth-root .auth-shell {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    padding: 0 max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
    background: var(--surface);
  }
  .auth-root .auth-shell::before {
    content: "";
    position: absolute;
    z-index: 1;
    inset: 0 0 auto;
    height: 84px;
    background: #1b1d20;
  }
  .auth-root .auth-shell::after { inset: 0; border-left: 0; }
  .auth-root .auth-shell > .brand-lockup {
    top: max(18px, env(safe-area-inset-top));
    left: max(20px, env(safe-area-inset-left));
  }
  .auth-root .auth-card {
    grid-column: 1;
    width: min(440px, 100%);
    max-height: calc(100svh - 112px);
    margin-top: 68px;
  }
  .auth-root .auth-shell > .brand-lockup .brand-logo-client { width: 48px; height: 48px; }
  .auth-root .auth-shell > .brand-lockup .brand-logo-cms { width: 190px; height: 39px; }
}

@media (max-height: 700px) {
  .auth-root .auth-card { max-height: calc(100svh - 36px); }
  .auth-root .auth-card h1 { font-size: 28px; }
  .auth-root .auth-card form { gap: 9px; margin-top: 13px; }
  .auth-root .auth-card :where(input, select, textarea),
  .auth-root .auth-submit { min-height: 44px; }
  .auth-root .auth-method { min-height: 38px; }
  .auth-root .auth-divider { margin-block: 10px; }
  .password-visibility { top: 2px; }
}

@media (max-height: 600px) {
  .auth-root .auth-shell > .brand-lockup { top: max(8px, env(safe-area-inset-top)); }
  .auth-root .auth-shell > .brand-lockup .brand-logo-client { width: 32px; height: 32px; }
  .auth-root .auth-shell > .brand-lockup .brand-logo-cms { width: 140px; height: 29px; }
  .auth-root .auth-card { max-height: calc(100svh - 20px); }
}

@media (max-height: 560px) {
  .auth-root .auth-shell > .brand-lockup { display: none; }
  .auth-root .auth-card .page-kicker { margin-bottom: 4px; }
  .auth-root .auth-card h1 { font-size: 25px; }
  .auth-root .auth-card form { margin-top: 9px; }
  .auth-root .auth-error-region { min-height: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-submit-spinner { animation-duration: .01ms !important; }
}

/* Production CMS: management registers, settings and dialogs */
.admin-portal .page-heading > div:first-child { min-width: 0; }
.admin-portal .page-heading > div:first-child > p {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.6;
  text-wrap: pretty;
}
.management-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.management-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) repeat(2, minmax(170px, 220px));
  gap: 8px;
  margin: 22px 0 14px;
}
.management-toolbar .search-field { width: 100%; max-width: none; }
.management-toolbar select { width: 100%; }
.template-management-toolbar { grid-template-columns: minmax(280px, 1fr) minmax(170px, 220px); }
.management-filter-disclosure { min-width: 0; }
.management-filter-disclosure > .filter-row { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: stretch; }
.management-filter-disclosure > .filter-row > * { width: 100%; min-width: 0; }

@media (min-width: 821px) {
  .management-filter-disclosure > summary { display: none; }
  .management-filter-disclosure:not([open]) > .filter-row { display: grid; }
}

.admin-portal select:not([multiple]) {
  min-height: 44px;
  padding: 0 38px 0 13px;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  color: var(--text);
  background-color: var(--surface);
  background-image: linear-gradient(45deg, transparent 50%, #7b8594 50%), linear-gradient(135deg, #7b8594 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 13px) 50%;
  background-repeat: no-repeat;
  background-size: 4px 4px, 4px 4px;
  box-shadow: none;
  appearance: none;
  cursor: pointer;
  transition: border-color .18s ease, background-color .18s ease;
}
.admin-portal select:not([multiple]):hover { border-color: color-mix(in srgb, var(--text) 20%, var(--border-soft)); }
.admin-portal select:not([multiple]):focus { outline: none; }
.admin-portal select:not([multiple]):focus-visible {
  border-color: var(--brand);
  outline: 2px solid color-mix(in srgb, var(--brand) 24%, transparent);
  outline-offset: 1px;
}
.admin-portal .management-toolbar .search-field input {
  border-color: var(--border-soft);
  box-shadow: none;
}
.management-table-wrap {
  position: relative;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}
.management-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  color: var(--text);
}
.management-table th {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  letter-spacing: .07em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.management-table td {
  min-width: 0;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  font-size: 13px;
}
.management-table tbody tr:last-child td { border-bottom: 0; }
.management-table tbody tr:hover td { background: color-mix(in srgb, var(--brand) 4%, var(--surface)); }
.management-table td:last-child { width: 1%; text-align: right; white-space: nowrap; }
.management-primary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}
.management-primary > div { min-width: 0; }
.management-primary strong,
.management-primary small { display: block; }
.management-primary strong { font-size: 14px; line-height: 1.35; }
.management-primary small,
.management-description,
.management-table .table-subline { margin-top: 4px; color: var(--text-2); line-height: 1.45; }
.management-icon,
.settings-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--border));
  border-radius: 10px;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 7%, var(--surface));
}
.management-description { display: block; max-width: 320px; margin-top: 0; text-wrap: pretty; }
.tabular-value { font-variant-numeric: tabular-nums; }
.role-label { font-weight: var(--weight-medium); }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.row-actions .button { min-width: 112px; }
.row-actions .icon-button.danger { color: var(--danger); }
.management-empty {
  min-height: 132px;
  display: grid;
  place-content: center;
  gap: 6px;
  padding: 28px;
  color: var(--text-2);
  text-align: center;
}
.management-empty strong { color: var(--text); font-size: 15px; }
.management-empty[hidden] { display: none; }

.settings-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.settings-panel { padding: 0; overflow: hidden; }
.settings-panel:last-child { grid-column: 1 / -1; }
.settings-panel > header {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.settings-panel h2 { margin: 5px 0 0; font-size: 19px; line-height: 1.25; }
.settings-definition { margin: 0; padding: 8px 20px 14px; }
.settings-definition > div {
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(180px, 1.2fr);
  gap: 18px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border-soft);
}
.settings-definition > div:last-child { border-bottom: 0; }
.settings-definition dt { color: var(--text-2); font-size: 13px; }
.settings-definition dd { margin: 0; font-size: 13px; font-weight: var(--weight-medium); text-align: right; overflow-wrap: anywhere; }
.security-setting {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin: 0 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border-soft);
}
.security-setting:last-child { border-bottom: 0; }
.security-setting strong { display: block; font-size: 14px; }
.security-setting p { margin: 5px 0 0; color: var(--text-2); font-size: 12px; line-height: 1.5; }
.settings-table { min-width: 720px; }
.settings-table td:last-child .button { min-width: 112px; }
.admin-portal .section-title > div > p { margin: 6px 0 0; color: var(--text-2); font-size: 13px; }

.admin-portal #admin-dialog {
  width: min(780px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  border-radius: 16px;
  box-shadow: 0 24px 72px rgba(3, 8, 18, .26);
}
.admin-portal #admin-dialog[data-layout="conversation"] { width: min(880px, calc(100% - 32px)); }
.admin-portal #admin-dialog[data-layout="document"] { width: min(1020px, calc(100% - 32px)); }
.admin-portal #admin-dialog .viewer-shell { max-height: calc(100dvh - 32px); }
.admin-portal #admin-dialog .modal-head {
  min-height: 86px;
  padding: 18px 28px;
  background: var(--surface);
  backdrop-filter: none;
}
.admin-portal #admin-dialog .viewer-body {
  max-height: calc(100dvh - 118px);
  padding: 24px 28px 28px;
  background: var(--surface);
}
.admin-portal #admin-dialog .viewer-form {
  display: grid;
  gap: 22px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.admin-portal #admin-dialog .viewer-form > .viewer-actions {
  position: sticky;
  z-index: 2;
  bottom: -28px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 0 -28px -28px;
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
}
.admin-portal #admin-dialog .viewer-form > .viewer-actions .button { min-width: 132px; }
.admin-portal #admin-dialog .form-group { min-width: 0; }
.admin-portal #admin-dialog textarea { resize: vertical; }
.form-section { display: grid; gap: 18px; }
.form-section > div:first-child h3 { margin: 5px 0 0; font-size: 17px; }
.form-context {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--border);
}
.form-context > div { min-height: 76px; padding: 15px; background: var(--surface-2); }
.form-context small,
.form-context strong { display: block; }
.form-context small { margin-bottom: 7px; color: var(--text-2); }
.form-context strong { font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.request-dialog-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--border);
}
.request-dialog-summary > div { min-height: 74px; padding: 14px 16px; background: var(--surface-2); }
.request-dialog-summary small,
.request-dialog-summary strong { display: block; }
.request-dialog-summary small { margin-bottom: 7px; color: var(--text-2); }
.request-dialog-summary strong { font-size: 13px; line-height: 1.4; }
.admin-portal #admin-dialog .request-thread {
  max-height: min(34dvh, 340px);
  display: grid;
  gap: 10px;
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  overscroll-behavior: contain;
}
.admin-portal #admin-dialog .request-thread article {
  width: min(78%, 620px);
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.admin-portal #admin-dialog .request-thread article.from-team { justify-self: end; border-color: color-mix(in srgb, var(--brand) 24%, var(--border)); background: color-mix(in srgb, var(--brand) 5%, var(--surface)); }
.admin-portal #admin-dialog .request-thread article > div { display: flex; justify-content: space-between; gap: 12px; }
.admin-portal #admin-dialog .request-thread article p { margin: 0; line-height: 1.55; white-space: pre-wrap; }
.admin-portal #admin-dialog .request-thread article small { color: var(--text-2); }
.request-response-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }

.admin-portal .project-table { min-width: 1320px; }
.admin-portal .project-table td:nth-child(7) { min-width: 190px; }
.admin-portal .project-table td:nth-child(6) { min-width: 132px; }
.admin-portal .project-table .table-subline.money { font-size: 11px; white-space: normal; }
.admin-portal .payment-row { grid-template-columns: 52px minmax(0, 1fr) 180px 220px; }
.admin-portal .payment-order { display: flex; gap: 4px; }
.payment-marker {
  top: 37px;
  width: auto;
  min-width: 56px;
  height: 22px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
.admin-portal .document-row > .button,
.admin-portal .document-row > .document-row-actions .button { min-width: 112px; }
.admin-portal .project-table tbody tr:nth-child(4n+1) .project-thumb,
.admin-portal .project-card-grid .project-tile:nth-child(4n+1) .project-tile-image { background-image: url("images/house-main.jpg"); }
.admin-portal .project-table tbody tr:nth-child(4n+2) .project-thumb,
.admin-portal .project-card-grid .project-tile:nth-child(4n+2) .project-tile-image { background-image: url("images/house-istra.jpg"); }
.admin-portal .project-table tbody tr:nth-child(4n+3) .project-thumb,
.admin-portal .project-card-grid .project-tile:nth-child(4n+3) .project-tile-image { background-image: url("images/construction-frame.jpg"); }
.admin-portal .project-table tbody tr:nth-child(4n+4) .project-thumb,
.admin-portal .project-card-grid .project-tile:nth-child(4n+4) .project-tile-image { background-image: url("images/house-forest.jpg"); }

/* Client dialogs use one content gutter instead of a card nested inside a modal. */
.client-portal #viewer-dialog[data-layout="compact"] .viewer-body,
.client-portal #viewer-dialog[data-layout="conversation"] .viewer-body {
  padding: 24px 28px 28px;
  background: var(--surface);
}
.client-portal #viewer-dialog[data-layout="compact"] .viewer-form {
  gap: 20px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.client-portal #viewer-dialog[data-layout="compact"] .viewer-form > .viewer-actions,
.client-portal #viewer-dialog[data-layout="conversation"] .request-composer > .viewer-actions {
  position: sticky;
  z-index: 2;
  bottom: -28px;
  display: flex;
  justify-content: flex-end;
  margin: 0 -28px -28px;
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
}
.client-portal #viewer-dialog[data-layout="conversation"] .request-thread {
  background: var(--bg);
}
.client-portal #viewer-dialog[data-layout="conversation"] .request-composer {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

@media (max-width: 980px) {
  .management-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .management-toolbar { grid-template-columns: minmax(220px, 1fr) minmax(160px, 210px); }
  .management-toolbar select:last-child { grid-column: 2; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-panel:last-child { grid-column: auto; }
}

@media (max-width: 680px) {
  .management-metrics { grid-template-columns: 1fr; }
  .management-toolbar { grid-template-columns: 1fr; }
  .management-toolbar select:last-child { grid-column: auto; }
  .template-management-toolbar { gap: 8px; }
  .management-filter-disclosure { width: 100%; }
  .management-filter-disclosure > summary { display: flex; }
  .management-filter-disclosure > .filter-row { padding: 10px; }
  .settings-panel > header { align-items: flex-start; flex-direction: column; }
  .settings-panel > header .button { width: 100%; }
  .settings-definition > div { grid-template-columns: 1fr; gap: 6px; }
  .settings-definition dd { text-align: left; }
  .security-setting { grid-template-columns: 40px minmax(0, 1fr); }
  .security-setting .badge { grid-column: 2; width: max-content; }
  .admin-portal #admin-dialog,
  .admin-portal #admin-dialog[data-layout] { width: 100%; max-width: none; max-height: calc(100dvh - 8px); margin: auto 0 0; border-radius: 18px 18px 0 0; }
  .admin-portal #admin-dialog .viewer-shell { max-height: calc(100dvh - 8px); }
  .admin-portal #admin-dialog .modal-head { min-height: 76px; padding: 14px 16px; }
  .admin-portal #admin-dialog .viewer-body { max-height: calc(100dvh - 84px); padding: 18px 16px 22px; }
  .admin-portal #admin-dialog .viewer-form > .viewer-actions { bottom: -22px; margin: 0 -16px -22px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
  .admin-portal #admin-dialog .viewer-form > .viewer-actions .button { flex: 1 1 0; min-width: 0; }
  .form-context,
  .request-dialog-summary { grid-template-columns: 1fr; }
  .form-context > div,
  .request-dialog-summary > div { min-height: 0; }
  .request-response-grid { grid-template-columns: 1fr; }
  .admin-portal #admin-dialog .request-thread article { width: 92%; }

  .template-table,
  .employee-table { min-width: 0; }
  .template-table thead,
  .employee-table thead { display: none; }
  .template-table tbody,
  .employee-table tbody { display: grid; }
  .template-table tbody tr,
  .employee-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
    padding: 18px;
    border-bottom: 1px solid var(--border-soft);
  }
  .template-table tbody tr:last-child,
  .employee-table tbody tr:last-child { border-bottom: 0; }
  .template-table tbody tr[hidden],
  .employee-table tbody tr[hidden] { display: none; }
  .template-table td,
  .employee-table td,
  .template-table td:last-child,
  .employee-table td:last-child {
    width: auto;
    padding: 0;
    border: 0;
    text-align: left;
    white-space: normal;
  }
  .template-table td:first-child,
  .template-table td:nth-child(2),
  .template-table td:last-child,
  .employee-table td:first-child,
  .employee-table td:last-child { grid-column: 1 / -1; }
  .template-table td:nth-child(3)::before,
  .template-table td:nth-child(4)::before,
  .employee-table td:nth-child(2)::before,
  .employee-table td:nth-child(3)::before,
  .employee-table td:nth-child(4)::before,
  .employee-table td:nth-child(5)::before {
    content: "";
    display: block;
    margin-bottom: 5px;
    color: var(--text-2);
    font-size: 10px;
    font-weight: var(--weight-semibold);
    letter-spacing: .06em;
    text-transform: uppercase;
  }
  .template-table td:nth-child(3)::before { content: "Использовано"; }
  .template-table td:nth-child(4)::before { content: "Обновлено"; }
  .employee-table td:nth-child(2)::before { content: "Роль"; }
  .employee-table td:nth-child(3)::before { content: "Проекты"; }
  .employee-table td:nth-child(4)::before { content: "Активность"; }
  .employee-table td:nth-child(5)::before { content: "Доступ"; }
  .template-table .management-description { max-width: none; }
  .template-table .row-actions { justify-content: flex-start; }
  .template-table .row-actions .button { flex: 1 1 auto; }
  .employee-table td:last-child .button { width: 100%; }
}

@media (max-width: 820px) {
  .management-filter-disclosure:not([open]) > .filter-row { display: none; }
}

@media (max-width: 560px) {
  .client-portal #viewer-dialog[data-layout="compact"] .viewer-body,
  .client-portal #viewer-dialog[data-layout="conversation"] .viewer-body { padding: 18px 16px 22px; }
  .client-portal #viewer-dialog[data-layout="compact"] .viewer-form,
  .client-portal #viewer-dialog[data-layout="conversation"] .request-composer { padding: 0; }
  .client-portal #viewer-dialog[data-layout="compact"] .viewer-form > .viewer-actions,
  .client-portal #viewer-dialog[data-layout="conversation"] .request-composer > .viewer-actions {
    bottom: -22px;
    margin: 0 -16px -22px;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  }
  .client-portal #viewer-dialog[data-layout="compact"] .viewer-form > .viewer-actions .button,
  .client-portal #viewer-dialog[data-layout="conversation"] .request-composer > .viewer-actions .button { width: 100%; min-width: 0; }
}

/* Filters: compact disclosure with a neutral border and one consistent rhythm. */
.filter-disclosure > summary:focus { outline: none; }
.filter-disclosure > summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

@media (max-width: 820px) {
  .client-portal .toolbar:has(> .filter-disclosure),
  .admin-portal .toolbar:has(> .filter-disclosure) { gap: 8px; }

  .client-portal .toolbar:has(> .filter-disclosure) .search-field input,
  .admin-portal .toolbar:has(> .filter-disclosure) .search-field input,
  .client-portal .filter-disclosure > summary,
  .admin-portal .filter-disclosure > summary {
    border-color: var(--border-soft);
    box-shadow: none;
  }

  .client-portal .filter-disclosure,
  .admin-portal .filter-disclosure {
    overflow: hidden;
    border-radius: 10px;
    background: var(--surface);
  }

  .client-portal .filter-disclosure > summary,
  .admin-portal .filter-disclosure > summary {
    min-height: 46px;
    padding-inline: 14px;
    border-radius: 10px;
    background: var(--surface);
    transition: background-color .18s ease, border-color .18s ease;
  }

  .client-portal .filter-disclosure > summary:hover,
  .admin-portal .filter-disclosure > summary:hover { background: var(--surface-2); }

  .client-portal .filter-disclosure > summary::after,
  .admin-portal .filter-disclosure > summary::after {
    width: 8px;
    height: 8px;
    content: "";
    border-right: 1.5px solid var(--text-2);
    border-bottom: 1.5px solid var(--text-2);
    transform: rotate(45deg);
    transform-origin: center;
    transition: transform .2s cubic-bezier(.22, 1, .36, 1);
  }

  .client-portal .filter-disclosure[open],
  .admin-portal .filter-disclosure[open] { border: 1px solid var(--border-soft); }

  .client-portal .filter-disclosure[open] > summary,
  .admin-portal .filter-disclosure[open] > summary {
    border: 0;
    border-radius: 9px 9px 0 0;
  }

  .client-portal .filter-disclosure[open] > summary::after,
  .admin-portal .filter-disclosure[open] > summary::after { transform: rotate(225deg); }

  .client-portal .filter-disclosure > .filter-row,
  .admin-portal .filter-disclosure > .filter-row {
    gap: 8px;
    padding: 10px;
    border-top: 1px solid var(--border-soft);
    background: var(--surface-2);
  }
}

/* Tickets: messages float on the dialog surface without a card inside a card. */
.client-portal #viewer-dialog[data-layout="conversation"] .request-summary {
  padding: 0 0 16px;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  border-radius: 0;
  background: transparent;
}

.client-portal #viewer-dialog[data-layout="conversation"] .request-thread,
.admin-portal #admin-dialog[data-layout="conversation"] .request-thread {
  gap: 18px;
  padding: 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.client-portal #viewer-dialog[data-layout="conversation"] .request-thread article,
.admin-portal #admin-dialog[data-layout="conversation"] .request-thread article {
  width: min(82%, 680px);
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 0 10px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.client-portal #viewer-dialog[data-layout="conversation"] .request-thread article::before,
.admin-portal #admin-dialog[data-layout="conversation"] .request-thread article::before {
  grid-column: 1;
  grid-row: 1 / 3;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  content: "К";
  border: 1px solid var(--border-soft);
  border-radius: 50%;
  color: var(--text-2);
  background: var(--surface-2);
  font-size: 10px;
  font-weight: var(--weight-bold);
}

.client-portal #viewer-dialog[data-layout="conversation"] .request-thread article > div:first-child,
.client-portal #viewer-dialog[data-layout="conversation"] .request-thread article > p,
.admin-portal #admin-dialog[data-layout="conversation"] .request-thread article > div:first-child,
.admin-portal #admin-dialog[data-layout="conversation"] .request-thread article > p {
  grid-column: 2;
  margin: 0;
  border-right: 1px solid var(--border-soft);
  border-left: 1px solid var(--border-soft);
  background: var(--surface-2);
}

.client-portal #viewer-dialog[data-layout="conversation"] .request-thread article > div:first-child,
.admin-portal #admin-dialog[data-layout="conversation"] .request-thread article > div:first-child {
  padding: 12px 14px 5px;
  border-top: 1px solid var(--border-soft);
  border-radius: 13px 13px 0 0;
}

.client-portal #viewer-dialog[data-layout="conversation"] .request-thread article > p,
.admin-portal #admin-dialog[data-layout="conversation"] .request-thread article > p {
  padding: 0 14px 12px;
  border-bottom: 1px solid var(--border-soft);
  border-radius: 0 0 13px 13px;
}

.client-portal #viewer-dialog[data-layout="conversation"] .request-thread article.from-client,
.admin-portal #admin-dialog[data-layout="conversation"] .request-thread article.from-team {
  grid-template-columns: minmax(0, 1fr) 36px;
  justify-self: end;
}

.client-portal #viewer-dialog[data-layout="conversation"] .request-thread article.from-client::before,
.admin-portal #admin-dialog[data-layout="conversation"] .request-thread article.from-team::before {
  grid-column: 2;
  content: "Вы";
  border-color: color-mix(in srgb, var(--brand) 22%, var(--border-soft));
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 7%, var(--surface));
}

.admin-portal #admin-dialog[data-layout="conversation"] .request-thread article.from-team::before { content: "NV"; }
.client-portal #viewer-dialog[data-layout="conversation"] .request-thread article.from-team::before { content: "NV"; }

.client-portal #viewer-dialog[data-layout="conversation"] .request-thread article.from-client > div:first-child,
.client-portal #viewer-dialog[data-layout="conversation"] .request-thread article.from-client > p,
.admin-portal #admin-dialog[data-layout="conversation"] .request-thread article.from-team > div:first-child,
.admin-portal #admin-dialog[data-layout="conversation"] .request-thread article.from-team > p {
  grid-column: 1;
  border-color: color-mix(in srgb, var(--brand) 18%, var(--border-soft));
  background: color-mix(in srgb, var(--brand) 6%, var(--surface));
}

.client-portal #viewer-dialog[data-layout="conversation"] .ticket-reactions,
.admin-portal #admin-dialog[data-layout="conversation"] .ticket-reactions {
  grid-column: 2;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  margin-top: 6px;
}

.client-portal #viewer-dialog[data-layout="conversation"] article.from-client .ticket-reactions,
.admin-portal #admin-dialog[data-layout="conversation"] article.from-team .ticket-reactions {
  grid-column: 1;
  justify-content: flex-end;
}

.ticket-reaction {
  min-width: 32px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--text-2);
  background: var(--surface);
  font-size: 14px;
  box-shadow: none;
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background-color .16s ease, transform .16s ease;
}

.ticket-reaction:hover {
  border-color: var(--border-soft);
  color: var(--text);
  background: var(--surface-2);
}

.ticket-reaction:active { transform: scale(.94); }
.ticket-reaction:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ticket-reaction.active {
  border-color: color-mix(in srgb, var(--brand) 34%, var(--border-soft));
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 9%, var(--surface));
}
.ticket-reaction:disabled { cursor: wait; opacity: .55; }
.reaction-count { font-size: 11px; font-variant-numeric: tabular-nums; }

@media (hover: hover) and (pointer: fine) {
  .ticket-reactions { opacity: 0; transition: opacity .16s ease; }
  .request-thread article:hover .ticket-reactions,
  .request-thread article:focus-within .ticket-reactions,
  .ticket-reactions:has(.ticket-reaction.active) { opacity: 1; }
}

.admin-portal #admin-dialog[data-layout="conversation"] .request-dialog-summary {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 0 16px;
  overflow: visible;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  border-radius: 0;
  background: transparent;
}

.admin-portal #admin-dialog[data-layout="conversation"] .request-dialog-summary > div {
  min-height: 0;
  padding: 0;
  background: transparent;
}

.admin-portal #admin-dialog[data-layout="conversation"] .request-dialog-summary > div:last-child { margin-left: auto; }
.admin-portal #admin-dialog[data-layout="conversation"] .ticket-status-control {
  min-width: 156px;
  display: grid;
  gap: 6px;
}
.admin-portal #admin-dialog[data-layout="conversation"] .ticket-status-control label {
  color: var(--text-2);
  font-size: 11px;
}
.admin-portal #admin-dialog[data-layout="conversation"] .ticket-status-control select { min-height: 38px; }

@media (max-width: 560px) {
  .client-portal #viewer-dialog[data-layout="conversation"] .request-thread,
  .admin-portal #admin-dialog[data-layout="conversation"] .request-thread { gap: 14px; }

  .client-portal #viewer-dialog[data-layout="conversation"] .request-thread article,
  .admin-portal #admin-dialog[data-layout="conversation"] .request-thread article { width: 94%; }

  .admin-portal #admin-dialog[data-layout="conversation"] .request-dialog-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 16px;
  }

  .admin-portal #admin-dialog[data-layout="conversation"] .request-dialog-summary > div:last-child { margin-left: 0; }
  .admin-portal #admin-dialog[data-layout="conversation"] .ticket-status-control { min-width: 132px; }
}

/* Conversation dialogs keep chrome and composer fixed; only the message history scrolls. */
.client-portal #viewer-dialog[data-layout="conversation"],
.admin-portal #admin-dialog[data-layout="conversation"] {
  height: min(820px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  overflow: hidden;
}

.client-portal #viewer-dialog[data-layout="conversation"] .viewer-shell,
.admin-portal #admin-dialog[data-layout="conversation"] .viewer-shell {
  height: 100%;
  min-height: 0;
  max-height: none;
}

.client-portal #viewer-dialog[data-layout="conversation"] .viewer-body,
.admin-portal #admin-dialog[data-layout="conversation"] .viewer-body {
  min-height: 0;
  max-height: none;
  overflow: hidden;
  overscroll-behavior: none;
}

.client-portal #viewer-dialog[data-layout="conversation"] .request-viewer,
.admin-portal #admin-dialog[data-layout="conversation"] .viewer-form {
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
}

.client-portal #viewer-dialog[data-layout="conversation"] .request-thread,
.admin-portal #admin-dialog[data-layout="conversation"] .request-thread {
  min-height: 0;
  max-height: none;
  align-content: start;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.admin-portal #admin-dialog[data-layout="conversation"] .viewer-form > .viewer-actions,
.client-portal #viewer-dialog[data-layout="conversation"] .request-composer > .viewer-actions {
  position: static;
  bottom: auto;
}

.client-portal #viewer-dialog[data-layout="conversation"] .request-composer textarea,
.admin-portal #admin-dialog[data-layout="conversation"] .request-response-grid textarea {
  height: 84px;
  min-height: 84px;
  max-height: 84px;
  resize: none;
}

@media (max-width: 680px) {
  .client-portal #viewer-dialog[data-layout="conversation"],
  .admin-portal #admin-dialog[data-layout="conversation"] {
    height: calc(100dvh - 8px);
    max-height: calc(100dvh - 8px);
  }

  .client-portal #viewer-dialog[data-layout="conversation"] .request-viewer,
  .admin-portal #admin-dialog[data-layout="conversation"] .viewer-form { gap: 12px; }

  .client-portal #viewer-dialog[data-layout="conversation"] .request-composer textarea,
  .admin-portal #admin-dialog[data-layout="conversation"] .request-response-grid textarea {
    height: 72px;
    min-height: 72px;
    max-height: 72px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .management-table tbody tr,
  .admin-portal #admin-dialog { animation: none !important; }
}
