:root {
  --brand-accent: #2f9d5f;
  --brand-accent-dark: #23824c;
  --brand-accent-soft: rgba(47, 157, 95, 0.12);
  --grey-900: #1a1c1e;
  --grey-800: #2c3035;
  --grey-700: #3d434b;
  --grey-500: #6b7280;
  --grey-300: #c5cad3;
  --grey-100: #eef1f4;
  --white: #ffffff;
  --text: #1f2328;
  --text-muted: #5a6270;
  --nav-w: 13.5rem;
  --topbar-h: 4.25rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Raleway", "Century Gothic", sans-serif;
  --font-ui: "Rajdhani", "Raleway", sans-serif;
  --danger: #c94444;
  --warn: #b8860b;
  --shadow: 0 12px 40px rgba(26, 28, 30, 0.08);
  --shadow-soft: 0 4px 18px rgba(26, 28, 30, 0.06);
  --canvas: #eef1f4;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--text);
  background: var(--canvas);
  line-height: 1.5;
}

/* —— Left nav —— */
.app-nav {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.1rem 0.85rem;
  background: linear-gradient(180deg, #1a1c1e 0%, #24282d 100%);
  color: #e8eaed;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--nav-w);
  height: 100vh;
  height: 100dvh;
  z-index: 40;
  overflow-y: auto;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: #fff;
  padding: 0.35rem 0.45rem;
}

.brand-mark {
  color: var(--brand-accent);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-text {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 0.01em;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.72);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-left: 3px solid transparent;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.nav-item[aria-current="page"] {
  color: #fff;
  background: rgba(47, 157, 95, 0.18);
  border-left-color: var(--brand-accent);
}

.nav-icon {
  display: grid;
  place-items: center;
  opacity: 0.9;
}

.nav-badge {
  margin-left: auto;
  min-width: 1.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: #d4547a;
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
}

.nav-badge[hidden] {
  display: none !important;
}

.nav-foot-block {
  margin-top: auto;
  padding: 0.35rem 0.5rem 0.15rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.65rem 0 0.25rem;
  padding: 0 0.35rem;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.65);
}

.nav-status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--brand-accent);
  box-shadow: 0 0 0 3px rgba(47, 157, 95, 0.25);
}

.nav-foot {
  margin: 0;
  padding: 0.35rem 0.35rem 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
}

/* —— App body —— */
.app-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  margin-left: var(--nav-w);
  background:
    radial-gradient(ellipse 55% 40% at 100% 0%, rgba(47, 157, 95, 0.1), transparent 55%),
    var(--canvas);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--topbar-h);
  padding: 0.65rem 1.25rem;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid rgba(197, 202, 211, 0.85);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.topbar-titles h1 {
  margin: 0.05rem 0 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--grey-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-sub {
  margin: 0.15rem 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.topbar-sub[hidden] {
  display: none !important;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--grey-300);
  background: var(--white);
  color: var(--grey-700);
  cursor: pointer;
  border-radius: 0;
  padding: 0;
}

.icon-btn:hover {
  border-color: var(--brand-accent);
  color: var(--brand-accent-dark);
}

.icon-badge {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: #d4547a;
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.2rem 0.55rem 0.2rem 0.2rem;
  border: 1px solid var(--grey-300);
  background: var(--white);
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  background: var(--brand-accent-soft);
  color: var(--brand-accent-dark);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.8rem;
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.user-meta strong {
  font-size: 0.82rem;
  color: var(--grey-900);
}

.user-meta em {
  font-style: normal;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-accent-dark);
}

.live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--brand-accent);
  animation: pulse 2s ease infinite;
}

#fleet-filter-meta[hidden] {
  display: none !important;
}

.btn.ghost.topbar-back {
  margin: 0;
  flex-shrink: 0;
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
}

.eyebrow {
  margin: 0;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-accent);
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grey-700);
  border: 1px solid var(--grey-300);
  background: var(--white);
  padding: 0.28rem 0.65rem;
  flex-shrink: 0;
}

.live-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--brand-accent);
  animation: pulse 2s var(--ease) infinite;
}

main {
  flex: 1;
  min-height: 0;
  min-width: 0;
  padding: 1rem 1.25rem 1.5rem;
  overflow: auto;
}

/* Fleet: fill main; only the table scrolls (map stays fixed). */
main:has(#fleet:not([hidden])) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* display:grid/block must not defeat the hidden attribute */
.fleet-view[hidden],
.detail-view[hidden],
.ops-view[hidden] {
  display: none !important;
}

/* —— Fleet —— */
.fleet-view {
  display: flex;
  flex-direction: column;
  gap: 0;
  animation: rise 0.45s var(--ease) both;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.fleet-workspace {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  gap: 0.85rem;
}

.fleet-main {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  gap: 0.75rem;
}

.fleet-map-block {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.fleet-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  background: var(--white);
  border: 1px solid rgba(197, 202, 211, 0.85);
  box-shadow: var(--shadow-soft);
}

.fleet-bar-input {
  flex: 1 1 10rem;
  min-width: 9rem;
  height: 2.15rem;
  border: 1px solid var(--grey-300);
  padding: 0 0.65rem;
  font: inherit;
  font-size: 0.9rem;
  background: var(--white);
}

.fleet-bar-select {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  position: relative;
  min-width: 7.5rem;
}

.fleet-bar-select > span:first-child {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.fleet-bar-select select {
  height: 2.15rem;
  border: 1px solid var(--grey-300);
  padding: 0 0.5rem;
  font: inherit;
  font-size: 0.88rem;
  background: var(--white);
}

.fleet-bar-count {
  position: absolute;
  top: 1.15rem;
  right: 0.4rem;
  min-width: 1.15rem;
  padding: 0.05rem 0.3rem;
  border-radius: 999px;
  background: var(--brand-accent);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}

.fleet-bar-count[hidden] {
  display: none !important;
}

.fleet-table-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  margin-bottom: 0.35rem;
}

.fleet-table-title-row h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.fleet-table-title-row h2 span {
  color: var(--text-muted);
  font-weight: 600;
}

.fleet-table-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.fleet-table-search {
  position: relative;
  display: block;
  min-width: 14rem;
  flex: 1 1 12rem;
  max-width: 22rem;
}

.fleet-table-search .filter-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.fleet-table-search #fleet-filter {
  width: 100%;
  min-width: 0;
  height: 2.15rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.9rem;
}

.columns-menu-wrap {
  position: relative;
}

.columns-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 30;
  min-width: 11.5rem;
  padding: 0.45rem 0;
  background: var(--white);
  border: 1px solid var(--grey-300);
  box-shadow: var(--shadow);
}

.columns-menu[hidden] {
  display: none !important;
}

.columns-menu-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}

.columns-menu-item:hover {
  background: var(--brand-accent-soft);
}

.columns-menu-item.is-locked {
  opacity: 0.65;
  cursor: default;
}

.columns-menu-item input {
  accent-color: var(--brand-accent);
}

.fleet-drawer-backdrop {
  display: none;
}

.fleet-drawer-backdrop[hidden] {
  display: none !important;
}

.fleet-drawer-grab {
  display: none;
}

.fleet-drawer {
  flex: 0 0 24rem;
  width: 24rem;
  max-width: 42%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid rgba(197, 202, 211, 0.85);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  animation: rise 0.3s var(--ease) both;
}

.fleet-drawer[hidden] {
  display: none !important;
}

.fleet-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem 0.55rem;
  border-bottom: 1px solid var(--grey-100);
  flex-shrink: 0;
  position: relative;
}

.fleet-drawer-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.fleet-drawer-titles h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--grey-900);
  word-break: break-word;
}

.drawer-live {
  margin: 0.35rem 0 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-accent-dark);
}

.drawer-live em {
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
  margin-left: 0.25rem;
}

.drawer-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  padding: 0.35rem 0.65rem 0;
  border-bottom: 1px solid var(--grey-100);
  flex-shrink: 0;
}

.drawer-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.45rem 0.55rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.drawer-tab.is-on {
  color: var(--brand-accent-dark);
  border-bottom-color: var(--brand-accent);
}

.fleet-drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.fleet-drawer-body[hidden] {
  display: none !important;
}

.fleet-drawer-meta {
  padding: 0.75rem 1rem 0.5rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.fleet-drawer-meta .meta-cell {
  padding: 0;
  border: 0;
}

.fleet-drawer-meta .meta-cell .k {
  font-size: 0.72rem;
}

.fleet-drawer-meta .meta-cell .v {
  font-size: 0.92rem;
}

.drawer-motion {
  padding: 0.5rem 1rem 0.75rem;
}

.drawer-motion-chart {
  min-height: 5.5rem;
}

.drawer-panel-copy {
  padding: 1rem;
  margin: 0;
}

.drawer-timeline {
  list-style: none;
  margin: 0;
  padding: 0.75rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.drawer-timeline-item {
  display: grid;
  grid-template-columns: 0.75rem 1fr;
  gap: 0.65rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--grey-100);
  position: relative;
}

.drawer-timeline-item:last-child {
  border-bottom: 0;
}

.drawer-timeline-dot {
  width: 0.55rem;
  height: 0.55rem;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: var(--brand-accent);
  box-shadow: 0 0 0 3px var(--brand-accent-soft);
}

.drawer-timeline-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.drawer-timeline-body strong {
  font-size: 0.92rem;
  color: var(--grey-900);
}

.drawer-timeline-body .muted {
  font-size: 0.78rem;
}

.drawer-timeline-when {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.drawer-notes {
  margin: 0.75rem 1rem 1rem;
  width: calc(100% - 2rem);
  border: 1px solid var(--grey-300);
  padding: 0.65rem;
  font: inherit;
  resize: vertical;
}

.fleet-drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--grey-100);
  margin-top: auto;
  flex-shrink: 0;
}


.panel {
  background: var(--white);
  border: 1px solid rgba(197, 202, 211, 0.85);
  box-shadow: var(--shadow-soft);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem 0.35rem;
}

.panel-head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--grey-900);
}

.fleet-overview {
  display: none;
}

.overview-stats {
  display: flex;
  flex-wrap: wrap;
  flex: 1 1 auto;
  gap: 0.5rem;
  min-width: 0;
  width: 100%;
}

.stat {
  min-width: 6.5rem;
  flex: 1 1 5.5rem;
  padding: 0.25rem 0.5rem;
  border-right: 1px solid var(--grey-100);
  background: transparent;
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
}

.stat:last-child {
  border-right: 0;
}

.stat b {
  display: block;
  font-family: var(--font-ui);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--grey-900);
  font-variant-numeric: tabular-nums;
}

.stat span {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0.12rem;
}

.overview-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}


.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-label {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

#fleet-filter {
  width: 100%;
  min-width: 12rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid rgba(197, 202, 211, 0.95);
  background: var(--white);
  font-family: var(--font-ui);
  font-size: 1rem;
}

#fleet-filter:focus {
  outline: 2px solid var(--brand-accent);
  outline-offset: 1px;
}

.filter-meta {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.map-panel {
  background: #e8edf1;
  border: 0;
  overflow: hidden;
  min-height: 0;
}

/* Fixed map — stays put while the table panel scrolls. */
.fleet-map {
  flex: 0 0 auto;
  flex-shrink: 0;
  height: 420px;
  min-height: 420px;
  max-height: 420px;
  border: 1px solid rgba(197, 202, 211, 0.85);
  box-shadow: var(--shadow-soft);
}

.fleet-map #map {
  height: 100%;
  min-height: 100%;
}

#map {
  width: 100%;
  height: 100%;
  background: #e8edf1;
}

.leaflet-container { font-family: var(--font); }

.fleet-tooltip {
  font-family: var(--font);
  font-size: 0.88rem;
  line-height: 1.35;
  padding: 0;
  border: 1px solid rgba(197, 202, 211, 0.95);
  box-shadow: var(--shadow-soft);
  background: var(--white);
  color: var(--text);
  border-radius: 0;
}

.fleet-tooltip::before {
  border-top-color: var(--white);
}

.map-tip {
  padding: 0.45rem 0.55rem;
  min-width: 10rem;
  max-width: 16rem;
}

.map-tip strong {
  display: block;
  color: var(--grey-900);
  margin-bottom: 0.15rem;
}

.map-tip .mono {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.map-tip .muted {
  margin-top: 0.25rem;
  font-size: 0.78rem;
  white-space: normal;
}

/* —— Fleet table (tabbed) —— */
.fleet-table-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.fleet-table-panel .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  background: #f3f5f7;
  padding: 0;
}

#fleet-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef1f4;
}

.fleet-panel-head {
  flex-shrink: 0;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  padding-bottom: 0;
  border-bottom: 1px solid var(--grey-100);
}

.fleet-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  width: 100%;
}

.fleet-tab {
  appearance: none;
  border: 0;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  padding: 0.55rem 0.75rem 0.65rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.fleet-tab:hover {
  color: var(--grey-900);
}

.fleet-tab[aria-selected="true"] {
  color: var(--brand-accent-dark);
  border-bottom-color: var(--brand-accent);
}

.fleet-tab-count {
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 1.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--grey-100);
  color: var(--grey-700);
  font-variant-numeric: tabular-nums;
}

.fleet-tab[aria-selected="true"] .fleet-tab-count {
  background: var(--brand-accent-soft);
  color: var(--brand-accent-dark);
}

.fleet-tab-lede {
  flex-shrink: 0;
  margin: 0;
  padding: 0.55rem 0.85rem 0.15rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.fleet-pager {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem 0.65rem;
  background: var(--white);
  border-top: 1px solid var(--grey-300);
  box-shadow: 0 -4px 12px rgba(26, 28, 30, 0.04);
}

.fleet-pager[hidden] {
  display: none !important;
}

.fleet-pager-meta {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 7rem;
  text-align: center;
}

.fleet-pager .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.stat[data-fleet-tab] {
  cursor: pointer;
  border-radius: 0.35rem;
  padding: 0.15rem 0.35rem;
  margin: -0.15rem -0.35rem;
  transition: background 0.15s var(--ease);
}

.stat[data-fleet-tab]:hover,
.stat[data-fleet-tab].is-active {
  background: var(--brand-accent-soft);
}

.table-wrap {
  overflow-x: auto;
  padding: 0 0.35rem 0.5rem;
}

.fleet-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
  background: transparent;
}

.fleet-table th {
  text-align: left;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--grey-300);
  white-space: nowrap;
  background: #eef1f4;
}

.fleet-table td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid rgba(197, 202, 211, 0.55);
  color: var(--grey-900);
  vertical-align: middle;
  background: var(--white);
}

.fleet-table tbody tr {
  transition: background 0.15s var(--ease);
}

.fleet-table tbody tr:nth-child(even) td {
  background: #fafbfc;
}

#fleet-table tbody tr {
  cursor: pointer;
}

.fleet-table tbody tr:hover td,
.fleet-table tbody tr:focus-visible td {
  background: var(--brand-accent-soft);
  outline: none;
}

.fleet-table tbody tr.is-selected td {
  background: var(--brand-accent-soft);
}

.events-table tbody tr {
  cursor: default;
}

.events-actions {
  text-align: right;
  white-space: nowrap;
}

.fleet-table .events-actions .btn {
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
}

.timeline-block {
  margin-top: 0.25rem;
}

.fleet-table .addr-cell {
  max-width: 16rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.fleet-table .product-cell {
  max-width: 18rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.88rem;
  color: var(--grey-900);
}

/* Ship page: keep In transit table inside the card (no horizontal scroll). */
.ops-main .fleet-table-panel .table-wrap {
  overflow-x: hidden;
}

#shipped-table {
  table-layout: fixed;
  width: 100%;
}

#shipped-table th:nth-child(1),
#shipped-table td:nth-child(1) { width: 18%; }
#shipped-table th:nth-child(2),
#shipped-table td:nth-child(2) { width: 12%; }
#shipped-table th:nth-child(3),
#shipped-table td:nth-child(3) { width: 16%; }
#shipped-table th:nth-child(4),
#shipped-table td:nth-child(4),
#shipped-table th:nth-child(5),
#shipped-table td:nth-child(5) { width: 27%; }

#shipped-table .addr-cell,
#shipped-table td {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fleet-table-empty td {
  text-align: center;
  color: var(--text-muted);
  padding: 1.5rem;
  cursor: default;
}

.fleet-table-empty:hover td {
  background: var(--white) !important;
}

/* —— Detail —— */
.detail-view {
  animation: rise 0.4s var(--ease) both;
}

.detail-head {
  margin-bottom: 0.85rem;
}

.detail-head h1 {
  margin: 0.15rem 0 0.3rem;
  font-size: clamp(1.7rem, 3.5vw, 2.3rem);
  font-weight: 800;
  color: var(--grey-900);
}

.lede {
  margin: 0;
  max-width: 40rem;
  color: var(--text-muted);
  font-size: 1.02rem;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.75rem 0.9rem;
  background: var(--white);
  border: 1px solid rgba(197, 202, 211, 0.85);
  box-shadow: var(--shadow-soft);
}

.status-item {
  min-width: 6.5rem;
  padding: 0.25rem 0.5rem;
  border-right: 1px solid var(--grey-100);
}

.status-item:last-child { border-right: 0; }

.status-item .k {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.12rem;
}

.status-item .v {
  font-weight: 700;
  color: var(--grey-900);
  font-variant-numeric: tabular-nums;
}

.detail-main {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  align-items: stretch;
}

.detail-side {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.detail-map {
  border: 1px solid rgba(197, 202, 211, 0.85);
  box-shadow: var(--shadow-soft);
  height: 100%;
  min-height: 280px;
  align-self: stretch;
}

.detail-map #map {
  height: 100%;
  min-height: 280px;
}

.meta-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  align-content: start;
}

.meta-cell {
  padding: 0.5rem 0.65rem;
  background: var(--white);
  border: 1px solid rgba(197, 202, 211, 0.85);
  box-shadow: var(--shadow-soft);
}

.meta-cell .k {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.12rem;
}

.meta-cell .v {
  font-weight: 600;
  color: var(--grey-900);
  font-size: 0.88rem;
}

.charts-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.chart-card {
  background: var(--white);
  border: 1px solid rgba(197, 202, 211, 0.85);
  box-shadow: var(--shadow-soft);
  padding: 0.4rem 0.55rem 0.4rem;
}

.chart-head { margin-bottom: 0.15rem; }

.chart-card h2 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

h2 {
  margin: 0.1rem 0 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--grey-900);
}

.section-head.tight { margin-bottom: 0.7rem; }

.chart-canvas {
  width: 100%;
  height: 70px;
  overflow: hidden;
}

.chart-frame {
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  gap: 0.3rem;
  width: 100%;
  height: 100%;
  align-items: stretch;
}

.chart-ylabels {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  line-height: 1;
  padding: 0.1rem 0;
}

.chart-frame svg {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
}

.chart-empty {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.85rem;
}

.mono {
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
}

.muted {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 0.15rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border: 1px solid transparent;
  background: var(--grey-100);
  color: var(--grey-700);
}

.chip.ok {
  color: var(--brand-accent-dark);
  background: var(--brand-accent-soft);
  border-color: rgba(47, 157, 95, 0.28);
}

.chip.warn {
  color: #8a6800;
  background: rgba(184, 134, 11, 0.12);
  border-color: rgba(184, 134, 11, 0.3);
}

.chip.idle {
  color: var(--grey-700);
  background: var(--grey-100);
  border-color: var(--grey-300);
}

.chip.danger {
  color: var(--danger);
  background: rgba(201, 68, 68, 0.1);
  border-color: rgba(201, 68, 68, 0.28);
}

.chip.transit {
  color: #1d4ed8;
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
}

.batt-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.82rem;
}

.batt-ico {
  width: 1.15rem;
  height: 0.65rem;
  border: 1.5px solid currentColor;
  position: relative;
  display: inline-block;
}

.batt-ico::after {
  content: "";
  position: absolute;
  right: -3px;
  top: 1px;
  width: 2px;
  height: 4px;
  background: currentColor;
}

.batt-ico i {
  display: block;
  height: 100%;
  background: currentColor;
}

.batt-cell.ok { color: var(--brand-accent-dark); }
.batt-cell.warn { color: #b8860b; }
.batt-cell.danger { color: var(--danger); }

.meter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-ui);
  font-weight: 700;
}

.meter-track {
  flex: 1;
  height: 0.5rem;
  background: var(--grey-100);
  border: 1px solid var(--grey-300);
  overflow: hidden;
}

.meter-track i {
  display: block;
  height: 100%;
  background: var(--brand-accent);
}

.meter.warn .meter-track i { background: #d4a017; }
.meter.danger .meter-track i { background: var(--danger); }

.signal-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 0.15rem;
  height: 1rem;
}

.signal-bars i {
  display: block;
  width: 0.28rem;
  background: var(--grey-300);
}

.signal-bars i:nth-child(1) { height: 35%; }
.signal-bars i:nth-child(2) { height: 55%; }
.signal-bars i:nth-child(3) { height: 75%; }
.signal-bars i:nth-child(4) { height: 100%; }
.signal-bars i.on { background: var(--brand-accent); }
.signal-bars span {
  margin-left: 0.4rem;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--grey-800);
}

.map-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.map-popup-row {
  font-size: 0.88rem;
  margin-top: 0.15rem;
}

.leaflet-popup.fleet-popup .leaflet-popup-content-wrapper {
  border-radius: 0;
  box-shadow: var(--shadow);
}

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background-color: rgba(47, 157, 95, 0.25);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background-color: var(--brand-accent);
  color: #fff;
  font-family: var(--font-ui);
  font-weight: 700;
}

.tiny {
  font-size: 0.72rem;
}

.reel-id {
  font-size: 0.95rem;
}

.alerts-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.alert-row {
  display: grid;
  grid-template-columns: 8rem 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--grey-300);
  background: var(--white);
}

.alert-row.danger {
  border-color: rgba(201, 68, 68, 0.35);
  background: rgba(201, 68, 68, 0.05);
}

.alert-row.warn {
  border-color: rgba(184, 134, 11, 0.35);
  background: rgba(184, 134, 11, 0.06);
}

.placeholder-card {
  padding: 1.25rem 1.35rem;
  max-width: 48rem;
}

.empty-hint {
  margin: 0;
  padding: 1rem 0.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.btn {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid transparent;
  cursor: pointer;
  padding: 0.5rem 0.85rem;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.btn:hover { transform: translateY(-1px); }

.btn.ghost {
  color: var(--grey-900);
  background: var(--white);
  border-color: var(--grey-300);
}

.btn.ghost:hover {
  border-color: var(--brand-accent);
  background: var(--brand-accent-soft);
  color: var(--brand-accent-dark);
}

.btn.primary {
  color: #fff;
  background: var(--brand-accent);
  border-color: var(--brand-accent-dark);
  margin-top: 0.35rem;
}

.btn.primary:hover {
  background: var(--brand-accent-dark);
}

/* —— Provision / Assign ops pages —— */
.ops-view {
  animation: rise 0.4s var(--ease) both;
}

.ops-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 20rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  max-width: 1100px;
}

.ops-layout-wide {
  max-width: 1280px;
}

.ops-preview {
  margin: 0;
  padding: 0.65rem 0.75rem;
  box-sizing: border-box;
  background: #fafbfc;
  border: 1px solid rgba(197, 202, 211, 0.95);
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--grey-900);
  min-height: 2.75rem;
  display: flex;
  align-items: center;
}

.ops-rail {
  padding: 1.15rem 1.2rem 1.35rem;
  align-self: start;
}

.ops-rail-title {
  margin: 0.2rem 0 0.45rem;
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--grey-900);
}

.ops-rail-lede {
  margin: 0 0 1.1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.ops-rail-lede em {
  font-style: normal;
  font-weight: 700;
  color: var(--grey-900);
}

.ops-steps {
  list-style: none;
  margin: 0 0 1.15rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.ops-steps li {
  display: grid;
  grid-template-columns: 1.6rem 1fr;
  gap: 0.65rem;
  align-items: start;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.35;
}

.ops-steps a {
  color: var(--brand-accent-dark);
  font-weight: 700;
  text-decoration: none;
}

.ops-steps a:hover {
  text-decoration: underline;
}

.ops-step-n {
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--brand-accent-dark);
  background: var(--brand-accent-soft);
  border: 1px solid rgba(47, 157, 95, 0.28);
}

.ops-help-btn {
  width: 100%;
  margin: 0;
}

.ops-main {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
}

.ops-card {
  padding: 1.25rem 1.35rem 1.4rem;
}

.ops-card-head {
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--grey-100);
}

.ops-card-head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}

.ops-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}

.ops-field-full {
  grid-column: 1 / -1;
}

.ops-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid var(--grey-100);
}

.ops-actions .btn.primary {
  margin-top: 0;
  min-width: 11rem;
}

.ops-credentials {
  padding: 0;
  overflow: hidden;
}

.ops-credentials summary {
  cursor: pointer;
  list-style: none;
  padding: 0.75rem 1.1rem;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  user-select: none;
}

.ops-credentials summary::-webkit-details-marker { display: none; }

.ops-credentials summary::after {
  content: "+";
  float: right;
  font-weight: 700;
  color: var(--grey-500);
}

.ops-credentials[open] summary::after { content: "–"; }

.ops-credentials[open] summary {
  color: var(--grey-900);
  border-bottom: 1px solid var(--grey-100);
}

.ops-credentials-body {
  padding: 0.85rem 1.1rem 1.1rem;
}

.form-lede {
  margin: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field.check {
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-ui);
  font-weight: 600;
  letter-spacing: 0.04em;
  padding-top: 0.35rem;
}

.field-label {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field-label .optional {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  opacity: 0.85;
}

.field-hint {
  margin: 0.35rem 0 0;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field input[type="email"],
.field input[type="search"],
.field input[type="url"],
.field input:not([type]),
.field select {
  width: 100%;
  box-sizing: border-box;
  min-height: 2.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(197, 202, 211, 0.95);
  background: #fafbfc;
  font-family: var(--font);
  font-size: 0.95rem;
  line-height: 1.35;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.field input:hover,
.field select:hover {
  border-color: var(--grey-500);
}

.field input:focus,
.field select:focus {
  outline: 2px solid var(--brand-accent);
  outline-offset: 1px;
  background: var(--white);
}

.form-status {
  margin: 0;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.95rem;
}

.form-status.ok { color: var(--brand-accent-dark); }
.form-status.err { color: var(--danger); }

.token-once {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(47, 157, 95, 0.4);
  background:
    linear-gradient(135deg, rgba(47, 157, 95, 0.1), transparent 55%),
    var(--brand-accent-soft);
}

.token-warn {
  margin: 0 0 0.55rem;
  font-weight: 700;
  color: var(--brand-accent-dark);
  font-size: 0.92rem;
}

.token-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.token-row code {
  flex: 1;
  min-width: 0;
  word-break: break-all;
  background: var(--white);
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(197, 202, 211, 0.85);
  font-size: 0.82rem;
}

.token-row .btn {
  margin: 0;
  flex-shrink: 0;
}

.topbar-help {
  margin: 0;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
}

.topbar-help[hidden] {
  display: none !important;
}

/* —— Help modal —— */
.help-modal {
  border: 0;
  padding: 0;
  max-width: min(34rem, calc(100vw - 2rem));
  width: 100%;
  background: transparent;
}

.help-modal::backdrop {
  background: rgba(26, 28, 30, 0.55);
  backdrop-filter: blur(2px);
}

.help-modal-inner {
  background: var(--white);
  border: 1px solid rgba(197, 202, 211, 0.9);
  box-shadow: var(--shadow);
  animation: rise 0.25s var(--ease) both;
}

.help-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--grey-100);
}

.help-modal-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.help-modal-close {
  margin: 0;
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
}

.help-modal-body {
  padding: 1.1rem 1.2rem 1.35rem;
  color: var(--text);
  font-size: 0.95rem;
}

.help-modal-body p {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
}

.help-modal-body p:last-child {
  margin-bottom: 0;
}

.help-modal-body h3 {
  margin: 1rem 0 0.35rem;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-900);
}

.help-modal-body h3:first-child {
  margin-top: 0;
}

.help-modal-body ul {
  margin: 0 0 0.75rem;
  padding-left: 1.15rem;
  color: var(--text-muted);
}

.help-modal-body li {
  margin-bottom: 0.3rem;
}

.btn-map {
  flex-shrink: 0;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  padding: 0.35rem 0.55rem;
  color: var(--brand-accent-dark);
  background: var(--brand-accent-soft);
  border-color: rgba(47, 157, 95, 0.35);
}

.btn-map:hover {
  background: var(--brand-accent);
  border-color: var(--brand-accent);
  color: #fff;
}

code {
  font-size: 0.9em;
  background: var(--grey-100);
  padding: 0.1rem 0.35rem;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47, 157, 95, 0.45); }
  50% { box-shadow: 0 0 0 5px rgba(47, 157, 95, 0); }
}

@media (max-width: 1100px) {
  .fleet-workspace {
    flex-direction: column;
  }

  /* Bottom sheet overlay — not a short strip under the list. */
  .fleet-drawer-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(26, 28, 30, 0.45);
    -webkit-tap-highlight-color: transparent;
  }

  .fleet-drawer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    flex: none;
    width: 100%;
    max-width: none;
    height: min(92dvh, 100%);
    max-height: min(92dvh, 100%);
    z-index: 60;
    border: 0;
    border-radius: 1rem 1rem 0 0;
    box-shadow: 0 -12px 40px rgba(26, 28, 30, 0.22);
    animation: drawer-sheet-up 0.28s var(--ease) both;
  }

  .fleet-drawer-grab {
    display: block;
    position: absolute;
    top: 0.45rem;
    left: 50%;
    transform: translateX(-50%);
    width: 2.5rem;
    height: 0.28rem;
    border-radius: 999px;
    background: var(--grey-300);
  }

  .fleet-drawer-head {
    padding-top: 1.15rem;
  }

  .fleet-drawer-body {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  body.fleet-drawer-open {
    overflow: hidden;
  }

  body.fleet-drawer-open .app-body {
    overflow: hidden;
  }

  .fleet-map {
    height: 280px;
    min-height: 280px;
    max-height: 280px;
  }

  .stat {
    min-width: 45%;
    border-right: 0;
  }

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

  .ops-fields {
    grid-template-columns: 1fr;
  }
}

@keyframes drawer-sheet-up {
  from { transform: translateY(100%); opacity: 0.85; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 900px) {
  :root {
    --nav-w: 4.25rem;
  }

  .brand-text,
  .nav-item > span:not(.nav-icon):not(.nav-badge),
  .nav-foot,
  .nav-status {
    display: none;
  }

  .nav-badge {
    position: absolute;
    top: 0.2rem;
    right: 0.15rem;
    margin: 0;
    min-width: 0.95rem;
    padding: 0 0.2rem;
    font-size: 0.6rem;
  }

  .nav-item {
    position: relative;
  }

  .nav-brand {
    justify-content: center;
    padding: 0.35rem;
  }

  .nav-item {
    justify-content: center;
    padding: 0.75rem;
    border-left-width: 0;
    border-bottom: 3px solid transparent;
  }

  .nav-item[aria-current="page"] {
    border-bottom-color: var(--brand-accent);
  }

  .detail-main {
    grid-template-columns: 1fr;
  }

  .detail-map,
  .detail-map #map {
    min-height: 280px;
    height: 320px;
  }

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

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

  .status-item { border-right: 0; min-width: 45%; }

  .topbar {
    flex-wrap: wrap;
    height: auto;
  }

  .fleet-table-search {
    min-width: 100%;
    max-width: none;
    flex-basis: 100%;
  }

  /* Scroll the whole fleet (map → table); don't trap in nested panes. */
  main:has(#fleet:not([hidden])) {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .fleet-view,
  .fleet-workspace,
  .fleet-main {
    flex: 0 0 auto;
    min-height: auto;
    overflow: visible;
    height: auto;
  }

  .fleet-table-panel {
    flex: 0 0 auto;
    min-height: auto;
    overflow: visible;
  }

  .fleet-table-panel .table-wrap {
    flex: none;
    overflow: visible;
    max-height: none;
  }

  .fleet-map {
    height: 220px;
    min-height: 220px;
    max-height: 220px;
    touch-action: pan-y;
  }

  .fleet-map .leaflet-container {
    touch-action: pan-y;
  }

  .detail-map {
    touch-action: pan-y;
  }

  .detail-map .leaflet-container {
    touch-action: pan-y;
  }
}

@media (max-width: 600px) {
  :root {
    --nav-w: 0px;
  }

  html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .app-nav {
    position: sticky;
    top: 0;
    left: auto;
    bottom: auto;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 0.5rem 0.65rem;
    gap: 0.5rem;
    z-index: 40;
  }

  .app-body {
    margin-left: 0;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  main {
    overflow: visible;
  }

  main:has(#fleet:not([hidden])) {
    overflow: visible;
  }

  .nav-menu {
    flex-direction: row;
    flex: 1;
  }

  .nav-foot { display: none; }

  .brand-text { display: inline; font-size: 1rem; }

  .fleet-map {
    height: 200px;
    min-height: 200px;
    max-height: 200px;
  }
}
