﻿:root {
  --bg: #eef2f1;
  --paper: #ffffff;
  --ink: #13201d;
  --muted: #4f635f;
  --accent: #0f766e;
  --accent-soft: #d7f2ed;
  --warn: #c2410c;
  --ok: #166534;
  --line: #d6dfdd;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at top right, #d8ede7 0%, var(--bg) 40%, #e9efec 100%);
  color: var(--ink);
  font-family: "Manrope", sans-serif;
}

.app-shell {
  display: grid;
  grid-template-columns: 372px 1fr;
  min-height: 100vh;
  gap: 12px;
  padding: 10px;
}

.panel,
.workspace {
  min-height: 0;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: visible;
  max-height: none;
  padding-right: 6px;
}

.panel-header {
  background: linear-gradient(160deg, #083a34 0%, #0f766e 65%, #22a397 100%);
  color: #fff;
  border-radius: 18px;
  padding: 18px;
}

.panel-header h1 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  letter-spacing: 0.2px;
}

.panel-header p {
  margin: 0;
  font-size: 0.92rem;
  opacity: 0.9;
}

.card,
.map-card,
.table-card,
.note-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(19, 32, 29, 0.06);
}

.card {
  padding: 14px;
}

.card h2,
.map-header h2,
.table-header h2,
.note-card h2 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.controls label {
  display: block;
  margin: 10px 0 5px;
  font-size: 0.86rem;
  font-weight: 700;
  color: #314844;
}

.controls select,
.controls input[type="text"],
.controls input[type="range"] {
  width: 100%;
}

select,
input[type="text"] {
  border: 1px solid #c5d2ce;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 0.92rem;
  font-family: inherit;
  background: #fff;
}

input[type="range"] {
  accent-color: var(--accent);
}

.inline-control {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.inline-control input {
  width: auto;
}

.district-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
}

.district-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
}

.stats {
  display: grid;
  gap: 8px;
}

.stat-pill {
  border: 1px solid #dce9e6;
  background: #f7fbfa;
  border-radius: 10px;
  padding: 8px 9px;
  font-size: 0.9rem;
}

.stat-pill strong {
  font-weight: 800;
  color: #06332d;
}

.workspace {
  --map-panel-height: 42vh;
  display: grid;
  grid-template-rows: minmax(240px, var(--map-panel-height)) 14px minmax(380px, 1fr);
  gap: 12px;
  min-height: 0;
}

.map-card,
.table-card {
  padding: 12px;
}

.map-card {
  min-height: 320px;
}

.table-card {
  min-height: 360px;
}

.map-header,
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

.map-header p,
.table-header p,
.hint,
.note-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

#map {
  width: 100%;
  height: calc(100% - 36px);
  min-height: 280px;
  border-radius: 12px;
  border: 1px solid #cfe0dc;
}

.row-splitter {
  border: 1px solid #c8dcda;
  border-radius: 999px;
  background: linear-gradient(90deg, #e8f4f1 0%, #d5ece7 50%, #e8f4f1 100%);
  cursor: row-resize;
  user-select: none;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.row-splitter::before {
  content: "";
  width: 64px;
  height: 4px;
  border-radius: 999px;
  background: #5e8e86;
}

body.resizing-rows {
  cursor: row-resize;
  user-select: none;
}

.table-wrap {
  height: calc(100% - 38px);
  overflow: auto;
  border: 1px solid #d2dfdc;
  border-radius: 10px;
}

.strategy-list {
  display: grid;
  gap: 8px;
  max-height: none;
  min-height: 360px;
  overflow: auto;
  padding-right: 2px;
}

.panel .card:last-child {
  display: flex;
  flex-direction: column;
}

.strategy-item {
  border: 1px solid #d7e4e1;
  background: #f8fcfb;
  border-radius: 10px;
  padding: 8px 9px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: #15322d;
}

.strategy-item:hover {
  background: #eef8f5;
  border-color: #bad7d1;
}

.strategy-item.selected {
  border-color: #2a8f83;
  background: #dff3ee;
}

.strategy-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.strategy-rank {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  background: #d8ece8;
  color: #0e4f47;
  border-radius: 999px;
  padding: 1px 6px;
}

.strategy-name {
  font-size: 0.87rem;
  font-weight: 800;
}

.strategy-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 0.8rem;
  color: #32524c;
}

.strategy-metrics strong {
  color: #0c3d36;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f0f7f5;
  color: #103a34;
  text-align: left;
  border-bottom: 1px solid #cfddd9;
  padding: 8px;
}

tbody td {
  border-bottom: 1px solid #ecf1ef;
  padding: 8px;
  vertical-align: top;
}

tbody tr:hover {
  background: #f4faf8;
  cursor: pointer;
}

.time-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
}

.time-ok {
  background: #dbf4e4;
  color: var(--ok);
}

.time-no {
  background: #ffe6d8;
  color: var(--warn);
}

.school-popup {
  font-size: 0.82rem;
  line-height: 1.35;
}

.leaflet-popup-content {
  margin: 10px 12px;
}

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

  .workspace {
    min-height: 0;
    grid-template-rows: minmax(280px, 44vh) 10px minmax(320px, 56vh);
  }

  .panel {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .row-splitter {
    height: 10px;
  }

  .map-card {
    min-height: 280px;
  }

  .table-card {
    min-height: 320px;
  }
}
