.btn, .chip, .select, .input, .tab, .record {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface);
  padding: 0 var(--space-3);
}
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); font-weight: 600; }
.btn:hover { background: var(--surface-2); }
.btn[aria-pressed="true"] { background: var(--info-bg); border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-strong); color: var(--on-accent); }
.btn--icon { width: 44px; padding: 0; }

.chip { display: inline-flex; align-items: center; gap: var(--space-2); border-radius: 999px; font-weight: 600; max-width: 100%; }
.chip__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { padding: 2px 8px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); font-size: 12px; font-weight: 700; }

.field { display: grid; gap: var(--space-1); color: var(--muted); font-size: 12px; }
.input, .select { width: 100%; background: var(--surface); color: var(--text); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.shortcuts { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.tabs { display: flex; gap: var(--space-1); padding: 0 var(--space-3) var(--space-2); }
.tab { flex: 1; border-radius: var(--radius-m); background: transparent; border-color: transparent; font-weight: 600; color: var(--muted); }
.tab[aria-selected="true"] { background: var(--info-bg); color: var(--accent); border-color: var(--accent); }

.notice {
  margin: var(--space-3); padding: var(--space-3); border-radius: var(--radius-m);
  display: grid; gap: var(--space-2); background: var(--info-bg); color: var(--text);
}
.notice[data-kind="error"] { background: var(--danger-bg); color: var(--danger); }
.notice[data-kind="warn"] { background: var(--warn-bg); color: var(--warn); }
.notice .btn { justify-self: start; }
.map-notice {
  position: absolute; z-index: 700; left: 50%; bottom: calc(var(--map-inset-bottom) + 12px);
  transform: translateX(-50%); margin: 0; max-width: min(90%, 420px);
  background: var(--warn-bg); color: var(--warn); box-shadow: var(--shadow-1);
}

.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); padding: var(--space-3); margin: 0; }
.metric { padding: var(--space-3); border-radius: var(--radius-m); background: var(--surface-2); }
.metric dt { color: var(--muted); font-size: 12px; }
.metric dd { margin: var(--space-1) 0 0; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.hint { padding: 0 var(--space-3) var(--space-3); color: var(--muted); font-size: 12px; }

.section-title { padding: var(--space-3) var(--space-3) 0; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.list-bar { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3); }
.list-bar .select { width: auto; flex: 1; }
.records { list-style: none; margin: 0; padding: 0 var(--space-3); display: grid; gap: var(--space-1); }
.record { display: grid; width: 100%; text-align: left; gap: 2px; padding: var(--space-2) var(--space-3); border-color: var(--surface-2); }
.record:hover { background: var(--surface-2); }
.record[aria-pressed="true"] { background: var(--info-bg); border-color: var(--accent); }
.record__time { font-weight: 600; font-variant-numeric: tabular-nums; }
.record__meta { color: var(--muted); font-size: 12px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-3); }

.details { display: grid; gap: var(--space-2); margin: 0; padding: var(--space-3); }
.details div { display: flex; justify-content: space-between; gap: var(--space-3); padding-bottom: var(--space-2); border-bottom: 1px solid var(--surface-2); }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.empty { padding: var(--space-3); color: var(--muted); }

.menu {
  position: absolute; top: calc(100% + var(--space-2)); right: 0; min-width: 220px; z-index: 5;
  display: grid; gap: var(--space-2); padding: var(--space-3);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); box-shadow: var(--shadow-2);
}
.menu__group { display: flex; gap: var(--space-2); }
.menu__group .btn { flex: 1; }

.pin { background: none; border: 0; }
.pin svg { width: 28px; height: 28px; fill: var(--pin-point); stroke: var(--surface); stroke-width: 2; paint-order: stroke; }
.pin--first svg { fill: var(--pin-first); }
.pin--last svg { fill: var(--pin-last); }
.pin .ring { fill: none; stroke: var(--pin-last); stroke-width: 3; }
.pin--selected svg { transform: scale(1.4); stroke: var(--pin-selected); stroke-width: 3; }
.cluster { background: none; }
.cluster span {
  position: absolute; left: 50%; top: 0; transform: translateX(-50%); white-space: nowrap; box-sizing: border-box;
  display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); border: 3px solid var(--surface);
  box-shadow: var(--shadow-1); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums;
}
.trace { stroke: var(--accent); stroke-opacity: 0.9; }
.trace--gap { stroke-opacity: 0.6; }
.accuracy-circle { fill: var(--accent); fill-opacity: 0.15; stroke: var(--accent); stroke-width: 1; }

.trip-route { stroke: var(--trip-route); stroke-opacity: 0.7; }
.trip-route--active { stroke: var(--accent); stroke-opacity: 1; }
.trip-route--gap { stroke-opacity: 0.6; }
.trip-stop { fill: var(--accent); fill-opacity: 0.12; stroke: var(--accent); stroke-width: 1; }
.suspect { fill: var(--suspect); fill-opacity: 0.35; stroke: var(--suspect); stroke-width: 2; stroke-dasharray: 3 3; }
.trip-arrow { background: none; border: 0; }
.trip-arrow svg { width: 18px; height: 18px; fill: var(--accent); stroke: var(--surface); stroke-width: 2; paint-order: stroke; }
.trip-end { background: none; border: 0; }
.trip-end span {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 999px; font-weight: 700; font-size: 13px;
  background: var(--accent); color: var(--on-accent); border: 3px solid var(--surface); box-shadow: var(--shadow-1);
}

.toggle { display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-3) var(--space-3); color: var(--text); }
.trip-day { margin: var(--space-3) var(--space-3) var(--space-1); font-size: 12px; font-weight: 700; color: var(--muted); }
#tripsList .records { padding-top: 0; }
.record__title { font-weight: 600; font-variant-numeric: tabular-nums; }
