/* ============================================================================
   Repin city analytics — styles
   Colours and typography echo docs/DESIGN_SYSTEM.md: dark chrome, colour is
   data, Montserrat for everything except the wordmark treatment.
   ========================================================================= */

@font-face {
  font-family: 'Montserrat';
  src: url('vendor/fonts/Montserrat-VariableFont_wght.ttf') format('truetype-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* chrome */
  --bg-base: #0b0e11;
  --surface-1: #12161b;
  --surface-2: #1a1f26;
  --surface-3: #232a33;
  --outline: #2e3742;

  /* text */
  --text-hi: #f2f5f7;
  --text-mid: #a9b4c0;
  --text-low: #6b7683;

  /* brand and status */
  --brand: #e11d2e;
  --accent: #22d3ee;
  --accent-soft: rgba(34, 211, 238, 0.14);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --brand-soft: rgba(225, 29, 46, 0.12);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;

  --font: 'Montserrat', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Cascadia Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;

  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  --focus: 0 0 0 2px var(--bg-base), 0 0 0 4px var(--accent);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-base);
  color: var(--text-mid);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1,
h2,
h3,
p,
ul,
ol {
  margin: 0;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent);
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 60;
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top 120ms ease;
}

.skip-link:focus {
  top: 12px;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: 4px;
}

/* ------------------------------------------------------------- primitives */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 14px;
  border: 1px solid var(--outline);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-hi);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

.btn:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: #3b4653;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--small {
  min-height: 30px;
  padding: 4px 11px;
  font-size: 12px;
}

.btn--ghost {
  background: transparent;
}

.btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: #c8182a;
  border-color: #c8182a;
}

.btn--block {
  width: 100%;
}

.segmented {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--outline);
  border-radius: 999px;
}

.segmented__item {
  min-height: 28px;
  padding: 4px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-mid);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.segmented__item:hover {
  color: var(--text-hi);
}

.segmented__item[aria-pressed='true'] {
  background: var(--accent-soft);
  color: var(--accent);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border: 1px solid var(--outline);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  cursor: pointer;
  user-select: none;
}

.switch input {
  accent-color: var(--accent);
  margin: 0;
}

.switch:hover {
  border-color: #3b4653;
  color: var(--text-hi);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-low);
  text-transform: uppercase;
}

.field--inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.field--inline .field__label {
  white-space: nowrap;
}

.field input,
.field select {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--outline);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text-hi);
}

.field input[type='date'] {
  min-width: 140px;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
}

.hint {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-low);
  max-width: 78ch;
}

.wordmark {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text-hi);
  white-space: nowrap;
}

.wordmark__sub {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-low);
}

/* ----------------------------------------------------------- boot + auth */

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.boot__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-mid);
}

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: radial-gradient(1000px 600px at 50% -10%, rgba(34, 211, 238, 0.08), transparent 60%),
    var(--bg-base);
}

.auth-card {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px;
  background: var(--surface-1);
  border: 1px solid var(--outline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-hi);
}

.auth-hint {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-low);
}

.auth-foot {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-low);
}

.auth-foot code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mid);
}

.password-wrap {
  display: flex;
  gap: 8px;
}

.password-wrap input {
  flex: 1;
  min-width: 0;
}

.form-error {
  padding: 9px 12px;
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.12);
  color: #fecaca;
  font-size: 13px;
}

/* --------------------------------------------------------------- shell */

.shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--outline);
}

.topbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  padding: 8px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-mid);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text-hi);
}

.tab[aria-current='page'] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border: 1px solid var(--outline);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-mid);
}

.user-chip__name {
  color: var(--text-hi);
  font-weight: 600;
}

.user-chip__role {
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-low);
}

/* --------------------------------------------------------------- filters */

.filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--outline);
}

.filterbar__group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.filterbar__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-low);
}

.filterbar__summary {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-low);
}

.custom-range {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

/* ---------------------------------------------------------------- views */

main {
  padding-top: 20px;
  display: block;
}

.view {
  display: block;
}

.view-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.view-head h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-hi);
}

.view-sub {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-low);
}

.view-actions {
  display: flex;
  gap: 8px;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

/* ----------------------------------------------------------------- KPI */

.kpi-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 12px;
}

/* The wrapper exists so the whole KPI row can be swapped for a loading/error
   state; `display: contents` keeps the cards as the grid items. */
.kpi-grid__items {
  display: contents;
}

.kpi-grid > .panel-state {
  grid-column: 1 / -1;
}

.panel-state[data-tone='error'] .panel-state__title {
  color: #fca5a5;
}

.kpi {
  padding: 14px 16px;
  background: var(--surface-1);
  border: 1px solid var(--outline);
  border-radius: var(--radius);
}

.kpi__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-low);
}

.kpi__value {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-hi);
  font-variant-numeric: tabular-nums;
}

.kpi__sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-low);
  min-height: 16px;
}

.kpi__delta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--outline);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  font-variant-numeric: tabular-nums;
}

.kpi__delta[data-direction='up']::before {
  content: '▲';
  font-size: 9px;
  color: var(--text-mid);
}

.kpi__delta[data-direction='down']::before {
  content: '▼';
  font-size: 9px;
  color: var(--text-mid);
}

.kpi__delta[data-direction='flat']::before {
  content: '■';
  font-size: 8px;
  color: var(--text-low);
}

/* --------------------------------------------------------------- panels */

.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 16px;
  background: var(--surface-1);
  border: 1px solid var(--outline);
  border-radius: var(--radius);
}

.panel + .panel {
  margin-top: 16px;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-head h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-hi);
}

.panel-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-low);
}

.panel-head__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.panel-body {
  flex: 1;
  min-width: 0;
}

.chart-box {
  position: relative;
  height: 260px;
}

.chart-box--tall {
  height: 320px;
}

/* ------------------------------------------------------------ KPI compare */

.compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.compare__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-low);
}

.compare__value {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-hi);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- table */

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

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--outline);
  white-space: nowrap;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-1);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-low);
}

.table td {
  color: var(--text-mid);
  font-variant-numeric: tabular-nums;
}

.table tbody tr {
  cursor: pointer;
}

.table tbody tr:hover td,
.table tbody tr:focus-visible td {
  background: var(--surface-2);
  color: var(--text-hi);
}

.table tbody tr[aria-current='true'] td {
  background: var(--accent-soft);
  color: var(--text-hi);
}

.table__sort {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: inherit;
  cursor: pointer;
}

.table__sort:hover {
  color: var(--text-hi);
}

.table__sort-icon::after {
  content: '↕';
  font-size: 10px;
  opacity: 0.6;
}

.table__sort[aria-pressed='true'] .table__sort-icon::after {
  content: '↓';
  opacity: 1;
  color: var(--accent);
}

.table__city {
  color: var(--text-hi);
  font-weight: 600;
}

.table__muted {
  color: var(--text-low);
}

.table__delta {
  font-weight: 600;
}

.table__delta[data-direction='up'] {
  color: var(--warning);
}

.table__delta[data-direction='down'] {
  color: var(--success);
}

.table__delta[data-direction='flat'] {
  color: var(--text-low);
}

.category-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.category-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55);
}

/* --------------------------------------------------------------- alerts */

.alerts {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
}

.alert {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--outline);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
}

.alert[data-severity='high'] {
  border-left-color: var(--danger);
}

.alert[data-severity='medium'] {
  border-left-color: var(--warning);
}

.alert[data-severity='low'] {
  border-left-color: var(--text-low);
}

.alert__main {
  min-width: 0;
  flex: 1;
}

.alert__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-hi);
}

.alert__kind {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-low);
}

.alert__numbers {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-mid);
  font-variant-numeric: tabular-nums;
}

.severity {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.severity[data-severity='high'] {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
}

.severity[data-severity='medium'] {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
}

.severity[data-severity='low'] {
  background: var(--surface-3);
  color: var(--text-mid);
}

/* ------------------------------------------------------------- hourly grid */

.heatgrid-scroll {
  overflow-x: auto;
  padding-bottom: 4px;
}

.heatgrid {
  display: grid;
  grid-template-columns: 40px minmax(480px, 1fr);
  gap: 3px;
  min-width: 520px;
}

.heatgrid__hourrow,
.heatgrid__row {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 3px;
}

.heatgrid__hourlabel {
  font-size: 9px;
  text-align: center;
  color: var(--text-low);
  font-variant-numeric: tabular-nums;
}

.heatgrid__rowlabel {
  display: flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-mid);
}

.heatgrid__cell {
  min-height: 26px;
  border-radius: 3px;
  background: var(--surface-3);
  font-size: 9px;
  line-height: 1;
  color: rgba(11, 14, 17, 0.85);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.heatgrid-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-low);
}

.heatgrid-legend__ramp {
  width: 120px;
  height: 8px;
  border-radius: 999px;
  border: 1px solid var(--outline);
}

/* ---------------------------------------------------------------- map */

.panel--map {
  padding: 0;
  overflow: hidden;
}

.map-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--outline);
}

.map-controls__group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-low);
  font-variant-numeric: tabular-nums;
}

.map-canvas {
  position: relative;
  height: min(66vh, 700px);
  min-height: 360px;
  background: repeating-linear-gradient(45deg, #0e1216 0 12px, #10151a 12px 24px);
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--outline);
  font-size: 11.5px;
  color: var(--text-low);
}

.map-legend__ramp {
  width: 96px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #164e63, var(--accent), var(--warning), var(--danger));
  border: 1px solid var(--outline);
}

.map-legend__spacer {
  width: 8px;
}

.map-legend__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px #fff;
}

.map-note {
  position: absolute;
  z-index: 500;
  left: 12px;
  right: 12px;
  bottom: 12px;
  padding: 8px 12px;
  border: 1px solid var(--outline);
  border-radius: var(--radius-sm);
  background: rgba(18, 22, 27, 0.92);
  font-size: 12px;
  color: var(--text-mid);
}

.map-popup {
  font-size: 13px;
  color: var(--text-hi);
}

.map-popup__count {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-hi);
  font-variant-numeric: tabular-nums;
}

.map-popup__category {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: var(--text-mid);
}

.map-popup__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.map-popup__meta {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-low);
}

/* Leaflet chrome tuned to the dark surface. */
.leaflet-container {
  background: #0e1216;
  font-family: var(--font);
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip,
.leaflet-tooltip {
  background: var(--surface-2);
  color: var(--text-mid);
  border: 1px solid var(--outline);
  box-shadow: var(--shadow);
}

.leaflet-popup-content {
  margin: 12px 14px;
}

.leaflet-popup-close-button {
  color: var(--text-low) !important;
}

.leaflet-control-attribution {
  background: rgba(11, 14, 17, 0.7) !important;
  color: var(--text-low) !important;
}

.leaflet-control-attribution a {
  color: var(--text-mid) !important;
}

.leaflet-bar a {
  background: var(--surface-2);
  color: var(--text-hi);
  border-bottom-color: var(--outline);
}

.leaflet-bar a:hover {
  background: var(--surface-3);
}

/* -------------------------------------------------------- panel states */

.panel-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 16px;
  text-align: center;
  min-height: 120px;
}

.panel-state--overlay {
  position: absolute;
  inset: 48px 0 0;
  background: rgba(11, 14, 17, 0.82);
  backdrop-filter: blur(2px);
  border-radius: var(--radius);
  z-index: 400;
}

.panel-state__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-hi);
}

.panel-state__detail {
  max-width: 52ch;
  font-size: 12.5px;
  color: var(--text-low);
}

.state-heading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* loading skeleton — three shimmer bars */
.skeleton {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton__bar {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.skeleton__bar:nth-child(2) {
  width: 72%;
}

.skeleton__bar:nth-child(3) {
  width: 48%;
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--surface-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton__bar,
  .spinner {
    animation: none;
  }
}

/* --------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  background: var(--surface-2);
  border: 1px solid var(--outline);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 13px;
  color: var(--text-mid);
}

.toast[data-tone='error'] {
  border-left-color: var(--danger);
}

.toast[data-tone='success'] {
  border-left-color: var(--success);
}

.toast__message {
  flex: 1;
  min-width: 0;
}

.toast__close {
  border: 0;
  background: none;
  color: var(--text-low);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
}

/* --------------------------------------------------------------- footer */

.footer {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--outline);
  font-size: 11.5px;
  color: var(--text-low);
}

.noscript {
  margin: 40px auto;
  max-width: 420px;
  text-align: center;
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .topbar {
    flex-wrap: wrap;
    gap: 8px 14px;
  }

  .topbar__actions {
    order: 2;
  }

  .tabs {
    order: 3;
    width: 100%;
    border-top: 1px solid var(--outline);
    padding-top: 6px;
  }

  .filterbar {
    align-items: stretch;
  }

  .filterbar__summary {
    margin-left: 0;
    width: 100%;
  }

  .map-meta {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 560px) {
  .shell {
    padding: 0 12px 32px;
  }

  .view-head h1 {
    font-size: 19px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi__value {
    font-size: 22px;
  }

  .chart-box {
    height: 220px;
  }

  .chart-box--tall {
    height: 280px;
  }

  .map-canvas {
    height: 58vh;
    min-height: 320px;
  }

  .segmented {
    max-width: 100%;
    overflow-x: auto;
  }

  .field--inline {
    width: 100%;
  }

  .field--inline input,
  .field--inline select {
    flex: 1;
    min-width: 0;
  }

  .custom-range {
    width: 100%;
  }
}
