:root {
  --bg: #f7f7f7;
  --surface: #ffffff;
  --text: #171717;
  --muted: #5f6368;
  --line: #e4e6e8;
  --accent: #1f6feb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.layout {
  width: min(1080px, calc(100% - 2rem));
  margin: 1.5rem auto 2rem;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
}

.dashboard-main {
  min-width: 0;
}

.hero-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.hero-badge-group {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: auto;
}

.hero h1 {
  font-size: clamp(1.6rem, 3.8vw, 2.4rem);
  line-height: 1.15;
  margin: 0.2rem 0 0.35rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.9rem;
  padding: 0.2rem 0.65rem;
  border: 1px solid color-mix(in srgb, var(--line) 70%, var(--accent) 30%);
  border-radius: 999px;
  background: color-mix(in srgb, white 90%, var(--accent) 10%);
  color: color-mix(in srgb, var(--text) 74%, var(--accent) 26%);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  font-weight: 500;
  white-space: nowrap;
}

.hero-badge-icon {
  justify-content: center;
  width: 1.9rem;
  padding: 0;
}

.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
}

.subtitle {
  max-width: 72ch;
  color: var(--muted);
  margin: 0;
}

.meta {
  margin-top: 0.5rem;
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
  font-size: 0.82rem;
}

.cards {
  margin-top: 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.7rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem 0.9rem;
}

.card-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.card-value {
  margin-top: 0.3rem;
  font-size: 1.2rem;
  font-weight: 600;
}

.panel-grid {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.panel {
  margin-top: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.9rem;
}

.panel h2 {
  margin: 0 0 0.7rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.dashboard-sidebar {
  position: sticky;
  top: 1rem;
}

.dashboard-sidebar__header {
  margin-bottom: 0.85rem;
  align-items: flex-start;
}

.dashboard-sidebar__actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dashboard-sidebar__clear {
  padding: 0.34rem 0.6rem;
  border-radius: 999px;
  border-color: color-mix(in srgb, var(--line) 58%, var(--accent) 42%);
  background: color-mix(in srgb, white 88%, var(--accent) 12%);
}

.dashboard-sidebar__clear:hover {
  border-color: color-mix(in srgb, var(--line) 35%, var(--accent) 65%);
  background: color-mix(in srgb, white 80%, var(--accent) 20%);
}

.dashboard-sidebar__header h2 {
  margin-bottom: 0.18rem;
}

.tool-sidebar-list {
  display: grid;
  gap: 0.7rem;
}

.tool-sidebar-control {
  display: grid;
  gap: 0.45rem;
}

.tool-sidebar-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tool-sidebar-select {
  width: 100%;
  padding: 0.72rem 2.4rem 0.72rem 0.85rem;
  border-radius: 10px;
  border-color: color-mix(in srgb, var(--line) 72%, var(--accent) 28%);
  background: linear-gradient(180deg, #ffffff 0%, #fbfbfb 100%);
}

.tool-sidebar-select:focus-visible {
  outline: 2px solid color-mix(in srgb, white 28%, var(--accent) 72%);
  outline-offset: 2px;
}

.tool-sidebar-summary {
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfbfb 100%);
}

.tool-sidebar-item__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
}

.tool-sidebar-item__title {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.3;
}

.tool-sidebar-item__count {
  flex-shrink: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
  color: var(--muted);
}

.tool-sidebar-item__stats {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.38rem 0.75rem;
  margin: 0.7rem 0 0;
}

.tool-sidebar-item__stats dt,
.tool-sidebar-item__stats dd {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
}

.tool-sidebar-item__stats dt {
  color: var(--muted);
}

.tool-sidebar-item__stats dd {
  text-align: right;
}

.tool-sidebar-empty {
  padding: 0.2rem 0;
}

.panel-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
}

.hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}

.table-wrap {
  overflow-x: auto;
}

.table-controls {
  margin-top: 0.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.table-controls-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

button,
select {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
}

button:disabled {
  opacity: 0.45;
}

#locationMap {
  width: 100%;
  height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.map-status {
  margin: 0.55rem 0 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  color: var(--muted);
}

.report-row:hover td {
  background: color-mix(in srgb, var(--accent) 4%, white);
}

.report-row td:last-child {
  text-align: right;
}

.details-button {
  white-space: nowrap;
  padding: 0.28rem 0.58rem;
  border-color: color-mix(in srgb, var(--line) 72%, var(--accent) 28%);
  background: color-mix(in srgb, white 88%, var(--accent) 12%);
  color: color-mix(in srgb, var(--text) 72%, var(--accent) 28%);
  font-weight: 500;
  box-shadow: none;
}

.details-button:hover {
  background: color-mix(in srgb, white 78%, var(--accent) 22%);
  border-color: color-mix(in srgb, var(--line) 45%, var(--accent) 55%);
  color: color-mix(in srgb, var(--text) 55%, var(--accent) 45%);
}

.details-button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, white);
  outline-offset: 2px;
}

.details-button:active {
  background: color-mix(in srgb, white 70%, var(--accent) 30%);
}

.report-modal {
  width: min(900px, calc(100vw - 2rem));
  max-height: calc(100vh - 3rem);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.report-modal::backdrop {
  background: rgba(23, 23, 23, 0.55);
  backdrop-filter: blur(3px);
}

.report-modal__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem 0.8rem;
  border-bottom: 1px solid var(--line);
}

.report-modal__close {
  min-width: 5rem;
}

.report-modal__content {
  padding: 1rem;
  overflow: auto;
}

.report-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.report-detail-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem;
  background: #fcfcfc;
}

.report-detail-card h3 {
  margin: 0 0 0.7rem;
  font-size: 0.85rem;
}

.report-detail-list {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr;
  gap: 0.45rem 0.7rem;
  margin: 0;
}

.report-detail-list dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-family: "IBM Plex Mono", monospace;
}

.report-detail-list dd {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.report-detail-card--full {
  grid-column: 1 / -1;
}

.report-detail-stack {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.report-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.report-chip {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  font-family: "IBM Plex Mono", monospace;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 0.55rem 0.4rem;
  white-space: nowrap;
}

th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

th.sortable {
  cursor: pointer;
}

th.sorted {
  color: var(--text);
}

td {
  font-family: "IBM Plex Mono", monospace;
}

canvas {
  max-height: 280px;
}

@media (max-width: 850px) {
  .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .dashboard-sidebar {
    position: static;
  }

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

  #locationMap {
    height: 260px;
  }

  .hero-title-row {
    align-items: flex-start;
  }

  .report-detail-grid {
    grid-template-columns: 1fr;
  }

  .report-detail-list {
    grid-template-columns: 1fr;
  }
}
