:root {
  /* Navy of the logo. */
  --brand: #00005f;
  --brand-hover: #1a1a8c;
  --brand-bg: #e8e8f5;
  --bg: #f4f5f8;
  --surface: #ffffff;
  --border: #d9dce3;
  --text: #14162b;
  --text-2: #555a6e;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --radius: 10px;
  /* Statuses of the dashboard, in blues, the darker the more pressing: arc colour, then the darker one used for text. */
  --ok: #a9c4ee;
  --ok-text: #3d66a8;
  --soon: #4a7bd8;
  --soon-text: #2f5cb8;
  --late: #00005f;
  --green: #15803d;
  --green-bg: #dcfce7;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

h1 {
  margin: 0 0 16px;
  font-size: 1.375rem;
  line-height: 1.25;
}

p {
  margin: 0 0 12px;
}

a {
  color: var(--brand);
}

[hidden] {
  display: none !important;
}

.noscript {
  margin: 48px auto;
  text-align: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--brand);
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Screens shown without a session */

.auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  min-height: 100vh;
  padding: 12vh 16px 32px;
}

.card {
  width: 100%;
  max-width: 400px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.field {
  margin-bottom: 16px;
}

/* Label above its input, the hint on the right of the label. */
.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.field label {
  font-weight: 600;
}

.label-row .hint {
  margin: 0;
  font-size: 0.8125rem;
  text-align: right;
}

.field input,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: inherit;
  font: inherit;
}

.field input:focus-visible,
.field textarea:focus-visible,
.btn:focus-visible,
a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.hint {
  margin: 4px 0 0;
  color: var(--text-2);
  font-size: 0.875rem;
}

.notice {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 0.9375rem;
}

.notice.error {
  background: var(--red-bg);
  color: var(--red);
}

.notice.ok {
  background: var(--green-bg);
  color: var(--green);
}

/* Something under way (a report read driver after driver) */
.notice.info {
  background: var(--brand-bg);
  color: var(--brand);
}

.btn {
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

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

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn.quiet {
  padding: 6px 12px;
  background: transparent;
  color: var(--brand);
  font-weight: 500;
}

.btn.quiet:hover {
  background: var(--brand-bg);
}

form .btn {
  width: 100%;
}


.alt {
  margin: 16px 0 0;
  font-size: 0.9375rem;
  text-align: center;
}

/* Signed-in shell: menu on the left, bar on top */

.icon {
  flex: none;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.shell.small {
  grid-template-columns: 62px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden auto;
  background:
    var(--brand)
    url("img/sidebar.webp")
    center / cover no-repeat;
  color: #fff;
}

.sidebar .brand {
  padding: 14px 16px;
  color: #fff;
  font-size: 1.125rem;
  white-space: nowrap;
}

/* The logo is drawn in the brand colour. */
.sidebar .brand img {
  filter: brightness(0) invert(1);
}

.sidebar nav {
  flex: 1;
  padding: 8px;
}

.sidebar nav a,
.sidebar .fold {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: #d5d5ee;
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.sidebar nav a:hover,
.sidebar .fold:hover,
.sidebar nav a[aria-current] {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.sidebar a:focus-visible,
.sidebar .fold:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -2px;
}

.sidebar .fold {
  margin: 8px;
  width: auto;
}

/* Entry with screens of its own (sub in modules.js): a button opens their list under it */
.menu-head {
  display: flex;
  align-items: center;
  gap: 2px;
}

.menu-head .has-sub {
  flex: 1;
  min-width: 0;
}

.sub-toggle {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: #d5d5ee;
  cursor: pointer;
}

.sub-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.sub-toggle .icon {
  width: 16px;
  height: 16px;
  transition: transform 0.15s;
}

.sub-toggle[aria-expanded="true"] .icon {
  transform: rotate(90deg);
}

.sidebar .sub {
  margin: 2px 0 4px;
  padding: 0 0 0 26px;
  list-style: none;
}

.menu-head:has(.sub-toggle[aria-expanded="false"]) + .sub {
  display: none;
}

.sidebar .sub a {
  padding: 6px 12px;
  font-size: 0.875rem;
}

/* The module is marked by its screen when the list is open */
.menu-head:has(.sub-toggle[aria-expanded="true"]) .has-sub[aria-current] {
  background: none;
}

.crumb {
  color: var(--text-2);
  font-weight: 500;
}

@media (min-width: 768px) {
  .shell.small .sub-toggle,
  .shell.small .sidebar .sub {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sub-toggle .icon {
    transition: none;
  }
}

.shell.small .sidebar .label {
  display: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 12px;
  min-height: 56px;
  padding: 8px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar .burger {
  display: none;
  margin-right: auto;
  padding: 6px;
}


.page {
  padding: 24px 20px;
}

.scrim {
  display: none;
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: 240px;
    transform: translateX(-100%);
    transition: transform 0.15s ease-out;
  }

  .shell.menu-open .sidebar {
    transform: none;
  }

  .shell.menu-open .scrim {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: block;
    border: 0;
    background: rgba(0, 0, 20, 0.45);
  }

  /* On a phone the menu is a drawer: always with its texts, opened by the bar. */
  .shell.small .sidebar .label {
    display: inline;
  }

  .sidebar .fold {
    display: none;
  }

  .topbar {
    padding: 8px 12px;
  }

  .topbar .burger {
    display: inline-flex;
  }

  .page {
    padding: 16px 12px;
  }

}

@media (prefers-reduced-motion: reduce) {
  .sidebar {
    transition: none;
  }
}

/* Filterable list (assets/js/lib.combobox.js) */

.custSelectWrapper {
  position: relative;
  display: inline-block;
  max-width: 100%;
  font-size: 0.875rem;
}

.custSelectWrapper summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 180px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  list-style: none;
  cursor: pointer;
}

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

.custSelectWrapper summary::after {
  content: "\25be";
  margin-left: auto;
  color: var(--text-2);
}

.custSelectWrapper summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.custSelectWrapper input {
  display: none;
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

.custSelectWrapper span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custSelectWrapper[open] input {
  display: block;
}

.custSelectWrapper[open] span {
  display: none;
}

.custSelectWrapper ul {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 40;
  min-width: 100%;
  max-width: 90vw;
  max-height: 50vh;
  margin: 4px 0 0;
  padding: 4px 0;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 6px 16px rgba(0, 0, 40, 0.18);
  list-style: none;
}

.custSelectWrapper li {
  padding: 6px 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.custSelectWrapper li:hover,
.custSelectWrapper li[data-selected="true"] {
  background: var(--brand-bg);
  color: var(--brand);
}

/* Dashboard */

.widgets {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 16px;
}

.widget {
  flex: 1 1 250px;
  max-width: 380px;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.widget[aria-busy] {
  min-height: 280px;
  opacity: 0.5;
}

.widget h2 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.25;
}

.widget .sub {
  margin: 0 0 8px;
  color: var(--text-2);
  font-size: 0.875rem;
}

.widget.overview {
  flex: 0 1 130px;
  padding: 20px 12px;
}

.widget.overview h2 {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
}

.count {
  margin: 14px 0 0;
  font-size: 0.875rem;
}

.count .icon {
  display: block;
  width: 26px;
  height: 26px;
  margin: 0 auto 2px;
  color: var(--soon);
}

.count strong {
  display: block;
  font-size: 1.75rem;
  line-height: 1.1;
}

.gauge {
  display: block;
  width: 100%;
  max-width: 220px;
  margin: 0 auto 12px;
}

.gauge path {
  fill: none;
  stroke-width: 30;
  stroke: var(--border);
}

.gauge .ok {
  stroke: var(--ok);
}

.gauge .soon {
  stroke: var(--soon);
}

.gauge .late {
  stroke: var(--late);
}

.statuses {
  margin: 0;
  padding: 0;
  list-style: none;
}

.statuses li {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  padding: 5px 10px;
  border: 2px solid var(--border);
  border-radius: 4px;
  color: var(--text-2);
  font-size: 0.875rem;
}

.statuses .ok {
  border-color: var(--ok);
  color: var(--ok-text);
}

.statuses .soon {
  border-color: var(--soon);
  color: var(--soon-text);
}

.statuses .late {
  border-color: var(--late);
  color: var(--late);
}

.statuses .late.some {
  background: var(--late);
  color: #fff;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 16px;
}

.page-head h1 {
  margin: 0;
}

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

/* Every button of the head of a page has the size of a quiet one, whatever it does */
.actions .btn {
  padding: 6px 12px;
}

.widget-tools {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin: -8px 0 12px;
}

.widget-tools .btn {
  min-width: 32px;
  padding: 2px 8px;
}

.hidden-widgets {
  margin-top: 24px;
}

.hidden-widgets h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.hidden-widgets li {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.hidden-widgets ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Map of the vehicles: a row of its own */

.widget.fleet-map {
  flex: 1 1 100%;
  max-width: none;
}

.map {
  height: 420px;
  margin-top: 12px;
  border-radius: 6px;
  overflow: hidden;
  text-align: left;
}

.map-bubble {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text);
  font-size: 0.875rem;
}

.statuses .unknown.some {
  border-color: var(--border);
}

/* A gauge drawn again when its figures change does not sweep in a second time */
.arriving .gauge.drawn path {
  stroke-dasharray: none;
  animation: none;
}

@media (max-width: 767px) {
  .map {
    height: 320px;
  }

  .widget,
  .widget.overview {
    flex: 1 1 100%;
    max-width: none;
  }
}

/* Panels opened by a button (popup.js): language, account */

.popup {
  position: relative;
  display: inline-block;
}

.popup-panel {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 40;
  min-width: 190px;
  margin-top: 6px;
  padding: 6px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 6px 16px rgba(0, 0, 40, 0.18);
  text-align: left;
}

.popup-panel a,
.popup-panel button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 16px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.popup-panel a:hover,
.popup-panel button:hover,
.popup-panel [aria-current] {
  background: var(--brand-bg);
}

.popup-panel a:focus-visible,
.popup-panel button:focus-visible,
.flag:focus-visible,
.avatar:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.popup-panel .danger {
  color: var(--red);
}

.popup-panel .danger:hover {
  background: var(--red-bg);
}

/* Flags are emoji: a font that has them, whatever the text font. */
.flag {
  font-family: 'Twemoji Mozilla', 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  font-size: 1.25rem;
  line-height: 1;
}

button.flag {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}

/* Under the card of the screens without a session: the list opens centred. */
.auth .popup-panel {
  right: 50%;
  transform: translateX(50%);
}

.avatar {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
}

.identity {
  display: flex;
  flex-direction: column;
  max-width: 260px;
  padding: 8px 16px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.identity strong,
.identity span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity span {
  color: var(--text-2);
  font-size: 0.875rem;
}

.account .danger {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.narrow {
  max-width: 720px;
}

.page h2 {
  margin: 24px 0 12px;
  font-size: 1.0625rem;
}

/* Lists: filter, counters, table, pages */

.list-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.filter {
  flex: 1 1 260px;
  max-width: 480px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: inherit;
  font: inherit;
}

.filter:focus-visible,
.chip:focus-visible,
.list th button:focus-visible,
.pager select:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 5px 10px;
  border: 2px solid transparent;
  border-radius: 6px;
  color: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  opacity: 0.6;
}

.chip[aria-pressed="true"] {
  border-color: var(--text);
  opacity: 1;
}

.chip.all {
  background: #1d4ed8;
}

.chip.late {
  background: #b45309;
}

.chip.expired {
  background: var(--red);
}

.chip.ok {
  background: var(--green);
}

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

.list {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  white-space: nowrap;
}

.list th,
.list td {
  padding: 10px 14px;
  text-align: left;
}

.list th {
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.list th button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.list th[aria-sort="ascending"] button::after {
  content: " \25b2";
  font-size: 0.7em;
}

.list th[aria-sort="descending"] button::after {
  content: " \25bc";
  font-size: 0.7em;
}

.list tbody tr:nth-child(odd) {
  background: var(--bg);
}

/* The line pointed at, with a mouse only (a finger would leave it lit); not the one that says the list is empty */
@media (hover: hover) {
  .list tbody tr:hover:not(:has(.empty)) {
    background: var(--brand-bg);
  }
}

.list small {
  color: var(--text-2);
  font-size: 0.875em;
}

.list .late {
  color: var(--red);
}

.list .empty {
  padding: 24px;
  color: var(--text-2);
  text-align: center;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px 10px;
  margin-top: 10px;
  color: var(--text-2);
  font-size: 0.875rem;
}

.pager select {
  padding: 3px 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: inherit;
  font: inherit;
}

.pager .btn {
  min-width: 32px;
  padding: 2px 8px;
}

.chip.active {
  background: #0f766e;
}

.chip.inactive {
  background: #6b7280;
}

.list select,
.period input {
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: inherit;
  font: inherit;
}

.icon-link {
  display: inline-flex;
  padding: 4px;
  border-radius: 6px;
  color: var(--brand);
}

.icon-link:hover {
  background: var(--brand-bg);
}

button.icon-link {
  border: 0;
  background: none;
  font: inherit;
}

.icon-link:disabled {
  color: var(--text-2);
  opacity: .45;
  cursor: not-allowed;
}

.btn .icon {
  width: 18px;
  height: 18px;
  margin-right: 6px;
  vertical-align: -3px;
}

.burger .icon {
  margin-right: 0;
}

/* Vehicles / drivers switch of the files */

.tabs {
  display: inline-flex;
  border: 1px solid var(--brand);
  border-radius: 6px;
  overflow: hidden;
}

.tabs a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}

.tabs a[aria-current] {
  background: var(--brand);
  color: #fff;
}

.period,
.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9375rem;
}

.list .number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Forms: framed groups, their title on the frame */

.group {
  min-width: 0;
  margin: 18px 0 0;
  padding: 16px 16px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.group legend {
  padding: 3px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-2);
  font-weight: 700;
}

.group .field:last-of-type {
  margin-bottom: 14px;
}

.group form .btn,
form .group .btn {
  width: auto;
}

/* Settings of the legal entities */

.cards {
  display: grid;
  grid-template-columns: minmax(0, 720px);
  gap: 8px;
}

.entity h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 0;
  font-size: 1.25rem;
}

.entity h2 .icon {
  color: var(--soon);
}

/* Lines "label: value": one per row, ruled. */
.facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  margin: 0;
}

.facts dt,
.facts dd {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.facts dt {
  color: var(--text-2);
}

.facts dd {
  justify-content: flex-end;
  padding-left: 24px;
  overflow-wrap: break-word;
  font-weight: 700;
  text-align: right;
}

.facts dt:last-of-type,
.facts dd:last-of-type {
  border-bottom: 0;
}

/* Values as long as a sentence: the label keeps its width, the value wraps. */
.facts.long {
  grid-template-columns: minmax(8em, max-content) minmax(0, 1fr);
}

.group .field {
  margin-bottom: 22px;
}

/* On/off settings (toggle() of parts.js) */

.switch {
  position: relative;
  flex: none;
  width: 42px;
  height: 24px;
  margin: 0;
  border-radius: 12px;
  background: #c5c9e6;
  appearance: none;
  cursor: pointer;
  transition: background 0.15s;
}

.switch::before {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 20, 0.35);
  content: "";
  transition: transform 0.15s;
}

.switch:checked {
  background: var(--brand);
}

.switch:checked::before {
  transform: translateX(18px);
}

.switch:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.switch:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .switch,
  .switch::before {
    transition: none;
  }
}

/* Slider: the value is written on the right of its label. */
.field input[type="range"] {
  padding: 0;
  border: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.label-row output strong {
  color: var(--text);
}

/* Long text of a cell: one line, cut with an ellipsis. */
.list .clip {
  display: block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Status shown as an icon (status.js) */

.status {
  display: inline-flex;
  color: var(--brand);
}

.status.inactive,
.status.retired {
  color: #8a8fa3;
}

.status-button {
  display: inline-flex;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}

.status-button:hover {
  background: var(--brand-bg);
}

.status-button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Activities: one line of 24 hours per day */

:root {
  /* Activities, in the usual colours, pastel: fill, then the darker one used for figures. */
  --driving: #f4a6a6;
  --driving-text: #b83a3a;
  --work: #a5c3f0;
  --work-text: #2f5cb8;
  --availability: #f7cb8f;
  --availability-text: #a9650c;
  --rest: #a9dbb3;
  --rest-text: #2e7d46;
}

.chooser {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 260px;
}

.chooser .icon {
  color: var(--soon);
}

.period-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.period-nav .btn {
  padding: 5px 10px;
}

.period-label {
  min-width: 170px;
  text-align: center;
}

.tabs button {
  padding: 6px 14px;
  border: 0;
  background: none;
  color: var(--brand);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.tabs button[aria-pressed="true"] {
  background: var(--brand);
  color: #fff;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-bottom: 10px;
  color: var(--text-2);
  font-size: 0.875rem;
}

.legend span::before {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border-radius: 3px;
  background: currentColor;
  content: "";
  vertical-align: -1px;
}

.legend .driving::before {
  color: var(--driving);
}

.legend .work::before {
  color: var(--work);
}

.total.driving strong {
  color: var(--driving-text);
}

.total.work strong {
  color: var(--work-text);
}

.total.availability strong {
  color: var(--availability-text);
}

.total.rest strong {
  color: var(--rest-text);
}

.legend .availability::before {
  color: var(--availability);
}

.legend .rest::before {
  color: var(--rest);
}

.timeline {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 6px 12px;
  align-items: center;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.hours {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  color: var(--text-2);
  font-size: 0.75rem;
}

.hours span {
  border-left: 1px solid var(--border);
  padding-left: 3px;
}

/* A day is a button: a click opens its detail under the lines. */
button.day-name {
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

button.day-name:hover {
  background: var(--brand-bg);
}

button.day-name[aria-pressed="true"] {
  background: var(--brand);
  color: #fff;
}

button.day-name[aria-pressed="true"] small {
  color: #d5d5ee;
}

button.day-name:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.day-name strong,
.day-name small {
  display: block;
  text-transform: capitalize;
}

.day-name small {
  color: var(--text-2);
}

.day-track {
  display: block;
  width: 100%;
  height: 28px;
  border-radius: 4px;
  background: var(--bg);
}

.day-track.picked {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.day-track {
  cursor: pointer;
}

/* Opened inside the lines, under its day, over their whole width. */
.day-detail {
  grid-column: 1 / -1;
  margin: 4px 0 12px;
  padding: 12px;
  border: 2px solid var(--brand);
  border-radius: 8px;
  background: var(--bg);
}

.day-detail h2 {
  margin: 0 0 8px;
  font-size: 1.125rem;
}

.day-detail h2::first-letter {
  text-transform: uppercase;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
}

.dot.driving {
  background: var(--driving);
}

.dot.work {
  background: var(--work);
}

.dot.availability {
  background: var(--availability);
}

.dot.rest {
  background: var(--rest);
}

.day-track .driving {
  fill: var(--driving);
}

.day-track .work {
  fill: var(--work);
}

.day-track .availability {
  fill: var(--availability);
}

.day-track .rest {
  fill: var(--rest);
}

.totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.total {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.total-name {
  display: block;
  color: var(--text-2);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.total strong {
  display: block;
  font-size: 1.75rem;
  line-height: 1.3;
}

.total small {
  color: var(--text-2);
}

@media (max-width: 767px) {
  .timeline {
    grid-template-columns: 64px minmax(0, 1fr);
    padding: 10px;
  }

  .hours span:nth-child(odd) {
    font-size: 0;
  }
}

/* Stretch under the pointer: its full colour, and a panel that follows the pointer. */
.day-track .driving:hover {
  fill: var(--driving-text);
}

.day-track .work:hover {
  fill: var(--work-text);
}

.day-track .availability:hover {
  fill: var(--availability-text);
}

.day-track .rest:hover {
  fill: var(--rest-text);
}

.tip {
  position: fixed;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  font-size: 0.875rem;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 6px 16px rgba(0, 0, 40, 0.25);
}

.tip strong {
  display: flex;
  align-items: center;
}

/* Question asked over the page (dialog.js) */

.ask {
  max-width: 460px;
  padding: 22px 24px;
  border: 0;
  border-radius: var(--radius);
  color: var(--text);
  box-shadow: 0 12px 40px rgba(0, 0, 40, 0.3);
}

.ask::backdrop {
  background: rgba(0, 0, 30, 0.45);
}

/* Form over the page (modal() of dialog.js): a title and its close button, then the form */
.modal {
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.modal-head h2 {
  margin: 0;
}

.modal form.narrow,
.modal form {
  max-width: none;
}

.modal .actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.modal .actions .btn,
.modal form .btn {
  width: auto;
}

.ask h2 {
  margin: 0 0 8px;
  font-size: 1.125rem;
}

.ask .actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.btn.danger {
  border-color: var(--red);
  background: var(--red);
}

/* Support */

.tabs.wrap {
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.badge {
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--brand-bg);
  color: var(--brand);
  font-size: 0.8125rem;
  font-weight: 600;
}

.badge.pending {
  background: #fdf0d5;
  color: #92540a;
}

.badge.revoked {
  background: #e7e9ee;
  color: var(--text-2);
}

.field input.code {
  max-width: 220px;
  font-family: ui-monospace, 'Cascadia Mono', Menlo, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.field select,
.field input[type="file"] {
  max-width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: inherit;
  font: inherit;
}

.two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0 20px;
  max-width: 900px;
  margin-bottom: 20px;
}

/* Button that is only an icon */
.btn.icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
}

.btn.icon-only .icon {
  width: 18px;
  height: 18px;
  margin: 0;
}

/* Legal notice and privacy policy; their links at the foot of the pages and of the menu */

.legal-links {
  margin: 0;
  color: var(--text-2);
  font-size: 0.8125rem;
  text-align: center;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 18px;
}

.legal-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: inherit;
}

.legal-links .icon {
  width: 16px;
  height: 16px;
}

.doc h1 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.doc h1 .icon {
  color: var(--soon);
}

.sidebar .legal-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 20px;
  text-align: left;
}

.sidebar .legal-links a {
  color: #b9b9de;
  text-decoration: none;
}

.sidebar .legal-links a:hover {
  color: #fff;
  text-decoration: underline;
}

/* In the account menu only while the menu shows no text. */
.shell:not(.small) .popup-panel .when-small {
  display: none;
}

.auth.doc {
  padding-top: 6vh;
}

.doc .card {
  max-width: 760px;
}

.doc .card h2 {
  margin: 24px 0 8px;
  font-size: 1.0625rem;
}

/* Screens without a session: the form on the left, a picture on the right */

.signin {
  display: grid;
  grid-template-columns: minmax(360px, 5fr) 7fr;
  min-height: 100vh;
  background: var(--surface);
}

.signin-form {
  display: flex;
  flex-direction: column;
  padding: 24px clamp(20px, 5vw, 64px);
}

.signin-form header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.signin-body {
  width: 100%;
  max-width: 420px;
  margin: auto;
  padding: 32px 0;
}

.signin-body h1 {
  margin-bottom: 10px;
  font-size: 2rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.signin-body .intro {
  margin-bottom: 24px;
  color: var(--text-2);
}

.signin-body .field input {
  padding: 12px 14px;
}

.signin-body form .btn {
  margin-top: 8px;
  padding: 13px 18px;
}

.signin-body .forgot {
  margin: -8px 0 16px;
}

.signin-art {
  position: relative;
  overflow: hidden;
  background: var(--brand);
}

.signin-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* A tall picture in a wide frame: keep the cloud and the lorry, lose sky and road. */
  object-position: 50% 42%;
}

@media (max-width: 860px) {
  .signin {
    grid-template-columns: minmax(0, 1fr);
  }

  .signin-art {
    display: none;
  }

  .signin-body h1 {
    font-size: 1.625rem;
  }
}

/* Password field with its button to show what is typed */

.with-eye {
  position: relative;
}

.field .with-eye input {
  padding-right: 44px;
}

.eye {
  position: absolute;
  top: 50%;
  right: 6px;
  display: inline-flex;
  padding: 6px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-2);
  transform: translateY(-50%);
  cursor: pointer;
}

.eye:hover {
  color: var(--brand);
}

.eye:focus-visible {
  outline: 2px solid var(--brand);
}

/* Dashboard opened: the gauges draw themselves, left to right */

.arriving .gauge path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation-name: draw-arc;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes draw-arc {
  to {
    stroke-dashoffset: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .arriving .gauge path {
    stroke-dasharray: none;
    animation: none;
  }
}

/* Change of page: the new content fades in and rises a little */

.page-enter {
  animation: page-enter 0.22s ease-out;
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-enter {
    animation: none;
  }
}

/* Gauge and its lines: the one under the pointer stands out on both, the others step back */

.gauge path,
.statuses li {
  transition: opacity 0.12s, stroke-width 0.12s, background-color 0.12s, color 0.12s;
}

.gauge.lighting path:not(.lit),
.statuses.lighting li:not(.lit) {
  opacity: 0.35;
}

.gauge path.lit {
  stroke-width: 38;
}

.statuses li.lit.ok {
  background: var(--ok);
  color: var(--text);
}

.statuses li.lit.soon {
  background: var(--soon);
  color: #fff;
}

.statuses li.lit.late {
  background: var(--late);
  color: #fff;
}

.statuses li.lit.unknown {
  background: var(--border);
  color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
  .gauge path,
  .statuses li {
    transition: none;
  }
}

/* Reports: one button each, all of the same size */

.reports {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.report {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  position: relative;
  width: 240px;
  height: 170px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
}

.report .icon {
  width: 32px;
  height: 32px;
  margin-bottom: 4px;
  color: var(--soon);
}

.report strong {
  font-size: 1.0625rem;
  line-height: 1.25;
}

.report span {
  color: var(--text-2);
  font-size: 0.875rem;
  line-height: 1.35;
}

a.report:hover {
  border-color: var(--brand);
  background: var(--brand-bg);
}

.report.soon strong,
.report.soon span,
.report.soon .icon {
  opacity: 0.55;
}

.report em {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand-bg);
  color: var(--brand);
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 600;
}

@media (max-width: 767px) {
  .reports li,
  .report {
    width: 100%;
  }

  .report {
    height: auto;
    min-height: 120px;
  }
}

/* A report: drivers picked, then a table that folds (driver, month, week, line) */

.page-head h1 a {
  color: var(--text-2);
  font-weight: 500;
  text-decoration: none;
}

.page-head h1 a:hover {
  color: var(--brand);
}

.picked {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.picked:empty {
  display: none;
}

.picked-one {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.picked-one:hover {
  border-color: var(--brand);
}

.picked-one .icon {
  width: 14px;
  height: 14px;
  color: var(--text-2);
}

.tree-tools {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.tree {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tree th,
.tree td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-weight: 400;
  vertical-align: middle;
}

.tree thead th {
  font-weight: 600;
  vertical-align: bottom;
}

.tree .number,
.tree .pair {
  text-align: right;
}

.tree .pair strong,
.tree .pair small {
  display: block;
  line-height: 1.2;
}

.tree small {
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 400;
}

.tree .zero strong,
.tree .zero small,
.tree .off {
  color: #a3a7b5;
}

.tree .level-0,
.tree .level-1,
.tree .level-2 {
  background: var(--bg);
}

.tree .level-0 th {
  font-weight: 700;
}

.tree .level-1 th,
.tree .level-2 th {
  color: var(--brand);
  font-weight: 600;
}

.tree .level-1 th:first-child {
  padding-left: 28px;
}

.tree .level-2 th:first-child {
  padding-left: 44px;
}

.tree .level-3 th:first-child {
  padding-left: 60px;
}

.fold-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.fold-line .icon {
  width: 16px;
  height: 16px;
  color: var(--text-2);
  transition: transform 0.15s;
}

.fold-line[aria-expanded="true"] .icon {
  transform: rotate(90deg);
}

.leaf {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  line-height: 1.25;
}

.leaf .icon {
  flex: none;
  width: 18px;
  height: 18px;
}

@media (prefers-reduced-motion: reduce) {
  .fold-line .icon {
    transition: none;
  }
}

/* Infringements: severities to filter by, and their badges (blue to red, as the ERRU scale) */

.levels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.level,
.badge {
  padding: 4px 10px;
  border: 2px solid transparent;
  border-radius: 6px;
  color: #fff;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
}

.level {
  cursor: pointer;
  opacity: 0.55;
}

.level[aria-pressed="true"] {
  border-color: var(--text);
  opacity: 1;
}

.badge {
  display: inline-block;
  padding: 1px 8px;
}

.level.MI,
.badge.MI {
  background: #4a7bd8;
}

.level.SI,
.badge.SI {
  background: #1d4fa8;
}

.level.VSI,
.badge.VSI {
  background: #e0a400;
}

.level.MSI,
.badge.MSI {
  background: #c62828;
}

.level.all {
  background: var(--brand);
}

.tree.infringements .wrap {
  min-width: 260px;
  white-space: normal;
}

.tree tfoot th {
  font-weight: 600;
}

/* Users of the settings: the account being changed, its scopes one per line */

.user-edit {
  margin-bottom: 16px;
}

.scopes {
  margin: 8px 0 12px;
  padding: 0;
  list-style: none;
}

.scopes li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.scopes small {
  color: var(--text-2);
}

.list .wrap {
  min-width: 220px;
  white-space: normal;
}

/* Tree of a client (settings): the levels on the left, the one picked on the right */

.org-layout {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.org-tree,
.org-panel {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.org-tree ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.org-tree ul ul {
  margin-left: 14px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

.org-tree button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.org-tree button:hover {
  background: var(--brand-bg);
}

.org-tree button[aria-current] {
  background: var(--brand);
  color: #fff;
}

.org-tree small {
  color: inherit;
  font-size: 0.75rem;
  opacity: 0.75;
}

.org-panel h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.org-panel h2 small,
.org-members small {
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 400;
}

.org-members h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 18px 0 6px;
  font-size: 1rem;
}

.org-members ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.org-members li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 767px) {
  .org-layout {
    grid-template-columns: 1fr;
  }
}

/* Printing: the page alone, without the menu, the bar nor the tools */

@media print {
  .sidebar,
  .topbar,
  .scrim,
  .no-print {
    display: none !important;
  }

  .shell,
  .shell.small {
    display: block;
  }

  .page {
    padding: 0;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
  }

  .tree {
    font-size: 8pt;
    white-space: normal;
  }

  .tree th,
  .tree td {
    padding: 3px 5px;
  }

  .tree tr {
    break-inside: avoid;
  }
}

/* Lists on a phone: each line of a table is a card, each value under the title of its column
   (data-label, table.js). The titles that sort stay above the cards, as buttons. */

@media (max-width: 767px) {
  .table-wrap {
    overflow: visible;
    border: 0;
    background: none;
  }

  .list,
  .list thead,
  .list tbody,
  .list tbody tr,
  .list td {
    display: block;
  }

  .list {
    white-space: normal;
  }

  .list thead tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
  }

  .list th {
    display: none;
    padding: 0;
    border: 0;
  }

  .list th:has(button),
  .list th:has(input) {
    display: block;
  }

  .list th button {
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
  }

  .list th[aria-sort] button {
    border-color: var(--brand);
    color: var(--brand);
  }

  .list tbody tr,
  .list tbody tr:nth-child(odd) {
    margin-bottom: 10px;
    padding: 4px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
  }

  /* flow-root: holds the floated title without cutting a panel opened from the cell */
  .list td {
    display: flow-root;
    min-height: 2.4em;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    text-align: right;
    overflow-wrap: anywhere;
  }

  .list td:last-child {
    border-bottom: 0;
  }

  .list td[data-label]::before {
    content: attr(data-label);
    float: left;
    max-width: 45%;
    margin-right: 12px;
    color: var(--text-2);
    font-weight: 600;
    text-align: left;
  }

  .list td.empty {
    text-align: center;
  }

  .list .clip {
    max-width: none;
    white-space: normal;
  }
}

/* Geolocation: the fleet as a list beside its map */

.geo-tabs {
  margin-bottom: 16px;
}

.geo-fleet {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 16px;
  align-items: start;
}

.geo-map {
  position: sticky;
  top: 16px;
}

.geo-map .map {
  height: 560px;
  margin-top: 0;
}

.row-actions {
  white-space: nowrap;
}

/* State and address are sentences: they wrap rather than widen the list, as the titles do */
.geo-list th,
.geo-list td.wraps {
  white-space: normal;
}

.geo-list td.address {
  min-width: 120px;
}

.geo-list td.state {
  min-width: 130px;
}

.dot.moving {
  background: #16a34a;
}

.dot.stopped {
  background: #dc2626;
}

.chip.geo-all {
  background: #1d4ed8;
}

.chip.geo-moving {
  background: #16a34a;
}

.chip.geo-stopped {
  background: #dc2626;
}

.dot.idle,
.chip.geo-idle {
  background: #d97706;
}

@media (max-width: 1099px) {
  .geo-fleet {
    grid-template-columns: minmax(0, 1fr);
  }

  /* The map first: it is what a phone opens the screen for */
  .geo-map {
    position: static;
    order: -1;
  }

  .geo-map .map {
    height: 360px;
  }
}

/* Vehicles and clusters on the map (map.google.js) */

/* A drop of the colour of the state, its tip on the position (the map anchors a marker by its
   bottom), the picture in a white disc inside; the arrow and the label hang outside it */
.map-pin {
  --state: #dc2626;
  position: relative;
  width: 44px;
  height: 53px;
  cursor: pointer;
}

.map-pin.moving {
  --state: #16a34a;
}

.map-pin.idle {
  --state: #d97706;
}

/* A square rounded on three corners and turned: a circle of 44px whose fourth corner, the tip,
   points down to 22 * (1 + sqrt 2) = 53px */
.pin-drop {
  position: absolute;
  top: 0;
  left: 0;
  width: 44px;
  height: 44px;
  border-radius: 50% 50% 50% 0;
  background: var(--state);
  rotate: -45deg;
  box-shadow: 0 2px 6px rgb(0 0 0 / 35%);
}

.pin-body {
  position: absolute;
  top: 4px;
  left: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ffffff;
  color: #1f2937;
}

.pin-body img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.pin-body .icon {
  width: 22px;
  height: 22px;
}

/* Turned about the centre of the disc: it sits on the rim, on the side the vehicle goes */
.pin-heading {
  position: absolute;
  top: 0;
  left: 0;
  width: 44px;
  height: 44px;
  pointer-events: none;
}

.pin-heading .icon {
  position: absolute;
  top: -15px;
  left: 50%;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  fill: var(--state);
  stroke: #ffffff;
  stroke-width: 1.5;
}

.pin-label {
  position: absolute;
  top: 26px;
  left: 38px;
  max-width: 160px;
  padding: 2px 7px;
  overflow: hidden;
  border-radius: 6px;
  background: #1f2937;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  box-shadow: 0 1px 3px rgb(0 0 0 / 30%);
}

/* Card of a picked vehicle */
.map-card {
  min-width: 220px;
  max-width: 300px;
  color: #1f2937;
  font-size: 0.875rem;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid #e5e7eb;
}

.card-head strong {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
}

.card-icon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #dbeafe;
  color: #1d4ed8;
}

.card-icon img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.card-state {
  --state: #dc2626;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  padding: 1px 8px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--state) 14%, #ffffff);
  color: color-mix(in srgb, var(--state) 70%, #000000);
  font-size: 0.8rem;
  font-weight: 600;
}

.card-state.moving {
  --state: #16a34a;
}

.card-state.idle {
  --state: #d97706;
}

.card-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--state);
}

.map-card ul {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.map-card li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-card li .icon {
  flex: none;
  width: 16px;
  height: 16px;
  color: #6b7280;
}

/* A cluster: how many vehicles it holds, larger and darker as they are more (CLUSTER_SIZES of map.google.js) */
.map-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #60a5fa;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.875rem;
  box-shadow: 0 0 0 6px rgb(96 165 250 / 30%), 0 1px 4px rgb(0 0 0 / 40%);
  translate: 0 50%;
  cursor: pointer;
}

.map-cluster.size-1 {
  width: 46px;
  height: 46px;
  background: #2563eb;
  box-shadow: 0 0 0 7px rgb(37 99 235 / 30%), 0 1px 4px rgb(0 0 0 / 40%);
}

.map-cluster.size-2 {
  width: 54px;
  height: 54px;
  background: #6d28d9;
  box-shadow: 0 0 0 8px rgb(109 40 217 / 30%), 0 1px 4px rgb(0 0 0 / 40%);
}

.map-cluster.size-3 {
  width: 62px;
  height: 62px;
  background: #3b0764;
  box-shadow: 0 0 0 9px rgb(59 7 100 / 30%), 0 1px 4px rgb(0 0 0 / 40%);
}

/* Geolocation settings of a vehicle */

.ask.wide {
  width: min(560px, calc(100vw - 32px));
  max-width: none;
  overflow-x: hidden;
}

.geo-settings .actions .btn {
  width: auto;
}

.geo-settings .group {
  margin-top: 14px;
}

.geo-settings select {
  box-sizing: border-box;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: inherit;
  font: inherit;
}

.icon-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-choice input {
  position: absolute;
  opacity: 0;
}

.icon-choice span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: #ffffff;
  color: #1f2937;
  cursor: pointer;
}

.icon-choice img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.icon-choice input:checked + span {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent);
}

.icon-choice input:focus-visible + span {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Trips: the lines that head a vehicle and a day */

.list tr.trips-head th,
.list tr.trips-head td {
  background: var(--surface-alt, #eef2ff);
  font-weight: 700;
}

.list tr.trips-head.level-1 th,
.list tr.trips-head.level-1 td {
  background: transparent;
  border-top: 2px solid var(--border);
  font-weight: 600;
}

.geo-list td.place {
  min-width: 140px;
}

.list tr.picked-line td {
  background: color-mix(in srgb, var(--brand) 10%, transparent);
}

/* Picture of a vehicle at the head of its line (vehicle-icon.js) */

.with-icon {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.vehicle-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #ffffff;
  color: #1f2937;
}

.vehicle-icon img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.vehicle-icon .icon {
  width: 18px;
  height: 18px;
}

/* Zones: buttons to draw one, and the form above the list while it is drawn */

.zone-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.zone-editor {
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 2px solid #d97706;
  border-radius: var(--radius);
  background: var(--surface);
}

.zone-editor h2 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.zone-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.zone-fields .field {
  flex: 1 1 200px;
}

.zone-fields input,
.zone-fields select {
  box-sizing: border-box;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: inherit;
  font: inherit;
}

.zone-editor .actions {
  justify-content: flex-end;
  margin-top: 12px;
}

/* Bar on the map to pick what a click draws (zones) */

.map-frame {
  position: relative;
}

.map-bar {
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 2;
  display: flex;
  translate: -50% 0;
  overflow: hidden;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 1px 4px rgb(0 0 0 / 30%);
}

.map-bar button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 38px;
  border: 0;
  border-right: 1px solid #e5e7eb;
  background: #ffffff;
  color: #374151;
  cursor: pointer;
}

.map-bar button:last-child {
  border-right: 0;
}

.map-bar button[aria-pressed="true"] {
  background: var(--brand);
  color: #ffffff;
}

.map-bar button:disabled {
  opacity: 0.35;
  cursor: default;
}

.zone-steps {
  margin: 12px 0 0;
  padding-left: 20px;
  font-size: 0.9rem;
}

.zone-steps li + li {
  margin-top: 4px;
}

.step-icons {
  display: inline-flex;
  gap: 4px;
  vertical-align: middle;
}

.step-icons .icon {
  width: 16px;
  height: 16px;
}

.zone-technical-field {
  margin-top: 10px;
}

.zone-technical-field .hint {
  margin: 4px 0 0;
}

.zone-technical {
  display: inline-block;
  padding: 0 6px;
  border-radius: 8px;
  background: #e5e7eb;
  color: #374151;
  font-size: 0.75rem;
  font-weight: 600;
  vertical-align: middle;
}

.zone-links {
  margin-top: 8px;
}

.zone-links .btn {
  width: auto;
}

.zone-editor .actions .grow {
  flex: 1;
}

.zone-editor .actions .btn {
  width: auto;
}

.zone-search {
  margin-top: 12px;
}

.zone-search-row {
  display: flex;
  gap: 8px;
}

.zone-search-row input {
  flex: 1;
  box-sizing: border-box;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: inherit;
  font: inherit;
}

.zone-search-row .btn {
  width: auto;
}

/* Maintenance: where a plan stands, and the dialog of a vehicle */

.maint-status {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
}

.maint-status.late {
  background: #fee2e2;
  color: #991b1b;
}

.maint-status.soon {
  background: #fef3c7;
  color: #92400e;
}

.maint-status.ok {
  background: #dcfce7;
  color: #166534;
}

.maint-status.unknown {
  background: #f3f4f6;
  color: #4b5563;
}

.chip.maint-all {
  background: #1d4ed8;
}

.chip.maint-late {
  background: #dc2626;
}

.chip.maint-soon {
  background: #d97706;
}

.chip.maint-ok {
  background: #16a34a;
}

/* A line opens the book of its vehicle under it, over the whole width of the table. */
.list tr.maint-line {
  cursor: pointer;
}

.maint-line .fold-line {
  text-align: left;
}

.maint-tools {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.list tbody tr.maint-book-line,
.list tbody tr.maint-book-line:hover {
  background: transparent;
}

.maint-book-line > td {
  padding-top: 0;
}

.maint-book-line .day-detail h2 {
  font-size: 1rem;
}

.maint-dialog {
  width: min(760px, calc(100vw - 32px));
}

.maint-dialog .group {
  margin-top: 14px;
}

.maint-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.maint-dialog input,
.maint-dialog select {
  box-sizing: border-box;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: inherit;
  font: inherit;
}

.maint-dialog .actions .btn {
  width: auto;
}

.maint-dialog .actions {
  justify-content: flex-end;
  margin-top: 10px;
}

.maint-dialog h3 {
  margin: 14px 0 6px;
  font-size: 0.95rem;
}
