:root {
  color-scheme: light;
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-soft: #f6f8fa;
  --text: #1d2835;
  --muted: #657486;
  --line: #d9e1e8;
  --navy: #17324d;
  --teal: #0f8b8d;
  --green: #38a169;
  --amber: #d97706;
  --red: #dc3545;
  --blue: #2f6fed;
  --shadow: 0 18px 40px rgba(20, 34, 50, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 24px 18px;
  background: #102235;
  color: #e8edf2;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
}

.brand-logo {
  display: block;
  width: 54px;
  height: auto;
  flex: 0 0 auto;
}

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

.brand strong {
  color: #ffffff;
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: 0;
}

.brand span {
  color: #adbac7;
  font-size: 12px;
  margin-top: 6px;
}

.sidebar-status span {
  color: #adbac7;
  font-size: 12px;
  margin-top: 3px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #cbd5df;
  text-align: left;
}

.nav-item svg,
.icon-button svg,
.primary-button svg,
.search svg,
.metric-top svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.nav-item.active,
.nav-item:hover {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #38a169;
  box-shadow: 0 0 0 6px rgba(56, 161, 105, 0.18);
}

.main {
  min-width: 0;
  max-width: 100%;
  padding: 24px;
}

.topbar,
.filter-band,
.panel-header,
.metric-top,
.top-actions,
.vehicle-panel,
.table-tools {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  font-size: 17px;
  line-height: 1.3;
}

.panel-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(330px, 38vw);
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.icon-button,
.primary-button,
.tool-button,
.segment {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.icon-button {
  display: inline-grid;
  width: 40px;
  place-items: center;
}

.icon-button.spinning svg {
  animation: spin 0.45s linear;
}

.icon-button.active {
  border-color: rgba(15, 139, 141, 0.3);
  background: rgba(15, 139, 141, 0.1);
  color: #0b6d6f;
}

.icon-button.subtle {
  width: 34px;
  min-height: 34px;
  background: var(--surface-soft);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
}

.filter-band {
  gap: 14px;
  flex-wrap: wrap;
  min-height: 64px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(76px, auto));
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  background: #eef3f7;
}

.segment {
  padding: 0 12px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.segment.active {
  background: var(--surface);
  color: var(--navy);
  box-shadow: 0 3px 10px rgba(20, 34, 50, 0.08);
}

.select-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.select-label span {
  flex: 0 0 auto;
  white-space: nowrap;
}

.select-label select {
  flex: 1 1 auto;
  min-width: 112px;
  min-height: 38px;
  padding: 0 32px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #ffffff;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: var(--text);
  font-size: 14px;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.panel,
.table-band {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 132px;
  padding: 18px;
}

.metric-top {
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.metric-top svg {
  color: var(--teal);
}

.metric-card strong {
  display: block;
  margin-top: 16px;
  font-size: 30px;
  line-height: 1;
}

.metric-card small {
  display: inline-flex;
  margin-top: 12px;
  color: var(--green);
  font-weight: 700;
}

.metric-card.warning .metric-top svg,
.metric-card.warning small {
  color: var(--amber);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.9fr);
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.route-panel {
  display: flex;
  flex-direction: column;
  grid-row: span 2;
}

.panel-header {
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  margin-bottom: 14px;
}

.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.dot.normal {
  background: var(--teal);
}

.dot.busy {
  background: var(--amber);
}

.dot.risk {
  background: var(--red);
}

.map-frame {
  flex: 1;
  min-height: 492px;
  border: 1px solid #dce5ec;
  border-radius: 8px;
  background:
    linear-gradient(rgba(23, 50, 77, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 50, 77, 0.06) 1px, transparent 1px),
    #f7fafc;
  background-size: 34px 34px;
  overflow: hidden;
}

.map-frame svg,
.chart-box svg,
.vehicle-panel svg {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-box {
  height: 320px;
}

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

.trend-detail-panel {
  display: none;
  margin-top: 12px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.trend-detail-panel.active {
  display: block;
}

.trend-detail-panel table {
  min-width: 420px;
}

.vehicle-panel {
  min-height: 280px;
  gap: 18px;
}

.vehicle-panel svg {
  width: 190px;
  height: 190px;
  flex: 0 0 190px;
}

.vehicle-list {
  display: grid;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.vehicle-row {
  display: grid;
  grid-template-columns: 10px minmax(72px, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  color: var(--muted);
  font-size: 13px;
}

.vehicle-row strong {
  color: var(--text);
  font-size: 15px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.normal {
  background: rgba(15, 139, 141, 0.12);
  color: #0b6d6f;
}

.status-pill.busy {
  background: rgba(217, 119, 6, 0.14);
  color: #9a4f00;
}

.status-pill.risk {
  background: rgba(220, 53, 69, 0.12);
  color: #a81f2c;
}

.table-band {
  padding: 18px;
}

.table-heading {
  margin-bottom: 12px;
}

.table-tools {
  gap: 8px;
}

.tool-button {
  min-width: 64px;
  padding: 0 12px;
  background: var(--surface-soft);
}

.tool-button.active {
  border-color: var(--teal);
  background: rgba(15, 139, 141, 0.1);
  color: #0b6d6f;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  height: 50px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 700;
}

td {
  font-size: 14px;
}

tr:last-child td {
  border-bottom: 0;
}

tr.row-selected td {
  background: rgba(15, 139, 141, 0.07);
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.empty-panel {
  min-height: 68px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.progress {
  width: 132px;
  height: 8px;
  border-radius: 999px;
  background: #e7edf2;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.progress.high span {
  background: var(--amber);
}

.progress.risk span {
  background: var(--red);
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

.site-footer {
  padding: 14px 0 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--navy);
  text-decoration: underline;
}

.module-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 18px;
  margin-bottom: 18px;
}

.module-wide {
  min-height: 356px;
}

.timeline-board,
.warehouse-heatmap,
.fleet-board,
.funnel-board,
.exception-list,
.queue-list,
.stack-list {
  display: grid;
  gap: 12px;
}

.timeline-board {
  min-height: 282px;
  padding-top: 4px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) 78px;
  align-items: center;
  gap: 14px;
  min-height: 48px;
}

.timeline-route,
.timeline-time,
.queue-card small,
.stack-meta,
.fleet-card span,
.exception-card small,
.funnel-row span {
  color: var(--muted);
  font-size: 12px;
}

.timeline-route strong,
.queue-card strong,
.fleet-card strong,
.exception-card strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.timeline-track,
.stack-track,
.funnel-track {
  position: relative;
  min-height: 12px;
  border-radius: 999px;
  background: #e7edf2;
  overflow: hidden;
}

.timeline-bar,
.stack-bar,
.funnel-bar {
  display: block;
  height: 100%;
  min-width: 8px;
  border-radius: inherit;
}

.timeline-bar,
.stack-bar {
  min-height: 12px;
}

.tone-normal {
  background: var(--teal);
}

.tone-busy {
  background: var(--amber);
}

.tone-risk {
  background: var(--red);
}

.tone-blue {
  background: var(--blue);
}

.stack-row {
  display: grid;
  gap: 7px;
}

.stack-top,
.queue-header,
.fleet-card header,
.exception-card header,
.funnel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stack-top strong,
.funnel-row strong {
  font-size: 14px;
}

.queue-card,
.fleet-card,
.exception-card,
.heat-cell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.queue-card,
.exception-card {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.queue-card footer,
.exception-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

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

.heat-cell {
  min-height: 122px;
  padding: 14px;
}

.heat-cell strong {
  display: block;
  font-size: 16px;
}

.heat-cell span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.heat-meter {
  height: 9px;
  margin-top: 18px;
  border-radius: 999px;
  background: #dfe7ee;
  overflow: hidden;
}

.heat-meter b {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.heat-cell.risk {
  border-color: rgba(220, 53, 69, 0.28);
  background: rgba(220, 53, 69, 0.06);
}

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

.fleet-card {
  display: grid;
  gap: 12px;
  min-height: 136px;
  padding: 14px;
}

.fleet-card .progress {
  width: 100%;
}

.fleet-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.fleet-meta b {
  display: block;
  margin-top: 3px;
  font-size: 13px;
}

.funnel-board {
  padding: 10px 0;
}

.funnel-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 72px;
}

.funnel-track {
  min-height: 26px;
}

.funnel-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

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

.moving-vehicle {
  filter: drop-shadow(0 6px 8px rgba(20, 34, 50, 0.28));
  pointer-events: none;
}

.return-console {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  padding: 0;
  overflow: hidden;
}

.return-menu {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: #f7f9fb;
}

.return-menu > strong {
  display: block;
  margin: 0 6px 6px;
  color: var(--muted);
  font-size: 12px;
}

.return-menu-item,
.return-tab,
.action-strip button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
}

.return-menu-item {
  justify-content: flex-start;
  padding: 0 10px;
}

.return-menu-item svg,
.action-strip svg,
.return-actions svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.return-menu-item.active,
.return-menu-item:hover {
  border-color: rgba(15, 139, 141, 0.2);
  background: rgba(15, 139, 141, 0.1);
  color: #0b6d6f;
}

.return-workbench {
  min-width: 0;
  padding: 16px;
}

.return-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.return-tab {
  min-width: 92px;
  justify-content: center;
  border-radius: 8px 8px 0 0;
  color: var(--muted);
}

.return-tab.active {
  border-color: var(--line);
  border-bottom-color: var(--surface);
  background: var(--surface);
  color: var(--navy);
  font-weight: 700;
}

.return-pane {
  display: none;
}

.return-pane.active {
  display: block;
}

.return-page-heading {
  margin-bottom: 14px;
}

.return-page-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.return-welcome-grid,
.return-two-column,
.return-form-grid {
  display: grid;
  gap: 12px;
}

.return-welcome-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 12px;
}

.return-mini-card,
.return-list-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.return-mini-card {
  min-height: 118px;
  padding: 16px;
}

.return-mini-card span,
.return-mini-card small {
  color: var(--muted);
}

.return-mini-card strong {
  display: block;
  margin: 12px 0 8px;
  font-size: 28px;
  line-height: 1;
}

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

.return-list-panel {
  padding: 14px;
}

.return-list-panel h2 {
  margin-bottom: 10px;
}

.return-feed-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.return-feed-row b {
  color: var(--text);
}

.return-feed-row em {
  color: var(--teal);
  font-style: normal;
  font-weight: 700;
}

.return-stat-bars {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.return-stat-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 56px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.return-stat-row div {
  height: 12px;
  border-radius: 999px;
  background: #e7edf2;
  overflow: hidden;
}

.return-stat-row b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.return-stat-row b.risk {
  background: var(--red);
}

.return-stat-row strong {
  color: var(--text);
  text-align: right;
}

.return-form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
  margin-bottom: 14px;
}

.return-filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) repeat(4, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.field.wide {
  grid-row: span 2;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  outline: 0;
}

.field textarea {
  resize: vertical;
}

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

.return-notice {
  margin: 14px 0 10px;
  color: #b4232d;
  font-size: 13px;
}

.action-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.action-strip button {
  min-height: 32px;
  padding: 0 8px;
  border-color: var(--line);
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
}

.toast-stack {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  display: grid;
  gap: 8px;
  width: min(320px, calc(100vw - 36px));
}

.toast {
  padding: 12px 14px;
  border: 1px solid rgba(15, 139, 141, 0.25);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 13px;
}

.inbound-stage-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.inbound-stage-card {
  display: grid;
  gap: 14px;
  min-height: 146px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.inbound-stage-card header,
.inbound-stage-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.inbound-stage-card strong,
.inbound-stage-card span,
.inbound-stage-card b {
  display: block;
}

.inbound-stage-card header span,
.inbound-stage-card footer span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.inbound-progress {
  height: 12px;
  border-radius: 999px;
  background: #e7edf2;
  overflow: hidden;
}

.inbound-progress span {
  display: block;
  height: 100%;
  min-width: 8px;
  border-radius: inherit;
}

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

.axis,
.grid-line,
.map-label {
  fill: none;
  stroke: #c8d4df;
  stroke-width: 1;
}

.chart-label,
.map-text,
.value-label {
  fill: #657486;
  font-size: 12px;
}

.map-node {
  filter: drop-shadow(0 8px 12px rgba(20, 34, 50, 0.16));
}

.route-line {
  fill: none;
  stroke-linecap: round;
}

.route-marker {
  filter: drop-shadow(0 4px 8px rgba(20, 34, 50, 0.24));
}

@media (max-width: 1160px) {
  .app-shell {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .sidebar {
    padding: 18px 12px;
    align-items: center;
  }

  .brand div,
  .nav-item span,
  .sidebar-status div {
    display: none;
  }

  .brand {
    min-height: 48px;
  }

  .brand-logo {
    width: 48px;
  }

  .nav-item {
    justify-content: center;
    width: 48px;
    padding: 0;
  }

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

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

  .return-console {
    grid-template-columns: 1fr;
  }

  .return-menu {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .return-welcome-grid,
  .return-two-column,
  .return-form-grid {
    grid-template-columns: 1fr;
  }

  .route-panel {
    grid-row: auto;
  }

  .map-frame {
    min-height: 430px;
  }
}

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

  .sidebar {
    position: static;
    width: 100%;
    max-width: 100vw;
    height: auto;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 18px;
    overflow-x: auto;
  }

  .brand {
    flex: 0 0 164px;
    min-height: 66px;
  }

  .brand div {
    display: block;
    min-width: 0;
  }

  .brand strong,
  .brand span {
    white-space: nowrap;
  }

  .brand-logo {
    width: 54px;
  }

  .nav-list {
    flex: 0 0 auto;
    grid-auto-flow: column;
    grid-auto-columns: 48px;
  }

  .sidebar-status {
    display: none;
  }

  .main {
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions,
  .search {
    width: 100%;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
  }

  .search {
    flex: 1 1 100%;
    grid-column: 1 / -1;
  }

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

  .toggle {
    margin-left: 0;
  }

  .vehicle-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .warehouse-heatmap,
  .fleet-board,
  .exception-list,
  .inbound-stage-board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 24px;
  }

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

  .filter-band {
    align-items: stretch;
    flex-direction: column;
  }

  .segmented {
    display: grid;
    grid-template-columns: 1fr;
    min-width: 0;
    width: 100%;
  }

  .segment {
    min-width: 0;
    padding: 0 6px;
    overflow: hidden;
    white-space: nowrap;
  }

  .select-label,
  .select-label select {
    width: 100%;
  }

  .select-label select {
    min-width: 0;
    width: auto;
  }

  .primary-button {
    width: 40px;
    padding: 0;
  }

  .primary-button span {
    display: none;
  }

  .top-actions {
    grid-template-columns: 40px 40px 1fr;
    justify-content: start;
  }

  .panel-header,
  .table-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .timeline-time {
    text-align: left;
  }

  .fleet-meta {
    grid-template-columns: 1fr;
  }

  .return-menu {
    grid-template-columns: 1fr;
  }

  .return-filter-grid {
    grid-template-columns: 1fr;
  }

  .return-feed-row,
  .return-stat-row {
    grid-template-columns: 1fr;
  }

  .field.wide {
    grid-row: auto;
  }

  .legend {
    gap: 8px;
  }

  .map-frame {
    min-height: 320px;
  }

  .chart-box,
  .chart-box.compact {
    height: 260px;
  }
}
