/* Base & Typography */
:root {
  --bg-main: #090d16;
  --bg-card: rgba(17, 24, 39, 0.75);
  --border-card: rgba(255, 255, 255, 0.08);
  --solar-color: #f59e0b;
  --home-color: #38bdf8;
  --grid-export: #10b981;
  --grid-import: #f97316;
  --battery-color: #a855f7;
  --text-muted: #94a3b8;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.06) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(245, 158, 11, 0.06) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
  background-attachment: fixed;
  color: #f8fafc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: 1.25rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.glow-solar { box-shadow: 0 0 25px -5px rgba(245, 158, 11, 0.35); }
.glow-home { box-shadow: 0 0 25px -5px rgba(56, 189, 248, 0.35); }
.glow-export { box-shadow: 0 0 25px -5px rgba(16, 185, 129, 0.35); }
.glow-import { box-shadow: 0 0 25px -5px rgba(249, 115, 22, 0.35); }
.glow-battery { box-shadow: 0 0 25px -5px rgba(168, 85, 247, 0.35); }

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 0.2; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.pulsing-ring {
  animation: pulse-ring 2.4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.power-flow-container {
  position: relative;
  width: 100%;
  max-width: 620px;
  margin: 0.5rem auto;
  height: 125px;
}

.flow-node {
  position: absolute;
  top: 50% !important;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  z-index: 10;
  transition: all 0.3s ease;
  user-select: none;
}

@media (min-width: 640px) {
  .flow-node {
    width: 94px;
    height: 94px;
  }
  .power-flow-container {
    height: 135px;
  }
}

.node-grid {
  left: 14%;
}

.node-grid-centered {
  left: 14% !important;
}

.node-home {
  left: 50%;
}

.node-solar {
  left: 86%;
}

.nav-pill {
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-weight: 500;
  font-size: 0.875rem;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  transition: all 0.15s ease;
  cursor: pointer;
}

.nav-pill.active {
  color: #ffffff;
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
}

.nav-pill:hover:not(.active) {
  background: rgba(255, 255, 255, 0.09);
  color: #e2e8f0;
}

.scenario-pill {
  padding: 0.35rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  transition: all 0.15s ease;
  cursor: pointer;
}

.scenario-pill.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fbbf24;
}

.modal-backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}


/* Tabular figures for rock-solid live numbers without jitter */
.font-mono, [id^="val-"], .metric-value {
  font-variant-numeric: tabular-nums !important;
  font-feature-settings: "tnum" !important;
}

/* Always keep KPI numbers & units on a single line (especially iPad / tablet) */
#val-gas-m3, #val-gas-today-m3, #val-cons-w, #val-grid-import-w, #val-solar-w, #val-result-w, #val-actual-cost-today, #val-inv1-w, #val-inv2-w {
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
}
