/* ============================================================================
   EMASS — Design System
   Industrial control-room aesthetic: dense data, high contrast, calm surfaces.
   ========================================================================== */

:root {
  --bg: #f4f6fa;
  --bg-elev: #ffffff;
  --bg-sunken: #eef1f7;
  --bg-hover: #f0f3f9;
  --border: #dfe4ee;
  --border-strong: #c8d0e0;
  --text: #101828;
  --text-2: #475467;
  --text-3: #7a8699;
  --brand: #1c5cd6;
  --brand-2: #0ea5e9;
  --brand-soft: #e8f0ff;
  --ok: #10a05a;
  --ok-soft: #e3f7ec;
  --warn: #d98209;
  --warn-soft: #fdf3e3;
  --crit: #d92d20;
  --crit-soft: #fdecea;
  --purple: #7b5ce6;
  --purple-soft: #f0ecfd;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 6px 16px -6px rgba(16, 24, 40, 0.1);
  --shadow-lg: 0 12px 34px -10px rgba(16, 24, 40, 0.2);
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --sidebar-w: 232px;
  --header-h: 58px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html[data-theme="dark"] {
  --bg: #0b1220;
  --bg-elev: #131c2e;
  --bg-sunken: #0e1729;
  --bg-hover: #1a2439;
  --border: #24304a;
  --border-strong: #33405e;
  --text: #e8eef9;
  --text-2: #a3b0c7;
  --text-3: #7285a3;
  --brand: #4d8dff;
  --brand-2: #38bdf8;
  --brand-soft: #17243d;
  --ok: #34d399;
  --ok-soft: #10301f;
  --warn: #fbbf24;
  --warn-soft: #302310;
  --crit: #f87171;
  --crit-soft: #35161a;
  --purple: #a78bfa;
  --purple-soft: #221a3d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.45), 0 8px 20px -8px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 16px 40px -12px rgba(0, 0, 0, 0.75);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 640; letter-spacing: -0.015em; color: var(--text); }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--brand); color: #fff; }

/* ---------- scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 20px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-track { background: transparent; }

/* ============================ LOGIN ==================================== */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--bg);
}
.login-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(150deg, #0a2540 0%, #123a6b 48%, #0b6fa4 100%);
  color: #fff;
  padding: 56px 52px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.055) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 70% at 70% 30%, #000 25%, transparent 78%);
  pointer-events: none;
}
.login-hero > * { position: relative; z-index: 1; }
.hero-brand { display: flex; align-items: center; gap: 13px; }
.hero-mark {
  width: 44px; height: 44px; border-radius: 11px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.24);
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px; letter-spacing: -0.5px;
  backdrop-filter: blur(6px);
}
/* Explicit white: the global h1..h4 rule sets color: var(--text), which is
   near-black in light theme and would be invisible on the dark hero panel. */
.hero-title { font-size: 33px; font-weight: 720; line-height: 1.16; letter-spacing: -0.03em; margin: 0 0 16px; color: #fff; }
.hero-sub { font-size: 14.5px; color: rgba(255,255,255,.82); max-width: 470px; line-height: 1.62; }
.hero-points { display: grid; gap: 13px; margin-top: 30px; max-width: 460px; }
.hero-point { display: flex; gap: 11px; align-items: flex-start; font-size: 13px; color: rgba(255,255,255,.9); }
.hero-point svg { flex: 0 0 17px; margin-top: 2px; opacity: .95; }
.hero-foot { font-size: 11.5px; color: rgba(255,255,255,.55); letter-spacing: .03em; text-transform: uppercase; }

.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 28px; }
.login-card { width: 100%; max-width: 384px; }
.login-card h2 { font-size: 25px; letter-spacing: -0.025em; margin-bottom: 6px; }
.login-card .muted { margin-bottom: 26px; }
.demo-box {
  margin-top: 22px; padding: 13px 15px; border-radius: var(--r);
  background: var(--bg-sunken); border: 1px solid var(--border);
  font-size: 12px; color: var(--text-2);
}
.demo-box strong { color: var(--text); font-weight: 600; }
.demo-row { display: flex; justify-content: space-between; padding: 4px 0; gap: 12px; }
.demo-row code { font-family: var(--mono); font-size: 11.5px; color: var(--text); }
.demo-row button {
  background: none; border: 0; color: var(--brand); font-size: 11px;
  padding: 0; text-decoration: underline; text-underline-offset: 2px;
}

/* ============================ APP SHELL =============================== */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 40;
  transition: width .18s ease, flex-basis .18s ease;
}
.sidebar.collapsed { width: 62px; flex-basis: 62px; }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-group-title,
.sidebar.collapsed .sb-brand-text,
.sidebar.collapsed .sb-foot-text,
.sidebar.collapsed .nav-badge { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 9px 0; }
.sidebar.collapsed .nav-group-title { height: 6px; }

.sb-brand {
  height: var(--header-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 15px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 var(--header-h);
}
.sb-mark {
  width: 29px; height: 29px; flex: 0 0 29px; border-radius: 8px;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 11.5px; letter-spacing: -0.4px;
}
.sb-brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sb-brand-text b { font-size: 14px; font-weight: 720; letter-spacing: .02em; }
.sb-brand-text span { font-size: 9.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .1em; }

.sb-nav { flex: 1; overflow-y: auto; padding: 10px 9px 16px; }
.nav-group-title {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .11em;
  color: var(--text-3); padding: 14px 9px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7.5px 10px; border-radius: var(--r-sm);
  color: var(--text-2); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background .12s, color .12s;
  text-decoration: none; position: relative;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: -9px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 17px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.nav-item svg { flex: 0 0 15px; opacity: .8; }
.nav-item.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto; font-size: 10px; font-weight: 700; padding: 1px 6px;
  border-radius: 20px; background: var(--crit); color: #fff;
}
.sb-foot {
  border-top: 1px solid var(--border); padding: 9px;
  display: flex; align-items: center; gap: 8px;
}
.sb-foot-btn {
  flex: 1; display: flex; align-items: center; gap: 8px; padding: 7px 9px;
  border-radius: var(--r-sm); border: 0; background: transparent;
  color: var(--text-2); font-size: 12px; font-weight: 500;
}
.sb-foot-btn:hover { background: var(--bg-hover); color: var(--text); }

.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  transition: margin-left .18s ease;
}
.sidebar.collapsed ~ .main { margin-left: 62px; }

.topbar {
  height: var(--header-h);
  flex: 0 0 var(--header-h);
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 30;
}
.tb-customer { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.tb-customer b { font-size: 13px; font-weight: 640; white-space: nowrap; }
.tb-customer span { font-size: 10.5px; color: var(--text-3); display: flex; align-items: center; gap: 4px; }
.tb-spacer { flex: 1; }

.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); display: inline-block; }
.status-dot.pulse { animation: pulse 2.2s infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,160,90,.5); }
  60% { box-shadow: 0 0 0 5px rgba(16,160,90,0); }
}

.icon-btn {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  border: 1px solid transparent; background: transparent;
  display: grid; place-items: center; color: var(--text-2);
  position: relative; transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn.has-dot::after {
  content: ""; position: absolute; top: 6px; right: 7px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--crit);
  border: 1.5px solid var(--bg-elev);
}

.meter-picker {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg); padding: 0 8px 0 10px; height: 32px;
  min-width: 190px;
}
.meter-picker select {
  border: 0; background: transparent; outline: none;
  font-size: 12.5px; font-weight: 550; color: var(--text);
  height: 30px; width: 100%; cursor: pointer;
}

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  color: #fff; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700;
}

.page { padding: 20px 20px 44px; max-width: 1780px; width: 100%; }
.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 19px; }
.page-head .sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.page-head-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- cards / panels ---------- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 15px; border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 13.5px; font-weight: 640; }
.card-head .hint { font-size: 11.5px; color: var(--text-3); font-weight: 400; }
.card-head-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.card-body { padding: 15px; }
.card-body.tight { padding: 0; }

/* ---------- KPIs ---------- */
.kpi-grid { display: grid; gap: 13px; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); }
.kpi {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px 15px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.kpi-label {
  font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .075em;
  color: var(--text-3); display: flex; align-items: center; gap: 6px;
}
.kpi-value {
  font-size: 24px; font-weight: 700; letter-spacing: -0.028em; margin-top: 7px;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.kpi-unit { font-size: 12px; font-weight: 550; color: var(--text-3); margin-left: 4px; letter-spacing: 0; }
.kpi-meta { font-size: 11.5px; color: var(--text-2); margin-top: 5px; display: flex; align-items: center; gap: 5px; }
.kpi-accent { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.kpi-accent.brand { background: var(--brand); }
.kpi-accent.ok { background: var(--ok); }
.kpi-accent.warn { background: var(--warn); }
.kpi-accent.crit { background: var(--crit); }
.kpi-accent.purple { background: var(--purple); }

.trend-up { color: var(--ok); font-weight: 600; }
.trend-down { color: var(--crit); font-weight: 600; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--bg-elev);
  color: var(--text); font-size: 12.5px; font-weight: 560;
  transition: background .12s, border-color .12s, box-shadow .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn.sm { height: 27px; padding: 0 9px; font-size: 11.5px; }
.btn.danger { color: var(--crit); border-color: var(--crit); background: transparent; }
.btn.danger:hover { background: var(--crit-soft); }
.btn-block { width: 100%; height: 42px; font-size: 13.5px; }

.seg {
  display: inline-flex; background: var(--bg-sunken); border-radius: var(--r-sm);
  padding: 2px; gap: 2px; border: 1px solid var(--border);
}
.seg button {
  border: 0; background: transparent; padding: 5px 10px; border-radius: 4px;
  font-size: 11.5px; font-weight: 600; color: var(--text-2);
}
.seg button.active { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-sm); }
.seg button:hover:not(.active) { color: var(--text); }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4.5px 10px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--bg-elev); font-size: 11.5px; font-weight: 550; color: var(--text-2);
  cursor: pointer; transition: all .12s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- form ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-size: 11px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-2);
}
.input, .select, textarea.input {
  height: 34px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--bg-elev); padding: 0 10px; font-size: 13px;
  outline: none; transition: border-color .12s, box-shadow .12s; width: 100%;
}
textarea.input { height: auto; padding: 8px 10px; resize: vertical; min-height: 66px; }
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.select { cursor: pointer; }
.input.invalid { border-color: var(--crit); }

/* ---------- table ---------- */
.table-wrap { overflow: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th {
  text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-3); padding: 9px 12px;
  border-bottom: 1px solid var(--border); background: var(--bg-sunken);
  position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
table.data td { padding: 8.5px 12px; border-bottom: 1px solid var(--border); color: var(--text-2); }
table.data tbody tr:hover { background: var(--bg-hover); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 11.5px; }
table.data .strong { color: var(--text); font-weight: 600; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4.5px;
  padding: 2px 7px; border-radius: 5px; font-size: 10.5px; font-weight: 650;
  letter-spacing: .015em; white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.crit { background: var(--crit-soft); color: var(--crit); }
.badge.neutral { background: var(--bg-sunken); color: var(--text-2); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.purple { background: var(--purple-soft); color: var(--purple); }
.badge.no-dot::before { display: none; }

/* ---------- progress ---------- */
.bar { height: 6px; border-radius: 20px; background: var(--bg-sunken); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 20px; background: var(--brand); transition: width .35s ease; }
.bar > i.ok { background: var(--ok); }
.bar > i.warn { background: var(--warn); }
.bar > i.crit { background: var(--crit); }

/* ---------- chart containers ---------- */
.chart-box { position: relative; width: 100%; }
.chart-box canvas { display: block; width: 100% !important; }

/* ---------- misc ---------- */
.muted { color: var(--text-2); font-size: 12.5px; }
.dim { color: var(--text-3); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 9px; }
.row.wrap { flex-wrap: wrap; }
.grid { display: grid; gap: 13px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: 2fr 1fr; }
.g-1-2 { grid-template-columns: 1fr 2fr; }
.spacer { flex: 1; }
.sep { height: 1px; background: var(--border); margin: 14px 0; }
.divider-v { width: 1px; align-self: stretch; background: var(--border); margin: 0 3px; }

.empty {
  padding: 34px 20px; text-align: center; color: var(--text-3); font-size: 12.5px;
}
.empty svg { opacity: .35; margin-bottom: 9px; }

.skeleton {
  background: linear-gradient(90deg, var(--bg-sunken) 25%, var(--bg-hover) 50%, var(--bg-sunken) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 5px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- toast ---------- */
#toasts {
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 9px; align-items: flex-end;
}
.toast {
  min-width: 250px; max-width: 380px; padding: 11px 14px;
  border-radius: var(--r); background: var(--bg-elev);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  font-size: 12.5px; display: flex; gap: 9px; align-items: flex-start;
  animation: slideIn .22s ease; border-left: 3px solid var(--brand);
}
.toast.ok { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--crit); }
.toast.warn { border-left-color: var(--warn); }
.toast b { display: block; font-size: 12.5px; margin-bottom: 1px; }
@keyframes slideIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 18, 32, .5);
  backdrop-filter: blur(2px); z-index: 500;
  display: grid; place-items: center; padding: 20px;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-elev); border-radius: var(--r-lg); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 520px;
  max-height: 88vh; display: flex; flex-direction: column;
  animation: popIn .18s ease;
}
.modal.wide { max-width: 780px; }
@keyframes popIn { from { opacity: 0; transform: scale(.97) translateY(8px); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; gap: 10px; padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 15px; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot {
  padding: 13px 18px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.tabs button {
  background: none; border: 0; padding: 9px 14px; font-size: 12.5px; font-weight: 560;
  color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 650; }

/* ---------- topology graph ---------- */
#topology { width: 100%; height: 520px; display: block; cursor: grab; }
#topology:active { cursor: grabbing; }

/* ---------- LCD meter cards ---------- */
.lcd-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); }
.lcd {
  background: linear-gradient(165deg, #0d1a17, #0a1412);
  border: 1px solid #1c3a32; border-radius: var(--r); padding: 11px 12px;
  color: #5ffbc4; font-family: var(--mono); position: relative; overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(95,251,196,.09), 0 2px 8px rgba(0,0,0,.25);
}
.lcd::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 1px, transparent 1px 3px);
  pointer-events: none; opacity: .5;
}
.lcd-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.lcd-name {
  font-family: var(--sans); font-size: 10.5px; font-weight: 650; color: #a7fde0;
  text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 140px;
}
.lcd-led { width: 6px; height: 6px; border-radius: 50%; background: #ff5a4d; box-shadow: 0 0 6px #ff5a4d; }
.lcd-led.on { background: #2fe38b; box-shadow: 0 0 6px #2fe38b; }
.lcd-main { font-size: 25px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; text-shadow: 0 0 12px rgba(95,251,196,.32); }
.lcd-unit { font-size: 10.5px; color: #3fb894; margin-left: 4px; letter-spacing: .04em; }
.lcd-rows { margin-top: 8px; display: grid; gap: 2.5px; }
.lcd-row { display: flex; justify-content: space-between; font-size: 10.5px; color: #38a382; }
.lcd-row b { color: #8bfdd6; font-weight: 550; font-variant-numeric: tabular-nums; }

/* ---------- calendar heatmap ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow {
  text-align: center; font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-3); padding-bottom: 3px;
}
.cal-cell {
  aspect-ratio: 1.18; border-radius: 7px; border: 1px solid var(--border);
  background: var(--bg-sunken); padding: 5px 6px; position: relative;
  display: flex; flex-direction: column; overflow: hidden;
  transition: transform .12s, box-shadow .12s;
}
.cal-cell.has:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.cal-cell.empty { border-color: transparent; background: transparent; }
.cal-num { font-size: 10.5px; font-weight: 650; color: var(--text-2); }
.cal-kwh { font-size: 12.5px; font-weight: 700; margin-top: auto; font-variant-numeric: tabular-nums; }
.cal-peak { position: absolute; top: 5px; right: 5px; font-size: 8.5px; }

/* ---------- legend ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* ---------- attribution note ---------- */
.note-integrity {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 13px; border-radius: var(--r-sm);
  background: var(--brand-soft); border: 1px solid rgba(28,92,214,.18);
  font-size: 11.5px; color: var(--text-2); line-height: 1.55;
}
.note-integrity svg { flex: 0 0 14px; color: var(--brand); margin-top: 1.5px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .g-2-1, .g-1-2, .g4 { grid-template-columns: 1fr; }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .sidebar { width: 62px; flex-basis: 62px; }
  .sidebar .nav-label, .sidebar .nav-group-title, .sidebar .sb-brand-text,
  .sidebar .sb-foot-text, .sidebar .nav-badge { display: none; }
  .sidebar .nav-item { justify-content: center; padding: 9px 0; }
  .main { margin-left: 62px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .page { padding: 14px 12px 40px; }
  .kpi-value { font-size: 21px; }
  .tb-customer span { display: none; }
  .meter-picker { min-width: 0; width: 120px; }
}
@media print {
  .sidebar, .topbar, .page-head-actions, .btn, .tabs { display: none !important; }
  .main { margin-left: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
}
