:root {
  --bg: #f5f8fa;
  --surface: #ffffff;
  --surface-2: #eef5f8;
  --text: #162433;
  --muted: #667789;
  --border: #dce7ed;
  --blue: #1976d2;
  --sea: #dff4fa;
  --red: #d93f35;
  --orange: #e8842e;
  --yellow: #d8a722;
  --risk-blue: #2677c9;
  --gray: #8a99a8;
  --shadow: 0 18px 44px rgba(32, 56, 76, 0.13);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

button, input { font: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: var(--left-panel-width, 320px) 8px minmax(0, 1fr) 8px var(--right-panel-width, 360px);
  gap: 8px;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  min-height: 720px;
  padding: 14px;
}

.left-panel, .right-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.layout-splitter {
  position: relative;
  z-index: 8;
  border-radius: 99px;
  background: transparent;
}

.layout-splitter::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(120, 147, 166, 0.18);
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.layout-splitter:hover::before,
.layout-splitter.dragging::before {
  opacity: 1;
  background: rgba(30, 111, 159, 0.3);
}

.layout-splitter.vertical {
  cursor: col-resize;
  min-width: 8px;
}

.layout-splitter.horizontal {
  cursor: row-resize;
  min-height: 8px;
}

.brand, .panel-section, .topbar, .timeline {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 8px 22px rgba(37, 59, 77, 0.05);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: 8px;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #1b79b5, #11496c);
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
}

.brand p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.panel-section {
  border-radius: 8px;
  padding: 14px;
  overflow: auto;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 750;
}

.icon-button, .top-actions button, .filter-grid button {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
}

.icon-button {
  width: 30px;
  height: 30px;
}

.typhoon-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.typhoon-main strong {
  display: block;
  font-size: 18px;
  margin-bottom: 6px;
}

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

.typhoon-main em {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 6px;
  color: #765600;
  background: #fff1bd;
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
}

.typhoon-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin: 13px 0 0;
}

.typhoon-facts div {
  min-width: 0;
}

.typhoon-facts dt {
  color: var(--muted);
  font-size: 11px;
}

.typhoon-facts dd {
  margin: 5px 0 0;
  font-size: 13px;
  font-weight: 650;
}

.warning-card {
  background: linear-gradient(180deg, #fffef7, #ffffff 58%);
  border-color: #eadfae;
}

.warning-card p {
  margin: 0;
  color: #485b62;
  font-size: 13px;
  line-height: 1.65;
}

.sync-dot {
  color: #0c7d66;
  font-size: 12px;
}

.warning-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.warning-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.warning-links a {
  padding: 5px 8px;
  border-radius: 5px;
  background: #f2f6f8;
  color: #1e6f9f;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fbfdfe;
}

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

.filter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.filter-grid button {
  height: 34px;
  font-size: 12px;
  font-weight: 700;
}

.filter-grid button.active {
  color: #fff;
  border-color: #1e6f9f;
  background: #1e6f9f;
}

.layer-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  color: #415466;
  font-size: 13px;
}

.layer-list label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-workspace {
  display: grid;
  grid-template-rows: auto minmax(300px, var(--map-panel-height, 48vh)) 8px auto;
  gap: 8px;
  align-content: start;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 10px 12px;
  border-radius: 8px;
  min-width: 0;
}

.summary-strip {
  display: grid;
  grid-template-columns: minmax(150px, 1.6fr) repeat(4, minmax(64px, 1fr));
  gap: 8px;
  min-width: 0;
  flex: 1 1 430px;
  width: auto;
}

.summary-strip article {
  min-width: 0;
  padding: 7px 9px;
  background: var(--surface-2);
  border-radius: 6px;
}

.summary-strip span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-strip strong {
  display: block;
  margin-top: 3px;
  font-size: 20px;
  line-height: 1;
}

.summary-strip article:first-child strong {
  font-size: 17px;
  line-height: 1.1;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 0 1 auto;
  min-width: 0;
}

.top-actions button {
  height: 32px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.top-actions #playBtn {
  color: #fff;
  border-color: #1d6d9f;
  background: #1d6d9f;
}

.map-mode-control {
  display: inline-flex;
  overflow: hidden;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.map-mode-control button {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.map-mode-control button + button {
  border-left: 1px solid var(--border);
}

.map-mode-control button.active {
  color: #fff;
  background: #39495a;
}

.map-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #dbeef4;
  box-shadow: var(--shadow);
  min-height: 0;
  min-width: 0;
}

.map-viewport {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  min-height: 0;
  touch-action: none;
  cursor: grab;
  background: #fff;
}

.map-viewport.offline-map {
  background:
    radial-gradient(circle at 45% 56%, rgba(27, 122, 181, 0.18) 0 4px, transparent 5px),
    linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0)),
    #d8eef4;
}

.map-viewport.offline-map::before {
  content: "";
  position: absolute;
  inset: 8% 10%;
  z-index: 0;
  background:
    linear-gradient(140deg, transparent 0 26%, rgba(217,232,218,0.95) 26% 39%, transparent 40%),
    linear-gradient(25deg, transparent 0 53%, rgba(217,232,218,0.9) 54% 66%, transparent 67%),
    radial-gradient(ellipse at 38% 62%, rgba(218,236,219,0.95) 0 18%, transparent 19%),
    radial-gradient(ellipse at 52% 47%, rgba(218,236,219,0.88) 0 12%, transparent 13%);
  opacity: 0.82;
  pointer-events: none;
}

.map-viewport.offline-map::after {
  content: "离线简图 · 本地简化底图";
  position: absolute;
  left: 18px;
  top: 16px;
  z-index: 3;
  padding: 8px 10px;
  border: 1px solid rgba(25, 118, 210, 0.18);
  border-radius: 6px;
  background: rgba(255,255,255,0.88);
  color: #2a4b62;
  font-size: 12px;
  font-weight: 850;
  box-shadow: 0 8px 18px rgba(23, 53, 77, 0.12);
}

.map-viewport:active {
  cursor: grabbing;
}

.map-content {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  z-index: 1;
}

.tile-layer,
#mapSvg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.tile-layer {
  overflow: hidden;
  user-select: none;
  pointer-events: none;
}

.tile-layer img {
  position: absolute;
  width: 256px;
  height: 256px;
  user-select: none;
  pointer-events: none;
}

.tile-base {
  z-index: 0;
}

.tile-label {
  z-index: 1;
}

#mapSvg {
  z-index: 2;
  pointer-events: auto;
}

.map-hint {
  position: absolute;
  left: 18px;
  top: 18px;
  z-index: 2;
  max-width: min(520px, calc(100% - 380px));
  padding: 8px 10px;
  border: 1px solid rgba(196, 215, 224, 0.92);
  border-radius: 7px;
  background: rgba(255,255,255,0.9);
  color: #516577;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(32, 56, 76, 0.12);
}

.map-attribution {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 3;
  padding: 5px 8px;
  border-radius: 5px;
  background: rgba(255,255,255,0.88);
  color: #607485;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(32, 56, 76, 0.12);
}

.typhoon-route-panel {
  position: absolute;
  right: 16px;
  top: 16px;
  z-index: 4;
  width: min(390px, calc(100% - 32px));
  height: min(560px, calc(100% - 72px));
  min-width: 280px;
  min-height: 260px;
  max-width: calc(100% - 32px);
  max-height: calc(100% - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 3px solid #174fba;
  border-radius: 8px;
  background: rgba(16, 22, 24, 0.94);
  color: #d9dde3;
  box-shadow: 0 18px 42px rgba(8, 18, 32, 0.38);
}

.typhoon-route-panel.collapsed {
  width: 148px;
  height: auto !important;
  min-height: 0;
}

.typhoon-route-panel.collapsed .route-typhoon-list,
.typhoon-route-panel.collapsed .route-panel-filter,
.typhoon-route-panel.collapsed .route-table {
  display: none;
}

.route-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  padding: 10px 12px;
  background: #174fba;
  color: #fff;
  font-size: 15px;
  font-weight: 850;
  cursor: move;
  user-select: none;
}

.route-panel-title button {
  border: 0;
  background: transparent;
  color: #071326;
  cursor: pointer;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  min-width: 28px;
}

.route-panel-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(14, 27, 33, 0.9);
  color: #c7d0d8;
  font-size: 12px;
  font-weight: 850;
}

.route-panel-filter span {
  flex: 0 0 auto;
}

.route-year-buttons {
  display: flex;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
  scrollbar-color: #2f73df rgba(255,255,255,0.08);
}

.route-year-buttons button {
  flex: 0 0 auto;
  border: 1px solid rgba(96, 149, 255, 0.42);
  border-radius: 6px;
  background: rgba(8, 18, 28, 0.86);
  color: #f3f7fb;
  font-size: 13px;
  font-weight: 800;
  padding: 7px 9px;
  cursor: pointer;
}

.route-year-buttons button.active {
  border-color: #5fa0ff;
  background: #1f67d6;
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16);
}

.route-typhoon-list {
  display: grid;
  gap: 8px;
  flex: 0 1 42%;
  padding: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: 74px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #2f73df rgba(255,255,255,0.08);
}

.route-typhoon-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  color: #d8dde4;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}

.route-typhoon-item span:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.route-typhoon-item small {
  color: #88a4c6;
  font-size: 11px;
  line-height: 1;
}

.route-typhoon-item.active {
  background: #111a20;
  color: #fff;
}

.route-icon {
  color: #3c7dff;
  font-size: 20px;
}

.route-table {
  flex: 1 1 auto;
  min-height: 96px;
  overflow: auto;
  padding-bottom: 14px;
  scrollbar-color: #2f73df rgba(255,255,255,0.08);
}

.route-table-head,
.route-table-row {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr 0.8fr 0.8fr;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.route-table-head {
  position: sticky;
  top: 0;
  background: #1c2529;
  color: #aeb6bf;
  font-weight: 850;
}

.route-table-row {
  width: 100%;
  border: 0;
  border-top: 1px solid rgba(255,255,255,0.04);
  background: rgba(255,255,255,0.03);
  color: #d6d0c5;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.route-table-row:nth-child(odd) {
  background: rgba(255,255,255,0.07);
}

.route-table-row.active {
  color: #fff;
  background: rgba(43, 122, 255, 0.32);
  box-shadow: inset 3px 0 0 #ffcf2e;
}

.route-resize-grip {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 22px;
  height: 22px;
  cursor: nwse-resize;
  z-index: 2;
}

.route-resize-grip::after {
  content: "";
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(255,255,255,0.62);
  border-bottom: 2px solid rgba(255,255,255,0.62);
}

.grid-line {
  stroke: rgba(58, 94, 113, 0.12);
  stroke-width: 1;
}

.region {
  fill: rgba(232, 241, 234, 0.95);
  stroke: #94b6aa;
  stroke-width: 2;
}

.region.island {
  fill: rgba(226, 237, 229, 0.82);
}

.region.muted {
  fill: rgba(232, 241, 234, 0.58);
  stroke: rgba(148, 182, 170, 0.68);
}

.province-label {
  fill: #668073;
  font-size: 16px;
  font-weight: 850;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(255,255,255,0.86);
  stroke-width: 4px;
}

.city-dot {
  fill: #2d6f91;
  stroke: #fff;
  stroke-width: 2;
}

.city-label,
.map-label,
.source-label {
  fill: #425e70;
  font-size: 13px;
  font-weight: 750;
  paint-order: stroke;
  stroke: rgba(255,255,255,0.84);
  stroke-width: 3px;
}

.source-label {
  fill: #5c7383;
  font-size: 12px;
  font-weight: 650;
}

.source-label.strong {
  fill: #1f3b4d;
  font-size: 13px;
  font-weight: 850;
}

.city-warning-text {
  fill: #fff;
  font-size: 11px;
  font-weight: 850;
}

.wind-ring {
  fill: rgba(216, 63, 53, 0.08);
  stroke: rgba(216, 63, 53, 0.32);
  stroke-width: 2;
  stroke-dasharray: 8 8;
}

.wind-label {
  fill: #ad3932;
  font-size: 11px;
  font-weight: 850;
  paint-order: stroke;
  stroke: rgba(255,255,255,0.92);
  stroke-width: 4px;
}

.wind-label.muted {
  fill: #6d7f8c;
  font-weight: 700;
}

.track-line {
  fill: none;
  stroke: #d93f35;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.track-line-full {
  fill: none;
  stroke: rgba(217, 63, 53, 0.28);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 8 8;
}

.forecast-line {
  fill: none;
  stroke: #e8842e;
  stroke-width: 3;
  stroke-dasharray: 10 9;
  stroke-linecap: round;
}

.track-point,
.forecast-point {
  fill: #fff;
  stroke: #d93f35;
  stroke-width: 3;
}

.forecast-point {
  stroke: #e8842e;
}

.track-point.power-low {
  fill: #34d058;
  stroke: #34d058;
}

.track-point.power-mid {
  fill: #ff9f1c;
  stroke: #ff9f1c;
}

.track-point.power-strong {
  fill: #ff1e1e;
  stroke: #ff1e1e;
}

.track-point.power-super {
  fill: #ff4fc3;
  stroke: #ff4fc3;
}

.typhoon-eye {
  fill: #d93f35;
  stroke: #fff;
  stroke-width: 4;
  filter: url(#pinShadow);
}

.typhoon-level-label {
  fill: #28394a;
  font-size: 13px;
  font-weight: 900;
  paint-order: stroke;
  stroke: rgba(255,255,255,0.96);
  stroke-width: 4px;
}

.project-cluster {
  cursor: pointer;
  filter: url(#pinShadow);
}

.province-card {
  fill: rgba(22, 199, 222, 0.22);
  stroke: #f4a51c;
  stroke-width: 5;
  paint-order: stroke;
  filter: url(#pinShadow);
}

.cluster-halo {
  fill: rgba(0, 190, 230, 0.16);
  stroke: rgba(25, 205, 238, 0.48);
  stroke-width: 3;
}

.cluster-core {
  fill: #16c7de;
  stroke: rgba(255,255,255,0.78);
  stroke-width: 2;
}

.project-cluster-label {
  fill: #f6fbff;
  font-size: 14px;
  font-weight: 850;
  paint-order: stroke;
  stroke: rgba(13, 41, 70, 0.76);
  stroke-width: 4px;
}

.project-cluster-label.province {
  font-size: 22px;
  font-weight: 950;
  stroke: rgba(24, 52, 73, 0.9);
  stroke-width: 5px;
}

.project-cluster.province .cluster-halo {
  fill: rgba(22, 199, 222, 0.18);
  stroke: rgba(22, 199, 222, 0.38);
  stroke-width: 4;
}

.project-cluster.province .cluster-core {
  fill: #19c4d9;
  stroke: rgba(255,255,255,0.95);
  stroke-width: 3;
}

.project-cluster-label.district {
  font-size: 12px;
}

.pin {
  cursor: pointer;
  filter: url(#pinShadow);
}

.pin-ring {
  fill: #fff;
  stroke-width: 3;
}

.pin-core {
  stroke: #fff;
  stroke-width: 2;
}

.pin-warning-label {
  font-size: 11px;
  font-weight: 900;
  paint-order: stroke;
  stroke: rgba(255,255,255,0.95);
  stroke-width: 3px;
}

.project-map-label {
  opacity: 0;
  fill: #12283b;
  font-size: 12px;
  font-weight: 800;
  paint-order: stroke;
  stroke: rgba(255,255,255,0.96);
  stroke-width: 3px;
  transition: opacity 140ms ease;
  pointer-events: auto;
  cursor: pointer;
}

.map-viewport.is-zoomed .project-map-label {
  opacity: 1;
}

.map-legend {
  position: absolute;
  left: 18px;
  bottom: 18px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid rgba(190, 210, 219, 0.9);
  border-radius: 8px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  color: #43576a;
  font-size: 12px;
  box-shadow: 0 12px 30px rgba(28, 50, 68, 0.12);
}

.map-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.map-legend i {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 99px;
}

.risk-red { background: var(--red); }
.risk-orange { background: var(--orange); }
.risk-yellow { background: var(--yellow); }
.risk-blue { background: var(--risk-blue); }
.risk-gray { background: var(--gray); }

.map-tooltip {
  position: absolute;
  pointer-events: auto;
  max-width: 320px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 12px;
  line-height: 1.45;
  z-index: 3;
}

.map-tooltip.track-popup {
  padding: 0;
  overflow: hidden;
  border: 3px solid #225dcc;
  border-radius: 12px;
  box-shadow: 0 16px 34px rgba(21, 55, 98, 0.24);
}

.track-popup-card {
  background: rgba(255,255,255,0.96);
}

.track-popup-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  color: #fff;
  background: #225dcc;
  font-size: 13px;
}

.track-popup-title span {
  color: #ffe560;
  font-weight: 900;
  white-space: nowrap;
}

.track-popup-card dl {
  margin: 0;
}

.track-popup-card div {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid #e6eef5;
}

.track-popup-card dt {
  color: #788897;
  font-weight: 800;
}

.track-popup-card dd {
  margin: 0;
  color: #233242;
  font-weight: 850;
}

.timeline {
  align-self: start;
  padding: 9px 14px;
  border-radius: 8px;
  overflow: auto;
}

.timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  margin-bottom: 5px;
}

.timeline-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.timeline-head span {
  color: var(--muted);
}

.timeline-controls select {
  height: 28px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.timeline input {
  width: 100%;
  accent-color: #1e6f9f;
}

.timeline-ticks {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.selected-project {
  flex: 0 0 auto;
  max-height: 52vh;
  min-height: 0;
  overflow: auto;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 150px;
  color: var(--muted);
  background: #f7fafb;
  border: 1px dashed #cbd9e0;
  border-radius: 8px;
  font-size: 13px;
}

.project-title-edit {
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 18px;
  font-weight: 850;
  line-height: 1.25;
  text-align: left;
  cursor: text;
}

.project-detail address {
  margin: 0 0 12px;
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
  line-height: 1.45;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.project-edit-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfe;
}

.project-edit-form label {
  min-width: 0;
}

.project-edit-form .span-2,
.project-edit-actions {
  grid-column: 1 / -1;
}

.project-edit-form span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.project-edit-form input {
  width: 100%;
  height: 32px;
  min-width: 0;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: 0;
  background: #fff;
  color: var(--text);
  font-size: 12px;
}

.project-edit-form input:focus {
  border-color: rgba(25,118,210,0.72);
  box-shadow: 0 0 0 3px rgba(25,118,210,0.12);
}

.project-edit-actions {
  display: flex;
  justify-content: flex-end;
}

.project-edit-actions button {
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: #1e6f9f;
  color: #fff;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.detail-grid div {
  padding: 9px;
  border-radius: 6px;
  background: #f4f8fa;
}

.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.detail-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.risk-reason {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f7fafb;
}

.risk-reason > strong {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
}

.risk-reason ul {
  margin: 0;
  padding-left: 18px;
  color: #536677;
  font-size: 12px;
  line-height: 1.55;
}

.risk-list-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.risk-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 3px;
}

.city-group-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid #dce7ed;
  border-radius: 7px;
  background: rgba(244, 248, 250, 0.96);
  color: #213749;
  backdrop-filter: blur(6px);
}

.city-group-header strong {
  font-size: 14px;
}

.city-group-header span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.risk-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  padding: 12px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.risk-row.active {
  outline: 2px solid rgba(25,118,210,0.25);
  border-color: rgba(25,118,210,0.45);
}

.risk-bar {
  width: 8px;
  height: 100%;
  min-height: 64px;
  border-radius: 99px;
}

.risk-main {
  min-width: 0;
}

.risk-title-line {
  display: grid;
  grid-template-columns: minmax(92px, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.risk-row h3 {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  color: #13283a;
  font-size: 15px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.risk-row p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.risk-row-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.risk-row-meta span {
  padding: 3px 6px;
  border-radius: 4px;
  background: #f2f6f8;
  color: #617385;
  font-size: 11px;
  font-weight: 650;
}

.risk-score {
  display: grid;
  place-items: center;
  align-self: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #f6f8fa;
  font-size: 13px;
  font-weight: 850;
}

.warning-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  max-width: 260px;
  overflow: hidden;
  padding: 5px 8px;
  border: 1px solid color-mix(in srgb, var(--warn), white 48%);
  border-radius: 6px;
  background: color-mix(in srgb, var(--warn), white 88%);
  color: color-mix(in srgb, var(--warn), black 22%);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warning-badge:empty {
  display: none;
}

.gb-signal-icon {
  display: block;
  flex: 0 0 auto;
  width: 86px;
  aspect-ratio: 6 / 5;
  object-fit: contain;
  border: 0;
  border-radius: 5px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.16);
}

.gb-signal-icon.compact {
  width: 88px;
}

.gb-signal-icon.mini {
  width: 64px;
  border-radius: 4px;
}

.detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.detail-heading .warning-badge {
  margin-top: 2px;
}

.warning-history-card {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfe;
}

.warning-history-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
}

.warning-history-current span,
.warning-scope-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.warning-history-current strong {
  font-size: 13px;
}

.warning-scope-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.warning-scope-grid.single {
  grid-template-columns: 1fr;
}

.warning-scope-grid div {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 7px;
  row-gap: 1px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  border-radius: 6px;
  background: #f3f8fb;
}

.warning-scope-grid div:has(.gb-signal-icon:empty) {
  grid-template-columns: 1fr;
}

.warning-scope-grid .gb-signal-icon {
  grid-row: span 2;
}

.warning-scope-grid strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warning-history-list {
  display: grid;
  gap: 6px;
  max-height: 260px;
  margin: 0;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  list-style: none;
}

.warning-history-list li {
  display: grid;
  grid-template-columns: 58px 1fr;
  column-gap: 7px;
  row-gap: 2px;
  align-items: center;
  min-width: 0;
  font-size: 11px;
}

.warning-history-list .gb-signal-icon {
  grid-row: span 2;
}

.warning-history-list span {
  color: var(--muted);
}

.warning-history-list strong {
  overflow: hidden;
  color: #2a3a48;
  font-size: 11px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1400px) {
  .app-shell {
    grid-template-columns: var(--left-panel-width, 300px) 8px minmax(0, 1fr) 8px var(--right-panel-width, 340px);
    height: auto;
    min-height: 100vh;
  }
  .right-panel {
    display: flex;
    overflow: auto;
  }
  .selected-project {
    max-height: 620px;
    overflow: auto;
  }
  .risk-list-section {
    min-height: 360px;
    max-height: 620px;
    overflow: hidden;
  }
  .map-workspace {
    grid-template-rows: auto minmax(320px, var(--map-panel-height, 50vh)) 8px auto;
    overflow: visible;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 10px;
    height: auto;
    min-height: 100vh;
  }
  .summary-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }
  .top-actions {
    width: 100%;
  }
  .top-actions button {
    flex: 1;
  }
  .right-panel {
    display: flex;
  }
  .layout-splitter {
    display: none;
  }
  #mapSvg, .map-panel, .map-viewport {
    min-height: 420px;
  }
}
