:root {
  --bg: #08131a;
  --panel: rgba(11, 27, 34, 0.88);
  --panel-strong: #10232c;
  --panel-soft: rgba(18, 42, 52, 0.7);
  --border: rgba(141, 198, 184, 0.18);
  --text: #ebf6f0;
  --muted: #94b6ae;
  --accent: #67e8b2;
  --accent-deep: #2e8f73;
  --warning: #ffb54a;
  --danger: #ff6d5d;
  --ok: #76f0c6;
  --shadow: 0 24px 60px rgba(1, 7, 10, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(81, 180, 144, 0.18), transparent 26%),
    radial-gradient(circle at right center, rgba(255, 181, 74, 0.12), transparent 22%),
    linear-gradient(135deg, #061118 0%, #091a21 44%, #0f2129 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 28px 22px;
  background: rgba(6, 16, 22, 0.92);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 30px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  color: #04231a;
  background: linear-gradient(135deg, #9af6ce, #4cc08f);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.brand h1,
.topbar h2,
.panel h3,
.view-copy h3,
.metric-card h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.03em;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
}

.nav-group {
  display: grid;
  gap: 10px;
  margin-bottom: 28px;
}

.nav-item {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: 180ms ease;
}

.nav-item:hover,
.nav-item.active {
  background: linear-gradient(135deg, rgba(77, 159, 131, 0.2), rgba(20, 42, 51, 0.92));
  border-color: var(--border);
}

.sidebar-card,
.panel,
.content-panel {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.sidebar-card {
  padding: 18px;
}

.signal-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(141, 198, 184, 0.08);
  font-size: 0.95rem;
}

.signal-row:last-child {
  border-bottom: 0;
}

.status.high {
  color: var(--danger);
}

.status.medium {
  color: var(--warning);
}

.status.ok {
  color: var(--ok);
}

.main-panel {
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(13, 33, 41, 0.82);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

.pill.online {
  color: #032218;
  background: linear-gradient(135deg, #aef8d8, #5de3ad);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(360px, 0.95fr);
  gap: 20px;
  align-items: start;
}

.dashboard-metrics {
  margin-bottom: 20px;
}

.stack {
  display: grid;
  gap: 20px;
}

.map-panel {
  align-self: start;
}

.panel,
.content-panel {
  padding: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 16px;
}

.panel-tag {
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(103, 232, 178, 0.14);
  border: 1px solid rgba(103, 232, 178, 0.16);
  color: #aef8d8;
  font-size: 0.85rem;
}

.map-stage {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  min-height: 470px;
  background:
    linear-gradient(180deg, rgba(17, 44, 53, 0.7), rgba(6, 17, 24, 0.95)),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.02) 0,
      rgba(255, 255, 255, 0.02) 1px,
      transparent 1px,
      transparent 88px
    );
  border: 1px solid rgba(141, 198, 184, 0.12);
}

.map-glow {
  position: absolute;
  inset: auto auto 10% 6%;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(103, 232, 178, 0.22), transparent 70%);
  filter: blur(10px);
}

.site-map {
  width: 100%;
  height: 100%;
  display: block;
}

.map-frame {
  fill: rgba(11, 26, 33, 0.9);
  stroke: rgba(154, 246, 206, 0.14);
  stroke-width: 2;
}

.map-surface {
  fill: url(#mapSurface);
  stroke: rgba(154, 246, 206, 0.1);
  stroke-width: 1.5;
}

.map-road,
.map-gridline {
  fill: none;
  stroke-linecap: round;
}

.map-road {
  stroke: rgba(224, 239, 232, 0.2);
  stroke-width: 7;
}

.map-road.major {
  stroke: rgba(224, 239, 232, 0.28);
  stroke-width: 10;
}

.map-road.minor {
  stroke: rgba(172, 223, 208, 0.14);
  stroke-width: 4;
}

.map-gridline {
  stroke: rgba(130, 183, 170, 0.12);
  stroke-width: 1.5;
}

.map-block {
  fill: rgba(39, 72, 81, 0.55);
  stroke: rgba(176, 228, 213, 0.08);
}

.map-block.faint {
  fill: rgba(28, 55, 63, 0.42);
}

.map-node {
  fill: rgba(31, 76, 88, 0.5);
  stroke: rgba(172, 232, 214, 0.18);
  stroke-width: 2;
}

.map-node.small {
  fill: rgba(27, 64, 75, 0.45);
}

.hotspot {
  pointer-events: none;
}

.camera-hotspot {
  fill: url(#hotspotCamera);
}

.alert-hotspot {
  fill: url(#hotspotAlert);
}

.truck-hotspot {
  fill: url(#hotspotTruck);
}

.hotspot.faint {
  opacity: 0.7;
}

.zone-label {
  fill: rgba(197, 255, 240, 0.66);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-family: "IBM Plex Sans", sans-serif;
}

.zone-label.warning {
  fill: rgba(255, 196, 120, 0.82);
}

.map-pin path {
  stroke-width: 1.8;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.22));
}

.map-pin circle {
  fill: rgba(7, 22, 27, 0.92);
}

.camera-pin path {
  fill: #5ba6ff;
  stroke: rgba(172, 213, 255, 0.9);
}

.camera-pin circle {
  stroke: #dff0ff;
  stroke-width: 1.5;
}

.truck-pin path {
  fill: #67e8b2;
  stroke: rgba(203, 255, 233, 0.86);
}

.truck-pin circle {
  stroke: #e9fff7;
  stroke-width: 1.5;
}

.tank-pin path {
  fill: #b7f0df;
  stroke: rgba(232, 255, 247, 0.88);
}

.tank-pin circle {
  stroke: #0f2b31;
  stroke-width: 1.5;
}

.alert-pin path {
  fill: #ff6d5d;
  stroke: rgba(255, 210, 203, 0.92);
}

.alert-pin circle {
  stroke: #fff2ef;
  stroke-width: 1.5;
}

.map-pin.small path {
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0.9);
}

.map-legend {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(4, 12, 16, 0.72);
  border: 1px solid rgba(141, 198, 184, 0.12);
  backdrop-filter: blur(8px);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 8px;
}

.dot-truck {
  background: #7eecc1;
}

.dot-tank {
  background: #c5fff0;
}

.dot-camera {
  background: #7aaeff;
}

.dot-alert {
  background: #ff6d5d;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(22, 48, 58, 0.88), rgba(10, 25, 31, 0.95));
  border: 1px solid rgba(141, 198, 184, 0.12);
}

.metric-card p,
.metric-card span {
  margin: 0;
}

.metric-card p {
  color: var(--muted);
  font-size: 0.88rem;
}

.metric-card h3 {
  margin: 10px 0 8px;
}

.metric-card span {
  color: #b5d2c8;
  font-size: 0.9rem;
}

.metric-card-alert h3 {
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 8px;
}

.metric-alert-icon {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: rgba(255, 109, 93, 0.14);
  border: 1px solid rgba(255, 109, 93, 0.3);
  color: var(--danger);
  font-size: 0.78rem;
  line-height: 1;
}

.alerts-list,
.asset-feed {
  display: grid;
  gap: 12px;
}

.chart-panel {
  min-height: 100%;
}

.chart-shell {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: stretch;
}

.chart-y-axis,
.chart-x-axis {
  color: var(--muted);
  font-size: 0.8rem;
}

.chart-y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 0 30px;
}

.line-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chart-svg {
  width: 100%;
  height: 260px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(17, 39, 47, 0.88), rgba(9, 23, 29, 0.96));
  border: 1px solid rgba(141, 198, 184, 0.1);
}

.chart-grid-lines line {
  stroke: rgba(141, 198, 184, 0.13);
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.methane-line {
  stroke: #67e8b2;
}

.smoke-line {
  stroke: #ffb54a;
}

.chart-dots circle {
  stroke-width: 3;
  fill: #07161b;
}

.methane-dots circle {
  stroke: #67e8b2;
}

.smoke-dots circle {
  stroke: #ffb54a;
}

.chart-x-axis {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}

.chart-legend {
  margin-top: 14px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: #c4dcd4;
  font-size: 0.9rem;
}

.legend-swatch {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 8px;
}

.legend-methane {
  background: #67e8b2;
}

.legend-smoke {
  background: #ffb54a;
}

.legend-leak {
  background: #5ba6ff;
}

.legend-fire {
  background: #ff6d5d;
}

.legend-assets {
  background: #d0fef1;
}

.distribution-layout {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 18px;
  align-items: center;
}

.donut-chart {
  position: relative;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background:
    conic-gradient(
      #67e8b2 0 34%,
      #5ba6ff 34% 56%,
      #ff6d5d 56% 64%,
      #ffb54a 64% 83%,
      #d0fef1 83% 100%
    );
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.18);
}

.donut-hole {
  position: absolute;
  inset: 28px;
  border-radius: 50%;
  background: rgba(8, 20, 26, 0.95);
  border: 1px solid rgba(141, 198, 184, 0.1);
  display: grid;
  place-items: center;
  text-align: center;
}

.donut-hole strong,
.donut-hole span {
  display: block;
}

.donut-hole strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 2rem;
}

.donut-hole span {
  color: var(--muted);
  font-size: 0.84rem;
}

.distribution-list {
  display: grid;
  gap: 10px;
}

.distribution-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(14, 34, 42, 0.78);
  border: 1px solid rgba(141, 198, 184, 0.08);
}

.alert-card,
.asset-card,
.info-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(14, 34, 42, 0.88);
  border: 1px solid rgba(141, 198, 184, 0.1);
}

.alert-card {
  display: grid;
  gap: 8px;
}

.alert-card header,
.asset-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.badge {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
}

.badge.high {
  background: rgba(255, 109, 93, 0.16);
  color: #ffc1b8;
}

.badge.medium {
  background: rgba(255, 181, 74, 0.14);
  color: #ffd79a;
}

.badge.low {
  background: rgba(118, 240, 198, 0.14);
  color: #aff7de;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(141, 198, 184, 0.1);
}

.data-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.table-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.table-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.table-status.ok {
  color: var(--ok);
}

.table-status.warn {
  color: var(--warning);
}

.table-status.alert {
  color: var(--danger);
}

.content-panel {
  display: none;
}

.content-panel.active {
  display: block;
}

.view-copy {
  max-width: 760px;
  margin-bottom: 20px;
}

.view-copy p:last-child {
  color: #bdd8cf;
}

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

.camera-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.camera-table-panel {
  padding-top: 18px;
}

.info-card h4,
.info-card p {
  margin: 0;
}

.info-card h4 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.08rem;
  margin-bottom: 10px;
}

.info-card p {
  color: #b7d2c9;
  font-size: 0.94rem;
  line-height: 1.5;
}

.info-meta {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.info-chip {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(103, 232, 178, 0.08);
  border: 1px solid rgba(103, 232, 178, 0.1);
  color: #c4f3df;
  font-size: 0.8rem;
}

@media (max-width: 1180px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .camera-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .topbar {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .main-panel,
  .sidebar {
    padding: 16px;
  }

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

  .distribution-layout,
  .chart-shell {
    grid-template-columns: 1fr;
  }

  .donut-chart {
    margin: 0 auto;
  }

  .chart-y-axis {
    display: none;
  }

  .camera-stats-grid {
    grid-template-columns: 1fr;
  }

  .map-stage {
    min-height: 340px;
  }

  .map-legend {
    position: static;
    margin: 14px;
  }
}
