/* Supervision BETI: the design system.
   Tokens first, then the shell, then components, then page-specific pieces.
   Series colours follow the dataviz reference palette, validated for adjacent pairs in
   both themes; status colours are reserved and always come with an icon and a label. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../vendor/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../vendor/fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --surface-3: #f1f3f5;
  --hover: #f3f4f6;
  --border: #e5e7eb;
  --border-2: #d6d9df;
  --ring: rgba(132, 187, 39, .35);
  --text: #15171c;
  --text-2: #4a505b;
  --text-3: #7d8490;
  --text-4: #a3a9b3;

  --brand: #84bb27;
  --brand-600: #6f9f1d;
  --brand-ink: #4c7a0b;
  --brand-soft: #f0f7e3;
  --brand-dark: #121417;

  /* status: reserved, never a series */
  --ok: #0ca30c;      --ok-ink: #11761a;   --ok-soft: #e9f6ea;
  --warn: #fab219;    --warn-ink: #8a5a00; --warn-soft: #fff5dd;
  --serious: #ec835a; --serious-ink: #a8431b; --serious-soft: #fdeee7;
  --crit: #d03b3b;    --crit-ink: #b02828; --crit-soft: #fdeceb;
  --off: #8b93a0;     --off-ink: #555c68;  --off-soft: #eff1f4;
  --info: #2a78d6;    --info-ink: #1b5aa6; --info-soft: #eaf2fc;
  --violet: #6250d6;  --violet-ink: #4b3bb5; --violet-soft: #efedfc;

  /* series: dataviz reference slots, fixed per entity */
  --s-solar: #008300;
  --s-load: #2a78d6;
  --s-ge: #eb6834;
  --s-battery: #1baf7a;
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100;
  --c5: #e87ba4; --c6: #008300; --c7: #6250d6; --c8: #e34948;
  --grid: #eceef1;
  --axis: #9aa1ab;

  --r-xs: 4px; --r-sm: 6px; --r: 10px; --r-lg: 14px; --r-xl: 18px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18), 0 4px 8px -4px rgba(16, 24, 40, .08);
  --sidebar: 252px;
  --topbar: 52px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
}
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    --bg: #0f1012; --surface: #17181b; --surface-2: #1c1d21; --surface-3: #222328;
    --hover: #222429; --border: #2a2c31; --border-2: #363940;
    --text: #eceef1; --text-2: #b3b8c1; --text-3: #858b95; --text-4: #5f646d;
    --brand-ink: #a6d65a; --brand-soft: #1f2a12;
    --ok-ink: #5fd35f; --ok-soft: #12261488; --warn-ink: #fbc54d; --warn-soft: #33270b;
    --serious-ink: #f3a07f; --serious-soft: #35200f; --crit-ink: #f07373; --crit-soft: #351616;
    --off-ink: #a6adb8; --off-soft: #24262b; --info-ink: #7fb2f0; --info-soft: #14243a;
    --violet-ink: #aba2f2; --violet-soft: #221f3d;
    --s-load: #3987e5; --s-ge: #d95926; --s-battery: #199e70; --s-solar: #0f9a0f;
    --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500;
    --c5: #d55181; --c6: #0f9a0f; --c7: #9085e9; --c8: #e66767;
    --grid: #26282d; --axis: #6c727c;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 3px rgba(0, 0, 0, .45);
    --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  --bg: #0f1012; --surface: #17181b; --surface-2: #1c1d21; --surface-3: #222328;
  --hover: #222429; --border: #2a2c31; --border-2: #363940;
  --text: #eceef1; --text-2: #b3b8c1; --text-3: #858b95; --text-4: #5f646d;
  --brand-ink: #a6d65a; --brand-soft: #1f2a12;
  --ok-ink: #5fd35f; --ok-soft: #12261488; --warn-ink: #fbc54d; --warn-soft: #33270b;
  --serious-ink: #f3a07f; --serious-soft: #35200f; --crit-ink: #f07373; --crit-soft: #351616;
  --off-ink: #a6adb8; --off-soft: #24262b; --info-ink: #7fb2f0; --info-soft: #14243a;
  --violet-ink: #aba2f2; --violet-soft: #221f3d;
  --s-load: #3987e5; --s-ge: #d95926; --s-battery: #199e70; --s-solar: #0f9a0f;
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500;
  --c5: #d55181; --c6: #0f9a0f; --c7: #9085e9; --c8: #e66767;
  --grid: #26282d; --axis: #6c727c;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 3px rgba(0, 0, 0, .45);
  --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, .6);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 400 14px/1.45 var(--font);
  font-feature-settings: "cv11", "ss01", "tnum" 0; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--text); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
small { font-size: .78em; color: var(--text-3); font-weight: 500; margin-left: 1px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.i { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.i-sm { width: 14px; height: 14px; }
.i-lg { width: 20px; height: 20px; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--text-3); }
.muted-2 { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 0; }
.crit-ink { color: var(--crit-ink); }
.warn-ink { color: var(--warn-ink); }
.ok-ink { color: var(--ok-ink); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Shell ------------------------------------------------------------------------- */

.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.main, .content { min-width: 0; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 14px 10px 10px; gap: 6px; overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 10px; }
.brand img { height: 22px; width: auto; display: block; }
.brand .logo-dark { display: none; }
:root[data-theme="dark"] .brand .logo-light { display: none; }
:root[data-theme="dark"] .brand .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand .logo-light { display: none; }
  :root:not([data-theme="light"]) .brand .logo-dark { display: block; }
}
.brand .product { padding-left: 10px; border-left: 1px solid var(--border-2); font-size: 13px;
  font-weight: 500; color: var(--text-2); }

.scope {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r);
  border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm);
  margin-bottom: 6px;
}
.scope .sq { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-3);
  display: grid; place-items: center; color: var(--text-2); }
.scope b { display: block; font-size: 13px; font-weight: 600; }
.scope span { font-size: 12px; color: var(--text-3); }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  color: var(--text-2); font-weight: 500; font-size: 13.5px;
}
.nav a:hover { background: var(--hover); color: var(--text); }
.nav a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow);
  border: 1px solid var(--border); padding: 6px 9px; }
.nav a.active .i { color: var(--brand-600); }
.nav .count { margin-left: auto; font-size: 11px; font-weight: 600; min-width: 20px; height: 18px;
  padding: 0 6px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3);
  color: var(--text-2); }
.nav .count.crit { background: var(--crit); color: #fff; }

.side-head { display: flex; align-items: center; justify-content: space-between;
  padding: 14px 10px 4px; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.side-filter { margin: 2px 4px 6px; position: relative; }
.side-filter input { width: 100%; height: 30px; padding: 0 8px 0 28px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; }
.side-filter .i { position: absolute; left: 9px; top: 8px; width: 14px; height: 14px; color: var(--text-3); }
.site-list { overflow-y: auto; flex: 1; margin: 0 -4px; padding: 0 4px 8px; scrollbar-width: thin; }
.site-list .group { padding: 10px 10px 3px; font-size: 11px; color: var(--text-3); font-weight: 500;
  display: flex; justify-content: space-between; }
.site-list a { display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 7px;
  font-size: 13px; color: var(--text); }
.site-list a:hover { background: var(--hover); }
.site-list a.active { background: var(--surface); box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  padding: 3px 9px; }
.site-list a .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-list a .v { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.site-list a .id { font-size: 11px; color: var(--text-4); font-variant-numeric: tabular-nums; width: 36px; }

.me { margin-top: auto; border-top: 1px solid var(--border); padding: 10px 6px 2px; position: relative; }
.me button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 6px; border-radius: 8px; cursor: pointer; }
.me button:hover { background: var(--hover); }
.avatar { width: 30px; height: 30px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-ink);
  font-weight: 700; font-size: 12px; display: grid; place-items: center; flex: none; }
.me b { font-size: 13px; display: block; font-weight: 600; }
.me span { font-size: 11.5px; color: var(--text-3); }

.main {
  min-width: 0; margin: 8px 8px 8px 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm); display: flex; flex-direction: column;
  min-height: calc(100vh - 16px);
}
.topbar {
  height: var(--topbar); display: flex; align-items: center; gap: 10px; padding: 0 18px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(8px);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--text-3);
  min-width: 0; }
.crumbs a:hover { color: var(--text); }
.crumbs .i { width: 14px; height: 14px; color: var(--text-4); }
.crumbs b { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.searchbtn {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px 0 10px; min-width: 220px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-3);
  cursor: pointer; font-size: 13px;
}
.searchbtn:hover { border-color: var(--border-2); }
.searchbtn .kbd { margin-left: auto; }
.kbd { font: 500 11px var(--font); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border);
  color: var(--text-3); background: var(--surface-2); }
.live {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; border-radius: 16px;
  border: 1px solid var(--border); font-size: 12.5px; font-weight: 500; cursor: pointer; background: var(--surface);
}
.live .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); position: relative; }
.live .pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--ok); opacity: 0; animation: ping 2s cubic-bezier(0, 0, .2, 1) infinite; }
.live.paused .pulse { background: var(--off); }
.live.paused .pulse::after { display: none; }
@keyframes ping { 0% { transform: scale(.4); opacity: .6; } 80%, 100% { transform: scale(1.3); opacity: 0; } }
.btn.menu-toggle { display: none; }

.content { padding: 24px 28px 48px; width: 100%; max-width: 1480px; margin: 0 auto; }
.content.wide { max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 20px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 13px; color: var(--text-3); margin-bottom: 4px; }
.page-head h1 { font-size: 24px; letter-spacing: -.02em; }
.page-head .sub { color: var(--text-3); font-size: 13.5px; margin-top: 4px; display: flex; gap: 8px;
  flex-wrap: wrap; align-items: center; }
.sep-dot::before { content: "·"; color: var(--text-4); margin-right: 8px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Flash ------------------------------------------------------------------------------ */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r);
  margin-bottom: 16px; border: 1px solid; font-size: 13.5px; }
.flash.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok-ink); }
.flash.error { background: var(--crit-soft); border-color: color-mix(in srgb, var(--crit) 30%, transparent); color: var(--crit-ink); }
.flash.secret { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--text); }
.flash .x { margin-left: auto; cursor: pointer; opacity: .6; background: none; border: 0; padding: 0; }

/* Cards ------------------------------------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 8px 10px; padding: 14px 16px 0; flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 14.5px; font-weight: 600; }
.card-head .sub { font-size: 12px; color: var(--text-3); }
.card-head .tools { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card-body { padding: 14px 16px 16px; }
.card-body.flush { padding: 8px 0 0; }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-3);
  display: flex; align-items: center; gap: 8px; }
.card-foot a { color: var(--brand-ink); font-weight: 500; }
.card-title-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2); }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.g-main-l { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.mt { margin-top: 16px; }
.mt-l { margin-top: 24px; }
.section-title { font-size: 15px; font-weight: 600; margin: 28px 0 12px; display: flex; align-items: center; gap: 10px; }
.section-title .sub { font-weight: 400; font-size: 12.5px; color: var(--text-3); }

/* KPI strip --------------------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); border: 1px solid var(--border);
  border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.kpi { padding: 16px 18px 15px; border-left: 1px solid var(--border); min-width: 0; position: relative; }
.kpi:first-child { border-left: 0; }
.kpi .label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.kpi .label .tick { width: 3px; height: 12px; border-radius: 2px; background: var(--text-4); }
.kpi .value { font-size: 28px; font-weight: 600; letter-spacing: -.025em; margin-top: 8px; line-height: 1.1;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi .value small { font-size: 15px; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.kpi .value .of { font-size: 17px; color: var(--text-3); font-weight: 500; }
.kpi .foot { font-size: 12px; color: var(--text-3); margin-top: 8px; min-height: 17px; }
.kpi .foot b { color: var(--text-2); font-weight: 600; }
.kpi .foot .crit { color: var(--crit-ink); font-weight: 500; }
.kpi a.foot:hover { color: var(--text); }
.kpi .meter { height: 4px; border-radius: 3px; background: var(--surface-3); margin-top: 12px; overflow: hidden; display: flex; gap: 2px; }
.kpi .meter i { display: block; height: 100%; border-radius: 3px; }
.segbar { display: flex; gap: 3px; margin-top: 12px; }
.segbar i { height: 5px; flex: 1; border-radius: 3px; background: var(--surface-3); }

/* Status dots & badges --------------------------------------------------------------- */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--off); }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.crit { background: var(--crit); box-shadow: 0 0 0 3px color-mix(in srgb, var(--crit) 18%, transparent); }
.dot.off { background: var(--surface); border: 2px solid var(--off); }
.dot.idle { background: var(--border-2); }
.dot.info { background: var(--info); }
.dot.lg { width: 10px; height: 10px; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid transparent; line-height: 1; }
.badge .i { width: 13px; height: 13px; }
.badge.ok { background: var(--ok-soft); color: var(--ok-ink); }
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); }
.badge.crit { background: var(--crit-soft); color: var(--crit-ink); }
.badge.serious { background: var(--serious-soft); color: var(--serious-ink); }
.badge.off, .badge.muted, .badge.idle { background: var(--off-soft); color: var(--off-ink); }
.badge.info { background: var(--info-soft); color: var(--info-ink); }
.badge.violet { background: var(--violet-soft); color: var(--violet-ink); }
.badge.brand { background: var(--brand-soft); color: var(--brand-ink); }
.badge.outline { background: transparent; border-color: var(--border); color: var(--text-2); }
.badge.dotted::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.sm { height: 19px; font-size: 11px; padding: 0 6px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 12px;
  font-size: 12px; font-weight: 500; border: 1px solid var(--border); color: var(--text-2); background: var(--surface); }

/* Buttons & forms -------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 32px; padding: 0 12px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap; color: var(--text); box-shadow: var(--shadow-sm); }
.btn:hover { background: var(--hover); border-color: var(--border-2); }
.btn.primary { background: var(--brand); border-color: var(--brand-600); color: #12200a; font-weight: 600; }
.btn.primary:hover { background: var(--brand-600); }
.btn.dark { background: var(--text); color: var(--surface); border-color: var(--text); }
.btn.danger { color: var(--crit-ink); }
.btn.danger:hover { background: var(--crit-soft); }
.btn.ghost { border-color: transparent; box-shadow: none; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 27px; padding: 0 9px; font-size: 12.5px; border-radius: 7px; }
.btn.icon { width: 32px; padding: 0; }
.btn.icon.sm { width: 27px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--surface-3);
  border: 1px solid var(--border); }
.seg a, .seg button { all: unset; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: 7px; font-size: 12.5px; font-weight: 500; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.seg a:hover, .seg button:hover { color: var(--text); }
.seg .on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg .n { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.input, select.input, textarea.input {
  height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--surface);
  font-size: 13.5px; color: var(--text); width: 100%; box-shadow: var(--shadow-sm);
}
textarea.input { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
select.input { appearance: none; padding-right: 30px; background-image:
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a919c' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; }
.input.sm { height: 30px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; font-weight: 400; }
.check input { width: 16px; height: 16px; accent-color: var(--brand-600); margin: 0; }
.hint { font-size: 12px; color: var(--text-3); font-weight: 400; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filters .input { width: auto; min-width: 160px; }

/* Tables ------------------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.t th { text-align: left; font-weight: 500; font-size: 12px; color: var(--text-3); padding: 9px 12px;
  border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); position: sticky; top: 0; z-index: 2; }
.t th.sortable { cursor: pointer; user-select: none; }
.t th.sortable:hover { color: var(--text); }
.t th.sorted::after { content: " ↓"; }
.t th.sorted.asc::after { content: " ↑"; }
.t td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.t tbody tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: var(--surface-2); }
.t tr.link { cursor: pointer; }
.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t td.site { min-width: 170px; }
.t td.site b { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t .site-cell { display: flex; align-items: center; gap: 10px; }
.t .site-cell b { font-weight: 600; display: block; line-height: 1.25; }
.t .site-cell span { font-size: 12px; color: var(--text-3); }
.t.dense td { padding: 7px 10px; }
.t.dense th { padding: 8px 10px; }
.t tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--border); }
.t.card-table th:first-child, .t.card-table td:first-child { padding-left: 16px; }
.t.card-table th:last-child, .t.card-table td:last-child { padding-right: 16px; }
.empty { padding: 28px 16px; text-align: center; color: var(--text-3); font-size: 13px; }
.empty .i { width: 22px; height: 22px; display: block; margin: 0 auto 8px; color: var(--text-4); }

/* Key-value lists ---------------------------------------------------------------------- */
.kv { display: flex; flex-direction: column; }
.kv .row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border);
  min-height: 46px; }
.kv .row:first-child { border-top: 0; }
.kv .row .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2); flex: none; }
.kv .row .k { font-size: 13px; color: var(--text-2); flex: 1; min-width: 0; }
.kv .row .v { text-align: right; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kv .row .v .s { display: block; font-size: 11.5px; font-weight: 400; color: var(--text-3); }
.kv .row .v.ok { color: var(--ok-ink); }
.kv .row .v.warn { color: var(--warn-ink); }
.kv .row .v.crit { color: var(--crit-ink); }
.kv.compact .row { min-height: 38px; padding: 7px 16px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: 13px; }
dl.facts dt { color: var(--text-3); }
dl.facts dd { margin: 0; font-weight: 500; min-width: 0; }

/* Meters --------------------------------------------------------------------------------- */
.bar { height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; position: relative; }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--c1); }
.bar.lg { height: 8px; }
.bar.ok > i { background: var(--ok); }
.bar.warn > i { background: var(--warn); }
.bar.crit > i { background: var(--crit); }
.fuelcell { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; min-width: 130px; }
.fuelcell .bar { grid-column: 1 / -1; }
.fuelcell .l { font-weight: 600; font-variant-numeric: tabular-nums; }
.fuelcell .p { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.hstrip { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 1.5px; height: 18px; min-width: 120px; }
.hstrip i { border-radius: 2px; background: var(--surface-3); }
.hstrip i.full { background: var(--ok); opacity: .85; }
.hstrip i.part { background: var(--warn); }
.hstrip i.none { background: var(--crit); opacity: .75; }
.hstrip i.na { background: var(--surface-3); }
.hstrip-axis { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-4); margin-top: 3px; }

.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 5px;
  font-size: 11.5px; font-weight: 500; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.chip.crit { background: var(--crit-soft); color: var(--crit-ink); }
.chip.warn { background: var(--warn-soft); color: var(--warn-ink); }
.chip.info { background: var(--info-soft); color: var(--info-ink); }
.chip.off { background: var(--off-soft); color: var(--off-ink); }

.hm { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.hm.dark-crit { color: #fff; background: #8f1d1d; padding: 2px 7px; border-radius: 5px; }
.hm.orange { color: var(--serious-ink); }
.hm.yellow { color: var(--warn-ink); }
.hm.green { color: var(--ok-ink); }

/* Lists of items (alerts, watch list, activity) --------------------------------------- */
.items { display: flex; flex-direction: column; }
.item { display: flex; gap: 12px; align-items: flex-start; padding: 11px 16px; border-top: 1px solid var(--border); }
.item:first-child { border-top: 0; }
a.item:hover { background: var(--surface-2); }
.item .ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.item .ic.crit { background: var(--crit-soft); color: var(--crit-ink); }
.item .ic.warn { background: var(--warn-soft); color: var(--warn-ink); }
.item .ic.off { background: var(--off-soft); color: var(--off-ink); }
.item .ic.info { background: var(--info-soft); color: var(--info-ink); }
.item .ic.ok { background: var(--ok-soft); color: var(--ok-ink); }
.item .ic.brand { background: var(--brand-soft); color: var(--brand-ink); }
.item .body { flex: 1; min-width: 0; }
.item .t1 { font-size: 13.5px; font-weight: 500; line-height: 1.35; }
.item .t1 .muted { font-weight: 400; }
.item .t2 { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.item .end { font-size: 12px; color: var(--text-3); text-align: right; white-space: nowrap; }
.item .chev { color: var(--text-4); align-self: center; }

/* Site header & tabs --------------------------------------------------------------------- */
.site-head { display: flex; gap: 16px; align-items: center; padding: 22px 28px 0; max-width: 1480px; margin: 0 auto;
  width: 100%; flex-wrap: wrap; }
.site-id { width: 64px; height: 64px; border-radius: 14px; flex: none; display: grid; place-items: center;
  background: linear-gradient(145deg, #1d2024, #2c3036); color: #fff; position: relative; overflow: hidden; }
.site-id svg.mark { position: absolute; width: 74px; height: 74px; right: -18px; bottom: -22px; opacity: .55; }
.site-id b { font-size: 15px; font-weight: 700; letter-spacing: .01em; position: relative; font-variant-numeric: tabular-nums; }
.site-head .who { min-width: 0; flex: 1; }
.site-head .who .client { font-size: 12.5px; color: var(--text-3); }
.site-head .who h1 { font-size: 22px; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin: 2px 0 4px; }
.site-head .who h1 .pre { color: var(--text-3); font-weight: 500; }
.site-head .who .meta { font-size: 12.5px; color: var(--text-3); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tabs { display: flex; gap: 4px; padding: 0 28px; border-bottom: 1px solid var(--border); margin-top: 16px;
  overflow-x: auto; max-width: none; scrollbar-width: none; }
.tabs-inner { display: flex; gap: 2px; max-width: 1480px; margin: 0 auto; width: 100%; }
.tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 11px 10px 12px; font-size: 13.5px; font-weight: 500;
  color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); border-bottom-color: var(--text); }
.tabs a .count { font-size: 11px; background: var(--crit); color: #fff; border-radius: 9px; padding: 0 6px; height: 17px;
  display: inline-grid; place-items: center; font-weight: 600; }

.rangebar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rangebar form { display: flex; gap: 6px; align-items: center; }
.rangebar .input { height: 30px; width: 140px; font-size: 12.5px; }

/* Charts ------------------------------------------------------------------------------- */
.chart { width: 100%; height: var(--h, 260px); position: relative; }
.chart.loading::after { content: ""; position: absolute; inset: 0; background:
  linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface-3) 70%, transparent), transparent);
  background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.chart .no-data { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: 13px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.legend i.dash { background: repeating-linear-gradient(90deg, currentColor 0 3px, transparent 3px 5px) !important; height: 2px; }
.legend b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.chart-meta { font-size: 11.5px; color: var(--text-3); }

/* Energy flow ----------------------------------------------------------------------- */
.flow { display: grid; grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1.05fr) 64px minmax(0, 1fr);
  align-items: stretch; padding: 8px 4px 4px; }
.flow .col { display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.flow .wire { width: 100%; height: 100%; display: block; overflow: visible; }
.flow .wire path { fill: none; stroke: var(--border-2); stroke-width: 2; vector-effect: non-scaling-stroke; }
.flow .wire path.on { stroke-dasharray: 2 6; stroke-linecap: round; stroke-width: 2.5; animation: flow 1s linear infinite; }
.flow .wire path.on.rev { animation-direction: reverse; }
@keyframes flow { to { stroke-dashoffset: -16; } }
@media (prefers-reduced-motion: reduce) { .flow .wire path.on { animation: none; stroke-dasharray: none; } }
.node { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 12px 14px;
  display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow-sm); min-height: 74px; }
.node .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.node .lbl { font-size: 12.5px; color: var(--text-2); }
.node .val { font-size: 20px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.node .val small { font-size: 13px; }
.node .sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.node.idle { opacity: .72; }
.node.center { flex-direction: column; text-align: center; justify-content: center; padding: 16px 12px; gap: 6px; min-height: 150px; }
.node.center .val { font-size: 26px; }
.ic.solar { background: color-mix(in srgb, var(--s-solar) 12%, transparent); color: var(--s-solar); }
.ic.load { background: color-mix(in srgb, var(--s-load) 12%, transparent); color: var(--s-load); }
.ic.ge { background: color-mix(in srgb, var(--s-ge) 13%, transparent); color: var(--s-ge); }
.ic.battery { background: color-mix(in srgb, var(--s-battery) 14%, transparent); color: var(--s-battery); }
.ic.bus { background: var(--surface-3); color: var(--text-2); }

/* Gauges -------------------------------------------------------------------------------- */
.soc-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.soc { display: flex; flex-direction: column; gap: 6px; }
.soc .h { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); }
.soc .h b { font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tank { display: flex; gap: 16px; align-items: flex-end; }
.tank .vessel { width: 54px; height: 104px; border: 2px solid var(--border-2); border-radius: 10px; position: relative;
  overflow: hidden; background: var(--surface-2); flex: none; }
.tank .vessel i { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(180deg,
  color-mix(in srgb, var(--c1) 70%, transparent), var(--c1)); }
.tank .vessel.low i { background: linear-gradient(180deg, color-mix(in srgb, var(--crit) 70%, transparent), var(--crit)); }
.tank .vessel .tick { position: absolute; left: 0; width: 8px; border-top: 1px solid var(--border-2); }
.big { font-size: 30px; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.big small { font-size: 16px; }

.stat-grid { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 0;
  border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.stat { padding: 14px 16px; border-left: 1px solid var(--border); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat .k { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 20px; font-weight: 600; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat .v small { font-size: 12.5px; }
.stat .s { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.stat .v.crit { color: var(--crit-ink); }
.stat .v.warn { color: var(--warn-ink); }
.stat .v.ok { color: var(--ok-ink); }

/* Map --------------------------------------------------------------------------------------- */
.map { height: var(--h, 520px); border-radius: 0 0 var(--r-lg) var(--r-lg); overflow: hidden; position: relative; background: var(--surface-2); }
.map .maplibregl-ctrl-attrib { font-size: 10px; }
.map-legend { position: absolute; left: 12px; bottom: 12px; z-index: 2; display: flex; gap: 12px; padding: 6px 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; font-size: 12px; box-shadow: var(--shadow); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend b { font-weight: 500; color: var(--text-3); }
.marker { width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35);
  cursor: pointer; background: var(--off); }
.marker.ok { background: var(--ok); }
.marker.warn { background: var(--warn); }
.marker.crit { background: var(--crit); width: 16px; height: 16px; }
.marker.off { background: #fff; border-color: var(--off); border-width: 3px; }
.marker.idle { background: #c4c9d0; }
.maplibregl-popup-content { border-radius: 10px !important; padding: 10px 12px !important; font: 13px var(--font);
  box-shadow: var(--shadow-lg) !important; background: var(--surface) !important; color: var(--text); }
.maplibregl-popup-tip { border-top-color: var(--surface) !important; border-bottom-color: var(--surface) !important; }
.pop b { display: block; font-size: 13.5px; }
.pop .m { color: var(--text-3); font-size: 12px; margin: 2px 0 6px; }
.pop a { color: var(--brand-ink); font-weight: 600; font-size: 12.5px; }

.site-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; padding: 16px; }
.site-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column;
  gap: 10px; background: var(--surface); }
.site-card:hover { border-color: var(--border-2); box-shadow: var(--shadow); }
.site-card .top { display: flex; gap: 8px; align-items: center; }
.site-card .top b { font-size: 13.5px; }
.site-card .top .id { font-size: 11.5px; color: var(--text-3); margin-left: auto; font-variant-numeric: tabular-nums; }
.site-card .vals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.site-card .vals div { font-size: 11px; color: var(--text-3); }
.site-card .vals b { display: block; font-size: 13.5px; color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }

/* Dialogs, menus, palette ------------------------------------------------------------------ */
dialog { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 0; background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg); width: min(520px, calc(100vw - 32px));
  text-align: start; white-space: normal; }  /* not the table cell's, when opened from a row */
dialog::backdrop { background: rgba(15, 17, 20, .38); backdrop-filter: blur(2px); }
dialog .d-head { padding: 18px 20px 4px; display: flex; gap: 12px; align-items: flex-start; }
dialog .d-head h3 { font-size: 16px; }
dialog .d-head p { font-size: 13px; color: var(--text-3); margin-top: 3px; }
dialog .d-head .x { margin-left: auto; }
dialog .d-body { padding: 14px 20px 4px; }
dialog .d-foot { padding: 14px 20px 18px; display: flex; justify-content: flex-end; gap: 8px; }
.radio-cards { display: grid; gap: 8px; }
.radio-cards label { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; align-items: flex-start; }
.radio-cards label:hover { background: var(--surface-2); }
.radio-cards input { margin-top: 3px; accent-color: var(--brand-600); }
.radio-cards label:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.radio-cards b { font-size: 13px; display: block; }
.radio-cards span { font-size: 12px; color: var(--text-3); }

.popover { position: absolute; z-index: 60; min-width: 220px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-lg); padding: 5px; }
.popover a, .popover button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 9px; border-radius: 6px; font-size: 13px; cursor: pointer; color: var(--text); }
.popover a:hover, .popover button:hover { background: var(--hover); }
.popover hr { border: 0; border-top: 1px solid var(--border); margin: 5px 0; }
.me .popover { bottom: 58px; left: 6px; right: 6px; }

.palette { width: min(620px, calc(100vw - 32px)); margin-top: 12vh; }
.palette .p-in { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.palette .p-in input { border: 0; outline: 0; height: 52px; font-size: 15px; flex: 1; background: transparent; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow: auto; }
.palette li a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; }
.palette li.sel a, .palette li a:hover { background: var(--hover); }
.palette li .k { font-size: 12px; color: var(--text-3); margin-left: auto; }
.palette li .id { font-variant-numeric: tabular-nums; color: var(--text-3); width: 44px; font-size: 12.5px; }
.palette .p-foot { padding: 8px 14px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); display: flex; gap: 14px; }

/* Raw frames ---------------------------------------------------------------------------------- */
pre.raw { margin: 0; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  font: 12px/1.5 var(--mono); overflow: auto; max-height: 360px; white-space: pre-wrap; word-break: break-all; }
details.frame > summary { list-style: none; cursor: pointer; }
details.frame > summary::-webkit-details-marker { display: none; }
details.frame[open] > summary td { background: var(--surface-2); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 14px; font-size: 12px; }
.slots div { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border); padding: 3px 0; }
.slots span { color: var(--text-3); }
.slots b { font-weight: 500; font-variant-numeric: tabular-nums; }

/* Timeline (notes, history) ------------------------------------------------------------------ */
.tl { list-style: none; margin: 0; padding: 0; position: relative; }
.tl li { position: relative; padding: 0 0 16px 22px; }
.tl li::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: -4px; width: 1px; background: var(--border); }
.tl li:last-child::before { display: none; }
.tl li::after { content: ""; position: absolute; left: 1px; top: 4px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--border-2); }
.tl li.now::after { border-color: var(--brand); background: var(--brand); }
.tl .when { font-size: 12px; color: var(--text-3); }
.tl .what { font-size: 13px; margin-top: 2px; }
.tl .why { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.note-box { padding: 12px 14px; border-radius: 10px; background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); font-size: 13px; white-space: pre-wrap; }
.note-box .by { font-size: 11.5px; color: var(--text-3); margin-top: 6px; white-space: normal; }

/* Login ------------------------------------------------------------------------------------- */
.login { display: grid; grid-template-columns: minmax(380px, 1fr) 1.15fr; min-height: 100vh; background: var(--surface); }
.login .l { display: flex; flex-direction: column; padding: 40px 56px; }
.login .l .logo img { height: 40px; }
.login .l .logo .logo-dark { display: none; }
:root[data-theme="dark"] .login .l .logo .logo-light { display: none; }
:root[data-theme="dark"] .login .l .logo .logo-dark { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .login .l .logo .logo-light { display: none; }
  :root:not([data-theme="light"]) .login .l .logo .logo-dark { display: inline; }
}
.login form { margin: auto 0; max-width: 380px; width: 100%; display: flex; flex-direction: column; gap: 16px; }
.login h1 { font-size: 26px; letter-spacing: -.025em; }
.login .lead { color: var(--text-3); font-size: 14px; margin-top: -6px; line-height: 1.5; }
.login .input { height: 40px; font-size: 14px; }
.login .btn.primary { height: 42px; font-size: 14px; }
.login .help { font-size: 12.5px; color: var(--text-3); }
.login .copy { font-size: 11.5px; color: var(--text-4); }
.login .r { background: #0d0f11; color: #f4f6f2; position: relative; overflow: hidden; display: flex; flex-direction: column;
  justify-content: flex-end; padding: 56px 64px; }
.login .r svg.hero { position: absolute; right: 6%; top: 7%; width: 54%; max-width: 560px; height: auto; }
.login .r .glow { position: absolute; width: 640px; height: 640px; right: 0; top: -4%; border-radius: 50%;
  background: radial-gradient(circle, rgba(132,187,39,.22), transparent 62%); }
.login .r .dots { position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 22px 22px; mask-image: linear-gradient(200deg, #000, transparent 70%); }
.login .r .tag { color: var(--brand); font-size: 13px; font-weight: 600; position: relative; }
.login .r h2 { font-size: 34px; line-height: 1.15; letter-spacing: -.03em; max-width: 520px; margin: 10px 0 22px; position: relative; font-weight: 600; }
.login .r ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; position: relative; }
.login .r li { display: flex; gap: 10px; align-items: center; font-size: 14px; color: #c9cec4; }
.login .r li .i { color: var(--brand); width: 18px; height: 18px; padding: 2px; border-radius: 50%; background: rgba(132,187,39,.14); }
.err { color: var(--crit-ink); font-size: 13px; background: var(--crit-soft); padding: 9px 12px; border-radius: 8px; }
.pw { position: relative; }
.pw button { position: absolute; right: 6px; top: 6px; }

/* Client view --------------------------------------------------------------------------------- */
.client-top { display: flex; align-items: center; gap: 16px; padding: 0 28px; height: 60px; border-bottom: 1px solid var(--border);
  background: var(--surface); position: sticky; top: 0; z-index: 30; }
.client-top img { height: 24px; }
.client-top .name { padding-left: 14px; border-left: 1px solid var(--border-2); font-weight: 600; font-size: 14px; }
.client-top .grow { flex: 1; }
.preview-bar { background: var(--text); color: var(--surface); font-size: 12.5px; padding: 7px 28px; display: flex; gap: 12px; align-items: center; }
.preview-bar select { background: transparent; color: inherit; border: 1px solid rgba(255,255,255,.3); border-radius: 6px; padding: 2px 6px; }
.preview-bar a { text-decoration: underline; }
body.client { background: var(--bg); }
body.client .content { padding-top: 28px; }

/* Responsive ---------------------------------------------------------------------------------- */
@media (max-width: 1280px) {
  .g-main, .g-main-l { grid-template-columns: minmax(0, 1fr) 320px; }
  .kpis { --n: 3 !important; }
  .kpis .kpi:nth-child(4) { border-left: 0; }
  .kpis .kpi:nth-child(n+4) { border-top: 1px solid var(--border); }
}
@media (max-width: 1080px) {
  .g-main, .g-main-l, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login { grid-template-columns: 1fr; }
  .login .r { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 80; left: 0; top: 0; bottom: 0; width: 280px; background: var(--bg);
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  .main { margin: 0; border-radius: 0; border: 0; }
  .topbar { border-radius: 0; padding: 0 12px; }
  .btn.menu-toggle { display: inline-flex; }
  .searchbtn { min-width: 0; }
  .searchbtn .lbl, .searchbtn .kbd { display: none; }
  .content { padding: 16px 16px 40px; }
  .site-head, .tabs { padding-left: 16px; padding-right: 16px; }
  .g-2, .g-4 { grid-template-columns: minmax(0, 1fr); }
  .kpis { --n: 2 !important; }
  .kpis .kpi { border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
  .kpis .kpi:nth-child(odd) { border-left: 0; }
  .kpis .kpi:nth-child(-n+2) { border-top: 0; }
  .stat-grid { --n: 2 !important; }
  .stat-grid .stat:nth-child(odd) { border-left: 0; }
  .stat-grid .stat:nth-child(n+3) { border-top: 1px solid var(--border); }
  .flow { grid-template-columns: 1fr; gap: 10px; }
  .flow .wirecol { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .seg { flex-wrap: wrap; }
  .crumbs a, .crumbs .i { display: none; }
  .live [data-live-label] { display: none; }
  .map-legend { flex-wrap: wrap; right: 12px; gap: 6px 12px; }
  .site-head .who h1 { font-size: 19px; }
  .rangebar form { flex-wrap: wrap; }
  .page-head .actions { width: 100%; }
  .login .l { padding: 28px 20px; }
  .client-top { padding: 0 16px; }
}

@media print {
  .sidebar, .topbar, .no-print, .tabs, .rangebar { display: none !important; }
  .app { display: block; }
  .main { margin: 0; border: 0; box-shadow: none; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}
