:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #14212b;
  --muted: #5b6b76;
  --line: #d7dee5;
  --accent: #0b6e4f;
  --accent-ink: #ffffff;
  --warn: #8a5a00;
  --danger: #8b1e1e;
  --info: #0b4f6c;
  --shadow: 0 10px 30px rgba(20, 33, 43, 0.08);
  --radius: 14px;
  --font: "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(11, 110, 79, 0.08), transparent 40%),
    linear-gradient(180deg, #eef3f6 0%, var(--bg) 40%, #e8eef2 100%);
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: 0.08em;
}
.subtitle { margin: 0.15rem 0 0; color: var(--muted); }
.status-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; align-content: center; }
.chip {
  border: 1px solid var(--line);
  background: #f8fafb;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}

.layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1rem;
  padding: 1rem 1.5rem 2rem;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem 1.2rem;
}
.search-panel, .summary-panel { grid-column: 1 / -1; }
.table-panel { grid-column: 1 / 2; }
.map-panel { grid-column: 2 / 3; min-height: 420px; }
.details-panel { grid-column: 1 / -1; }

h2 { margin: 0 0 0.75rem; font-size: 1.1rem; }
.attribution { color: var(--muted); font-size: 0.9rem; }
.attribution.small { font-size: 0.8rem; margin-top: 0.75rem; }

.search-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}
label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
input, select, button, .button-link {
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 0.55rem 0.7rem;
  color: var(--ink);
  background: #fff;
}
.checkbox { flex-direction: row; align-items: center; gap: 0.5rem; }
.actions { grid-column: 1 / -1; display: flex; gap: 0.6rem; flex-wrap: wrap; }
button, .button-link {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
button.secondary, .button-link.secondary {
  background: #e8eef2;
  color: var(--ink);
}

.alert {
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.9rem;
  font-size: 0.9rem;
}
.alert.info { background: #e7f4fa; color: var(--info); }
.alert.ok { background: #e7f6ef; color: var(--accent); }
.alert.error { background: #fdecec; color: var(--danger); }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
}
.summary-grid div {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem;
  background: #fbfcfd;
}
.summary-grid span { display: block; color: var(--muted); font-size: 0.78rem; }
.summary-grid strong { font-size: 0.95rem; word-break: break-word; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.8rem; }

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}
.table-toolbar h2 { margin: 0; margin-right: auto; }
.table-wrap { overflow: auto; max-height: 480px; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
th, td { padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; background: #f3f7f9; cursor: pointer; }
tr.selected { background: #e7f6ef; }
tr:hover { background: #f5faf7; }
.pagination { display: flex; gap: 0.75rem; align-items: center; margin-top: 0.75rem; }
.column-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 0.25rem; padding: 0.5rem 0; }

#map {
  width: 100%;
  height: 360px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #e9eef2;
}
#details-view {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  background: #0f1a21;
  color: #d7e7df;
  border-radius: 12px;
  padding: 1rem;
  min-height: 220px;
  overflow: auto;
}

@media (max-width: 1100px) {
  .layout, .search-form, .summary-grid { grid-template-columns: 1fr; }
  .table-panel, .map-panel, .details-panel, .search-panel, .summary-panel { grid-column: 1; }
}
