:root {
  color-scheme: light;
  --ink: #102a2c;
  --muted: #667878;
  --line: #dfe8e5;
  --surface: #ffffff;
  --canvas: #f3f7f5;
  --navy: #0c2c30;
  --navy-2: #153d3f;
  --mint: #22c7a1;
  --mint-soft: #daf7ef;
  --coral: #ff715b;
  --amber: #f0a83b;
  --shadow: 0 24px 70px rgba(12, 44, 48, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 12px; font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.eyebrow.accent { color: #0c9479; }
.muted { color: var(--muted); }

.loading-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 16px; background: var(--navy); color: #d7e9e6; }
.loader-mark { display: flex; align-items: end; gap: 5px; height: 34px; }
.loader-mark span { display: block; width: 9px; border-radius: 7px; background: var(--mint); animation: pulse 1s ease-in-out infinite; }
.loader-mark span:nth-child(1) { height: 17px; }
.loader-mark span:nth-child(2) { height: 31px; animation-delay: .14s; }
.loader-mark span:nth-child(3) { height: 23px; animation-delay: .28s; }
@keyframes pulse { 50% { opacity: .35; transform: translateY(4px); } }

.login-view { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.15fr) minmax(420px, .85fr); }
.login-story { position: relative; overflow: hidden; min-height: 100vh; padding: 54px clamp(42px, 6vw, 92px); display: flex; flex-direction: column; justify-content: space-between; color: white; background: radial-gradient(circle at 84% 18%, rgba(34,199,161,.23), transparent 26%), linear-gradient(145deg, #092427, #113f42); }
.login-story::before, .login-story::after { content: ""; position: absolute; border: 1px solid rgba(100, 235, 207, .16); border-radius: 50%; }
.login-story::before { width: 560px; height: 560px; right: -230px; top: 5%; }
.login-story::after { width: 360px; height: 360px; left: -230px; bottom: -120px; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 20px; letter-spacing: .06em; }
.brand-light { color: white; }
.brand-symbol { width: 31px; height: 31px; display: inline-flex; align-items: end; justify-content: center; gap: 3px; padding: 6px; border-radius: 9px; background: var(--mint); }
.brand-symbol i { display: block; width: 4px; border-radius: 4px; background: var(--navy); }
.brand-symbol i:nth-child(1) { height: 9px; }.brand-symbol i:nth-child(2) { height: 18px; }.brand-symbol i:nth-child(3) { height: 13px; }
.story-copy { position: relative; z-index: 1; max-width: 720px; }
.story-copy h1 { margin: 0; max-width: 720px; font-size: clamp(46px, 5.5vw, 78px); line-height: .98; letter-spacing: -.055em; font-weight: 720; }
.story-copy h1 em { color: var(--mint); font-style: normal; }
.story-copy > p:last-child { max-width: 600px; margin: 28px 0 0; font-size: 18px; line-height: 1.65; color: #b9cfcc; }
.provider-strip { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; }
.provider-strip span { padding: 8px 12px; border: 1px solid rgba(255,255,255,.13); border-radius: 99px; color: #c7dad7; font-size: 12px; background: rgba(255,255,255,.045); }

.login-panel { padding: 50px; display: grid; place-items: center; background: #fbfdfc; }
.login-card { width: min(420px, 100%); display: grid; gap: 24px; }
.login-card h2 { margin: 0 0 8px; font-size: 38px; letter-spacing: -.04em; }
.login-card p { margin-top: 0; }
.mobile-brand { display: none; }
.field { display: grid; gap: 8px; font-size: 13px; font-weight: 720; }
.field input, .tenant-picker select { width: 100%; border: 1px solid #cfdad7; border-radius: 10px; padding: 14px 15px; color: var(--ink); background: white; outline: none; transition: border-color .2s, box-shadow .2s; }
.field input:focus, .tenant-picker select:focus { border-color: var(--mint); box-shadow: 0 0 0 4px rgba(34,199,161,.12); }
.password-field { position: relative; }
.password-field input { padding-right: 62px; }
.text-button { position: absolute; right: 8px; top: 7px; padding: 8px; border: 0; background: transparent; color: #0b8d74; font-weight: 750; }
.primary-button { min-height: 51px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border: 0; border-radius: 10px; color: white; background: var(--navy); font-weight: 750; box-shadow: 0 12px 25px rgba(12,44,48,.16); transition: transform .2s, background .2s; }
.primary-button:hover { transform: translateY(-1px); background: var(--navy-2); }
.primary-button:disabled { cursor: wait; opacity: .65; transform: none; }
.security-note { display: flex; align-items: center; justify-content: center; gap: 7px; color: #7c8d8b; font-size: 12px; }
.security-note span { color: var(--mint); font-size: 9px; }
.form-error { margin: -8px 0 !important; padding: 11px 13px; border-left: 3px solid var(--coral); background: #fff1ee; color: #9f3021; font-size: 13px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 20px 22px; display: flex; flex-direction: column; color: #d6e5e2; background: var(--navy); }
.sidebar .brand { padding: 0 10px 32px; }
.main-nav { display: grid; gap: 6px; }
.nav-item { width: 100%; padding: 12px 13px; display: flex; gap: 12px; align-items: center; border: 0; border-radius: 9px; color: #a9bfbc; background: transparent; text-align: left; font-weight: 650; }
.nav-item span { width: 21px; color: #75a09a; font-size: 18px; text-align: center; }
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,.08); }
.nav-item.active span { color: var(--mint); }
.sidebar-foot { margin-top: auto; display: grid; gap: 16px; }
.safe-mode { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 10px; background: rgba(34,199,161,.08); }
.safe-mode > span { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 5px rgba(34,199,161,.1); }
.safe-mode div { display: grid; gap: 2px; }.safe-mode b { color: #e5f3f0; font-size: 12px; }.safe-mode small { color: #86aaa4; font-size: 10px; }
.logout-button { padding: 10px; border: 1px solid rgba(255,255,255,.1); border-radius: 8px; color: #bcd0cd; background: transparent; }
.logout-button:hover { color: white; border-color: rgba(255,255,255,.25); }

.workspace { min-width: 0; }
.impersonation-banner { min-height: 42px; padding: 8px clamp(20px,4vw,48px); display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #503209; background: #fff2d9; border-bottom: 1px solid #efd49d; font-size: 13px; font-weight: 700; }
.impersonation-banner button { border: 0; border-bottom: 1px solid currentColor; color: #755019; background: transparent; font-weight: 750; }
.topbar { min-height: 104px; padding: 23px clamp(24px,4vw,52px); display: flex; align-items: center; justify-content: space-between; gap: 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar h2 { margin: 0; font-size: 27px; letter-spacing: -.035em; }
.topbar .eyebrow { margin-bottom: 6px; }
.topbar-actions { display: flex; align-items: center; gap: 22px; }
.tenant-picker { display: grid; gap: 3px; min-width: 180px; color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.tenant-picker select { padding: 8px 34px 8px 10px; font-size: 13px; text-transform: none; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip > span { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 50%; color: var(--navy); background: var(--mint-soft); font-size: 12px; font-weight: 850; }
.user-chip div { display: grid; gap: 2px; }.user-chip b { font-size: 13px; }.user-chip small { color: var(--muted); font-size: 11px; }
.content { padding: 35px clamp(24px,4vw,52px) 55px; }

.hero { margin-bottom: 27px; display: flex; align-items: end; justify-content: space-between; gap: 30px; }
.hero h3 { margin: 0 0 8px; font-size: clamp(27px,3vw,39px); letter-spacing: -.045em; }.hero p { margin: 0; color: var(--muted); line-height: 1.6; }
.status-pill { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid #bce9de; border-radius: 99px; color: #08755f; background: var(--mint-soft); font-size: 12px; font-weight: 800; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--mint); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(160px,1fr)); gap: 15px; margin-bottom: 28px; }
.metric-card { min-height: 132px; padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: 0 8px 24px rgba(12,44,48,.035); }
.metric-card .metric-label { color: var(--muted); font-size: 12px; font-weight: 700; }.metric-card strong { display: block; margin: 14px 0 4px; font-size: 30px; letter-spacing: -.04em; }.metric-card small { color: #879794; font-size: 11px; }
.metric-card.safe strong { color: #0b8f75; font-size: 19px; margin-top: 20px; }
.panel-grid { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(280px,.7fr); gap: 18px; }
.panel { border: 1px solid var(--line); border-radius: 13px; background: var(--surface); overflow: hidden; }
.panel-head { min-height: 66px; padding: 17px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 16px; }.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.panel-body { padding: 20px; }
.provider-list { display: grid; gap: 12px; }
.provider-row { padding: 14px 15px; display: flex; justify-content: space-between; align-items: center; gap: 15px; border: 1px solid var(--line); border-radius: 10px; }
.provider-row div { display: grid; gap: 3px; }.provider-row b { font-size: 13px; }.provider-row small { color: var(--muted); }
.tag { display: inline-flex; padding: 5px 8px; border-radius: 6px; background: #edf2f1; color: #5d6d6a; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.tag.on { color: #08765f; background: var(--mint-soft); }.tag.off { color: #8c641b; background: #fff2d9; }
.empty-state { min-height: 180px; padding: 28px; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--muted); }
.empty-state span { width: 48px; height: 48px; margin-bottom: 12px; display: grid; place-items: center; border-radius: 50%; color: #0d8c73; background: var(--mint-soft); font-size: 23px; }.empty-state h4 { margin: 0 0 7px; color: var(--ink); }.empty-state p { margin: 0; max-width: 380px; font-size: 13px; line-height: 1.5; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 11px 14px; color: #788986; background: #f8faf9; text-align: left; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
td { padding: 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.tenant-name { font-weight: 780; }.subtle { color: var(--muted); }
.reason-control { display: flex; gap: 7px; min-width: 330px; }.reason-control input { min-width: 210px; padding: 8px 9px; border: 1px solid #cfdbd8; border-radius: 7px; outline: none; }.reason-control input:focus { border-color: var(--mint); }
.small-button { padding: 8px 11px; border: 0; border-radius: 7px; color: white; background: var(--navy); font-size: 11px; font-weight: 750; white-space: nowrap; }.small-button:disabled { opacity: .55; cursor: wait; }
.coverage-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.coverage-item { padding: 12px; border-radius: 9px; background: #f5f8f7; }.coverage-item b { display: block; font-size: 12px; }.coverage-item small { color: var(--muted); font-size: 10px; }
.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; max-width: 390px; padding: 13px 16px; border-radius: 9px; color: white; background: var(--navy); box-shadow: var(--shadow); font-size: 13px; }
.toast.error { background: #9f3021; }
.unit-metrics .latest-report { font-size: 17px; line-height: 1.25; }
.unit-layout { display: grid; grid-template-columns: minmax(420px, 1.1fr) minmax(520px, 1fr); gap: 18px; }
.map-panel { min-height: 600px; }
.units-map { width: 100%; height: 534px; background: #dfe8e5; }
.unit-table-panel { min-width: 0; max-height: 600px; }
.unit-table-wrap { max-height: 533px; overflow: auto; }
.unit-table-wrap th { position: sticky; z-index: 2; top: 0; }
#units-table tbody tr { cursor: pointer; transition: background .15s; }
#units-table tbody tr:hover, #units-table tbody tr:focus { outline: none; background: #eff8f5; }
#units-table .empty-table-row { cursor: default; }
#units-table .empty-table-row:hover { background: transparent; }
#units-table .empty-table-row td { padding: 0; }
.unit-place { min-width: 180px; max-width: 280px; }
.unit-marker-wrap { background: transparent; border: 0; }
.unit-marker { width: 20px; height: 20px; display: block; border: 4px solid white; border-radius: 50% 50% 50% 0; background: var(--amber); box-shadow: 0 3px 9px rgba(12,44,48,.35); transform: rotate(-45deg); }
.unit-marker.on { background: var(--mint); }
.leaflet-popup-content { color: var(--ink); line-height: 1.5; }

@media (max-width: 1000px) {
  .metric-grid { grid-template-columns: repeat(2,1fr); }
  .panel-grid { grid-template-columns: 1fr; }
  .login-view { grid-template-columns: 1fr 1fr; }
  .login-story { padding: 42px; }.story-copy h1 { font-size: 48px; }
  .unit-layout { grid-template-columns: 1fr; }.map-panel { min-height: 500px; }.units-map { height: 434px; }.unit-table-panel { max-height: none; }
}
@media (max-width: 760px) {
  .login-view { display: block; background: #fbfdfc; }.login-story { display: none; }.login-panel { min-height: 100vh; padding: 28px; }.mobile-brand { display: flex; margin-bottom: 20px; }
  .app-shell { display: block; padding-bottom: 68px; }.sidebar { position: fixed; z-index: 10; top: auto; bottom: 0; width: 100%; height: 68px; padding: 8px; display: block; }.sidebar > .brand, .sidebar-foot { display: none; }.main-nav { height: 100%; display: flex; justify-content: space-around; }.nav-item { width: auto; min-width: 64px; padding: 7px; display: grid; justify-items: center; gap: 2px; font-size: 9px; }.nav-item span { font-size: 17px; }
  .topbar { min-height: 90px; padding: 18px 20px; align-items: start; }.topbar-actions { gap: 10px; }.user-chip div { display: none; }.tenant-picker { min-width: 128px; }.content { padding: 25px 18px 40px; }.hero { align-items: start; flex-direction: column; gap: 14px; }.metric-grid { grid-template-columns: 1fr 1fr; }.metric-card { min-height: 115px; padding: 16px; }.metric-card strong { font-size: 25px; }.reason-control { min-width: 280px; flex-direction: column; }.impersonation-banner { padding: 8px 18px; }
  .map-panel { min-height: 430px; }.units-map { height: 364px; }
}
@media (max-width: 430px) { .metric-grid { grid-template-columns: 1fr; } .topbar h2 { font-size: 22px; } }
