:root {
  --bg: #0b0f12;
  --panel: #0f1418;
  --muted: #9aa7b2;
  --text: #e6edf3;
  --accent: #26a269;
  --border: #1a232b;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);
}

#app {
  display: grid;
  grid-template-columns: 360px 1fr;
  height: 100vh;
}

#sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  border-right: 1px solid var(--border);
  background: var(--panel);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo {
  width: 36px; height: 36px; border-radius: 8px;
  background: linear-gradient(135deg, #208b5e, #26a269);
  display: grid; place-items: center; font-weight: 700;
}
.brand .title .name { font-weight: 700; }
.brand .title .subtitle { color: var(--muted); font-size: 12px; }

.panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #0e1216;
}
.panel h3 { margin: 0 0 8px 0; font-size: 14px; }

.history-controls { display: grid; gap: 8px; }
.history-controls label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
select, textarea, button { font: inherit; }
select, textarea {
  width: 100%;
  background: #0c0f13; color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 8px; outline: none;
}
button {
  background: var(--accent);
  color: white; border: none; padding: 8px 10px; border-radius: 8px;
  cursor: pointer; font-weight: 600;
}
button:disabled { opacity: 0.6; cursor: not-allowed; }

.chat { display: flex; flex-direction: column; height: 100%; min-height: 280px; }
.chat-thread { flex: 1; overflow: auto; display: grid; gap: 8px; padding: 8px; background: #0b0e12; border-radius: 8px; border: 1px solid var(--border); }
.chat-msg { padding: 8px; border-radius: 8px; }
.chat-msg.user { background: #0d1720; border: 1px solid #183026; }
.chat-msg.ai { background: #10151b; border: 1px solid var(--border); }
.chat-input { display: grid; gap: 8px; margin-top: 8px; }
#sendBtn { justify-self: end; }

.footer { color: var(--muted); font-size: 12px; text-align: center; }

#main { display: grid; grid-template-rows: 1fr auto minmax(240px, 45%); position: relative; }
#map { width: 100%; height: 100%; }
#viewerBar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-top: 1px solid var(--border); background: #0c1014;
}
.viewer-meta { display: flex; gap: 24px; color: var(--muted); font-size: 13px; }
.meta-label { color: var(--text); font-weight: 600; margin-right: 6px; }

#viewer { width: 100%; height: 100%; border-top: 1px solid var(--border); }
#emptyState { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.empty-msg { color: var(--muted); background: rgba(0,0,0,0.3); padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); }

/* Leaflet theme tweaks */
.leaflet-container { background: #0a0e11; }
.leaflet-control-zoom a { background: #0e141a; color: var(--text); border-color: var(--border); }
.leaflet-bar a.leaflet-disabled { background: #0e141a; color: #556; }

/* Welcome modal */
.hidden { display: none !important; }
#welcomeModal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}
.welcome-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
}
.welcome-box {
  position: relative;
  max-width: 560px;
  margin: 10vh auto 0 auto;
  background: #0e1216;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}
.welcome-box h2 { margin: 0 0 8px 0; font-size: 18px; }
.welcome-box p { margin: 0 0 12px 0; color: var(--muted); }
.welcome-actions { display: flex; justify-content: flex-end; }

