/* Palette commune UL / DT. Chargée après les composants historiques.
   --green/blue/amber/red = information ; --action-* = commande interactive. */
:root {
  --bg: #f7f9fb;
  --surface: #ffffff;
  --surface2: #f3f6f8;
  --text: #20313f;
  --muted: #596b7b;
  --line: #e1e7ec;
  --brand: #d71931;
  --red: #c7243b;
  --red-soft: #fcecef;
  --green: #147b5b;
  --green-soft: #e7f5ef;
  --inventory-ok-bg: #f2faf6;
  --inventory-gap-bg: #fffaef;
  --blue: #356c9c;
  --blue-soft: #eaf2fb;
  --amber: #8a5a0c;
  --amber-soft: #fff4df;
  --action-bg: #315f85;
  --action-text: #ffffff;
  --action-hover: #284f70;
  --action-shadow: #315f8512;
  --selection-line: #b5cbdc;
  --secondary-hover: #f7f9fb;
  --soft-hover: #e4edf5;
  --danger-hover: #f9e2e7;
  --danger-line: #e8abb5;
  --focus: #315f85;
  --active-bg: #edf3f8;
  --active-text: #315f85;
  --secondary-bg: #ffffff;
}
html[data-theme="dark"] {
  --bg: #141d25;
  --surface: #1e2a35;
  --surface2: #22323f;
  --text: #e6eef4;
  --muted: #aebdc9;
  --line: #3b4b59;
  --brand: #ff8392;
  --red: #ff8a9a;
  --red-soft: #442936;
  --green: #76d6b2;
  --green-soft: #1d3b34;
  --inventory-ok-bg: #20322e;
  --inventory-gap-bg: #302e26;
  --blue: #9bc7ef;
  --blue-soft: #213a50;
  --amber: #e8c37d;
  --amber-soft: #3c3320;
  --action-bg: #9fc3e4;
  --action-text: #122a37;
  --action-hover: #b6d2ec;
  --action-shadow: transparent;
  --selection-line: #526e85;
  --secondary-hover: #273744;
  --soft-hover: #314c62;
  --danger-hover: #51303e;
  --danger-line: #835263;
  --focus: #9fc3e4;
  --active-bg: #293f52;
  --active-text: #9fc3e4;
  --secondary-bg: #22323f;
}
html
  .btn:where(
    :not(.secondary):not(.soft):not(.card-action):not(.text-btn):not(.chip):not(.danger):not(
        .danger-outline-v4
      )
  ):not(
    :where(
      .tabs .btn,
      .tab-bar .btn,
      .personal-tabs .btn,
      .personal-notification-filters .btn,
      .inventory-group-tabs .btn
    )
  ) {
  background: var(--action-bg);
  color: var(--action-text);
  border-color: transparent;
}
html[data-theme]
  .btn:where(
    :not(.secondary):not(.soft):not(.card-action):not(.text-btn):not(.chip):not(.danger):not(
        .danger-outline-v4
      )
  ):not(
    :where(
      .tabs .btn,
      .tab-bar .btn,
      .personal-tabs .btn,
      .personal-notification-filters .btn,
      .inventory-group-tabs .btn
    )
  ):hover:not(:disabled) {
  background: var(--action-hover);
}
html .btn.secondary,
html .icon-btn {
  background: var(--secondary-bg);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}
html .btn.secondary:hover:not(:disabled),
html .icon-btn:hover:not(:disabled) {
  background: var(--secondary-hover);
  border-color: var(--line);
}
html .btn.soft {
  background: var(--active-bg);
  color: var(--active-text);
}
html .text-btn:hover {
  color: var(--active-text);
}
html .btn.danger,
html .btn.danger-outline-v4,
html .btn.text-btn.danger,
html .icon-btn.danger-icon-v4 {
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid var(--danger-line);
}
html .icon-btn.notification-clear {
  color: var(--red);
}
html .icon-btn:has(.icon[data-icon="trash"]) {
  color: var(--red);
  background: var(--red-soft);
  border-color: var(--danger-line);
}
html .input,
html textarea {
  border-color: var(--line);
}
html input[type="checkbox"],
html input[type="radio"] {
  accent-color: var(--action-bg);
}
html :is(button, a, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
html .input:focus,
html textarea:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.local-brand,
.mobile-brand,
.login-brand,
.dt-public-brand > span:first-child {
  color: var(--brand);
  font-weight: 800;
  letter-spacing: 0.3px;
}
.local-brand > .icon,
.mobile-brand > .icon {
  color: var(--brand);
  width: 25px;
  height: 25px;
}
html .nav-link.active,
html .nav-link.active:hover,
html .mobile-nav :is(a, button).active {
  background: var(--active-bg);
  color: var(--active-text);
}
html .nav-link .badge-count {
  background: var(--blue-soft);
  color: var(--blue);
}
html .brand-unit .icon {
  color: var(--blue);
}
html .avatar {
  background: var(--blue-soft);
  color: var(--blue);
}
html .notification-dot,
html .notify-dot {
  background: var(--red);
}
html .danger,
html .form-error {
  color: var(--red);
}
html .mission-head-icon {
  background: var(--blue-soft);
  color: var(--blue);
}
html .btn.card-action {
  background: var(--active-bg);
  color: var(--active-text);
}
html .form-section h3 > .icon {
  color: var(--blue);
}
/* Onglets groupés : mêmes repères pour missions UL, dispositifs DT et préférences. */
html :is(.mission-tabs, .dt-event-tabs, .view-switch) {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  margin: 0 0 22px;
  max-width: 100%;
}
/* Même support et même état actif que les périodes de mission, au format de la barre. */
html .view-switch {
  margin: 0;
  border-radius: 13px;
  padding: 4px;
  gap: 3px;
}
html .view-switch button {
  background: transparent;
  color: var(--muted);
  transition:
    background-color 0.15s,
    color 0.15s;
}
html .view-switch button.active {
  font-weight: 700;
}
html .mission-tabs .btn,
html .dt-event-tabs > button {
  white-space: nowrap;
  background: transparent;
  color: var(--muted);
  border: 0;
  box-shadow: none;
  border-radius: 12px;
  min-height: 42px;
  padding: 10px 15px;
}
html .view-switch button.active,
html .view-switch button.active:hover,
html .mission-tabs .btn.active,
html .dt-event-tabs > button.is-active,
html .mission-tabs .btn.active:hover,
html .dt-event-tabs > button.is-active:hover {
  background: var(--active-bg);
  color: var(--active-text);
  border: 0;
  box-shadow: none;
}
html .mission-tabs .mission-tab-count {
  background: var(--surface2);
  color: var(--muted);
}
html .mission-tabs .active .mission-tab-count {
  background: var(--surface);
  color: var(--active-text);
}
html
  :is(.tabs, .tab-bar, .personal-tabs, .personal-notification-filters, .inventory-group-tabs)
  .btn.btn.active {
  background: var(--active-bg);
  color: var(--active-text);
  border-color: var(--selection-line);
}
/* Le bouton neutre garde une surface perceptible en sombre, sans cerclage gris lourd. */
@media (max-width: 700px) {
  html .mission-tabs {
    display: flex;
    gap: 2px;
    padding: 5px;
  }
  html .mission-tabs .btn {
    padding: 9px 6px;
    font-size: 11px;
    gap: 5px;
    flex: 1;
  }
  html .mission-tabs .mission-tab-count {
    min-width: 19px;
  }
}

html .icon[data-icon="trash"] {
  color: var(--red);
}
:root {
  --count-bg: var(--surface2);
  --count-text: var(--muted);
  --count-active-bg: var(--surface);
  --count-active-text: var(--active-text);
}
html
  :is(
    .btn.danger,
    .btn.danger-outline-v4,
    .icon-btn.danger-icon-v4,
    .icon-btn:has(.icon[data-icon="trash"])
  ):hover:not(:disabled) {
  background: var(--danger-hover);
  color: var(--red);
  border-color: var(--danger-line);
  box-shadow: none;
  transform: none;
}

html .btn.green {
  background: var(--action-bg);
  color: var(--action-text);
}

html .stock-category-heading {
  display: flex;
  align-items: center;
  gap: 9px;
}
html .stock-category-heading .icon {
  width: 18px;
  height: 18px;
  color: var(--blue);
}
html .dt-event-card .dt-event-edit {
  color: var(--blue);
}

html .nav-link > .icon,
html .mobile-nav :is(a, button) > .icon {
  color: var(--blue);
}
html .nav-link.active > .icon,
html .mobile-nav :is(a, button).active > .icon {
  color: var(--active-text);
}
@media (max-width: 700px) {
  html .mission-tabs .btn > .icon {
    display: none;
  }
}

.local-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 22px;
  line-height: 1.2;
}
.login-brand {
  font-size: 25px;
}

/* Interactive selections share the slate palette; status colors remain semantic. */
html
  :is(
    .crew-picker-row.selected,
    .dt-event-tabs > .is-active,
    .personal-notification-filters .btn.chip.active,
    .personal-notification-filters .btn.chip.active:hover
  ) {
  background: var(--active-bg);
  color: var(--active-text);
  border-color: var(--selection-line);
}
html :is(.dt-station-shortcut.is-active, .dt-post-tab.is-active, .dt-post-tab.active) {
  border-color: var(--active-text);
  box-shadow: 0 0 0 1px var(--active-text);
}
html :is(.dt-station-shortcut.is-active, .dt-post-tab.is-active, .dt-post-tab.active) > .icon {
  color: var(--active-text);
}
html .dt-event-tabs .is-active > span,
html :is(.active .pill-count, .active .mission-tab-count, .nav-link.active .badge-count) {
  background: var(--surface);
  color: var(--active-text);
  border: 1px solid var(--selection-line);
}
html .btn.secondary:hover:not(:disabled),
html .icon-btn:hover:not(:disabled) {
  box-shadow: none;
  transform: none;
}
html .date-control {
  border-color: var(--line);
  background: var(--surface);
  border-radius: 12px;
  min-height: 46px;
}
html .date-control:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
html .date-control > .input:focus {
  outline: none;
}
html .date-control > .input {
  font: inherit;
  color: var(--text);
}
html :is(.mission-meta, .card-subtitle, .details-list) .icon {
  color: var(--blue);
}
html .admin-dashboard-v13 .dashboard-module-heading .icon {
  color: var(--blue);
}
html .admin-dashboard-v13 .dashboard-priorities .dashboard-module-heading .icon {
  color: var(--active-text);
}
html .admin-dashboard-v13 .dashboard-priority-icon {
  color: var(--amber);
}
html .admin-dashboard-v13 [data-period="expired"] .dashboard-priority-icon {
  color: var(--red);
}
html .admin-dashboard-v13 .dashboard-priority-row:hover .dashboard-priority-description strong,
html .admin-dashboard-v13 .dashboard-section-link:hover,
html .admin-dashboard-v13 .dashboard-entry:hover strong {
  color: var(--active-text);
}
html .admin-dashboard-v13 .dashboard-priority-row:hover .dashboard-priority-count,
html .admin-dashboard-v13 .dashboard-priority-row:focus-visible .dashboard-priority-count {
  color: var(--active-text);
  background: var(--active-bg);
}
html .dashboard-expiry-icon {
  color: var(--amber);
}
html .is-overdue .dashboard-expiry-icon {
  color: var(--red);
}
html .dt-home-alert-heading > .icon {
  color: var(--amber);
}
html .dt-home-alerts > button:first-child {
  border-top: 0;
}
html .dt-home-alerts > button:hover {
  color: var(--active-text);
}
html .dt-home-alert-heading {
  margin: 0;
}
html .dt-home-alerts {
  margin: 0;
}
html .import-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--secondary-bg);
  cursor: pointer;
  font-weight: 600;
  line-height: 1.5;
}
html .import-choice:has(:checked) {
  background: var(--active-bg);
  border-color: var(--selection-line);
}
html .import-choice:has(:disabled) {
  cursor: default;
  color: var(--muted);
}
html .import-choice input {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  margin: 0;
}
html .import-row[hidden] {
  display: none;
}
@media (max-width: 700px) {
  html .date-control > .input {
    font-size: 16px;
  }
  html .import-choice {
    font-size: 14px;
  }
}

html :is(.dt-context-header .eyebrow, .dt-context-meta svg, .dt-event-facts svg, .dt-home-facts svg) {
  color: var(--blue);
}

/* Shared action roles: add .secondary, .soft, .card-action or .danger to new controls.
   State colors (.green/.amber/.blue) belong to information, not selection. */
html :is(.btn.soft, .btn.card-action):hover:not(:disabled) {
  background: var(--soft-hover);
  color: var(--active-text);
  box-shadow: none;
  transform: none;
}
html .btn.secondary,
html .icon-btn,
html .btn.soft,
html .btn.card-action {
  transition:
    background-color 0.15s,
    border-color 0.15s,
    color 0.15s;
}
html :is(.btn.secondary, .icon-btn, .btn.soft, .btn.card-action):active:not(:disabled) {
  transform: none;
}
html .btn:disabled,
html .icon-btn:disabled {
  cursor: default;
  box-shadow: none;
  transform: none;
}
html .view-switch button:not(.active):hover {
  background: var(--secondary-hover);
}
html .appearance-choice:has(input:checked) {
  background: var(--active-bg);
  border-color: var(--active-text);
}
html .inventory-section > header h2 {
  display: flex;
  align-items: center;
  gap: 10px;
}
html .inventory-section > header h2 > .icon,
html .inventory-group-tabs .icon,
html .mission-crew > .icon,
html .mission-type-label .icon,
html :is(.vehicle-details strong, .details-list span) > .icon {
  color: var(--active-text);
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}
html :is(.vehicle-details strong, .details-list span) {
  display: flex;
  align-items: center;
  gap: 8px;
}
html .mission-type-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}
html .badge.has-icon::before {
  display: none;
}
html .badge .status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
html #check-form .inventory-line.is-verified {
  background: var(--inventory-ok-bg);
}
html #check-form .inventory-line.has-shortage {
  background: var(--inventory-gap-bg);
}
html #check-form .inventory-line.has-shortage .inventory-tick input:checked + span {
  background: var(--amber);
  border-color: var(--amber);
}
html .inventory-variance {
  color: var(--amber);
  font-weight: 650;
}
html .inventory-variance[hidden] {
  display: none;
}

/* Headings only: tile icons retain their existing sizes. */
html .admin-dashboard-v13 .dashboard-module-heading h2,
html .dt-board-title > h2 {
  display: flex;
  align-items: center;
  gap: 11px;
  line-height: 1.35;
}
html .admin-dashboard-v13 .dashboard-module-heading h2 > .icon,
html .dt-board-title > h2 > .icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  margin: 0;
  vertical-align: middle;
}
html .stock-category-heading > .icon {
  flex: 0 0 18px;
  margin: 0;
}
/* One visible 32px frame inside a 44px target, including touch devices. */
html .icon-btn.compact-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 10px;
  flex: 0 0 44px;
}
html .icon-btn.compact-icon::before {
  box-sizing: border-box;
  content: "";
  display: block;
  position: absolute;
  inset: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--secondary-bg);
  pointer-events: none;
}
html .icon-btn.compact-icon > .icon {
  position: relative;
  width: 18px;
  height: 18px;
  z-index: 1;
}
html .icon-btn.compact-icon:hover:not(:disabled) {
  background: transparent;
  box-shadow: none;
  transform: none;
}
html .icon-btn.compact-icon:hover:not(:disabled)::before {
  background: var(--secondary-hover);
}
html .dt-event-card .dt-event-edit {
  position: absolute;
}
html .fleet-tile .row.between > .fleet-actions {
  gap: 4px;
}
html .inventory-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
}
html .inventory-item-meta > span {
  white-space: nowrap;
}
html .inventory-item-meta .inventory-variance {
  margin: 0;
}
html .inventory-item-meta .inventory-variance::before {
  content: "·";
  margin-right: 8px;
  font-weight: normal;
}
html .inventory-item-meta [hidden] {
  display: none;
}
@media (min-width: 901px) {
  html .sidebar-footer .site-copyright {
    text-align: left;
    padding-inline: 14px;
  }
}

/* Navigation toward stock is a function, not a conformity result. */
html .terrain-stock-cta > div > .icon {
  color: var(--blue);
}

/* 3.1 beta — role-aware navigation, neutral empty states and aligned stock actions. */
html .empty-state > .icon {
  color: var(--blue);
}
@media (max-width: 900px) {
  html .mobile-nav {
    display: grid;
    grid-template-columns: repeat(var(--mobile-destinations, 3), minmax(0, 1fr));
  }
  html .mobile-nav > :is(a, button) {
    min-width: 0;
  }
}
@media (min-width: 701px) {
  html .stock-card.device-card > .device-actions:not(:has(.icon-btn)) {
    justify-items: end;
  }
  html .stock-card.device-card > .device-actions:not(:has(.icon-btn)) > div:first-child {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    width: 100%;
  }
  html .stock-card.device-card > .device-actions:not(:has(.icon-btn)) .badge {
    margin: 0;
  }
  html .stock-card.device-card > .device-actions:not(:has(.icon-btn)) .stock-actions {
    justify-content: flex-end;
  }
}

/* 3.1.0 — shared mobile headings and compact secondary management actions. */
.page-heading-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.mobile-content-models,
.mobile-mission-models {
  display: none;
}
.admin-dashboard-v13 .dashboard-module-heading {
  margin-bottom: 16px;
}
.admin-dashboard-v13 .dashboard-module-heading:has(> h2:only-child) {
  grid-template-columns: minmax(0, 1fr);
}
.admin-dashboard-v13 .dashboard-module-body > :first-child {
  margin-top: 0;
}
.admin-dashboard-v13
  .dashboard-module-body
  > :is(.dashboard-priority-row, .completed-check-row, .dashboard-entry):first-child {
  min-height: 0;
  padding-top: 0;
}
.admin-dashboard-v13 .dashboard-module-body > .dashboard-empty {
  margin: 0;
}
@media (max-width: 700px) {
  html .page-heading p {
    max-width: none;
  }
  .page-heading > .page-heading-actions {
    flex-basis: 100%;
  }
  .mobile-content-models,
  .mobile-mission-models {
    display: inline-flex;
  }
  .desktop-content-models,
  html .mission-tabs .btn.mission-model-tab,
  html .mission-tabs.models-view {
    display: none;
  }
  html .mission-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  html .mission-tabs .btn > .icon {
    display: inline-block;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
  }
  .page-heading.has-export {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: center;
    gap: 10px 12px;
  }
  .page-heading.has-export > .page-heading-copy {
    display: contents;
  }
  .page-heading.has-export h1 {
    grid-column: 1 / -1;
  }
  .page-heading.has-export p {
    grid-column: 1;
    margin: 0;
  }
  .page-heading.has-export > .pdf-export {
    grid-column: 2;
    grid-row: 2;
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    align-self: center;
    margin: 0;
  }
  .page-heading.has-export > .pdf-export > span {
    display: none;
  }
  .page-heading.has-export:not(.has-description) h1 {
    grid-column: 1;
  }
  .page-heading.has-export:not(.has-description) > .pdf-export {
    grid-row: 1;
  }
  .vehicle-control-banner {
    gap: 12px;
  }
  .vehicle-control-banner .mission-progress {
    padding-top: 0;
  }
}

/* 3.2 — common confirmation spacing. */
.contact-success {
  display: grid;
  gap: 18px;
}
.contact-success > .inline-actions {
  margin-top: 0;
}
.empty-log {
  gap: 10px;
}
