:root {
    color-scheme: dark;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #08111f;
    color: #e8eef8;
    --surface: #101d2f;
    --surface-raised: #14243a;
    --border: #263a55;
    --muted: #8fa2bc;
    --primary: #56a3ff;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; background: radial-gradient(circle at top left, #132c4c 0, #08111f 42rem); }

a { color: inherit; }

button, input { font: inherit; }

.app-shell { min-height: 100vh; }

.topbar {
    min-height: 72px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(143, 162, 188, .18);
    background: rgba(8, 17, 31, .78);
    backdrop-filter: blur(18px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand > span:last-child { display: grid; gap: 2px; }
.brand small { color: var(--muted); font-size: 12px; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, #56a3ff, #7857ff); font-weight: 800; }
.topbar-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #48d597; box-shadow: 0 0 0 4px rgba(72, 213, 151, .12); }
.topbar-actions { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 13px; }
.topbar-actions a { color: #c9def8; font-weight: 700; text-decoration: none; }
.topbar-actions form { margin: 0; }
.account-name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-button { padding: 7px 11px; color: #dce9f8; border: 1px solid var(--border); border-radius: 8px; background: #14243a; cursor: pointer; }

.main-content { width: min(1500px, 100%); margin: 0 auto; padding: 40px 32px 64px; }
.page-header { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 30px; }
.eyebrow { margin: 0 0 8px; color: #78b6ff; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(30px, 4vw, 46px); letter-spacing: -.04em; }
h2 { margin: 4px 0 0; font-size: 24px; }
h3 { margin: 0 0 8px; }
.page-description { margin: 10px 0 0; color: var(--muted); }

.date-filter { display: flex; align-items: end; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: rgba(16, 29, 47, .9); }
.date-filter label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.date-filter input { min-height: 40px; padding: 0 11px; color: #e8eef8; border: 1px solid var(--border); border-radius: 9px; background: #0b1727; }

.button { min-height: 40px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 9px; font-weight: 750; text-decoration: none; cursor: pointer; white-space: nowrap; }
.button:disabled { opacity: .55; cursor: wait; }
.button-primary { color: #07111f; background: #69b1ff; }
.button-secondary { min-height: 34px; color: #dbe9fb; border: 1px solid #385475; background: #172a42; font-size: 13px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.metric-card { min-height: 156px; padding: 22px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid rgba(255,255,255,.08); border-radius: 18px; box-shadow: 0 18px 40px rgba(0,0,0,.16); }
.metric-card strong { font-size: clamp(30px, 4vw, 44px); letter-spacing: -.04em; }
.metric-card small { color: rgba(255,255,255,.72); }
.metric-label { color: rgba(255,255,255,.86); font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.metric-card-blue { background: linear-gradient(145deg, #174a7c, #102a4a); }
.metric-card-green { background: linear-gradient(145deg, #17604b, #123c35); }
.metric-card-violet { background: linear-gradient(145deg, #513c8e, #30285e); }
.metric-card-gold { background: linear-gradient(145deg, #795824, #483719); }
.compact-metrics { margin-bottom: 24px; }
.compact-metrics .metric-card { min-height: 132px; }

.activity-strip { margin: 16px 0 28px; padding: 18px 22px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; border: 1px solid var(--border); border-radius: 16px; background: rgba(16, 29, 47, .84); }
.activity-strip div { display: grid; gap: 5px; }
.activity-strip span { color: var(--muted); font-size: 12px; }
.activity-strip strong { font-size: 19px; }

.property-panel { border: 1px solid var(--border); border-radius: 18px; overflow: hidden; background: rgba(16, 29, 47, .92); }
.section-heading { padding: 22px 24px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.freshness { color: var(--muted); font-size: 12px; }
.table-scroll { overflow-x: auto; }
.property-table { width: 100%; border-collapse: collapse; }
.property-table th { padding: 13px 16px; color: var(--muted); background: #0d1929; font-size: 11px; letter-spacing: .06em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.property-table td { padding: 17px 16px; border-top: 1px solid rgba(38, 58, 85, .72); white-space: nowrap; }
.property-table tbody tr:hover { background: rgba(86, 163, 255, .04); }
.property-table tfoot th, .property-table tfoot td { padding: 17px 16px; border-top: 2px solid #52749b; color: #f2f7ff; background: #13243a; font-weight: 850; white-space: nowrap; }
.property-table td:first-child { display: grid; gap: 3px; white-space: normal; }
.property-table td:first-child small { color: var(--muted); }
.occupancy-pill { padding: 5px 9px; border-radius: 999px; color: #9ff2cf; background: rgba(72, 213, 151, .12); font-weight: 800; }
.occupancy-pill.performance-low { color:#ffd1d8; background:rgba(211,77,100,.18); }
.occupancy-pill.performance-high { color:#b7f7d9; background:rgba(72,213,151,.2); box-shadow:inset 0 0 0 1px rgba(72,213,151,.24); }
.comparison-panel { margin-top:24px; }
.secondary-report { margin-top:20px; }
.comparison-table { min-width: 1450px; }
.comparison-table th:first-child, .comparison-table td:first-child { position:sticky; left:0; z-index:2; min-width:205px; background:#101d2f; box-shadow:8px 0 14px rgba(4,10,18,.16); }
.comparison-table thead th:first-child { z-index:4; background:#0d1929; }
.comparison-table tfoot th:first-child { z-index:3; background:#13243a; }
.comparison-table .primary-value { color:#fff; font-weight:850; }
.drill-link { display:grid; gap:4px; color:inherit; text-decoration:none; }
.drill-link:hover strong { color:#8fc4ff; text-decoration:underline; }
.drill-link small { color:var(--muted); font-size:11px; }
.report-breadcrumb { margin:-12px 0 20px; display:flex; align-items:center; gap:9px; color:var(--muted); font-size:13px; }
.report-breadcrumb a { color:#9dc8ff; text-decoration:none; }
.report-breadcrumb a:hover { text-decoration:underline; }
.sync-badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.sync-live { color: #9ff2cf; background: rgba(72, 213, 151, .12); }
.sync-delayed { color: #ffe3a2; background: rgba(212, 159, 51, .16); }
.sync-offline { color: #ffd1d8; background: rgba(211, 77, 100, .18); }
.sync-current { color: #9ff2cf; background: rgba(72, 213, 151, .12); }
.sync-behind { color: #ffe3a2; background: rgba(212, 159, 51, .16); }
.sync-unreachable, .sync-needs-setup { color: #ffd1d8; background: rgba(211, 77, 100, .18); }
.sync-time { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.sync-actions { display: flex; align-items: center; gap: 10px; }
.sync-table td { vertical-align: middle; }
.sync-table td:first-child { min-width: 190px; }
.sync-error { max-width: 280px; overflow: hidden; text-overflow: ellipsis; color: #ffb9c4; }

.alert { margin-bottom: 20px; padding: 15px 18px; display: grid; gap: 4px; border: 1px solid #8a3f4d; border-radius: 12px; color: #ffd9df; background: rgba(113, 33, 48, .4); }
.success-alert { margin-bottom: 20px; padding: 15px 18px; border: 1px solid #28785c; border-radius: 12px; color: #bff7df; background: rgba(25, 100, 73, .35); }
.loading-state, .empty-state { min-height: 300px; padding: 48px; display: grid; place-items: center; align-content: center; gap: 12px; color: var(--muted); text-align: center; }
.loading-ring { width: 38px; height: 38px; border: 3px solid #28415f; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.auth-page { min-height: calc(100vh - 160px); display: grid; place-items: center; padding: 40px 16px; }
.auth-card { width: min(440px, 100%); padding: 34px; border: 1px solid var(--border); border-radius: 22px; background: rgba(16, 29, 47, .94); box-shadow: 0 28px 80px rgba(0,0,0,.32); }
.auth-brand { width: 52px; height: 52px; margin-bottom: 24px; display: grid; place-items: center; border-radius: 15px; background: linear-gradient(135deg, #56a3ff, #7857ff); font-weight: 850; }
.auth-card h1 { font-size: 34px; }
.auth-description { margin: 10px 0 24px; color: var(--muted); }
.auth-form { display: grid; gap: 17px; }
.auth-form > label:not(.remember-option) { display: grid; gap: 7px; color: #cbd8e8; font-size: 13px; font-weight: 700; }
.auth-form input[type="email"], .auth-form input[type="password"] { width: 100%; min-height: 46px; padding: 0 13px; color: #eef5ff; border: 1px solid var(--border); border-radius: 10px; background: #0b1727; }
.remember-option { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }

.access-panel { border: 1px solid var(--border); border-radius: 18px; overflow: hidden; background: rgba(16, 29, 47, .92); }
.access-user-picker { padding: 22px 24px; display: grid; grid-template-columns: minmax(150px, 220px) minmax(260px, 500px); align-items: center; gap: 9px 18px; border-bottom: 1px solid var(--border); }
.access-user-picker label { color: #d9e6f7; font-weight: 800; }
.access-user-picker select { min-height: 44px; padding: 0 12px; color: #e8eef8; border: 1px solid var(--border); border-radius: 10px; background: #0b1727; }
.access-user-picker p { grid-column: 2; margin: 0; color: var(--muted); font-size: 12px; }
.access-list { display: grid; }
.access-option { min-height: 72px; padding: 15px 24px; display: grid; grid-template-columns: 22px minmax(180px, 1fr) auto; align-items: center; gap: 14px; border-bottom: 1px solid rgba(38, 58, 85, .72); cursor: pointer; }
.access-option:hover { background: rgba(86, 163, 255, .04); }
.access-option input { width: 18px; height: 18px; accent-color: #56a3ff; }
.access-option > span { display: grid; gap: 3px; }
.access-option small, .access-option em { color: var(--muted); font-size: 12px; }
.access-option em { font-style: normal; }
.access-actions { padding: 20px 24px; display: flex; justify-content: flex-end; }
.compact-loading { min-height: 220px; }

.property-admin-grid { display: grid; grid-template-columns: minmax(300px, .8fr) minmax(520px, 1.4fr); gap: 20px; align-items: start; }
.configuration-layout { display:grid; grid-template-columns:minmax(250px,.55fr) minmax(620px,1.45fr); gap:20px; align-items:start; }
.configuration-profile-card { width:100%; border:1px solid transparent; border-radius:12px; padding:14px; background:transparent; color:inherit; text-align:left; cursor:pointer; display:grid; gap:4px; }
.configuration-profile-card:hover,.configuration-profile-card.selected { border-color:var(--line); background:rgba(255,255,255,.04); }
.configuration-profile-card small,.configuration-profile-card span,.configuration-section small,.configuration-item small,.assignment-item small { color:var(--muted); }
.configuration-profile-card span { font-size:12px; }
.configuration-section { border-top:1px solid var(--line); margin-top:24px; padding-top:22px; }
.configuration-section h3 { margin:0; }
.settings-grid,.configuration-grid { display:grid; grid-template-columns:repeat(3,minmax(150px,1fr)); gap:12px; }
.settings-grid label,.configuration-item { display:grid; gap:7px; }
.configuration-item { padding:14px; border:1px solid var(--line); border-radius:12px; background:rgba(255,255,255,.025); align-content:start; }
.fee-tags { display:grid; gap:5px; margin-top:6px; font-size:12px; }
.assignment-grid { display:grid; grid-template-columns:repeat(2,minmax(220px,1fr)); gap:10px; }
.assignment-item { display:flex; gap:10px; padding:12px; border:1px solid var(--line); border-radius:10px; }
.assignment-item span { display:grid; gap:3px; }
.property-registry-panel, .property-editor-panel { border: 1px solid var(--border); border-radius: 18px; overflow: hidden; background: rgba(16, 29, 47, .92); }
.property-registry-list { display: grid; }
.property-registry-item { width: 100%; padding: 17px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #e8eef8; border-top: 1px solid rgba(38, 58, 85, .72); background: transparent; text-align: left; }
.property-registry-item:hover, .property-registry-item.selected { background: rgba(86, 163, 255, .08); }
.property-registry-item.selected { box-shadow: inset 3px 0 #56a3ff; }
.property-registry-selection { min-width: 0; display: grid; flex: 1; gap: 4px; padding: 0; color: inherit; border: 0; background: transparent; text-align: left; cursor: pointer; }
.property-registry-item small { color: var(--muted); }
.property-registry-item em { font-style: normal; }
.property-registry-actions { display: flex; align-items: center; gap: 10px; }
.button-link { padding: 3px; color: #9dc8ff; border: 0; background: transparent; font: inherit; font-size: 12px; font-weight: 750; cursor: pointer; }
.button-link:hover { color: #d7eaff; text-decoration: underline; }
.button-link-danger { color: #ff9bac; }
.button-link-danger:hover { color: #ffd1d8; }
.button-danger { color:#ffdbe1; background:rgba(211,77,100,.16); border-color:rgba(255,125,146,.45); }
.button-danger:hover { color:#fff; background:rgba(211,77,100,.28); border-color:#ff8da0; }
.validation-badge { padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.validation-valid { color: #9ff2cf; background: rgba(72, 213, 151, .12); }
.validation-invalid { color: #ffd1d8; background: rgba(211, 77, 100, .18); }
.validation-pending { color: #ffe3a2; background: rgba(212, 159, 51, .16); }
.property-form-grid { padding: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.property-form-grid label { display: grid; align-content: start; gap: 7px; color: #cbd8e8; font-size: 13px; font-weight: 750; }
.property-form-grid input[type="text"], .property-form-grid input[type="url"], .property-form-grid input[type="password"] { width: 100%; min-height: 44px; padding: 0 12px; color: #eef5ff; border: 1px solid var(--border); border-radius: 10px; background: #0b1727; }
.property-form-grid label > small { color: var(--muted); font-size: 11px; font-weight: 500; }
.property-form-grid .wide-field { grid-column: 1 / -1; }
.property-form-grid .toggle-field { display: flex; flex-direction: row; align-items: center; gap: 9px; }
.property-form-grid .toggle-field input { width: 18px; height: 18px; accent-color: #56a3ff; }
.validation-message { margin: 0 24px; padding: 14px 16px; display: grid; gap: 4px; color: #cddbf0; border: 1px solid var(--border); border-radius: 10px; background: #0d1929; }
.validation-message span, .validation-message small { color: var(--muted); }
.property-form-actions { padding: 20px 24px 24px; display: flex; justify-content: flex-end; gap: 10px; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1050px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .activity-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    .topbar { padding: 0 18px; }
    .account-name { display: none; }
    .main-content { padding: 28px 16px 48px; }
    .page-header { align-items: stretch; flex-direction: column; }
    .date-filter { display: grid; grid-template-columns: 1fr 1fr; }
    .date-filter .button { grid-column: 1 / -1; }
    .metric-grid { grid-template-columns: 1fr; }
    .activity-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .section-heading { align-items: start; flex-direction: column; gap: 12px; }
    .access-user-picker { grid-template-columns: 1fr; }
    .access-user-picker p { grid-column: 1; }
    .access-option { grid-template-columns: 22px 1fr; }
    .access-option em { grid-column: 2; }
    .property-admin-grid { grid-template-columns: 1fr; }
    .configuration-layout { grid-template-columns:1fr; }
    .settings-grid,.configuration-grid,.assignment-grid { grid-template-columns:1fr; }
    .property-form-grid { grid-template-columns: 1fr; }
    .property-form-grid .wide-field { grid-column: 1; }
}
