:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #102033;
  --muted: #667085;
  --line: #d9e1e8;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --danger: #b91c1c;
  --shadow: 0 14px 40px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  font-family: Inter, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.app-header {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand img {
  height: 44px;
}

.brand strong {
  display: block;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.brand span,
.header-actions a {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.layout {
  height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: 330px 1fr 360px;
  gap: 14px;
  padding: 14px;
}

.sidebar {
  min-width: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  padding: 16px;
}

.section-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  margin-bottom: 12px;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #344054;
  margin: 10px 0 6px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
  margin-top: 10px;
}

button,
.upload-button {
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  padding: 10px 12px;
  text-align: center;
}

button.secondary {
  background: #eef4f7;
  color: #344054;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.upload-button {
  display: block;
  margin-top: 10px;
}

.upload-button input {
  display: none;
}

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

#map {
  width: 100%;
  height: 100%;
}

.map-status {
  position: absolute;
  left: 18px;
  bottom: 18px;
  max-width: 560px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  color: #344054;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  z-index: 500;
}

.workflow-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.workflow-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  cursor: pointer;
  background: #fff;
}

.workflow-item.active {
  border-color: var(--primary);
  background: #ecfdf5;
}

.workflow-item strong {
  display: block;
  font-size: 13px;
}

.workflow-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  margin-top: 4px;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 12px;
}

.legend-row,
.stat-row,
.roi-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed #edf2f7;
  padding: 8px 0;
  font-size: 13px;
}

.legend-chip {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex: 0 0 auto;
}

.legend-name {
  margin-right: auto;
}

.empty-state {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.analysis-title {
  font-weight: 800;
  margin-bottom: 10px;
}

.stat-value,
.roi-value {
  font-weight: 800;
}

.notes {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.error {
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 1100px) {
  body {
    overflow: auto;
  }

  .layout {
    height: auto;
    grid-template-columns: 1fr;
  }

  .map-panel {
    height: 68vh;
  }
}
