:root {
  --ink: #15202b;
  --muted: #5d6977;
  --line: #cfd8e3;
  --panel: #ffffff;
  --bg: #eef3f7;
  --accent: #0f7f79;
  --accent-dark: #095d58;
  --selected: #f05a28;
  font-family: "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  height: 100vh;
  min-height: 100vh;
  margin: 0;
  display: grid;
  grid-template-columns: 420px 1fr;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

.sidebar {
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #f8fafc;
  padding: 14px;
}

header {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

header strong {
  font-size: 30px;
  font-weight: 350;
}

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

.panel {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.panel h2 {
  margin: 0;
  padding: 12px 14px;
  font-size: 16px;
  border-bottom: 1px solid var(--line);
  background: #e4e8ed;
}

.panel-note {
  margin: 0;
  padding: 10px 14px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

label {
  display: grid;
  gap: 5px;
  padding: 10px 14px 0;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid #b9c4cf;
  background: #ffffff;
  color: var(--ink);
  padding: 7px 9px;
}

input[readonly] {
  background: #f8fafc;
  color: #0f172a;
  cursor: help;
}

textarea {
  resize: vertical;
}

.checkbox-field {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
}

.checkbox-field input {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 14px 14px;
}

button {
  min-height: 36px;
  border: 1px solid #b8c4cf;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

button.primary {
  color: #ffffff;
  border-color: var(--accent);
  background: var(--accent);
}

button:hover {
  border-color: var(--accent);
}

.selection-summary {
  padding: 12px 14px 0;
  display: grid;
  gap: 8px;
}

.trace-tools {
  padding: 12px 14px 0;
  display: grid;
  gap: 8px;
}

.trace-tools strong {
  color: var(--ink);
}

.trace-tools .panel-note {
  padding: 0;
  font-size: 12px;
}

.trace-button-row {
  padding: 0;
}

.status {
  display: block;
  min-height: 42px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.status.is-error {
  color: #b42318;
  border-color: #f1b8b1;
  background: #fff4f2;
}

.map-shell {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  background: #dfe7ef;
}

.map-toolbar {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: auto;
  right: 14px;
  width: max-content;
  max-width: calc(100% - 28px);
  display: flex;
  gap: 6px;
  justify-content: flex-start;
  align-items: center;
  min-height: 40px;
  padding: 4px 6px 4px 10px;
  border: 1px solid rgba(21, 32, 43, 0.2);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 28px rgba(20, 36, 54, 0.12);
}

#mapTitle {
  flex: 0 0 auto;
  min-width: 130px;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.basemap-menu {
  position: relative;
}

.icon-text-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
}

.icon-text-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.demo-button {
  border-color: rgba(240, 90, 40, 0.45);
  color: #ffffff;
  background: linear-gradient(135deg, #0f7f79, #f05a28);
  box-shadow: 0 8px 22px rgba(15, 127, 121, 0.22);
}

.language-select {
  width: 58px;
  min-height: 34px;
  padding: 0 6px;
  font-weight: 800;
}

.basemap-menu-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 12;
  min-width: 178px;
  padding: 4px 0;
  border: 1px solid rgba(21, 32, 43, 0.18);
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(20, 36, 54, 0.18);
}

.basemap-menu-list button {
  width: 100%;
  min-height: 32px;
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0 10px;
}

.basemap-menu-list button:hover,
.basemap-menu-list button.is-active {
  background: rgba(15, 127, 121, 0.1);
  color: var(--accent-dark);
}

.icon-button {
  width: 36px;
  min-width: 36px;
  min-height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid #b9c4cf;
  background: #ffffff;
  color: var(--ink);
}

.toolbar-link {
  text-decoration: none;
}

.icon-button svg,
.toolbar-link svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linejoin: round;
  stroke-linecap: round;
}

#mapView {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.esri-view,
.esri-view-root {
  width: 100%;
  height: 100%;
}

.map-empty {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  color: var(--muted);
  pointer-events: none;
}

.map-shell.has-data .map-empty {
  display: none;
}

.map-loading {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 12px;
  align-content: center;
  background: rgba(248, 250, 252, 0.62);
  color: var(--ink);
  pointer-events: none;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(15, 127, 121, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.demo-tour {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

.demo-tour::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at var(--demo-x, 72%) var(--demo-y, 18%), rgba(255, 255, 255, 0.02) 0 90px, rgba(15, 23, 42, 0.32) 220px),
    rgba(15, 23, 42, 0.08);
}

.demo-tour-card {
  position: fixed;
  left: var(--demo-card-left, 50%);
  top: var(--demo-card-top, 50%);
  width: min(420px, calc(100vw - 32px));
  padding: 18px 20px 16px;
  border: 1px solid rgba(96, 239, 255, 0.45);
  background: rgba(5, 18, 30, 0.92);
  color: #e9fbff;
  box-shadow: 0 22px 60px rgba(3, 10, 18, 0.42), 0 0 28px rgba(15, 127, 121, 0.18);
  pointer-events: auto;
}

.demo-kicker {
  color: #7ff4ff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.demo-tour-card h2 {
  margin: 7px 0 8px;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 650;
}

.demo-tour-card p {
  margin: 0;
  color: rgba(233, 251, 255, 0.82);
  font-size: 14px;
  line-height: 1.45;
}

.demo-tour-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

.demo-tour-actions button {
  min-width: 82px;
  border-color: rgba(127, 244, 255, 0.38);
  background: rgba(255, 255, 255, 0.06);
  color: #e9fbff;
}

.demo-tour-actions button.primary {
  border-color: #60efff;
  background: #0f7f79;
}

.demo-highlight {
  position: relative;
  z-index: 42 !important;
  outline: 3px solid rgba(240, 90, 40, 0.88);
  outline-offset: 4px;
  box-shadow: 0 0 0 8px rgba(240, 90, 40, 0.16), 0 0 32px rgba(96, 239, 255, 0.38);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 70vh;
  }
}
