:root {
  color-scheme: dark;
  --bg: #10151b;
  --surface: rgba(21, 28, 36, 0.92);
  --surface-strong: #17202a;
  --line: rgba(217, 226, 236, 0.12);
  --text: #eef5fb;
  --muted: #95a7b8;
  --blue: #58b8ff;
  --cyan: #6de7d5;
  --green: #7fd68a;
  --amber: #f4c56a;
  --red: #ff817a;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at 18% 18%, rgba(88, 184, 255, 0.16), transparent 32%),
    linear-gradient(135deg, #0d1218 0%, #141a22 50%, #182126 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(12, 17, 23, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(109, 231, 213, 0.5);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(88, 184, 255, 0.22), rgba(109, 231, 213, 0.1));
  color: #dffcff;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #c8d6e3;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  border-color: rgba(88, 184, 255, 0.28);
  background: rgba(88, 184, 255, 0.1);
  color: #ffffff;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--cyan);
  font-size: 12px;
  font-weight: 700;
}

.side-panel {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.side-panel strong,
.side-panel span {
  display: block;
}

.side-panel span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.workspace {
  display: grid;
  gap: 18px;
  align-content: start;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.icon-button,
.primary-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
}

.icon-button {
  width: 42px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 20px;
}

.primary-button {
  padding: 0 16px;
  background: #eaf7ff;
  color: #10202b;
  font-weight: 800;
}

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

.status-strip article,
.panel,
.map-band {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.status-strip article {
  padding: 16px;
}

.status-strip span,
.muted {
  color: var(--muted);
}

.status-strip strong {
  display: block;
  margin-top: 8px;
  font-size: 23px;
}

.map-band {
  display: grid;
  grid-template-columns: minmax(360px, 1.35fr) minmax(320px, 0.65fr);
  min-height: 460px;
  overflow: hidden;
}

.meteo-map-wrap {
  position: relative;
  min-height: 460px;
  background: #10202b;
}

.meteo-map {
  position: absolute;
  inset: 0;
}

.station-fallback-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.lightning-live-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #10202b;
}

.lightning-live-layer iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.fallback-station {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #95a7b8;
  box-shadow: 0 0 0 5px rgba(149, 167, 184, 0.2), 0 8px 18px rgba(0, 0, 0, 0.28);
  transform: translate(-50%, -50%);
}

.fallback-station.meteo {
  background: #7fd68a;
}

.fallback-station.rain {
  background: #58b8ff;
}

.fallback-station.hydro {
  background: #b78cff;
}

.fallback-station.marine {
  background: #6de7d5;
}

.fallback-station.other {
  background: #95a7b8;
}

.fallback-station.metar {
  border-color: #17202a;
  border-radius: 2px;
  background: var(--amber);
  transform: translate(-50%, -50%) rotate(45deg);
}

.fallback-station.wind {
  width: 18px;
  height: 18px;
  background: var(--cyan);
  box-shadow: 0 0 0 6px rgba(109, 231, 213, 0.18), 0 8px 18px rgba(0, 0, 0, 0.28);
}

.fallback-station.no-data::after {
  position: absolute;
  top: 50%;
  left: 50%;
  content: "!";
  color: #10151b;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  transform: translate(-50%, -50%);
}

.map-overlay {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 4;
  max-width: calc(100% - 28px);
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(12, 17, 23, 0.82);
  color: #dce9f5;
  font-size: 12px;
  backdrop-filter: blur(10px);
}

.map-overlay strong {
  display: block;
  margin-top: 4px;
  color: #ffffff;
}

.map-overlay small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.map-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 34px;
}

.map-copy h2 {
  max-width: 680px;
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.08;
}

.map-copy p:last-child {
  max-width: 620px;
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.meteo-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.meteo-stats article {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.meteo-stats span,
.station-popup span {
  color: var(--muted);
  font-size: 12px;
}

.meteo-stats strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.source-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 14px;
  color: #cbd8e5;
  font-size: 13px;
}

.source-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-symbol {
  display: inline-block;
  width: 14px;
  height: 14px;
}

.legend-kttv {
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(109, 231, 213, 0.16);
}

.legend-metar {
  border: 2px solid #17202a;
  background: var(--amber);
  transform: rotate(45deg);
}

.legend-meteo,
.legend-rain,
.legend-hydro,
.legend-marine,
.legend-other {
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
}

.legend-meteo {
  background: #7fd68a;
}

.legend-rain {
  background: #58b8ff;
}

.legend-hydro {
  background: #b78cff;
}

.legend-marine {
  background: #6de7d5;
}

.legend-other {
  background: #95a7b8;
}

.wind-marker {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  transform-origin: center;
}

.wind-arrow {
  position: relative;
  width: 4px;
  height: 24px;
  border-radius: 999px;
  background: #f8fbff;
  box-shadow: 0 0 0 4px rgba(16, 32, 43, 0.65), 0 0 14px rgba(109, 231, 213, 0.6);
}

.wind-arrow::before {
  position: absolute;
  top: -8px;
  left: 50%;
  width: 0;
  height: 0;
  content: "";
  border-right: 7px solid transparent;
  border-bottom: 11px solid #f8fbff;
  border-left: 7px solid transparent;
  transform: translateX(-50%);
}

.wind-label {
  position: absolute;
  top: 26px;
  left: 50%;
  min-width: 40px;
  padding: 2px 5px;
  border: 1px solid rgba(109, 231, 213, 0.38);
  border-radius: 7px;
  background: rgba(12, 17, 23, 0.86);
  color: #eaf7ff;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  transform: translateX(-50%) rotate(var(--marker-counter-rotate, 0deg));
}

.station-dot {
  width: 12px;
  height: 12px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 5px rgba(244, 197, 106, 0.16);
}

.network-marker {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
}

.network-marker::before {
  width: 15px;
  height: 15px;
  content: "";
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: #95a7b8;
  box-shadow: 0 0 0 5px rgba(149, 167, 184, 0.2), 0 8px 18px rgba(0, 0, 0, 0.24);
}

.network-marker.meteo::before {
  background: #7fd68a;
  box-shadow: 0 0 0 4px rgba(127, 214, 138, 0.14);
}

.network-marker.rain::before {
  background: #58b8ff;
  box-shadow: 0 0 0 4px rgba(88, 184, 255, 0.14);
}

.network-marker.hydro::before {
  background: #b78cff;
  box-shadow: 0 0 0 4px rgba(183, 140, 255, 0.14);
}

.network-marker.marine::before {
  background: #6de7d5;
  box-shadow: 0 0 0 4px rgba(109, 231, 213, 0.14);
}

.network-marker.no-data::after {
  position: absolute;
  content: "!";
  color: #10151b;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.source-marker {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
}

.source-marker::before {
  width: 16px;
  height: 16px;
  content: "";
  border: 2px solid #17202a;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(244, 197, 106, 0.17), 0 6px 18px rgba(0, 0, 0, 0.25);
  transform: rotate(45deg);
}

.source-marker.metar::after {
  position: absolute;
  content: "M";
  color: #17202a;
  font-size: 10px;
  font-weight: 900;
}

.source-marker.no-data::after {
  content: "!";
}

.maplibregl-popup-content {
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(12, 17, 23, 0.94);
  color: var(--text);
  box-shadow: var(--shadow);
}

.maplibregl-popup {
  z-index: 30;
}

.maplibregl-popup-tip {
  border-top-color: rgba(12, 17, 23, 0.94) !important;
  border-bottom-color: rgba(12, 17, 23, 0.94) !important;
}

.station-popup {
  min-width: 210px;
}

.station-popup strong,
.station-popup span {
  display: block;
}

.station-popup p {
  margin: 8px 0 0;
  color: #d3dfeb;
}

.meteo-table {
  min-width: 980px;
}

.meteo-empty {
  color: var(--muted);
  text-align: center;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.55fr);
  gap: 18px;
}

.panel {
  padding: 20px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.search-box span {
  color: var(--muted);
  font-size: 13px;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.category-card {
  min-height: 156px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.category-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
}

.category-card p {
  min-height: 58px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.chip {
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cdd9e4;
}

.pipeline-list {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pipeline-list li {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.pipeline-list strong,
.pipeline-list span {
  display: block;
}

.pipeline-list span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: #b6c6d6;
  font-size: 12px;
  text-transform: uppercase;
}

td {
  color: #e5eef6;
  font-size: 14px;
}

.status.ready {
  background: rgba(127, 214, 138, 0.14);
  color: #a7f0b0;
}

.status.review {
  background: rgba(244, 197, 106, 0.14);
  color: #f6d58d;
}

.status.draft {
  background: rgba(88, 184, 255, 0.14);
  color: #9ed7ff;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .status-strip,
  .content-grid,
  .map-band {
    grid-template-columns: 1fr 1fr;
  }

  .map-copy {
    padding: 24px;
  }
}

@media (max-width: 760px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-list,
  .status-strip,
  .content-grid,
  .map-band,
  .category-grid {
    grid-template-columns: 1fr;
  }

  .search-box {
    min-width: 0;
  }

  .top-actions {
    justify-content: space-between;
  }

  .primary-button {
    flex: 1;
  }

  .map-band,
  .meteo-map-wrap {
    min-height: 420px;
  }

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