:root {
  --navy: #24214A;
  --orange: #EB941F;
  --green: #94C21F;
  --blue: #00579E;
  --border: #d9dce1;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  color: #1c1e21;
}

.topbar {
  background: var(--navy);
  color: #fff;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 4px solid var(--orange);
}
.topbar-logo { height: 26px; display: block; }
.topbar-title { font-weight: 700; font-size: 17px; }
.topbar-sub { font-size: 12px; color: #cfd0e0; flex: 1; }
.panel-toggle {
  display: none;
  background: var(--orange);
  border: none;
  color: #fff;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
}

.gas-banner {
  background: #c92a2a;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
}

.layout {
  display: flex;
  height: calc(100vh - 52px);
}
.gas-banner:not([hidden]) ~ .layout { height: calc(100vh - 52px - 36px); }

#map {
  flex: 1;
  min-width: 0;
  height: 100%;
}
#map.drawing, #map.drawing .leaflet-interactive { cursor: crosshair !important; }

.panel {
  width: 340px;
  overflow-y: auto;
  border-left: 1px solid var(--border);
  background: #fafbfc;
  padding: 12px;
}
.panel-section {
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}
.section-title {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--navy);
  margin-bottom: 8px;
}
.field-label {
  display: block;
  font-size: 12px;
  color: #555;
  margin: 8px 0 3px;
}
input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
}
.row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.row.wrap { flex-wrap: wrap; }
.row input[type="text"] { flex: 1; }

button {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  min-height: 38px;
}
button:hover { background: #f0f1f3; }
button.primary { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 600; }
button.primary:hover { background: #d9860f; }
button.primary:disabled { opacity: 0.6; cursor: wait; }
button.danger { color: #c92a2a; border-color: #e5b3b3; }
button.block { width: 100%; margin-top: 10px; }

.hint { font-size: 11.5px; color: #777; margin-top: 6px; line-height: 1.4; }

.layer-toggle { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13.5px; }
.layer-toggle input { width: 18px; height: 18px; }

.feature-info { font-size: 13px; line-height: 1.5; }
.feature-info .warn { color: #c92a2a; font-weight: 700; }
.title-result {
  margin-top: 8px;
  font-size: 12.5px;
  line-height: 1.45;
}
.title-result .title-no { font-weight: 700; font-size: 15px; color: var(--navy); }
.title-result .attribution { font-size: 10.5px; color: #888; margin-top: 4px; }

.exports-list { font-size: 12.5px; }
.export-row {
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.export-row a { color: var(--blue); font-weight: 600; text-decoration: none; white-space: nowrap; }
.export-name { word-break: break-all; }

.panel-footer {
  padding: 12px 0 4px;
  font-size: 11px;
  color: #999;
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 30, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}
.modal {
  background: #fff;
  border-radius: 10px;
  padding: 18px;
  width: 100%;
  max-width: 380px;
}
.modal-title { font-weight: 700; font-size: 16px; color: var(--navy); }
.modal-buttons { justify-content: flex-end; margin-top: 16px; }
.swatches { display: flex; gap: 6px; }
.swatch {
  width: 30px; height: 30px; min-height: 30px;
  border-radius: 6px; border: 2px solid #fff;
  outline: 1px solid var(--border);
  padding: 0;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  z-index: 3000;
  max-width: 90vw;
}

@media (max-width: 768px) {
  .panel-toggle { display: block; }
  .layout { position: relative; }
  .panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 55%;
    z-index: 1500;
    border-top: 2px solid var(--orange);
    border-left: none;
    display: none;
  }
  .panel.open { display: block; }
}
