/* ===========================================================
   Storage Hero — KPI dashboard styles
   Mobile-first, system fonts for instant load.
   =========================================================== */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e8ecf1;
  --line-strong: #d7dde6;
  --ink: #0e1726;
  --ink-2: #475569;
  --ink-3: #8a97a8;
  --accent: #0e1726;
  --accent-ink: #ffffff;
  --pos: #1f9d57;
  --pos-soft: #e4f5ea;
  --neg: #e23b3b;
  --neg-soft: #fde6e6;
  --warn: #f59a0b;
  --amber: #f5a623;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 6px 20px rgba(16,24,40,.05);
  --shadow-lg: 0 12px 40px rgba(16,24,40,.12);
  --radius: 18px;
  --radius-sm: 12px;

  --c-broadwater: #2f6df0;
  --c-lakehelena: #e23b3b;
  --c-riverview: #1f9d57;
  --c-lakeview: #f59a0b;
  --c-portfolio: #0e1726;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  --num: "Segoe UI", system-ui, -apple-system, sans-serif;
}
html[data-theme="dark"] {
  --bg: #0b0f16;
  --surface: #141a24;
  --surface-2: #10151d;
  --line: #232c39;
  --line-strong: #2c3645;
  --ink: #eef2f7;
  --ink-2: #a7b3c2;
  --ink-3: #6b7787;
  --accent: #eef2f7;
  --accent-ink: #0b0f16;
  --pos-soft: #11271c;
  --neg-soft: #2a1414;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "tnum" 1, "cv01" 1;
  line-height: 1.45;
  padding-bottom: 48px;
}
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.app-header { position: sticky; }
.app-header__row {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand__mark {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  object-fit: cover; display: block;
}
.brand__name { font-weight: 750; font-size: 16px; letter-spacing: -.3px; white-space: nowrap; }
.brand__sub { font-size: 11px; color: var(--ink-3); font-weight: 600; letter-spacing: .02em; margin-top: -2px; }
@media (max-width: 600px) { .brand__text { display: none; } }
.header-spacer { flex: 1; }
/* header nav tabs (Dashboard / Revenue data) */
.nav-tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; position: absolute; left: 50%; transform: translateX(-50%); }
.nav-tabs a {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  font-size: 13px; font-weight: 650; color: var(--ink-2); padding: 6px 13px; border-radius: 8px;
  white-space: nowrap; transition: .15s;
}
.nav-tabs a:hover { color: var(--ink); }
.nav-tabs a.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.nav-tabs a svg { width: 15px; height: 15px; }
@media (max-width: 600px) { .nav-tabs a span { display: none; } .nav-tabs a { padding: 7px 10px; } }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); display: grid; place-items: center; cursor: pointer;
  transition: .15s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.icon-btn svg { width: 18px; height: 18px; }
.updated { font-size: 11.5px; color: var(--ink-3); font-weight: 600; white-space: nowrap; }

/* ---------- data source pill ---------- */
.data-pill {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink-2); font-family: inherit; font-weight: 650; font-size: 11.5px;
  padding: 6px 10px; border-radius: 999px; cursor: default; white-space: nowrap;
}
.data-pill__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
html[data-data-state="live"] .data-pill { color: var(--pos); border-color: color-mix(in srgb, var(--pos) 40%, var(--line-strong)); }
html[data-data-state="live"] .data-pill__dot { background: var(--pos); box-shadow: 0 0 0 3px var(--pos-soft); }
html[data-data-state="loading"] .data-pill__dot { background: var(--warn); animation: pulse 1s ease-in-out infinite; }
html[data-data-state="error"] .data-pill__dot { background: var(--neg); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
@media (max-width: 460px) { .data-pill { padding: 6px 8px; } #dataPillText { display: none; } }

/* ---------- filter bar (labeled pill rows) ---------- */
.filters {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.filters__inner { max-width: 1180px; margin: 0 auto; padding: 11px 16px; display: flex; flex-direction: column; gap: 8px; }
.filter-row { display: flex; align-items: center; gap: 12px; }
.filter-label {
  flex: none; width: 64px; font-size: 11px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-3); text-align: left;
}
.pills {
  display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
  padding: 2px; margin: -2px; flex: 1; min-width: 0;
}
.pills::-webkit-scrollbar { display: none; }
.pill {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 10px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink-2); font-family: inherit; font-weight: 650; font-size: 13px;
  transition: .14s; line-height: 1;
}
.pill:hover { color: var(--ink); border-color: var(--ink-3); }
.pill__dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
/* location pills: text + outline in the property color; filled when active */
.pill[data-color] { color: var(--pill-c); border-color: color-mix(in srgb, var(--pill-c) 55%, var(--line-strong)); }
.pill[data-color]:hover { color: var(--pill-c); border-color: var(--pill-c); }
/* generic active = amber (period / metric) */
.pill.is-active {
  background: var(--amber); border-color: var(--amber); color: #1c1407; font-weight: 750;
}
/* location active: fill with the location color */
.pill[data-color].is-active {
  background: var(--pill-c); border-color: var(--pill-c);
  color: #fff; font-weight: 750;
}
.est-tag {
  display: inline-block; font-size: 9.5px; font-weight: 800; letter-spacing: .08em;
  color: var(--ink-3); background: var(--surface-2); border: 1px solid var(--line);
  padding: 1px 5px; border-radius: 5px; vertical-align: middle; margin-left: 4px;
}
.metric-group { display: block; }
@media (max-width: 560px) {
  .filter-label { width: 100%; margin-bottom: -2px; }
  .filter-row { flex-direction: column; align-items: stretch; gap: 5px; }
}

/* ---------- layout ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 16px; }
.section-label {
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); margin: 26px 4px 12px;
}
.section-label:first-child { margin-top: 6px; }
.live-tag { display: inline-block; font-size: 9.5px; font-weight: 800; letter-spacing: .08em; color: var(--pos); background: var(--pos-soft); padding: 2px 6px; border-radius: 5px; vertical-align: middle; margin-left: 4px; }
.pay-note { font-size: 12px; color: var(--ink-3); font-weight: 600; margin: -6px 4px 12px; line-height: 1.5; }
.charges-load { display: flex; align-items: center; gap: 10px; padding: 28px 4px; color: var(--ink-2); font-weight: 650; font-size: 14px; justify-content: center; }
.charges-load small { color: var(--ink-3); font-weight: 600; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- property meta strip ---------- */
.prop-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin: 2px 4px 14px; }
.prop-meta__name { font-size: 20px; font-weight: 780; letter-spacing: -.5px; display: flex; align-items: center; gap: 9px; }
.prop-meta__name .dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.prop-meta__facts { display: flex; flex-wrap: wrap; gap: 6px 8px; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.prop-meta__facts span { white-space: nowrap; }
.prop-meta__facts span + span::before { content: "·"; margin-right: 8px; color: var(--line-strong); }

/* ---------- KPI cards ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 14px 12px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  min-height: 132px; display: flex; flex-direction: column;
}
.kpi__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi__label { font-size: 12.5px; color: var(--ink-2); font-weight: 650; }
.kpi__icon { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.kpi__icon svg { width: 15px; height: 15px; }
.kpi__value { font-size: 30px; font-weight: 780; letter-spacing: -1px; margin-top: 9px; line-height: 1; }
.kpi__value .unit { font-size: 16px; font-weight: 650; color: var(--ink-3); letter-spacing: 0; margin-left: 1px; }
.kpi__sub { font-size: 11.5px; color: var(--ink-3); font-weight: 600; margin-top: 3px; }
.kpi__foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 10px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 720; padding: 2px 7px 2px 5px; border-radius: 999px; }
.delta svg { width: 12px; height: 12px; }
.delta.pos { color: var(--pos); background: var(--pos-soft); }
.delta.neg { color: var(--neg); background: var(--neg-soft); }
.delta.flat { color: var(--ink-3); background: var(--surface-2); }
.kpi__spark { width: 78px; height: 30px; flex: none; }

/* ---------- chart cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px;
}
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 4px; position: relative; }
.mini-toggle.centered { position: absolute; left: 50%; transform: translateX(-50%); top: -2px; }
.card__title { font-size: 15px; font-weight: 720; letter-spacing: -.2px; }
.card__meta { font-size: 12px; color: var(--ink-3); font-weight: 600; margin-top: 1px; }
.card__value { font-size: 19px; font-weight: 760; letter-spacing: -.4px; text-align: right; }
.card__value small { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-3); letter-spacing: 0; }

.legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 12px; }
.legend__item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); font-weight: 600; cursor: pointer; transition: .15s; }
.legend__item.off { opacity: .35; }
.legend__swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.legend__swatch.line { height: 4px; width: 16px; border-radius: 3px; }

.mini-toggle { display: inline-flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.mini-toggle button { border: 0; background: transparent; color: var(--ink-2); font-family: inherit; font-weight: 650; font-size: 11.5px; padding: 4px 9px; border-radius: 7px; cursor: pointer; transition: .15s; }
.mini-toggle button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* chart footer: bottom-left control + right legend (forecast card) */
.chart-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px 18px; flex-wrap: wrap; margin-top: 14px; }
.chart-foot .legend { margin-top: 0; }
.foot-ctrl { display: inline-flex; align-items: center; gap: 8px; }
.foot-ctrl__label { font-size: 12px; font-weight: 650; color: var(--ink-2); }

svg.chart { display: block; width: 100%; height: auto; overflow: visible; }
.grid-line { stroke: var(--line); stroke-width: 1; }
.axis-text { fill: var(--ink-3); font-size: 10px; font-weight: 600; font-family: var(--font); }
.tip {
  position: fixed; z-index: 60; pointer-events: none; opacity: 0; transform: translateY(4px);
  transition: opacity .12s; background: var(--ink); color: var(--bg);
  border-radius: 10px; padding: 9px 11px; font-size: 12px; font-weight: 600;
  box-shadow: var(--shadow-lg); max-width: 220px;
}
html[data-theme="dark"] .tip { background: #f8fafc; color: #0b0f16; }
.tip b { font-weight: 750; }
.tip .tip-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; white-space: nowrap; }
.tip .tip-row + .tip-row { margin-top: 3px; }
.tip .tip-k { display: inline-flex; align-items: center; gap: 6px; opacity: .85; }
.tip .tip-dot { width: 8px; height: 8px; border-radius: 50%; }
.tip .tip-title { font-weight: 750; margin-bottom: 5px; }
.tip .tip-total { margin-top: 5px; padding-top: 5px; border-top: 1px solid color-mix(in srgb, currentColor 22%, transparent); }
.tip .tip-total .tip-k { opacity: 1; font-weight: 700; }

/* ---------- donut / mix ---------- */
.mix-wrap { display: flex; align-items: center; gap: 18px; }
.mix-legend { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.mix-row { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.mix-row .sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.mix-row .nm { color: var(--ink-2); font-weight: 600; flex: 1; }
.mix-row .vl { font-weight: 740; }

/* ---------- comparison table ---------- */
.cmp { display: flex; flex-direction: column; gap: 9px; }
.cmp-row {
  display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 11px;
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 13px;
  background: var(--surface); cursor: pointer; transition: .15s;
}
.cmp-row:hover { border-color: var(--line-strong); transform: translateY(-1px); box-shadow: var(--shadow); }
.cmp-rank { font-size: 12px; font-weight: 750; color: var(--ink-3); text-align: center; }
.cmp-main { min-width: 0; }
.cmp-name { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.cmp-name .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.cmp-bar { height: 6px; border-radius: 999px; background: var(--surface-2); margin-top: 7px; overflow: hidden; }
.cmp-bar > span { display: block; height: 100%; border-radius: 999px; }
.cmp-sub { font-size: 11.5px; color: var(--ink-3); font-weight: 600; margin-top: 5px; display: flex; gap: 12px; }
.cmp-side { text-align: right; }
.cmp-occ { font-size: 18px; font-weight: 770; letter-spacing: -.4px; }
.cmp-occ small { font-size: 11px; color: var(--ink-3); font-weight: 650; }

.foot-note { font-size: 11.5px; color: var(--ink-3); text-align: center; margin: 22px 8px 8px; line-height: 1.6; }
.foot-note b { color: var(--ink-2); font-weight: 700; }

/* ---------- responsive ---------- */
@media (min-width: 720px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .grid-2 .card { margin-bottom: 0; }
  .kpi__value { font-size: 32px; }
}
@media (min-width: 980px) {
  main { padding: 20px 16px 40px; }
}
.fade-in { animation: fade .35s ease both; }
@keyframes fade { from { transform: translateY(5px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ===========================================================
   Squared corners everywhere — no rounded rectangles.
   Genuinely circular indicators (dots, logo, spinner) stay round.
   =========================================================== */
*, *::before, *::after { border-radius: 0 !important; }
.brand__mark,
.data-pill__dot,
.pill__dot,
.prop-meta__name .dot,
.tip .tip-dot,
.spinner { border-radius: 50% !important; }
