:root {
  color-scheme: light;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 260px minmax(0, 1fr);
}

.app-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 22px;
  padding: 24px 16px;
  border-right: 1px solid var(--border);
  background: #ffffff;
  box-shadow: 1px 0 8px rgba(49, 54, 59, 0.08);
}

.app-brand {
  padding: 4px 8px 16px;
  border-bottom: 1px solid #e1e6ea;
}

.app-brand strong,
.app-brand span {
  display: block;
}

.app-brand strong {
  font-size: 1.15rem;
  font-weight: 900;
}

.app-brand span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-nav {
  display: grid;
  gap: 8px;
}

.app-nav a {
  display: block;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
}

.app-nav a:hover,
.app-nav a:focus-visible {
  border-color: var(--accent);
  background: #f4fbff;
  outline: none;
}

.app-nav a.is-active {
  border-color: #1682bd;
  background: var(--accent-dark);
  color: #ffffff;
}

.app-workspace {
  min-width: 0;
  max-width: 100%;
}

.app-shell,
.page-header,
.page-content,
.panel,
.panel-body,
.filters,
.toolbar,
.summary-grid,
.charts-layout,
.mode-grid {
  min-width: 0;
  max-width: 100%;
}

.home-main {
  width: min(calc(100% - 24px), 1040px);
  margin: 0 auto;
  padding: 28px 0;
}

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

.app-card {
  display: grid;
  min-height: 190px;
  align-content: space-between;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #ffffff;
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
}

.app-card:hover,
.app-card:focus-visible {
  border-color: var(--accent);
  background: #f4fbff;
  outline: none;
}

.app-card strong {
  display: block;
  font-size: 1.3rem;
  font-weight: 900;
}

.app-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

.counter-workspace {
  min-height: 100vh;
}

.counter-main {
  display: grid;
  height: 100vh;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

.counter-download-bar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  box-shadow: 0 1px 6px rgba(49, 54, 59, 0.12);
}

.counter-download-bar .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.counter-frame-panel {
  display: grid;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: #eff0f1;
  box-shadow: none;
  overflow: hidden;
}

.counter-frame-panel iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #eff0f1;
}

.field-hint {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.loading-inline {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: 6px;
  border: 2px solid #bdc3c7;
  border-top-color: var(--accent-dark);
  border-radius: 50%;
  vertical-align: -0.12em;
  animation: spin 850ms linear infinite;
}

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

@media (max-width: 860px) {
  .app-shell {
    display: block;
    min-height: 100vh;
  }

  .app-sidebar {
    position: static;
    display: grid;
    width: 100%;
    height: auto;
    grid-template-columns: minmax(96px, 0.7fr) minmax(0, 1.3fr);
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 6px rgba(49, 54, 59, 0.1);
  }

  .app-brand {
    min-width: 0;
    padding: 0;
    border-bottom: 0;
  }

  .app-brand strong {
    overflow: hidden;
    font-size: 0.82rem;
    line-height: 1.05;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-brand span {
    margin-top: 2px;
    font-size: 0.58rem;
    letter-spacing: 0.06em;
  }

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

  .app-nav a {
    min-height: 40px;
    padding: 8px 7px;
    font-size: 0.72rem;
    line-height: 1.1;
    text-align: center;
  }

  .app-workspace {
    width: 100%;
  }

  .home-main {
    width: min(calc(100% - 16px), 1040px);
    padding: 16px 0;
  }

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

  .counter-download-bar {
    justify-content: stretch;
  }

  .counter-download-bar .button {
    width: 100%;
  }

  .counter-main {
    height: calc(100vh - 61px);
  }
}


:root {
  color-scheme: light;
  --ink: #31363b;
  --muted: #6f7882;
  --surface: #ffffff;
  --canvas: #eff0f1;
  --accent: #3daee9;
  --accent-dark: #1d99f3;
  --border: #bdc3c7;
  --bike: #16a085;
  --pedestrian: #3daee9;
  --car: #607d8b;
  --edp: #8e44ad;
  --two-rm: #f67400;
  --danger: #da4453;
  --shadow: 0 2px 8px rgba(49, 54, 59, 0.18);
}

* { box-sizing: border-box; }
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
a { color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.page-header, .page-content {
  width: min(calc(100% - 24px), 1120px);
  margin-inline: auto;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 0 14px;
}
.header-start, .header-end {
  display: flex;
  align-items: center;
  gap: 12px;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 0;
  font-size: clamp(1.75rem, 5vw, 2.45rem);
  line-height: 1;
}
h2 {
  margin-bottom: 0;
  font-size: 1.2rem;
}
h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}
.eyebrow {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.live-datetime {
  min-width: 155px;
  color: var(--ink);
  text-align: right;
}
.live-time, .live-date {
  display: block;
  font-variant-numeric: tabular-nums;
}
.live-time {
  font-size: 1.15rem;
  font-weight: 800;
}
.live-date {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}
.total-pill {
  min-width: 104px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}
.total-pill span, .total-pill small { display: block; }
.total-pill span {
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1;
}
.total-pill small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}
.page-content {
  display: grid;
  gap: 14px;
  padding-bottom: 26px;
}
.panel {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 0;
}
.panel-body { padding: 18px; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.top-actions {
  position: relative;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}
.top-actions .button {
  min-width: 0;
}
.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
}
.field {
  display: grid;
  gap: 7px;
}
.field span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.field input, .field select {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
}
.range-info-field strong {
  display: flex;
  min-height: 42px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid #d7dadd;
  border-radius: 4px;
  background: #f8f9fa;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  font-weight: 850;
}
.source-field {
  position: relative;
}

.source-native-select {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.csv-combobox {
  position: relative;
}

.csv-select-button {
  display: grid;
  width: 100%;
  min-height: 42px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  text-align: left;
}

.csv-select-button span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-caret {
  width: 0;
  height: 0;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  border-top: 6px solid var(--ink);
}

.csv-dropdown {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  width: min(560px, calc(100vw - 48px));
  padding: 8px;
  border: 1px solid #aeb4b8;
  border-radius: 5px;
  background: #ffffff;
  box-shadow: 0 16px 50px rgba(16, 42, 67, 0.24);
}

.csv-search-input {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--ink);
  font-weight: 700;
}

.csv-option-list {
  display: grid;
  max-height: 340px;
  overflow: auto;
  margin-top: 8px;
  border: 1px solid #e1e6ea;
  border-radius: 4px;
  background: #f8f9fa;
}

.csv-option {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 54px;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  align-items: center;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid #e1e6ea;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.csv-option-main,
.csv-option-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.csv-option-main {
  font-size: 0.86rem;
  font-weight: 850;
}

.csv-option-meta {
  grid-column: 1;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0;
}

.csv-option-count {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-width: 42px;
  padding: 5px 7px;
  border: 1px solid #d7dadd;
  border-radius: 4px;
  background: #eff0f1;
  color: var(--ink);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  text-align: center;
}

.csv-option:last-child {
  border-bottom: 0;
}

.csv-option:hover,
.csv-option:focus-visible {
  background: #f4fbff;
  outline: none;
}

.csv-option.is-selected {
  background: #2167d6;
  color: #ffffff;
}

.csv-option.is-selected .csv-option-meta {
  color: rgba(255, 255, 255, 0.82);
}

.csv-option.is-selected .csv-option-count {
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.csv-dropdown .field-hint {
  display: block;
  margin-top: 8px;
}
.button {
  min-width: 0;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: linear-gradient(#ffffff, #eff0f1);
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}
.button.primary {
  border-color: #1682bd;
  background: var(--accent-dark);
  color: #ffffff;
}
.button:disabled {
  color: #8b9298;
  cursor: not-allowed;
  opacity: 0.7;
}
.button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}
.status.is-error { color: var(--danger); }
.timeline-panel {
  overflow: hidden;
}
.timeline-panel-header {
  align-items: flex-start;
}
.timeline-controls {
  display: grid;
  grid-template-columns: minmax(130px, 0.85fr) repeat(2, minmax(165px, 1fr)) auto auto auto;
  gap: 8px;
  align-items: end;
}
.timeline-control {
  display: grid;
  gap: 6px;
}
.timeline-control span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.timeline-control input {
  width: 100%;
  min-height: 38px;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}
.timeline-body {
  display: grid;
  gap: 10px;
}
.timeline-status-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, auto);
  gap: 10px;
  align-items: center;
}
.timeline-summary {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}
.timeline-selection {
  min-width: 0;
  overflow: hidden;
  padding: 6px 8px;
  border: 1px solid #d7dadd;
  border-radius: 4px;
  background: #ffffff;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.timeline-overview {
  position: relative;
  height: 34px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: linear-gradient(#ffffff, #f4f6f7);
}
.timeline-overview[hidden] {
  display: none;
}
.timeline-overview-item {
  position: absolute;
  top: 7px;
  height: 18px;
  min-width: 4px;
  padding: 0;
  border: 1px solid rgba(22, 130, 189, 0.52);
  border-radius: 3px;
  background: #2296dd;
  cursor: pointer;
}
.timeline-overview-item:hover,
.timeline-overview-item:focus-visible {
  border-color: #0a5d8b;
  outline: 2px solid rgba(34, 150, 221, 0.25);
  outline-offset: 1px;
}
.timeline-overview-item.is-selected {
  border-color: #31363b;
  background: #31363b;
}
.timeline-viewport {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #ffffff;
  cursor: grab;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  user-select: none;
}
.timeline-viewport.is-dragging {
  cursor: grabbing;
}
.timeline-track {
  position: relative;
  min-width: 100%;
  background: linear-gradient(#ffffff, #f8f9fa);
}
.timeline-grid {
  position: absolute;
  top: 0;
  bottom: 0;
  background-image: repeating-linear-gradient(
    to right,
    rgba(189, 195, 199, 0.28) 0,
    rgba(189, 195, 199, 0.28) 1px,
    transparent 1px,
    transparent var(--timeline-hour-width, 132px)
  );
}
.timeline-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(96, 125, 139, 0.22);
}
.timeline-tick span {
  position: absolute;
  top: 28px;
  left: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
}
.timeline-date-marker {
  position: absolute;
  top: 0;
  height: 54px;
  border-left: 1px solid rgba(49, 54, 59, 0.22);
  z-index: 2;
  pointer-events: none;
}
.timeline-date-marker span {
  position: absolute;
  top: 7px;
  left: 6px;
  padding: 2px 5px;
  border: 1px solid #d7dadd;
  border-radius: 3px;
  background: #ffffff;
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 950;
  white-space: nowrap;
}
.timeline-date-marker.boundary {
  bottom: 0;
  height: auto;
  border-left-color: rgba(49, 54, 59, 0.34);
}
.timeline-date-marker.boundary span {
  top: 7px;
}
.timeline-row-label {
  position: absolute;
  left: 0;
  width: 58px;
  height: 44px;
  padding: 15px 6px 0;
  border-top: 1px solid #edf0f2;
  background: rgba(248, 249, 250, 0.94);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.timeline-gap {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  width: 1px;
  background: repeating-linear-gradient(
    to bottom,
    rgba(96, 125, 139, 0.55) 0,
    rgba(96, 125, 139, 0.55) 4px,
    transparent 4px,
    transparent 8px
  );
}
.timeline-gap span {
  position: absolute;
  top: 8px;
  left: 50%;
  padding: 2px 5px;
  border: 1px solid #d7dadd;
  border-radius: 3px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  white-space: nowrap;
  transform: translateX(-50%);
}
.timeline-nav-button {
  padding-inline: 10px;
}
.timeline-bar {
  position: absolute;
  display: flex;
  height: 28px;
  min-width: 12px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  overflow: hidden;
  padding: 0 8px;
  border: 1px solid rgba(22, 130, 189, 0.58);
  border-radius: 4px;
  background: linear-gradient(90deg, #2296dd, #16a085);
  box-shadow: 0 2px 8px rgba(49, 54, 59, 0.18);
  color: #ffffff;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 900;
  text-align: left;
}
.timeline-bar span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.timeline-bar em {
  flex: 0 0 auto;
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 950;
  letter-spacing: 0.04em;
}
.timeline-bar strong {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}
.timeline-endpoint {
  position: absolute;
  z-index: 3;
  display: grid;
  width: 1px;
  height: 38px;
  padding: 0;
  border: 0;
  background: #31363b;
  color: var(--ink);
  cursor: pointer;
}
.timeline-endpoint span {
  position: absolute;
  top: -2px;
  left: 50%;
  padding: 2px 4px;
  border: 1px solid #c9d0d5;
  border-radius: 3px;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(49, 54, 59, 0.12);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  transform: translateX(-50%);
}
.timeline-endpoint.start {
  background: #16a085;
}
.timeline-endpoint.end {
  background: #f67400;
}
.timeline-endpoint.start span {
  border-color: rgba(22, 160, 133, 0.42);
}
.timeline-endpoint.end span {
  border-color: rgba(246, 116, 0, 0.42);
}
.timeline-endpoint:hover span,
.timeline-endpoint:focus-visible span,
.timeline-endpoint.is-selected span {
  background: #31363b;
  color: #ffffff;
}
.timeline-endpoint:focus-visible {
  outline: 2px solid rgba(34, 150, 221, 0.38);
  outline-offset: 2px;
}
.timeline-bar:hover,
.timeline-bar:focus-visible {
  border-color: #0a5d8b;
  outline: 2px solid rgba(34, 150, 221, 0.32);
  outline-offset: 1px;
}
.timeline-bar.is-selected {
  border-color: #31363b;
  background: linear-gradient(90deg, #31363b, #607d8b);
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-width: 0;
  gap: 10px;
}
.metric {
  min-width: 0;
  min-height: 108px;
  overflow: hidden;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #ffffff;
}
.metric span {
  display: block;
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.metric strong {
  display: block;
  min-width: 0;
  margin-top: 10px;
  font-size: clamp(1.65rem, 3.2vw, 2.2rem);
  font-weight: 900;
  line-height: 1;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
}
.metric small {
  display: -webkit-box;
  min-width: 0;
  max-width: 100%;
  margin-top: 8px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--muted);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.mode-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.mode-tile {
  position: relative;
  min-height: 132px;
  overflow: hidden;
  padding: 15px;
  border: 1px solid rgba(49, 54, 59, 0.22);
  border-radius: 5px;
  box-shadow: var(--shadow);
  color: #ffffff;
}
.mode-tile::after {
  position: absolute;
  right: -34px;
  bottom: -70px;
  width: 130px;
  height: 130px;
  border: 22px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  content: "";
}
.mode-tile .label {
  position: relative;
  z-index: 1;
  display: block;
  font-weight: 900;
}
.mode-tile .count {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 24px;
  font-size: clamp(2.1rem, 5vw, 3rem);
  font-weight: 900;
  line-height: 0.9;
}
.mode-tile .share {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 10px;
  font-size: 0.8rem;
  font-weight: 800;
  opacity: 0.92;
}
.bike { background: var(--bike); }
.pedestrian { background: var(--pedestrian); }
.car { background: var(--car); }
.edp { background: var(--edp); }
.two-rm { background: var(--two-rm); }
.charts-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.8fr);
  gap: 14px;
}
.chart-canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 330px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #ffffff;
}
.pie-layout {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(160px, 1fr);
  align-items: center;
  gap: 18px;
}
.pie-chart {
  width: min(100%, 210px);
  aspect-ratio: 1;
  justify-self: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #d7dadd;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55), var(--shadow);
}
.pie-legend {
  display: grid;
  min-width: 0;
  max-width: 100%;
  gap: 8px;
}
.pie-legend-row {
  display: grid;
  min-width: 0;
  max-width: 100%;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px 10px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #ffffff;
}

.pie-legend-text {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.pie-legend-label {
  overflow: hidden;
  color: var(--ink);
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pie-legend-count {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.pie-legend-percent {
  grid-column: 2;
  min-width: 76px;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  font-weight: 900;
  text-align: left;
}
.swatch {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 3px;
}
.swatch.bike { background: var(--bike); }
.swatch.pedestrian { background: var(--pedestrian); }
.swatch.car { background: var(--car); }
.swatch.edp { background: var(--edp); }
.swatch.two-rm { background: var(--two-rm); }
.table-panel-header {
  align-items: center;
}

.pagination-controls {
  display: grid;
  grid-template-columns: 42px auto minmax(110px, 140px) 42px;
  align-items: center;
  gap: 8px;
}

.page-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-content: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: linear-gradient(#ffffff, #eff0f1);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
}

.page-button:disabled {
  color: #8b9298;
  cursor: not-allowed;
  opacity: 0.65;
}

.page-indicator {
  min-width: 54px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  text-align: center;
}

.page-select {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
}
table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
  background: #ffffff;
}
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid #e1e6ea;
  text-align: left;
  vertical-align: top;
}
th {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
td {
  font-size: 0.9rem;
  font-weight: 650;
}
tr:last-child td { border-bottom: 0; }
.empty {
  margin: 0;
  padding: 20px;
  color: var(--muted);
  font-weight: 700;
}
@media (max-width: 1400px) and (min-width: 861px) {
  .app-shell {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .app-sidebar {
    padding: 20px 12px;
  }

  .app-brand strong {
    font-size: 1rem;
  }

  .app-brand span {
    font-size: 0.68rem;
  }

  .app-nav a {
    padding: 10px 9px;
    font-size: 0.88rem;
    line-height: 1.18;
  }

  .page-header,
  .page-content {
    width: min(calc(100% - 20px), 1120px);
  }

  .filters {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

  .toolbar .button {
    padding-inline: 12px;
  }

  .timeline-panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .timeline-controls {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

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

  .metric {
    min-height: 116px;
    padding: 12px;
  }

  .metric strong {
    font-size: clamp(1.45rem, 2.6vw, 2rem);
  }

  .metric small {
    font-size: 0.82rem;
  }

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

  .mode-tile {
    min-height: 118px;
  }

  .mode-tile .count {
    margin-top: 18px;
    font-size: clamp(2.1rem, 4.2vw, 2.8rem);
  }

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

  .pie-layout {
    grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
    align-items: center;
  }

  .pie-chart {
    width: min(100%, 240px);
  }

  .pie-legend {
    min-width: 0;
    max-width: 100%;
  }

  .pie-legend-row {
    grid-template-columns: auto minmax(0, 1fr) minmax(64px, auto);
    align-items: center;
    min-width: 0;
  }

  .pie-legend-percent {
    grid-column: auto;
    min-width: 64px;
    text-align: right;
  }
}

@media (max-width: 1080px) and (min-width: 861px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters {
    grid-template-columns: minmax(260px, 1fr) minmax(150px, 0.7fr);
  }

  .toolbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .toolbar .button {
    padding-inline: 10px;
  }

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

  .pie-legend-row {
    grid-template-columns: auto minmax(0, 1fr) minmax(70px, auto);
  }
}

@media (max-width: 900px) {
  .filters,
  .charts-layout {
    grid-template-columns: 1fr;
  }

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

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

  .mode-tile:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .page-header,
  .page-content {
    width: 100%;
  }

  .page-header {
    align-items: stretch;
    gap: 10px;
    padding: 12px 8px 10px;
  }

  .header-start,
  .header-end {
    width: 100%;
    justify-content: space-between;
  }

  .page-header h1 {
    font-size: 1.45rem;
    line-height: 1.05;
  }

  .page-header .eyebrow {
    margin-bottom: 3px;
    font-size: 0.62rem;
  }

  .live-datetime {
    min-width: 0;
    text-align: left;
  }

  .live-time {
    font-size: 0.88rem;
  }

  .live-date {
    max-width: 170px;
    overflow: hidden;
    font-size: 0.58rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .total-pill {
    min-width: 68px;
    padding: 8px 10px;
  }

  .total-pill span {
    font-size: 1.28rem;
  }

  .total-pill small {
    font-size: 0.58rem;
  }

  .page-content {
    gap: 8px;
    padding-bottom: 14px;
  }

  .panel {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    box-shadow: 0 1px 4px rgba(49, 54, 59, 0.1);
  }

  .panel-header {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding: 12px 8px 0;
  }

  .panel-header h2 {
    font-size: 1rem;
  }

  .panel-body {
    padding: 10px 8px 12px;
  }

  .toolbar,
  .top-actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .toolbar .button,
  .top-actions .button {
    min-width: 0;
    min-height: 38px;
    overflow: hidden;
    padding: 8px 6px;
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .filters {
    gap: 9px;
  }

  .field {
    gap: 5px;
  }

  .field span {
    font-size: 0.62rem;
  }

  .field input,
  .field select,
  .csv-select-button,
  .range-info-field strong {
    min-height: 38px;
    padding: 8px;
    font-size: 0.8rem;
  }

  .csv-dropdown {
    right: 0;
    left: 0;
    width: auto;
    max-width: calc(100vw - 16px);
  }

  .timeline-controls {
    grid-template-columns: 1fr;
  }

  .timeline-status-row {
    grid-template-columns: 1fr;
  }

  .timeline-control input,
  .timeline-controls .button {
    min-height: 38px;
    font-size: 0.82rem;
  }

  .timeline-body {
    padding: 10px 8px 12px;
  }

  .timeline-viewport {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .status {
    padding: 0 8px;
    font-size: 0.78rem;
  }

  .summary-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .metric {
    min-height: 82px;
    padding: 12px 14px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .metric strong {
    margin-top: 7px;
    font-size: 1.55rem;
  }

  .metric small {
    margin-top: 6px;
    font-size: 0.76rem;
  }

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

  .mode-grid {
    gap: 6px;
  }

  .mode-tile,
  .mode-tile:last-child {
    min-height: 94px;
    grid-column: auto;
    border-radius: 0;
  }

  .mode-tile .count {
    margin-top: 14px;
    font-size: 2rem;
  }

  .chart-canvas {
    min-height: 260px;
  }

  .pie-chart {
    width: min(100%, 230px);
  }

  .pagination-controls {
    width: 100%;
    grid-template-columns: 38px minmax(45px, auto) minmax(0, 1fr) 38px;
  }

  .page-button,
  .page-select {
    min-height: 38px;
  }

  .table-wrap {
    overflow-x: hidden;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  table {
    display: block;
    width: 100%;
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 8px;
    padding: 8px;
    background: #eff0f1;
  }

  tr {
    display: grid;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #ffffff;
  }

  td {
    display: grid;
    min-width: 0;
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid #e1e6ea;
    overflow-wrap: anywhere;
    font-size: 0.78rem;
  }

  td::before {
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  td:nth-child(1)::before { content: "Date"; }
  td:nth-child(2)::before { content: "Mode"; }
  td:nth-child(3)::before { content: "CSV"; }
}

@media (max-width: 390px) {
  .page-header,
  .page-content {
    width: 100%;
  }

  .app-sidebar {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .app-nav a {
    font-size: 0.66rem;
  }

  .toolbar .button {
    font-size: 0.72rem;
  }
}
