:root {
  --bg: #eef4fb;
  --panel: #ffffff;
  --panel-soft: #f7fbff;
  --ink: #102a43;
  --muted: #486581;
  --accent: #0f4c81;
  --accent-2: #1f9d8f;
  --danger: #b42318;
  --line: #d6e2ef;
  --shadow: 0 16px 36px rgba(15, 76, 129, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(96, 168, 216, 0.22), transparent 30%),
    linear-gradient(180deg, #f7fbff 0%, var(--bg) 100%);
}

.shell-header {
  padding: 14px 24px 0 24px;
}

.shell-brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.shell-brand h1 {
  margin: 0;
  font-size: 24px;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  color: #5d88b4;
}

.hint {
  color: var(--muted);
}

.module-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.session-tabs {
  margin: 0 0 12px 0;
}

.module-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid #c2d8ef;
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}

.module-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.module-tab.link {
  cursor: pointer;
}

.layout {
  display: grid;
  grid-template-columns: minmax(340px, 430px) 1fr;
  gap: 18px;
  min-height: calc(100vh - 86px);
  padding: 18px 24px 24px 24px;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow-y: auto;
}

.panel-section {
  padding: 14px;
  border-radius: 16px;
  background: var(--panel-soft);
  border: 1px solid #d9e8f7;
}

.panel-section h2,
.observer h2,
.list-wrap h3 {
  margin: 0 0 6px 0;
}

.session-card {
  background: linear-gradient(180deg, #f9fcff 0%, #eef6ff 100%);
}

.session-card .module-tab {
  flex: 1 1 120px;
  min-height: 40px;
  padding: 8px 12px;
}

.field-caption {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.row {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}

.row-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 2px 0;
  color: var(--muted);
  font-size: 13px;
}

.row-inline input[type="checkbox"] {
  width: auto;
  margin: 0;
}

input,
select,
button {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #bcccdc;
  border-radius: 10px;
  font-size: 14px;
}

button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  cursor: pointer;
}

button:hover,
.button-link:hover {
  filter: brightness(1.05);
}

button.secondary {
  background: #eef5ff;
  border-color: #c3d8ee;
  color: var(--accent);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

.stats {
  justify-content: space-between;
  color: var(--muted);
  font-size: 14px;
  flex-wrap: wrap;
}

.module-panel[data-module-panel="analysis"] {
  display: none;
}

body[data-module="analysis"] .module-panel[data-module-panel="analysis"] {
  display: block;
}

body[data-module="analysis"] .module-panel[data-module-panel="visualization"] {
  display: none;
}

body[data-module="visualization"] .module-panel[data-module-panel="visualization"] {
  display: block;
}

body[data-module="analysis"] .viewer {
  grid-template-rows: 1fr;
}

body[data-module="analysis"] #streetView,
body[data-module="analysis"] #mapyczPanorama,
body[data-module="analysis"] #mapbox3d {
  display: none;
}

.observer {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  background: #eef5ff;
  border: 1px solid #d6e6fb;
}

.analysis-meta {
  margin: 10px 0 0 0;
  color: var(--muted);
}

.analysis-legend {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.analysis-legend-item {
  padding: 10px;
  border: 1px solid #c8dcf7;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
}

.analysis-legend-item strong {
  display: block;
  margin-bottom: 6px;
}

.analysis-legend-item span,
.analysis-legend-item small {
  display: block;
  color: var(--muted);
}

.analysis-scale-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  margin-bottom: 6px;
  border: 1px solid rgba(16, 42, 67, 0.12);
}

.picker-map {
  width: 100%;
  height: 240px;
  border-radius: 10px;
  border: 1px solid #c8dcf7;
  overflow: hidden;
}

.hidden {
  display: none;
}

#vizDownload {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

#vizDownload.hidden {
  display: none;
}

.viz-preview {
  display: block;
  width: 100%;
  margin-top: 10px;
  border-radius: 8px;
  border: 1px solid #c8dcf7;
}

.list-wrap {
  margin-top: 16px;
}

#turbineList {
  margin: 0;
  padding-left: 16px;
  font-size: 14px;
}

.status {
  min-height: 20px;
  color: var(--accent);
  font-size: 14px;
}

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

.viewer {
  display: grid;
  grid-template-rows: 45% 55%;
  min-height: calc(100vh - 110px);
  background: #dfeaf5;
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

#map,
#streetView,
#mapyczPanorama,
#mapbox3d {
  width: 100%;
  height: 100%;
}

#map {
  grid-row: 1;
}

#streetView,
#mapyczPanorama,
#mapbox3d {
  grid-row: 2;
}

@media (max-width: 1100px) {
  .shell-header,
  .layout {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 980px) {
  .shell-header,
  .layout {
    grid-template-columns: 1fr;
    display: block;
  }

  .shell-header {
    padding-top: 16px;
  }

  .layout {
    padding-top: 16px;
  }

  .module-tabs,
  .row,
  .stats {
    flex-direction: column;
  }

  .viewer {
    margin-top: 16px;
    min-height: 72vh;
    grid-template-rows: 42vh 42vh;
  }
}
