:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #ef4444;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

.app-shell { display: flex; flex-direction: column; height: 100vh; }

.topbar {
  background: #1e293b;
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.topbar h1 { margin: 0; font-size: 1.25rem; display: flex; align-items: center; gap: 10px; }
.badge-pro { background: #f59e0b; font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; color: #000; }
.subtitle { margin: 0.2rem 0 0 0; font-size: 0.85rem; opacity: 0.8; }

.topbar-actions { display: flex; gap: 10px; }
button {
  padding: 0.6rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}
button:hover:not(:disabled) { background: #f1f5f9; }
button.primary { background: var(--primary); color: white; border: none; }
button.primary:hover:not(:disabled) { background: var(--primary-hover); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.layout { display: flex; flex: 1; overflow: hidden; }

.sidebar {
  width: 350px;
  padding: 1.5rem;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.content { flex: 1; padding: 1.5rem; background: #f1f5f9; display: flex; flex-direction: column; }

.card {
  background: var(--card-bg);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.drop-zone {
  border: 2px dashed var(--border);
  padding: 1.5rem;
  text-align: center;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
}
.drop-zone.dragover { border-color: var(--primary); background: #eff6ff; }
.file-label { color: var(--primary); text-decoration: underline; cursor: pointer; }
input[type="file"] { display: none; }

.field-grid { display: flex; flex-direction: column; gap: 1rem; }
.field-grid label { font-size: 0.85rem; font-weight: 600; display: flex; flex-direction: column; gap: 4px; }
.field-grid select, .field-grid input { padding: 0.5rem; border-radius: 4px; border: 1px solid var(--border); }
.field-grid small { font-weight: normal; color: var(--muted); }

.stats-list { margin: 0; display: grid; grid-template-columns: 1fr; gap: 8px; }
.stats-list div { display: flex; justify-content: space-between; font-size: 0.9rem; border-bottom: 1px solid var(--bg); padding-bottom: 4px; }
.stats-list dt { color: var(--muted); }
.stats-list dd { margin: 0; font-weight: 600; }

.map-card { flex: 1; padding: 0; overflow: hidden; position: relative; }
#map { height: 100%; width: 100%; }

.loader-container { display: flex; align-items: center; gap: 10px; margin-top: 15px; color: var(--primary); font-weight: 600; }
.hidden { display: none; }
.spinner {
  width: 20px; height: 20px;
  border: 3px solid #e2e8f0; border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hint-card { background: #f0fdf4; border-color: #bbf7d0; }