:root {
  /* Water Company Professional Palette */
  --bg: #0a0e16;
  --bg-elevated: #111827;
  --bg-card: #1a2332;
  --ink: #f8fafc;
  --muted: #94a3b8;
  --border: #334155;
  
  /* Primary Blue - Water Theme */
  --primary: #0066cc;
  --primary-dark: #004d99;
  --primary-light: #3388dd;
  
  /* Status Colors */
  --safe: #10b981;
  --warning: #f59e0b;
  --critical: #dc2626;
  
  /* Accent Colors */
  --accent: #0891b2;
  --accent-soft: #2dd4bf;
  
  /* Shadows */
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 30px 60px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: 
    radial-gradient(ellipse 1200px 800px at 20% 0%, rgba(0, 102, 204, 0.08), transparent 50%),
    radial-gradient(ellipse 1000px 700px at 80% 100%, rgba(8, 145, 178, 0.06), transparent 50%),
    linear-gradient(180deg, #0a0e16 0%, #0d1117 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.noise {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='150' height='150' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
  pointer-events: none;
  mix-blend-mode: soft-light;
  opacity: 0.4;
  z-index: 1;
}

.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 48px 28px 80px;
  position: relative;
  z-index: 2;
  animation: fadeIn 0.6s ease-out;
}

/* HEADER */
.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 40px;
}

.eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  padding: 6px 14px;
  border-radius: 6px;
  margin: 0 0 14px;
  box-shadow: 0 0 20px rgba(0, 102, 204, 0.3);
}

h1 {
  font-size: clamp(32px, 5vw, 46px);
  font-weight: 700;
  margin: 0 0 12px;
  background: linear-gradient(135deg, var(--ink) 0%, var(--muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sub {
  color: var(--muted);
  margin: 0;
  max-width: 600px;
  line-height: 1.7;
  font-size: 15px;
}

.status {
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 14px 22px;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.status .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--safe);
  box-shadow: 0 0 12px var(--safe);
  animation: pulse 2s infinite;
}

.status-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.status-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 500;
}

.status-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

/* KPI SUMMARY */
.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.summary-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.summary-item:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(0, 102, 204, 0.2);
}

.summary-item.primary {
  background: linear-gradient(135deg, rgba(0, 102, 204, 0.15), rgba(0, 77, 153, 0.1));
  border-color: var(--primary);
}

.summary-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 102, 204, 0.15);
  border-radius: 10px;
  color: var(--primary);
  flex-shrink: 0;
}

.summary-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.summary-item span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
}

.summary-item strong {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  border: 1px solid;
  width: fit-content;
}

.badge.ok {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--safe);
  color: var(--safe);
}

.badge.warn {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--warning);
  color: var(--warning);
}

.badge.crit {
  background: rgba(220, 38, 38, 0.15);
  border-color: var(--critical);
  color: var(--critical);
}

/* MAIN GRID */
.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 2fr 1fr 1fr;
  margin-bottom: 32px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover::before {
  opacity: 1;
}

.card.accent {
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(0, 102, 204, 0.08) 100%);
  border-color: var(--primary);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card h2 {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}

.card-badge {
  padding: 4px 10px;
  background: rgba(0, 102, 204, 0.2);
  color: var(--primary);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 6px;
}

.card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.value-display {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.value {
  font-size: clamp(42px, 6vw, 60px);
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  margin: 0;
  line-height: 1;
  color: var(--ink);
}

.value.small {
  font-size: clamp(36px, 5vw, 48px);
}

.unit {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
}

/* Tank Visual */
.tank-visual {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tank-container {
  width: 70px;
  height: 110px;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid var(--border);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

.tank-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0%;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  transition: height 1s ease, background 0.5s ease;
}

.tank-levels {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.level-mark {
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
  position: absolute;
}

/* Battery Visual */
.battery-visual {
  display: flex;
  align-items: center;
  justify-content: center;
}

.battery-container {
  width: 60px;
  height: 30px;
  border: 2.5px solid var(--border);
  border-radius: 6px;
  position: relative;
  background: rgba(0, 0, 0, 0.4);
}

.battery-container::after {
  content: '';
  position: absolute;
  right: -7px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 14px;
  background: var(--border);
  border-radius: 0 3px 3px 0;
}

.battery-fill {
  position: absolute;
  left: 3px;
  top: 3px;
  bottom: 3px;
  width: 0%;
  background: var(--safe);
  border-radius: 2px;
  transition: all 0.8s ease;
}

/* Signal Visual */
.signal-visual {
  display: flex;
  align-items: center;
  justify-content: center;
}

.signal-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 40px;
}

.signal-bars .bar {
  width: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  transition: background 0.4s ease;
}

.signal-bars .bar:nth-child(1) { height: 20%; }
.signal-bars .bar:nth-child(2) { height: 40%; }
.signal-bars .bar:nth-child(3) { height: 60%; }
.signal-bars .bar:nth-child(4) { height: 80%; }
.signal-bars .bar:nth-child(5) { height: 100%; }

.signal-bars .bar.active {
  background: var(--safe);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.meta-item.highlight {
  font-weight: 600;
  color: var(--primary);
}

.meta-icon {
  width: 18px;
  height: 18px;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.meta-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* PANEL */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 24px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.panel-head h2 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-actions button {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--ink);
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0 20px rgba(0, 102, 204, 0.3);
}

.panel-actions button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 102, 204, 0.4);
}

.panel-actions button:active {
  transform: translateY(0);
}

.chart-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
}

.chart-block {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}

.chart-block h3 {
  margin: 0 0 14px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.chart {
  width: 100%;
  min-height: 420px;
  position: relative;
}

.chart svg {
  width: 100%;
  height: 420px;
  display: block;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.92);
  border: 1px solid var(--primary);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'JetBrains Mono', monospace;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, -120%);
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 10;
}

.chart-tooltip strong {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--primary);
}

.chart-line {
  stroke-dasharray: 2000;
  stroke-dashoffset: 2000;
  animation: draw 1.4s ease forwards;
}

/* SPECS */
.specs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.specs div {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.specs span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
}

.specs strong {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
}

/* FOOTER */
footer {
  margin-top: 32px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* ANIMATIONS */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* RESPONSIVE */
@media (max-width: 1024px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .page {
    padding: 32px 20px;
  }

  .top {
    flex-direction: column;
  }

  .summary {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 28px;
  }

  .value {
    font-size: 42px;
  }

  .value.small {
    font-size: 36px;
  }

  footer {
    flex-direction: column;
    gap: 8px;
  }
}
