:root {
  --bg: #f2f4f8;
  --panel: #ffffff;
  --line: #dfe3ea;
  --text: #1d2530;
  --muted: #6b7686;
  --primary: #1668dc;
  --primary-dark: #0f55b8;
  --ok: #128a4c;
  --warn: #b96a12;
  --bad: #c2302e;
  --neutral: #5b6b7d;
  --sidebar: #152238;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; min-width: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--bad); }
.tip { color: var(--muted); font-size: 12px; }

button {
  font: inherit;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  white-space: nowrap;
}
button:hover { border-color: var(--primary); color: var(--primary); }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-dark); }
button.danger { color: var(--bad); border-color: #e4b6b5; }
button.danger:hover { background: #fdf1f1; }
button.ghost { background: transparent; border-color: transparent; color: #b9c6d8; }
button.ghost:hover { color: #fff; border-color: transparent; }
button.small { padding: 4px 9px; font-size: 12px; }

input, select, textarea {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #c9dcf7; border-color: var(--primary); }
label { display: block; margin: 10px 0 4px; color: var(--muted); font-size: 13px; }

/* Login */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #152238 0%, #1d3a5f 55%, #23537f 100%);
  padding: 20px;
}
.login-card {
  width: 380px;
  max-width: 100%;
  background: var(--panel);
  border-radius: 16px;
  padding: 34px 32px;
  box-shadow: 0 18px 50px rgba(10, 20, 40, 0.35);
}
.login-card h1 { margin: 0 0 6px; font-size: 22px; }
.login-card .primary { width: 100%; margin-top: 16px; padding: 10px; }
.remember-login {
  display: flex; align-items: center; gap: 9px; margin-top: 13px;
  color: var(--text); cursor: pointer; user-select: none;
}
.remember-login input { width: 20px; height: 20px; margin: 0; accent-color: var(--primary); }

/* App layout */
.app-view { display: flex; height: 100vh; height: 100dvh; min-width: 0; overflow: hidden; }
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: #c9d4e3;
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
}
.brand { font-size: 19px; font-weight: 700; color: #fff; padding: 4px 10px 18px; }
.brand span { display: block; font-size: 12px; font-weight: 400; color: #8fa3ba; margin-top: 3px; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav button {
  text-align: left;
  background: transparent;
  border: none;
  color: #c9d4e3;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}
.sidebar nav button:hover { color: #fff; background: rgba(255,255,255,0.08); }
.sidebar nav button.active { background: var(--primary); color: #fff; }
.sidebar nav .nav-label {
  margin: 10px 10px 2px;
  font-size: 11px;
  color: #6f87a3;
  letter-spacing: 1px;
}
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px; font-size: 12px; color: #8fa3ba; }

main { flex: 1; min-width: 0; min-height: 0; overflow-y: auto; padding: 22px 26px; }
.view { max-width: 1200px; margin: 0 auto; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card .num { font-size: 26px; font-weight: 700; margin-top: 4px; }
.card .label { color: var(--muted); font-size: 13px; }
.card .num.ok { color: var(--ok); }
.card .num.warn { color: var(--warn); }
.card .num.bad { color: var(--bad); }

/* Panels & tables */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 16px; }
.panel-head .tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.panel-head .tools button { flex-shrink: 0; }
.panel-head input { width: 220px; }
.batch-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}
.batch-bar input { width: 90px; }
.batch-label { font-size: 13px; color: var(--muted); }
.batch-hint { font-size: 12px; color: var(--muted); }
.panel-body { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: #f8fafc; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td.num { text-align: right; white-space: nowrap; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.badge.ok { background: #e2f5ea; color: var(--ok); }
.badge.warn { background: #fdf0dd; color: var(--warn); }
.badge.bad { background: #fce8e7; color: var(--bad); }
.badge.neutral { background: #e8edf3; color: var(--neutral); }
.badge.blue { background: #e3eefc; color: var(--primary); }
.feature-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.feature-tags span { background: #f0f4f9; border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; font-size: 12px; color: var(--neutral); }

.empty { padding: 26px; text-align: center; color: var(--muted); }

/* 司机地图与轨迹回放 */
.map-page { display: flex; flex-direction: column; gap: 14px; }
.map-hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 22px 24px; color: #fff; border-radius: 16px;
  background: linear-gradient(125deg, #112a4c 0%, #1558a5 58%, #1684c7 100%);
  box-shadow: 0 14px 34px rgba(22, 76, 139, 0.22);
}
.map-hero::after {
  content: ""; position: absolute; width: 280px; height: 280px; right: -80px; top: -150px;
  border-radius: 50%; border: 42px solid rgba(255,255,255,0.07); pointer-events: none;
}
.map-eyebrow { display: block; color: #94d5ff; font-size: 11px; font-weight: 700; letter-spacing: 2px; margin-bottom: 5px; }
.map-hero h2 { position: relative; margin: 0; font-size: 25px; letter-spacing: 1px; }
.map-hero p { position: relative; margin: 6px 0 0; color: #d8ebff; font-size: 13px; }
.map-toolbar { position: relative; z-index: 1; display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.map-toolbar button { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.28); color: #fff; backdrop-filter: blur(8px); }
.map-toolbar button:hover { background: rgba(255,255,255,0.22); border-color: rgba(255,255,255,0.55); color: #fff; }
.map-toolbar button.danger-soft { background: rgba(255, 92, 92, 0.14); border-color: rgba(255, 180, 180, 0.5); }
.map-toolbar button.danger-soft:hover { background: rgba(255, 92, 92, 0.3); }
.map-live { display: inline-flex; align-items: center; gap: 7px; margin-right: 3px; color: #d8ebff; font-size: 12px; }
.map-live i { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 5px rgba(74,222,128,0.16); animation: mapLivePulse 1.8s ease-in-out infinite; }

.map-filter-bar {
  display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(180px, 1fr) minmax(180px, 1fr) 105px auto;
  align-items: end; gap: 10px; padding: 14px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 13px;
  box-shadow: 0 5px 18px rgba(30, 50, 80, 0.05);
}
.map-filter-field label { margin: 0 0 5px; font-size: 11px; font-weight: 700; color: #758398; letter-spacing: .4px; }
.map-filter-field input, .map-filter-field select { height: 38px; padding: 7px 9px; }
.map-filter-actions { display: flex; gap: 7px; padding-bottom: 1px; }
.map-filter-actions button { height: 38px; }

.map-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.map-stat {
  position: relative; overflow: hidden; min-height: 75px; padding: 13px 16px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 4px 14px rgba(30, 50, 80, 0.04);
}
.map-stat::after { content: ""; position: absolute; right: -17px; bottom: -28px; width: 75px; height: 75px; border-radius: 50%; background: #edf4fd; }
.map-stat span { display: block; color: var(--muted); font-size: 11px; }
.map-stat strong { position: relative; z-index: 1; display: block; margin-top: 4px; color: #18395d; font-size: 24px; line-height: 1.1; }
.map-stat.online strong { color: #169353; }
.map-stat.online::after { background: #e5f8ed; }
.map-stat.trajectory strong { color: #7957d5; }
.map-stat.trajectory::after { background: #f0ebff; }
.map-stat.updated strong { font-size: 18px; margin-top: 9px; color: #3d536d; }

.map-shell { display: grid; grid-template-columns: minmax(0, 1fr) 335px; gap: 14px; align-items: stretch; }
.map-canvas-wrap {
  position: relative; min-width: 0; overflow: hidden; background: #fff;
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 8px 24px rgba(30, 50, 80, 0.08);
}
.map-frame { height: 66vh; min-height: 490px; overflow: hidden; background: #e7edf4; }
.map-legend {
  position: absolute; z-index: 700; left: 12px; top: 12px;
  display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
  padding: 8px 11px; border: 1px solid rgba(255,255,255,0.75); border-radius: 10px;
  background: rgba(255,255,255,0.9); box-shadow: 0 5px 18px rgba(20,40,70,.14); backdrop-filter: blur(8px);
  color: #46566b; font-size: 11px;
}
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-dot.online { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.legend-dot.offline { background: #94a3b8; }
.legend-line { width: 18px; height: 4px; border-radius: 6px; background: linear-gradient(90deg, #3b82f6, #8b5cf6); }
.map-playback-panel {
  position: absolute; z-index: 700; left: 12px; right: 12px; bottom: 12px;
  display: grid; grid-template-columns: minmax(165px, 1fr) minmax(90px, 1.2fr) auto;
  align-items: center; gap: 13px; padding: 10px 12px;
  background: rgba(16, 32, 55, 0.91); color: #fff; border: 1px solid rgba(255,255,255,.15);
  border-radius: 12px; box-shadow: 0 8px 28px rgba(5,18,36,.28); backdrop-filter: blur(10px);
}
.map-playback-copy { min-width: 0; }
.map-playback-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.map-playback-copy span { display: block; margin-top: 2px; color: #a9bdd5; font-size: 10px; }
.map-progress { height: 5px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.14); }
.map-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #22c55e, #5bc0ff); transition: width .08s linear; }
.map-playback-actions { display: flex; gap: 6px; }
.map-playback-actions button { border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.09); color: #fff; }
.map-playback-actions button.primary { border-color: #2788e8; background: #1974ce; }

.map-driver-panel {
  height: 66vh; min-height: 490px; display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 8px 24px rgba(30, 50, 80, 0.08);
}
.map-driver-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 16px; border-bottom: 1px solid #e9edf3; }
.map-driver-head span { display: block; color: #26384d; font-size: 14px; font-weight: 700; }
.map-driver-head small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 400; }
.map-driver-head b { padding: 4px 9px; border-radius: 999px; background: #e8f2ff; color: var(--primary); font-size: 11px; }
.driver-card-list { flex: 1; overflow-y: auto; padding: 10px; background: #f7f9fc; scrollbar-width: thin; }
.driver-map-card {
  margin-bottom: 9px; padding: 12px; background: #fff; border: 1px solid #e5eaf1;
  border-left: 3px solid #aab5c4; border-radius: 10px; box-shadow: 0 3px 10px rgba(30,50,80,.04);
  transition: transform .16s ease, box-shadow .16s ease;
}
.driver-map-card:hover { transform: translateY(-1px); box-shadow: 0 7px 17px rgba(30,50,80,.09); }
.driver-map-card.online { border-left-color: #22c55e; }
.driver-card-title, .driver-identity, .driver-card-actions { display: flex; align-items: center; }
.driver-card-title, .driver-card-actions { justify-content: space-between; gap: 8px; }
.driver-identity { min-width: 0; gap: 8px; }
.driver-status-dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: #94a3b8; box-shadow: 0 0 0 4px rgba(148,163,184,.12); }
.driver-map-card.online .driver-status-dot { background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.12); }
.driver-identity div { min-width: 0; }
.driver-identity b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #27394d; font-size: 13px; }
.driver-identity small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.driver-status-badge { padding: 3px 7px; border-radius: 999px; background: #edf0f4; color: #6b7787; font-size: 9px; }
.driver-map-card.online .driver-status-badge { background: #e4f8ec; color: #168349; }
.driver-card-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin: 11px 0; padding: 9px 5px; background: #f7f9fc; border-radius: 8px; }
.driver-card-metrics span { min-width: 0; text-align: center; border-right: 1px solid #e6eaf0; }
.driver-card-metrics span:last-child { border-right: none; }
.driver-card-metrics b { display: block; color: #2d4057; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.driver-card-metrics small { display: block; margin-top: 2px; color: #8a96a5; font-size: 9px; }
.driver-location-state { margin: -4px 0 9px; padding: 6px 8px; border-radius: 7px; font-size: 9px; line-height: 1.35; }
.driver-location-state.located { background: #edf8f2; color: #177a4a; }
.driver-location-state.waiting { background: #fff7e6; color: #9a6410; }
.trajectory-color { display: inline-flex; align-items: center; gap: 5px; color: #7b8796; font-size: 9px; }
.trajectory-color i { width: 16px; height: 4px; border-radius: 5px; }
.driver-card-actions > div { display: flex; gap: 5px; }
.map-empty { height: 100%; min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; text-align: center; color: var(--muted); }
.map-empty b { color: #506176; font-size: 13px; }
.map-empty span { font-size: 10px; }
button:disabled { opacity: .48; cursor: not-allowed; }
button:disabled:hover { border-color: var(--line); color: inherit; }

.driver-location-marker { filter: drop-shadow(0 2px 4px rgba(20,40,70,.35)); }
.driver-trajectory-line { filter: drop-shadow(0 2px 3px rgba(34,74,130,.3)); stroke-linecap: round; stroke-linejoin: round; }
.driver-trajectory-line.is-playing { stroke-dasharray: 12 9; animation: trajectoryFlow .75s linear infinite; }
.trajectory-runner { animation: trajectoryRunnerGlow 1s ease-in-out infinite; filter: drop-shadow(0 0 5px rgba(255,255,255,.95)); }
@keyframes trajectoryFlow { to { stroke-dashoffset: -21; } }
@keyframes trajectoryRunnerGlow { 0%,100% { opacity: .88; stroke-width: 3; } 50% { opacity: 1; stroke-width: 5; } }
@keyframes mapLivePulse { 0%,100% { opacity: .7; } 50% { opacity: 1; box-shadow: 0 0 0 7px rgba(74,222,128,0.08); } }

/* Modal */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 25, 40, 0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 50; overflow-y: auto;
}
.modal {
  background: var(--panel); border-radius: 14px; width: 560px; max-width: 100%;
  box-shadow: 0 20px 60px rgba(10, 20, 40, 0.3);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.close { border: none; background: none; font-size: 20px; color: var(--muted); padding: 0 6px; }
.close:hover { color: var(--text); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-top: 6px; }
.check-grid label { display: flex; gap: 8px; align-items: center; margin: 0; color: var(--text); font-size: 13px; }
.check-grid input { width: auto; }
.code-box {
  font-family: Consolas, "Courier New", monospace; font-size: 15px; word-break: break-all;
  background: #f4f7fb; border: 1px dashed #b8c8db; border-radius: 8px; padding: 12px; margin: 8px 0;
  user-select: all; -webkit-user-select: all;
}
.key-box {
  font-family: Consolas, "Courier New", monospace; font-size: 12px; word-break: break-all;
  background: #f4f7fb; border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 6px 0;
}
.note { font-size: 12px; color: var(--muted); line-height: 1.6; }

/* Toast */
#toast-root { position: fixed; top: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1d2530; color: #fff; border-radius: 8px; padding: 10px 16px; box-shadow: 0 8px 24px rgba(0,0,0,0.2); font-size: 13px; animation: fadein 0.2s; }
.toast.ok { background: var(--ok); }
.toast.bad { background: var(--bad); }
@keyframes fadein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

@media (max-width: 1050px) {
  .map-filter-bar { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
  .map-filter-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .map-shell { grid-template-columns: 1fr; }
  .map-driver-panel { height: auto; min-height: 0; max-height: 520px; }
  .driver-card-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .driver-map-card { margin: 0; }
}

@media (max-width: 760px) {
  .app-view { flex-direction: column; }
  .sidebar { width: 100%; flex-shrink: 0; flex-direction: row; align-items: center; padding: 8px; gap: 6px; overflow: hidden; }
  .brand { flex-shrink: 0; padding: 4px 8px; font-size: 15px; white-space: nowrap; }
  .brand span { display: none; }
  .sidebar nav { min-width: 0; flex: 1; flex-direction: row; flex-wrap: wrap; gap: 2px; scrollbar-width: none; }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .sidebar nav button { padding: 6px 8px; font-size: 12px; }
  .sidebar-foot { flex-shrink: 0; margin: 0 0 0 auto; flex-direction: row; padding: 0; }
  .sidebar-foot span { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .check-grid { grid-template-columns: 1fr; }
  main { padding: 12px 10px; }
  .panel-head { flex-direction: column; align-items: stretch; }
  .panel-head .tools { justify-content: flex-start; }
  .panel-head input { width: 100%; }
  .panel-head .tools input, .panel-head .tools select { flex: 1 1 100%; width: 100%; }
  .panel-head .tools button { flex: 1 1 auto; min-height: 40px; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card { padding: 12px; }
  .card .num { font-size: 22px; }
  .modal-mask { padding: 16px 10px; align-items: center; }
  .modal { max-height: calc(100dvh - 24px); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
  .modal-body { min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot button { flex: 1 1 auto; min-height: 42px; }
  .modal-head, .modal-body, .modal-foot { padding: 12px 14px; }
  .row-actions { gap: 4px; }
  .row-actions button { padding: 6px 10px; }
  .map-hero { flex-direction: column; align-items: flex-start; padding: 18px; }
  .map-hero h2 { font-size: 22px; }
  .map-toolbar { justify-content: flex-start; }
  .map-live { flex-basis: 100%; margin-bottom: 3px; }
  .map-filter-bar { grid-template-columns: 1fr 1fr; }
  .map-filter-driver { grid-column: 1 / -1; }
  .map-filter-speed { grid-column: span 1; }
  .map-filter-actions { grid-column: 1 / -1; justify-content: stretch; }
  .map-filter-actions button { flex: 1; }
  .map-stats { grid-template-columns: repeat(2, 1fr); }
  .map-stat { min-height: 68px; padding: 11px 13px; }
  .map-stat strong { font-size: 21px; }
  .map-stat.updated strong { font-size: 16px; }
  .map-frame { height: 54vh; min-height: 410px; }
  .map-driver-panel { max-height: none; }
  .driver-card-list { grid-template-columns: 1fr; max-height: 52vh; }
  .map-playback-panel { grid-template-columns: 1fr auto; gap: 8px; }
  .map-progress { grid-column: 1 / -1; grid-row: 2; }
  .map-playback-actions { grid-column: 2; grid-row: 1; }
  .map-legend { right: 12px; }
  #toast-root { top: 10px; right: 10px; left: 10px; align-items: stretch; }
  .toast { text-align: center; }
  .batch-bar input { flex: 1; width: auto; min-width: 70px; }
  .sidebar nav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .sidebar nav button { flex-shrink: 0; }
  .sidebar nav .nav-label { display: none; }
}
@media (max-width: 600px) {
  .brand { display: none; }
  .sidebar nav button { min-height: 40px; padding: 8px 11px; }
  .sidebar-foot button { min-height: 40px; padding: 7px 10px; }
  .panel { overflow: visible; }
  .panel-body { overflow: visible; }
  table.responsive-table, table.responsive-table tbody,
  table.responsive-table tr, table.responsive-table td { display: block; width: 100%; }
  table.responsive-table thead { display: none; }
  table.responsive-table tbody { padding: 9px; }
  table.responsive-table tr {
    margin-bottom: 10px; overflow: hidden; border: 1px solid var(--line);
    border-radius: 10px; background: #fff; box-shadow: 0 3px 10px rgba(30,50,80,.04);
  }
  table.responsive-table tr:last-child { margin-bottom: 0; }
  table.responsive-table td {
    display: grid; grid-template-columns: minmax(88px, 32%) minmax(0, 1fr);
    gap: 10px; align-items: start; padding: 9px 11px; border-bottom: 1px solid #edf0f4;
    white-space: normal; overflow-wrap: anywhere;
  }
  table.responsive-table td:last-child { border-bottom: 0; }
  table.responsive-table td::before {
    content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600;
  }
  table.responsive-table td.row-actions { display: flex; flex-wrap: wrap; gap: 7px; }
  table.responsive-table td.row-actions::before { flex: 0 0 100%; }
  table.responsive-table td.row-actions button { flex: 1 1 auto; min-height: 38px; }
  .cards { grid-template-columns: 1fr 1fr; }
  .batch-bar > * { flex: 1 1 100%; }
  .batch-bar button { min-height: 42px; }
}
@media (max-width: 420px) {
  .login-card { padding: 26px 20px; }
  .brand { display: none; }
  th, td { padding: 8px 10px; }
  .panel-head h2 { font-size: 15px; }
  .map-filter-bar { grid-template-columns: 1fr; }
  .map-filter-driver, .map-filter-speed, .map-filter-actions { grid-column: auto; }
  .map-toolbar button { flex: 1; }
  .map-live { flex-basis: 100%; }
  .map-playback-panel { left: 8px; right: 8px; bottom: 8px; padding: 9px; }
  .map-playback-actions button { padding: 4px 7px; }
}
