/*
 * Habillage de toute l'administration au style des applications.
 * Maquette validee le 23/10/2026 : mockups/admin-02-identite-apps.html (menu A, Nuit).
 * Remplace le neomorphisme du 02/10 (mockups/admin-02-neumorphism.html).
 *
 * Charge en dernier : il habille les composants existants sans toucher aux
 * jetons de marque (tokens.css reste identique au theme partage, un test le
 * verifie). Meme langage que les apps : fond --surface-alt, cartes blanches a
 * filet, blocs forts en Nuit, action principale Safran en pilule (texte Nuit,
 * jamais blanc), filtres et onglets en pilules. Badges = statusColors du theme.
 */

:root {
  /* Teintes du texte sur fond Nuit, derivees de --ink-900 */
  --on-nuit: #c3d4ce;
  --on-nuit-muted: #9db3ab;
  --on-nuit-faint: #7e968e;
  --line-soft: var(--surface-sunk);
  --danger-soft: #fbe9e7;
  --danger-text: #c0383d;
  --info-soft: #e8f1fa;
  --success-soft: #e3f3e9;
  --brand-wash: rgba(245, 179, 35, 0.14);
}

body {
  background: var(--surface-alt);
}

/* ================================================================== Coquille */
.shell {
  background: var(--surface-alt);
}

/* Menu Nuit, comme les ecrans sombres des apps ; l'entree active passe au Safran. */
.sidebar {
  background: var(--ink-900);
  color: var(--on-nuit);
  padding: 20px 14px;
}

.sidebar .logo-tag,
.nav-group .title {
  color: var(--on-nuit-faint);
}

.sidebar nav a {
  color: var(--on-nuit);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 2px;
}

.sidebar nav a:hover {
  background: var(--accent-500);
  color: #fff;
}

.sidebar nav a.active,
.sidebar nav a.active:hover {
  background: var(--brand-500);
  color: var(--ink-900);
}

.sidebar .foot {
  border-top: 0;
  background: var(--accent-500);
  border-radius: var(--radius-md);
  padding: 12px;
}

.sidebar .foot .avatar {
  background: var(--brand-500);
  color: var(--ink-900);
}

.sidebar .foot .who span,
.sidebar .foot button {
  color: var(--on-nuit-muted);
}

.sidebar .foot button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.topbar {
  background: var(--surface-alt);
  border-bottom: 0;
  padding: 22px 28px 6px;
}

.topbar h1 {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.content {
  gap: 18px;
}

/* ================================================================== Briques */
.card {
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
}

.card h2 {
  font-size: var(--text-md);
  font-weight: 600;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-md);
  box-shadow: none;
  padding: 14px 16px;
}

.kpi .top {
  justify-content: flex-start;
  gap: 12px;
}

.kpi .ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.kpi .value {
  font-size: var(--text-xl);
  font-weight: 700;
  margin-top: 4px;
}

/* Le chiffre qui compte le plus : tuile Safran, comme le prix dans l'app. */
.kpi.hero {
  background: var(--brand-500);
  border-color: var(--brand-500);
}

.kpi.hero .label,
.kpi.hero .foot-line,
.kpi.hero .value small {
  color: var(--ink-700);
}

/* Jauge sous chaque compteur : un rail creux, rempli a la couleur du compteur. */
.gauge {
  height: 8px;
  border-radius: 99px;
  background: var(--surface-sunk);
  margin-top: 12px;
  overflow: hidden;
}

.gauge i {
  display: block;
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}

.gauge i.green {
  background: var(--success);
}
.gauge i.gold {
  background: var(--brand-500);
}
.gauge i.red {
  background: var(--danger);
}
.gauge i.blue {
  background: var(--info);
}

/* Boutons en pilule, comme dans les apps. */
.btn {
  border-radius: var(--radius-pill);
  padding: 10px 18px;
}

.btn-sm {
  border-radius: var(--radius-pill);
  padding: 7px 14px;
}

.btn-primary {
  background: var(--brand-500);
  color: var(--ink-900);
}

.btn-secondary {
  background: var(--ink-900);
  color: #fff;
}

.btn-ghost {
  background: var(--surface);
  color: var(--ink-900);
  border-color: var(--ink-100);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-alt);
  filter: none;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger-ghost {
  background: var(--surface);
  color: var(--danger);
  border: 1px solid var(--danger-soft);
}

.btn:disabled {
  background: var(--ink-100);
  border-color: transparent;
  color: var(--ink-300);
}

/* Champs : filet clair, contour Safran au focus (champs de l'app). */
.field input,
.field select,
.setting-value input,
.setting-value select,
.cc-row input,
.cc-field input,
.cc-save input,
.cc-side textarea,
.top-search input {
  background: var(--surface);
  border: 1px solid var(--ink-300);
  border-radius: var(--radius-sm);
  box-shadow: none;
}

/* Filtres de liste : pilules, comme les choix de type dans l'app. */
.toolbar .field input,
.toolbar .field select,
.top-search input {
  border-color: var(--ink-100);
  border-radius: var(--radius-pill);
  padding-inline: 14px;
}

.field input:focus,
.field select:focus,
.setting-value input:focus,
.setting-value select:focus,
.cc-row input:focus,
.cc-field input:focus,
.cc-side textarea:focus,
.top-search input:focus {
  outline: 2px solid var(--brand-500);
  outline-offset: 1px;
  border-color: var(--brand-500);
  background: var(--surface);
}

/* Etats : memes couleurs que statusColors (packages/shared/src/theme). */
.badge {
  padding: 3px 10px;
}

.badge-active,
.badge-approved,
.badge-online,
.badge-ride {
  background: var(--brand-100);
  color: var(--brand-700);
}
.badge-pending,
.badge-warning {
  background: var(--accent-100);
  color: var(--accent-600);
}
.badge-suspended,
.badge-rejected,
.badge-wait {
  background: var(--danger-soft);
  color: var(--danger-text);
}
.badge-shared {
  background: var(--info-soft);
  color: var(--info);
}
.badge-offline,
.badge-deleted,
.badge-neutral {
  background: var(--surface-sunk);
  color: var(--ink-500);
}

.plate {
  border: 1px solid var(--ink-100);
  border-radius: 6px;
  padding: 2px 8px;
  background: var(--surface-alt);
  font-weight: 700;
}

.avatar {
  background: var(--accent-100);
  color: var(--ink-900);
}

.avatar.has-photo {
  box-shadow:
    0 0 0 2px var(--surface),
    0 0 0 3px var(--brand-300);
}

/* Selecteurs a onglets (langue, onglets, plan / satellite) : rail creux, choix blanc. */
.lang-switch,
.legend-type {
  background: var(--surface-sunk);
  border: 0;
  box-shadow: none;
}

.lang-switch button.active,
.legend-type button.on {
  background: var(--surface);
  color: var(--ink-900);
  box-shadow: 0 1px 3px rgba(11, 38, 32, 0.15);
}

/* Onglets de page (Reglages) : pilules, l'onglet ouvert en Nuit. */
.tabs {
  background: none;
  padding: 0;
  gap: 6px;
  box-shadow: none;
}

.tabs button,
.tabs a {
  border: 1px solid var(--ink-100);
  background: var(--surface);
  color: var(--ink-700);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-weight: 500;
}

.tabs .on {
  background: var(--ink-900);
  border-color: var(--ink-900);
  color: #fff;
  box-shadow: none;
}

.workshop-pill {
  background: var(--accent-100);
  color: var(--ink-900);
  border: 1px dashed var(--accent-500);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
}

.alert {
  border-radius: var(--radius-md);
}

.alert-info {
  background: var(--accent-100);
  color: var(--ink-900);
}

/* Tableaux : en-tete sur bande creuse, lignes a filet doux. */
th {
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  padding: 10px 12px;
  background: var(--surface-alt);
  border-block: 1px solid var(--ink-100);
}

td {
  border-top: 0;
  border-bottom: 1px solid var(--line-soft);
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: var(--surface-alt);
}

/* Un tableau pose dans une carte va d'un bord a l'autre, comme une liste d'app. */
.card > .table-wrap {
  margin-inline: -20px;
}

.card > .table-wrap:last-child {
  margin-bottom: -18px;
}

.card > .table-wrap th:first-child,
.card > .table-wrap td:first-child {
  padding-inline-start: 20px;
}

.card > .table-wrap th:last-child,
.card > .table-wrap td:last-child {
  padding-inline-end: 20px;
}

/* ===================================================== Recherche du haut */
.top-search {
  position: relative;
  width: 300px;
}

.top-search .icon {
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-500);
  pointer-events: none;
}

.top-search input {
  width: 100%;
  font: inherit;
  font-size: 13px;
  padding-block: 11px;
  padding-inline: 40px 14px;
  color: var(--ink-900);
}

.top-results {
  position: absolute;
  top: calc(100% + 10px);
  inset-inline: 0;
  z-index: 700;
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  padding: 8px;
  max-height: 380px;
  overflow-y: auto;
}

.top-results button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  text-align: start;
  padding: 8px;
  border-radius: 12px;
  cursor: pointer;
  color: inherit;
}

.top-results button:hover {
  background: var(--surface-alt);
}

.top-results .avatar {
  width: 34px;
  height: 34px;
  font-size: 12px;
}

.top-results .who {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.top-results .who span,
.top-results .role {
  font-size: 12px;
  color: var(--ink-500);
}

/* ============================================================ Tableau de bord */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.dash-side {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.hour-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 180px;
  padding: 16px 16px 0;
  border-radius: 16px;
  background: var(--surface-alt);
}

.hc-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.hc-stack {
  width: 100%;
  max-width: 26px;
  min-height: 3px;
  display: flex;
  flex-direction: column;
  border-radius: 8px 8px 4px 4px;
  overflow: hidden;
}

.hc-stack i {
  display: block;
  min-height: 3px;
}
.hc-stack .pr {
  background: linear-gradient(180deg, var(--brand-300), var(--brand-500));
}
.hc-stack .sh {
  background: linear-gradient(180deg, #8fb6de, var(--info));
}

.hc-col span {
  font-size: 10.5px;
  color: var(--ink-500);
  padding-bottom: 8px;
}

.chart-legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--ink-500);
  margin-top: 12px;
}

.chart-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-inline-end: 6px;
  vertical-align: -1px;
}

.drv-list {
  display: grid;
  gap: 10px;
}

.drv-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--ink-100);
}

.drv-row .who {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.drv-row .who b {
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drv-row .who span {
  font-size: 12px;
  color: var(--ink-500);
}

.drv-row .amount {
  min-width: 80px;
  text-align: end;
}

.quick {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.quick-act {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 10px;
  border-radius: 18px;
  border: 1px solid var(--ink-100);
  background: var(--surface);
  color: var(--ink-700);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
}

.quick-act .icon {
  width: 46px;
  height: 46px;
  padding: 12px;
  border-radius: 14px;
  background: var(--brand-100);
  color: var(--brand-700);
}

.quick-act:hover {
  color: var(--ink-900);
}

.quick-act:active {
  background: var(--surface-alt);
}

.quick-n {
  position: absolute;
  top: 10px;
  inset-inline-end: 12px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  padding: 0 7px;
  border-radius: 99px;
}

.feed-item {
  border-top-color: var(--line-soft);
  align-items: flex-start;
}

.feed-well {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--surface-sunk);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.feed-well i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ================================================================ Call center */
.cc {
  background: var(--surface);
  border: 1px solid var(--ink-100);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-lg);
}

.cc-side {
  background: var(--surface);
}

.cc-step .n {
  background: var(--surface-sunk);
  color: var(--ink-500);
}

.cc-step .n.ok {
  background: var(--ink-900);
  color: #fff;
}

.cc-note,
.cc-new {
  background: var(--accent-100);
  border: 0;
}

.cc-chip {
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-pill);
}

.cc-chip.on-start {
  color: var(--success);
  background: var(--success-soft);
  border-color: var(--success-soft);
}
.cc-chip.on-end {
  color: var(--danger-text);
  background: var(--danger-soft);
  border-color: var(--danger-soft);
}

/* Type de course : carte a filet ; le choix porte le cadre et le fond Safran. */
.cc-type {
  background: var(--surface);
  border: 1px solid var(--ink-100);
}

.cc-type.on {
  background: var(--brand-100);
  color: var(--ink-900);
  border-color: var(--brand-500);
  box-shadow: inset 0 0 0 1px var(--brand-500);
}

/* Ce qui flotte sur la carte garde un fond franc, lisible sur la photo satellite. */
.cc-search input {
  background: var(--surface);
  box-shadow: 0 6px 20px rgba(11, 38, 32, 0.18);
}

/* ================================================================== Carte live */
.live {
  border-radius: var(--radius-lg);
  border: 1px solid var(--ink-100);
  box-shadow: var(--shadow-card);
}

.panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
}

.req {
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-md);
}

.req:hover {
  background: var(--surface-alt);
}

.chip,
.map-legend,
.map-filters button {
  background: rgba(255, 255, 255, 0.96);
}

.map-filters button.on {
  background: var(--ink-900);
}

/* ===================================================== Dossier du chauffeur */
.doc-card {
  background: var(--surface);
  border-radius: var(--radius-md);
}

.doc-card.doc-missing {
  background: var(--surface-alt);
  border-style: dashed;
}

.doc-thumb.doc-empty {
  background: transparent;
}

/* ===================================================================== Connexion */
.login-form {
  background: var(--surface-alt);
}

/* ================================================================== Responsive */
@media (max-width: 1100px) {
  .dash-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .top-search {
    width: 220px;
  }
}

@media (max-width: 900px) {
  /* Sur telephone, la ligne chauffeur passe sur deux lignes : identite en
     haut, plaque, etat et solde en dessous. */
  .drv-row {
    flex-wrap: wrap;
  }

  .drv-row .who {
    flex-basis: calc(100% - 60px);
  }

  .drv-row .amount {
    margin-inline-start: auto;
    min-width: 0;
  }

  .dash-grid > *,
  .dash-side > * {
    min-width: 0;
  }

  .top-search {
    display: none;
  }

  .quick {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Reglages : confirmation sur le bouton, a la place d'un bandeau. */
.btn.is-saved,
.btn.is-saved:disabled {
  color: var(--success);
  background: var(--success-soft);
}

.btn.is-saved .icon {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
}

/* Tableau de bord simplifie (maquette admin-02-tableau-de-bord-simple). */
#content:has(.dash-todo) {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.dash-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.dash-actions .btn .icon {
  width: 17px;
  height: 17px;
}

.dash-title {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
}

.card-head .dash-title {
  margin: 0;
}

/* A traiter : bandeau Nuit, comme la bande d'etat de l'accueil chauffeur. */
.dash-todo {
  background: var(--ink-900);
  border-color: var(--ink-900);
  color: #fff;
}

.dash-todo .dash-title {
  color: var(--on-nuit-muted);
}

.todo-items {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.todo-item {
  flex: 1 1 220px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--accent-500);
  color: #fff;
  text-decoration: none;
}

.todo-item:active {
  filter: brightness(1.1);
}

.todo-item .n {
  min-width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--brand-500);
  color: var(--ink-900);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 17px;
}

.todo-item .tx b {
  display: block;
  font-size: 13.5px;
}

.todo-item .tx span {
  font-size: 12px;
  color: var(--on-nuit-muted);
}

.todo-item .go {
  margin-inline-start: auto;
  color: var(--brand-300);
  font-weight: 700;
  font-size: 12.5px;
  white-space: nowrap;
}

.todo-item.urgent .n {
  background: var(--danger);
  color: #fff;
}

.todo-ok {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--brand-300);
  font-weight: 700;
}

.dash-nums {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dash-nums .kpi .label {
  color: var(--ink-500);
  font-size: 13px;
  font-weight: 600;
}

.dash-nums .kpi .value {
  margin-top: 6px;
}

.dash-more {
  display: block;
  text-align: center;
  padding-top: 10px;
}

@media (max-width: 900px) {
  .dash-nums {
    grid-template-columns: 1fr;
  }
}

/* Barre de filtres : un bouton d'action peut se ranger a l'autre bout. */
.toolbar-end {
  margin-inline-start: auto;
  align-self: flex-end;
}

.toolbar-end .icon {
  width: 16px;
  height: 16px;
}

/* Fenetre « Ajouter un agent » : les champs se suivent, un peu d'air entre eux. */
.agent-form .rd-label {
  margin-top: 10px;
}

/* Montants alignes a droite (a gauche en arabe) pour se comparer d'un coup d'oeil. */
th.num,
td.num {
  text-align: end;
  white-space: nowrap;
}

/* Courses : une ligne s'ouvre dans un panneau lateral. */
.rides-clickable tbody tr {
  cursor: pointer;
}

.rides-clickable tbody tr:hover,
.rides-clickable tbody tr.on {
  background: var(--brand-wash);
}

.ride-drawer {
  position: fixed;
  top: 0;
  inset-inline-end: 0;
  bottom: 0;
  width: min(440px, 100vw);
  z-index: 50;
  overflow-y: auto;
  padding: 22px 22px 32px;
  background: var(--surface);
  box-shadow: -12px 0 32px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

[dir='rtl'] .ride-drawer {
  box-shadow: 12px 0 32px rgba(0, 0, 0, 0.16);
}

.ride-drawer[hidden] {
  display: none;
}

.ride-drawer h2 {
  margin: 0;
  font-size: 18px;
}

.ride-drawer h3 {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
}

.rd-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.rd-drawer-head .icon {
  width: 18px;
  height: 18px;
}

.rd-summary {
  border-radius: 18px;
  border: 1px solid var(--ink-100);
  padding: 14px 16px;
  display: grid;
  gap: 6px;
}

.rd-total {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.rd-person {
  display: grid;
  gap: 2px;
}

.rd-passenger {
  border-radius: 16px;
  border: 1px solid var(--ink-100);
  padding: 12px 14px;
  display: grid;
  gap: 8px;
}

.rd-passenger + .rd-passenger {
  margin-top: 10px;
}

.rd-passenger-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.rd-fare {
  font-weight: 800;
  white-space: nowrap;
}

.rd-trip {
  font-size: 13px;
  line-height: 1.6;
}

.rd-trip .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-inline-end: 6px;
}

.rd-trip .dot.start {
  background: var(--success);
}

.rd-trip .dot.end {
  background: var(--danger);
}

.rd-trip .arrow {
  margin-inline: 6px;
  color: var(--ink-500);
}

.ride-drawer dl {
  margin: 0;
  display: grid;
  gap: 4px;
  font-size: 12.5px;
}

.dl-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.dl-row dt {
  color: var(--ink-500);
}

.dl-row dd {
  margin: 0;
  text-align: end;
}

.rd-timeline,
.rd-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  font-size: 13px;
}

.rd-timeline li {
  display: grid;
  gap: 1px;
  padding-inline-start: 14px;
  border-inline-start: 2px solid var(--brand-300, #fad27a);
}

.rd-timeline .when {
  font-size: 11.5px;
  color: var(--ink-500);
}

/* ======================================================= Tableau d'analyse */
#content:has(.viz-body) {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.viz-filters {
  flex-wrap: wrap;
  align-items: flex-end;
}

.viz-hours {
  display: flex;
  align-items: center;
  gap: 6px;
}

.viz-body {
  display: flex;
  flex-direction: column;
  gap: 22px;
  transition: opacity 0.15s;
}

/* Rechargement : l'image precedente reste, estompee, sans saut de mise en page. */
.viz-body.loading {
  opacity: 0.5;
}

.viz-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.viz-kpis .kpi .label {
  color: var(--ink-500);
  font-size: 13px;
  font-weight: 600;
}

.viz-kpis .kpi .value {
  font-size: 28px;
  margin-top: 6px;
}

.viz-grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.viz-grid3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  align-items: start;
}

.viz-card h2 {
  font-size: 15px;
  margin: 0;
}

.viz-sub {
  margin: 4px 0 8px;
  font-size: 12.5px;
}

.viz-plot {
  min-height: 60px;
}

.viz-scroll {
  overflow-x: auto;
}

/* Grille et axes en retrait : la donnee passe devant. */
.viz-grid {
  stroke: rgba(11, 38, 32, 0.08);
  stroke-width: 1;
}

.viz-base {
  stroke: var(--ink-300);
  stroke-width: 1;
}

.viz-axis {
  fill: var(--ink-500);
  font-size: 11px;
  font-family: inherit;
}

.viz-hit {
  fill: transparent;
  outline: none;
}

.viz-hit.hover,
.viz-hit:focus-visible {
  fill: var(--brand-wash);
}

.viz-cell {
  outline: none;
}

.viz-cell.hover,
.viz-cell:focus-visible {
  stroke: var(--ink-900);
  stroke-width: 1.5;
}

.viz-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--ink-700);
  margin: 8px 0 4px;
}

.viz-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-inline-end: 6px;
  vertical-align: -1px;
}

.viz-tip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  background: var(--surface);
  color: var(--ink-900);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
  padding: 8px 10px;
  font-size: 12px;
  min-width: 140px;
}

.viz-tip[hidden] {
  display: none;
}

.viz-tip-title {
  color: var(--ink-500);
  margin-bottom: 4px;
}

.viz-tip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.6;
}

/* Cle de serie en trait court : a cette densite, un carre plein pese trop. */
.viz-tip-row i {
  width: 12px;
  height: 3px;
  border-radius: 2px;
}

.viz-tip-row b {
  font-weight: 800;
  min-width: 48px;
}

.viz-tip-row span {
  color: var(--ink-500);
}

.viz-barlist {
  display: grid;
  gap: 10px;
}

.viz-barrow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  font-size: 13px;
}

.viz-barlabel {
  grid-row: 1;
  grid-column: 1;
  min-width: 0;
}

.viz-barlabel b {
  display: block;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viz-barlabel span {
  font-size: 11.5px;
  color: var(--ink-500);
}

.viz-barvalue {
  grid-row: 1;
  grid-column: 2;
  font-weight: 800;
  white-space: nowrap;
  align-self: start;
}

.viz-bartrack {
  grid-column: 1 / -1;
  height: 8px;
  border-radius: 99px;
  background: var(--surface-sunk);
  overflow: hidden;
}

.viz-bartrack i {
  display: block;
  height: 100%;
  border-radius: 99px;
}

@media (max-width: 1100px) {
  .viz-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .viz-grid2,
  .viz-grid3 {
    grid-template-columns: 1fr;
  }
}

/* Les axes des graphiques se lisent de gauche a droite, en arabe aussi : sinon
   les libelles ancres « end » passent de l'autre cote et se coupent. */
.viz-plot svg {
  direction: ltr;
}
