/* ==========================================================================
   Yacada — dashboard SPA
   ========================================================================== */

body.sp-app-page {
  overflow-x: hidden;
  background: var(--sp-bg);
}

body.sp-app-page::before {
  opacity: 0.55;
}

.sp-app {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  position: relative;
  z-index: 1;
}

/* Sidebar ---------------------------------------------------------------- */
.sp-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 14px 16px;
  background: linear-gradient(180deg, #15170f 0%, #10120c 60%, #0b0c08 100%);
  color: #f4f3e7;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 35;
  border-inline-end: 1px solid rgba(255, 255, 255, 0.06);
}

.sp-sidebar::before {
  content: "";
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  top: -170px;
  inset-inline-start: -90px;
  background: radial-gradient(circle, rgba(246, 238, 49, 0.26), transparent 68%);
  pointer-events: none;
}

.sp-sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.25;
  background-image: radial-gradient(rgba(255, 255, 255, 0.3) 0.5px, transparent 0.5px);
  background-size: 20px 20px;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 45%);
  mask-image: linear-gradient(180deg, #000, transparent 45%);
}

.sp-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 1;
  color: #f4f8fb;
}

.sp-sidebar__brand:hover { color: #fff; }

.sp-sidebar__brand .sp-brand__name { color: #fff; font-size: 1rem; }
.sp-sidebar__brand .sp-brand__tag { color: #b5b9a7; }

.sp-sidebar__scroll {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
  position: relative;
  z-index: 1;
}

.sp-nav-group {
  display: grid;
  gap: 3px;
}

.sp-nav-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #8a907d;
  padding: 0 10px 7px;
  text-transform: uppercase;
}

.sp-side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border-radius: 11px;
  color: #b5b9a7;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  position: relative;
  transition: background 180ms, color 180ms;
}

.sp-side-link .sp-icon {
  opacity: 0.8;
  transition: opacity 180ms;
}

.sp-side-link:hover {
  background: rgba(255, 255, 255, 0.055);
  color: #f0f6fa;
}

.sp-side-link.is-active {
  background: linear-gradient(90deg, rgba(246, 238, 49, 0.17), rgba(246, 238, 49, 0.05));
  color: #fff66b;
}

.sp-side-link.is-active .sp-icon { opacity: 1; color: #fff98f; }

.sp-side-link.is-active::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 25%;
  height: 50%;
  width: 2.5px;
  border-radius: 99px;
  background: var(--sp-solar);
}

.sp-side-link__count {
  margin-inline-start: auto;
  min-width: 19px;
  height: 19px;
  padding-inline: 5px;
  display: grid;
  place-items: center;
  border-radius: 99px;
  background: var(--sp-critical);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}

.sp-sidebar__foot {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sp-user-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.sp-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--sp-gradient-solar);
  color: #1b1103;
  font-size: 12px;
  font-weight: 800;
  flex: 0 0 auto;
  letter-spacing: -0.02em;
}

.sp-user-card__meta {
  min-width: 0;
  line-height: 1.5;
}

.sp-user-card__meta b {
  display: block;
  font-size: 11px;
  color: #edf5fa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-user-card__meta small {
  display: block;
  font-size: 9px;
  color: #7d94a4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-user-card__logout {
  margin-inline-start: auto;
  color: #7d94a4;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.sp-user-card__logout:hover { color: #ff9b92; background: rgba(255, 255, 255, 0.05); }

.sp-sidebar__demo {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(246, 238, 49, 0.1);
  border: 1px solid rgba(246, 238, 49, 0.16);
  color: #eab65a;
  font-size: 9.5px;
  line-height: 1.7;
}

/* Main shell ------------------------------------------------------------- */
.sp-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sp-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding-inline: clamp(16px, 3vw, 32px);
  background: color-mix(in srgb, var(--sp-bg) 82%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid var(--sp-border);
}

.sp-topbar__brand {
  display: none;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 13px;
}

.sp-topbar__crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--sp-text-faint);
  min-width: 0;
}

.sp-topbar__crumb b {
  color: var(--sp-text);
  font-weight: 650;
  white-space: nowrap;
}

.sp-topbar__crumb .sp-icon { opacity: 0.5; }

.sp-topbar__scope {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 99px;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  font-size: 10px;
  font-weight: 550;
  color: var(--sp-text-muted);
  white-space: nowrap;
}

.sp-topbar__scope .sp-icon { color: var(--sp-solar-text); }

.sp-topbar__actions {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 7px;
}

.sp-topbar__date {
  font-size: 10px;
  color: var(--sp-text-faint);
  padding-inline-end: 4px;
  white-space: nowrap;
}

.sp-icon-btn.sp-bell {
  position: relative;
}

.sp-bell__dot {
  position: absolute;
  top: 9px;
  inset-inline-end: 9px;
  min-width: 15px;
  height: 15px;
  padding-inline: 4px;
  border-radius: 99px;
  background: var(--sp-critical);
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--sp-bg);
  line-height: 1;
}

.sp-topbar .sp-avatar { width: 38px; height: 38px; }

.sp-content {
  width: 100%;
  max-width: 1560px;
  margin-inline: auto;
  padding: clamp(16px, 2.6vw, 30px) clamp(16px, 3vw, 34px) 48px;
  flex: 1;
}

/* Page head -------------------------------------------------------------- */
.sp-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: clamp(16px, 2.2vw, 24px);
}

.sp-page-head__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 650;
  color: var(--sp-solar-strong);
  letter-spacing: 0.02em;
  margin-bottom: 5px;
}

.sp-page-head h1 {
  font-size: clamp(1.45rem, 2.4vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.4;
}

.sp-page-head p {
  color: var(--sp-text-muted);
  font-size: 11.5px;
  margin-top: 4px;
}

.sp-page-head__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sp-live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--sp-success);
  font-weight: 600;
}

.sp-live-dot i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: sp-pulse 2.4s infinite;
}

.sp-updated {
  font-size: 9.5px;
  color: var(--sp-text-faint);
}

/* Banners ---------------------------------------------------------------- */
.sp-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 13px;
  background: var(--sp-solar-soft);
  border: 1px solid color-mix(in srgb, var(--sp-solar) 30%, transparent);
  color: var(--sp-solar-ink);
  font-size: 11px;
  line-height: 1.8;
  margin-bottom: 16px;
}

[data-theme="dark"] .sp-banner { color: #ffe1a9; }

.sp-banner .sp-icon { color: var(--sp-solar-strong); flex: 0 0 auto; }
.sp-banner b { font-weight: 750; }
.sp-banner a { margin-inline-start: auto; font-weight: 700; color: inherit; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }

.sp-banner--warn {
  background: var(--sp-warning-soft);
  border-color: color-mix(in srgb, var(--sp-warning) 30%, transparent);
  color: var(--sp-warning);
}

.sp-banner--error {
  background: var(--sp-critical-soft);
  border-color: color-mix(in srgb, var(--sp-critical) 28%, transparent);
  color: var(--sp-critical);
}

/* KPI grid --------------------------------------------------------------- */
.sp-kpis {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(10px, 1.4vw, 14px);
  margin-bottom: clamp(14px, 2vw, 20px);
}

.sp-kpi {
  grid-column: span 3;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  min-height: 138px;
  padding: 16px 17px;
  border-radius: var(--sp-radius-md);
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  box-shadow: var(--sp-shadow-1);
  overflow: hidden;
  transition: transform 240ms var(--sp-ease), box-shadow 240ms;
}

.sp-kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--sp-shadow-2);
}

.sp-kpi--power { grid-column: span 6; }

.sp-kpi__head {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--sp-text-muted);
  font-size: 10.5px;
  font-weight: 550;
}

.sp-kpi__head .sp-icon {
  color: var(--sp-solar-strong);
  width: 16px;
  height: 16px;
}

.sp-kpi__value {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: clamp(1.45rem, 2.4vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.sp-kpi__value small {
  font-size: 0.45em;
  font-weight: 600;
  color: var(--sp-text-faint);
  letter-spacing: 0;
}

.sp-kpi__foot {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9.5px;
  color: var(--sp-text-faint);
  flex-wrap: wrap;
}

.sp-kpi__trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 99px;
  background: var(--sp-success-soft);
  color: var(--sp-success);
  font-size: 9px;
  font-weight: 650;
}

.sp-kpi__trend--down {
  background: var(--sp-critical-soft);
  color: var(--sp-critical);
}

.sp-kpi__trend--neutral {
  background: var(--sp-surface-2);
  color: var(--sp-text-muted);
}

.sp-kpi__icon {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--sp-surface-2);
  color: var(--sp-text-muted);
}

.sp-kpi--power {
  background:
    radial-gradient(26rem 18rem at 92% -40%, rgba(246, 238, 49, 0.35), transparent 60%),
    linear-gradient(145deg, #0c1d2b 0%, #0a1723 62%, #0d2231 100%);
  border-color: rgba(255, 255, 255, 0.09);
  color: #f2f8fc;
}

.sp-kpi--power .sp-kpi__head { color: #a9bece; }
.sp-kpi--power .sp-kpi__head .sp-icon { color: #fff98f; }
.sp-kpi--power .sp-kpi__value { font-size: clamp(2rem, 3.8vw, 2.9rem); color: #fff; }
.sp-kpi--power .sp-kpi__value small { color: #91a9ba; }
.sp-kpi--power .sp-kpi__foot { color: #8fa7b8; }
.sp-kpi--power .sp-kpi__trend { background: rgba(85, 214, 179, 0.14); color: #7ae3cf; }
.sp-kpi--power .sp-kpi__icon { background: rgba(255, 255, 255, 0.08); color: #fff98f; }

.sp-kpi__spark {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 58px;
  opacity: 0.9;
  pointer-events: none;
}

.sp-kpi__spark canvas { width: 100%; height: 100%; }

.sp-kpi__ring {
  --p: 0;
  --ring-color: var(--sp-solar-text);
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--p) * 1%), var(--sp-surface-2) 0);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.sp-kpi__ring::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--sp-surface);
}

.sp-kpi__ring span {
  position: relative;
  font-size: 10px;
  font-weight: 800;
  color: var(--sp-text);
}

.sp-kpi--alert .sp-kpi__value { color: var(--sp-critical); }
.sp-kpi--alert .sp-kpi__head .sp-icon { color: var(--sp-critical); }
.sp-kpi--energy .sp-kpi__head .sp-icon { color: var(--sp-energy); }
.sp-kpi--co2 .sp-kpi__head .sp-icon { color: var(--sp-energy); }
.sp-kpi--revenue .sp-kpi__head .sp-icon { color: var(--sp-solar-strong); }

.sp-kpi .sp-kpi__progress {
  height: 4px;
  border-radius: 99px;
  background: var(--sp-surface-2);
  overflow: hidden;
  margin-top: 2px;
}

.sp-kpi .sp-kpi__progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--sp-gradient-solar);
}

.sp-kpi.is-loading .sp-kpi__value,
.sp-kpi.is-loading .sp-kpi__foot {
  color: transparent;
  background: var(--sp-surface-2);
  border-radius: 6px;
}

/* Panels & charts -------------------------------------------------------- */
.sp-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: clamp(10px, 1.4vw, 14px);
  margin-bottom: clamp(14px, 2vw, 20px);
}

.sp-grid-half {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 1.4vw, 14px);
  margin-bottom: clamp(14px, 2vw, 20px);
}

.sp-panel {
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-md);
  box-shadow: var(--sp-shadow-1);
  padding: clamp(14px, 1.8vw, 20px);
  min-width: 0;
}

.sp-panel--flush { padding: 0; overflow: hidden; }

.sp-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.sp-panel__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
}

.sp-panel__title .sp-icon { color: var(--sp-solar-strong); }

.sp-panel__sub {
  font-size: 9.5px;
  color: var(--sp-text-faint);
  margin-top: 2px;
  font-weight: 400;
}

.sp-panel__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sp-range {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 99px;
  background: var(--sp-surface-2);
  border: 1px solid var(--sp-border);
}

.sp-range button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 4px 9px;
  border-radius: 99px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--sp-text-faint);
  transition: background 160ms, color 160ms;
}

.sp-range button:hover { color: var(--sp-text); }

.sp-range button.is-active {
  background: var(--sp-surface);
  color: var(--sp-text);
  box-shadow: var(--sp-shadow-1);
}

.sp-chart-box {
  position: relative;
  width: 100%;
  height: clamp(190px, 24vw, 260px);
}

.sp-chart-box--sm { height: 160px; }
.sp-chart-box--lg { height: clamp(240px, 32vw, 340px); }

.sp-chart-box canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.sp-chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 9.5px;
  color: var(--sp-text-muted);
}

.sp-chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sp-chart-legend i { width: 7px; height: 7px; border-radius: 2px; background: var(--sp-chart); }
.sp-chart-legend i.teal { background: var(--sp-energy); }
.sp-chart-legend i.ghost { background: var(--sp-text-faint); opacity: 0.5; }

.sp-chart-tooltip {
  position: absolute;
  z-index: 10;
  pointer-events: none;
  padding: 7px 9px;
  border-radius: 8px;
  background: var(--sp-navy);
  color: #fff;
  font-size: 9.5px;
  line-height: 1.7;
  box-shadow: var(--sp-shadow-2);
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px));
  opacity: 0;
  transition: opacity 120ms;
}

[data-theme="dark"] .sp-chart-tooltip {
  background: var(--sp-elevated);
  color: var(--sp-text);
  border: 1px solid var(--sp-border);
}

.sp-chart-tooltip.is-visible { opacity: 1; }
.sp-chart-tooltip b { color: var(--sp-solar-text); }

.sp-chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--sp-text-faint);
  font-size: 10px;
  gap: 4px;
}

/* Fleet status / donut --------------------------------------------------- */
.sp-fleet {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 24px);
}

.sp-donut {
  position: relative;
  width: 126px;
  height: 126px;
  flex: 0 0 auto;
}

.sp-donut canvas { width: 100%; height: 100%; }

.sp-donut__center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
}

.sp-donut__center b {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.sp-donut__center small {
  font-size: 8.5px;
  color: var(--sp-text-faint);
}

.sp-fleet-legend {
  display: grid;
  gap: 9px;
  flex: 1;
  min-width: 0;
}

.sp-fleet-legend div {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  color: var(--sp-text-muted);
}

.sp-fleet-legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sp-text-faint);
}

.sp-fleet-legend i.ok { background: var(--sp-success); }
.sp-fleet-legend i.warn { background: var(--sp-warning); }
.sp-fleet-legend i.off { background: var(--sp-text-faint); }
.sp-fleet-legend b { margin-inline-start: auto; color: var(--sp-text); font-weight: 750; font-variant-numeric: tabular-nums; }

/* Site list -------------------------------------------------------------- */
.sp-site-list {
  display: grid;
}

.sp-site-row {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) 0.8fr 0.8fr 0.8fr 0.7fr 32px;
  align-items: center;
  gap: 10px;
  padding: 12px 6px;
  border-top: 1px solid var(--sp-border-soft);
  transition: background 160ms;
  cursor: pointer;
}

.sp-site-row:hover { background: var(--sp-surface-2); }
.sp-site-row:first-child { border-top: 0; }

.sp-site-name {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.sp-site-avatar {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border-radius: 10px;
  background: var(--sp-gradient-mint);
  color: #0f5f50;
  font-size: 10px;
  font-weight: 800;
  flex: 0 0 auto;
  letter-spacing: -0.02em;
}

[data-theme="dark"] .sp-site-avatar {
  background: rgba(50, 190, 160, 0.15);
  color: #7ae3cf;
}

.sp-site-name__meta {
  min-width: 0;
  line-height: 1.6;
}

.sp-site-name__meta b {
  display: block;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-site-name__meta small {
  display: block;
  font-size: 8.5px;
  color: var(--sp-text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-site-stat {
  text-align: center;
  line-height: 1.5;
}

.sp-site-stat b {
  display: block;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sp-site-stat small {
  display: block;
  font-size: 8px;
  color: var(--sp-text-faint);
}

.sp-site-row .sp-pill { justify-self: start; font-size: 9px; padding: 3px 8px; }

.sp-site-row__arrow {
  color: var(--sp-text-faint);
  display: grid;
  place-items: center;
}

.sp-table-head {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) 0.8fr 0.8fr 0.8fr 0.7fr 32px;
  gap: 10px;
  padding: 0 6px 7px;
  font-size: 8.5px;
  font-weight: 650;
  color: var(--sp-text-faint);
  letter-spacing: 0.02em;
}

.sp-table-head span:nth-child(n+2) { text-align: center; }

.sp-empty-inline {
  padding: 26px 10px;
  text-align: center;
  font-size: 10px;
  color: var(--sp-text-faint);
}

.sp-filter-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.sp-search {
  position: relative;
  flex: 1 1 180px;
  min-width: 0;
}

.sp-search .sp-icon {
  position: absolute;
  inset-inline-start: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--sp-text-faint);
  width: 14px;
  height: 14px;
}

.sp-search input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--sp-border);
  background: var(--sp-surface-2);
  border-radius: 9px;
  padding: 6px 34px 6px 10px;
  font-size: 10px;
  color: var(--sp-text);
}

.sp-search input:focus {
  outline: none;
  border-color: var(--sp-solar-text);
  background: var(--sp-surface);
}

.sp-select-mini {
  min-height: 34px;
  border: 1px solid var(--sp-border);
  background: var(--sp-surface-2);
  border-radius: 9px;
  padding: 4px 10px;
  font-size: 10px;
  color: var(--sp-text-muted);
}

/* Alerts ----------------------------------------------------------------- */
.sp-alert-list {
  display: grid;
  gap: 8px;
}

.sp-alert {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px 12px 13px;
  border-radius: 12px;
  background: var(--sp-surface-2);
  border: 1px solid transparent;
  border-inline-start: 3px solid var(--sp-warning);
  transition: border-color 160ms, background 160ms;
}

.sp-alert:hover { background: var(--sp-surface-3); }

.sp-alert--critical { border-inline-start-color: var(--sp-critical); }
.sp-alert--warning { border-inline-start-color: var(--sp-warning); }
.sp-alert--info { border-inline-start-color: var(--sp-info); }

.sp-alert--resolved {
  opacity: 0.62;
  border-inline-start-color: var(--sp-text-faint);
}

.sp-alert__icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--sp-warning-soft);
  color: var(--sp-warning);
  flex: 0 0 auto;
}

.sp-alert--critical .sp-alert__icon { background: var(--sp-critical-soft); color: var(--sp-critical); }
.sp-alert--info .sp-alert__icon { background: var(--sp-info-soft); color: var(--sp-info); }

.sp-alert__body {
  min-width: 0;
  flex: 1;
}

.sp-alert__title {
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.7;
}

.sp-alert__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 3px;
  font-size: 8.5px;
  color: var(--sp-text-faint);
}

.sp-alert__meta span { display: inline-flex; align-items: center; gap: 4px; }
.sp-alert__meta .sp-pill { font-size: 8px; padding: 2px 7px; }

.sp-alert__actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.sp-alert__actions .sp-btn {
  min-height: 27px;
  padding-inline: 10px;
  font-size: 8.5px;
  gap: 4px;
}

.sp-alert__time {
  flex: 0 0 auto;
  font-size: 8px;
  color: var(--sp-text-faint);
  white-space: nowrap;
}

.sp-alert-counts {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.sp-count-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 99px;
  background: var(--sp-surface-2);
  color: var(--sp-text-muted);
  font-size: 9px;
  font-weight: 600;
}

.sp-count-pill b { color: var(--sp-text); }
.sp-count-pill--danger b { color: var(--sp-critical); }
.sp-count-pill--warn b { color: var(--sp-warning); }

.sp-alert-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.sp-chip-btn {
  appearance: none;
  border: 1px solid var(--sp-border);
  background: var(--sp-surface);
  color: var(--sp-text-muted);
  border-radius: 99px;
  padding: 6px 11px;
  font-size: 9.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 160ms;
}

.sp-chip-btn:hover { border-color: var(--sp-border-strong); color: var(--sp-text); }

.sp-chip-btn.is-active {
  background: var(--sp-navy);
  border-color: var(--sp-navy);
  color: var(--sp-text-invert);
}

[data-theme="dark"] .sp-chip-btn.is-active {
  background: var(--sp-solar);
  border-color: var(--sp-solar-text);
  color: #1b1103;
}

.sp-chip-btn b {
  font-size: 8px;
  padding: 1px 5px;
  border-radius: 99px;
  background: var(--sp-surface-2);
  color: var(--sp-text-muted);
}

.sp-chip-btn.is-active b { background: rgba(255, 255, 255, 0.16); color: inherit; }

/* Site detail ------------------------------------------------------------ */
.sp-back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--sp-text-muted);
  margin-bottom: 10px;
}

.sp-back-link .sp-icon { transform: scaleX(-1); }
.sp-back-link:hover { color: var(--sp-text); }

.sp-site-hero {
  position: relative;
  border-radius: var(--sp-radius-lg);
  overflow: hidden;
  min-height: 190px;
  padding: clamp(18px, 3vw, 28px);
  color: #f2f8fc;
  background:
    radial-gradient(38rem 26rem at 85% -30%, rgba(246, 238, 49, 0.42), transparent 60%),
    var(--sp-gradient-night);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  margin-bottom: 14px;
  background-size: cover;
  background-position: center;
}

.sp-site-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(4, 13, 22, 0.15) 0%, rgba(4, 13, 22, 0.82) 100%);
  z-index: 1;
}

.sp-site-hero > * { position: relative; z-index: 2; }

.sp-site-hero__top {
  position: absolute;
  top: clamp(18px, 3vw, 28px);
  inset-inline: clamp(18px, 3vw, 28px);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  z-index: 3;
}

.sp-site-hero h2 {
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1.35;
}

.sp-site-hero p {
  font-size: 10.5px;
  color: #b7c8d4;
  margin-top: 4px;
}

.sp-site-hero__tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.sp-site-hero__tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 8.5px;
  color: #d7e5ee;
}

.sp-site-hero .sp-pill {
  background: rgba(255, 255, 255, 0.12);
  color: #d7e5ee;
}

.sp-site-hero .sp-pill--live { background: rgba(85, 214, 179, 0.18); color: #7ae3cf; }
.sp-site-hero .sp-pill--stale { background: rgba(240, 180, 84, 0.18); color: #f0b454; }
.sp-site-hero .sp-pill--offline { background: rgba(255, 255, 255, 0.1); color: #9fb0bd; }

.sp-detail-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.sp-detail-kpi {
  padding: 13px 14px;
  border-radius: 13px;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  box-shadow: var(--sp-shadow-1);
}

.sp-detail-kpi small {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  color: var(--sp-text-faint);
  margin-bottom: 4px;
}

.sp-detail-kpi b {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.sp-detail-kpi b span { font-size: 9px; color: var(--sp-text-faint); font-weight: 500; }

.sp-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.sp-device-list {
  display: grid;
  gap: 6px;
}

.sp-device {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 0.6fr 0.7fr auto;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--sp-surface-2);
  border: 1px solid transparent;
  font-size: 9px;
}

.sp-device:hover { border-color: var(--sp-border); }

.sp-device__name {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.sp-device__name .sp-icon { color: var(--sp-text-faint); }
.sp-device__name b { display: block; font-size: 9.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-device__name small { display: block; font-size: 7.5px; color: var(--sp-text-faint); direction: ltr; text-align: start; }

.sp-device__cell {
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--sp-text-muted);
}

.sp-device__cell b { display: block; color: var(--sp-text); font-size: 9.5px; }
.sp-device__cell small { font-size: 7px; color: var(--sp-text-faint); }

.sp-params {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.sp-param {
  padding: 10px;
  border-radius: 10px;
  background: var(--sp-surface-2);
}

.sp-param small { display: block; font-size: 8px; color: var(--sp-text-faint); margin-bottom: 2px; }
.sp-param b { font-size: 14px; font-weight: 750; font-variant-numeric: tabular-nums; }
.sp-param b span { font-size: 7.5px; color: var(--sp-text-faint); font-weight: 500; }

.sp-gateway-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 11px;
  background: var(--sp-surface-2);
  border: 1px solid var(--sp-border);
}

.sp-gateway-box .sp-icon { color: var(--sp-energy); }
.sp-gateway-box b { display: block; font-size: 10px; }
.sp-gateway-box small { display: block; font-size: 8px; color: var(--sp-text-faint); direction: ltr; text-align: start; }

/* Analytics -------------------------------------------------------------- */
.sp-filterbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.sp-filterbar__label {
  font-size: 9.5px;
  color: var(--sp-text-faint);
  margin-inline-end: 2px;
}

.sp-filterbar .sp-select-mini { min-width: 120px; }

.sp-totals {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.sp-total {
  padding: 13px 14px;
  border-radius: 13px;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  box-shadow: var(--sp-shadow-1);
}

.sp-total small { display: block; font-size: 8.5px; color: var(--sp-text-faint); margin-bottom: 3px; }
.sp-total b { font-size: 17px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.sp-total b span { font-size: 8.5px; color: var(--sp-text-faint); font-weight: 500; }

.sp-insights {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.sp-insight {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--sp-surface-2);
  font-size: 9.5px;
  color: var(--sp-text-muted);
}

.sp-insight .sp-icon { color: var(--sp-solar-strong); flex: 0 0 auto; }
.sp-insight b { color: var(--sp-text); font-variant-numeric: tabular-nums; }

.sp-heatmap-wrap {
  overflow-x: auto;
  padding-bottom: 4px;
}

.sp-heatmap {
  display: grid;
  grid-template-columns: 58px repeat(24, minmax(15px, 1fr));
  gap: 3px;
  min-width: 620px;
}

.sp-heat-label {
  font-size: 8px;
  color: var(--sp-text-faint);
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.sp-heat-hour {
  font-size: 7px;
  color: var(--sp-text-faint);
  text-align: center;
}

.sp-heat-cell {
  aspect-ratio: 1.35;
  min-height: 16px;
  border-radius: 4px;
  background: var(--sp-solar-soft);
  transition: transform 140ms, outline 140ms;
  outline: 0 solid transparent;
}

.sp-heat-cell:hover {
  transform: scale(1.18);
  outline: 2px solid var(--sp-solar);
}

.sp-heatmap-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: flex-end;
  margin-top: 8px;
  font-size: 8px;
  color: var(--sp-text-faint);
}

.sp-heatmap-legend i { width: 11px; height: 8px; border-radius: 2px; }

.sp-compare {
  width: 100%;
  border-collapse: collapse;
  font-size: 9.5px;
}

.sp-compare th {
  font-size: 8px;
  font-weight: 650;
  color: var(--sp-text-faint);
  text-align: start;
  padding: 0 8px 8px;
  white-space: nowrap;
}

.sp-compare td {
  padding: 9px 8px;
  border-top: 1px solid var(--sp-border-soft);
  color: var(--sp-text-muted);
  font-variant-numeric: tabular-nums;
}

.sp-compare tr:hover td { background: var(--sp-surface-2); }
.sp-compare td b { color: var(--sp-text); font-weight: 650; }
.sp-compare td:first-child { min-width: 150px; }

.sp-bar-mini {
  display: inline-flex;
  width: 52px;
  height: 4px;
  border-radius: 99px;
  background: var(--sp-surface-2);
  overflow: hidden;
  vertical-align: middle;
  margin-inline-end: 5px;
}

.sp-bar-mini i { height: 100%; border-radius: inherit; background: var(--sp-gradient-solar); }

/* Settings --------------------------------------------------------------- */
.sp-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.sp-setting-card {
  padding: clamp(15px, 2vw, 20px);
  border-radius: var(--sp-radius-md);
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  box-shadow: var(--sp-shadow-1);
}

.sp-setting-card h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.sp-setting-card h3 .sp-icon { color: var(--sp-solar-strong); }

.sp-setting-card > p {
  font-size: 9.5px;
  color: var(--sp-text-faint);
  line-height: 1.9;
}

.sp-theme-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 12px;
}

.sp-theme-option {
  appearance: none;
  border: 1.5px solid var(--sp-border);
  background: var(--sp-surface-2);
  border-radius: 10px;
  padding: 7px;
  display: grid;
  gap: 6px;
  text-align: center;
  font-size: 9px;
  font-weight: 600;
  color: var(--sp-text-muted);
  transition: border-color 160ms, background 160ms, color 160ms;
}

.sp-theme-option:hover { border-color: var(--sp-border-strong); }

.sp-theme-option.is-active {
  border-color: var(--sp-solar-text);
  background: var(--sp-solar-soft);
  color: var(--sp-solar-strong);
}

.sp-theme-preview {
  height: 43px;
  border-radius: 6px;
  border: 1px solid var(--sp-border);
  display: flex;
  gap: 3px;
  padding: 4px;
  overflow: hidden;
}

.sp-theme-preview--light { background: #f7f6ee; }
.sp-theme-preview--dark { background: #0b1721; }
.sp-theme-preview--system { background: linear-gradient(110deg, #f7f6ee 50%, #0b1721 50%); }

.sp-theme-preview i {
  display: block;
  border-radius: 2px;
  background: rgba(11, 22, 34, 0.14);
  height: 100%;
}

.sp-theme-preview i:first-child { width: 28%; }
.sp-theme-preview i:last-child { flex: 1; background: rgba(246, 238, 49, 0.75); height: 40%; align-self: flex-end; }

.sp-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--sp-border-soft);
  font-size: 10px;
  color: var(--sp-text-muted);
}

/* Data gateway: every parameter reported by the device gateway */
.sp-gw-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-block: 10px;
}
.sp-gw-field {
  border: 1px solid var(--sp-border);
  border-radius: 12px;
  padding: 8px 10px;
  background: var(--sp-surface-2);
  min-width: 0;
}
.sp-gw-field small { display: block; font-size: 8px; color: var(--sp-text-faint); margin-bottom: 3px; }
.sp-gw-field b { font-size: 10px; color: var(--sp-text); font-weight: 650; overflow-wrap: anywhere; }
.sp-gw-device {
  border: 1px solid var(--sp-border);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 12px;
  background: var(--sp-surface);
}
.sp-gw-device__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sp-gw-device__name { display: inline-flex; align-items: center; gap: 6px; }
.sp-gw-device__name b { font-size: 11px; }
.sp-gw-device__name small { font-size: 8.5px; color: var(--sp-text-faint); }
.sp-gw-pill {
  font-size: 8.5px;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--sp-surface-2);
  color: var(--sp-text-muted);
  border: 1px solid var(--sp-border);
}
.sp-gw-pill.is-on { background: rgba(50, 190, 160, .12); border-color: rgba(50, 190, 160, .3); color: #177a68; }
.sp-gw-pill.is-off { background: rgba(239, 106, 91, .12); border-color: rgba(239, 106, 91, .3); color: #b83a2c; }
.sp-gw-issues { display: flex; flex-wrap: wrap; gap: 6px; margin-block: 8px; }
.sp-gw-issues code { font-size: 8.5px; padding: 3px 8px; border-radius: 999px; background: rgba(239, 106, 91, .12); color: #b83a2c; }
.sp-gw-table-wrap { overflow-x: auto; margin-top: 8px; }
.sp-gw-table { min-width: 340px; }
.sp-gw-table th, .sp-gw-table td { font-size: 9.5px; }
.sp-gw-param__key { color: var(--sp-text-faint); font-size: 8px; direction: ltr; display: inline-block; }
.sp-gw-param__value { direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.sp-gw-raw { margin-top: 8px; }
.sp-gw-raw summary { font-size: 9px; color: var(--sp-text-muted); cursor: pointer; }
.sp-gw-raw pre {
  direction: ltr;
  text-align: left;
  font-size: 8.5px;
  line-height: 1.65;
  background: var(--sp-surface-2);
  border-radius: 10px;
  padding: 10px;
  margin-top: 6px;
  max-height: 260px;
  overflow: auto;
}
.sp-gw-health { border-top: 1px dashed var(--sp-border); margin-top: 6px; padding-top: 8px; }
.sp-setting-row:first-of-type { border-top: 0; }
.sp-setting-row b { color: var(--sp-text); font-weight: 600; }
.sp-setting-row small { display: block; font-size: 8px; color: var(--sp-text-faint); }

.sp-install-card {
  position: relative;
  overflow: hidden;
  padding: 20px;
  border-radius: var(--sp-radius-md);
  background: var(--sp-gradient-night);
  color: #f0f6fa;
  box-shadow: var(--sp-shadow-2);
}

.sp-install-card::before {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(246, 238, 49, 0.28);
  filter: blur(40px);
  top: -80px;
  inset-inline-end: -40px;
}

.sp-install-card h3 { color: #fff; font-size: 13px; display: flex; align-items: center; gap: 7px; }
.sp-install-card h3 .sp-icon { color: var(--sp-solar-text); }
.sp-install-card p { color: #a5bac9; font-size: 9.5px; margin: 7px 0 15px; line-height: 1.9; position: relative; }
.sp-install-card .sp-btn { position: relative; }

.sp-account {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border-radius: 11px;
  background: var(--sp-surface-2);
  border: 1px solid var(--sp-border);
  margin-top: 12px;
}

.sp-account .sp-avatar { width: 42px; height: 42px; font-size: 14px; }
.sp-account b { display: block; font-size: 11px; }
.sp-account small { display: block; font-size: 8.5px; color: var(--sp-text-faint); }
.sp-account .sp-btn { margin-inline-start: auto; }

.sp-logout {
  color: var(--sp-critical);
  font-size: 9.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Loading / error / empty ------------------------------------------------- */
.sp-skeleton-panel {
  min-height: 160px;
  border-radius: var(--sp-radius-md);
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  padding: 16px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.sp-skel {
  height: 10px;
  border-radius: 5px;
  background: var(--sp-surface-2);
  position: relative;
  overflow: hidden;
}

.sp-skel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.45) 48%, transparent 76%);
  animation: sp-shimmer 1.6s infinite;
  transform: translateX(-100%);
}

[data-theme="dark"] .sp-skel::after {
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.06) 48%, transparent 76%);
}

.sp-skel--sm { width: 40%; }
.sp-skel--md { width: 68%; }
.sp-skel--lg { width: 86%; }
.sp-skel--xl { height: 38px; border-radius: 8px; }
.sp-skel--chart { height: 170px; border-radius: 10px; }

.sp-error-box {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 40px 20px;
  text-align: center;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-md);
}

.sp-error-box .sp-empty__icon {
  background: var(--sp-critical-soft);
  color: var(--sp-critical);
}

.sp-error-box h2 { font-size: 1.05rem; }
.sp-error-box p { font-size: 10.5px; color: var(--sp-text-muted); max-width: 38ch; }

.sp-app-loading {
  display: grid;
  gap: 14px;
}

/* Bottom navigation ------------------------------------------------------ */
.sp-bottom-nav {
  display: none;
  position: fixed;
  z-index: 45;
  inset-inline: 14px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  height: 62px;
  padding: 5px 7px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--sp-surface) 88%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  backdrop-filter: blur(22px) saturate(1.2);
  border: 1px solid var(--sp-border);
  box-shadow: 0 18px 40px -22px rgba(8, 20, 32, 0.5);
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
}

.sp-bottom-link {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  background: none;
  color: var(--sp-text-faint);
  font-size: 7.5px;
  font-weight: 550;
  border-radius: 14px;
  transition: color 160ms, background 160ms;
}

.sp-bottom-link .sp-icon { width: 18px; height: 18px; }

.sp-bottom-link.is-active {
  color: var(--sp-solar-strong);
  background: var(--sp-solar-soft);
}

.sp-bottom-link__dot {
  position: absolute;
  top: 4px;
  inset-inline-end: 16px;
  min-width: 14px;
  height: 14px;
  border-radius: 99px;
  background: var(--sp-critical);
  color: #fff;
  font-size: 7px;
  font-weight: 700;
  display: grid;
  place-items: center;
  padding-inline: 3px;
}

/* Site cards / mobile alert tweaks */
.sp-mobile-only { display: none; }

/* Responsive ------------------------------------------------------------- */
@media (max-width: 1280px) {
  .sp-app { grid-template-columns: 236px minmax(0, 1fr); }
  .sp-kpi { padding: 14px 15px; min-height: 128px; }
  .sp-topbar__date { display: none; }
  .sp-site-row,
  .sp-table-head { grid-template-columns: minmax(0, 1.55fr) 0.8fr 0.8fr 0.8fr 0.7fr 28px; }
}

@media (max-width: 1120px) {
  .sp-app { grid-template-columns: minmax(0, 1fr); }
  .sp-sidebar { display: none; }
  .sp-bottom-nav { display: grid; }
  .sp-content { padding-bottom: calc(94px + env(safe-area-inset-bottom)); }
  .sp-topbar { height: 62px; }
  .sp-topbar__brand { display: inline-flex; }
  .sp-topbar__crumb { display: none; }
  .sp-topbar__scope { margin-inline-start: 2px; }
  .sp-kpi--power { grid-column: span 6; }
  .sp-grid-2 { grid-template-columns: 1fr; }
  .sp-detail-grid { grid-template-columns: 1fr; }
  .sp-totals { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sp-insights { grid-template-columns: 1fr; }
  .sp-toast-stack { bottom: calc(88px + env(safe-area-inset-bottom)); }
}

@media (max-width: 860px) {
  .sp-kpi { grid-column: span 6; min-height: 118px; }
  .sp-kpi--power { grid-column: span 12; }
  .sp-grid-half { grid-template-columns: 1fr; }
  .sp-detail-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sp-settings-grid { grid-template-columns: 1fr; }
  .sp-page-head { align-items: flex-start; }
  .sp-page-head__actions { width: 100%; justify-content: flex-start; }
  .sp-panel__head { margin-bottom: 10px; }
  .sp-site-row .sp-pill { font-size: 8px; }
}

@media (max-width: 720px) {
  .sp-content { padding-inline: 12px; }
  .sp-topbar { padding-inline: 12px; gap: 8px; }
  .sp-topbar__scope { display: none; }
  .sp-topbar__brand { font-size: 12px; }
  .sp-topbar .sp-avatar { width: 32px; height: 32px; }
  .sp-topbar__actions { gap: 4px; }
  .sp-topbar .sp-icon-btn { width: 36px; height: 36px; }
  .sp-bell__dot { top: 5px; inset-inline-end: 5px; }

  .sp-page-head { margin-bottom: 14px; }
  .sp-page-head h1 { font-size: 1.35rem; }
  .sp-page-head p { font-size: 10.5px; }
  .sp-page-head__actions .sp-btn { min-height: 34px; padding-inline: 12px; font-size: 9px; }

  .sp-kpis { gap: 8px; }
  .sp-kpi { padding: 13px; min-height: 112px; border-radius: 14px; }
  .sp-kpi__head { font-size: 9.5px; }
  .sp-kpi__value { font-size: 1.35rem; }
  .sp-kpi--power .sp-kpi__value { font-size: 2rem; }
  .sp-kpi__icon { width: 26px; height: 26px; top: 11px; inset-inline-end: 11px; }
  .sp-kpi__spark { height: 44px; }
  .sp-kpi__ring { width: 46px; height: 46px; }

  .sp-grid-2,
  .sp-grid-half { gap: 8px; margin-bottom: 12px; }
  .sp-panel { padding: 13px; border-radius: 14px; }
  .sp-panel__title { font-size: 11px; }
  .sp-chart-box { height: 185px; }
  .sp-range button { padding: 4px 7px; font-size: 8.5px; }

  .sp-site-list { gap: 7px; }
  .sp-table-head { display: none; }
  .sp-site-row {
    grid-template-columns: repeat(12, 1fr);
    gap: 7px 6px;
    padding: 11px;
    border: 1px solid var(--sp-border);
    border-radius: 12px;
    background: var(--sp-surface);
  }
  .sp-site-row:hover { background: var(--sp-surface); }
  .sp-site-name { grid-column: 1 / 9; }
  .sp-site-row .sp-pill { grid-column: 10 / 13; align-self: center; }
  .sp-site-row__arrow { display: none; }
  .sp-site-stat {
    grid-column: span 4;
    text-align: start;
    padding-top: 5px;
    border-top: 1px dashed var(--sp-border);
  }
  .sp-site-stat::before {
    content: attr(data-label);
    display: block;
    font-size: 7.5px;
    color: var(--sp-text-faint);
    margin-bottom: 1px;
  }
  .sp-site-stat b { font-size: 10px; }
  .sp-site-stat small { display: none; }
  .sp-site-list .sp-empty-inline { padding: 20px; }

  .sp-alert { padding: 11px; gap: 8px; }
  .sp-alert__icon { width: 26px; height: 26px; }
  .sp-alert__title { font-size: 9.7px; }
  .sp-alert__time { display: none; }
  .sp-alert__meta { gap: 5px; font-size: 8px; }
  .sp-alert__actions .sp-btn { min-height: 25px; font-size: 8px; }

  .sp-detail-kpis { gap: 7px; }
  .sp-detail-kpi { padding: 11px; }
  .sp-detail-kpi b { font-size: 15px; }
  .sp-site-hero { min-height: 210px; border-radius: 16px; }
  .sp-site-hero__tags { gap: 4px; }
  .sp-device { grid-template-columns: 1fr auto; padding: 9px; }
  .sp-device__cell:nth-of-type(2),
  .sp-device__cell:nth-of-type(3) { display: none; }
  .sp-device__cell:last-of-type { text-align: end; }
  .sp-device .sp-pill { grid-column: 2; }
  .sp-params { gap: 6px; }

  .sp-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .sp-total { padding: 11px; }
  .sp-total b { font-size: 15px; }
  .sp-compare { min-width: 620px; }
  .sp-heatmap { min-width: 560px; grid-template-columns: 50px repeat(24, minmax(13px, 1fr)); }
  .sp-heat-cell { min-height: 14px; }

  .sp-settings-grid { gap: 9px; }
  .sp-theme-options { gap: 6px; }
  .sp-install-card { padding: 16px; }
  .sp-account .sp-btn { font-size: 8px; min-height: 30px; }

  .sp-alert-filters { gap: 5px; }
  .sp-chip-btn { padding: 5px 9px; font-size: 8.5px; }

  .sp-bottom-nav { inset-inline: 10px; height: 58px; border-radius: 17px; }
  .sp-bottom-link { font-size: 7px; gap: 2px; }
  .sp-bottom-link .sp-icon { width: 16px; height: 16px; }
  .sp-bottom-link__dot { inset-inline-end: 12px; top: 3px; }
}

@media (max-width: 520px) {
  .sp-kpi { grid-column: span 6; min-height: 104px; padding: 11px; }
  .sp-kpi--power { grid-column: span 12; min-height: 132px; }
  .sp-kpi--energy-today,
  .sp-kpi--alerts { grid-column: span 6; }
  .sp-kpi__value { font-size: 1.2rem; }
  .sp-kpi--power .sp-kpi__value { font-size: 1.9rem; }
  .sp-kpi__head { font-size: 8.5px; gap: 5px; }
  .sp-kpi__head .sp-icon { width: 13px; height: 13px; }
  .sp-kpi__foot { font-size: 8px; }
  .sp-kpi__trend { font-size: 8px; }

  .sp-page-head h1 { font-size: 1.2rem; }
  .sp-page-head__eyebrow { font-size: 8.5px; }
  .sp-page-head__actions .sp-btn { flex: 1 1 auto; }

  .sp-panel__actions { width: 100%; justify-content: space-between; }
  .sp-range { width: 100%; justify-content: space-between; }
  .sp-range button { flex: 1; }

  .sp-fleet { flex-direction: column; align-items: stretch; }
  .sp-donut { margin-inline: auto; }
  .sp-fleet-legend { width: 100%; }

  .sp-site-stat { grid-column: span 4; }
  .sp-detail-kpis { grid-template-columns: 1fr 1fr; }
  .sp-site-hero { min-height: 235px; padding: 16px; }
  .sp-site-hero__top { top: 16px; inset-inline: 16px; }
  .sp-site-hero__tag { font-size: 7.5px; }
  .sp-site-hero h2 { font-size: 1.3rem; }
  .sp-params { grid-template-columns: 1fr 1fr; }
  .sp-param { padding: 8px; }
  .sp-param b { font-size: 12px; }

  .sp-totals { grid-template-columns: 1fr 1fr; }
  .sp-total b { font-size: 14px; }
  .sp-settings-grid { gap: 8px; }
  .sp-theme-option { font-size: 8px; padding: 5px; }
  .sp-theme-preview { height: 36px; }
  .sp-install-card h3 { font-size: 12px; }

  .sp-alert__actions { width: 100%; }
  .sp-alert__actions .sp-btn { flex: 1; }

  .sp-bottom-nav { inset-inline: 8px; bottom: calc(7px + env(safe-area-inset-bottom)); }
  .sp-content { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
  .sp-bottom-link { font-size: 6.5px; }
  .sp-bottom-link__dot { inset-inline-end: 7px; }
}

@media print {
  .sp-sidebar,
  .sp-topbar,
  .sp-bottom-nav,
  .sp-page-head__actions,
  .sp-alert__actions { display: none !important; }
  .sp-app { display: block; }
  .sp-content { padding: 0; }
  .sp-panel, .sp-kpi { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

/* Small shared refinements ------------------------------------------------ */
.sp-overline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 600;
  color: var(--sp-solar-strong);
  white-space: nowrap;
}

.sp-overline:hover { color: var(--sp-solar-text); }
.sp-overline .sp-icon { transform: scaleX(-1); }

.sp-select-mini {
  min-height: 32px;
  max-width: 100%;
}

@media (max-width: 720px) {
  .sp-device__cell--temp,
  .sp-device__cell--cap { display: none; }
  .sp-device { grid-template-columns: minmax(0, 1fr) auto auto; }
  .sp-device__cell { text-align: end; }
  .sp-device .sp-pill { justify-self: end; }
  .sp-device__name b { font-size: 9px; }
  .sp-count-pill { font-size: 8.5px; }
  .sp-alert-counts { gap: 5px; }
}

/* Connection guide ------------------------------------------------------- */
.sp-connect-strip {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(14px, 2vw, 24px);
  align-items: center;
  margin-bottom: clamp(14px, 2vw, 20px);
  overflow: hidden;
  position: relative;
  border: 0;
  background: var(--sp-gradient-night);
  color: #eaf3f8;
  box-shadow: var(--sp-shadow-2);
}

.sp-connect-strip::before {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  inset-inline-end: -90px;
  top: -130px;
  border-radius: 50%;
  background: rgba(246, 238, 49, 0.26);
  filter: blur(46px);
  pointer-events: none;
}

.sp-connect-strip__lead { position: relative; z-index: 1; }
.sp-connect-strip__badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 99px;
  background: rgba(246, 238, 49, 0.14);
  border: 1px solid rgba(246, 238, 49, 0.28);
  color: #fff66b;
  font-size: 8.5px;
  font-weight: 600;
}
.sp-connect-strip h2 { color: #fff; font-size: clamp(15px, 1.6vw, 20px); margin: 9px 0 5px; }
.sp-connect-strip p { color: #a9bfcd; font-size: 9.5px; line-height: 1.95; max-width: 60ch; margin-bottom: 12px; }

.sp-connect-flow {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.sp-connect-flow > div {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.sp-connect-flow b {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 7px;
  background: var(--sp-gradient-solar);
  color: #3d2400;
  font-size: 9px;
}
.sp-connect-flow span { display: block; color: #eaf3f8; font-size: 9px; font-weight: 600; line-height: 1.5; }
.sp-connect-flow small { display: block; color: #8ea6b6; font-size: 7.5px; font-weight: 400; }

.sp-connect-note {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 9px 12px;
  border-radius: 11px;
  background: var(--sp-solar-soft);
  border: 1px solid rgba(246, 238, 49, 0.28);
  color: var(--sp-solar-ink);
  font-size: 9.5px;
}
.sp-connect-note span { flex: 1; min-width: 180px; }
.sp-connect-note a { font-weight: 700; color: var(--sp-solar-strong); text-decoration: underline; text-underline-offset: 3px; }

.sp-connect-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
  gap: clamp(14px, 2vw, 24px);
  align-items: center;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
  border: 0;
  background: var(--sp-gradient-night);
  color: #eaf3f8;
  box-shadow: var(--sp-shadow-2);
}
.sp-connect-hero::before {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  inset-inline-start: -110px;
  bottom: -160px;
  border-radius: 50%;
  background: rgba(55, 184, 164, 0.22);
  filter: blur(46px);
  pointer-events: none;
}
.sp-connect-hero__copy { position: relative; z-index: 1; min-width: 0; }
.sp-connect-hero__kicker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #fff66b;
  font-size: 8.5px;
  font-weight: 600;
}
.sp-connect-hero h2 { color: #fff; font-size: clamp(16px, 1.8vw, 23px); margin: 7px 0 5px; }
.sp-connect-hero p { color: #a9bfcd; font-size: 9.5px; line-height: 1.95; max-width: 62ch; }

.sp-endpoint { margin-top: 13px; }
.sp-endpoint__label { display: block; color: #8ea6b6; font-size: 7.5px; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 5px; }
.sp-endpoint__row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 6px 6px 10px;
  border-radius: 10px;
  background: rgba(3, 12, 19, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.11);
}
.sp-endpoint__row code {
  flex: 1;
  min-width: 0;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 9px;
  color: #cfe3ee;
  white-space: nowrap;
  scrollbar-width: thin;
}
.sp-endpoint__row .sp-copy-btn { position: static; flex: 0 0 auto; }

.sp-connect-hero__meta {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.sp-connect-hero__meta > div {
  padding: 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
}
.sp-connect-hero__meta b { display: block; color: #fff; font-size: 13px; font-weight: 700; direction: ltr; text-align: start; }
.sp-connect-hero__meta small { display: block; color: #8ea6b6; font-size: 8px; margin-top: 2px; }

.sp-guide { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.sp-guide-step {
  position: relative;
  padding: 13px;
  border-radius: 12px;
  background: var(--sp-surface-2);
  border: 1px solid var(--sp-border);
  min-width: 0;
}
.sp-guide-step__num {
  position: absolute;
  top: 9px;
  inset-inline-end: 10px;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  color: var(--sp-text-faint);
  font-size: 8px;
  font-weight: 700;
}
.sp-guide-step__icon {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  margin-bottom: 9px;
  border-radius: 10px;
  background: var(--sp-solar-soft);
  color: var(--sp-solar-strong);
}
.sp-guide-step h3 { font-size: 10.5px; margin-bottom: 4px; }
.sp-guide-step p { font-size: 8.8px; line-height: 1.9; color: var(--sp-text-muted); margin-bottom: 9px; }
.sp-guide-step .sp-overline { font-size: 8.2px; }

.sp-code-wrap {
  position: relative;
  border-radius: 11px;
  background: #07131d;
  border: 1px solid rgba(255, 255, 255, 0.09);
  margin-bottom: 10px;
  overflow: hidden;
}
.sp-code {
  margin: 0;
  padding: 12px 12px 13px;
  overflow: auto;
  max-height: 320px;
  color: #d5e5ef;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
  font-size: 9px;
  line-height: 1.95;
  white-space: pre;
  scrollbar-width: thin;
}
.sp-code code { font: inherit; color: inherit; background: none; padding: 0; }
.sp-copy-btn {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  color: #d5e5ef;
  cursor: pointer;
  transition: background 160ms, color 160ms, border-color 160ms;
}
.sp-copy-btn:hover { background: var(--sp-solar); border-color: var(--sp-solar-text); color: #171500; }
.sp-code-wrap > .sp-copy-btn { position: absolute; top: 7px; inset-inline-end: 7px; }

.sp-connect-help {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  color: var(--sp-text-faint);
  font-size: 8.8px;
  line-height: 1.9;
}
.sp-connect-help code,
.sp-connect-hero code,
.sp-connect-note code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  direction: ltr;
  unicode-bidi: embed;
}

.sp-response-list { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 11px; }
.sp-response {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 7.8px;
  border: 1px solid var(--sp-border);
  color: var(--sp-text-muted);
  background: var(--sp-surface-2);
}
.sp-response b { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 8px; direction: ltr; }
.sp-response--ok { color: var(--sp-success); background: var(--sp-success-soft); border-color: transparent; }
.sp-response--warn { color: var(--sp-warning); background: var(--sp-warning-soft); border-color: transparent; }
.sp-response--muted b { color: var(--sp-text-faint); }

.sp-protocols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sp-protocol {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px;
  border-radius: 11px;
  background: var(--sp-surface-2);
  border: 1px solid var(--sp-border);
  min-width: 0;
}
.sp-protocol > span {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  flex: 0 0 auto
  flex: 0 0 auto;
  border-radius: 9px;
  background: var(--sp-energy-soft);
  color: var(--sp-energy-strong);
}
.sp-protocol b { display: block; font-size: 10px; }
.sp-protocol small { display: block; font-size: 8.5px; color: var(--sp-text-muted); line-height: 1.8; margin-top: 1px; }
.sp-protocol__key {
  display: inline-block;
  margin-top: 4px;
  font-size: 7.5px;
  color: var(--sp-text-faint);
  direction: ltr;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.sp-connect-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.sp-connect-foot > div:first-child { display: flex; align-items: flex-start; gap: 9px; flex: 1; min-width: 220px; }
.sp-connect-foot > div:first-child > .sp-icon { color: var(--sp-solar-strong); flex: 0 0 auto; margin-top: 2px; }
.sp-connect-foot b { display: block; font-size: 10.5px; margin-bottom: 3px; }
.sp-connect-foot p { font-size: 8.8px; line-height: 1.9; color: var(--sp-text-muted); max-width: 90ch; }
.sp-connect-foot__actions { display: flex; gap: 6px; flex-wrap: wrap; }

@media (max-width: 1100px) {
  .sp-connect-strip,
  .sp-connect-hero { grid-template-columns: 1fr; }
  .sp-connect-flow { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sp-guide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .sp-connect-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sp-connect-hero__meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sp-guide { grid-template-columns: 1fr; }
  .sp-protocols { grid-template-columns: 1fr; }
  .sp-connect-strip h2 { font-size: 14px; }
  .sp-connect-strip p,
  .sp-connect-hero p { font-size: 9px; }
  .sp-code { font-size: 8.5px; }
  .sp-connect-foot__actions { width: 100%; }
  .sp-connect-foot__actions .sp-btn { flex: 1; }
}

@media print {
  .sp-connect-strip,
  .sp-connect-hero { background: #fff; color: #000; box-shadow: none; border: 1px solid #ddd; }
  .sp-connect-strip h2,
  .sp-connect-hero h2,
  .sp-connect-hero__meta b { color: #000; }
}

.sp-guide-step__meta {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  margin-bottom: 6px;
  border-radius: 99px;
  background: var(--sp-surface-2);
  border: 1px solid var(--sp-border-soft);
  font-size: 8.5px;
  font-weight: 600;
  color: var(--sp-text-faint);
}

/* Yacada — 14-day forecast and location map */
.sp-forecast-layout {
  display: grid;
  grid-template-columns: minmax(340px, .88fr) minmax(0, 1.12fr);
  gap: 14px;
  margin-bottom: 14px;
}
.sp-forecast-map-panel { overflow: hidden; }
.sp-forecast-map-panel .sp-panel__head { padding-bottom: 10px; }
.sp-forecast-map-panel .sp-panel__title { font-size: 13px; letter-spacing: -.01em; }
.sp-forecast-map-panel .sp-panel__sub { color: var(--sp-text-muted); font-size: 11.5px; line-height: 1.7; }
.sp-forecast-tools { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.sp-forecast-tools .sp-btn { flex: 0 1 auto; }
.sp-print-only { display: none; }
.sp-forecast-select { display: flex; align-items: center; gap: 8px; padding: 0 16px 10px; }
.sp-forecast-select label { color: var(--sp-text-muted); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.sp-forecast-select select {
  flex: 1; min-width: 0; min-height: 38px; padding: 8px 10px; border: 1px solid var(--sp-border-strong);
  border-radius: 8px; background: var(--sp-surface-2); color: var(--sp-text);
  font: inherit; font-size: 12px; font-weight: 500;
}
.sp-forecast-select select:focus-visible,
.sp-location-field select:focus-visible,
.sp-map-coords input:focus-visible { outline: 2px solid var(--sp-solar-strong); outline-offset: 1px; }
.sp-forecast-select option,
.sp-location-field option { background: var(--sp-surface); color: var(--sp-text); }
.sp-forecast-location { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 0 16px 9px; }
.sp-location-field { display: grid; gap: 5px; min-width: 0; color: var(--sp-text-muted); font-size: 12px; font-weight: 600; }
.sp-location-field select {
  width: 100%; min-width: 0; min-height: 38px; box-sizing: border-box; padding: 8px 10px;
  border: 1px solid var(--sp-border-strong); border-radius: 8px;
  background: var(--sp-surface-2); color: var(--sp-text);
  font: inherit; font-size: 12px; font-weight: 500;
}
.sp-location-field select:disabled { opacity: .55; cursor: not-allowed; }
.sp-location-note {
  margin: 0 16px 10px; padding: 8px 10px; border: 1px solid var(--sp-border-soft); border-radius: 8px;
  background: var(--sp-surface-2); color: var(--sp-text-muted); font-size: 11px; line-height: 1.75;
}
.sp-forecast-map {
  height: 300px;
  margin: 0 16px;
  border-radius: 12px;
  background: #dfe8e6;
  z-index: 1;
}
.sp-forecast-map .leaflet-container { font-family: inherit; }
.sp-forecast-map .leaflet-control-attribution { font-size: 8px; direction: ltr; }
.sp-map-fallback { margin: 0 16px; padding: 10px; border-radius: 8px; background: #fff4df; color: #805b1e; font-size: 11px; }
.sp-map-coords { display: flex; flex-wrap: wrap; align-items: end; gap: 7px; padding: 10px 16px 0; }
.sp-map-coords label { display: grid; gap: 5px; flex: 1; min-width: 98px; color: var(--sp-text-muted); font-size: 11.5px; font-weight: 600; }
.sp-map-coords input { width: 100%; min-height: 36px; box-sizing: border-box; padding: 7px 8px; border: 1px solid var(--sp-border-strong); border-radius: 7px; background: var(--sp-surface-2); color: var(--sp-text); font: inherit; font-size: 12px; }
.sp-map-save { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px; padding: 10px 16px 14px; }
.sp-map-save small, .sp-map-source { display: inline-flex; align-items: center; gap: 4px; color: var(--sp-text-muted); font-size: 10.5px; line-height: 1.6; }
.sp-forecast-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sp-forecast-kpi {
  padding: 15px; border: 1px solid var(--sp-border, #ded9cd); border-radius: 14px;
  background: var(--sp-surface, #fffef8); display: flex; flex-direction: column; gap: 5px;
}
.sp-forecast-kpi small { color: var(--sp-text-faint, #8a98a1); font-size: 10.5px; }
.sp-forecast-kpi b { color: var(--sp-text, #11130c); font-size: 23px; letter-spacing: -.02em; line-height: 1.3; }
.sp-forecast-kpi b span { font-size: 11px; font-weight: 500; color: var(--sp-text-faint, #8a98a1); }
.sp-forecast-kpi em { display: inline-flex; align-items: center; gap: 4px; color: #b77a21; font-size: 10px; font-style: normal; margin-top: auto; }
.sp-forecast-kpi em svg { flex: 0 0 auto; }
.sp-forecast-chart-panel .sp-chart-box { min-height: 285px; }
.sp-forecast-method__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 4px 16px 16px; }
.sp-forecast-method__grid > div:last-child { grid-column: 1 / -1; }
.sp-forecast-method__grid b { display: block; margin-bottom: 6px; color: var(--sp-text, #11130c); font-size: 12px; }
.sp-forecast-method__grid p, .sp-forecast-method__grid li { margin: 0; color: var(--sp-text-soft, #697b89); font-size: 11px; line-height: 1.9; }
.sp-forecast-method__grid ul { margin: 0; padding-inline-start: 16px; }
.sp-fc-panel { margin-top: 14px; }
.sp-fc-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; padding: 0 14px 16px; }
.sp-fc-day {
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
  padding: 11px 10px; border: 1px solid var(--sp-border, #ded9cd); border-radius: 12px;
  background: var(--sp-surface-soft, #f7f5eb);
}
.sp-fc-day:nth-child(-n+3) { border-color: rgba(246, 238, 49, .42); background: rgba(246, 238, 49, .05); }
.sp-fc-day__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 5px; }
.sp-fc-day__head b { display: block; color: var(--sp-text, #11130c); font-size: 11.5px; white-space: nowrap; }
.sp-fc-day__head small { display: block; color: var(--sp-text-faint, #8a98a1); font-size: 9px; margin-top: 2px; }
.sp-fc-day__icon { color: #c17e18; }
.sp-fc-day__weather { color: var(--sp-text-soft, #697b89); font-size: 9.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-fc-day__energy { color: var(--sp-text, #11130c); font-size: 18px; font-weight: 800; letter-spacing: -.03em; }
.sp-fc-day__energy small { font-size: 9px; color: var(--sp-text-faint, #8a98a1); font-weight: 500; letter-spacing: 0; }
.sp-fc-day__range { color: var(--sp-text-faint, #8a98a1); font-size: 8.5px; line-height: 1.5; }
.sp-fc-day__meta { display: flex; align-items: center; justify-content: space-between; gap: 4px; color: var(--sp-text-soft, #697b89); font-size: 8.5px; }
.sp-fc-day__meta span { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.sp-fc-day__bar { height: 4px; margin-top: auto; border-radius: 99px; background: rgba(11, 22, 34, .07); overflow: hidden; }
.sp-fc-day__bar i { display: block; height: 100%; border-radius: inherit; background: var(--sp-chart); }
.sp-forecast-disclaimer {
  display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; padding: 14px 16px;
  border: 1px solid rgba(176, 118, 24, .32); border-radius: 13px;
  background: #fff7e8; color: #6f521d;
}
.sp-forecast-disclaimer > svg { flex: 0 0 auto; margin-top: 1px; color: #b07718; }
.sp-forecast-disclaimer b { display: block; font-size: 12px; margin-bottom: 3px; }
.sp-forecast-disclaimer p { margin: 0; font-size: 10.5px; line-height: 1.9; }
.sp-forecast-disclaimer small { display: block; margin-top: 5px; color: #927640; font-size: 9px; }
@media (max-width: 1100px) {
  .sp-forecast-layout { grid-template-columns: 1fr; }
  .sp-forecast-map { height: 260px; }
  .sp-fc-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .sp-forecast-kpis { grid-template-columns: 1fr 1fr; }
  .sp-forecast-method__grid { grid-template-columns: 1fr; }
  .sp-forecast-method__grid > div:last-child { grid-column: auto; }
  .sp-fc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 460px) {
  .sp-forecast-kpis { grid-template-columns: 1fr; }
  .sp-fc-grid { grid-template-columns: 1fr 1fr; }
  .sp-forecast-map { margin: 0 10px; }
  .sp-map-coords { padding-inline: 10px; }
  .sp-forecast-select, .sp-forecast-location { padding-inline: 12px; }
  .sp-location-note { margin-inline: 12px; }
}

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  html, body, body.sp-app-page { background: #fff !important; color: #111 !important; }
  .sp-content, .sp-content * { color: #111 !important; background: transparent !important; box-shadow: none !important; }
  .sp-print-only { display: block !important; margin: 0 0 14px; }
  .sp-print-brand { font-size: 10px; font-weight: 700; letter-spacing: .06em; color: #8a5a0a !important; }
  .sp-print-only h1 { margin: 4px 0; font-size: 20px; line-height: 1.4; }
  .sp-print-only p { margin: 0; font-size: 10px; color: #444 !important; }
  .sp-page-head, .sp-forecast-tools, .sp-forecast-map-panel, .sp-forecast-chart-panel, .sp-overline,
  .sp-forecast-select, .sp-forecast-location, .sp-location-note,
  .sp-map-coords, .sp-map-save, .sp-forecast-method { display: none !important; }
  .sp-forecast-layout { display: block; }
  .sp-forecast-kpis { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .sp-forecast-kpi, .sp-fc-day, .sp-panel { border-color: #ccc !important; background: #fff !important; break-inside: avoid; }
  .sp-fc-grid { grid-template-columns: repeat(4, 1fr); gap: 5px; padding: 0 0 8px; }
  .sp-fc-day { padding: 8px; }
  .sp-forecast-disclaimer { border-color: #aaa !important; background: #fff !important; break-inside: avoid; }
}
