/* TripGate — feuille de style commune (thème clair ivoire & or) */

:root {
  /* Fonds */
  --bg: #f6f1e8;               /* fond de page ivoire */
  --surface: #ffffff;          /* cartes */
  --surface-soft: #fbf8f2;     /* zones légèrement teintées */
  --edge: #e8e0d1;             /* bordures neutres */
  --edge-gold: rgba(184, 134, 47, 0.26);

  /* Champs */
  --field: #fdfbf7;
  --field-edge: #ddd3c2;
  --field-hover: #c9bca4;

  /* Textes */
  --text: #221c13;
  --text-2: #4a4235;           /* libellés */
  --muted: #776e5f;            /* textes secondaires */
  --faint: #a49a89;            /* icônes, indications */

  /* Or TripGate */
  --gold: #c4923a;             /* filets, bordures, décor */
  --gold-text: #866321;        /* or lisible pour les textes sur fond clair */
  --gold-soft: #fbf1dc;        /* fonds dorés pâles */
  --gold-grad: linear-gradient(100deg, #f3d58a 0%, #e2b85f 45%, #c4923a 100%);
  --on-gold: #2a1f0a;          /* texte sur bouton doré */

  /* États */
  --danger: #b3412c;
  --danger-bg: #fcefeb;
  --success: #2e7a46;
  --success-bg: #ebf6ef;

  --shadow: 0 18px 50px rgba(92, 70, 30, 0.10), 0 2px 6px rgba(92, 70, 30, 0.05);
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse 70% 45% at 50% -5%, rgba(226, 184, 95, 0.22), transparent 70%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Motif zellige (étoiles à 8 branches) très discret */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='88' viewBox='0 0 88 88'%3E%3Cg fill='none' stroke='%23c4923a' stroke-width='1'%3E%3Crect x='28' y='28' width='32' height='32'/%3E%3Crect x='28' y='28' width='32' height='32' transform='rotate(45 44 44)'/%3E%3Ccircle cx='0' cy='0' r='6'/%3E%3Ccircle cx='88' cy='0' r='6'/%3E%3Ccircle cx='0' cy='88' r='6'/%3E%3Ccircle cx='88' cy='88' r='6'/%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.10;
  -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 40%, #000 10%, transparent 75%);
          mask-image: radial-gradient(ellipse 60% 60% at 50% 40%, #000 10%, transparent 75%);
}

/* Logo : version « or profond » (logo-tripgate-clair.png) prévue pour fond clair */
.logo-img { filter: drop-shadow(0 4px 14px rgba(184, 134, 47, 0.14)); }

.card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background:
    radial-gradient(ellipse 80% 35% at 50% 0%, rgba(226, 184, 95, 0.12), transparent 75%),
    var(--surface);
  border: 1px solid var(--edge-gold);
  border-radius: 26px;
  padding: 28px 36px 32px;
  box-shadow: var(--shadow);
  animation: rise 0.6s cubic-bezier(.2,.8,.2,1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* Sélecteur de langue FR / EN */
.lang {
  display: flex;
  justify-content: flex-end;
}
.lang-switch {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: var(--surface-soft);
}
.lang-switch button {
  all: unset;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--muted);
  transition: color .2s, background .2s;
}
.lang-switch button:hover { color: var(--text); }
.lang-switch button[aria-pressed="true"] {
  background: var(--gold-grad);
  color: var(--on-gold);
}
.lang-switch button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* En-tête de carte */
.brand {
  text-align: center;
  margin-top: 4px;
}
.brand img {
  width: 168px;
  height: auto;
  display: block;
  margin: 0 auto;
}
.brand.no-lang { margin-top: 10px; }
.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 20px auto 22px;
  width: 78%;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
}
.divider::after { background: linear-gradient(90deg, var(--gold), transparent); }
.divider span {
  width: 8px; height: 8px;
  background: var(--gold);
  transform: rotate(45deg);
  flex: none;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold-text);
}
h1 {
  margin: 8px 0 6px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-size: 38px;
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: var(--text);
}
.lead {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

/* Formulaires */
form { margin-top: 28px; }

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 8px;
}
.control {
  position: relative;
  display: flex;
  align-items: center;
}
.control .icon {
  position: absolute;
  left: 15px;
  width: 18px; height: 18px;
  color: var(--faint);
  pointer-events: none;
  transition: color .2s;
}
.control input {
  width: 100%;
  height: 52px;
  padding: 0 48px 0 46px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--field-edge);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.control.no-icon input { padding-left: 16px; padding-right: 16px; }
.control input::placeholder { color: #b1a796; }
.control input:hover { border-color: var(--field-hover); }
.control input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(196, 146, 58, 0.16);
  background: #ffffff;
}
.control:focus-within .icon { color: var(--gold-text); }

.field.has-error input { border-color: var(--danger); }
.field.has-error input:focus { box-shadow: 0 0 0 4px rgba(179, 65, 44, 0.12); }
.error {
  display: none;
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--danger);
}
.field.has-error .error { display: block; }
.hint {
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--muted);
}

.toggle-pass {
  all: unset;
  position: absolute;
  right: 8px;
  width: 36px; height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--faint);
  cursor: pointer;
  transition: color .2s, background .2s;
}
.toggle-pass:hover { color: var(--gold-text); background: var(--gold-soft); }
.toggle-pass:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.toggle-pass svg { width: 19px; height: 19px; }
.toggle-pass .eye-off { display: none; }
.toggle-pass[aria-pressed="true"] .eye { display: none; }
.toggle-pass[aria-pressed="true"] .eye-off { display: block; }

.caps {
  display: none;
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--gold-text);
}
.caps.show { display: block; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 4px 0 26px;
  font-size: 13.5px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.check input {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 1px solid #cdbfa6;
  background: var(--field);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.check input::after {
  content: "";
  width: 9px; height: 5px;
  border-left: 2px solid var(--on-gold);
  border-bottom: 2px solid var(--on-gold);
  transform: rotate(-45deg) translate(1px, -1px);
  opacity: 0;
}
.check input:checked { background: var(--gold-grad); border-color: var(--gold); }
.check input:checked::after { opacity: 1; }
.check input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.link {
  color: var(--gold-text);
  text-decoration: none;
  font-weight: 500;
  transition: color .2s;
}
.link:hover { color: #6a4d17; text-decoration: underline; text-underline-offset: 3px; }
.link:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

/* Boutons */
.btn {
  width: 100%;
  height: 56px;
  border: 0;
  border-radius: 16px;
  background: var(--gold-grad);
  color: var(--on-gold);
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(196, 146, 58, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform .15s, box-shadow .2s, filter .2s, background .2s, color .2s;
}
.btn:hover { filter: brightness(1.04); box-shadow: 0 14px 30px rgba(196, 146, 58, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--gold-text); outline-offset: 3px; }
.btn svg { width: 20px; height: 20px; }
.btn .spinner {
  display: none;
  width: 18px; height: 18px;
  border: 2px solid rgba(42, 31, 10, 0.25);
  border-top-color: var(--on-gold);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn.loading { pointer-events: none; filter: saturate(.85); }
.btn.loading .spinner { display: block; }
.btn.loading .btn-icon { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-ghost {
  background: var(--surface);
  color: var(--gold-text);
  border: 1px solid rgba(184, 134, 47, 0.45);
  box-shadow: none;
}
.btn-ghost:hover {
  background: var(--gold-soft);
  box-shadow: none;
  filter: none;
}
.btn-sm { height: 40px; padding: 0 16px; font-size: 14px; border-radius: 11px; width: auto; gap: 8px; white-space: nowrap; }
.btn-sm svg { width: 17px; height: 17px; }
.btn-block { width: 100%; }

/* Messages */
.notice {
  display: none;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.45;
  border: 1px solid rgba(196, 146, 58, 0.35);
  background: #fdf6e6;
  color: #5e4718;
}
.notice.show { display: block; }
.notice.is-error {
  border-color: rgba(179, 65, 44, 0.30);
  background: var(--danger-bg);
  color: #8a2f1f;
}
.notice.is-success {
  border-color: rgba(46, 122, 70, 0.28);
  background: var(--success-bg);
  color: #22603a;
}
form > .notice:first-child { margin-top: 0; margin-bottom: 20px; }
.notice ul { margin: 0; padding-left: 18px; }

.help {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--edge);
  text-align: center;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}
.help svg { width: 15px; height: 15px; vertical-align: -2px; margin-right: 6px; color: var(--gold); }

/* Profil — même style que la carte de visite */
.profile-name {
  margin: 10px 0 8px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-size: 34px;
  line-height: 1.15;
  color: var(--text);
}
.profile-role {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold-text);
}
.profile-meta {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

footer {
  margin-top: 26px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #8f8676;
}
footer .dot { color: var(--gold); margin: 0 8px; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 480px) {
  body { padding: 20px 16px; justify-content: flex-start; }
  .card { padding: 22px 22px 26px; border-radius: 22px; }
  .brand img { width: 148px; }
  h1 { font-size: 33px; }
  .profile-name { font-size: 30px; }
}

/* =====================================================================
   PAGE DE CONNEXION — thème sombre d'origine (noir et or)
   Les couleurs sont redéfinies seulement pour <body class="theme-dark">.
   ===================================================================== */

body.theme-dark {
  --bg: #0b0b0b;
  --surface: #121212;
  --surface-soft: rgba(0, 0, 0, 0.35);
  --edge: rgba(255, 255, 255, 0.10);
  --edge-gold: rgba(212, 166, 74, 0.16);
  --field: #0d0d0d;
  --field-edge: #2a2724;
  --field-hover: #3a3631;
  --text: #f5f1e8;
  --text-2: #d8d3c8;
  --muted: #a29d93;
  --faint: #77726a;
  --gold: #d4a64a;
  --gold-text: #d4a64a;
  --gold-soft: rgba(255, 255, 255, 0.04);
  --on-gold: #1a1408;
  --danger: #e77b6b;
  background:
    radial-gradient(ellipse 70% 45% at 50% -5%, rgba(212, 166, 74, 0.18), transparent 70%),
    var(--bg);
}
body.theme-dark::before { opacity: 0.05; }
body.theme-dark .card {
  background:
    radial-gradient(ellipse 80% 35% at 50% 0%, rgba(212, 166, 74, 0.10), transparent 75%),
    var(--surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(243, 213, 138, 0.06);
}
body.theme-dark .logo-img { filter: drop-shadow(0 4px 18px rgba(212, 166, 74, 0.18)); }
body.theme-dark .control input::placeholder { color: #5f5a53; }
body.theme-dark .control input:focus { background: #0f0e0c; box-shadow: 0 0 0 4px rgba(212, 166, 74, 0.14); }
body.theme-dark .field.has-error input:focus { box-shadow: 0 0 0 4px rgba(231, 123, 107, 0.15); }
body.theme-dark .toggle-pass:hover { color: #f3d58a; }
body.theme-dark .caps { color: #f3d58a; }
body.theme-dark .check input { border-color: #45403a; }
body.theme-dark .link:hover { color: #f3d58a; }
body.theme-dark .btn { box-shadow: 0 10px 30px rgba(212, 166, 74, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
body.theme-dark .btn:hover { box-shadow: 0 14px 36px rgba(212, 166, 74, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
body.theme-dark .notice { border-color: rgba(212, 166, 74, 0.3); background: rgba(212, 166, 74, 0.07); color: #e9dcc0; }
body.theme-dark .notice.is-error { border-color: rgba(231, 123, 107, 0.4); background: rgba(231, 123, 107, 0.08); color: #f3c3b9; }
body.theme-dark .notice.is-success { border-color: rgba(143, 209, 158, 0.35); background: rgba(143, 209, 158, 0.07); color: #cfeed6; }
body.theme-dark footer { color: #6f6a62; }

/* =====================================================================
   ESPACE CONNECTÉ — menu latéral sur ordinateur, menu coulissant sur téléphone
   ===================================================================== */

body.app-page { padding: 0; display: block; }
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 264px;
  flex: none;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px 18px 22px;
  /* Menu sombre (brun profond, comme la carte de visite) face au contenu clair */
  background:
    radial-gradient(ellipse 90% 28% at 50% 0%, rgba(226, 184, 95, 0.20), transparent 75%),
    linear-gradient(180deg, #231c13 0%, #18130d 100%);
  border-right: 1px solid rgba(196, 146, 58, 0.35);
  color: #efe6d6;
  z-index: 30;
}
.sidebar-logo { display: block; text-align: center; }
.sidebar-logo img { width: 132px; height: auto; filter: drop-shadow(0 4px 16px rgba(226, 184, 95, 0.22)); }
.sidebar .divider { width: 100%; margin: 18px auto 20px; }
.sidebar .sidebar-close { display: none; }

.nav { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 0 6px 8px; scrollbar-width: thin; scrollbar-color: rgba(226, 184, 95, 0.35) transparent; }
/* Compteur à droite d'une entrée (année choisie) ; « alert » = demandes à traiter */
.nav-count { margin-left: auto; min-width: 24px; padding: 2px 8px; border-radius: 999px; background: rgba(226, 184, 95, 0.16); color: #f3d58a; font-size: 11.5px; font-weight: 700; text-align: center; }
.nav-count.alert { background: #e2b85f; color: #2a1f0a; }
/* Sélecteur d'année */
.year-picker { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; padding: 0 6px 0 14px; }
.year-picker label { font-size: 12px; font-weight: 700; color: #d9cfbd; }
.year-picker select {
  flex: 1;
  height: 36px;
  padding: 0 30px 0 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #2a1f0a;
  appearance: none;
  -webkit-appearance: none;
  background: #f6eedf url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23866321' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 11px center;
  border: 1px solid rgba(226, 184, 95, 0.6);
  border-radius: 10px;
  cursor: pointer;
}
.year-picker select:focus-visible { outline: 2px solid #e2b85f; outline-offset: 2px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: 12px;
  color: #d9cfbd;
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  transition: background .2s, color .2s;
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: #ffffff; }
.nav a[aria-current="page"] {
  background: rgba(226, 184, 95, 0.16);
  color: #f3d58a;
  box-shadow: inset 3px 0 0 #e2b85f;
}
.nav a:focus-visible { outline: 2px solid #e2b85f; outline-offset: 2px; }
.nav svg { width: 18px; height: 18px; flex: none; }

.sidebar-foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}
.me { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; min-width: 0; }
.me-text { min-width: 0; }
.me-name { font-size: 14px; font-weight: 600; color: #f7f0e3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-role { font-size: 10.5px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: #e2b85f; }

/* Éléments du menu sombre */
.sidebar .avatar {
  color: #f3d58a;
  background: radial-gradient(circle at 50% 35%, #33291b, #1a140d);
  border-color: #e2b85f;
}
.sidebar .btn-ghost {
  background: transparent;
  color: #f3d58a;
  border-color: rgba(226, 184, 95, 0.45);
}
.sidebar .btn-ghost:hover { background: rgba(226, 184, 95, 0.12); }
.sidebar .btn:focus-visible { outline-color: #f3d58a; }
.sidebar .icon-btn,
.topbar .icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  color: #f3d58a;
}
.sidebar .icon-btn:hover,
.topbar .icon-btn:hover { background: rgba(255, 255, 255, 0.12); }

.avatar {
  width: 40px; height: 40px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-size: 17px;
  color: var(--gold-text);
  background: radial-gradient(circle at 50% 35%, #fffaf0, #f4e8cf);
  border: 1.5px solid var(--gold);
}
.avatar.lg {
  width: 96px; height: 96px;
  font-size: 38px;
  border-width: 2px;
  box-shadow: 0 0 0 7px rgba(226, 184, 95, 0.16), 0 10px 26px rgba(92, 70, 30, 0.12);
}

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 40px;
  /* Barre du haut sombre, assortie au menu */
  border-bottom: 1px solid rgba(196, 146, 58, 0.35);
  background:
    radial-gradient(ellipse 40% 140% at 20% 0%, rgba(226, 184, 95, 0.14), transparent 70%),
    linear-gradient(180deg, #231c13 0%, #1b150e 100%);
  box-shadow: 0 6px 24px rgba(24, 19, 13, 0.18);
  color: #efe6d6;
}
.topbar-title { flex: 1; min-width: 0; }
.topbar .crumb { margin: 0 0 2px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.26em; text-transform: uppercase; color: #e2b85f; }
.topbar h1 { margin: 0; font-size: 30px; color: #f7f0e3; }
.topbar .lang-switch { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.14); }
.topbar .lang-switch button { color: #cfc4b0; }
.topbar .lang-switch button:hover { color: #ffffff; }
.topbar .lang-switch button[aria-pressed="true"] { color: var(--on-gold); }
.icon-btn {
  all: unset;
  width: 42px; height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--edge);
  background: var(--surface);
  color: var(--gold-text);
  cursor: pointer;
}
.icon-btn:hover { background: var(--gold-soft); }
.icon-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.icon-btn svg { width: 20px; height: 20px; }
.topbar .menu-btn { display: none; }

/* « backwards » : l'animation ne laisse aucune transformation une fois finie
   (sinon les éléments « fixed » à l'intérieur, comme l'aperçu plein écran, seraient positionnés par rapport au contenu) */
.content { width: 100%; max-width: 1180px; padding: 32px 40px 40px; animation: rise 0.5s cubic-bezier(.2,.8,.2,1) backwards; }
.app-foot { margin-top: auto; padding: 18px 40px 26px; text-align: left; }
.nav-overlay { position: fixed; inset: 0; z-index: 25; background: rgba(24, 19, 13, 0.45); }

/* Cartes de contenu */
.surface {
  background:
    radial-gradient(ellipse 80% 40% at 50% 0%, rgba(226, 184, 95, 0.08), transparent 75%),
    var(--surface);
  border: 1px solid var(--edge);
  border-radius: 22px;
  padding: 26px 28px;
  box-shadow: var(--shadow);
}
.surface + .surface { margin-top: 22px; }
.tiles > .surface { margin-top: 0; }
.surface-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.surface-title { margin: 0; font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; font-size: 26px; color: var(--text); }
.count { font-size: 13px; color: var(--muted); }

/* Tableau de bord */
.hero { display: flex; align-items: center; gap: 28px; }
.hero-text { flex: 1; min-width: 0; }
.hero .profile-name { margin: 6px 0 6px; font-size: 40px; }
.hero-side {
  text-align: right;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  padding-left: 24px;
  border-left: 1px solid var(--edge);
}
.hero-side strong { display: block; color: var(--text); font-size: 15px; font-weight: 500; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-top: 22px; }
.tile { display: flex; flex-direction: column; gap: 10px; }
.tile-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--gold-text);
  background: var(--gold-soft);
  border: 1px solid rgba(196, 146, 58, 0.3);
}
.tile-icon svg { width: 20px; height: 20px; }
.tile h3 { margin: 4px 0 0; font-size: 16px; font-weight: 600; }
.tile p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.tile .big { font-family: "Cormorant Garamond", Georgia, serif; font-size: 46px; font-weight: 600; line-height: 1; color: var(--gold-text); }
.tile .btn { margin-top: auto; align-self: flex-start; }
.tile.muted { opacity: 0.8; }
.facts { margin: 0; display: grid; gap: 10px; font-size: 14px; }
.facts div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--edge); padding-bottom: 8px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; text-align: right; }

/* Formulaires en grille + listes déroulantes */
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 16px; align-items: start; }
.form-grid .full,
.edit-grid .full { grid-column: 1 / -1; }
.form-grid .span-2,
.edit-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.control select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 52px;
  padding: 0 40px 0 16px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23866321' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 16px center;
  border: 1px solid var(--field-edge);
  border-radius: var(--radius);
  outline: none;
  cursor: pointer;
}
.control select:hover { border-color: var(--field-hover); }
.control select:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(196, 146, 58, 0.16); }
.control select:disabled { opacity: 0.55; cursor: not-allowed; }
.control select option { background: #ffffff; color: var(--text); }
.control.with-btn input { padding-right: 112px; }
.gen-btn {
  all: unset;
  position: absolute;
  right: 6px;
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold-text);
  background: var(--gold-soft);
  border: 1px solid rgba(196, 146, 58, 0.35);
  cursor: pointer;
}
.gen-btn:hover { background: #f6e5bf; }
.gen-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Tableau des utilisateurs */
.table-wrap { overflow-x: auto; }
table.users { width: 100%; border-collapse: collapse; font-size: 14px; }
table.users th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 12px 12px;
  border-bottom: 1px solid var(--edge);
}
table.users td { padding: 14px 12px; border-bottom: 1px solid #f0e9dd; vertical-align: middle; }
table.users tbody.user:hover td { background: #fdfaf4; }
table.users .actions { text-align: right; }
.u-cell { display: flex; align-items: center; gap: 12px; }
.u-name { font-weight: 600; }
.u-title { margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.you { font-style: normal; font-size: 12px; color: var(--gold-text); margin-left: 4px; }
code.uname { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; color: var(--text-2); }
.cell-label { display: none; }
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--edge);
  background: var(--surface-soft);
  color: var(--text-2);
  white-space: nowrap;
}
.badge.gold { border-color: rgba(196, 146, 58, 0.45); color: #6a4d17; background: var(--gold-soft); }
.badge.ok { border-color: rgba(46, 122, 70, 0.25); color: var(--success); background: var(--success-bg); }
.badge.off { border-color: rgba(179, 65, 44, 0.25); color: var(--danger); background: var(--danger-bg); }
.badges { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.badge.temp { border-color: rgba(196, 146, 58, 0.35); color: var(--gold-text); background: #fffaf0; border-style: dashed; }
tr.edit-row td { background: #faf6ee; padding: 18px 16px 6px; }

/* Mon compte */
.account-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 22px; align-items: start; }
.account-grid > .surface + .surface { margin-top: 0; }
.account-card { text-align: center; }
.account-card .avatar.lg { margin: 4px auto 14px; }
.account-card .profile-name { margin: 0 0 6px; font-size: 30px; }
.account-card .facts { margin-top: 18px; text-align: left; }
#passwordForm { margin-top: 0; max-width: 560px; }
#passwordForm .form-actions { justify-content: flex-start; }
.edit-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 14px; align-items: end; }
.edit-grid .form-actions { padding-bottom: 18px; }
.edit-grid .hint.full { grid-column: 1 / -1; margin: -6px 0 14px; }

/* =====================================================================
   FACTURATION
   ===================================================================== */

.nav-section {
  margin: 14px 14px 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(226, 184, 95, 0.75);
}

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 22px; }
.kpis > .surface + .surface { margin-top: 0; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 20px 22px; }
.kpi-label { font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-text); }
.kpi-value { font-family: "Cormorant Garamond", Georgia, serif; font-size: 32px; font-weight: 600; line-height: 1.1; color: var(--text); }
.big-money { font-size: 34px !important; }
.tile-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: var(--surface-soft);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.tabs a:hover { border-color: var(--field-hover); }
.tabs a[aria-current="page"] { background: var(--gold-soft); border-color: rgba(196, 146, 58, 0.45); color: #6a4d17; }
.tab-count { font-size: 11px; color: var(--muted); }
.search input {
  height: 40px;
  width: 280px;
  max-width: 100%;
  padding: 0 14px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--field-edge);
  border-radius: 11px;
  outline: none;
}
.search input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(196, 146, 58, 0.16); }
.empty { margin: 8px 0; padding: 26px 0; text-align: center; color: var(--muted); }
.num { text-align: right !important; white-space: nowrap; }
.amount-due { color: #8a2f1f; font-weight: 600; }
.inv-link { color: var(--text); font-weight: 600; text-decoration: none; }
.inv-link:hover { color: var(--gold-text); text-decoration: underline; text-underline-offset: 3px; }
.stack { display: inline-flex; flex-direction: column; }
.stack small { color: var(--muted); font-size: 12px; }
.row-actions { display: inline-flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* Champs texte multi-lignes */
.control textarea {
  width: 100%;
  min-height: 90px;
  padding: 12px 16px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--field-edge);
  border-radius: var(--radius);
  outline: none;
  resize: vertical;
}
.control textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(196, 146, 58, 0.16); background: #fff; }
.control input[type="date"] { padding-right: 16px; }

/* Éditeur de lignes */
.invoice-form { margin-top: 0; }
.invoice-form > .surface + .surface { margin-top: 22px; }
.new-client { margin-top: 8px; padding-top: 14px; border-top: 1px dashed var(--edge); }
.lines-head,
.line-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 80px 150px 96px 130px 36px;
  gap: 10px;
  align-items: center;
}
.lines-head {
  padding: 0 0 8px;
  border-bottom: 1px solid var(--edge);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.line-row { padding: 10px 0; border-bottom: 1px solid #f0e9dd; }
.lc-label { display: none; }
.line-row input,
.line-row select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  font: inherit;
  font-size: 14.5px;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--field-edge);
  border-radius: 11px;
  outline: none;
}
.line-row select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23866321' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center;
}
.line-row input:focus,
.line-row select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(196, 146, 58, 0.16); background: #fff; }
.lc-qty input, .lc-price input { text-align: right; }
.lc-total { text-align: right; font-weight: 600; white-space: nowrap; }
.icon-btn.small { width: 34px; height: 34px; border-radius: 10px; }
.icon-btn.small svg { width: 16px; height: 16px; }

.invoice-bottom { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; margin-top: 22px; align-items: start; }
.totals {
  padding: 16px 18px;
  border: 1px solid var(--edge);
  border-radius: 16px;
  background: var(--surface-soft);
}
.t-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 14.5px; }
.t-row > :last-child { font-weight: 600; white-space: nowrap; }
.t-sub { font-size: 13.5px; color: var(--muted); }
.t-grand {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 2px solid var(--gold);
  font-size: 18px;
}
.t-grand > :last-child { color: var(--gold-text); }
.t-due { font-weight: 700; color: #8a2f1f; }
.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-top: 18px;
  padding: 14px 0;
  background: linear-gradient(180deg, rgba(246, 241, 232, 0), rgba(246, 241, 232, 0.96) 30%);
}

/* Détail d'une facture */
.invoice-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.back-link { font-size: 13px; }
.invoice-number { margin: 6px 0 8px; font-family: "Cormorant Garamond", Georgia, serif; font-size: 34px; font-weight: 600; }
.ih-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 13.5px; color: var(--muted); }
.ih-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-form { margin: 0; display: inline; }
.invoice-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; margin-top: 22px; align-items: start; }
.invoice-grid > .surface + .surface,
.invoice-side > .surface + .surface { margin-top: 0; }
.invoice-side { display: flex; flex-direction: column; gap: 22px; }
.invoice-grid .invoice-bottom { grid-template-columns: 1fr; gap: 18px; }
/* Ordinateur portable : le panneau latéral passe sous le document pour laisser de la place aux lignes */
@media (min-width: 960px) and (max-width: 1299px) {
  .invoice-grid { grid-template-columns: 1fr; }
  .invoice-side { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .invoice-side > .surface { flex: 1 1 300px; }
}
.invoice-grid .totals { justify-self: end; width: min(100%, 360px); }
.invoice-side form { margin-top: 0; }
.bill-to { margin-bottom: 18px; }
.bill-to p { margin: 2px 0; }
.bt-name { font-size: 18px; font-weight: 600; }
table.lines-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.lines-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--edge);
}
table.lines-table td { padding: 12px 10px; border-bottom: 1px solid #f0e9dd; }
.notes-text { margin: 0 0 14px; color: var(--text-2); }
.words { margin: 0; color: var(--text-2); font-size: 13.5px; line-height: 1.55; }
.side-title { margin: 0 0 10px; font-family: "Cormorant Garamond", Georgia, serif; font-size: 23px; font-weight: 600; }
.payments { list-style: none; margin: 0; padding: 0; }
.payments li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--edge); }
.payments li > div { display: flex; flex-direction: column; }
.count.small { font-size: 11.5px; }
.btn-danger { color: var(--danger); border-color: rgba(179, 65, 44, 0.4); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-ok { background: linear-gradient(100deg, #9fd8ad 0%, #5fb27a 100%); color: #10331d; box-shadow: 0 8px 20px rgba(46, 122, 70, 0.22); }

/* Détails d'une ligne (titre + « Libellé : valeur ») */
.line-row { align-items: start; }
.lc-total { line-height: 44px; }
.lc-remove { padding-top: 5px; }
.details-toggle {
  all: unset;
  display: inline-block;
  margin-top: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-text);
  cursor: pointer;
}
.details-toggle:hover { text-decoration: underline; text-underline-offset: 3px; }
.details-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.lc-details { grid-column: 1 / 6; }
.lc-details textarea {
  width: 100%;
  min-height: 70px;
  padding: 10px 12px;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text);
  background: var(--field);
  border: 1px dashed var(--field-edge);
  border-radius: 11px;
  outline: none;
  resize: vertical;
}
.lc-details textarea:focus { border-style: solid; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(196, 146, 58, 0.16); background: #fff; }
.ld .ld-title { display: block; }
.ld .ld-detail { display: block; font-size: 12.5px; color: var(--muted); }
.ld .ld-detail strong { color: var(--text-2); font-weight: 600; }

/* Paramètres : cachet */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }
.settings-grid > .surface + .surface { margin-top: 0; }
.settings-grid form { margin-top: 0; }
.stamp-preview {
  display: grid;
  place-items: center;
  min-height: 150px;
  margin: 16px 0 18px;
  padding: 14px;
  border: 1.5px dashed rgba(196, 146, 58, 0.45);
  border-radius: 16px;
  background:
    repeating-conic-gradient(#f7f2e9 0% 25%, #ffffff 0% 50%) 50% / 18px 18px; /* damier : montre la transparence */
}
.stamp-preview img { max-width: 100%; max-height: 180px; }
.file-input {
  width: 100%;
  padding: 10px;
  font: inherit;
  font-size: 14px;
  color: var(--text-2);
  background: var(--field);
  border: 1px dashed var(--field-edge);
  border-radius: var(--radius);
  cursor: pointer;
}
.file-input::file-selector-button {
  margin-right: 12px;
  padding: 8px 14px;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  color: var(--on-gold);
  background: var(--gold-grad);
  cursor: pointer;
}
@media (max-width: 959px) {
  .settings-grid { grid-template-columns: 1fr; }
}

/* Devis */
.doc-ref { margin: 0 0 14px; color: var(--muted); }
.doc-link { margin: 10px 0 0; font-size: 13.5px; color: var(--muted); }
.answer-buttons { display: flex; gap: 8px; margin-top: 12px; }
.answer-buttons .inline-form { flex: 1; }
.answer-buttons .btn { width: 100%; }

/* ---------- Suivi : rapports et graphiques ----------
   Couleurs des séries validées (daltonisme, contraste sur fond blanc) :
   1 = or TripGate « Facturé » (et barres à une seule série), 2 = bleu « Encaissé ». */
:root { --viz-1: #b8862f; --viz-2: #2a78d6; --viz-grid: #efe9de; --viz-base: #cdc3b1; --viz-muted: #d3cbbd; }

.rp-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 10px; }
.rp-filters .tabs { min-width: 0; max-width: 100%; } /* sur téléphone : les boutons défilent dans leur ligne, pas la page */
.rp-custom { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 13.5px; color: var(--text-2); }
.rp-custom label { display: inline-flex; align-items: center; gap: 6px; }
.rp-custom input[type="date"] {
  height: 38px;
  padding: 0 10px;
  font: inherit;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--field-edge);
  border-radius: 10px;
}
.rp-custom.is-active input[type="date"] { border-color: rgba(196, 146, 58, 0.6); background: var(--gold-soft); }
.rp-period { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 0 18px; font-size: 14px; }

/* Chiffres clés : valeurs en sans-serif (lisibles, chiffres proportionnels) */
.rp-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rp-kpis .kpi-value { font-family: "Inter", system-ui, sans-serif; font-size: 25px; font-weight: 600; letter-spacing: -0.01em; }
.rp-delta { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.rp-delta b { font-size: 10px; }
.rp-delta span { font-weight: 400; color: var(--muted); }
.rp-delta.up { color: var(--success); }
.rp-delta.down { color: var(--danger); }

.rp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }
.rp-grid > .surface + .surface { margin-top: 0; }
.rp-wide { grid-column: 1 / -1; }
.rp-card .surface-head { flex-wrap: wrap; gap: 4px 14px; }

/* Légende (≥ 2 séries) */
.rp-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 14px; padding: 0; font-size: 13px; color: var(--text-2); }
.rp-legend li { display: inline-flex; align-items: center; gap: 7px; }
.rp-key { width: 12px; height: 12px; border-radius: 3px; }
.rp-key.s1, .rp-bar.s1, .rp-hbar { background: var(--viz-1); }
.rp-key.s2, .rp-bar.s2 { background: var(--viz-2); }

/* Colonnes groupées : barres fines (≤ 24 px), bout arrondi, posées sur une ligne de base */
.rp-cols { display: grid; grid-template-columns: 64px minmax(0, 1fr); column-gap: 8px; }
.rp-yaxis { position: relative; height: 220px; }
.rp-yaxis span { position: absolute; right: 0; transform: translateY(50%); font-size: 11.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rp-plot { position: relative; min-width: 0; }
.rp-gridlines { position: absolute; top: 0; left: 0; right: 0; height: 220px; pointer-events: none; }
.rp-gridlines span { position: absolute; left: 0; right: 0; border-top: 1px solid var(--viz-grid); }
.rp-gridlines span:first-child { border-top-color: var(--viz-base); }
.rp-buckets { position: relative; display: flex; }
.rp-bucket { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.rp-bars { display: flex; align-items: flex-end; justify-content: center; gap: 2px; width: 100%; height: 220px; }
.rp-bar { position: relative; width: min(24px, 40%); border-radius: 4px 4px 0 0; outline: none; transition: filter 0.15s; }
.rp-bar::after { content: ""; position: absolute; inset: -8px -3px 0; } /* zone de survol plus grande que la barre */
.rp-bar:hover, .rp-bar:focus-visible { filter: brightness(1.15); }
.rp-bar:focus-visible, .rp-hbar:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.rp-xlabel { margin-top: 8px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.rp-cols.dense .rp-xlabel { font-size: 10.5px; }

/* Barres horizontales : nom | barre | valeur */
.rp-hbars { list-style: none; display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; }
.rp-hbars li { display: grid; grid-template-columns: minmax(0, 13rem) minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.rp-hname { overflow: hidden; font-size: 13.5px; color: var(--text); white-space: nowrap; text-overflow: ellipsis; }
.rp-hname .count { font-size: 12px; }
.rp-htrack { position: relative; height: 14px; }
.rp-hbar { position: relative; display: block; height: 14px; border-radius: 0 4px 4px 0; outline: none; }
.rp-hbar::after { content: ""; position: absolute; inset: -6px 0; }
.rp-hbar:hover { filter: brightness(1.12); }
.rp-hbars li.muted .rp-hbar { background: var(--viz-muted); }
.rp-hval { font-size: 13.5px; font-weight: 600; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Tableau des chiffres (équivalent accessible du graphique) */
.rp-table { margin-top: 16px; }
.rp-table summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--gold-text); }
.rp-table table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.rp-table th, .rp-table td { padding: 7px 10px; border-bottom: 1px solid var(--edge); text-align: left; }
.rp-table th { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.rp-total td { font-weight: 700; }

/* Info-bulle : la valeur d'abord, le libellé ensuite */
.rp-tip {
  position: fixed;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 260px;
  padding: 8px 11px;
  border-radius: 10px;
  background: #1b150e;
  color: #d9cfbd;
  font-size: 12.5px;
  box-shadow: 0 10px 24px rgba(24, 19, 13, 0.3);
  pointer-events: none;
}
.rp-tip strong { font-size: 14px; color: #ffffff; font-variant-numeric: tabular-nums; }
.rp-tip[hidden] { display: none; }

@media (max-width: 1199px) {
  .rp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1099px) {
  .rp-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .kpis.rp-kpis { grid-template-columns: 1fr; } /* montants complets, une tuile par ligne */
  .rp-filters { flex-direction: column; align-items: stretch; }
  .rp-xyear { display: none; } /* « janv. » au lieu de « janv. 26 » sous les colonnes */
  .rp-cols { grid-template-columns: 50px minmax(0, 1fr); column-gap: 6px; }
  .rp-yaxis span { font-size: 10.5px; }
  .rp-cols.dense .rp-bucket:nth-child(even) .rp-xlabel { visibility: hidden; } /* une étiquette sur deux */
  .rp-hbars li { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
  .rp-hname { grid-column: 1 / -1; white-space: normal; }
}

/* ---------- Fenêtre de confirmation (dans la page, à la place des fenêtres du navigateur) ---------- */
.confirm-dialog {
  width: min(calc(100vw - 32px), 440px);
  padding: 0;
  border: 1px solid var(--edge-gold);
  border-radius: 22px;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(226, 184, 95, 0.12), transparent 75%),
    var(--surface);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(24, 19, 13, 0.35);
}
.confirm-dialog::backdrop { background: rgba(24, 19, 13, 0.55); }
.confirm-dialog[open] { animation: cd-in 0.18s ease-out both; }
@keyframes cd-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.confirm-dialog form { margin: 0; padding: 26px 26px 22px; }
.cd-title { margin: 0 0 8px; font-family: "Cormorant Garamond", Georgia, serif; font-size: 26px; font-weight: 600; color: var(--text); }
.cd-text { margin: 0 0 22px; font-size: 15px; line-height: 1.55; color: var(--text-2); }
.cd-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.confirm-dialog.is-danger [data-cd-ok] { background: linear-gradient(100deg, #df8a74 0%, #b3412c 100%); color: #ffffff; box-shadow: 0 8px 20px rgba(179, 65, 44, 0.25); }
@media (max-width: 480px) {
  .cd-actions { flex-direction: column-reverse; }
  .cd-actions .btn { width: 100%; }
}

/* ---------- Aperçu en direct du document (éditeur de facture / devis) ---------- */
.invoice-form { container: docform / inline-size; }
.live-preview { display: none; }
.lp-fab { display: none; }
.lp-panel {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 128px);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--edge-gold);
  border-radius: 22px;
  box-shadow: 0 14px 40px rgba(60, 45, 20, 0.12);
}
.lp-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--edge); font-size: 14px; }
.lp-dot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: #5fb27a; box-shadow: 0 0 0 3px rgba(95, 178, 122, 0.18); }
.live-preview.is-busy .lp-dot { background: var(--gold); box-shadow: 0 0 0 3px rgba(196, 146, 58, 0.2); animation: lp-pulse 0.9s ease-in-out infinite; }
.live-preview.is-error .lp-dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(179, 65, 44, 0.16); }
@keyframes lp-pulse { 50% { opacity: 0.35; } }
.lp-status { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.live-preview.is-error .lp-status { color: var(--danger); }
.lp-close { display: none; }
/* Choix du cachet dans l'aperçu */
.lp-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 14px 9px 18px; border-bottom: 1px solid var(--edge); }
.lp-tools-label { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.lp-tools .link { font-size: 13px; }
.lp-seg { display: inline-flex; padding: 3px; border: 1px solid var(--edge); border-radius: 999px; background: var(--surface-soft); }
.lp-seg button {
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background .2s, color .2s;
}
.lp-seg button:hover { color: var(--text); }
.lp-seg button[aria-pressed="true"] { background: var(--gold-grad); color: var(--on-gold); box-shadow: 0 3px 10px rgba(196, 146, 58, 0.25); }
.lp-seg button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.lp-stage { flex: 1; min-height: 0; overflow: auto; padding: 16px; background: #e9e2d6; }
.lp-page { position: relative; margin: 0 auto; overflow: hidden; } /* les pages (fond, ombres) sont dessinées dans le cadre */
.lp-page iframe { position: absolute; top: 0; left: 0; width: 794px; height: 1123px; border: 0; transform-origin: 0 0; pointer-events: none; }
.lp-hint { margin: 0; padding: 10px 18px; border-top: 1px solid var(--edge); font-size: 12px; line-height: 1.4; color: var(--muted); }

/* Grand écran : formulaire à gauche, document à droite (toujours visible) */
@media (min-width: 1300px) {
  .content:has(> .doc-editor) { max-width: 1760px; }
  .doc-editor { display: grid; grid-template-columns: minmax(0, 1fr) clamp(380px, 38%, 640px); gap: 24px; align-items: start; }
  .live-preview { display: block; position: sticky; top: 108px; }
}
/* Écran plus petit : bouton « Aperçu » qui ouvre le document en plein écran */
@media (max-width: 1299px) {
  .lp-fab {
    position: fixed;
    right: 22px;
    bottom: var(--lp-fab-bottom, 96px);
    z-index: 20;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 46px;
    padding: 0 18px 0 16px;
    border: 1px solid rgba(226, 184, 95, 0.5);
    border-radius: 999px;
    font: inherit;
    font-size: 14.5px;
    font-weight: 600;
    color: #f3d58a;
    background: linear-gradient(180deg, #2a2117 0%, #18130d 100%);
    box-shadow: 0 12px 30px rgba(24, 19, 13, 0.35);
    cursor: pointer;
  }
  .lp-fab svg { width: 18px; height: 18px; }
  .lp-fab:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
  .live-preview.is-open { display: block; position: fixed; inset: 0; z-index: 50; padding: 24px; background: rgba(24, 19, 13, 0.62); }
  .live-preview.is-open .lp-panel { max-width: 900px; height: 100%; max-height: none; margin: 0 auto; }
  .live-preview.is-open .lp-close { display: grid; place-items: center; }
  body.lp-open { overflow: hidden; }
}
@media (max-width: 959px) {
  .lp-fab { right: 16px; }
  .live-preview.is-open { padding: 0; }
  .live-preview.is-open .lp-panel { border: 0; border-radius: 0; }
  .lp-stage { padding: 10px; }
}

/* Formulaire étroit (à côté de l'aperçu, ou portable) : désignation sur toute la largeur,
   quantité / prix / TVA / total en dessous */
@media (min-width: 960px) {
  @container docform (max-width: 820px) {
    .lines-head { display: none; }
    .line-row {
      grid-template-columns: 84px minmax(0, 1fr) 96px minmax(0, 1fr) 36px;
      grid-template-areas:
        "desc desc desc desc desc"
        "details details details details details"
        "qty price vat total remove";
      gap: 8px 10px;
      padding: 14px 0;
    }
    .lc-desc { grid-area: desc; }
    .lc-details { grid-area: details; }
    .lc-qty { grid-area: qty; }
    .lc-price { grid-area: price; }
    .lc-vat { grid-area: vat; }
    .lc-total { grid-area: total; line-height: normal; }
    .lc-total output { display: block; line-height: 44px; }
    .lc-remove { grid-area: remove; align-self: end; padding: 0 0 5px; }
    .lc-label { display: block; margin-bottom: 4px; font-size: 11.5px; color: var(--muted); }
    .invoice-bottom { grid-template-columns: 1fr; gap: 18px; }
  }
}

/* ---------- Téléphone et tablette ---------- */
@media (max-width: 959px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 14px 14px; min-width: 0; }
  .kpi:first-child { grid-column: 1 / -1; }
  .kpi-value { font-size: 20px; }
  .kpi:first-child .kpi-value { font-size: 30px; }
  .kpi-label { font-size: 10.5px; letter-spacing: 0.1em; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar > * { min-width: 0; max-width: 100%; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; min-width: 0; }
  .tabs a { white-space: nowrap; }
  .search input { width: 100%; }
  .row-actions { width: 100%; }
  .row-actions .btn { flex: 1; }

  .lines-head { display: none; }
  .line-row {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-areas:
      "desc desc desc"
      "details details details"
      "qty price vat"
      "total total remove";
    gap: 8px 10px;
    padding: 14px 0;
  }
  .lc-desc { grid-area: desc; }
  .lc-details { grid-area: details; grid-column: auto; }
  .lc-total { line-height: normal; }
  .lc-remove { padding-top: 0; }
  .lc-qty { grid-area: qty; }
  .lc-price { grid-area: price; }
  .lc-vat { grid-area: vat; }
  .lc-total { grid-area: total; text-align: left; align-self: center; }
  .lc-remove { grid-area: remove; justify-self: end; }
  .lc-label { display: block; margin-bottom: 4px; font-size: 11.5px; color: var(--muted); }
  .lc-total .lc-label { display: inline; margin-right: 8px; }
  .invoice-bottom, .invoice-grid { grid-template-columns: 1fr; }
  .sticky-actions { flex-direction: column-reverse; align-items: stretch; }
  .invoice-head { align-items: stretch; }
  .ih-actions .btn, .ih-actions .inline-form { flex: 1; }
  .ih-actions .inline-form .btn { width: 100%; }
  table.lines-table th:nth-child(3), table.lines-table td:nth-child(3) { display: none; }
  table.lines-table th, table.lines-table td { padding-left: 6px; padding-right: 6px; }
}

/* ---------- Téléphone et tablette ---------- */
@media (max-width: 959px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform .25s ease, visibility 0s linear .25s;
    box-shadow: 24px 0 60px rgba(24, 19, 13, 0.35);
  }
  body.nav-open .sidebar { transform: none; visibility: visible; transition: transform .25s ease; }
  body.nav-open { overflow: hidden; }
  .sidebar .sidebar-close { display: grid; position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; }
  .topbar .menu-btn { display: grid; }
  .topbar { padding: 14px 16px; gap: 12px; }
  .topbar h1 { font-size: 24px; }
  .topbar .crumb { font-size: 10px; letter-spacing: 0.14em; white-space: nowrap; }
  .topbar .lang-switch button { padding: 6px 10px; }
  .content { padding: 20px 16px 28px; }
  .app-foot { padding: 14px 16px 22px; text-align: center; }

  .surface { padding: 20px 18px; border-radius: 20px; }
  .hero { flex-direction: column; text-align: center; gap: 16px; }
  .hero .profile-name { font-size: 32px; }
  .hero-side { text-align: center; padding: 14px 0 0; border-left: 0; border-top: 1px solid var(--edge); width: 100%; }

  .account-grid { grid-template-columns: 1fr; }
  #passwordForm .form-actions { flex-direction: column-reverse; align-items: stretch; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2,
  .edit-grid .span-2 { grid-column: auto; }
  .form-grid .form-actions { flex-direction: column; align-items: stretch; gap: 14px; }
  .form-actions .btn { width: 100%; }
  .edit-grid .form-actions .btn { flex: 1; }

  table.users thead { display: none; }
  table.users, table.users tbody, table.users tr, table.users td { display: block; width: 100%; }
  table.users tbody.user {
    border: 1px solid var(--edge);
    border-radius: 16px;
    margin-bottom: 12px;
    overflow: hidden;
    background: var(--surface);
  }
  table.users td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid #f3ede3; }
  table.users td:first-child { padding-top: 14px; }
  table.users .actions { justify-content: stretch; border-bottom: 0; }
  table.users .actions .btn { width: 100%; }
  .cell-label { display: inline; font-size: 12px; color: var(--muted); }
  .badges { align-items: flex-end; }
  table.users td:first-child .cell-label { display: none; }
  tr.edit-row td { display: block; padding: 16px 14px 4px; }
  .edit-grid { grid-template-columns: 1fr; }
  .edit-grid .form-actions { padding-bottom: 14px; }
}

/* =====================================================================
   SUIVI (modèle) : en-tête de page, onglets par année, filtres, tableaux de suivi
   ===================================================================== */
.surface.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap; padding-top: 20px; padding-bottom: 20px; }
.page-head .count { margin: 4px 0 0; }
.surface.tabs-bar { padding: 10px 12px; margin-top: 14px; }
.surface.filter-bar { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; margin-top: 14px; }
.surface.list-card { margin-top: 14px; padding: 8px 18px 12px; }
.year-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; }
.year-tabs a {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  padding: 8px 16px; border-radius: 999px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; color: var(--text-2); text-decoration: none; white-space: nowrap;
}
.year-tabs a:hover { background: var(--gold-soft); }
.year-tabs a[aria-current="page"] { background: #1a1510; color: #f3d58a; border-color: #1a1510; }
.year-tabs a[aria-current="page"] .tab-count { color: #d9cfbd; }
.year-tabs a:focus-visible, .chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.filter-bar .search input { width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--edge);
  background: var(--surface); font-size: 13px; color: var(--text-2); text-decoration: none; white-space: nowrap;
}
.chip:hover { border-color: var(--field-hover); }
.chip[aria-current="page"] { background: var(--gold-soft); border-color: rgba(196, 146, 58, 0.55); color: #6a4d17; font-weight: 600; }
.chip-sub { font-size: 11.5px; color: var(--muted); font-weight: 400; }

table.track-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.track-table th {
  padding: 12px 10px; border-bottom: 1px solid var(--edge); text-align: left; white-space: nowrap;
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
}
table.track-table td { padding: 12px 10px; border-bottom: 1px solid #f0e9dd; vertical-align: middle; }
table.track-table tbody tr:last-child td { border-bottom: 0; }
table.track-table tbody tr:hover td { background: #fdfaf4; }
table.track-table .num { text-align: right; white-space: nowrap; }
table.track-table .c { text-align: center; }
.tt-del { width: 40px; padding-left: 0 !important; padding-right: 0 !important; text-align: center; }
.tt-del form { margin: 0; }
.tt-no { white-space: nowrap; }
.tt-no .inv-link { display: block; }
.tt-state { display: inline-block; margin-top: 4px; }
.tt-state .badge { font-size: 11px; padding: 2px 8px; }
.tt-desig { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.icon-btn.danger { color: var(--danger); }
.icon-btn.danger:hover { background: var(--danger-bg); }

/* Cases « Déposé » / « Payé » */
.check-form { display: inline-block; margin: 0; }
.check-btn {
  display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0;
  border: 1.5px solid var(--field-edge); border-radius: 7px; background: #fff; color: transparent;
  cursor: pointer; vertical-align: middle; transition: background .15s, border-color .15s;
}
.check-btn svg { width: 16px; height: 16px; }
button.check-btn:hover { border-color: var(--gold); color: rgba(134, 99, 33, 0.35); }
.check-btn[aria-checked="true"], .check-btn.is-on { background: #1a1510; border-color: #1a1510; color: #f3d58a; }
button.check-btn[aria-checked="true"]:hover { background: #3a2f22; color: #f3d58a; }
.check-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.check-btn.is-off { border-style: dashed; background: transparent; opacity: 0.45; cursor: default; }

/* Encadré « Document verrouillé » et demandes */
.lock-panel .side-title { display: flex; align-items: center; gap: 8px; }
.lock-ico { width: 20px; height: 20px; color: var(--gold-text); flex: none; }
.lock-panel .count { margin: 0 0 12px; }
.lock-panel .notice { margin: 0 0 12px; }
.pending-req { margin: 0 0 6px; font-size: 14px; }
.req-kinds { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; padding: 0; border: 0; }
.req-kinds legend { margin-bottom: 8px; padding: 0; }
.req-kind { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--edge); border-radius: 999px; font-size: 13.5px; cursor: pointer; }
.req-kind:has(input:checked) { border-color: rgba(196, 146, 58, 0.6); background: var(--gold-soft); color: #6a4d17; font-weight: 600; }
.req-kind input { accent-color: #866321; margin: 0; }
.request-form .field { margin-bottom: 12px; }
.page-tabs { margin: 14px 0 0; }
.req-list { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.req-list > .surface + .surface { margin-top: 0; }
.req-card { display: flex; justify-content: space-between; gap: 22px; align-items: flex-start; }
.req-card.is-pending { border-left: 4px solid var(--gold); }
.req-main { min-width: 0; }
.req-main p { margin: 0 0 6px; }
.req-doc { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.req-type { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-text); }
.req-reason { font-style: italic; color: var(--text-2); }
.req-note { font-size: 13.5px; color: var(--text-2); }
.req-actions { flex: 0 0 320px; }
.req-actions form { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.req-buttons { display: flex; gap: 8px; }
.req-buttons .btn { flex: 1; }
.sign-form .field { margin-bottom: 12px; }

/* =====================================================================
   GESTION COMPTABILITÉ : cartes noir et or, indicateurs en anneaux, relances
   ===================================================================== */
.year-chip { display: inline-block; padding: 1px 10px; border-radius: 999px; background: #1a1510; color: #f3d58a; font-size: 12.5px; font-weight: 700; }
.ck-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 14px 0 22px; }
.ck-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0;
  padding: 18px 20px; border-radius: 18px; text-decoration: none; color: #f5efe3;
  background: linear-gradient(160deg, #221b12 0%, #120e09 100%);
  border: 1px solid rgba(226, 184, 95, 0.28);
  box-shadow: 0 14px 34px rgba(24, 19, 13, 0.18);
  transition: transform .15s, border-color .15s;
}
.ck-card:hover { transform: translateY(-2px); border-color: rgba(226, 184, 95, 0.7); }
.ck-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.ck-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ck-label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: #e2b85f; }
.ck-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(226, 184, 95, 0.12); color: #f3d58a; flex: none; }
.ck-ico svg { width: 18px; height: 18px; }
.ck-value { font-size: 26px; font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; color: #ffffff; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ck-sub { font-size: 12.5px; color: #bfb5a3; }
.ck-card.is-alert { border-color: rgba(231, 123, 107, 0.65); }
.ck-card.is-alert .ck-label { color: #f0a08f; }
.ck-card.is-alert .ck-ico { background: rgba(231, 123, 107, 0.16); color: #f0a08f; }

.rings { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; }
.ring { margin: 0; text-align: center; min-width: 0; }
.ring-dial { position: relative; width: 112px; height: 112px; margin: 0 auto; }
.ring-dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--viz-grid); stroke-width: 8; }
.ring-value { fill: none; stroke: var(--viz-1); stroke-width: 8; stroke-linecap: round; }
.ring-pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.ring-pct small { position: relative; top: 3px; font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 1px; }
.ring figcaption { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.ring-label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.ring-detail { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.compta-grid { margin-top: 22px; }
.chase-list { list-style: none; margin: 0 0 12px; padding: 0; }
.chase-list a { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 6px; border-bottom: 1px dashed var(--edge); color: var(--text); text-decoration: none; border-radius: 8px; }
.chase-list li:last-child a { border-bottom: 0; }
.chase-list a:hover { background: #fdfaf4; }
.chase-list a:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.chase-main { display: flex; flex-direction: column; min-width: 0; }
.chase-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chase-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.chase-amount { font-variant-numeric: tabular-nums; }

/* Demandes du site web */
.lead-contact { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; }
.lead-details { margin-top: 8px; }
.lead-details summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--gold-text); }
.lead-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 18px; margin: 10px 0 0; }
.lead-fields div { min-width: 0; }
.lead-fields dt { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.lead-fields dd { margin: 2px 0 0; font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.lead-actions { display: flex; flex-direction: column; gap: 8px; flex-basis: 260px; }
.lead-actions .req-buttons .inline-form { flex: 1; }
.lead-actions .req-buttons .btn { width: 100%; }

/* Accueil : notification des demandes à valider / réponses reçues */
.req-banner {
  display: flex; align-items: center; gap: 12px; margin: 0 0 18px; padding: 14px 18px;
  border-radius: 16px; background: #1a1510; color: #f5efe3; text-decoration: none;
  border: 1px solid rgba(226, 184, 95, 0.45); box-shadow: 0 10px 26px rgba(24, 19, 13, 0.16);
}
.req-banner svg { width: 22px; height: 22px; color: #f3d58a; flex: none; }
.req-banner strong { color: #f3d58a; font-size: 17px; margin-right: 4px; }
.req-banner-go { margin-left: auto; font-weight: 600; color: #f3d58a; white-space: nowrap; }
.req-banner:hover { border-color: #e2b85f; }
.req-banner:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* Formulaires sans aperçu (bons de commande et de livraison) */
@media (min-width: 1300px) {
  .content:has(> .doc-editor.no-preview) { max-width: 1180px; }
  .doc-editor.no-preview { display: block; }
}
.lines-head.dn-head,
.line-row.dn-line {
  grid-template-columns: minmax(0, 1fr) 110px 36px;
  grid-template-areas: "desc qty remove" "details details details";
}
.lines-head.dn-head { grid-template-areas: none; }
.dn-line .lc-desc { grid-area: desc; }
.dn-line .lc-qty { grid-area: qty; }
.dn-line .lc-remove { grid-area: remove; align-self: start; padding: 5px 0 0; justify-self: end; }
.dn-line .lc-details { grid-area: details; }
.dn-extra { display: grid; gap: 14px; margin-top: 22px; }

@media (max-width: 1099px) {
  .ck-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rings { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 24px; }
}
@media (max-width: 959px) {
  .surface.page-head { align-items: stretch; }
  .page-head .head-actions { width: 100%; }
  .page-head .head-actions .btn { flex: 1; }
  .surface.tabs-bar { padding: 8px; }
  .surface.list-card { padding: 4px 0 0; background: transparent; border: 0; box-shadow: none; }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }

  /* Tableau de suivi → cartes */
  table.track-table thead { display: none; }
  table.track-table, table.track-table tbody, table.track-table tr, table.track-table td { display: block; width: 100%; }
  table.track-table tr { position: relative; margin-bottom: 12px; border: 1px solid var(--edge); border-radius: 16px; background: var(--surface); overflow: hidden; }
  table.track-table tbody tr:hover td { background: transparent; }
  table.track-table td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 14px; border-bottom: 1px solid #f3ede3; text-align: right; }
  table.track-table td.num, table.track-table td.c { text-align: right; }
  table.track-table tr td:last-child { border-bottom: 0; }
  table.track-table .tt-no { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 6px 10px; padding-top: 14px; text-align: left; }
  table.track-table .tt-no .inv-link { display: inline; font-size: 15px; }
  table.track-table .tt-state { margin: 0; }
  table.track-table .tt-desig { max-width: none; white-space: normal; }
  .tt-del { position: absolute; top: 8px; right: 8px; width: auto !important; padding: 0 !important; border: 0 !important; z-index: 1; }
  .tt-del:empty { display: none !important; }
  .rings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ring-dial { width: 96px; height: 96px; }
  .ring-pct { font-size: 21px; }
  .req-card { flex-direction: column; gap: 12px; }
  .req-actions { flex: none; width: 100%; }
  .line-row.dn-line { grid-template-columns: minmax(0, 1fr) 96px 36px; grid-template-areas: "desc desc desc" "details details details" "qty . remove"; }
  .dn-line .lc-remove { align-self: end; padding: 0 0 5px; }
}
@media (max-width: 520px) {
  .ck-grid { grid-template-columns: 1fr; gap: 12px; }
  .ck-value { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
