:root {
  color-scheme: light;
  --bg: #f2f2f7;
  --surface: rgba(255, 255, 255, .88);
  --surface-solid: #ffffff;
  --surface-soft: #f7f7fa;
  --line: rgba(60, 60, 67, .14);
  --line-strong: rgba(60, 60, 67, .24);
  --text: #1c1c1e;
  --muted: #6e6e73;
  --subtle: #8e8e93;
  --blue: #007aff;
  --blue-soft: #eaf3ff;
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  --shadow: 0 8px 30px rgba(0, 0, 0, .07);
  --radius: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #000000;
    --surface: rgba(28, 28, 30, .9);
    --surface-solid: #1c1c1e;
    --surface-soft: #2c2c2e;
    --line: rgba(235, 235, 245, .14);
    --line-strong: rgba(235, 235, 245, .24);
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --subtle: #8e8e93;
    --blue-soft: #102b4d;
    --shadow: 0 10px 32px rgba(0, 0, 0, .32);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p { margin: 0; }

.login-screen { position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.login-screen[hidden] { display: none; }
.login-box { width: min(380px, 100%); padding: 28px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.login-logo { width: 46px; height: 46px; display: grid; place-items: center; margin-bottom: 16px; border-radius: 14px; background: linear-gradient(145deg, #ff453a, #ff9f0a); color: #fff; font-size: 12px; font-weight: 800; }
.login-box h2 { font-size: 20px; }
.login-box p { margin: 5px 0 20px; color: var(--muted); font-size: 13px; }
.login-box label { display: block; margin: 11px 0 5px; color: var(--muted); font-size: 12px; }
.login-box input { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; outline: none; background: var(--surface-soft); color: var(--text); }
.login-box input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 122, 255, .12); }
.login-submit { width: 100%; margin-top: 18px; }
.login-error { margin-top: 12px; color: var(--red); font-size: 12px; }

.topbar {
  min-height: 68px;
  padding: 10px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo {
  width: 42px; height: 42px; display: grid; place-items: center;
  flex: 0 0 auto; border-radius: 13px;
  background: linear-gradient(145deg, #ff453a, #ff9f0a);
  color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .5px;
  box-shadow: 0 5px 14px rgba(255, 69, 58, .25);
}
.brand h1 { font-size: 17px; letter-spacing: -.2px; }
.sub { margin-top: 2px; color: var(--muted); font-size: 12px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; min-height: 30px;
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); background: var(--surface-soft); font-size: 12px;
  white-space: nowrap;
}
.pill.ghost { background: transparent; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--subtle); }
.pill.ok .dot { background: var(--green); box-shadow: 0 0 0 3px rgba(52, 199, 89, .14); }
.pill.bad .dot { background: var(--red); box-shadow: 0 0 0 3px rgba(255, 59, 48, .14); }

.btn {
  min-height: 34px; padding: 6px 13px; border: 1px solid var(--line-strong);
  border-radius: 10px; background: var(--surface-solid); color: var(--text);
  cursor: pointer; transition: transform .15s, background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-soft); border-color: var(--blue); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #006ee6; }
.btn.tiny { min-height: 28px; padding: 4px 9px; border-radius: 8px; font-size: 12px; }
.btn.danger { color: var(--red); }

.kpis {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px;
  padding: 14px 22px 0;
}
.kpi {
  min-width: 0; padding: 13px 15px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
.kpi label { display: block; color: var(--muted); font-size: 12px; }
.kpi b { display: block; margin-top: 3px; font-size: 24px; letter-spacing: -.5px; }
.kpi small { color: var(--subtle); font-size: 11px; }

.mobile-tabs { display: none; }

.layout {
  min-height: 0; flex: 1; display: grid; gap: 12px;
  grid-template-columns: 272px minmax(0, 1fr) 370px;
  padding: 12px 22px calc(16px + var(--safe-bottom));
}
.panel {
  min-height: 0; display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 14px; }

.search { padding: 11px 12px 5px; }
.search input, .range select, .modal-box input, .playback select {
  width: 100%; min-height: 36px; padding: 7px 10px; outline: none;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); color: var(--text);
}
.search input:focus, .modal-box input:focus, .range select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 122, 255, .12); }
.devlist { list-style: none; flex: 1; min-height: 0; overflow: auto; margin: 5px 0; padding: 0 8px; }
.devlist li { margin: 4px 0; padding: 11px 10px; border: 1px solid transparent; border-radius: 12px; cursor: pointer; background: transparent; }
.devlist li:hover { background: var(--surface-soft); }
.devlist li.sel { border-color: rgba(0, 122, 255, .35); background: var(--blue-soft); }
.dev-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dev-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dev-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 3px; color: var(--muted); font-size: 11px; }
.badge, .tag { display: inline-flex; align-items: center; border-radius: 999px; white-space: nowrap; font-size: 10px; }
.badge { padding: 2px 7px; border: 1px solid var(--line); color: var(--muted); }
.badge.on, .tag.green { color: var(--green); background: rgba(52, 199, 89, .11); border-color: rgba(52, 199, 89, .25); }
.badge.off { color: var(--muted); }
.range { padding: 12px; border-top: 1px solid var(--line); }
.range label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; }

.mapwrap { position: relative; padding: 0; }
#map { position: absolute; inset: 0; background: #dfe4ea; }
.leaflet-container { background: #dfe4ea; }
.map-overlay {
  position: absolute; z-index: 600; top: 12px; left: 12px;
  display: inline-flex; width: max-content; max-width: calc(100% - 24px);
  align-items: center; gap: 7px; padding: 4px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--muted); font-size: 11px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
  pointer-events: auto; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.map-overlay #mapHint { padding: 4px 6px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-switch { display: flex; gap: 4px; }
.map-overlay .btn { min-height: 27px; padding: 3px 8px; font-size: 11px; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface-solid); color: var(--text); }
.leaflet-popup-content { margin: 10px 12px; font-size: 12px; line-height: 1.6; }
.leaflet-bar a { background: var(--surface-solid); color: var(--text); border-color: var(--line); }
.leaflet-bar a:hover { background: var(--surface-soft); }

.playback {
  position: absolute; z-index: 600; left: 12px; right: 12px; bottom: 12px;
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.playback input[type=range] { flex: 1; min-width: 40px; accent-color: var(--blue); }
.pb-left, .pb-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.pb-time, #pbPos { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.playback select { width: auto; min-height: 30px; padding: 4px 7px; font-size: 12px; }

.tabs { display: flex; flex: 0 0 auto; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1 0 auto; min-width: 82px; padding: 13px 8px 11px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.tabbody { flex: 1; width: 100%; min-width: 0; min-height: 0; overflow: auto; }
.tabpane { display: flex; flex-direction: column; width: 100%; min-width: 0; min-height: 100%; }
.tabpane[hidden], .empty[hidden], .modal[hidden], .toast[hidden] { display: none !important; }
.panehead { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-width: 0; padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.list { display: flex; flex-direction: column; gap: 8px; width: 100%; min-width: 0; padding: 10px; }
.empty { padding: 42px 18px; text-align: center; color: var(--muted); }
.card { width: 100%; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-solid); cursor: pointer; transition: transform .15s, border-color .15s, background .15s; }
.card:hover { border-color: var(--line-strong); }
.card:active { transform: scale(.99); }
.card.sel { border-color: rgba(0, 122, 255, .5); background: var(--blue-soft); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; min-width: 0; }
.card-title { min-width: 0; overflow-wrap: anywhere; font-size: 12.5px; font-weight: 600; }
.card-sub { min-width: 0; margin-top: 4px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 12px; min-width: 0; margin-top: 9px; color: var(--muted); font-size: 11.5px; }
.card-grid > span { min-width: 0; overflow-wrap: anywhere; }
.card-grid b { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.tag { padding: 3px 8px; }
.tag.blue { color: var(--blue); background: var(--blue-soft); border: 1px solid rgba(0, 122, 255, .18); }
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 12px; }
.kv span { color: var(--muted); }
.kv b { max-width: 65%; text-align: right; word-break: break-all; }
.kv > b { min-width: 0; }
.kv > b .btn { margin: 2px 0; }

.modal { position: fixed; inset: 0; z-index: 5000; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .35); backdrop-filter: blur(8px); }
.modal-box { width: min(430px, 100%); padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface-solid); box-shadow: 0 20px 60px rgba(0, 0, 0, .2); }
.modal-box h3 { margin-bottom: 12px; font-size: 17px; }
.modal-box label { display: block; margin: 10px 0 5px; color: var(--muted); font-size: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toast { position: fixed; z-index: 6000; left: 50%; bottom: calc(24px + var(--safe-bottom)); transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 10px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-solid); box-shadow: var(--shadow); color: var(--text); font-size: 13px; }

@media (max-width: 1350px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .layout { grid-template-columns: 250px minmax(0, 1fr) 330px; } }
@media (min-width: 981px) {
  .topbar { min-height: 58px; padding: 8px 16px; gap: 12px; }
  .brand { gap: 10px; }
  .logo { width: 36px; height: 36px; border-radius: 11px; }
  .brand h1 { font-size: 16px; }
  .sub { font-size: 11px; }
  .topbar-right { gap: 6px; }
  .pill { min-height: 28px; padding: 4px 9px; font-size: 11px; }
  .btn { min-height: 32px; padding: 5px 11px; border-radius: 9px; }
  .btn.tiny { min-height: 27px; padding: 4px 8px; border-radius: 8px; }
  .kpis { gap: 8px; padding: 10px 16px 0; }
  .kpi { padding: 10px 12px; border-radius: 13px; box-shadow: 0 4px 18px rgba(0, 0, 0, .05); }
  .kpi label { font-size: 11px; }
  .kpi b { font-size: 21px; }
  .kpi small { font-size: 10px; }
  .layout { gap: 10px; padding: 10px 16px calc(12px + var(--safe-bottom)); }
  .panel { border-radius: 14px; box-shadow: 0 5px 20px rgba(0, 0, 0, .055); }
  .panel-head { padding: 11px 12px; }
  .panel-head h2 { font-size: 13px; }
  .search { padding: 9px 10px 4px; }
  .search input, .range select { min-height: 33px; padding: 6px 9px; border-radius: 9px; font-size: 12px; }
  .devlist { padding: 0 6px; }
  .devlist li { margin: 3px 0; padding: 9px; border-radius: 10px; }
  .range { padding: 10px; }
  .map-overlay { top: 10px; left: 10px; }
  .playback { left: 10px; right: 10px; bottom: 10px; padding: 7px 9px; border-radius: 12px; }
  .tabs .tab { min-width: 76px; padding: 11px 7px 9px; font-size: 11px; }
  .panehead { padding: 9px 11px; }
  .list { gap: 6px; padding: 8px; }
  .card { padding: 10px; border-radius: 11px; }
  .card-title { font-size: 12px; }
  .card-grid { margin-top: 7px; font-size: 11px; }
  .kv { padding: 8px 11px; font-size: 11px; }
}
@media (max-width: 980px) {
  body { overflow: auto; }
  .topbar { padding: 10px 14px; }
  .topbar-right .pill.ghost { display: none; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 10px 14px 0; }
  .kpi { padding: 10px 11px; }
  .kpi b { font-size: 20px; }
  .layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(340px, 52vh) auto; padding: 10px 14px calc(14px + var(--safe-bottom)); }
  .sidebar { max-height: 320px; }
  .devlist { max-height: 145px; }
  .detail { min-height: 340px; }
}
@media (max-width: 560px) {
  .topbar { align-items: flex-start; }
  .brand h1 { font-size: 16px; }
  .sub { font-size: 11px; }
  .logo { width: 38px; height: 38px; border-radius: 12px; }
  .topbar-right .pill { display: none; }
  .topbar-right .btn { min-height: 32px; padding-inline: 10px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi label { font-size: 11px; }
  .kpi b { font-size: 20px; }
  .layout { grid-template-rows: auto 52vh auto; padding-inline: 10px; }
  .map-overlay { top: 8px; left: 8px; max-width: calc(100% - 16px); }
  .map-switch .btn { padding-inline: 7px; }
  .playback { left: 8px; right: 8px; bottom: 8px; flex-wrap: wrap; }
  .pb-left { width: 100%; justify-content: space-between; }
  .playback input[type=range] { order: 3; flex-basis: 100%; }
  .pb-right { margin-left: auto; }
  .card-grid { grid-template-columns: 1fr; }
  .kv { align-items: flex-start; }
  .kv b { max-width: 58%; }

  body { overflow: auto; }
  .mobile-tabs {
    position: sticky; top: 0; z-index: 1200;
    display: flex; gap: 4px; overflow-x: auto;
    padding: 8px 10px; border-bottom: 1px solid var(--line);
    background: var(--surface); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    scrollbar-width: none;
  }
  .mobile-tabs::-webkit-scrollbar { display: none; }
  .mobile-tab {
    flex: 0 0 auto; min-width: 56px; min-height: 32px; padding: 5px 11px;
    border: 1px solid transparent; border-radius: 999px;
    background: transparent; color: var(--muted); font-size: 12px; cursor: pointer;
  }
  .mobile-tab.active { border-color: rgba(0, 122, 255, .22); background: var(--blue-soft); color: var(--blue); font-weight: 600; }
  .kpis { padding-top: 10px; }
  body:not(.mobile-tab-overview) .kpis { display: none; }
  .layout { display: block; padding-top: 10px; }
  .layout > .panel { display: none; min-height: calc(100vh - 190px); }
  body.mobile-tab-devices .layout > .sidebar,
  body.mobile-tab-map .layout > .mapwrap,
  body.mobile-tab-trips .layout > .detail,
  body.mobile-tab-ignitions .layout > .detail,
  body.mobile-tab-parkings .layout > .detail,
  body.mobile-tab-info .layout > .detail { display: flex; }
  body.mobile-tab-overview .layout { display: none; }
  body.mobile-tab-trips .detail .tabs,
  body.mobile-tab-ignitions .detail .tabs,
  body.mobile-tab-parkings .detail .tabs,
  body.mobile-tab-info .detail .tabs { display: none; }
  body.mobile-tab-trips .detail [data-pane="trips"],
  body.mobile-tab-ignitions .detail [data-pane="ignitions"],
  body.mobile-tab-parkings .detail [data-pane="parkings"],
  body.mobile-tab-info .detail [data-pane="info"] { display: flex !important; }
  .layout > .mapwrap { min-height: calc(100vh - 190px); }
  .layout > .sidebar { max-height: none; }
  .layout > .detail { min-height: calc(100vh - 190px); }
}

/* Mobile workspace: single-task screens with a thumb-friendly bottom nav. */
@media (max-width: 560px) {
  body { background: var(--bg); padding-bottom: calc(62px + var(--safe-bottom)); }
  .topbar {
    position: sticky; top: 0; z-index: 1300; min-height: 58px;
    padding: 8px 12px; border-bottom: 1px solid var(--line);
  }
  .brand { gap: 9px; }
  .logo { width: 34px; height: 34px; border-radius: 10px; font-size: 10px; }
  .brand h1 { font-size: 15px; }
  .sub { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
  .topbar-right { gap: 5px; }
  .topbar-right .btn { min-height: 30px; padding: 4px 8px; border-radius: 9px; font-size: 11px; }
  .topbar-right #btnLogout { display: none; }

  .mobile-tabs {
    position: fixed; top: auto; right: 0; bottom: 0; left: 0; z-index: 3000;
    display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0;
    height: calc(62px + var(--safe-bottom)); padding: 5px 4px var(--safe-bottom);
    border-top: 1px solid var(--line); border-bottom: 0; border-radius: 0;
    background: color-mix(in srgb, var(--surface-solid) 88%, transparent);
    box-shadow: 0 -5px 22px rgba(0, 0, 0, .08);
    backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  }
  .mobile-tab {
    min-width: 0; min-height: 48px; padding: 5px 2px 3px;
    border: 0; border-radius: 10px; font-size: 10px;
  }
  .mobile-tab.active { background: var(--blue-soft); }

  .kpis { padding: 12px 12px 0; gap: 8px; }
  .kpi { min-height: 88px; padding: 12px; border-radius: 14px; }
  .kpi label { font-size: 11px; }
  .kpi b { margin-top: 6px; font-size: 22px; }
  .kpi small { font-size: 10px; }

  .layout { padding: 10px 10px calc(12px + var(--safe-bottom)); }
  .layout > .panel { min-height: calc(100svh - 142px); border-radius: 16px; }
  .layout > .mapwrap { min-height: calc(100svh - 142px); }
  .layout > .detail { min-height: calc(100svh - 142px); }
  .layout > .sidebar { min-height: calc(100svh - 142px); }
  .panel-head { padding: 14px; }
  .panel-head h2 { font-size: 15px; }
  .search { padding: 10px 12px 6px; }
  .search input, .range select { min-height: 42px; border-radius: 12px; font-size: 13px; }
  .devlist { margin: 4px 0; padding: 0 8px; }
  .devlist li { margin: 4px 0; padding: 14px 12px; border-radius: 12px; }
  .dev-name { font-size: 13px; }
  .dev-meta { margin-top: 5px; font-size: 11px; }
  .range { padding: 13px 12px; }

  .map-overlay { top: 10px; left: 10px; padding: 4px; }
  .map-overlay #mapHint { max-width: 96px; }
  .map-overlay .btn { min-height: 30px; padding: 4px 7px; }
  .mobile-tab-map .playback { bottom: calc(70px + var(--safe-bottom)); left: 10px; right: 10px; }
  .playback { padding: 10px; border-radius: 14px; }
  .pb-time, #pbPos { font-size: 10px; }

  .detail .tabbody { padding-bottom: 2px; }
  .panehead { min-height: 45px; padding: 10px 14px; }
  .list { gap: 10px; padding: 12px; }
  .card { padding: 14px; border-radius: 14px; }
  .card-title { font-size: 13px; }
  .card-sub { margin-top: 6px; font-size: 11px; }
  .card-grid { gap: 8px; margin-top: 12px; font-size: 12px; }
  .kv { padding: 13px 14px; font-size: 12px; }
  .kv b { max-width: 60%; }

  .modal { align-items: end; padding: 0; }
  .modal-box { width: 100%; padding: 20px 18px calc(20px + var(--safe-bottom)); border-radius: 20px 20px 0 0; }
  .toast { bottom: calc(76px + var(--safe-bottom)); }
}

@media (max-width: 560px) {
  /* C layout: overview, map, records and settings are the primary workspaces. */
  .mobile-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mobile-tab { font-size: 11px; }
  .layout { display: block; }
  .layout > .panel { display: none; }
  .layout > .sidebar,
  .layout > .mapwrap,
  .layout > .detail { min-height: calc(100svh - 142px); }

  body.mobile-tab-overview .layout { display: block; }
  body.mobile-tab-overview .layout > .sidebar { display: flex; }
  body.mobile-tab-overview .layout > .mapwrap,
  body.mobile-tab-overview .layout > .detail { display: none; }
  body.mobile-tab-overview .sidebar .panel-head { min-height: 54px; }
  body.mobile-tab-overview .sidebar .devlist { min-height: 230px; }

  body.mobile-tab-map .layout > .mapwrap { display: flex; }
  body.mobile-tab-map .layout > .sidebar,
  body.mobile-tab-map .layout > .detail { display: none; }

  body.mobile-tab-records .layout > .detail,
  body.mobile-tab-settings .layout > .detail { display: flex; }
  body.mobile-tab-records .layout > .sidebar,
  body.mobile-tab-records .layout > .mapwrap,
  body.mobile-tab-settings .layout > .sidebar,
  body.mobile-tab-settings .layout > .mapwrap { display: none; }
  body.mobile-tab-records .detail .tabs { display: flex; }
  body.mobile-tab-records .detail .tabbody { display: flex; flex-direction: column; }
  body.mobile-tab-settings .detail .tabbody { display: flex; flex-direction: column; }
  body.mobile-tab-settings .detail .tabs { display: none; }
  body.mobile-tab-settings .detail [data-pane="info"] { display: flex !important; }
  body.mobile-tab-settings .detail [data-pane="trips"],
  body.mobile-tab-settings .detail [data-pane="ignitions"],
  body.mobile-tab-settings .detail [data-pane="parkings"] { display: none !important; }
}
