:root {
    --navy-950: #03253b;
    --navy-900: #06314c;
    --navy-800: #08466d;
    --blue-700: #07689b;
    --blue-600: #087db5;
    --cyan-500: #00a9d8;
    --cyan-100: #ddf6fc;
    --green-600: #049873;
    --green-100: #daf7ee;
    --red-600: #ef3f4a;
    --red-100: #fee8ea;
    --amber-600: #bc7605;
    --amber-100: #fff3d5;
    --ink: #0b2639;
    --text: #233b4c;
    --muted: #607689;
    --line: #dbe3e9;
    --line-dark: #c6d2da;
    --surface: #ffffff;
    --surface-2: #f5f7fa;
    --surface-3: #edf2f6;
    --shadow: 0 8px 26px rgba(3, 37, 59, .08);
    --sidebar-width: 238px;
    --radius: 6px;
    --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--surface-2); line-height: 1.5; }
body.nav-open { overflow: hidden; }
a { color: var(--blue-700); text-decoration: none; }
a:hover { color: var(--navy-900); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3 { color: var(--ink); line-height: 1.2; }
h1 { font-size: clamp(1.75rem, 3vw, 2.35rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
.skip-link { position: fixed; left: 10px; top: -60px; z-index: 9999; background: #fff; padding: 10px 14px; border: 2px solid var(--navy-900); }
.skip-link:focus { top: 10px; }
.icon { fill: currentColor; flex: 0 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--navy-950); font-weight: 800; letter-spacing: -.02em; }
.brand:hover { color: var(--navy-950); }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; height: 31px; padding: 0 7px; background: var(--cyan-500); color: var(--navy-950); font-size: .82rem; font-weight: 900; letter-spacing: .08em; transform: skew(-7deg); }
.brand-name { font-size: 1rem; }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--navy-800); border-radius: 24px; padding: 9px 20px; background: var(--navy-800); color: #fff; font-weight: 800; font-size: .9rem; letter-spacing: .01em; text-align: center; transition: .15s ease; }
.button:hover { background: var(--navy-950); border-color: var(--navy-950); color: #fff; transform: translateY(-1px); }
.button-outline { background: #fff; color: var(--navy-800); }
.button-outline:hover { background: var(--surface-3); color: var(--navy-950); }
.button-secondary { background: var(--cyan-500); border-color: var(--cyan-500); color: var(--navy-950); }
.button-danger { background: var(--red-600); border-color: var(--red-600); }
.button-success { background: var(--green-600); border-color: var(--green-600); }
.button-small { min-height: 36px; padding: 7px 15px; font-size: .82rem; }
.button-block { width: 100%; }
.text-button { border: 0; background: none; color: var(--blue-700); font-weight: 700; padding: 0; }
.alert { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 13px 16px; margin: 0 0 18px; border-left: 4px solid var(--blue-600); background: #e8f4fb; color: var(--ink); }
.alert button { border: 0; background: none; font-size: 1.3rem; line-height: 1; color: inherit; }
.alert-success { border-color: var(--green-600); background: var(--green-100); }
.alert-danger, .alert-error { border-color: var(--red-600); background: var(--red-100); }
.alert-warning { border-color: var(--amber-600); background: var(--amber-100); }
.eyebrow { margin-bottom: 5px; color: var(--blue-600); font-size: .74rem; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.text-danger { color: var(--red-600); }
.text-success { color: var(--green-600); }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Public website */
.public-body { background: #fff; }
.public-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--line); }
.public-header-inner { max-width: 1200px; min-height: 76px; margin: 0 auto; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.public-nav { display: flex; align-items: center; gap: 27px; font-size: .9rem; font-weight: 750; }
.mobile-nav-button { display: none; border: 0; background: transparent; color: var(--navy-950); }
.public-hero { background: var(--navy-950); color: #fff; overflow: hidden; }
.public-hero-inner { max-width: 1200px; min-height: 610px; margin: 0 auto; padding: 76px 28px; display: grid; grid-template-columns: minmax(0,1.05fr) minmax(360px,.95fr); align-items: center; gap: 80px; }
.public-hero h1 { max-width: 680px; margin-bottom: 24px; color: #fff; font-size: clamp(2.7rem, 6vw, 5.1rem); line-height: .98; letter-spacing: -.055em; }
.public-hero p { max-width: 620px; color: #d4e3ec; font-size: 1.16rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-actions .button-secondary { min-width: 190px; }
.hero-visual { position: relative; min-height: 440px; }
.hero-building { position: absolute; inset: 20px 0 0 15%; background: linear-gradient(150deg, #fff 0 35%, #e5f3f8 35% 100%); clip-path: polygon(50% 0, 100% 26%, 100% 100%, 0 100%, 0 26%); }
.hero-building::before, .hero-building::after { content: ""; position: absolute; bottom: 0; width: 30%; height: 58%; background: var(--navy-800); border: 12px solid #fff; border-bottom: 0; }
.hero-building::before { left: 12%; }
.hero-building::after { right: 12%; }
.hero-note { position: absolute; right: 0; top: 0; width: 255px; padding: 18px; background: #fff; color: var(--ink); box-shadow: 0 14px 45px rgba(0,0,0,.25); border-left: 5px solid var(--cyan-500); }
.hero-note strong { display: block; font-size: 1.05rem; }
.hero-note span { color: var(--muted); font-size: .85rem; }
.public-section { padding: 88px 28px; }
.public-section.alt { background: var(--surface-2); }
.public-section-inner { max-width: 1200px; margin: 0 auto; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 34px; }
.section-heading h2 { margin-bottom: 0; font-size: clamp(2rem, 4vw, 3.15rem); letter-spacing: -.04em; }
.section-heading p { max-width: 560px; margin-bottom: 0; color: var(--muted); }
.feature-grid { display: grid; grid-template-columns: repeat(3,1fr); border-top: 1px solid var(--line-dark); border-left: 1px solid var(--line-dark); }
.feature-item { min-height: 220px; padding: 34px; border-right: 1px solid var(--line-dark); border-bottom: 1px solid var(--line-dark); background: #fff; }
.feature-number { display: block; margin-bottom: 44px; color: var(--cyan-500); font-weight: 900; }
.feature-item p { color: var(--muted); }
.listing-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 22px; }
.listing-card { border: 1px solid var(--line-dark); background: #fff; }
.listing-image { position: relative; aspect-ratio: 16/10; overflow: hidden; background: var(--surface-3); }
.listing-image img { width: 100%; height: 100%; object-fit: cover; }
.listing-placeholder { width: 100%; height: 100%; display: grid; place-items: center; background: linear-gradient(145deg,#dceaf1,#f8fbfc); color: var(--navy-800); font-size: 3rem; font-weight: 900; }
.listing-status { position: absolute; left: 14px; top: 14px; background: var(--green-600); color: #fff; padding: 5px 9px; font-size: .69rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.listing-body { padding: 21px; }
.listing-body h3 { margin-bottom: 5px; font-size: 1.12rem; }
.listing-address { color: var(--muted); font-size: .88rem; }
.listing-facts { display: flex; gap: 14px; padding: 15px 0; margin: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-weight: 700; font-size: .86rem; }
.listing-foot { display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.listing-price { color: var(--navy-950); font-size: 1.25rem; font-weight: 900; }
.search-panel { margin-bottom: 28px; padding: 20px; background: var(--navy-950); }
.search-grid { display: grid; grid-template-columns: 2fr repeat(4,1fr) auto; gap: 10px; align-items: end; }
.search-panel label { color: #cfe0ea; font-size: .75rem; font-weight: 800; }
.search-panel input, .search-panel select { background: #fff; }
.public-footer { padding: 62px 28px 24px; background: var(--navy-950); color: #c8d8e1; }
.public-footer-grid { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 60px; }
.public-footer h2 { color: #fff; font-size: .88rem; text-transform: uppercase; letter-spacing: .1em; }
.public-footer a { display: block; margin: 8px 0; color: #d3e2ea; }
.brand-light { color: #fff; margin-bottom: 16px; }
.public-footer-bottom { max-width: 1200px; margin: 45px auto 0; padding-top: 20px; border-top: 1px solid #28506a; display: flex; justify-content: space-between; gap: 20px; font-size: .78rem; }
.content-narrow { max-width: 820px; margin: 0 auto; }
.content-wide { max-width: 1200px; margin: 0 auto; }
.auth-page { min-height: calc(100vh - 77px); padding: 70px 22px; background: var(--surface-2); }
.auth-shell { max-width: 460px; margin: 0 auto; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.auth-head { padding: 34px 38px 24px; text-align: center; }
.auth-head .brand { margin-bottom: 30px; }
.auth-head h1 { margin-bottom: 8px; font-size: 1.8rem; }
.auth-body { padding: 0 38px 38px; }
.auth-links { display: flex; justify-content: space-between; gap: 15px; margin-top: 18px; font-size: .85rem; }

/* App shell */
.app-body { background: var(--surface-2); }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 80; width: var(--sidebar-width); display: flex; flex-direction: column; background: var(--navy-950); color: #fff; }
.sidebar-head { min-height: 76px; display: flex; align-items: center; padding: 0 20px; border-bottom: 1px solid #20465e; }
.brand-sidebar { color: #fff; }
.brand-sidebar:hover { color: #fff; }
.brand-sidebar .brand-name { font-size: .88rem; }
.sidebar-close { display: none; margin-left: auto; border: 0; background: transparent; color: #fff; }
.sidebar-nav { flex: 1; padding: 16px 10px; overflow-y: auto; }
.sidebar-nav a { min-height: 43px; display: flex; align-items: center; gap: 12px; padding: 0 13px; margin: 2px 0; color: #c6d8e3; border-left: 3px solid transparent; font-size: .85rem; font-weight: 650; }
.sidebar-nav a:hover { color: #fff; background: rgba(255,255,255,.06); }
.sidebar-nav a.active { color: #fff; background: #0c496d; border-left-color: var(--cyan-500); }
.sidebar-foot { padding: 16px 16px 19px; border-top: 1px solid #20465e; }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.sidebar-user span:last-child { min-width: 0; }
.sidebar-user strong, .sidebar-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { font-size: .82rem; }
.sidebar-user small { color: #9fb7c5; font-size: .69rem; }
.avatar, .topbar-avatar { display: inline-grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--cyan-500); color: var(--navy-950); font-weight: 900; }
.avatar { width: 34px; height: 34px; font-size: .72rem; }
.sidebar-foot > a { display: flex; align-items: center; gap: 10px; color: #c6d8e3; font-size: .82rem; }
.sidebar-overlay { display: none; }
.app-workspace { min-height: 100vh; margin-left: var(--sidebar-width); display: flex; flex-direction: column; }
.app-topbar { position: sticky; top: 0; z-index: 45; min-height: 76px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; background: #fff; border-bottom: 1px solid var(--line); }
.app-menu-button { display: none; border: 0; background: transparent; color: var(--navy-950); }
.topbar-context span, .topbar-context strong { display: block; }
.topbar-context span { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
.topbar-context strong { color: var(--ink); font-size: .88rem; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.topbar-help { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .8rem; font-weight: 700; }
.topbar-avatar { width: 36px; height: 36px; font-size: .73rem; }
.app-main { flex: 1; width: 100%; max-width: 1480px; margin: 0 auto; padding: 31px 34px 52px; }
.page-heading { min-height: 72px; margin-bottom: 22px; display: flex; align-items: flex-start; justify-content: space-between; gap: 25px; }
.page-heading h1 { margin-bottom: 0; font-size: 2rem; letter-spacing: -.035em; }
.page-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.app-footer { padding: 20px 34px; display: flex; justify-content: space-between; gap: 20px; color: var(--muted); border-top: 1px solid var(--line); font-size: .74rem; }

/* Dashboard/records */
.metrics-strip { display: grid; grid-template-columns: repeat(4,1fr); border: 1px solid var(--line-dark); background: #fff; }
.metric { min-height: 132px; padding: 22px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: .7rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.metric-value { display: block; margin: 15px 0 2px; color: var(--ink); font-size: 2rem; line-height: 1; font-weight: 900; }
.metric-detail { color: var(--muted); font-size: .76rem; }
.metric-accent { color: var(--cyan-500); }
.metric-success { color: var(--green-600); }
.metric-danger { color: var(--red-600); }
.dashboard-grid { margin-top: 22px; display: grid; grid-template-columns: minmax(0,1.6fr) minmax(300px,.9fr); gap: 22px; }
.panel { background: #fff; border: 1px solid var(--line-dark); }
.panel + .panel { margin-top: 22px; }
.panel-head { min-height: 58px; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-head h3 { margin: 0; }
.panel-body { padding: 19px; }
.panel-body.flush { padding: 0; }
.panel-note { padding: 12px 18px; background: var(--cyan-100); color: var(--navy-900); border-bottom: 1px solid #bce9f4; font-size: .84rem; }
.status-board { display: grid; grid-template-columns: repeat(4,1fr); border: 1px solid var(--line-dark); background: #fff; }
.status-cell { min-height: 120px; padding: 20px; border-right: 1px solid var(--line); }
.status-cell:last-child { border: 0; }
.status-cell strong { display: block; margin-top: 14px; font-size: 1.8rem; color: var(--ink); }
.status-cell span { color: var(--muted); font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.payment-tiles { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.payment-tile { min-height: 115px; padding: 17px; color: #fff; background: var(--navy-800); }
.payment-tile:nth-child(2) { background: var(--blue-600); }
.payment-tile:nth-child(3) { background: var(--green-600); }
.payment-tile.danger { background: var(--red-600); }
.payment-tile.neutral { background: #5a7184; }
.payment-tile span { display: block; font-size: .7rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; opacity: .9; }
.payment-tile strong { display: block; margin-top: 10px; font-size: 1.7rem; }
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; background: #fff; }
.data-table th { padding: 11px 14px; background: var(--surface-3); color: #536c7e; border-bottom: 1px solid var(--line-dark); font-size: .68rem; letter-spacing: .07em; text-transform: uppercase; text-align: left; white-space: nowrap; }
.data-table td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: .86rem; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #f9fbfc; }
.record-title { color: var(--ink); font-weight: 800; }
.record-meta { color: var(--muted); font-size: .75rem; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border: 1px solid transparent; border-radius: 2px; font-size: .67rem; line-height: 1; font-weight: 900; text-transform: uppercase; letter-spacing: .045em; }
.badge-success { color: #00684f; background: var(--green-100); border-color: #9de3ce; }
.badge-danger { color: #b4232c; background: var(--red-100); border-color: #fac0c4; }
.badge-warning { color: #8a5700; background: var(--amber-100); border-color: #f0d28a; }
.badge-neutral { color: #526878; background: var(--surface-3); border-color: var(--line-dark); }
.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; padding: 15px; background: #fff; border: 1px solid var(--line-dark); margin-bottom: 18px; }
.filter-bar .field { min-width: 140px; margin: 0; flex: 1; }
.filter-bar .field.search { flex: 2; min-width: 220px; }
.record-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.record-card { background: #fff; border: 1px solid var(--line-dark); }
.record-card-head { padding: 17px; border-bottom: 1px solid var(--line); }
.record-card-head h2 { margin-bottom: 5px; font-size: 1.08rem; }
.record-card-body { padding: 17px; }
.record-card-footer { padding: 13px 17px; display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); background: var(--surface-2); }
.detail-grid { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(290px,.8fr); gap: 22px; }
.definition-list { display: grid; grid-template-columns: 150px 1fr; margin: 0; }
.definition-list dt, .definition-list dd { padding: 10px 0; border-bottom: 1px solid var(--line); }
.definition-list dt { color: var(--muted); font-size: .76rem; font-weight: 800; }
.definition-list dd { margin: 0; color: var(--ink); font-size: .88rem; }
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; padding: 0 0 22px 28px; border-left: 2px solid var(--line-dark); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--blue-600); }
.timeline strong { display: block; color: var(--ink); font-size: .84rem; }
.timeline span { color: var(--muted); font-size: .74rem; }
.timeline p { margin: 6px 0 0; font-size: .83rem; }
.empty-state { min-height: 260px; padding: 48px 24px; display: grid; place-items: center; align-content: center; text-align: center; background: #fff; border: 1px solid var(--line-dark); }
.empty-state .empty-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 13px; border-radius: 50%; background: var(--surface-3); color: var(--muted); font-size: 1.5rem; }
.empty-state h2 { margin-bottom: 7px; }
.empty-state p { max-width: 460px; color: var(--muted); }
.empty-state .button { margin-top: 9px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 17px 20px; }
.form-grid.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.field { margin-bottom: 17px; }
.field.full { grid-column: 1/-1; }
.field label, .field-label { display: block; margin-bottom: 6px; color: #425b6d; font-size: .78rem; font-weight: 850; }
.field label .required { color: var(--red-600); }
.input, input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="number"], input[type="date"], input[type="datetime-local"], input[type="search"], select, textarea {
    width: 100%; min-height: 44px; padding: 10px 12px; color: var(--ink); background: #fff; border: 1px solid var(--line-dark); border-radius: 3px; outline: none;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(8,125,181,.12); }
.input-help { margin-top: 5px; color: var(--muted); font-size: .72rem; }
.check-row { display: flex; align-items: flex-start; gap: 9px; font-size: .84rem; }
.check-row input { margin-top: 4px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 5px; }
.section-divider { margin: 28px 0 20px; padding-bottom: 10px; border-bottom: 1px solid var(--line-dark); }
.section-divider h2 { margin: 0; font-size: 1.05rem; }
.file-control { display: flex; align-items: center; gap: 10px; }
.file-control input { position: absolute; opacity: 0; pointer-events: none; }
.file-label { display: inline-flex; min-height: 42px; align-items: center; padding: 9px 15px; border: 1px dashed var(--blue-600); color: var(--blue-700); background: #f1f9fd; font-size: .82rem; font-weight: 800; cursor: pointer; }

/* Maintenance/field */
.work-order-id { color: var(--blue-600); font-size: .77rem; font-weight: 900; letter-spacing: .06em; }
.priority-emergency { color: #fff; background: var(--red-600); }
.priority-high { color: #8e4100; background: #ffe4c5; border-color: #ffc583; }
.dispatch-board { display: grid; grid-template-columns: repeat(4,minmax(230px,1fr)); gap: 13px; overflow-x: auto; padding-bottom: 8px; }
.dispatch-column { min-width: 230px; background: var(--surface-3); border-top: 4px solid var(--blue-600); }
.dispatch-column:nth-child(2) { border-top-color: var(--cyan-500); }
.dispatch-column:nth-child(3) { border-top-color: var(--amber-600); }
.dispatch-column:nth-child(4) { border-top-color: var(--green-600); }
.dispatch-column-head { padding: 13px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line-dark); }
.dispatch-column-head h2 { margin: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.dispatch-card { margin: 10px; padding: 13px; background: #fff; border: 1px solid var(--line-dark); }
.dispatch-card h3 { margin: 7px 0; font-size: .91rem; }
.dispatch-card p { color: var(--muted); font-size: .76rem; margin-bottom: 8px; }
.timer-panel { padding: 24px; color: #fff; background: var(--navy-950); }
.timer-display { margin: 12px 0 18px; color: #fff; font-size: clamp(2.3rem,8vw,4.5rem); font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.timer-state { color: #bcd1dd; font-size: .76rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 900; }
.timer-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.timer-actions .button { border-color: #fff; }
.location-readout { margin-top: 16px; padding-top: 14px; border-top: 1px solid #29536c; display: flex; align-items: flex-start; gap: 9px; color: #c9dce6; font-size: .8rem; }
.photo-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.photo-item { aspect-ratio: 4/3; border: 1px solid var(--line-dark); background: var(--surface-3); overflow: hidden; }
.photo-item img { width: 100%; height: 100%; object-fit: cover; }
.chat-thread { max-height: 520px; overflow-y: auto; padding: 16px; background: var(--surface-2); }
.chat-message { max-width: 78%; margin-bottom: 12px; padding: 11px 13px; background: #fff; border: 1px solid var(--line); }
.chat-message.mine { margin-left: auto; background: var(--cyan-100); border-color: #b7e9f5; }
.chat-message.internal { border-left: 4px solid var(--amber-600); background: var(--amber-100); }
.chat-meta { display: flex; justify-content: space-between; gap: 15px; margin-bottom: 5px; color: var(--muted); font-size: .67rem; }
.chat-message p { margin: 0; font-size: .84rem; white-space: pre-wrap; }

/* Resident */
.resident-hero { padding: 28px; display: grid; grid-template-columns: 1.5fr repeat(2,.75fr); background: var(--navy-950); color: #fff; }
.resident-hero h2 { color: #fff; margin-bottom: 5px; }
.resident-hero p { margin-bottom: 0; color: #c9dce6; }
.resident-balance { padding-left: 24px; border-left: 1px solid #2a526b; }
.resident-balance span { display: block; color: #a9c2d1; font-size: .7rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.resident-balance strong { display: block; margin-top: 7px; color: #fff; font-size: 1.7rem; }

/* Responsive */
@media (max-width: 1100px) {
    .metrics-strip { grid-template-columns: repeat(2,1fr); }
    .metric:nth-child(2) { border-right: 0; }
    .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
    .dashboard-grid, .detail-grid { grid-template-columns: 1fr; }
    .record-grid, .listing-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .public-hero-inner { grid-template-columns: 1fr .8fr; gap: 35px; }
    .search-grid { grid-template-columns: repeat(3,1fr); }
    .search-grid .search-wide { grid-column: span 2; }
}
@media (max-width: 820px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: inline-flex; }
    .sidebar-overlay { position: fixed; inset: 0; z-index: 70; background: rgba(0,20,33,.55); }
    .sidebar-overlay.show { display: block; }
    .app-workspace { margin-left: 0; }
    .app-menu-button { display: inline-flex; margin-right: 12px; }
    .app-topbar { justify-content: flex-start; }
    .topbar-right { margin-left: auto; }
    .app-main { padding: 24px 18px 42px; }
    .app-footer { padding: 18px; }
    .public-header-inner { min-height: 68px; padding: 0 18px; }
    .mobile-nav-button { display: inline-flex; }
    .public-nav { display: none; position: absolute; left: 0; right: 0; top: 68px; padding: 18px; flex-direction: column; align-items: stretch; gap: 0; background: #fff; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
    .public-nav.open { display: flex; }
    .public-nav a { padding: 12px; }
    .public-hero-inner { min-height: auto; padding: 65px 20px; grid-template-columns: 1fr; }
    .hero-visual { min-height: 330px; }
    .public-section { padding: 64px 20px; }
    .feature-grid { grid-template-columns: 1fr; }
    .listing-grid { grid-template-columns: 1fr; }
    .public-footer-grid { grid-template-columns: 1fr; gap: 28px; }
    .section-heading { align-items: flex-start; flex-direction: column; }
    .form-grid, .form-grid.three { grid-template-columns: 1fr; }
    .field.full { grid-column: auto; }
    .record-grid { grid-template-columns: 1fr; }
    .resident-hero { grid-template-columns: 1fr; gap: 20px; }
    .resident-balance { padding: 18px 0 0; border-left: 0; border-top: 1px solid #2a526b; }
}
@media (max-width: 560px) {
    .brand-name { font-size: .88rem; }
    .public-hero h1 { font-size: 2.55rem; }
    .hero-visual { display: none; }
    .metrics-strip, .status-board { grid-template-columns: 1fr; }
    .metric, .status-cell { border-right: 0; border-bottom: 1px solid var(--line); }
    .metric:last-child, .status-cell:last-child { border-bottom: 0; }
    .payment-tiles { grid-template-columns: repeat(2,1fr); }
    .page-heading { flex-direction: column; }
    .page-actions, .page-actions .button { width: 100%; }
    .topbar-context span { display: none; }
    .topbar-help span { display: none; }
    .app-main { padding-left: 13px; padding-right: 13px; }
    .panel-body { padding: 14px; }
    .definition-list { grid-template-columns: 1fr; }
    .definition-list dt { padding-bottom: 2px; border: 0; }
    .definition-list dd { padding-top: 0; }
    .auth-shell { border-left: 0; border-right: 0; box-shadow: none; }
    .auth-head, .auth-body { padding-left: 22px; padding-right: 22px; }
    .search-grid { grid-template-columns: 1fr; }
    .search-grid .search-wide { grid-column: auto; }
    .public-footer-bottom { flex-direction: column; }
    .photo-grid { grid-template-columns: repeat(2,1fr); }
}

/* Branding and homepage media */
.brand-logo {
    display: block;
    width: auto;
    height: 40px;
    max-width: 220px;
    object-fit: contain;
}
.public-header .brand-logo-header { height: 39px; max-width: 220px; }
.brand-sidebar .brand-logo-sidebar { height: 31px; max-width: 174px; }
.brand-light .brand-logo-footer { height: 43px; max-width: 230px; }
.auth-brand { display: inline-flex; justify-content: center; width: 100%; }
.auth-head .brand-logo-login { height: 62px; max-width: 275px; margin: 0 auto; }

.hero-eyebrow { color: #54d5f2 !important; }
.hero-secondary-button { background: transparent; color: #fff; border-color: #fff; }
.hero-secondary-button:hover { background: #fff; color: var(--navy-950); border-color: #fff; }
.public-hero.has-media {
    position: relative;
    isolation: isolate;
    min-height: 650px;
    background: var(--navy-950);
}
.public-hero.has-media .public-hero-inner {
    position: relative;
    z-index: 3;
    min-height: 650px;
    grid-template-columns: minmax(0, 730px);
}
.public-hero.has-media .hero-copy { max-width: 730px; }
.hero-background-image,
.hero-background-video,
.hero-background-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.hero-background-image {
    z-index: 0;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
}
.hero-background-video {
    z-index: 1;
    object-fit: cover;
    object-position: center center;
    pointer-events: none;
}
.hero-video-fallback { z-index: 0; }
.hero-background-overlay {
    z-index: 2;
    background: linear-gradient(90deg, rgba(3,37,59,.97) 0%, rgba(3,37,59,.91) 36%, rgba(3,37,59,.64) 65%, rgba(3,37,59,.34) 100%);
    pointer-events: none;
}
.public-hero.hero-position-left .hero-background-image { background-position: left center; }
.public-hero.hero-position-right .hero-background-image { background-position: right center; }
.public-hero.hero-position-left .hero-background-video { object-position: left center; }
.public-hero.hero-position-right .hero-background-video { object-position: right center; }

.branding-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(330px, .75fr);
    gap: 22px;
    align-items: start;
}
.branding-sticky-panel { position: sticky; top: 98px; }
.branding-logo-preview-grid,
.branding-upload-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.branding-logo-preview-grid { margin-bottom: 22px; }
.branding-logo-preview {
    position: relative;
    min-height: 170px;
    display: grid;
    place-items: center;
    padding: 36px 22px 24px;
    border: 1px solid var(--line-dark);
    overflow: hidden;
}
.branding-logo-preview-light { background: #fff; }
.branding-logo-preview-dark { background: var(--navy-950); color: #fff; }
.branding-logo-preview img { width: auto; max-width: 85%; max-height: 82px; object-fit: contain; }
.branding-preview-label {
    position: absolute;
    top: 11px;
    left: 13px;
    color: var(--muted);
    font-size: .66rem;
    font-weight: 900;
    letter-spacing: .07em;
    text-transform: uppercase;
}
.branding-logo-preview-dark .branding-preview-label { color: #a9c4d3; }
.branding-fallback-logo { display: flex; align-items: center; gap: 10px; }
.branding-logo-preview-dark .branding-fallback-logo strong { color: #fff; }
.branding-upload-card {
    padding: 18px;
    border: 1px solid var(--line-dark);
    background: var(--surface-2);
}
.branding-upload-card.compact { padding: 15px; background: #fff; }
.branding-upload-card h3 { margin-bottom: 5px; }
.branding-upload-card > p { margin-bottom: 13px; color: var(--muted); font-size: .8rem; }
.branding-upload-card input[type="file"] {
    display: block;
    width: 100%;
    min-height: 43px;
    padding: 8px;
    border: 1px dashed var(--blue-600);
    background: #fff;
    color: var(--text);
    font-size: .76rem;
}
.branding-upload-card input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 7px 10px;
    border: 0;
    background: var(--surface-3);
    color: var(--navy-900);
    font-weight: 800;
    cursor: pointer;
}
.branding-delete-form { margin-top: 12px; }
.branding-reset-form { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.branding-hero-preview {
    position: relative;
    min-height: 220px;
    margin-bottom: 18px;
    overflow: hidden;
    background: var(--navy-950);
    border: 1px solid var(--line-dark);
}
.branding-hero-preview > img,
.branding-hero-preview > video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.branding-hero-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(3,37,59,.96), rgba(3,37,59,.42));
}
.branding-hero-copy {
    position: absolute;
    z-index: 2;
    left: 20px;
    right: 20px;
    bottom: 20px;
    color: #fff;
}
.branding-hero-copy small {
    display: block;
    margin-bottom: 5px;
    color: #54d5f2;
    font-size: .62rem;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.branding-hero-copy strong { display: block; max-width: 300px; color: #fff; font-size: 1.35rem; line-height: 1.08; }
.branding-hero-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    gap: 5px;
    padding: 28px;
    color: #fff;
    text-align: center;
}
.branding-hero-empty strong { color: #fff; }
.branding-hero-empty span { color: #bdd1dc; font-size: .8rem; }
.branding-media-stack { display: grid; gap: 12px; }
.branding-upload-note { margin: 18px -19px -19px; border-top: 1px solid #bce9f4; border-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
    .public-hero .hero-background-video { display: none; }
    .branding-hero-preview video { animation: none; }
}

@media (max-width: 1100px) {
    .branding-layout { grid-template-columns: 1fr; }
    .branding-sticky-panel { position: static; }
}

@media (max-width: 820px) {
    .public-hero.has-media,
    .public-hero.has-media .public-hero-inner { min-height: 570px; }
    .hero-background-overlay { background: linear-gradient(90deg, rgba(3,37,59,.97), rgba(3,37,59,.70)); }
    .branding-logo-preview-grid,
    .branding-upload-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .public-header .brand-logo-header { height: 33px; max-width: 180px; }
    .brand-sidebar .brand-logo-sidebar { height: 29px; max-width: 160px; }
    .auth-head .brand-logo-login { height: 52px; max-width: 230px; }
    .public-hero.has-media,
    .public-hero.has-media .public-hero-inner { min-height: 535px; }
    .hero-background-overlay { background: linear-gradient(90deg, rgba(3,37,59,.98), rgba(3,37,59,.78)); }
    .branding-hero-preview { min-height: 190px; }
}
