/* ── Page header ── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text);
  line-height: 1.2;
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 3px;
}
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.action-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 6px 12px;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  background: none;
  cursor: pointer;
  font-family: inherit;
}
.action-link:hover { color: var(--text); border-color: var(--border-strong); text-decoration: none; }
.action-link-warn {
  background: none;
  font: inherit;
  cursor: pointer;
  color: var(--med-text);
  border-color: var(--med-text);
}
.action-link-warn:hover { color: var(--med-text); background: var(--med-bg); border-color: var(--med-text); }

/* ── Notice banner ── */
.notice-banner {
  background: var(--med-bg);
  border: 1px solid var(--med-text);
  color: var(--med-text);
  border-radius: 3px;
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: 13px;
}

/* ── Live camera ── */
.cam-section { margin-bottom: 28px; }
.cam-header {
  display: flex; align-items: center; gap: 7px;
  width: 100%;
  margin-bottom: 10px;
  background: none; border: none; padding: 0;
  font: inherit; color: inherit; text-align: left;
  cursor: pointer;
}
.cam-live-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: #e02020; animation: cam-pulse 1.6s ease-in-out infinite;
}
@keyframes cam-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.cam-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text);
}
.cam-toggle-chevron {
  flex-shrink: 0;
  color: var(--accent);
  transition: transform 0.2s;
}
.cam-section--collapsed .cam-toggle-chevron { transform: rotate(-90deg); }
.cam-section--collapsed .cam-header { margin-bottom: 0; }
.cam-section--collapsed .cam-wrap { display: none; }
.cam-wrap {
  position: relative;
  max-width: 560px;
  aspect-ratio: 16 / 9;
  background: #111;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.cam-wrap #live-cam,
.cam-wrap .cam-media {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; border: none; display: block;
}
.cam-offline {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #555; font-size: 13px;
}
.cam-play-btn {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.cam-play-btn::before {
  content: '';
  width: 60px; height: 60px; border-radius: 50%;
  background: rgba(0,0,0,0.55);
  position: absolute;
}
.cam-play-btn svg { position: relative; z-index: 1; margin-left: 4px; }

/* ── Crossing location (mini map) ── */
.minimap-section { margin-bottom: 28px; }
.minimap-header {
  display: flex; align-items: center; gap: 7px;
  width: 100%;
  margin-bottom: 10px;
  background: none; border: none; padding: 0;
  font: inherit; color: inherit; text-align: left;
  cursor: pointer;
}
.minimap-header svg:first-child { color: var(--text-2); flex-shrink: 0; }
.minimap-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text);
}
.minimap-toggle-chevron {
  flex-shrink: 0;
  color: var(--accent);
  transition: transform 0.2s;
}
.minimap-section--collapsed .minimap-toggle-chevron { transform: rotate(-90deg); }
.minimap-section--collapsed .minimap-header { margin-bottom: 0; }
.minimap-section--collapsed .minimap-wrap { display: none; }

/* ── Collapsed-section affordance ──
   Shared "Show" hint + hover cue that makes the collapsed camera/location
   headers read as tappable (they otherwise look like inert text labels).
   The hint only appears while collapsed; the chevron already signals the
   expanded state. Kept accent-colored but small, so it stays secondary to
   the wait-time data below. */
.section-toggle-hint {
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--accent);
  display: none;
}
.cam-section--collapsed .section-toggle-hint,
.minimap-section--collapsed .section-toggle-hint { display: inline; }

.cam-header:hover .cam-title,
.cam-header:hover .cam-toggle-chevron,
.minimap-header:hover .minimap-title,
.minimap-header:hover .minimap-toggle-chevron { color: var(--accent-hover); }
.cam-header:hover .section-toggle-hint,
.minimap-header:hover .section-toggle-hint {
  color: var(--accent-hover); text-decoration: underline;
}
.minimap-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.dashboard-map {
  width: 100%;
  height: 260px;
  border-radius: 6px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.minimap-full-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}
.minimap-full-link:hover { text-decoration: underline; }

/* ── Stat cards ── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-3);
  margin-bottom: 6px;
}
.card-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.card-sub {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 4px;
}
.card-accent { border-top: 3px solid var(--accent); }
.no-data { color: var(--text-3); font-style: italic; }

/* ── Section ── */
.section { margin-bottom: 32px; }
.section h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
}

.toggle-label { font-size: 12px; color: var(--text-3); }

/* ── Legend ── */
.legend {
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-2);
}
.legend-dot { width: 12px; height: 12px; border-radius: 2px; }
.ld-low   { background: var(--low-bg); }
.ld-med   { background: var(--med-bg); }
.ld-high  { background: var(--high-bg); }
.ld-empty { background: var(--surface-2); border: 1px solid var(--border); }

/* ── Heatmap ── */
.table-scroll {
  overflow-x: auto;
  border-radius: 3px;
  border: 1px solid var(--border);
}
table.heatmap {
  border-collapse: separate;
  border-spacing: 2px;
  background: var(--surface-2);
  padding: 6px;
  white-space: nowrap;
}
table.heatmap th.corner { width: 44px; }
table.heatmap th.hour-head {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-align: center;
  padding: 2px 0 4px;
  min-width: 36px;
}
table.heatmap th.day-head {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  text-align: right;
  padding-right: 8px;
  white-space: nowrap;
}
.hm-cell {
  width: 36px;
  height: 32px;
  border-radius: 3px;
  text-align: center;
  vertical-align: middle;
  cursor: default;
}
.hm-cell .cv { font-size: 10px; font-weight: 700; display: block; line-height: 1; }
.hm-cell .cs { font-size: 9px; font-weight: 500; display: block; opacity: 0.75; margin-top: 1px; }
.c-low   { background: var(--low-bg);   color: var(--low-text); }
.c-med   { background: var(--med-bg);   color: var(--med-text); }
.c-high  { background: var(--high-bg);  color: var(--high-text); }
.c-empty { background: var(--surface-2); color: var(--text-3); border: 1px solid var(--border); }

/* Cells / days outside the active day + time-of-day filter: kept in the grid for
   context but dimmed so the current selection stands out. */
.hm-dim { opacity: 0.28; }
.day-card-dim { opacity: 0.4; }


/* ── Best hours ── */
.ranked-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.rank-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.rank-num  { font-size: 10px; font-weight: 700; color: var(--text-3); text-transform: uppercase; }
.rank-hour { font-size: 15px; font-weight: 700; color: var(--text); }
.rank-stats { font-size: 11px; color: var(--text-2); }
.rank-count { color: var(--text-3); }
.rank-pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  align-self: flex-start;
}
.rp-low  { background: var(--low-bg);  color: var(--low-text); }
.rp-med  { background: var(--med-bg);  color: var(--med-text); }
.rp-high { background: var(--high-bg); color: var(--high-text); }

/* ── Weekday cards ── */
.day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.day-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.day-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
.day-window {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 8px;
}
.day-window strong {
  display: block;
  font-size: 14px;
  color: var(--text);
  font-weight: 700;
}
.top-hours { display: flex; flex-direction: column; gap: 4px; }
.top-hour-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}
.th-time { font-weight: 600; color: var(--text); }
.th-vals { color: var(--text-2); }

/* ── Data note ── */
.data-note {
  margin-top: 32px;
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
}
.data-note a { color: var(--accent); }

/* ── How to use ── */
.help-section {
  border-top: 1px solid var(--border);
  padding-top: 28px;
  margin-top: 8px;
}
.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.help-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.help-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 1px;
  color: var(--text-3);
}
.help-icon svg { flex-shrink: 0; }
.help-item strong {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.help-item p {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.55;
  margin: 0;
}

/* ── Inline tooltip ── */
.tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  padding: 0 0 0 5px;
  cursor: default;
  color: var(--text-3);
  vertical-align: middle;
  line-height: 1;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
}
.tip:hover { color: var(--text-2); }
.tip svg { display: block; flex-shrink: 0; }
.tip-box {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.13);
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-2);
  white-space: normal;
  width: 220px;
  z-index: 200;
  text-align: left;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.55;
  pointer-events: none;
}
.tip:hover .tip-box,
.tip:focus .tip-box,
.tip.tip-open .tip-box { display: block; }
.tip.tip-flip .tip-box { left: auto; right: 0; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; gap: 8px; }
  .tip-box { width: 180px; }
}

/* ── Shared form components (needed here since home.css is not loaded on dashboard) ── */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 11px 16px 9px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.card-name {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.submit-tagline {
  font-size: 13px;
  color: var(--text-2);
  padding: 12px 16px 0;
  line-height: 1.6;
}
.submit-select {
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  cursor: pointer;
  flex: 1;
  min-width: 140px;
}
.submit-select:focus { border-color: var(--accent); }
.submit-select:disabled { opacity: 0.45; cursor: not-allowed; }
.submit-btn {
  height: 34px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s;
}
.submit-btn:hover { background: var(--accent-hover); }
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.submit-feedback {
  margin-top: 10px;
  font-size: 12px;
  min-height: 16px;
}
.submit-feedback-ok    { color: var(--low-text); }
.submit-feedback-error { color: var(--high-text); }
.share-crossing-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.share-crossing-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Breadcrumb ── */
.breadcrumb {
  margin-bottom: 14px;
}
.breadcrumb-home {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.15s;
}
.breadcrumb-home:hover { color: var(--text); text-decoration: none; }

/* ── Smart recommendation banner ── */
.smart-banner {
  display: none;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 3px;
  border: 1px solid var(--border);
  margin-bottom: 24px;
}
.smart-banner-good     { background: var(--low-bg);  border-color: #a8d5b5; }
.smart-banner-moderate { background: var(--med-bg);  border-color: #e8cf7a; }
.smart-banner-busy     { background: var(--high-bg); border-color: #e5a5aa; }
.smart-banner-no-data  { background: var(--surface);  border-color: var(--border); }

.smart-banner-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
}
.smart-banner-good .smart-banner-icon     { background: var(--low-text);  color: #fff; }
.smart-banner-moderate .smart-banner-icon { background: var(--med-text);  color: #fff; }
.smart-banner-busy .smart-banner-icon     { background: var(--high-text); color: #fff; }
.smart-banner-no-data .smart-banner-icon  { background: var(--text-3);    color: #fff; }

.smart-banner-body { flex: 1; }
.smart-banner-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.smart-banner-detail {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 3px;
  line-height: 1.4;
}

/* ── Dashboard report form ── */
.dashboard-report {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 28px;
}
.dashboard-report .submit-tagline { padding: 10px 16px 0; }
.dashboard-submit-form {
  padding: 12px 16px 14px;
  position: relative;
}
.dashboard-submit-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.dashboard-crossing-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Today's data section ── */
.today-hours-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px;
}
.today-hour-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 3px;
  min-width: 60px;
  flex-shrink: 0;
}
.today-h {
  display: block;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.today-m {
  display: block;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}
.today-current {
  outline: 2px solid var(--text);
  outline-offset: -1px;
}
.today-no-data {
  font-size: 13px;
  color: var(--text-3);
  font-style: italic;
}

/* ── Heatmap current time highlighting ── */
table.heatmap th.hour-head.current-hour {
  color: var(--accent);
  font-weight: 800;
}
table.heatmap th.day-head.current-day {
  color: var(--accent);
  font-weight: 800;
}
.hm-cell.hm-current {
  outline: 2px solid var(--text);
  outline-offset: -2px;
  position: relative;
}

/* ── Wait time quick-tap buttons (dashboard) ── */
.wait-btns {
  margin-top: 10px;
}
.wait-btns-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-3);
  margin-bottom: 6px;
}
.wait-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.wait-input {
  height: 34px;
  width: 120px;
  flex: 0 0 auto;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  outline: none;
}
.wait-input:focus { border-color: var(--accent); }
.wait-input-or { font-size: 12px; color: var(--text-3); }
.wait-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.wait-row:last-child { margin-bottom: 0; }
.wait-btn {
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
  font-family: inherit;
}
.wait-btn:hover { border-color: var(--border-strong); color: var(--text); }
.wait-btn.wait-btn-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.wait-btn.wait-btn-active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.submit-footer { margin-top: 10px; }

/* ── Heatmap tap tooltip ── */
.hm-tooltip {
  display: none;
  position: fixed;
  z-index: 200;
  background: #1a1a1a;
  color: #fff;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 12px;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  max-width: 200px;
  line-height: 1.5;
}
.hm-tt-title {
  font-weight: 700;
  margin-bottom: 2px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  opacity: 0.7;
}
.hm-cell { cursor: pointer; }

/* ── Dashboard mobile ── */
@media (max-width: 600px) {
  .dashboard-submit-fields { flex-direction: column; align-items: stretch; }
  .dashboard-crossing-label { font-size: 14px; }
  .dashboard-submit-form .submit-select { height: 44px; font-size: 15px; }
  .dashboard-submit-form .submit-btn { height: 44px; font-size: 15px; }
  /* 16px stops iOS Safari auto-zooming (and horizontally panning the page) on focus */
  .wait-input { height: 44px; font-size: 16px; flex: 1; width: auto; }
  .action-link { font-size: 14px; padding: 8px 14px; }
  .breadcrumb-home { font-size: 14px; }
  /* Wait buttons: fill row evenly, no orphaned buttons */
  .wait-row { flex-wrap: nowrap; }
  .wait-btn { flex: 1; min-width: 0; height: 40px; font-size: 13px; padding: 0 4px; }

  /* Scroll offset for sticky navbar */
  #dashboard-report { scroll-margin-top: 64px; }
}

/* ── Filter panel ── */
/* The panel is collapsed by default on every viewport (JS toggles
   .filter-panel--collapsed); this header is the always-visible, clearly-labelled
   control that opens it. */
.filter-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--text-2);
  text-align: left;
  transition: color 0.12s;
}
.filter-toggle:hover { color: var(--accent); }
.filter-toggle-icon { flex-shrink: 0; color: var(--accent); }
.filter-toggle-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.filter-toggle-summary {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  margin-left: auto;
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.filter-toggle-chevron { flex-shrink: 0; transition: transform 0.2s; }
.filter-panel--collapsed .filter-toggle-chevron { transform: rotate(-90deg); }
.filter-panel--collapsed .filter-row,
.filter-panel--collapsed .filter-row-secondary,
.filter-panel--collapsed .filter-custom-row,
.filter-panel--collapsed .filter-active-bar { display: none; }

.filter-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 14px 16px 10px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.filter-row-secondary {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 2px;
}
.filter-sublabel {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
  flex-shrink: 0;
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.filter-chip {
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
  font-family: inherit;
}
.filter-chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}
.filter-chip-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.filter-chip-active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}
.filter-chip-sm {
  height: 24px;
  font-size: 11px;
  padding: 0 8px;
}
.filter-custom-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
}
.filter-date-input {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 12px;
  color: var(--text);
  background: var(--surface);
  font-family: inherit;
  outline: none;
}
.filter-date-input:focus { border-color: var(--accent); }
.filter-apply-btn {
  height: 28px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: background 0.12s;
}
.filter-apply-btn:hover { background: var(--accent-hover); }
.filter-apply-group {
  margin-left: auto;
}
.filter-active-bar {
  font-size: 11px;
  color: var(--text-3);
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.filter-active-bar strong {
  color: var(--text-2);
  font-weight: 600;
}
@media (max-width: 600px) {
  /* Filter panel: stack label above chips on mobile */
  .filter-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .filter-row-secondary { flex-direction: column; align-items: flex-start; gap: 8px; }
  .filter-group { flex-direction: column; align-items: flex-start; gap: 4px; }

  /* Custom date range: stack inputs full-width */
  .filter-custom-row { flex-direction: column; align-items: stretch; gap: 6px; }
  .filter-date-input { width: 100%; height: 36px; font-size: 13px; }
  .filter-custom-row .filter-apply-btn { width: 100%; height: 36px; font-size: 13px; }

  /* Make chips slightly larger for touch */
  .filter-chip { height: 30px; font-size: 12px; padding: 0 12px; }
  .filter-chip-sm { height: 28px; font-size: 12px; padding: 0 10px; }

  /* Apply button full-width */
  .filter-apply-group { margin-left: 0; width: 100%; }
  .filter-apply-group .filter-apply-btn { width: 100%; height: 36px; font-size: 13px; }

  /* Filter toggle styling is shared across viewports (see the global rules);
     on mobile the summary can get long, so let it shrink before the chevron. */
  .filter-toggle-summary { font-size: 11px; }

  /* Limit best hours to 6 on mobile */
  .rank-card-hidden-mobile { display: none; }

  /* Camera: full width on mobile */
  .cam-wrap { max-width: 100%; }

  /* Mini map: shorter on mobile */
  .dashboard-map { height: 220px; }
}
