/* ============================================
   FLEETSENSE UI KIT
   ============================================

   One page header, one button, one field, one card.

   Part 1 defines the shared components (fs-*) used by the newer views.
   Part 2 maps the older views onto the same look, so every screen shares
   the header, the buttons and the form controls.

   Loaded after the legacy layers on purpose; feature stylesheets
   (offers.css, import-dossiers.css) come after it.
   ============================================ */

:root {
  --fs-surface: rgba(12, 24, 45, 0.78);
  --fs-surface-raised: rgba(17, 30, 54, 0.92);
  --fs-surface-sunken: rgba(7, 16, 31, 0.72);
  --fs-line: rgba(148, 163, 184, 0.16);
  --fs-line-strong: rgba(148, 163, 184, 0.3);

  --fs-text: #f8fafc;
  --fs-text-2: #cbd5e1;
  --fs-text-3: #94a3b8;

  --fs-accent: #60a5fa;
  --fs-primary: #2563eb;
  --fs-primary-hover: #3b82f6;
  --fs-success: #34d399;
  --fs-warning: #fbbf24;
  --fs-danger: #f87171;

  --fs-radius-control: 10px;
  --fs-radius-card: 16px;
  --fs-radius-panel: 20px;
  --fs-control-height: 42px;

  --fs-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* ============================================
   PART 1 — SHARED COMPONENTS
   ============================================ */

/* Page */
.fs-page {
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: 28px 32px 48px;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  color: var(--fs-text-2);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
}

.fs-page [hidden] {
  display: none !important;
}

.fs-page h2,
.fs-page h3,
.fs-page h4 {
  color: var(--fs-text);
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.fs-page h2 { font-size: 20px; }
.fs-page h3 { font-size: 17px; }
.fs-page h4 { font-size: 15px; }

.fs-muted { color: var(--fs-text-3); }
.fs-hint { color: var(--fs-text-3); font-size: 13px; }

.fs-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Page header */
.fs-header {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-6);
  border: 1px solid rgba(96, 165, 250, 0.16);
  border-radius: var(--fs-radius-panel);
  background:
    radial-gradient(circle at 92% -30%, rgba(59, 130, 246, 0.22), transparent 46%),
    linear-gradient(145deg, rgba(15, 29, 51, 0.98), rgba(11, 22, 41, 0.96));
  box-shadow: 0 18px 50px rgba(2, 8, 23, 0.2);
}

.fs-header__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.fs-header__titles { min-width: 0; flex: 1 1 320px; }

.fs-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: var(--space-2);
  color: var(--fs-accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.fs-eyebrow .material-symbols-rounded { font-size: 16px; }

.fs-header h1 {
  color: var(--fs-text);
  font-family: var(--font-display);
  font-size: clamp(26px, 2.2vw, 34px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.fs-header__sub {
  max-width: 680px;
  margin-top: 6px;
  color: var(--fs-text-3);
  line-height: 1.55;
}

.fs-header__actions,
.fs-header__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.fs-header__meta { color: var(--fs-text-3); font-size: 13px; }

/* Buttons */
.fs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--fs-control-height);
  padding: 0 var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--fs-radius-control);
  background: transparent;
  color: var(--fs-text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.fs-btn .material-symbols-rounded { font-size: 20px; }

.fs-btn--primary {
  background: var(--fs-primary);
  border-color: rgba(96, 165, 250, 0.45);
  color: #fff;
}

.fs-btn--primary:hover { background: var(--fs-primary-hover); }

.fs-btn--secondary {
  background: rgba(15, 23, 42, 0.6);
  border-color: var(--fs-line-strong);
}

.fs-btn--secondary:hover {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(96, 165, 250, 0.45);
}

.fs-btn--ghost { color: var(--fs-text-2); }

.fs-btn--ghost:hover {
  background: rgba(96, 165, 250, 0.1);
  color: var(--fs-text);
}

.fs-btn--danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.fs-btn--danger:hover { background: rgba(239, 68, 68, 0.2); }

.fs-btn--sm {
  min-height: 34px;
  padding: 0 var(--space-3);
  font-size: 13px;
}

.fs-btn--sm .material-symbols-rounded { font-size: 18px; }

.fs-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.fs-btn:focus-visible,
.fs-input:focus-visible,
.fs-select:focus-visible,
.fs-textarea:focus-visible,
.fs-disclosure > summary:focus-visible {
  outline: 3px solid rgba(96, 165, 250, 0.35);
  outline-offset: 1px;
}

/* Fields */
.fs-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  color: var(--fs-text-3);
  font-size: 13px;
  font-weight: 500;
}

.fs-input,
.fs-select,
.fs-textarea {
  width: 100%;
  min-width: 0;
  min-height: var(--fs-control-height);
  padding: 0 var(--space-3);
  border: 1px solid var(--fs-line-strong);
  border-radius: var(--fs-radius-control);
  background-color: var(--fs-surface-sunken);
  color: var(--fs-text);
  font-family: var(--font-body);
  font-size: 14px;
  letter-spacing: 0;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.fs-textarea {
  padding: var(--space-3);
  min-height: 96px;
  line-height: 1.5;
  resize: vertical;
}

.fs-input::placeholder,
.fs-textarea::placeholder { color: rgba(148, 163, 184, 0.6); }

.fs-input:hover,
.fs-select:hover,
.fs-textarea:hover { border-color: rgba(96, 165, 250, 0.4); }

.fs-input:focus,
.fs-select:focus,
.fs-textarea:focus {
  border-color: var(--fs-accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

.fs-input:disabled,
.fs-select:disabled,
.fs-textarea:disabled {
  border-color: var(--fs-line);
  color: var(--fs-text-2);
  cursor: not-allowed;
  opacity: 0.75;
}

.fs-select {
  appearance: none;
  padding-right: 36px;
  background-image: var(--fs-chevron);
  background-repeat: no-repeat;
  background-position: right 12px center;
  text-overflow: ellipsis;
}

.fs-select option { background: #0f172a; color: var(--fs-text); }

.fs-input[type="date"] { color-scheme: dark; }

.fs-input[type="file"] {
  padding: 7px;
  color: var(--fs-text-3);
  font-size: 13px;
}

.fs-input[type="file"]::file-selector-button {
  margin-right: var(--space-3);
  padding: 5px 12px;
  border: 1px solid var(--fs-line-strong);
  border-radius: 7px;
  background: rgba(30, 41, 59, 0.85);
  color: var(--fs-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.fs-search { position: relative; }

.fs-search > .material-symbols-rounded {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fs-text-3);
  font-size: 20px;
  pointer-events: none;
}

.fs-search > .fs-input { padding-left: 40px; }

.fs-check {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--fs-text-2);
  font-size: 14px;
  cursor: pointer;
}

.fs-check input {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--fs-primary-hover);
  cursor: pointer;
}

/* Cards */
.fs-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-6);
  border: 1px solid var(--fs-line);
  border-radius: var(--fs-radius-card);
  background: var(--fs-surface);
  box-shadow: 0 16px 36px rgba(2, 8, 23, 0.14);
}

.fs-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.fs-card__title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-display);
}

.fs-step-num {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.16);
  color: var(--fs-accent);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
}

.fs-toolbar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* Badges */
.fs-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 2px 10px;
  border: 1px solid var(--fs-line-strong);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.1);
  color: var(--fs-text-2);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}

.fs-badge .material-symbols-rounded { font-size: 15px; }

.fs-badge[data-tone="info"] {
  border-color: rgba(96, 165, 250, 0.4);
  background: rgba(59, 130, 246, 0.14);
  color: #93c5fd;
}

.fs-badge[data-tone="success"] {
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(16, 185, 129, 0.14);
  color: #6ee7b7;
}

.fs-badge[data-tone="warning"] {
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
}

.fs-badge[data-tone="danger"] {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

/* Callouts */
.fs-callout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid rgba(96, 165, 250, 0.25);
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.08);
  color: var(--fs-text-2);
  font-size: 14px;
}

.fs-callout > .material-symbols-rounded {
  color: var(--fs-accent);
  font-size: 20px;
  line-height: 1.5;
}

.fs-callout strong { color: var(--fs-text); }
.fs-callout ul { margin: 6px 0 0; padding-left: 18px; }
.fs-callout li + li { margin-top: 4px; }

.fs-callout[data-tone="warning"] {
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(245, 158, 11, 0.08);
}

.fs-callout[data-tone="warning"] > .material-symbols-rounded { color: var(--fs-warning); }

.fs-callout[data-tone="success"] {
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(16, 185, 129, 0.08);
}

.fs-callout[data-tone="success"] > .material-symbols-rounded { color: var(--fs-success); }

/* Disclosures */
.fs-disclosure {
  border: 1px solid var(--fs-line);
  border-radius: 12px;
  background: rgba(8, 18, 35, 0.45);
}

.fs-disclosure > summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: 12px;
  color: var(--fs-text);
  font-size: 14px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.fs-disclosure > summary::-webkit-details-marker { display: none; }

.fs-disclosure > summary::after {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  margin-left: auto;
  background: var(--fs-chevron) center / contain no-repeat;
  transition: transform var(--transition-fast);
}

.fs-disclosure[open] > summary::after { transform: rotate(180deg); }
.fs-disclosure > summary:hover { background: rgba(96, 165, 250, 0.06); }
.fs-disclosure > summary .material-symbols-rounded { color: var(--fs-accent); font-size: 20px; }

.fs-disclosure__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: 0 var(--space-4) var(--space-4);
}

/* Tables */
.fs-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--fs-line);
  border-radius: 12px;
}

.fs-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.fs-table th {
  padding: var(--space-3) var(--space-4);
  background: rgba(8, 18, 35, 0.6);
  color: var(--fs-text-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.fs-table td {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--fs-line);
  color: var(--fs-text-2);
  vertical-align: top;
}

.fs-table tbody tr:hover { background: rgba(96, 165, 250, 0.05); }
.fs-table .fs-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Definition grid */
.fs-dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3) var(--space-5);
}

.fs-dl dt {
  color: var(--fs-text-3);
  font-size: 12px;
  font-weight: 500;
}

.fs-dl dd {
  margin: 2px 0 0;
  color: var(--fs-text);
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* Code / raw proof */
.fs-pre {
  max-height: 300px;
  overflow: auto;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--fs-line);
  border-radius: 10px;
  background: rgba(2, 8, 23, 0.55);
  color: var(--fs-text-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Empty state */
.fs-empty {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  padding: var(--space-12) var(--space-6);
  border: 1px dashed rgba(96, 165, 250, 0.26);
  border-radius: var(--fs-radius-panel);
  background:
    radial-gradient(circle at 50% 18%, rgba(59, 130, 246, 0.11), transparent 44%),
    rgba(12, 25, 47, 0.58);
  text-align: center;
}

.fs-empty > .material-symbols-rounded {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-2);
  border: 1px solid rgba(96, 165, 250, 0.24);
  border-radius: 20px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--fs-accent);
  font-size: 30px;
}

.fs-empty p { max-width: 460px; color: var(--fs-text-3); }

/* Toast: outcome of the last action, always in view */
.fs-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: var(--z-fixed);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  max-width: min(460px, calc(100vw - 32px));
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: 12px;
  background: #101d33;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  color: var(--fs-text);
  font-size: 14px;
}

.fs-toast [data-message] {
  flex: 1;
  padding: 5px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.fs-toast[data-tone="error"] { border-color: rgba(248, 113, 113, 0.5); }
.fs-toast[data-tone="success"] { border-color: rgba(52, 211, 153, 0.5); }

/* Steps */
.fs-steps {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-4) 0 0;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  list-style: none;
}

.fs-step {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  padding: 4px 14px 4px 5px;
  border: 1px solid var(--fs-line);
  border-radius: 999px;
  background: rgba(8, 18, 35, 0.5);
  color: var(--fs-text-3);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.fs-step:hover { border-color: rgba(96, 165, 250, 0.4); color: var(--fs-text); }

.fs-step__mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.14);
  font-size: 12px;
}

.fs-step__mark .material-symbols-rounded { font-size: 17px; }

.fs-step[data-state="current"] {
  border-color: rgba(96, 165, 250, 0.5);
  background: rgba(59, 130, 246, 0.14);
  color: var(--fs-text);
}

.fs-step[data-state="current"] .fs-step__mark { background: var(--fs-primary); color: #fff; }
.fs-step[data-state="done"] { color: var(--fs-text-2); }
.fs-step[data-state="done"] .fs-step__mark { background: rgba(16, 185, 129, 0.2); color: var(--fs-success); }

/* File drop zone */
.fs-dropzone {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3) var(--space-4);
  padding: var(--space-5);
  border: 1.5px dashed rgba(96, 165, 250, 0.35);
  border-radius: 14px;
  background: rgba(59, 130, 246, 0.04);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.fs-dropzone > .material-symbols-rounded {
  color: var(--fs-accent);
  font-size: 32px;
}

.fs-dropzone__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fs-dropzone__text strong { color: var(--fs-text); }
.fs-dropzone > .fs-toolbar { grid-column: 1 / -1; }

.fs-dropzone.drag-over {
  border-color: var(--fs-success);
  background: rgba(16, 185, 129, 0.08);
}

/* Scenario cards side by side (ui-kit.js scenarioDeck) */
.scenario-deck {
  --sc-bg-card: rgba(8, 18, 35, 0.72);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  align-items: start;
  gap: var(--space-3);
  padding-top: 4px;
}

.scenario-deck[data-count="1"] { grid-template-columns: minmax(0, 420px); }
.scenario-deck > .scenario-card { min-width: 0; width: auto; border-width: 1px; }
.scenario-deck .scenario-card-title { max-width: none; white-space: normal; line-height: 1.3; }
.scenario-deck .scenario-card-monthly { font-size: 30px; }
.scenario-deck .breakdown-value,
.scenario-deck .breakdown-item.sub span:last-child { white-space: nowrap; }

.scenario-formulas-toggle {
  margin-top: var(--space-4);
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.scenario-formulas-toggle > summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-top: var(--space-3);
  color: var(--fs-accent);
  font-size: 13px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.scenario-formulas-toggle > summary::-webkit-details-marker { display: none; }

.scenario-formulas-toggle > summary::before {
  content: "+";
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(96, 165, 250, 0.4);
  border-radius: 5px;
  font-size: 13px;
  line-height: 1;
}

.scenario-formulas-toggle[open] > summary::before { content: "−"; }

@media (max-width: 768px) {
  /* Phones: swipe between scenarios */
  .scenario-deck:not([data-count="1"]) {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 86%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: var(--space-2);
  }

  .scenario-deck > .scenario-card { scroll-snap-align: start; }

  .fs-page {
    padding: 18px 16px 36px;
    gap: var(--space-4);
  }

  .fs-header,
  .fs-card { padding: var(--space-5) var(--space-4); }

  .fs-header__actions { width: 100%; }
  .fs-header__actions .fs-btn { flex: 1 1 auto; }

  .fs-toast {
    right: 16px;
    left: 16px;
    bottom: 16px;
    max-width: none;
  }
}

/* ============================================
   PART 2 — EXISTING VIEWS ON THE SAME KIT
   Scoped to #app-shell so these rules win over the legacy
   layers without !important.
   ============================================ */

/* Tokens referenced by the legacy layers but never defined: without them
   corners render square and some text falls back to the default color. */
:root {
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --color-text-low: var(--fs-text-3);
  --color-text-light: var(--fs-text-2);
  --color-primary: var(--fs-primary-hover);
  --color-primary-hover: var(--fs-accent);
  --color-border-hover: rgba(96, 165, 250, 0.45);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --glass-bg: rgba(15, 23, 42, 0.72);
  --glass-border: rgba(148, 163, 184, 0.18);
  --glass-blur: 16px;
}

/* Form controls use the app font, not the browser default */
button,
input,
select,
textarea {
  font-family: inherit;
}

/* Sidebar: compact, grouped, collapsible to an icon rail (navigation.js) */
:root { --sidebar-width: 224px; }
body.sidebar-rail { --sidebar-width: 68px; }

#app-shell .app-sidebar {
  width: var(--sidebar-width);
  border-right: 1px solid rgba(148, 163, 184, 0.12);
  background: #0a1324;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: width 0.18s ease;
}

#app-shell .app-main { transition: margin-left 0.18s ease; }

#app-shell .sidebar-header {
  padding: var(--space-4) var(--space-4) var(--space-2);
  border-bottom: 0;
}

#app-shell .sidebar-brand { justify-content: flex-start; padding: 0 var(--space-1); min-height: 32px; }
#app-shell .sidebar-logo-img { max-height: 40px; filter: none; }
.sidebar-logo-mark { display: none; width: 30px; height: 30px; }

#app-shell .org-selector-container { margin-top: var(--space-3); }
#app-shell .org-selector__button,
#app-shell .org-selector--legacy { min-height: 36px; padding: 4px 10px; border-radius: 9px; font-size: 13px; }
#app-shell .org-selector__name { font-size: 13px; }

#app-shell .sidebar-nav {
  flex: 1;
  gap: 2px;
  padding: var(--space-2) var(--space-3);
  overflow-y: auto;
}

.nav-section {
  margin: var(--space-4) 0 var(--space-1);
  padding: 0 10px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-section:first-child { margin-top: var(--space-1); }

#app-shell .nav-item {
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  color: #a5b4c8;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.25;
  white-space: nowrap;
}

#app-shell .nav-item .nav-item-icon { width: 22px; flex: none; }
#app-shell .nav-item .material-symbols-rounded { font-size: 20px; }
#app-shell .nav-item-label { overflow: hidden; text-overflow: ellipsis; }
#app-shell .nav-item:hover { background: rgba(148, 163, 184, 0.08); color: var(--fs-text); }

#app-shell .nav-item.active {
  background: rgba(59, 130, 246, 0.16);
  box-shadow: none;
  color: #fff;
}

#app-shell .nav-item.active .material-symbols-rounded { color: var(--fs-accent); }
#app-shell .nav-item.active::before { left: -12px; height: 18px; }

#app-shell .sidebar-footer {
  gap: 2px;
  padding: var(--space-2) var(--space-3) var(--space-3);
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  background: transparent;
}

.sidebar-footer-row { display: flex; gap: 4px; }

#app-shell .sidebar-signout,
.sidebar-rail-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: #a5b4c8;
  font: 500 14px var(--font-body);
  cursor: pointer;
}

#app-shell .sidebar-signout { flex: 1; width: auto; justify-content: flex-start; }
.sidebar-rail-toggle { justify-content: center; width: 36px; padding: 0; flex: none; }
#app-shell .sidebar-signout:hover,
.sidebar-rail-toggle:hover { background: rgba(148, 163, 184, 0.08); color: var(--fs-text); }

/* Icon rail */
@media (min-width: 769px) {
  body.sidebar-rail .sidebar-logo-img,
  body.sidebar-rail .org-selector-container,
  body.sidebar-rail .nav-item-label,
  body.sidebar-rail .sidebar-signout .nav-item-label { display: none; }

  body.sidebar-rail .sidebar-logo-mark { display: block; }
  body.sidebar-rail .sidebar-brand { justify-content: center; padding: 0; }
  body.sidebar-rail #app-shell .sidebar-header { padding: var(--space-4) var(--space-2) var(--space-2); }
  body.sidebar-rail #app-shell .sidebar-nav,
  body.sidebar-rail #app-shell .sidebar-footer { padding-left: var(--space-2); padding-right: var(--space-2); }
  body.sidebar-rail .nav-section { height: 1px; margin: var(--space-3) 10px; padding: 0; overflow: hidden; background: rgba(148, 163, 184, 0.14); color: transparent; }
  body.sidebar-rail .nav-section:first-child { display: none; }
  body.sidebar-rail #app-shell .nav-item { justify-content: center; padding: 0; }
  body.sidebar-rail .sidebar-footer-row { flex-direction: column; }
  body.sidebar-rail #app-shell .sidebar-signout { justify-content: center; padding: 0; }
  body.sidebar-rail .sidebar-rail-toggle { width: 100%; }
  body.sidebar-rail .sidebar-rail-toggle .material-symbols-rounded { transform: scaleX(-1); }
}

@media (max-width: 768px) {
  #app-shell .app-sidebar { width: 272px; }
  .sidebar-rail-toggle { display: none; }
}

/* Mobile: a slim sticky top bar instead of an empty glass card.
   The bar stays on every view, including those that hide .page-header. */
.mobile-brand { display: none; }
.mobile-menu-close { display: none; }

@media (min-width: 769px) {
  .app-main > .mobile-navigation-bar { display: none; }
}

@media (max-width: 768px) {
  .app-main > .mobile-navigation-bar {
    position: sticky;
    top: 0;
    z-index: 900;
    max-width: none;
    margin: 0;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
    border: 0;
    border-bottom: 1px solid rgba(96, 165, 250, 0.16);
    border-radius: 0;
    background: rgba(11, 20, 38, 0.88);
    box-shadow: none;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .app-main > .mobile-navigation-bar .page-header {
    display: flex !important; /* navigation.js hides it on some views */
    align-items: center;
    gap: var(--space-3);
    margin: 0;
  }

  #app-shell .mobile-menu-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border-radius: var(--fs-radius-control);
  }

  .mobile-menu-close {
    display: block;
    margin: 0 0 12px auto;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid currentColor;
    border-radius: 8px;
    color: var(--fs-text);
    background: transparent;
    cursor: pointer;
  }

  .mobile-brand {
    display: block;
    height: 26px;
    width: auto;
  }
}

/* Page headers: one panel, one title size, one eyebrow */
#app-shell .view-header,
#app-shell .templates-header,
#app-shell .sim-form-header {
  position: relative;
  overflow: hidden;
  padding: var(--space-6);
  border: 1px solid rgba(96, 165, 250, 0.16);
  border-radius: var(--fs-radius-panel);
  background:
    radial-gradient(circle at 92% -30%, rgba(59, 130, 246, 0.22), transparent 46%),
    linear-gradient(145deg, rgba(15, 29, 51, 0.98), rgba(11, 22, 41, 0.96));
  box-shadow: 0 18px 50px rgba(2, 8, 23, 0.2);
}

#app-shell .templates-header { align-items: flex-start; }
#app-shell .view-header .header-content { gap: 0; }

#app-shell .operational-header h1,
#app-shell .clients-header h1,
#app-shell .view-header .header-title,
#app-shell .templates-header h1,
#app-shell .sim-form-header-titles h1 {
  margin: 0;
  color: var(--fs-text);
  font-family: var(--font-display);
  font-size: clamp(26px, 2.2vw, 34px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

#app-shell .operational-header p,
#app-shell .clients-header-titles p,
#app-shell .view-header .header-subtitle,
#app-shell .templates-header p,
#app-shell .sim-form-header-titles p {
  max-width: 680px;
  margin: 6px 0 0;
  color: var(--fs-text-3);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: 0;
}

#app-shell .header-help-text {
  color: var(--fs-text-3);
  font-size: 12px;
  letter-spacing: 0;
}

/* The simulation form header keeps its sticky actions, now as a panel
   aligned with the form below it. */
#app-shell .sim-form-header {
  top: var(--space-3);
  width: calc(100% - 64px);
  max-width: 1336px;
  margin: 28px auto 0;
  overflow: visible;
  backdrop-filter: none;
}

#app-shell .simulation-form-view { background-color: transparent; }

#app-shell .sim-form-context {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  max-width: 1400px;
  margin: 24px auto 0;
  padding: 0 32px;
}

#app-shell .sim-form-context > .sim-form-client-wrapper,
#app-shell .sim-form-context > .sim-form-template-wrapper {
  max-width: none;
  margin: 0;
  padding: 0;
}

/* Buttons: primary is solid blue, secondary is outlined, both 10px corners */
:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .btn,
:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .btn-header,
:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .sim-form-btn,
#login-view .btn {
  min-height: var(--fs-control-height);
  padding: 0 var(--space-4);
  border-radius: var(--fs-radius-control);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  box-shadow: none;
  transform: none;
}

:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .btn .material-symbols-rounded,
:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .btn-header .material-symbols-rounded,
:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .sim-form-btn .material-symbols-rounded { font-size: 20px; }

:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .btn-primary,
:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .btn-header-primary,
:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .sim-form-btn-primary,
#login-view .btn-primary {
  border: 1px solid rgba(96, 165, 250, 0.45);
  background: var(--fs-primary);
  color: #fff;
  filter: none;
}

:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .btn-primary:hover,
:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .btn-header-primary:hover,
:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .sim-form-btn-primary:hover,
#login-view .btn-primary:hover {
  background: var(--fs-primary-hover);
  transform: none;
}

:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .btn-secondary,
:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .btn-tertiary,
:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .btn-header-secondary,
:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .sim-form-btn-secondary,
:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .org-profile-actions .btn-primary {
  border: 1px solid var(--fs-line-strong);
  background: rgba(15, 23, 42, 0.6);
  color: var(--fs-text);
}

:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .btn-secondary:hover,
:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .btn-tertiary:hover,
:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .btn-header-secondary:hover,
:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .sim-form-btn-secondary:hover,
:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .org-profile-actions .btn-primary:hover {
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(30, 41, 59, 0.85);
}

:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .btn-sm {
  min-height: 34px;
  padding: 0 var(--space-3);
  font-size: 13px;
}

:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) .btn-icon {
  min-height: 0;
  padding: 0;
  border-radius: var(--fs-radius-control);
}

/* Icon-only header buttons (refresh) are square */
#app-shell .btn-header-secondary:not(:has(> span:not(.material-symbols-rounded))) {
  flex: none;
  width: var(--fs-control-height);
  justify-content: center;
  padding: 0;
}

/* Fleet scopes read as a segmented filter */
#app-shell .fleet-scopes .btn {
  min-height: 36px;
  border-radius: 999px;
  font-weight: 500;
}

#app-shell .fleet-scopes [aria-pressed="true"] {
  border-color: rgba(96, 165, 250, 0.6);
  background: rgba(59, 130, 246, 0.2);
  color: #fff;
}

#app-shell .view-toggle { border-radius: var(--fs-radius-control); }
#app-shell .view-toggle-btn { display: grid; place-items: center; border-radius: 7px; }

/* Search fields and filters */
#app-shell .search-input,
#app-shell .filter-select,
#app-shell .templates-search input,
#app-shell .templates-filter-select,
:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) input.input-field,
:is(#app-shell, .modal, .modal-overlay, .modal-backdrop, .vehicle-dossier, .fs-sheet) select.input-field,
#app-shell .sim-form-context .sim-form-select {
  min-height: var(--fs-control-height);
  border: 1px solid var(--fs-line-strong);
  border-radius: var(--fs-radius-control);
  background-color: var(--fs-surface-sunken);
  color: var(--fs-text);
  font-size: 14px;
  letter-spacing: 0;
}

#app-shell .filter-select,
#app-shell .templates-filter-select,
#app-shell .sim-form-context .sim-form-select {
  appearance: none;
  padding-right: 36px;
  background-image: var(--fs-chevron);
  background-repeat: no-repeat;
  background-position: right 12px center;
}

#app-shell .templates-search { max-width: 360px; }

#app-shell .search-input:focus,
#app-shell .filter-select:focus,
#app-shell .templates-search input:focus,
#app-shell .templates-filter-select:focus,
#app-shell .sim-form-context .sim-form-select:focus {
  border-color: var(--fs-accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

/* Vehicle cards never force the page wider than the screen */
#app-shell .vehicle-grid { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
#app-shell .vehicle-card { min-width: 0; }
#app-shell .vehicle-actions { flex-wrap: wrap; }

/* Settings: one primary save in the header; the profile save is secondary */
#app-shell .org-avatar { border-radius: var(--fs-radius-card); }

@media (max-width: 1024px) {
  #app-shell .sim-form-header { width: calc(100% - 32px); }
  #app-shell .sim-form-context { padding: 0 16px; }
}

@media (max-width: 768px) {
  #app-shell .view-header,
  #app-shell .templates-header,
  #app-shell .sim-form-header { padding: var(--space-5) var(--space-4); }

  #app-shell .sim-form-header {
    position: static;
    margin-top: var(--space-4);
  }

  #app-shell .sim-form-context { grid-template-columns: 1fr; }

  #app-shell .operational-stats,
  #app-shell .fleet-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Toolbars stack vertically here: a 360px flex-basis would become a height */
  #app-shell :is(.fleet-toolbar, .drivers-toolbar, .clients-toolbar) .search-box { flex-basis: auto; }

  /* Filters wrap instead of widening the page */
  #app-shell :is(.fleet-toolbar, .drivers-toolbar, .clients-toolbar) .filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    width: 100%;
  }

  #app-shell :is(.fleet-toolbar, .drivers-toolbar, .clients-toolbar) .filter-select {
    flex: 1 1 140px;
    min-width: 0;
    max-width: 100%;
  }

  #app-shell .view-header .header-actions {
    align-items: stretch;
    min-width: 0;
    width: 100%;
  }
}

/* ============================================
   PART 3 — SIDE PANELS
   Details and actions open on the right, like the dashboard's context
   pane, instead of floating in the middle of the screen.
   - .fs-sheet (ui-kit.js openSidePanel) and the vehicle dossier are docked:
     the page stays usable and shifts left on wide screens.
   - Legacy form modals become right-hand sheets over a light scrim.
   ============================================ */

:root {
  --fs-sheet-width: min(520px, 100vw);
  --fs-sheet-width-wide: min(720px, 100vw);
}

@keyframes fs-sheet-in {
  from { transform: translateX(32px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* Docked panels */
.fs-sheet,
dialog.vehicle-dossier {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 950;
  display: flex;
  flex-direction: column;
  width: var(--fs-sheet-width);
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-left: 1px solid rgba(96, 165, 250, 0.22);
  border-radius: 0;
  background: #0d1a2f;
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.45);
  color: var(--fs-text-2);
  font-family: var(--font-body);
  font-size: 15px;
  letter-spacing: 0;
  animation: fs-sheet-in 0.22s ease-out;
}

.fs-sheet--wide,
dialog.vehicle-dossier { width: var(--fs-sheet-width-wide); }

/* The page makes room for a docked panel on wide screens */
/* The page makes room for a docked panel only when enough width remains;
   otherwise the panel covers the right of the page. */
@media (min-width: 1440px) {
  body.fs-sheet-open:not(.fs-sheet-open--wide) .app-main { margin-right: var(--fs-sheet-width); transition: margin-right 0.22s ease-out; }
}

@media (min-width: 1680px) {
  body.fs-sheet-open.fs-sheet-open--wide .app-main { margin-right: var(--fs-sheet-width-wide); transition: margin-right 0.22s ease-out; }
}

.fs-sheet__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex: none;
  padding: var(--space-5) var(--space-6) var(--space-4);
  border-bottom: 1px solid var(--fs-line);
  background:
    radial-gradient(circle at 100% -40%, rgba(59, 130, 246, 0.2), transparent 55%),
    #0f1d34;
}

.fs-sheet__head h2 {
  color: var(--fs-text);
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.fs-sheet__head p { margin-top: 4px; color: var(--fs-text-3); font-size: 14px; }

.fs-sheet__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  flex: 1;
  min-height: 0;
  padding: var(--space-5) var(--space-6) var(--space-8);
  overflow-y: auto;
}

.fs-sheet__foot {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-3);
  flex: none;
  padding: var(--space-3) var(--space-6);
  border-top: 1px solid var(--fs-line);
  background: #0e1a30;
}

.fs-sheet__foot:empty { display: none; }
.fs-sheet [hidden] { display: none !important; }
.fs-sheet h3 { color: var(--fs-text); font-family: var(--font-display); font-size: 17px; }
.fs-sheet .scenario-deck[data-count="1"] { grid-template-columns: minmax(0, 1fr); }

/* Vehicle dossier as a docked panel */
dialog.vehicle-dossier { overflow-y: auto; }
dialog.vehicle-dossier .dossier-header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: var(--space-5) var(--space-6) var(--space-4);
  background: #0f1d34;
}
dialog.vehicle-dossier .dossier-header h2 { font-family: var(--font-display); font-size: 22px; }
dialog.vehicle-dossier .dossier-summary { padding: 0 var(--space-6) var(--space-5); }
dialog.vehicle-dossier .dossier-tabs { padding: 0 var(--space-5) var(--space-3); }
dialog.vehicle-dossier .dossier-content { padding: var(--space-4) var(--space-6) var(--space-8); }

/* Legacy modals: right-hand sheet over a light scrim */
.modal.modal-active,
.modal-overlay.active,
.modal-backdrop:not(.hidden) {
  justify-content: flex-end;
  align-items: stretch;
  padding: 0;
}

.modal-overlay.active,
.modal-backdrop:not(.hidden),
.modal.modal-active > .modal-overlay {
  background: rgba(2, 8, 23, 0.45);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.modal.modal-active > .modal-content,
.modal-overlay.active > .modal-content,
.modal-overlay.active > .modal-container,
.modal-backdrop > .modal-panel {
  display: flex;
  flex-direction: column;
  width: var(--fs-sheet-width);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  overflow-y: auto;
  border: 0;
  border-left: 1px solid rgba(96, 165, 250, 0.22);
  border-radius: 0;
  background: #0d1a2f;
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: none;
  transform: none;
  animation: fs-sheet-in 0.22s ease-out;
}

.modal.modal-active > .modal-content.modal-sm { width: min(440px, 100vw); }

:is(.modal.modal-active, .modal-overlay.active, .modal-backdrop) .modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  flex: none;
  padding: var(--space-5) var(--space-6) var(--space-4);
  border-bottom: 1px solid var(--fs-line);
  background: #0f1d34;
}

:is(.modal.modal-active, .modal-overlay.active, .modal-backdrop) :is(.modal-header h2, .modal-header h3, .modal-title) {
  color: var(--fs-text);
  font-family: var(--font-display);
  font-size: 21px;
  letter-spacing: -0.01em;
}

:is(.modal.modal-active, .modal-overlay.active, .modal-backdrop) .modal-body {
  flex: 1 0 auto;
  max-height: none;
  padding: var(--space-5) var(--space-6);
  overflow: visible;
}

:is(.modal.modal-active, .modal-overlay.active, .modal-backdrop) .modal-footer,
.modal-overlay.active .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  flex: none;
  margin-top: auto;
  padding: var(--space-3) var(--space-6);
  border-top: 1px solid var(--fs-line);
  background: #0e1a30;
}

/* Every form inside a side panel uses the kit fields, whatever its origin
   (template form, vehicle dossier, contact, driver, fleet) */
:is(.modal.modal-active, .modal-overlay.active, .modal-backdrop, .vehicle-dossier) :is(.modal-body, .dossier-content) {
  color: var(--fs-text-2);
  font-size: 14px;
  letter-spacing: 0;
  line-height: 1.5;
}

:is(.modal.modal-active, .modal-overlay.active, .modal-backdrop, .vehicle-dossier) :is(input:not([type="checkbox"], [type="radio"], [type="color"], [type="file"], [type="range"], [type="submit"], [type="button"]), select, textarea) {
  width: 100%;
  min-height: var(--fs-control-height);
  padding: 0 var(--space-3);
  border: 1px solid var(--fs-line-strong);
  border-radius: var(--fs-radius-control);
  background-color: var(--fs-surface-sunken);
  color: var(--fs-text);
  font-family: var(--font-body);
  font-size: 14px;
  letter-spacing: 0;
  color-scheme: dark;
}

:is(.modal.modal-active, .modal-overlay.active, .modal-backdrop, .vehicle-dossier) textarea { min-height: 88px; padding: 10px var(--space-3); line-height: 1.5; }

:is(.modal.modal-active, .modal-overlay.active, .modal-backdrop, .vehicle-dossier) select {
  appearance: none;
  padding-right: 36px;
  background-image: var(--fs-chevron);
  background-repeat: no-repeat;
  background-position: right 12px center;
}

:is(.modal.modal-active, .modal-overlay.active, .modal-backdrop, .vehicle-dossier) :is(input, select, textarea):focus {
  border-color: var(--fs-accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

:is(.modal.modal-active, .modal-overlay.active, .modal-backdrop, .vehicle-dossier) :is(.form-label, .form-group > label, .input-group > label, .dossier-grid label) {
  display: block;
  margin-bottom: 6px;
  color: var(--fs-text-3);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
}

:is(.modal.modal-active, .modal-overlay.active, .modal-backdrop) :is(.form-section h4, .form-section-title) {
  margin: var(--space-2) 0 var(--space-3);
  color: var(--fs-text);
  font-family: var(--font-display);
  font-size: 15px;
}

:is(.modal.modal-active, .modal-overlay.active, .modal-backdrop) :is(.form-grid-2col, .form-row) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3) var(--space-4);
}

/* Forms inside legacy sheets use the kit fields */
:is(.modal.modal-active, .modal-overlay.active, .modal-backdrop) :is(.form-group, .input-group) {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-4);
}

:is(.modal.modal-active, .modal-overlay.active, .modal-backdrop) :is(.form-group, .input-group) > label {
  color: var(--fs-text-3);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
}

:is(.modal.modal-active, .modal-overlay.active, .modal-backdrop) :is(.form-group, .input-group) > :is(input:not([type="checkbox"], [type="radio"], [type="color"], [type="file"], [type="range"]), select, textarea) {
  width: 100%;
  min-height: var(--fs-control-height);
  padding: 0 var(--space-3);
  border: 1px solid var(--fs-line-strong);
  border-radius: var(--fs-radius-control);
  background-color: var(--fs-surface-sunken);
  color: var(--fs-text);
  font-family: var(--font-body);
  font-size: 14px;
  letter-spacing: 0;
}

:is(.modal.modal-active, .modal-overlay.active, .modal-backdrop) :is(.form-group, .input-group) > textarea { min-height: 88px; padding: 10px var(--space-3); line-height: 1.5; }

:is(.modal.modal-active, .modal-overlay.active, .modal-backdrop) :is(.form-group, .input-group) > select {
  appearance: none;
  padding-right: 36px;
  background-image: var(--fs-chevron);
  background-repeat: no-repeat;
  background-position: right 12px center;
}

:is(.modal.modal-active, .modal-overlay.active, .modal-backdrop) :is(.form-group, .input-group) > :is(input, select, textarea):focus {
  border-color: var(--fs-accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

:is(.modal.modal-active, .modal-overlay.active, .modal-backdrop) .form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0 var(--space-4);
}

@media (max-width: 768px) {
  .fs-sheet__head,
  .fs-sheet__body,
  .fs-sheet__foot { padding-left: var(--space-4); padding-right: var(--space-4); }
}

@media (prefers-reduced-motion: reduce) {
  .fs-sheet,
  dialog.vehicle-dossier,
  .modal.modal-active > .modal-content,
  .modal-overlay.active > .modal-content,
  .modal-overlay.active > .modal-container,
  .modal-backdrop > .modal-panel { animation: none; }
}

/* ============================================
   PART 4 — ONE LOOK FOR EVERY SCREEN
   Calm slate surfaces (the dashboard's look), tighter spacing,
   and one card (.fs-tile) for vehicles, templates, simulations and offers.
   ============================================ */

:root {
  --fs-bg: #0a1120;
  --fs-surface: #0f172a;
  --fs-surface-raised: #131d33;
  --fs-surface-sunken: #0b1324;
  --fs-line: #1e293b;
  --fs-line-strong: #2b3a52;
}

body {
  background: var(--fs-bg);
  letter-spacing: 0;
}

body::before { display: none; }

/* Tighter pages everywhere */
.fs-page { padding: 20px 24px 40px; gap: 16px; }
#app-shell :is(#fleet-view, #drivers-view, #contacts-view, #clients-view, #calculations-view, #settings-view) > .page-container { padding: 20px 24px 40px !important; }
#app-shell #car-templates-view { padding: 20px 24px 40px; max-width: 1480px; }

/* Headers: flat panel, one line when possible */
.fs-header,
#app-shell :is(.operational-header, .clients-header, .view-header, .templates-header, .sim-form-header) {
  padding: 18px 20px;
  border: 1px solid var(--fs-line);
  border-radius: var(--fs-radius-card);
  background: var(--fs-surface);
  box-shadow: none;
}

.operational-header::after { display: none; }

.fs-header h1,
#app-shell :is(.operational-header h1, .clients-header h1, .view-header .header-title, .templates-header h1, .sim-form-header-titles h1) {
  font-size: clamp(22px, 1.7vw, 26px);
}

.fs-header__sub,
#app-shell :is(.operational-header p, .clients-header-titles p, .view-header .header-subtitle, .templates-header p, .sim-form-header-titles p) {
  margin-top: 4px;
  font-size: 14px;
}

.fs-eyebrow,
.operational-eyebrow { margin-bottom: 4px; }

.fs-card { padding: 20px; background: var(--fs-surface); box-shadow: none; }

#app-shell :is(.operational-stats, .fleet-stats) { gap: 8px; margin: 14px 0; }
#app-shell :is(.stat-card, .operational-stat) { padding: 10px 14px; border-color: var(--fs-line); background: var(--fs-surface-sunken); }

#app-shell :is(.clients-table-wrapper, .drivers-table-container) {
  border-color: var(--fs-line);
  background: var(--fs-surface);
  box-shadow: none;
}

/* ---------- Tile: the one card ---------- */
.fs-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 14px 16px 12px;
  border: 1px solid var(--fs-line);
  border-radius: 14px;
  background: var(--fs-surface);
  box-shadow: none;
  color: var(--fs-text-2);
  font-family: var(--font-body);
  font-size: 14px;
  letter-spacing: 0;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.fs-tile:hover { border-color: #334155; background: var(--fs-surface-raised); }
.fs-tile.is-selected,
.fs-tile[aria-current="true"] { border-color: rgba(96, 165, 250, 0.6); box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.35); }

.fs-tile__top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.fs-tile__titles { min-width: 0; }

.fs-tile__title {
  overflow: hidden;
  color: var(--fs-text);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fs-tile__sub {
  margin-top: 2px;
  overflow: hidden;
  color: var(--fs-text-3);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fs-brandmark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border: 1px solid var(--fs-line);
  border-radius: 11px;
  background: #16213a;
  color: var(--fs-text-2);
  font-size: 13px;
  font-weight: 700;
}

.fs-brandmark img { width: 24px; height: 24px; object-fit: contain; filter: brightness(0) invert(0.9); }

.fs-plate {
  padding: 0 5px;
  border: 1px solid #334155;
  border-radius: 4px;
  color: var(--fs-text-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.fs-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--fs-text-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.fs-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.fs-status[data-tone="success"] { background: rgba(16, 185, 129, 0.14); color: #6ee7b7; }
.fs-status[data-tone="info"] { background: rgba(59, 130, 246, 0.16); color: #93c5fd; }
.fs-status[data-tone="warning"] { background: rgba(245, 158, 11, 0.14); color: #fcd34d; }
.fs-status[data-tone="danger"] { background: rgba(239, 68, 68, 0.14); color: #fca5a5; }

.fs-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.fs-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid var(--fs-line);
  border-radius: 7px;
  background: var(--fs-surface-sunken);
  color: var(--fs-text-2);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.fs-chip .material-symbols-rounded { font-size: 15px; }
.fs-chip[data-energy="electrique"] { border-color: rgba(52, 211, 153, 0.3); color: #6ee7b7; }
.fs-chip[data-energy="hybride_phev"],
.fs-chip[data-energy="hybride"] { border-color: rgba(96, 165, 250, 0.35); color: #93c5fd; }
.fs-chip[data-energy="essence"] { border-color: rgba(251, 191, 36, 0.3); color: #fcd34d; }
.fs-chip[data-energy="diesel"] { border-color: rgba(148, 163, 184, 0.35); color: #cbd5e1; }

.fs-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  padding-top: 10px;
  border-top: 1px solid var(--fs-line);
}

.fs-facts > div { min-width: 0; }
.fs-facts__wide { grid-column: 1 / -1; }
.fs-facts dt { color: var(--fs-text-3); font-size: 12px; }
.fs-facts dd { margin: 1px 0 0; overflow: hidden; color: var(--fs-text); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.fs-facts:has(> div:nth-child(3):not(.fs-facts__wide)) { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.fs-due {
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
  font-size: 11px;
  font-weight: 700;
}

.fs-due[data-urgent="true"] { background: rgba(239, 68, 68, 0.16); color: #fca5a5; }

.fs-tile__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--fs-line);
}

.fs-tile__actions > .fs-btn { margin-left: -8px; }
.fs-tile__tools { display: flex; gap: 2px; }

.fs-icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--fs-text-3);
  cursor: pointer;
}

.fs-icon-btn .material-symbols-rounded { font-size: 19px; }
.fs-icon-btn:hover { background: rgba(148, 163, 184, 0.1); color: var(--fs-text); }
.fs-icon-btn[data-action="delete"]:hover,
.fs-icon-btn.template-delete-btn:hover { background: rgba(239, 68, 68, 0.12); color: #fca5a5; }

/* Grids of tiles */
#app-shell :is(.vehicle-grid, .templates-grid) {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 12px;
}

/* Legacy card rules must not leak into tiles */
#app-shell .vehicle-card.fs-tile,
#app-shell .template-card.fs-tile { padding: 14px 16px 12px; border-color: var(--fs-line); background: var(--fs-surface); box-shadow: none; transform: none; }
#app-shell .vehicle-card.fs-tile:hover,
#app-shell .template-card.fs-tile:hover { border-color: #334155; background: var(--fs-surface-raised); }
#app-shell .vehicle-card.fs-tile .fs-tile__actions { flex-wrap: nowrap; }

/* Segmented control (tabs that filter a list) */
.fs-segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 12px;
  padding: 3px;
  border: 1px solid var(--fs-line);
  border-radius: 10px;
  background: var(--fs-surface-sunken);
}

.fs-segmented button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--fs-text-3);
  font: 600 13px var(--font-body);
  cursor: pointer;
}

.fs-segmented button .material-symbols-rounded { font-size: 17px; }
.fs-segmented button:hover { color: var(--fs-text); }
.fs-segmented button[aria-pressed="true"] { background: rgba(59, 130, 246, 0.2); color: #fff; }

/* ---------- Tables (contacts, historical clients, drivers): compact rows ---------- */
#app-shell :is(.clients-table, .drivers-table) { width: 100%; border-collapse: collapse; font-size: 14px; letter-spacing: 0; }

#app-shell :is(.clients-table, .drivers-table) th {
  padding: 10px 16px;
  background: var(--fs-surface-sunken);
  color: var(--fs-text-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#app-shell :is(.clients-table, .drivers-table) td {
  padding: 9px 16px;
  border-top: 1px solid var(--fs-line);
  color: var(--fs-text-2);
  font-size: 14px;
  vertical-align: middle;
}

#app-shell :is(.client-row, .drivers-table tbody tr) { cursor: pointer; }
#app-shell :is(.client-row, .drivers-table tbody tr):hover { background: var(--fs-surface-raised); }
#app-shell .client-name { color: var(--fs-text); font-size: 14px; font-weight: 600; }
#app-shell .contact-company { display: block; margin-top: 1px; color: var(--fs-text-3); font-size: 12.5px; }
#app-shell .client-avatar-sm { width: 32px; height: 32px; font-size: 12px; }

#app-shell .contact-driver-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #93c5fd;
  font-weight: 600;
}

#app-shell .contact-driver-tag .material-symbols-rounded { font-size: 14px; }
#app-shell .client-status.fs-status { text-transform: none; letter-spacing: 0; }

#app-shell .btn-table-action {
  min-height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 13px;
}

#app-shell .client-actions { white-space: nowrap; text-align: right; }

/* Finder header tabs never wrap */
.finder-status-tab { white-space: nowrap; }

/* Row actions are icons; their name is in the tooltip */
#app-shell .client-actions .btn-table-action > span:not(.material-symbols-rounded) { display: none; }
#app-shell .client-actions .btn-table-action { width: 32px; justify-content: center; padding: 0; }

/* Facts wrap to a second row rather than truncating amounts and dates */
.fs-facts:has(> div:nth-child(3):not(.fs-facts__wide)) { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); }
.fs-facts dt { white-space: nowrap; }

/* ---------- List layout (Simulations & offres): one line per item ---------- */
.fs-list {
  container-type: inline-size;
  overflow: hidden;
  border: 1px solid var(--fs-line);
  border-radius: 14px;
  background: var(--fs-surface);
  font-family: var(--font-body);
  font-size: 14px;
  letter-spacing: 0;
}

.finder-list-cols {
  display: grid;
  grid-template-columns: minmax(170px, 2fr) minmax(110px, 1.4fr) 104px 168px minmax(130px, 1.2fr) 112px 96px 92px;
  align-items: center;
  gap: 12px;
}

.offers-list-cols {
  display: grid;
  grid-template-columns: minmax(170px, 2fr) 128px 168px minmax(140px, 1.6fr) 112px 96px 110px;
  align-items: center;
  gap: 12px;
}

.fs-list__head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 9px 16px;
  border-bottom: 1px solid var(--fs-line);
  background: var(--fs-surface-sunken);
  color: var(--fs-text-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fs-list__row {
  min-height: 56px;
  padding: 8px 16px;
  border-top: 1px solid var(--fs-line);
  color: var(--fs-text-2);
  cursor: pointer;
}

.fs-list__head + .fs-list__row { border-top: 0; }
.fs-list__row:hover { background: var(--fs-surface-raised); }
.fs-list__row:focus-visible { outline: 2px solid var(--fs-accent); outline-offset: -2px; }
.fs-list__row[aria-current="true"] { background: rgba(59, 130, 246, 0.1); box-shadow: inset 3px 0 0 var(--fs-accent); }

.fs-list__vehicle { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fs-list__vehicle .fs-brandmark { width: 34px; height: 34px; border-radius: 9px; }
.fs-list__vehicle .fs-brandmark img { width: 20px; height: 20px; }
.fs-list__titles { display: flex; flex-direction: column; min-width: 0; }
.fs-list__titles strong { overflow: hidden; color: var(--fs-text); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.fs-list__titles small { color: var(--fs-text-3); font-size: 12px; }
.fs-list__fav { color: #fbbf24; font-size: 15px; vertical-align: -2px; }
.fs-list__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-list__num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fs-list__cost { color: #34d399; font-weight: 700; }
.fs-list .fs-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@container (max-width: 1180px) {
  .finder-list-cols { grid-template-columns: minmax(170px, 2fr) minmax(110px, 1.4fr) 104px 168px minmax(130px, 1.2fr) 112px 96px; }
  .finder-list-cols > :nth-child(8) { display: none; }
}

/* Narrower lists drop the secondary columns */
@container (max-width: 900px) {
  .finder-list-cols { grid-template-columns: minmax(160px, 2fr) minmax(100px, 1.2fr) 100px 112px 96px; }
  .finder-list-cols > :nth-child(4),
  .finder-list-cols > :nth-child(5),
  .finder-list-cols > :nth-child(8) { display: none; }
  .offers-list-cols { grid-template-columns: minmax(160px, 2fr) 124px 112px 96px 100px; }
  .offers-list-cols > :nth-child(3),
  .offers-list-cols > :nth-child(4) { display: none; }
}

@container (max-width: 640px) {
  .finder-list-cols { grid-template-columns: minmax(0, 1fr) auto 104px; }
  .finder-list-cols > :not(:nth-child(1), :nth-child(3), :nth-child(6)) { display: none; }
  .offers-list-cols { grid-template-columns: minmax(0, 1fr) auto 104px; }
  .offers-list-cols > :not(:nth-child(1), :nth-child(2), :nth-child(5)) { display: none; }
}

@media (max-width: 768px) {
  .finder-list-toggle { display: none; }
}

/* Sortable column headers */
.fs-list__sort {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  margin: -4px -6px;
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.fs-list__sort .material-symbols-rounded { font-size: 15px; opacity: 0; transition: opacity 0.12s ease; }
.fs-list__sort:hover { background: rgba(148, 163, 184, 0.1); color: var(--fs-text); }
.fs-list__sort:hover .material-symbols-rounded,
.fs-list__sort:focus-visible .material-symbols-rounded { opacity: 0.6; }
.fs-list__sort.is-sorted { color: var(--fs-accent); }
.fs-list__sort.is-sorted .material-symbols-rounded { opacity: 1; }
.fs-list__num .fs-list__sort { flex-direction: row-reverse; }

/* ============================================
   PART 5 — SHARED WORKSPACE (js/ui/workspace.js)
   Same layout as Simulations & offres (finder.css) for every list screen.
   ============================================ */

#app-shell .ws-host {
  max-width: none;
  margin: 0;
  padding: 0 !important;
}

/* Lines: the workspace sets the column template for each width */
.ws-cols {
  display: grid;
  grid-template-columns: var(--ws-cols-3);
  align-items: center;
  gap: 12px;
}

@container (max-width: 1000px) {
  .ws-cols { grid-template-columns: var(--ws-cols-2); }
  .ws-cols > .ws-p3 { display: none; }
}

@container (max-width: 640px) {
  .ws-cols { grid-template-columns: var(--ws-cols-1); }
  .ws-cols > .ws-p2 { display: none; }
}

.fs-tile[tabindex]:focus-visible { outline: 2px solid var(--fs-accent); outline-offset: 2px; }

/* Primary header button (e.g. "Nouveau modèle") */
.ws-primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(96, 165, 250, 0.45);
  border-radius: 10px;
  background: var(--fs-primary);
  color: #fff;
  font: 600 13px var(--font-body);
  white-space: nowrap;
  cursor: pointer;
}

.ws-primary-btn:hover { background: var(--fs-primary-hover); }
.ws-primary-btn .material-symbols-rounded { font-size: 19px; }

/* Detail opened in the centre */
.ws-detail { overflow: hidden; }

.ws-detail__body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  padding: 20px 24px 32px;
  overflow-y: auto;
  color: var(--fs-text-2);
  font-size: 14px;
}

.ws-detail__section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--fs-line);
  border-radius: 12px;
  background: var(--fs-surface-sunken);
}

.ws-detail__section h3 {
  color: var(--fs-text);
  font-family: var(--font-display);
  font-size: 15px;
}

/* Context pane actions stack, the first one is primary */
.ws-layout .ctx-actions-bar { display: flex; flex-direction: column; gap: 8px; margin-top: auto; padding: 16px 0 0; background: none; }
.ws-layout .ctx-actions-bar .ctx-action-btn { width: 100%; justify-content: center; }
.ws-layout .ws-ctx-primary { border-color: rgba(96, 165, 250, 0.5); background: #2563eb; color: #fff; }
.ws-layout .ws-ctx-primary:hover { background: #3b82f6; }

@media (max-width: 768px) {
  .ws-primary-btn { height: 34px; padding: 0 10px; }
}

/* Vehicle dossier inside the workspace centre (Flotte active) */
.ws-dossier-host { display: flex; flex: 1; min-height: 0; flex-direction: column; }

.vehicle-dossier.vehicle-dossier--inline {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: auto;
  max-width: none;
  max-height: none;
  min-height: 0;
  margin: 0 24px 24px;
  overflow-y: auto;
  border: 1px solid var(--slate-800, #1e293b);
  border-radius: 16px;
  background: var(--slate-950, #020617);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  animation: none;
}

.vehicle-dossier--inline .dossier-header { padding: 16px 24px 12px; background: var(--slate-900, #0f172a); }
.vehicle-dossier--inline .dossier-header h2 { font-family: var(--font-display); font-size: 21px; }
.vehicle-dossier--inline .dossier-summary { padding: 12px 24px 16px; background: var(--slate-900, #0f172a); }
.vehicle-dossier--inline .dossier-summary > div { border-color: var(--fs-line); background: var(--fs-surface-sunken); }
.vehicle-dossier--inline .dossier-tabs { position: sticky; top: 0; z-index: 2; padding: 8px 20px; background: var(--slate-900, #0f172a); }
.vehicle-dossier--inline .dossier-content { padding: 16px 24px 28px; }

/* Kanban layout (Flotte active) */
.ws-kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(200px, 1fr);
  align-items: start;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.ws-kanban__col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
  padding: 10px;
  border: 1px solid var(--fs-line);
  border-radius: 12px;
  background: var(--fs-surface-sunken);
}

.ws-kanban__col > header { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 6px; }
.ws-kanban__count { color: var(--fs-text-3); font-size: 12px; font-weight: 700; }

.ws-kanban__card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--fs-line);
  border-radius: 10px;
  background: var(--fs-surface);
  color: var(--fs-text-2);
  font-size: 13px;
  cursor: pointer;
}

.ws-kanban__card:hover { border-color: #334155; background: var(--fs-surface-raised); }
.ws-kanban__card[aria-current="true"] { border-color: rgba(96, 165, 250, 0.6); }
.ws-kanban__card strong { color: var(--fs-text); font-size: 14px; }
.ws-kanban__card small { color: var(--fs-text-3); font-size: 12px; }
.ws-kanban__meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.ws-kanban__empty { color: var(--fs-text-3); font-size: 12px; text-align: center; padding: 12px 0; }

@media (max-width: 768px) {
  .vehicle-dossier.vehicle-dossier--inline { margin: 0 12px 12px; }
}

/* Breadcrumb: one line, long group names are shortened */
.ws-layout .finder-crumb-item { white-space: nowrap; }
.ws-layout .finder-crumb-current { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

/* Contacts: avatar and short lists inside a card */
.fs-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.14);
  color: #bfdbfe;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.fs-list__vehicle .fs-avatar { width: 34px; height: 34px; font-size: 12px; }
.ctx-hero-icon .fs-avatar { width: 100%; height: 100%; border: 0; }

.ws-detail__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.ws-mini-list { display: flex; flex-direction: column; gap: 6px; list-style: none; }

.ws-mini-list button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--fs-line);
  border-radius: 10px;
  background: var(--fs-surface);
  color: var(--fs-text-2);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ws-mini-list button:hover { border-color: #334155; background: var(--fs-surface-raised); }
.ws-mini-list .fs-brandmark { width: 32px; height: 32px; border-radius: 9px; }
.ws-mini-list .fs-brandmark img { width: 18px; height: 18px; }
.ws-mini-list .material-symbols-rounded { color: var(--fs-text-3); }
.ctx-dl dt { white-space: nowrap; }
.ctx-dl dd { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* US-016: pending vehicle requests counter in the sidebar (hidden when nothing waits). */
.nav-item .nav-badge{margin-left:auto;min-width:22px;padding:2px 7px;border-radius:999px;background:#c2410c;color:#fff;font-size:12px;font-weight:700;line-height:18px;text-align:center}
a.nav-item{text-decoration:none;color:inherit}
/* The hidden attribute must win over .nav-item { display: flex } for menu entries shown on condition. */
.nav-item[hidden],.nav-item .nav-badge[hidden]{display:none !important}

/* Cadrage 09/11 — profil d'organisation : groupes de champs, erreurs ciblées. */
.org-profile-fieldset { border: 0; margin: var(--space-4, 16px) 0 0; padding: 0; min-width: 0; }
.org-profile-fieldset[disabled] { opacity: .7; }
.settings-subtitle { font-size: .95rem; font-weight: 600; margin: 0 0 var(--space-2, 8px); padding: 0; }
.form-field-error { color: var(--fs-danger, #b91c1c); font-size: .85rem; margin: 4px 0 0; }
.input-field[aria-invalid="true"] { border-color: var(--fs-danger, #b91c1c); }
.org-profile-actions { display: flex; flex-wrap: wrap; gap: var(--space-2, 8px); justify-content: flex-end; }

/* Cadrage 09/11 — fiche collaborateur, import d'initialisation, fenêtres accessibles. */
.contact-indicators dd { display: flex; flex-direction: column; gap: 2px; }
.contact-indicator-source { color: var(--color-text-medium, #64748b); font-size: .78rem; line-height: 1.3; }
.contact-status-field { border: 0; margin: var(--space-3, 12px) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-3, 12px); align-items: center; }
.contact-status-field legend { width: 100%; margin-bottom: 4px; }
.contact-status-option { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; }
.contact-import-table { overflow-x: auto; margin: var(--space-3, 12px) 0; }
.contact-import-table table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.contact-import-table caption { text-align: left; font-weight: 600; padding-bottom: 6px; }
.contact-import-table th, .contact-import-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--fs-border, rgba(127,127,127,.2)); vertical-align: top; }
.contact-import-include, .contact-import-confirm { display: inline-flex; gap: 6px; align-items: flex-start; margin-top: 4px; }
.contact-import-actions { display: flex; justify-content: flex-end; margin-top: var(--space-3, 12px); }
.fs-dialog__notice { margin: 0; padding: 8px var(--space-5, 20px) var(--space-4, 16px); color: var(--fs-danger, #b91c1c); font-size: .85rem; }
.fs-dialog:focus { outline: none; }
.contact-import-dialog { max-width: 760px; width: calc(100vw - 32px); }
@media (max-width: 480px) { .fs-dialog .form-grid-2col { grid-template-columns: 1fr; } }
@media (max-width: 480px) {
  .contact-import-table table { font-size: .82rem; }
  .contact-import-table th, .contact-import-table td { padding: 6px 4px; }
  .contact-import-table td:last-child { min-width: 9.5em; }
}

/* Réserve qualification .56 : à largeur moyenne, les actions de l'en-tête ne débordent jamais.
   L'import devient une icône (nom accessible conservé), l'en-tête passe à la ligne si besoin. */
.ws-secondary-btn { background: rgba(15, 23, 42, 0.5); border-color: rgba(148, 163, 184, 0.25); color: var(--slate-200, #e2e8f0); }
.ws-secondary-btn:hover { background: rgba(59, 130, 246, 0.12); }
.finder-header-right { min-width: 0; }
@media (min-width: 769px) and (max-width: 1439px) {
  /* Deux rangées : fil d'Ariane et actions, puis recherche sur toute la largeur. */
  .finder-header { flex-wrap: wrap; height: auto; min-height: 68px; row-gap: 10px; column-gap: 12px; padding-top: 12px; padding-bottom: 12px; }
  .finder-header-left { flex: 1 1 auto; min-width: 0; }
  .finder-header-left .finder-breadcrumbs { min-width: 0; overflow: hidden; }
  .finder-header-right { flex: 0 1 auto; flex-wrap: nowrap; gap: 10px; }
  .finder-header-center { order: 3; flex: 1 1 100%; min-width: 0; justify-content: flex-start; }
  .finder-search-bar { width: 100%; min-width: 0; max-width: none; }
  .ws-secondary-btn { padding: 0 10px; }
  .ws-secondary-btn .ws-btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
/* Q56-02 : un nom d'organisation long ne pousse plus les valeurs « En bref » hors du panneau. */
.ctx-block, .ctx-dl, .ctx-dl > div { min-width: 0; max-width: 100%; }
.ctx-dl > div > dd { flex: 1 1 auto; }

/* Recalcul automatique des simulations (cadrage FunP 09/11) : un résultat en cours de mise à jour
   reste visible mais grisé et signalé, jamais présenté comme actuel. */
.sim-form-calc-status { margin: 6px 0 0; min-height: 1.4em; font-size: .9rem; color: var(--fs-text-muted, #94a3b8); }
.sim-form-calc-status[data-state="pending"]::before { content: ''; display: inline-block; width: .7em; height: .7em; margin-right: .5em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -1px; animation: sf-spin .8s linear infinite; }
.sim-form-calc-status[data-state="current"] { color: var(--fs-success, #34d399); }
.sim-form-calc-status[data-state="error"] { color: var(--fs-danger, #f87171); }
.sim-form-results--stale { opacity: .45; filter: grayscale(.6); transition: opacity .15s; pointer-events: none; }
@keyframes sf-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sim-form-calc-status[data-state="pending"]::before { animation: none; } .sim-form-results--stale { transition: none; } }
/* Q57-07 : rôle lecteur, pas de commande d'écriture inutilisable. */
.ws-readonly-note { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: var(--fs-text-2, #5b6472); }
.ws-readonly-note .material-symbols-rounded { font-size: 18px; }

@media (max-width: 768px) { #app-shell .mobile-brand { width: 100px; height: auto; } }
