/* ── CHRONOS — Charte graphique Maison Tellus ── */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400;1,600&family=Jost:wght@300;400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --noir:   #0a0a0a;
  /* Accent piloté par l'instance hôte (chronos-theme.css + inline <body>).
     Tellus → #c4a055 · Lisbon Finals → #f5a623. Tout `var(--or)` suit. */
  --or:     var(--project-accent, #c4a055);
  --creme:  #f5f0e8;
  --muted:  #8a7f72;
  --texte:  #5a5248;
  --blanc:  #ffffff;
  --sidebar-w: 220px;
}

body {
  font-family: 'Jost', sans-serif;
  font-weight: 300;
  background: var(--creme);
  color: var(--texte);
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--noir);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
}

.sidebar__logo {
  display: block;
  text-decoration: none;
  padding: 1.7rem 1.5rem 1.4rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

/* Projet hôte — au-dessus, discret */
.sidebar__host {
  display: block;
  font-family: 'Jost', sans-serif;
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.24em;
  color: rgba(255,255,255,.80);
  text-transform: uppercase;
}

.sidebar__poweredby {
  display: block;
  font-family: var(--chronos-font-ui);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,.32);
  margin: 6px 0 5px;
}

/* Marque produit CHRONOS — logo PNG */
.chronos-logo-img {
  display: block;
  height: 22px;
  width: auto;
  object-fit: contain;
}

.chronos-lockup {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chronos-mark {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
  color: #fff;
}
.chronos-mark .ring { stroke: currentColor; }
.chronos-mark .dot  { fill: currentColor; }
.chronos-mark .tick { stroke: var(--project-accent, #c4a055); }

.chronos-word {
  font-family: 'Jost', sans-serif;
  font-weight: 500;
  font-size: 17px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: #fff;
  line-height: 1;
}

.sidebar__baseline {
  display: block;
  font-family: var(--chronos-font-ui);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.30em;
  text-transform: uppercase;
  color: rgba(255,255,255,.42);
  margin-top: 8px;
  padding-left: 30px;
}

.sidebar__nav {
  list-style: none;
  padding: .75rem 0 0;
  flex: 1 1 0;
  overflow-y: scroll;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(196,160,85,.2) transparent;
}
.sidebar__nav::-webkit-scrollbar { width: 3px; }
.sidebar__nav::-webkit-scrollbar-thumb { background: var(--project-accent-soft, rgba(196,160,85,.25)); border-radius: 3px; }

.sidebar__nav--system {
  list-style: none;
  flex: 0 0 auto;
  padding: .35rem 0 0;
  border-top: 1px solid var(--project-accent-soft, rgba(196,160,85,.12));
}

.sidebar__section {
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(196,160,85,0.4);
  padding: .5rem 1.5rem .15rem;
  pointer-events: none;
}

.sidebar__nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0.5rem 1.5rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  transition: color .2s, background .2s;
}

.sidebar__nav a svg {
  width: 16px; height: 16px;
  fill: currentColor;
  flex-shrink: 0;
}

.sidebar__nav a:hover,
.sidebar__nav a.active {
  color: var(--or);
  background: rgba(196,160,85,.06);
}

.sidebar__footer {
  flex: 0 0 auto;
  padding: .75rem 1.5rem;
  border-top: 1px solid rgba(196,160,85,.15);
}

.btn-logout {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color .2s;
}
.btn-logout:hover { color: var(--or); }

/* ── MAIN ── */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 2.5rem 2.5rem 3rem;
}

/* ── PAGE HEADER ── */
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(196,160,85,.25);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header__eyebrow {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--or);
  margin-bottom: 6px;
}

.page-header__title {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 2rem;
  color: var(--noir);
  font-weight: 400;
}

/* ── STATS GRID ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--blanc);
  border: 1px solid var(--chronos-line);
  border-radius: var(--chronos-radius-md);
  padding: 1.25rem 1.5rem;
}

.stat-card__value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.5rem;
  color: var(--noir);
  line-height: 1;
}

.stat-card__label {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}

.stat-card--alert .stat-card__value { color: #b5541a; }

/* ── CHRONOS AGENT STATUS BAR (composant produit) ── */
.agent-status {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--chronos-ink);
  padding: 0.85rem 1.25rem;
  margin-bottom: 2rem;
  border-radius: var(--chronos-radius-md);
  flex-wrap: wrap;
}

.agent-status__mark {
  width: 20px; height: 20px;
  flex-shrink: 0;
  display: inline-flex;
}
.agent-status__mark svg { width: 20px; height: 20px; }
.agent-status__mark .ring { stroke: #fff; }
.agent-status__mark .dot  { fill: #fff; }
.agent-status__mark .tick { stroke: var(--project-accent, #c4a055); }

.agent-status__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--chronos-success);
  box-shadow: 0 0 0 3px rgba(53, 201, 131, .18);
  animation: pulse 2s infinite;
}
.agent-status__dot.paused  { background: var(--chronos-muted); box-shadow: none; animation: none; }
.agent-status__dot.warning { background: var(--chronos-warning); box-shadow: 0 0 0 3px rgba(200, 162, 79, .18); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

.agent-status__label {
  font-family: var(--chronos-font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
}

.agent-status__detail {
  font-family: var(--chronos-font-ui);
  font-size: 12px;
  color: rgba(255, 255, 255, .60);
}

.agent-status__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.agent-status__loop {
  font-family: var(--chronos-font-ui);
  font-size: 11px;
  color: rgba(255, 255, 255, .45);
}
.agent-status__loop.is-warning { color: var(--chronos-warning); }

.agent-status__actions { display: flex; gap: .5rem; }
.agent-status__actions .btn { font-size: 11px; padding: .35rem .8rem; }

/* Sync — bouton clair discret sur fond sombre */
.btn--ghost-light {
  background: rgba(255, 255, 255, .07);
  color: rgba(255, 255, 255, .85);
  border: 1px solid rgba(255, 255, 255, .15);
}
.btn--ghost-light:hover { background: rgba(255, 255, 255, .14); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  font-family: 'Jost', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  border: none;
  border-radius: var(--chronos-radius-sm);
  cursor: pointer;
  transition: all .2s;
}

.btn--primary {
  background: var(--noir);
  color: var(--blanc);
}
.btn--primary:hover { background: #2d2926; }

.btn--gold {
  background: var(--or);
  color: var(--noir);
}
.btn--gold:hover { background: #b8924a; }

/* Bleu SIGNAL — réservé aux actions IA / système / automation */
.btn--signal {
  background: var(--chronos-signal);
  color: #fff;
}
.btn--signal:hover { background: #0a6fe4; }

.btn--outline {
  background: transparent;
  color: var(--noir);
  border: 1px solid rgba(196,160,85,.4);
}
.btn--outline:hover { border-color: var(--or); color: var(--or); }

.btn--danger {
  background: #c0392b;
  color: var(--blanc);
}

.btn--pause {
  background: rgba(196,160,85,.15);
  color: var(--or);
  border: 1px solid rgba(196,160,85,.3);
}

/* Agent actif → vert clair */
.btn--actif {
  background: #2d6a4f;
  color: #d8f3dc;
  border: 1px solid #52b788;
  font-weight: 600;
}
.btn--actif:hover { background: #245a42; }

/* Agent inactif → pastel doux */
.btn--inactif {
  background: #f0f4f0;
  color: #6b8f71;
  border: 1px solid #b7d5bc;
}
.btn--inactif:hover { background: #d8f3dc; color: #2d6a4f; border-color: #52b788; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--blanc);
}

th {
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(196,160,85,.2);
  white-space: nowrap;
}

td {
  padding: 0.85rem 1rem;
  font-size: 13px;
  border-bottom: 1px solid rgba(196,160,85,.1);
  vertical-align: middle;
}

.th-sort {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: color .15s;
}
.th-sort:hover { color: var(--or); }
.th-sort--active { color: var(--or); }

tr:hover td { background: rgba(196,160,85,.04); }

td a {
  color: var(--noir);
  text-decoration: none;
  font-weight: 400;
}
td a:hover { color: var(--or); }

/* ── SCORE STARS ── */
.stars { color: var(--or); letter-spacing: 1px; font-size: 12px; }
.stars span { color: #ddd; }

/* ── BADGE STATUT ── */
.badge {
  display: inline-block;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 8px;
  font-weight: 500;
}
.badge--nouveau  { background: rgba(196,160,85,.15); color: #8a6f35; }
.badge--contacte { background: rgba(62,207,142,.12); color: #1a7a52; }
.badge--attente  { background: rgba(181,84,26,.12);  color: #b5541a; }

/* ── CARD ── */
.card {
  background: var(--blanc);
  border: 1px solid var(--chronos-line);
  border-radius: var(--chronos-radius-md);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.card__title {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.25rem;
  color: var(--noir);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(196,160,85,.15);
}

/* ── FORM ── */
.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  font-family: 'Jost', sans-serif;
  font-size: 13px;
  color: var(--noir);
  background: var(--blanc);
  border: 1px solid rgba(196,160,85,.3);
  border-radius: var(--chronos-radius-sm);
  outline: none;
  transition: border-color .2s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--or);
}

textarea { min-height: 200px; resize: vertical; line-height: 1.6; }

/* ── FILTERS ── */
.filters {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filters input, .filters select {
  width: auto;
  min-width: 140px;
}

/* ── FLASH ── */
.flash-container { margin-bottom: 1.5rem; }
.flash {
  padding: 0.9rem 1.25rem;
  font-size: 13px;
  margin-bottom: 0.5rem;
  border-left: 3px solid var(--or);
  background: rgba(196,160,85,.08);
}
.flash--error   { border-color: #c0392b; background: rgba(192,57,43,.06); }
.flash--warning { border-color: #e67e22; background: rgba(230,126,34,.06); }
.flash--success { border-color: #27ae60; background: rgba(39,174,96,.06); }

/* ── LOGIN ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--noir);
}

.login-box {
  width: 380px;
  padding: 3rem 2.5rem;
  background: var(--creme);
}

.login-box__logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-box__brand {
  font-family: 'Jost', sans-serif;
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
}

.login-box__name {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 2rem;
  color: var(--noir);
  display: block;
  margin-top: 4px;
}

.login-box__sep {
  width: 40px;
  border: none;
  border-top: 1px solid var(--or);
  margin: 1.25rem auto;
}

/* ── ESCALADE BOX ── */
.escalade-box {
  background: rgba(181,84,26,.06);
  border: 1px solid rgba(181,84,26,.2);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.escalade-box__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.escalade-box__contact {
  font-weight: 500;
  font-size: 14px;
  color: var(--noir);
}

.escalade-box__pub {
  font-size: 12px;
  color: var(--muted);
}

.escalade-box__actions { display: flex; gap: 0.5rem; }

/* ── MOBILE TOP BAR ── */
.mobile-topbar {
  display: none;
}

/* ── BOTTOM NAV ── */
.bottom-nav {
  display: none;
}

/* ── DRAWER OVERLAY ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,23,20,.65);
  z-index: 199;
  opacity: 0;
  transition: opacity .28s ease;
}
.sidebar-overlay.is-open {
  opacity: 1;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {

  /* Sidebar devient drawer */
  .sidebar {
    width: 280px;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    z-index: 200;
    box-shadow: none;
  }
  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.4);
  }
  .sidebar-overlay { display: block; pointer-events: none; }
  .sidebar-overlay.is-open { pointer-events: auto; }

  /* Main content prend toute la largeur */
  .main-content {
    margin-left: 0;
    padding: 1rem 1rem 5.5rem;
  }

  /* Top bar mobile */
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 52px;
    background: var(--noir);
    border-bottom: 1px solid rgba(196,160,85,.18);
    padding: 0 1rem;
    z-index: 150;
  }
  .mobile-topbar__burger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: var(--or);
  }
  .mobile-topbar__burger span {
    display: block;
    width: 22px;
    height: 1.5px;
    background: var(--or);
    transition: transform .22s, opacity .22s;
    border-radius: 2px;
  }
  .mobile-topbar__logo {
    display: flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
  }
  .mobile-topbar__logo .chronos-logo-img {
    height: 18px;
  }
  .mobile-topbar__logo small {
    font-family: 'Jost', sans-serif;
    font-style: normal;
    font-size: 8px;
    letter-spacing: .16em;
    color: rgba(255,255,255,.4);
    text-transform: uppercase;
    margin-left: 2px;
    align-self: center;
  }
  .mobile-topbar__right {
    width: 34px;
    display: flex;
    justify-content: flex-end;
  }
  .mobile-topbar__status {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #50a05a;
  }

  /* Décale le contenu sous la top bar */
  .main-content {
    padding-top: 68px;
  }

  /* Bottom navigation */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 58px;
    background: var(--noir);
    border-top: 1px solid rgba(196,160,85,.15);
    z-index: 150;
    align-items: stretch;
  }
  .bottom-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: rgba(138,127,114,.6);
    font-size: 8px;
    letter-spacing: .1em;
    text-transform: uppercase;
    font-family: 'Jost', sans-serif;
    font-weight: 400;
    position: relative;
    transition: color .18s;
  }
  .bottom-nav__item svg {
    width: 20px; height: 20px;
    fill: currentColor;
  }
  .bottom-nav__item.active,
  .bottom-nav__item:hover {
    color: var(--or);
  }
  .bottom-nav__item.active::before {
    content: '';
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 28px; height: 2px;
    background: var(--or);
    border-radius: 0 0 2px 2px;
  }

  /* ══════════════════════════════════════════════════
     SYSTÈME AUTO — toute nouvelle page est couverte
     Tout div avec grid-template-columns inline → 1 col
     ══════════════════════════════════════════════════ */
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  /* Exceptions : stats toujours 2 col, tokens toujours inline */
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* ── GRILLES ── */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: .75rem;
    margin-bottom: 1.25rem;
  }
  .stat-card { padding: 1rem 1rem; }
  .stat-card__value { font-size: 2rem; }

  /* ── PAGE HEADER ── */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: .75rem;
    margin-bottom: 1.25rem;
  }
  .page-header > div:last-child {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
  }
  .page-header > div:last-child .btn {
    flex: 1 1 auto;
    min-width: calc(50% - .25rem);
    justify-content: center;
    text-align: center;
    font-size: 10px;
    padding: .55rem .5rem;
  }

  /* ── COÛTS — stats horizontales → verticales ── */
  [style*="grid-template-columns:auto 1px auto"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem !important;
    padding: 1.25rem 1rem !important;
  }
  /* Cacher les séparateurs verticaux */
  [style*="width:1px;height:60px"] { display: none !important; }
  /* Réduire la taille du chiffre principal */
  [style*="grid-template-columns:auto 1px auto"] [style*="font-size:3rem"] {
    font-size: 2.2rem !important;
  }
  [style*="grid-template-columns:auto 1px auto"] [style*="font-size:2rem"] {
    font-size: 1.8rem !important;
  }

  /* Table features → 2 lignes par entrée */
  .couts-features-table,
  .couts-features-table thead,
  .couts-features-table tbody,
  .couts-features-table tr,
  .couts-features-table td { display: block !important; }
  .couts-features-table thead { display: none !important; }
  .couts-features-table tbody { display: flex !important; flex-direction: column; }
  .couts-features-table tr {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    grid-template-rows: auto auto !important;
    gap: .1rem .5rem;
    padding: .65rem .5rem !important;
    border-bottom: 1px solid rgba(196,160,85,.1) !important;
    border-top: none !important;
  }
  .couts-features-table tr:last-child { border-bottom: none !important; }
  .couts-features-table td:nth-child(1) {
    grid-column: 1; grid-row: 1;
    font-size: 13px !important; font-weight: 500;
    padding: 0 !important; border: none !important;
  }
  .couts-features-table td:nth-child(2) {
    grid-column: 1; grid-row: 2;
    font-size: 11px !important; color: var(--muted) !important;
    padding: 0 !important; border: none !important;
  }
  .couts-features-table td:nth-child(2)::before { content: "Appels : "; }
  .couts-features-table td:nth-child(3) {
    grid-column: 2; grid-row: 1 / 3;
    display: flex !important; align-items: center;
    padding: 0 !important; border: none !important;
    font-size: 1rem !important;
  }

  /* Table mensuel → cards simples */
  .couts-mois-table,
  .couts-mois-table thead,
  .couts-mois-table tbody,
  .couts-mois-table tr,
  .couts-mois-table td { display: block !important; }
  .couts-mois-table thead { display: none !important; }
  .couts-mois-table tbody { display: flex !important; flex-direction: column; }
  .couts-mois-table tr {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: auto auto auto !important;
    gap: .15rem .75rem;
    padding: .85rem .5rem !important;
    border-bottom: 1px solid rgba(196,160,85,.1) !important;
    border-top: none !important;
  }
  .couts-mois-table tr:last-child { border-bottom: none !important; }
  /* Mois — pleine largeur */
  .couts-mois-table td:nth-child(1) {
    grid-column: 1 / -1; grid-row: 1;
    font-size: 13px !important; font-weight: 500;
    padding: 0 !important; border: none !important; margin-bottom: 2px;
  }
  /* Appels + Claude */
  .couts-mois-table td:nth-child(2) {
    grid-column: 1; grid-row: 2;
    font-size: 11px !important; color: var(--muted) !important;
    padding: 0 !important; border: none !important;
  }
  .couts-mois-table td:nth-child(2)::before { content: "Appels : "; }
  .couts-mois-table td:nth-child(5) {
    grid-column: 2; grid-row: 2;
    font-size: 11px !important;
    padding: 0 !important; border: none !important; text-align: right;
  }
  .couts-mois-table td:nth-child(5)::before { content: "Claude : "; color: var(--muted); }
  /* Total */
  .couts-mois-table td:nth-child(7) {
    grid-column: 1 / -1; grid-row: 3;
    padding: 0 !important; border: none !important;
  }
  /* Cacher tokens et railway */
  .couts-mois-table td:nth-child(3),
  .couts-mois-table td:nth-child(4),
  .couts-mois-table td:nth-child(6) { display: none !important; }

  /* ── COMMUNIQUÉS — liste + form → colonne ── */
  [style*="grid-template-columns:1fr 360px"] {
    grid-template-columns: 1fr !important;
  }

  /* ── CAMPAGNES — card 1fr auto → flex col ── */
  .card [style*="grid-template-columns:1fr auto;gap:1rem"] {
    display: flex !important;
    flex-direction: column !important;
    gap: .75rem !important;
  }

  /* ── COMPOSER — boutons textarea ── */
  [style*="gap:.75rem;flex-wrap:wrap;margin-top:.5rem"] {
    flex-direction: column !important;
  }
  [style*="gap:.75rem;flex-wrap:wrap;margin-top:.5rem"] .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* ── KNOWLEDGE BASE — header actions ── */
  .page-header [style*="display:flex;gap:.75rem"] {
    flex-wrap: wrap !important;
  }

  /* ── FORMULAIRES — flex score+bouton → colonne ── */
  [style*="display:flex;gap:.5rem;align-items:flex-end"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  /* ── PARAMÈTRES — grid-column: 1/-1 fonctionne ── */
  /* (couvert par le sélecteur universel) */

  /* ── CARD ── */
  .card { padding: 1rem; margin-bottom: 1rem; }
  .card__title { font-size: 11px; margin-bottom: .75rem; }

  /* ── TABLES → CARDS MOBILE ── */
  .table-wrap { overflow-x: visible; }

  .table-wrap table,
  .table-wrap table thead,
  .table-wrap table tbody,
  .table-wrap table tr,
  .table-wrap table th,
  .table-wrap table td { display: block !important; }

  .table-wrap table thead { display: none !important; }

  .table-wrap table tbody {
    display: flex !important;
    flex-direction: column;
    gap: 0;
  }

  .table-wrap table tr {
    display: flex !important;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .2rem .5rem;
    padding: .75rem .25rem;
    border: none !important;
    border-bottom: 1px solid rgba(196,160,85,.1) !important;
    cursor: pointer;
  }
  .table-wrap table tr:last-child { border-bottom: none !important; }

  .table-wrap table td {
    display: inline !important;
    padding: 0 !important;
    border: none !important;
    font-size: 12px;
  }
  /* Nom — pleine largeur, bold */
  .table-wrap table td:first-child {
    display: block !important;
    font-size: 13px !important;
    font-weight: 500;
    color: var(--noir) !important;
    width: 100%;
    margin-bottom: 2px;
  }
  /* Sujet — pleine largeur, tronqué */
  .table-wrap table td:nth-child(2) {
    display: block !important;
    font-size: 12px !important;
    color: var(--texte) !important;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
  }
  /* Publication + date — inline côte à côte */
  .table-wrap table td:nth-child(3),
  .table-wrap table td:nth-child(4) {
    display: inline !important;
    font-size: 11px !important;
    color: var(--muted) !important;
  }
  .table-wrap table td:nth-child(3)::after { content: "  ·  "; }
  /* Cacher bouton "Voir" */
  .table-wrap table td:last-child .btn--outline { display: none !important; }
  .table-wrap table td:nth-child(5) { display: none !important; }

  /* ── AGENT STATUS ── */
  .agent-status {
    padding: .85rem 1rem;
    gap: .75rem;
    margin-bottom: 1rem;
  }
  .agent-status__detail { margin-left: 0; }

  /* ── ESCALADES ── */
  .escalade-box { padding: .85rem; }
  .escalade-box__header {
    flex-direction: column;
    align-items: flex-start;
    gap: .75rem;
  }
  .escalade-box__actions {
    flex-direction: column;
    width: 100%;
    gap: .5rem;
  }
  .escalade-box__actions .btn {
    width: 100%;
    justify-content: center;
    padding: .65rem !important;
  }
}

/* ── DETAIL GRID (email, contact, communiqué...) ── */
.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}
.header-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

/* ── INBOX TABLE MOBILE ── */
@media (max-width: 768px) {
  /* Detail grid */
  .detail-grid { grid-template-columns: 1fr; }
  .header-actions { width: 100%; }
  .header-actions .btn { flex: 1; justify-content: center; text-align: center; }

  /* ── PROPOSITIONS ── */
  /* Card proposition : stack vertical */
  .card [style*="grid-template-columns:1fr auto"] {
    display: flex !important;
    flex-direction: column !important;
    gap: .75rem !important;
  }
  /* Boutons actions pleine largeur */
  .card [style*="min-width:130px"] {
    min-width: unset !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
  }
  .card [style*="min-width:130px"] .btn,
  .card [style*="min-width:130px"] form { flex: 1; min-width: calc(50% - .25rem); }
  .card [style*="min-width:130px"] form .btn { width: 100%; }
  .card [style*="min-width:130px"] form:last-child { flex: 0 0 100%; }

  /* Infos 3 colonnes → 1 colonne */
  .card [style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Formulaire validation → 2 colonnes */
  #form-{{ p.id }} [style*="grid-template-columns:1fr 1fr 1fr"],
  [id^="form-"] [style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: 1fr 1fr !important;
  }
  /* Ligne score + boutons → colonne */
  [id^="form-"] [style*="display:flex;align-items:center;gap:1rem"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  [id^="form-"] [style*="flex:0 0 160px"] {
    flex: 1 !important;
  }

  /* ── CONTACTS LIST ── */
  .filters__form {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: .6rem !important;
    align-items: end !important;
  }
  .filters__form > div { width: 100% !important; }
  .filters__form .btn { width: 100% !important; }

  /* Table contacts → cards */
  .contacts-table,
  .contacts-table thead,
  .contacts-table tbody,
  .contacts-table tr,
  .contacts-table td { display: block !important; }
  .contacts-table thead { display: none !important; }
  .contacts-table tbody { display: flex !important; flex-direction: column; }
  .contacts-table tr {
    display: grid !important;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    gap: .15rem .6rem;
    padding: .75rem .5rem !important;
    border-bottom: 1px solid rgba(196,160,85,.1) !important;
    border-top: none !important;
    align-items: center;
  }
  .contacts-table tr:last-child { border-bottom: none !important; }
  /* Score — col 1 ligne 1+2 */
  .contacts-table td:nth-child(1) {
    grid-column: 1; grid-row: 1 / 3;
    font-size: 12px !important;
    padding: 0 !important; border: none !important;
    color: var(--or);
  }
  /* Nom — col 2 ligne 1 */
  .contacts-table td:nth-child(2) {
    grid-column: 2; grid-row: 1;
    padding: 0 !important; border: none !important;
    font-size: 13px !important;
  }
  /* Badge statut — col 3 ligne 1 */
  .contacts-table td:nth-child(7) {
    grid-column: 3; grid-row: 1;
    padding: 0 !important; border: none !important;
  }
  /* Publication — col 2 ligne 2 */
  .contacts-table td:nth-child(4) {
    grid-column: 2; grid-row: 2;
    font-size: 11px !important;
    color: var(--muted) !important;
    padding: 0 !important; border: none !important;
  }
  /* Cacher fonction, spécialité, tel, bouton */
  .contacts-table td:nth-child(3),
  .contacts-table td:nth-child(5),
  .contacts-table td:nth-child(6),
  .contacts-table td:nth-child(8) { display: none !important; }

  /* ── CONTACT DETAIL ── */
  /* Formulaire édition — grilles → 1 col */
  #edit-mode [style*="grid-template-columns:1fr 2fr"],
  #edit-mode [style*="grid-template-columns:1fr 2fr;"] {
    grid-template-columns: 1fr 1fr !important;
  }
  #edit-mode [style*="grid-template-columns:1fr 2fr 1fr"] {
    grid-template-columns: 1fr 1fr 1fr !important;
  }
  /* Score + bouton → colonne */
  .card [style*="display:flex;gap:.5rem;align-items:flex-end"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  /* ── HISTORIQUE EMAILS ── */
  .emails-history-table,
  .emails-history-table thead,
  .emails-history-table tbody,
  .emails-history-table tr,
  .emails-history-table td { display: block !important; }
  .emails-history-table thead { display: none !important; }
  .emails-history-table tbody { display: flex !important; flex-direction: column; }
  .emails-history-table tr {
    display: grid !important;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    gap: .15rem .5rem;
    padding: .7rem .5rem !important;
    border-bottom: 1px solid rgba(196,160,85,.1) !important;
    border-top: none !important;
  }
  .emails-history-table tr:last-child { border-bottom: none !important; }
  .emails-history-table td:nth-child(1) {
    grid-column: 1; grid-row: 1;
    padding: 0 !important; border: none !important;
  }
  .emails-history-table td:nth-child(2) {
    grid-column: 2; grid-row: 1;
    font-size: 12px !important;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    padding: 0 !important; border: none !important;
  }
  .emails-history-table td:nth-child(3) {
    grid-column: 3; grid-row: 1;
    padding: 0 !important; border: none !important;
  }
  .emails-history-table td:nth-child(4) {
    grid-column: 1 / -1; grid-row: 2;
    font-size: 11px !important; color: var(--muted) !important;
    padding: 0 !important; border: none !important;
  }
  .emails-history-table td:nth-child(5) { display: none !important; }

  /* ── JOURNAL TABLE ── */
  .journal-table,
  .journal-table thead,
  .journal-table tbody,
  .journal-table tr,
  .journal-table td { display: block !important; }
  .journal-table thead { display: none !important; }
  .journal-table tbody { display: flex !important; flex-direction: column; }
  .journal-table tr {
    display: grid !important;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: .15rem .5rem;
    padding: .85rem .75rem !important;
    border-bottom: 1px solid rgba(196,160,85,.1) !important;
    border-top: none !important;
    cursor: pointer;
  }
  .journal-table tr:last-child { border-bottom: none !important; }
  /* Date — ligne 1 gauche */
  .journal-table td:nth-child(1) {
    grid-column: 1; grid-row: 1;
    font-size: 12px !important;
    color: var(--muted) !important;
    padding: 0 !important; border: none !important;
  }
  /* Badge type — ligne 1 droite */
  .journal-table td:nth-child(2) {
    grid-column: 2; grid-row: 1;
    padding: 0 !important; border: none !important;
    display: flex !important;
    align-items: center;
  }
  /* Aperçu — ligne 2 pleine largeur */
  .journal-table td:nth-child(3) {
    grid-column: 1 / -1; grid-row: 2;
    font-size: 12px !important;
    color: var(--texte) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 !important; border: none !important;
  }
  /* Coût — caché sur mobile */
  .journal-table td:nth-child(4) { display: none !important; }

  /* Barre de sélection */
  #barre-selection {
    flex-wrap: wrap !important;
    gap: .5rem !important;
  }
  #barre-selection .btn { font-size: 11px !important; padding: .45rem .75rem !important; }

  /* Table inbox → cards */
  .inbox-table,
  .inbox-table thead,
  .inbox-table tbody,
  .inbox-table tr,
  .inbox-table th,
  .inbox-table td { display: block !important; }

  .inbox-table thead { display: none !important; }

  .inbox-table tbody { display: flex !important; flex-direction: column; }

  .inbox-table tr {
    display: grid !important;
    grid-template-columns: 32px 1fr;
    grid-template-rows: auto auto;
    gap: 0 .5rem;
    padding: .75rem .75rem .75rem .5rem !important;
    border-bottom: 1px solid rgba(196,160,85,.1) !important;
    border-top: none !important;
  }
  .inbox-table tr:last-child { border-bottom: none !important; }

  /* Checkbox — colonne gauche, 2 lignes */
  .inbox-table td:nth-child(1) {
    grid-column: 1;
    grid-row: 1 / 3;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
  }

  /* Expéditeur — ligne 1, colonne droite */
  .inbox-table td:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
    font-size: 13px !important;
    font-weight: 500;
    color: var(--noir);
    padding: 0 !important;
    border: none !important;
  }

  /* Sujet — ligne 2, colonne droite */
  .inbox-table td:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
    font-size: 12px !important;
    color: var(--muted) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 1px 0 0 !important;
    border: none !important;
  }

  /* Cacher publication, score, date */
  .inbox-table td:nth-child(4),
  .inbox-table td:nth-child(5),
  .inbox-table td:nth-child(6) { display: none !important; }
}

/* ── TABLETTE ── */
@media (min-width: 769px) and (max-width: 1024px) {
  :root { --sidebar-w: 180px; }
  .sidebar__nav a { font-size: 10px; padding: .45rem 1.1rem; }
  .sidebar__logo { padding: 1.5rem 1.1rem 1.2rem; }
  .sidebar__agent { font-size: 19px; }
  .main-content { padding: 2rem; }
}
