:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --dark: #111827;
  --sidebar: #0f172a;
  --sidebar-button: #1e293b;
  --sidebar-button-hover: #263548;
  --success: #16a34a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Inter, Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden {
  display: none !important;
}

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

.error {
  color: var(--danger);
  min-height: 18px;
  font-size: 14px;
  margin-top: 10px;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  font: inherit;
}

button:hover {
  background: var(--primary-dark);
}

button.secondary {
  background: #374151;
}

button.secondary:hover {
  background: #1f2937;
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  background: #b91c1c;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  font: inherit;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

label {
  display: block;
  margin-bottom: 12px;
  font-size: 14px;
}

.checkbox-label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.checkbox-label input {
  width: auto;
  margin: 0;
  margin-top: 3px;
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 12px 0;
}

.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 30%),
    radial-gradient(circle at bottom right, rgba(15, 23, 42, 0.22), transparent 28%),
    var(--bg);
}

.auth-card {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.09);
  padding: 24px;
}

.auth-card h1 {
  margin: 0 0 10px;
  font-size: 30px;
}

.auth-card button {
  width: 100%;
  margin-top: 8px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--dark);
  color: white;
  position: sticky;
  top: 0;
  z-index: 1200;
}

.brand {
  font-weight: 700;
  font-size: 18px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar-right .muted {
  color: #d1d5db;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: calc(100vh - 63px);
}

.sidebar {
  background: var(--sidebar);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar button {
  width: 100%;
  text-align: left;
  background: var(--sidebar-button);
  color: white;
}

.sidebar button:hover {
  background: var(--sidebar-button-hover);
}

.sidebar button.active {
  background: var(--primary);
}

.content {
  padding: 18px;
}

.tab {
  animation: fade 0.16s ease-in;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(3px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.04);
}

.panel h2 {
  margin-top: 0;
  font-size: 20px;
}

.panel h3 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 16px;
}

.panel-subtitle {
  font-size: 14px;
  font-weight: 700;
  margin: 10px 0 6px;
}

.notice {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.45;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.04);
}

.stat-card {
  padding: 16px;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.idea-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.55;
}

.idea-list li {
  margin-bottom: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid textarea {
  min-height: 110px;
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.row button {
  flex: 1;
}

.row.spread {
  justify-content: space-between;
  align-items: center;
}

.map-layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 16px;
  min-height: calc(100vh - 130px);
}

#map {
  min-height: 640px;
  height: 100%;
  border-radius: 18px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.list-item {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
}

.list-item.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.list-item .row {
  margin-bottom: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 14px;
  overflow: hidden;
}

th,
td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  background: #f9fafb;
}

.small-buttons button {
  padding: 7px 10px;
  font-size: 13px;
  border-radius: 10px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  max-width: 390px;
  background: #111827;
  color: white;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  line-height: 1.4;
}

.toast img {
  max-width: 100%;
  border-radius: 10px;
  margin-top: 8px;
  display: block;
}

.leaflet-container {
  font: inherit;
}

@media (max-width: 1120px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar button {
    width: auto;
    flex: 1;
    text-align: center;
  }

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

  #map {
    min-height: 430px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}