.sidebar { overflow-y: auto; scrollbar-width: thin; }
.sidebar > * { flex-shrink: 0; }
.brand { margin-bottom: 20px; }
.workspace-switch { margin-bottom: 18px; }
.primary-nav { gap: 4px; width: 100%; }
.nav-group > summary { list-style: none; cursor: pointer; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-chevron { margin-left: auto; }
.nav-chevron svg { width: 12px; height: 12px; transition: transform .14s ease; }
.nav-group[open] > summary .nav-chevron svg { transform: rotate(90deg); }
.nav-group:has(.active) > summary { color: var(--violet); }
.nav-submenu { border-left: 1px solid var(--line); margin: 2px 0 8px 24px; padding-left: 8px; }
.nav-submenu .nav-link { padding: 9px 11px; font-size: 11px; }
.sidebar-bottom { padding-top: 18px; }
.sidebar-profile { margin-top: 8px; padding: 16px 0; }
.page-content { padding-top: 18px; }
.dashboard-toolbar { justify-content: flex-end; margin-bottom: 12px; }
.dashboard-toolbar .heading-actions { margin-left: auto; }
.dashboard-toolbar .date-label { display: flex; }
.page-card { min-width: 0; }
.section-toolbar { gap: 12px; flex-wrap: wrap; }
.table-actions, .form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.table-actions .text-button { white-space: nowrap; }
.management-search { max-width: 430px; margin: 0 0 20px; }
.management-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; max-width: 920px; }
.management-form label, .production-form input, .production-form select { min-width: 0; }
.management-form .form-message, .management-form .form-actions, .form-wide, .form-hint { grid-column: 1 / -1; }
.form-hint { color: var(--secondary); font-size: 11px; line-height: 1.7; }
.management-form fieldset { min-width: 0; margin: 0; padding: 15px; border: 1px solid var(--line); border-radius: 10px; }
.management-form legend { padding: 0 7px; font-size: 11px; font-weight: 700; }
.assignment-list { display: grid; gap: 7px; max-height: 240px; overflow-y: auto; }
.assignment-list label, .production-form .checkbox-label, .day-options label { display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 8px; }
.assignment-list small { display: block; margin-top: 4px; color: var(--muted); }
.assignment-picker { display: grid; gap: 4px; min-width: 0; }
.assignment-picker .assignment-select-all { display: flex; align-items: center; gap: 10px; padding: 8px; border-bottom: 1px solid var(--line); color: var(--ink); }
.assignment-picker .assignment-select-all small { margin-left: auto; color: var(--secondary); font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.assignment-picker .assignment-list { max-height: min(320px, 45dvh); }
.assignment-picker .assignment-search { width: 100%; min-width: 0; }
.assignment-picker .assignment-empty { margin: 0; padding: 8px; color: var(--secondary); font-size: var(--text-body); }
.table-actions .text-button .icon { display: inline-block; width: 13px; height: 13px; margin-left: 3px; vertical-align: -2px; }
.geofence-details-form { grid-template-columns: minmax(0,1fr); }
.geofence-schedule { margin-top: 6px; color: var(--secondary); font-size: var(--text-small); line-height: 1.5; }
.geofence-schedule.is-inactive { color: #a42d42; }
/* Sits just under the card's access line; the negative margin collapses with that line's 20px. */
.geofence-card .geofence-schedule { margin: -12px 0 20px; }
.app-dialog .management-search { max-width: none; margin: 0 0 6px; }

/* Place search in the geofence editor */
.geofence-search { display: flex; gap: 8px; margin-bottom: 10px; }
.geofence-search input { flex: 1; min-width: 0; min-height: 38px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); color: var(--ink); font-size: var(--text-body); }
.geofence-search .button .icon { width: 15px; height: 15px; }
.geofence-place-results { margin: 0 0 10px; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.geofence-place-results ul { list-style: none; margin: 0; padding: 4px; }
.geofence-place-results li button { display: block; width: 100%; padding: 9px 10px; border-radius: 7px; text-align: left; line-height: 1.45; color: var(--ink); font-size: var(--text-body); }
.geofence-place-results li button:hover, .geofence-place-results li button:focus-visible { background: var(--violet-soft); color: var(--violet); }
.geofence-place-results > p { margin: 0; padding: 10px 12px; }

/* Drawing a new geofence on the live map */
.map-draw-panel { position: absolute; z-index: 470; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(420px, calc(100% - 110px)); display: grid; gap: 10px; padding: 14px; border: 1px solid #e3dcef; border-radius: 14px; background: #fffffff7; color: var(--ink); box-shadow: 0 10px 30px #2e154522; }
.map-draw-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.map-draw-heading strong { font-size: var(--text-title); overflow-wrap: anywhere; }
.map-draw-heading .icon-button { width: 32px; height: 32px; }
.map-draw-shapes { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; padding: 4px; border-radius: 9px; background: var(--surface-soft); }
.map-draw-shapes button { min-height: 34px; border-radius: 7px; color: var(--secondary); font-size: var(--text-body); font-weight: 600; }
.map-draw-shapes button[aria-pressed="true"] { background: var(--violet); color: #fff; }
.map-draw-radius { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--secondary); font-size: var(--text-body); }
.map-draw-radius input { width: 120px; min-height: 34px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: var(--text-body); }
.map-draw-hint { margin: 0; color: var(--secondary); font-size: var(--text-body); line-height: 1.5; }
.map-draw-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.map-draw-actions [data-draw="next"] { margin-left: auto; }
/* Geofence "G" markers on the live map, and the details they open */
.geofence-map-marker { background: none; border: 0; }
.geofence-map-marker svg { display: block; overflow: visible; filter: drop-shadow(0 2px 3px #2e154540); }
.geofence-map-marker path { fill: var(--violet); stroke: #fff; stroke-width: 2; }
.geofence-map-marker text { fill: #fff; font: 700 13px/1 var(--font-ui); }
.geofence-map-marker:hover path, .geofence-map-marker:focus-visible path { fill: var(--violet-dark); }
.geofence-map-marker:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; border-radius: 6px; }
.geofence-detail-grid { margin-bottom: 14px; }
.geofence-detail-manage { margin-top: 14px; }
.geofence-detail-actions { flex-wrap: wrap; }
.geofence-drawing #fleet-map { cursor: crosshair; }
/* Clicks on vehicles place points instead of opening their popups. */
.geofence-drawing #fleet-map .leaflet-marker-icon { pointer-events: none; }
.geofence-drawing .map-legend { display: none; }

/* A user's panel opened by a super admin */
.user-panel-banner { display: flex; flex: none; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; padding: 7px 16px; background: #2f2455; color: #fff; font-size: var(--text-small); line-height: 1.4; text-align: center; }
.user-panel-banner .icon { width: 15px; height: 15px; }
.user-panel-banner strong { color: #fff; }
.user-panel-banner .text-button { color: #fff; font-size: var(--text-small); text-decoration: underline; }
.production-form input[type=checkbox] { appearance: auto; width: 17px; height: 17px; min-height: 0; padding: 0; accent-color: var(--violet); flex-shrink: 0; }
.day-options { display: flex; flex-wrap: wrap; gap: 7px; }
.all-menus { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.all-menus > .nav-link { grid-column: 1 / -1; }
.menu-section { min-width: 0; padding: 12px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 12px; }
.menu-section h3 { padding: 5px 10px 10px; font-size: 12px; }
.menu-section .nav-link { font-size: 11px; padding: 10px; }
.icon-settings-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(210px,1fr)); gap: 18px; }
.icon-setting { padding: 18px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.vehicle-icon-preview { display: grid; place-items: center; height: 72px; background: var(--surface-soft); border-radius: 9px; }
.vehicle-icon-preview img { width: 80px; height: 60px; object-fit: contain; }
.vehicle-icon-preview .icon { width: 40px; height: 40px; color: var(--violet); }
.custom-vehicle-icon { width: 27px; height: 27px; object-fit: contain; }
.token-label { display: grid; gap: 9px; margin: 16px 0; }
.token-label input { width: 100%; min-width: 0; padding: 12px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; }
.geofence-editor-wrap { grid-column: 1 / -1; min-width: 0; }
.geofence-editor-map { height: 330px; border: 1px solid var(--line); border-radius: 12px; z-index: 0; }
.geofence-editor-wrap .form-actions { margin-top: 12px; }
#geofence-radius-label { max-width: 145px; }
#geofence-points { color: var(--secondary); font-size: 11px; }
.geofence-card .table-actions { margin-top: 15px; }
.report-form { display: grid; grid-template-columns: repeat(auto-fit,minmax(145px,1fr)); }
.report-form label { min-width: 0; }
@media (min-width: 761px) and (max-width: 1100px) {
  :root { --sidebar: 200px; }
  .sidebar { align-items: stretch; padding-left: 12px; padding-right: 12px; }
  .sidebar .brand-wordmark { display: block; font-size: 21px; }
  .sidebar .nav-link > span:not(:first-child) { display: inline-flex; }
  .sidebar .nav-link { justify-content: flex-start; gap: 10px; }
  .sidebar .brand { margin-left: 8px; }
  .sidebar .primary-nav { width: 100%; }
}
@media (max-width:760px), (max-width:1024px) and (max-height:500px) {
  .secondary-view, .page-card, #report-output { min-width: 0; width: 100%; max-width: 100%; }
  .section-toolbar, .section-toolbar > *, .management-search { min-width: 0; max-width: 100%; }
  .section-toolbar h2, .form-hint, .report-note, .form-message { overflow-wrap: anywhere; }
  .dialog-heading > div, .detail-grid > div { min-width: 0; }
  .detail-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #dialog-title, .detail-grid strong, .vehicle-registration { overflow-wrap: anywhere; }
  .table-scroll { width: 100%; min-width: 0; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 10px; scrollbar-width: thin; scrollbar-color: #cfc5d9 #f5f2f8; }
  .table-scroll:focus-visible { outline-offset: -2px; }
  .table-scroll table { min-width: 100%; width: max-content; }
  .table-scroll th, .table-scroll td { padding: 13px 12px; }
  .management-form input, .management-form select, .management-form textarea, .report-form input, .report-form select { width: 100%; min-width: 0; max-width: 100%; }
  .management-form input[type=checkbox] { width: 17px; }
  .page-card .table-actions { gap: 9px; }
  .dashboard-toolbar { margin-bottom: 12px; }
  .page-heading:not(.dashboard-toolbar) { align-items: flex-start; }
  .page-heading:not(.dashboard-toolbar) .date-label { display: none; }
  .management-form { grid-template-columns: minmax(0,1fr); }
  .all-menus .nav-link > span { display: inline-flex; }
  .all-menus .nav-link { justify-content: flex-start; }
  .geofence-editor-map { height: 280px; }
  .map-draw-panel { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); width: auto; transform: none; }
  .icon-settings-grid { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 380px) {
  .all-menus { grid-template-columns: minmax(0,1fr); }
  .heading-actions { gap: 10px; }
}
