/* =========================================================================
   Jetons de couleur
   =========================================================================
   Une seule couche sémantique pour les deux thèmes. Le thème clair n'est pas
   une inversion automatique du sombre : chaque valeur est choisie contre sa
   propre surface, et les deux teintes de graphique ont été repassées au
   validateur de palette pour le fond blanc — le turquoise sombre y tombait
   sous le plancher de saturation et se lisait comme un gris.

   L'écran de connexion garde volontairement ses couleurs en dur : c'est une
   page pleine, dessinée comme telle, et elle ne suit pas la bascule.
   ========================================================================= */

:root {
  color-scheme: dark;

  /* Surfaces */
  --bg: #0a1222;
  --bg-soft: #0f1a31;
  --panel: #152443;
  --panel-2: #0b1730;
  --panel-3: #10203c;
  --line: #22385f;
  --voile: rgba(255, 255, 255, 0.04);
  --survol: rgba(255, 255, 255, 0.06);
  --ombre-carte: 0 10px 24px rgba(4, 10, 22, 0.35);
  --lueur-fond: rgba(87, 211, 200, 0.14);

  /* Encres */
  --text: #f1f6ff;
  --text-fort: #f6f9ff;
  --muted: #9eb1d8;
  --muted-2: #a6b3cf;

  /* Marque */
  --brand: #57d3c8;
  --brand-ink: #062225;
  --brand-doux: rgba(87, 211, 200, 0.12);
  --brand-bord: rgba(87, 211, 200, 0.34);
  --brand-plein: linear-gradient(135deg, #2c7f86 0%, #24697a 55%, #1f5f74 100%);
  --brand-plein-ink: #ecfeff;

  /* Contrôles */
  --field-bg: #0e1b33;
  --btn-bg: #10203c;
  --btn-bord: #35557f;
  --btn-bord-vif: #5f83bb;
  --btn-grad: linear-gradient(135deg, #273f63 0%, #1d3351 52%, #193e54 100%);
  --btn-grad-actif: linear-gradient(135deg, #4b6797 0%, #345a8a 50%, #2a5f7e 100%);
  --btn-ombre: 0 10px 22px rgba(5, 18, 40, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.16);

  /* États */
  --ok: #7fe0b8;
  --ok-bg: rgba(60, 190, 140, 0.12);
  --ok-bord: rgba(60, 190, 140, 0.3);
  --danger: #ffa8b4;
  --danger-bg: rgba(207, 90, 106, 0.16);
  --danger-bord: rgba(207, 90, 106, 0.42);
  --danger-plein: #c03a4a;
  --danger-plein-survol: #a92f3d;
  --attente: #e8c37e;
  --attente-bg: rgba(220, 170, 80, 0.12);
  --attente-bord: rgba(220, 170, 80, 0.3);
  --neutre: #a6b6d4;
  --neutre-bg: rgba(160, 180, 220, 0.1);
  --neutre-bord: rgba(160, 180, 220, 0.24);
  --accent-doux: rgba(120, 170, 255, 0.14);
  --accent-bord: rgba(120, 170, 255, 0.34);
  --lien: #9fd8ff;

  /* Graphiques */
  --chart-vues: #31a99e;
  --chart-visiteurs: #cf7f3c;
  --dash-aire: rgba(49, 169, 158, 0.16);
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #e9eef6;
  --bg-soft: #f4f7fb;
  --panel: #ffffff;
  --panel-2: #ffffff;
  --panel-3: #f2f5fa;
  --line: #dbe3ef;
  --voile: rgba(20, 40, 80, 0.03);
  --survol: rgba(20, 40, 80, 0.05);
  --ombre-carte: 0 6px 18px rgba(20, 40, 80, 0.07);
  --lueur-fond: rgba(14, 143, 128, 0.09);

  --text: #14213d;
  --text-fort: #0b1730;
  --muted: #5f7089;
  --muted-2: #6b7d96;

  --brand: #0e8f80;
  --brand-ink: #ffffff;
  --brand-doux: rgba(14, 143, 128, 0.1);
  --brand-bord: rgba(14, 143, 128, 0.32);
  --brand-plein: linear-gradient(135deg, #0e8f80 0%, #0a7a6d 100%);
  --brand-plein-ink: #ffffff;

  --field-bg: #ffffff;
  --btn-bg: #ffffff;
  --btn-bord: #ccd6e5;
  --btn-bord-vif: #9db3d0;
  --btn-grad: linear-gradient(180deg, #ffffff 0%, #f1f5fa 100%);
  --btn-grad-actif: linear-gradient(135deg, #0e8f80 0%, #0b7d70 100%);
  --btn-ombre: 0 2px 5px rgba(20, 40, 80, 0.07);

  --ok: #0a7550;
  --ok-bg: rgba(10, 117, 80, 0.1);
  --ok-bord: rgba(10, 117, 80, 0.26);
  --danger: #b0203a;
  --danger-bg: rgba(176, 32, 58, 0.08);
  --danger-bord: rgba(176, 32, 58, 0.26);
  --danger-plein: #b0203a;
  --danger-plein-survol: #8e1a2f;
  --attente: #8a6212;
  --attente-bg: rgba(138, 98, 18, 0.1);
  --attente-bord: rgba(138, 98, 18, 0.24);
  --neutre: #5f7089;
  --neutre-bg: rgba(95, 112, 137, 0.09);
  --neutre-bord: rgba(95, 112, 137, 0.22);
  --accent-doux: rgba(30, 90, 190, 0.09);
  --accent-bord: rgba(30, 90, 190, 0.26);
  --lien: #1257a8;

  --chart-vues: #0e8f80;
  --chart-visiteurs: #bf6a12;
  --dash-aire: rgba(14, 143, 128, 0.13);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: radial-gradient(circle at 12% 10%, var(--lueur-fond), transparent 30%), var(--bg);
  color: var(--text);
  transition: background-color 180ms ease, color 180ms ease;
}

.hidden { display: none !important; }

.admin-app {
  min-height: 100vh;
}

.login-wrap {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(70% 110% at 8% 100%, rgba(75, 119, 197, 0.32), transparent 62%),
    radial-gradient(80% 120% at 100% 15%, rgba(33, 163, 189, 0.24), transparent 62%),
    linear-gradient(112deg, #081326 0%, #10253c 52%, #0c2531 100%);
}

.login-wrap::before {
  content: "";
  position: absolute;
  inset: -12% -10%;
  background: repeating-linear-gradient(90deg, rgba(135, 179, 241, 0.1) 0 2px, transparent 2px 210px);
  opacity: 0.24;
  transform: skewX(-9deg);
  filter: blur(0.9px);
  z-index: -2;
}

.login-wrap::after {
  content: "";
  position: absolute;
  right: -160px;
  bottom: -280px;
  width: 500px;
  height: 760px;
  background: linear-gradient(180deg, rgba(20, 43, 78, 0.2), rgba(11, 31, 50, 0.96));
  transform: rotate(19deg);
  clip-path: polygon(36% 0, 100% 0, 100% 100%, 0 100%);
  z-index: -1;
}

.login-topbar {
  position: absolute;
  top: 16px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.login-brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #d8e6ff;
  background: rgba(68, 104, 156, 0.45);
  border: 1px solid rgba(141, 177, 231, 0.32);
}

.login-brand-text {
  display: grid;
  gap: 1px;
  line-height: 1.1;
}

.login-brand-text strong {
  font-size: 14px;
  letter-spacing: 0.04em;
}

.login-brand-text span {
  font-size: 11px;
  color: var(--muted);
}

.login-version {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #cce0ff;
  background: rgba(60, 90, 126, 0.55);
  border: 1px solid rgba(141, 177, 231, 0.28);
}

.login-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, rgba(24, 43, 74, 0.9), rgba(19, 37, 64, 0.9));
  border: 1px solid rgba(70, 104, 156, 0.38);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 24px 48px rgba(1, 10, 24, 0.6), inset 0 1px 0 rgba(176, 210, 255, 0.08);
  backdrop-filter: blur(6px);
}

.login-card h1 {
  margin: 0;
  text-align: center;
  font-size: 1.8rem;
  letter-spacing: 0.01em;
}

.login-card p {
  margin: 8px 0 16px;
  text-align: center;
  color: #9cb1d9;
  font-size: 0.92rem;
}

.login-form label {
  display: grid;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #839bc7;
  margin-bottom: 10px;
}

.login-form input {
  border: 1px solid #2c4870;
  background: #0d1e37;
  border-radius: 10px;
  padding: 11px 12px;
}

.login-form input:focus {
  outline: none;
  border-color: #7fa7df;
  box-shadow: 0 0 0 3px rgba(109, 154, 223, 0.22);
}

.login-row {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

#login-form .login-row button[type="submit"] {
  width: 100%;
  text-align: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b5382 0%, #274873 52%, #1f5a79 100%);
  color: #f4f8ff;
  border: 1px solid #5d7fb5;
  font-weight: 700;
  box-shadow: 0 12px 26px rgba(8, 25, 53, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

#login-form .login-row button[type="submit"]:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(8, 25, 53, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

#login-form .login-row button[type="submit"]:active {
  transform: translateY(0);
  filter: brightness(0.98);
}

.login-link {
  color: #93a9d1;
  text-decoration: none;
  justify-self: end;
  font-size: 12px;
}

.login-link:hover {
  color: #c7dcff;
  text-decoration: underline;
}

.login-foot {
  margin-top: 14px;
  border-top: 1px solid rgba(136, 168, 214, 0.2);
  padding-top: 12px;
  display: grid;
  gap: 6px;
  text-align: center;
  color: #8ea6cf;
  font-size: 12px;
}

.login-foot small {
  color: #7892c2;
}

.dashboard {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  min-height: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--panel-2);
  border-right: 1px solid var(--line);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand strong {
  display: block;
  font-size: 1.15rem;
}

.brand span {
  color: var(--muted);
  font-size: 0.9rem;
}

.menu {
  display: grid;
  gap: 8px;
}

button {
  border: 1px solid var(--line);
  background: var(--btn-bg);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: center;
  cursor: pointer;
}

#dashboard button {
  border: 1px solid var(--btn-bord);
  background: var(--btn-grad);
  color: var(--text-fort);
  box-shadow: 0 10px 22px rgba(5, 18, 40, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

#dashboard button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  border-color: var(--btn-bord-vif);
  box-shadow: 0 14px 26px rgba(5, 18, 40, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

#dashboard button:active {
  transform: translateY(0);
  filter: brightness(0.98);
}

#dashboard .menu-item,
#dashboard .logout-btn {
  text-align: left;
}

#dashboard .menu-item.is-active {
  background: var(--btn-grad-actif);
  color: var(--text-fort);
  border-color: #7fa1d8;
  box-shadow: 0 16px 30px rgba(8, 25, 53, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  font-weight: 700;
}

.logout-btn {
  margin-top: 0;
}

.menu-separator {
  height: 1px;
  width: 100%;
  background: var(--line);
}

/* La colonne de droite empile la barre supérieure et la zone défilante : c'est
   elle qui porte la hauteur, pas le contenu, sinon la barre défilerait avec. */
.colonne-principale {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100vh;
  overflow: hidden;
}

.content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  display: grid;
  gap: 16px;
  align-content: start;
}

.panel-view { display: none; }
.panel-view.is-active { display: block; }

.panel-head h2 {
  margin: 0;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.card {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

.card h3 {
  margin: 0 0 10px;
}

/* Le titre à gauche, les actions à droite : la barre d'outils d'une liste se
   lit toujours aux mêmes deux endroits, quelle que soit la vue. */
.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.table-head h3 {
  margin: 0;
}

.table-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-tools {
  margin-bottom: 12px;
}

.table-tools input {
  max-width: 460px;
}

.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: rgba(87, 211, 200, 0.08);
  border: 1px solid rgba(87, 211, 200, 0.35);
  border-radius: 10px;
}

.bulk-count {
  color: var(--text);
}

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

.bulk-actions button {
  padding: 8px 12px;
}

.bulk-actions .btn-danger {
  background: var(--danger-plein);
  color: #fff;
  border: 0;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.bulk-actions .btn-danger:hover {
  background: var(--danger-plein-survol);
}

.col-select {
  width: 36px;
  text-align: center;
}

.col-select input[type="checkbox"],
.row-select input[type="checkbox"] {
  cursor: pointer;
  transform: scale(1.1);
}

.subtabs {
  margin-top: 14px;
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--voile);
}

.subtab-btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--voile);
  color: var(--muted-2);
  font-weight: 600;
  cursor: pointer;
}

.subtab-btn.is-active {
  background: var(--btn-grad-actif);
  color: var(--text-fort);
  border-color: #7fa1d8;
  box-shadow: 0 12px 24px rgba(8, 25, 53, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.plans-subview {
  display: none;
}

.plans-subview.is-active {
  display: block;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--field-bg);
  color: var(--text);
  border-radius: 10px;
  padding: 10px;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 1000px var(--field-bg) inset;
  -webkit-box-shadow: 0 0 0 1000px var(--field-bg) inset;
  transition: background-color 9999s ease-in-out 0s;
}

textarea {
  resize: vertical;
}

.grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full { grid-column: 1 / -1; }

.actions {
  display: flex;
  gap: 8px;
  align-items: end;
}

.actions button,
#dashboard button[type="submit"] {
  font-weight: 700;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 18, 0.72);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
}

.modal-card {
  width: min(760px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

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

.modal-head h3 {
  margin: 0;
}

.modal-close {
  background: var(--btn-grad) !important;
  color: var(--text-fort) !important;
  border: 1px solid var(--btn-bord) !important;
}

.btn-muted {
  background: var(--btn-grad) !important;
  color: var(--text-fort) !important;
  border: 1px solid var(--btn-bord) !important;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

#dashboard .table-sort-btn {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0;
  color: var(--text);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#dashboard .table-sort-btn:hover {
  border: 0 !important;
  transform: none !important;
  filter: none !important;
  color: var(--text-fort);
}

#dashboard .table-sort-btn.is-active-sort {
  color: var(--brand);
}

.sort-indicator {
  font-size: 0.72rem;
  opacity: 0.9;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  white-space: nowrap;
}

.lead-message {
  max-width: 420px;
  white-space: normal;
  word-break: break-word;
  color: var(--text);
}

.message {
  margin: 10px 0 0;
  color: var(--muted);
}

@media (max-width: 980px) {
  .login-topbar {
    top: 12px;
    left: 14px;
    right: 14px;
  }

  .dashboard {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    overflow: visible;
    z-index: 20;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 12px;
  }

  .content {
    height: auto;
    overflow: visible;
  }

  .menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .logout-btn {
    margin-top: 0;
  }

  .table-tools input {
    max-width: 100%;
  }
}

@media (max-width: 760px) {
  .login-wrap {
    padding: 62px 14px 14px;
  }

  .login-card {
    width: 100%;
    padding: 18px;
  }

  .login-card h1 {
    font-size: 1.55rem;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .menu {
    grid-template-columns: 1fr;
  }
}

tr.row-editable {
  cursor: pointer;
  transition: background .12s ease;
}

tr.row-editable:hover {
  background: rgba(106, 168, 255, 0.08);
}

tr.row-editable:hover td {
  background: transparent;
}

.feature-media-section {
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  margin-top: 6px;
}

.form-section-title {
  margin: 0 0 4px 0;
  font-size: 15px;
  color: var(--text-fort);
}

.form-help {
  margin: 0 0 10px 0;
  font-size: 12px;
  color: var(--muted);
}

.feature-media-list {
  list-style: none;
  padding: 0;
  margin: 0 0 10px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feature-media-empty {
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  padding: 6px 0;
}

.feature-media-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 6px;
  background: var(--voile);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.feature-media-item .media-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
}

.feature-media-item .media-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: rgba(80, 120, 200, 0.25);
  color: var(--text);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.feature-media-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.feature-media-info .media-url {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feature-media-info .media-meta {
  font-size: 11px;
  color: var(--muted);
}

.feature-media-actions {
  display: flex;
  gap: 4px;
}

.feature-media-actions button {
  padding: 4px 8px !important;
  font-size: 12px !important;
  min-width: 28px;
}

.feature-media-upload {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: rgba(80, 140, 255, 0.06);
  border: 1px dashed var(--btn-bord);
  border-radius: 8px;
  margin-bottom: 10px;
}

.feature-media-file-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

.feature-media-file-label input[type="file"] {
  max-width: 240px;
}

.feature-media-upload-status {
  font-size: 12px;
  color: var(--muted);
}

.feature-media-upload-status.is-success {
  color: var(--ok);
}

.feature-media-upload-status.is-error {
  color: var(--danger);
}

.feature-media-add {
  display: grid;
  grid-template-columns: 110px 1fr 1fr auto;
  gap: 6px;
  align-items: center;
}

.feature-media-add input,
.feature-media-add select {
  padding: 6px 8px;
}

@media (max-width: 700px) {
  .feature-media-add {
    grid-template-columns: 1fr;
  }
  .feature-media-item {
    grid-template-columns: 40px 1fr;
  }
  .feature-media-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

/* ==========================================================================
   Password field avec bouton oeil (toggle visibilite)
   ========================================================================== */

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 42px;
  width: 100%;
}

.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--muted-2);
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.password-toggle:hover {
  background: var(--survol);
  color: var(--text-fort);
}

.password-toggle:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.6);
  outline-offset: 2px;
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
}

.password-toggle .icon-eye-off {
  display: none;
}

.password-toggle.is-visible .icon-eye {
  display: none;
}

.password-toggle.is-visible .icon-eye-off {
  display: block;
}

/* ==========================================================================
   Icon picker
   ========================================================================== */

.icon-picker {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.icon-picker-trigger {
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--voile);
  color: var(--text-fort);
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
  transition: background 160ms ease, border-color 160ms ease;
}

.icon-picker-trigger:hover {
  background: var(--survol);
  border-color: rgba(140, 175, 240, 0.5);
}

.icon-picker-trigger.has-value .icon-picker-label {
  color: var(--text-fort);
}

.icon-picker-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.14);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--brand);
  flex-shrink: 0;
}

.icon-picker-preview:empty {
  background: var(--survol);
  border-color: var(--line);
}

.icon-picker-preview svg {
  width: 16px;
  height: 16px;
}

.icon-picker-label {
  flex: 1;
  color: var(--muted-2);
  font-family: "JetBrains Mono", "SF Mono", Menlo, monospace;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.icon-picker-arrow {
  color: var(--muted-2);
  font-size: 0.8rem;
}

.icon-picker-clear {
  width: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--voile);
  color: var(--muted-2);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.icon-picker-clear:hover {
  background: rgba(252, 110, 129, 0.14);
  color: var(--danger);
  border-color: rgba(252, 110, 129, 0.3);
}

/* Modal */
.icon-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.icon-picker-modal[hidden] { display: none; }

.icon-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 22, 0.78);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.icon-picker-dialog {
  position: relative;
  width: min(820px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: rgba(13, 20, 36, 0.98);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(3, 8, 18, 0.6);
  overflow: hidden;
}

.icon-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--survol);
}

.icon-picker-head h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-fort);
}

.icon-picker-close {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--voile);
  color: var(--text-fort);
  font-size: 1.4rem;
  line-height: 1;
  font-family: var(--font-body, system-ui), sans-serif;
  cursor: pointer;
  transition: background 160ms ease;
}

.icon-picker-close:hover {
  background: var(--line);
}

.icon-picker-search {
  padding: 14px 22px;
  border-bottom: 1px solid var(--survol);
}

.icon-picker-search input {
  width: 100%;
  background: var(--voile);
  border: 1px solid var(--line);
  color: var(--text-fort);
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  font-size: 0.94rem;
}

.icon-picker-search input:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.icon-picker-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 22px 22px;
}

.icon-picker-category + .icon-picker-category {
  margin-top: 20px;
}

.icon-picker-category-title {
  margin: 0 0 10px;
  font-family: "JetBrains Mono", "SF Mono", Menlo, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 600;
}

.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}

.icon-picker-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--survol);
  background: var(--voile);
  color: var(--text-fort);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
  font: inherit;
}

.icon-picker-tile:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.icon-picker-tile.is-selected {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.4);
}

.icon-picker-tile-svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--brand);
}

.icon-picker-tile-svg svg {
  width: 22px;
  height: 22px;
}

.icon-picker-tile-name {
  font-family: "JetBrains Mono", "SF Mono", Menlo, monospace;
  font-size: 0.7rem;
  color: var(--muted-2);
  word-break: break-all;
  text-align: center;
  line-height: 1.2;
}

.icon-picker-empty {
  margin: 20px 0;
  text-align: center;
  color: var(--muted-2);
}

body.icon-picker-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .icon-picker-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }
  .icon-picker-tile {
    padding: 10px 6px 8px;
  }
}

/* ---------- Carrousel hero ---------- */
.hero-page-label {
  font-weight: 500;
  opacity: 0.7;
}

.hero-settings {
  align-items: end;
}

.hero-thumb {
  width: 96px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--survol);
  display: block;
}

.hero-thumb.is-broken {
  visibility: hidden;
}

.hero-url-cell {
  max-width: 280px;
  overflow-wrap: anywhere;
  font-size: 0.85em;
}

.hero-slide-preview {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 10px;
  margin-top: 4px;
}

.hero-upload {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* =========================================================================
   Statistiques de visite
   ========================================================================= */

.stats-periode {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.stats-periode label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.stats-periode input[type="date"] {
  padding: 6px 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
}

.stats-range.is-active {
  background: var(--brand);
  color: var(--brand-ink);
  border-color: var(--brand);
}

/* --- Indicateurs cles --- */

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

.stats-kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stats-kpi-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.stats-kpi-value {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
}

/* --- Graphique d'évolution ---
   Courbes en SVG écrit à la main : une bibliothèque de graphiques serait une
   dépendance externe pour un besoin que ces règles couvrent.

   Les deux teintes ne sont pas choisies à l'œil. Elles sont vérifiées sur le
   fond des cartes (--panel) : écart de perception suffisant sous les trois
   formes de daltonisme, et contraste supérieur à 3:1 sur ce fond. */

:root {
  --chart-vues: #31a99e;
  --chart-visiteurs: #cf7f3c;
}

.stats-chart {
  position: relative;
  margin-top: 4px;
  border-radius: 10px;
  /* overflow-y explicite : sans lui, la barre horizontale rend la boite trop
     haute pour elle-meme et le navigateur ajoute une seconde barre, verticale,
     a l'interieur de la carte. */
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  transition: opacity 140ms ease;
}

.stats-chart::-webkit-scrollbar {
  height: 8px;
}

.stats-chart::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

/* Pendant un rechargement, le graphique garde son dessin en retrait : pas de
   squelette, pas de saut de mise en page. */
.stats-chart.is-refetching {
  opacity: 0.45;
}

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

/* Le texte du SVG se réduit avec le dessin. En dessous de cette largeur les
   graduations deviendraient illisibles : la carte défile plutôt que d'écraser. */
.stats-chart svg {
  display: block;
  width: 100%;
  min-width: 540px;
  height: auto;
  overflow: visible;
}

/* Grille et axes : filet plein d'un cran au-dessus du fond, jamais en pointillé. */
.stats-grid-line {
  stroke: var(--line);
  stroke-width: 1;
}

.stats-axis-text {
  fill: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.stats-serie-line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* Anneau de 2px dans la couleur du fond : le point reste lisible là où les deux
   courbes se croisent. */
.stats-serie-dot {
  stroke: var(--panel);
  stroke-width: 2;
}

.stats-serie--vues {
  stroke: var(--chart-vues);
}

.stats-serie--vues.stats-serie-dot {
  fill: var(--chart-vues);
  stroke: var(--panel);
}

.stats-serie--visiteurs {
  stroke: var(--chart-visiteurs);
}

.stats-serie--visiteurs.stats-serie-dot {
  fill: var(--chart-visiteurs);
  stroke: var(--panel);
}

/* Les valeurs portent une couleur de texte, jamais celle de la série : c'est le
   trait coloré à côté qui donne l'identité. */
.stats-end-label {
  fill: var(--text);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stats-crosshair {
  stroke: var(--muted);
  stroke-width: 1;
  opacity: 0.5;
}

/* --- Histogramme des appareils ---
   Une seule serie : la teinte est celle des visiteurs dans la courbe du dessus,
   pour que la couleur garde le meme sens d'un graphique a l'autre. */

.stats-bar {
  fill: var(--chart-visiteurs);
  transition: fill 120ms ease;
}

.stats-bar:hover {
  fill: color-mix(in srgb, var(--chart-visiteurs) 82%, white);
}

/* La valeur porte une couleur de texte, jamais celle de la serie : c'est la
   barre en dessous qui donne l'identite. */
.stats-bar-value {
  fill: var(--text);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stats-bar-part {
  fill: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* --- Légende et infobulle --- */

.stats-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

.stats-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.stats-legend-key {
  width: 18px;
  height: 2px;
  border-radius: 2px;
  flex: none;
}

.stats-legend-key--vues {
  background: var(--chart-vues);
}

.stats-legend-key--visiteurs {
  background: var(--chart-visiteurs);
}

.stats-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 150px;
  padding: 9px 11px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(4, 10, 22, 0.5);
  pointer-events: none;
  opacity: 0;
  transition: opacity 100ms ease;
}

.stats-tooltip.is-visible {
  opacity: 1;
}

.stats-tooltip-date {
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.stats-tooltip-ligne {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.stats-tooltip-ligne + .stats-tooltip-ligne {
  margin-top: 3px;
}

/* La valeur mène, le libellé suit : ici le lecteur connaît la série et cherche
   le nombre. */
.stats-tooltip-valeur {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stats-tooltip-libelle {
  font-size: 0.78rem;
  color: var(--muted);
}

/* --- Vue tableau, jumelle du graphique --- */

.stats-table-view {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.stats-table-view summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--muted);
}

.stats-table-view summary:hover {
  color: var(--text);
}

.stats-table-view table {
  margin-top: 12px;
}

/* --- Adresse de l'administrateur --- */

.stats-mon-ip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.85rem;
}

.stats-mon-ip-etat {
  color: var(--muted);
  font-size: 0.8rem;
}

/* --- Mise en colonnes --- */

.stats-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.stats-columns .card {
  margin-top: 16px;
}

/* --- Textes d'aide et etats vides --- */

.stats-hint {
  margin: 0 0 12px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
}

.stats-vide {
  color: var(--muted);
  font-style: italic;
  text-align: center;
  padding: 18px 0;
}

/* --- Formulaire d'exclusion --- */

.stats-exclude-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.stats-exclude-form input {
  flex: 1 1 200px;
  padding: 8px 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
}

.stats-exclure-btn,
.stats-reintegrer-btn {
  padding: 4px 10px;
  font-size: 0.78rem;
}

#stats-view code {
  font-size: 0.82rem;
  color: var(--brand);
}

@media (max-width: 720px) {
  .stats-kpi-value {
    font-size: 1.35rem;
  }
}

/* =========================================================================
   Interface v4 — icônes, listes et actions
   =========================================================================
   Trois principes tiennent cette couche :

   1. Une icône ne remplace jamais un mot sans que le mot reste accessible.
      Les boutons d'action des listes portent title + aria-label ; la forme
      seule ne dit rien à qui ne l'a jamais vue, ni à un lecteur d'écran.
   2. La couleur ne porte l'information qu'en second. Une pastille rouge dit
      aussi « Inactif » en toutes lettres : le daltonisme ne doit rien coûter.
   3. Rien n'est ajouté qui ne serve à repérer ou à agir. Pas de dégradé
      décoratif de plus, pas d'ombre pour l'ombre.
   ========================================================================= */

/* --- Marque et navigation latérale --- */

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--brand-ink);
  background: linear-gradient(140deg, var(--brand), #3aa9c4);
  box-shadow: 0 8px 18px rgba(87, 211, 200, 0.22);
}

.brand-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

/* Les libellés de groupe donnent au menu une structure lisible sans ajouter
   de niveau de navigation : ce sont des repères, pas des boutons. */
.menu-group-title {
  margin: 12px 0 2px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.menu-group-title:first-child {
  margin-top: 0;
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 14px;
}

/* Boutons de menu : fond plat au repos, la barre active suffit à situer la
   page en cours. Les dégradés d'origine sont neutralisés ici. */
#dashboard .menu-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--muted-2);
  font-weight: 500;
}

#dashboard .menu-item:hover {
  background: var(--survol);
  border-color: transparent;
  transform: none;
  filter: none;
  box-shadow: none;
  color: var(--text);
}

#dashboard .menu-item.is-active {
  background: rgba(87, 211, 200, 0.12);
  border-color: rgba(87, 211, 200, 0.34);
  color: var(--text-fort);
  box-shadow: none;
  font-weight: 600;
}

#dashboard .menu-item.is-active::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}

#dashboard .menu-item.is-active .btn-ico {
  color: var(--brand);
}

#dashboard .logout-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  background: transparent;
  border-color: var(--line);
  box-shadow: none;
  color: var(--muted-2);
}

#dashboard .logout-btn:hover {
  background: rgba(207, 90, 106, 0.14);
  border-color: rgba(207, 90, 106, 0.45);
  color: var(--danger);
  transform: none;
  filter: none;
  box-shadow: none;
}

/* =========================================================================
   Système de listes
   =========================================================================
   Une liste, c'est toujours la même chose : des indicateurs, un en-tête avec
   ses filtres, un tableau, un pied de pagination. Les règles sont écrites une
   fois et servent aux cinq listes.
   ========================================================================= */

/* --- Actions d'en-tête de vue --- */

.panel-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* --- Rangée d'indicateurs --- */

.liste-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.liste-kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.liste-kpi-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.liste-kpi-value {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.05;
  color: var(--text);
}

.liste-kpi-note {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 18px;
}

.liste-kpi-note-txt {
  font-size: 0.72rem;
  color: var(--muted);
}

.kpi-chip {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.kpi-chip--ok {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: var(--ok-bord);
}

.kpi-chip--danger {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: var(--danger-bord);
}

.kpi-chip--neutre {
  color: var(--neutre);
  background: var(--neutre-bg);
  border-color: var(--neutre-bord);
}

/* --- En-tête de liste --- */

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

.liste-titre {
  display: flex;
  align-items: center;
  gap: 10px;
}

.liste-titre h3 {
  margin: 0;
}

.chip-compte {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: var(--neutre-bg);
  border: 1px solid var(--neutre-bord);
}

.liste-outils {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.liste-outils .search-field {
  width: 240px;
}

/* --- Pastilles de filtre ---
   Chaque pastille porte le nombre de lignes qu'elle retiendrait. Ce compte
   vaut sur toute la liste, jamais sur la recherche en cours : sinon il
   changerait à chaque frappe et ne servirait plus de repère. */

.pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

#dashboard .pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: var(--muted-2);
  font-size: 0.79rem;
  font-weight: 500;
}

#dashboard .pill:hover {
  background: var(--survol);
  border-color: var(--btn-bord);
  color: var(--text);
  transform: none;
  filter: none;
  box-shadow: none;
}

#dashboard .pill.is-active {
  background: var(--brand-doux);
  border-color: var(--brand-bord);
  color: var(--brand);
  font-weight: 600;
}

.pill-compte {
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}

/* --- Pied de liste : décompte, taille de page, pagination --- */

.liste-pied {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
}

.pied-compte strong {
  color: var(--text);
}

.pied-taille {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  color: var(--muted);
}

.pied-taille select {
  width: auto;
  padding: 5px 8px;
  font-size: 0.8rem;
}

.pager {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

#dashboard .pager-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  color: var(--muted-2);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

#dashboard .pager-btn:hover:not([disabled]) {
  background: var(--survol);
  border-color: var(--line);
  color: var(--text);
  transform: none;
  filter: none;
  box-shadow: none;
}

#dashboard .pager-btn.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
  font-weight: 700;
}

#dashboard .pager-btn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

.pager-trou {
  padding: 0 2px;
  color: var(--muted);
}

/* --- Interrupteur d'état --------------------------------------------------
   L'état est toujours écrit à côté : « Actif » / « Inactif ». La position du
   curseur seule ne suffit pas — c'est la convention la moins bien comprise de
   toutes les commandes de formulaire. */

.bascule-cell {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

#dashboard .bascule {
  width: 38px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
}

#dashboard .bascule:hover {
  transform: none;
  filter: none;
  box-shadow: none;
}

#dashboard .bascule:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

.bascule-piste {
  display: block;
  width: 38px;
  height: 22px;
  padding: 3px;
  border-radius: 999px;
  background: var(--neutre-bg);
  border: 1px solid var(--neutre-bord);
  transition: background 140ms ease, border-color 140ms ease;
}

.bascule-pastille {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 140ms ease, background 140ms ease;
}

.bascule.is-on .bascule-piste {
  background: var(--brand);
  border-color: var(--brand);
}

.bascule.is-on .bascule-pastille {
  transform: translateX(16px);
  background: var(--brand-ink);
}

.bascule-libelle {
  font-size: 0.78rem;
  color: var(--muted);
}

.bascule.is-on + .bascule-libelle {
  color: var(--text);
}

#dashboard .bascule[disabled] {
  opacity: 0.5;
  cursor: progress;
}

/* --- Cellules spécialisées --- */

.badge-scope {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.badge-scope--crm {
  color: var(--lien);
  background: var(--accent-doux);
  border-color: var(--accent-bord);
}

.badge-scope--erp {
  color: var(--attente);
  background: var(--attente-bg);
  border-color: var(--attente-bord);
}

.badge-scope--bundle {
  color: var(--brand);
  background: var(--brand-doux);
  border-color: var(--brand-bord);
}

.cell-tarif {
  white-space: nowrap;
}

.cell-unite {
  margin-left: 3px;
  font-size: 0.75rem;
  color: var(--muted);
}

.cell-muet {
  color: var(--muted);
  font-style: italic;
}

.cell-alerte {
  color: var(--danger);
  font-size: 0.82rem;
}

.liste-vide {
  padding: 26px 10px;
  text-align: center;
  color: var(--muted);
  font-style: italic;
}

tr.is-selected {
  background: var(--brand-doux);
}

@media (max-width: 1100px) {
  .liste-outils .search-field {
    width: 100%;
  }

  .liste-tete {
    align-items: flex-start;
  }
}

/* --- Barre supérieure --------------------------------------------------------
   Fil d'Ariane à gauche, réglages du poste à droite. Elle ne défile pas : c'est
   le repère de position, il doit rester lisible quelle que soit la hauteur de
   la liste en dessous. */

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  height: 56px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}

.fil-ariane {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-size: 0.84rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fil-ariane strong {
  color: var(--text);
  font-weight: 600;
}

.fil-sep {
  color: var(--muted);
  opacity: 0.5;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

#dashboard .topbar-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  color: var(--muted-2);
  transition: background 120ms ease, color 120ms ease;
}

#dashboard .topbar-btn:hover {
  background: var(--survol);
  border-color: var(--line);
  color: var(--text);
  transform: none;
  filter: none;
  box-shadow: none;
}

#dashboard .topbar-btn svg {
  width: 17px;
  height: 17px;
}

/* --- Pastille de compte --- */

.avatar-menu {
  position: relative;
}

#dashboard .avatar {
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--brand-bord);
  background: var(--brand-doux);
  box-shadow: none;
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

#dashboard .avatar:hover {
  background: var(--brand-doux);
  filter: brightness(1.15);
  transform: none;
  box-shadow: none;
}

.avatar-panneau {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  min-width: 226px;
  padding: 8px;
  display: grid;
  gap: 2px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 34px rgba(4, 10, 22, 0.4);
}

.avatar-entete {
  display: grid;
  gap: 2px;
  padding: 8px 10px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.avatar-entete strong {
  font-size: 0.88rem;
  color: var(--text);
}

.avatar-entete span {
  font-size: 0.75rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

#dashboard .avatar-action {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  box-shadow: none;
  color: var(--text);
  font-size: 0.85rem;
  text-align: left;
}

#dashboard .avatar-action:hover {
  background: var(--survol);
  border-color: transparent;
  transform: none;
  filter: none;
  box-shadow: none;
}

#dashboard .avatar-action--danger {
  color: var(--danger);
}

#dashboard .avatar-action--danger:hover {
  background: var(--danger-bg);
}

/* --- Compteur d'un élément de menu --- */

.menu-count {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: var(--neutre-bg);
  border: 1px solid var(--neutre-bord);
}

#dashboard .menu-item.is-active .menu-count {
  color: var(--brand);
  background: var(--brand-doux);
  border-color: var(--brand-bord);
}

/* --- Icône embarquée dans un bouton ou un onglet --- */

.btn-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 18px;
  height: 18px;
  color: currentColor;
  opacity: 0.9;
}

.btn-ico svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* Les boutons hydratés par data-icon deviennent des boîtes flex : sans quoi
   l'icône et le texte ne s'alignent pas sur la même ligne de base.
   Pas de justify-content ici : les boutons du menu font toute la largeur et
   doivent rester alignés à gauche, les autres se dimensionnent sur leur
   contenu et sont donc déjà centrés d'eux-mêmes. */
#dashboard button[data-icon] {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#dashboard .btn-primary {
  border-color: var(--brand-bord);
  background: var(--brand-plein);
  color: var(--brand-plein-ink);
  font-weight: 600;
}

/* --- En-tête de section --- */

.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.panel-head-text {
  min-width: 0;
}

.panel-icon {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--brand);
  background: rgba(87, 211, 200, 0.1);
  border: 1px solid rgba(87, 211, 200, 0.26);
}

/* Ces deux emplacements reçoivent l'icône via le même gabarit que les boutons :
   on redimensionne le conteneur autant que le dessin, sinon le SVG déborde de
   la boîte de 18 px prévue pour un bouton. */
.panel-icon .btn-ico,
.panel-icon svg {
  width: 21px;
  height: 21px;
}

.search-ico .btn-ico,
.search-ico svg {
  width: 16px;
  height: 16px;
}

/* --- Onglets secondaires --- */

.subtabs {
  flex-wrap: wrap;
}

.subtab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* --- Champ de recherche --- */

.search-field {
  position: relative;
  max-width: 460px;
}

.search-field input {
  padding-left: 38px;
}

.search-ico {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  color: var(--muted);
  pointer-events: none;
}

/* --- Boutons d'action des listes --------------------------------------------
   Carrés, sans fond au repos : une ligne de liste peut en porter quatre, et
   quatre boutons pleins pèseraient plus lourd que la donnée qu'ils servent.
   Le fond n'apparaît qu'au survol et au focus clavier. */

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

#dashboard .btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  box-shadow: none;
  color: var(--muted-2);
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

#dashboard .btn-icon svg {
  width: 17px;
  height: 17px;
  display: block;
  pointer-events: none;
}

#dashboard .btn-icon:hover {
  background: rgba(120, 170, 255, 0.14);
  border-color: rgba(120, 170, 255, 0.34);
  color: var(--text-fort);
  transform: none;
  filter: none;
  box-shadow: none;
}

#dashboard .btn-icon:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

#dashboard .btn-icon--danger:hover {
  background: rgba(207, 90, 106, 0.18);
  border-color: rgba(207, 90, 106, 0.5);
  color: var(--danger);
}

#dashboard .btn-icon[disabled] {
  opacity: 0.3;
  cursor: not-allowed;
}

#dashboard .btn-icon[disabled]:hover {
  background: transparent;
  border-color: transparent;
  color: var(--muted-2);
}

/* Bouton texte discret, hors tableau (bandeau « mon adresse »). */
#dashboard .btn-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  font-size: 0.8rem;
}

#dashboard .btn-inline svg {
  width: 15px;
  height: 15px;
}

/* --- Pastilles d'état --- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge--on {
  color: var(--ok);
  background: rgba(60, 190, 140, 0.12);
  border-color: rgba(60, 190, 140, 0.3);
}

.badge--off {
  color: var(--neutre);
  background: rgba(160, 180, 220, 0.1);
  border-color: rgba(160, 180, 220, 0.24);
}

.badge--wait {
  color: var(--attente);
  background: rgba(220, 170, 80, 0.12);
  border-color: rgba(220, 170, 80, 0.3);
}

.badge--danger {
  color: var(--danger);
  background: rgba(207, 90, 106, 0.14);
  border-color: rgba(207, 90, 106, 0.36);
}

/* --- Tableaux --------------------------------------------------------------
   L'en-tête reste collé en haut de la carte pendant le défilement : sur une
   liste longue, savoir quelle colonne on lit vaut mieux qu'un gain de place. */

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

td {
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.cell-id {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  width: 1%;
  white-space: nowrap;
}

.cell-num {
  font-variant-numeric: tabular-nums;
}

.cell-strong {
  color: var(--text);
  font-weight: 600;
}

.cell-link {
  color: var(--lien);
  text-decoration: none;
}

.cell-link:hover {
  text-decoration: underline;
}

/* Détail secondaire sous une pastille : le motif d'un échec de notification,
   par exemple. Lisible, mais jamais au même niveau que l'état. */
.cell-note {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

#dashboard td code {
  font-size: 0.82rem;
  color: var(--lien);
}

/* --- Statistiques : barre de période et sections --- */

.stats-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(4, 10, 22, 0.35);
}

.stats-toolbar .message:empty {
  display: none;
}

/* Les trois durées forment un seul objet : bord commun, un seul choix actif.
   Trois boutons séparés laisseraient croire qu'ils se cumulent. */
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-soft);
}

#dashboard .segmented .stats-range {
  padding: 7px 13px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--muted-2);
  font-size: 0.85rem;
}

#dashboard .segmented .stats-range:hover {
  transform: none;
  filter: none;
  box-shadow: none;
  color: var(--text);
}

#dashboard .segmented .stats-range.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
  font-weight: 700;
}

.stats-date {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

/* La barre de période étant elle-même collée en haut, les en-têtes de colonnes
   de cette vue se calent en dessous plutôt que de disparaître derrière. */
#stats-view thead th {
  top: 72px;
}

/* Les deux graphiques de la vue d'ensemble passent côte à côte dès qu'il y a
   la place : empilés sur toute la largeur, ils suffisaient à eux seuls à faire
   défiler la page, et la vue d'ensemble n'était plus une vue d'ensemble. */
@media (min-width: 1500px) {
  .stats-charts {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
  }
}

/* =========================================================================
   Tableau de bord commercial
   =========================================================================
   Deux teintes, reprises telles quelles des graphiques de fréquentation :
   le turquoise pour tout ce qui compte des clients, l'ambre pour tout ce qui
   compte de l'argent. Une couleur veut dire la même chose d'une vue à l'autre.

   Le couple a été passé au validateur de palette (écart perceptuel sous les
   trois formes de daltonisme, contraste sur le fond des cartes) : il passe les
   six contrôles. Chaque graphique ne portant qu'une seule série, la couleur ne
   sert jamais seule à distinguer quoi que ce soit — le titre nomme la série.
   ========================================================================= */

:root {
  --dash-clients: var(--chart-vues);
  --dash-ca: var(--chart-visiteurs);
}

/* --- Rangée d'indicateurs --- */

.dash-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.dash-kpi {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.dash-kpi-tete {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dash-kpi-ico {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
}

.dash-kpi-ico svg {
  width: 16px;
  height: 16px;
}

.dash-kpi-ico--clients {
  color: var(--dash-clients);
  background: rgba(49, 169, 158, 0.14);
}

.dash-kpi-ico--ca {
  color: var(--dash-ca);
  background: rgba(207, 127, 60, 0.14);
}

.dash-kpi-label {
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Chiffres proportionnels, pas tabulaires : à cette taille, des chiffres de
   largeur égale font paraître « 121 » trop aéré. Le tabulaire est réservé aux
   colonnes de tableaux, où les nombres s'alignent verticalement. */
.dash-kpi-value {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.05;
  color: var(--text);
}

.dash-kpi-note {
  font-size: 0.72rem;
  color: var(--muted);
}

/* La flèche double la couleur : un écart ne doit jamais se lire à la teinte
   seule — ni pour un daltonien, ni sur une impression en noir et blanc. */
.dash-ecart {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
}

.dash-ecart-fleche {
  font-size: 0.85rem;
}

.dash-ecart-ref {
  font-weight: 400;
  font-size: 0.7rem;
  color: var(--muted);
}

.dash-ecart--hausse {
  color: var(--ok);
}

.dash-ecart--baisse {
  color: var(--danger);
}

.dash-ecart--stable {
  color: var(--muted);
}

/* --- Bandeau d'avertissement sur la mesure --- */

.dash-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 16px;
  padding: 13px 16px;
  font-size: 0.83rem;
  line-height: 1.55;
  color: var(--attente);
  background: rgba(220, 170, 80, 0.09);
  border: 1px solid rgba(220, 170, 80, 0.32);
  border-radius: 12px;
}

.dash-note svg {
  width: 19px;
  height: 19px;
  flex: none;
  margin-top: 1px;
  color: var(--attente);
}

.dash-note strong {
  color: var(--attente);
}

.dash-note code {
  font-size: 0.8rem;
  color: var(--attente);
}

/* --- Courbe des clients --- */

/* L'aire n'est là que pour donner du corps à la courbe : elle reste très en
   retrait, la ligne porte la lecture. */
.dash-area {
  fill: rgba(49, 169, 158, 0.16);
  stroke: none;
}

.dash-serie--clients {
  stroke: var(--dash-clients);
}

.dash-serie--clients.stats-serie-dot {
  fill: var(--dash-clients);
  stroke: var(--panel);
}

.stats-legend-key--clients {
  background: var(--dash-clients);
}

.stats-legend-key--nouveaux {
  background: rgba(49, 169, 158, 0.45);
}

/* --- Histogramme du chiffre d'affaires --- */

.dash-bar {
  fill: var(--dash-ca);
  transition: fill 120ms ease;
}

.dash-bar:hover {
  fill: color-mix(in srgb, var(--dash-ca) 82%, white);
}

/* --- Plans les plus utilisés --- */

.dash-plans {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.dash-bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.1fr) minmax(0, 2fr) auto;
  align-items: center;
  gap: 14px;
}

.dash-bar-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--text);
  min-width: 0;
}

.dash-bar-scope {
  flex: none;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: rgba(160, 180, 220, 0.12);
  border: 1px solid rgba(160, 180, 220, 0.2);
}

.dash-bar-track {
  height: 12px;
  border-radius: 6px;
  background: rgba(160, 180, 220, 0.1);
  overflow: hidden;
}

.dash-bar-fill {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: var(--dash-clients);
  transition: width 220ms ease;
}

.dash-bar-value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.dash-bar-sub {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
}

@media (max-width: 700px) {
  .dash-bar-row {
    grid-template-columns: 1fr auto;
  }

  .dash-bar-track {
    grid-column: 1 / -1;
    order: 3;
  }
}

.stats-subview {
  display: none;
}

.stats-subview.is-active {
  display: block;
}

/* --- Indicateurs clés : icône de repérage à gauche du chiffre --- */

.stats-kpi {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.stats-kpi-ico {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--brand);
  background: rgba(87, 211, 200, 0.1);
}

.stats-kpi-ico svg {
  width: 18px;
  height: 18px;
}

.stats-kpi-texte {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.stats-kpi-value {
  font-size: 1.45rem;
}

@media (max-width: 980px) {
  .menu-group-title {
    grid-column: 1 / -1;
  }

  #dashboard .menu-item.is-active::before {
    display: none;
  }

  .stats-toolbar {
    position: static;
  }

  thead th {
    position: static;
  }
}
