:root {
  --navy: #0C2461;
  --navy-2: #0A3D62;
  --slate: #3C6382;
  --page: #F5F7FA;
  --line: #DCE3EE;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

html, body { background: var(--page); color: var(--navy); }
body { margin: 0; }
h1:focus, main:focus { outline: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 0.5rem; top: -4rem; z-index: 2000; padding: 0.75rem 1rem;
  background: #fff; color: var(--navy); border-radius: 8px; transition: top 0.3s var(--ease);
}
.skip-link:focus { top: 0.5rem; }

.page-loading { display: flex; justify-content: center; align-items: center; min-height: 40vh; }

#blazor-error-ui {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 3000;
  padding: 0.75rem 1.25rem; background: #FAD390; color: var(--navy);
}
#blazor-error-ui .reload { color: var(--navy); font-weight: 600; margin-left: 0.5rem; }

/* Sign-in and other pre-login screens: editorial hero beside a calm card */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.auth-hero {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff; padding: 2.5rem 1.5rem; display: flex; flex-direction: column; justify-content: flex-end; gap: 1rem;
}
.auth-brand { letter-spacing: 0.22em; color: #fff; }
.auth-headline { color: #fff; font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif; font-size: 2rem; line-height: 1.15; }
.auth-lede { color: #E8EEF9; max-width: 34rem; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 26rem; padding: 2rem; background: #fff; border-radius: 14px; }
@media (min-width: 960px) {
  .auth-shell { grid-template-columns: 1.15fr 1fr; }
  .auth-hero { padding: 4rem; min-height: 100vh; }
  .auth-headline { font-size: 3.25rem; }
}

/* Drawer: navy surface, readable active state (palette pairing rules, ADR-005) */
.mud-drawer .mud-nav-link { color: #fff; border-radius: 8px; transition: background-color 0.3s var(--ease); }
.mud-drawer .mud-nav-link .mud-icon-root { color: #fff; }
.mud-drawer .mud-nav-link:hover { background: rgba(255, 255, 255, 0.1); }
.mud-drawer .mud-nav-link.active:not(.mud-nav-link-disabled),
.mud-drawer .mud-nav-link.active:not(.mud-nav-link-disabled) .mud-icon-root { background: rgba(255, 255, 255, 0.18); color: #fff !important; font-weight: 600; }
.mud-drawer .mud-nav-link.active:not(.mud-nav-link-disabled) .mud-icon-root { background: transparent; }
.drawer-divider { border-color: rgba(255, 255, 255, 0.25); }
.app-brand { font-family: Georgia, "Iowan Old Style", serif; letter-spacing: 0.04em; }

/* Cards and tables */
.summary-card, .lease-card, .totals, .pay-callout {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
}
.pay-callout { background: #FAD390; border-color: #FAD390; }
.text-overdue { color: #B71540; }
.data-table { background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.data-table .num, .mud-table .num { text-align: right; }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.75rem; }
.pager { display: flex; justify-content: center; margin-top: 1.5rem; }
.remote-error { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.invoice-heading { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.25rem; }
.totals-row { display: flex; justify-content: space-between; padding: 0.35rem 0; }
.totals-balance { font-weight: 700; border-top: 1px solid var(--line); margin-top: 0.5rem; padding-top: 0.75rem; font-size: 1.15rem; }
.copy-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.steps { padding-left: 1.25rem; line-height: 1.9; }

/* Status chips: icon, text and tint together, never colour alone */
.status-chip { font-weight: 600; }
.status-neutral { background: #E6EAF2 !important; color: var(--navy) !important; }
.status-success { background: #B8E994 !important; color: var(--navy) !important; }
.status-warning { background: #F6B93B !important; color: var(--navy) !important; }
.status-info { background: #82CCDD !important; color: var(--navy) !important; }
.status-error { background: #B71540 !important; color: #fff !important; }

/* Touch targets of at least 44px */
.touch-target, .mud-button-root, .mud-icon-button, .mud-nav-link { min-height: 44px; }
.mud-icon-button { min-width: 44px; }
@media (pointer: coarse) { .mud-input-root-margin-dense { min-height: 44px; box-sizing: border-box; } }

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

/* Figures read better in the sans face with tabular, lining numerals than in Georgia's old-style ones */
.figure { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important; font-variant-numeric: tabular-nums lining-nums; font-weight: 600 !important; }

/* Dashboard */
.period-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.period-form .mud-input-control { flex: 1 1 11rem; max-width: 14rem; }
.dashboard-tabs .mud-tabs-panels { padding-top: 1.5rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.unit-choices { display: flex; flex-wrap: wrap; column-gap: 1rem; }
.share { display: flex; align-items: center; gap: 0.75rem; min-width: 10rem; }
.share .mud-progress-linear { flex: 1; }
.subtle { display: block; color: var(--slate); font-size: 0.85rem; }
.sort-active { background: rgba(30, 55, 153, 0.12); font-weight: 700; }

/* Staff screens */
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
a.mud-link.mud-link-underline-hover { text-decoration: underline; }
.permission-area { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 0.75rem; padding: 0.25rem 0.75rem; }
.permission-area legend { font-weight: 600; padding: 0 0.25rem; }
.form-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; max-width: 36rem; }
.dashboard-tabs .form-card { max-width: none; }
.modal-layer { position: fixed; inset: 0; z-index: 1400; display: flex; align-items: center; justify-content: center; padding: 1rem; overflow-y: auto; background: rgba(16, 24, 64, 0.5); }
.modal-card { width: 100%; max-height: 100%; overflow-y: auto; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3); }
.stat-grid > .mud-grid-item { display: flex; }
.stat-grid .summary-card { flex: 1; }
.form-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.credentials { background: #FAD390; border: 1px solid #F8C291; border-radius: 12px; max-width: 36rem; }

/* Palette pairing rules (ADR-005): the light status colours are fills only; text on them is navy */
.mud-alert-outlined-info, .mud-alert-outlined-success, .mud-alert-outlined-warning { color: var(--navy) !important; }
.mud-alert-outlined-info { background: #E4F4F8; }
.mud-alert-outlined-success { background: #EEF9E4; }
.mud-alert-outlined-warning { background: #FEF3DB; }
.mud-alert-outlined-info .mud-alert-icon, .mud-alert-outlined-success .mud-alert-icon, .mud-alert-outlined-warning .mud-alert-icon { color: var(--navy) !important; }

.doc-page { max-width: 62rem; }
.doc-step { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1.5rem; margin-bottom: 1.5rem; scroll-margin-top: 5rem; }
.doc-list { margin: 0 0 1rem; padding-left: 1.4rem; line-height: 1.6; }
.doc-figure { margin: 0.5rem 0 1.25rem; }
.doc-figure img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; }
.doc-figure figcaption { margin-top: 0.4rem; font-size: 0.85rem; color: var(--slate); }
