/* ============================================================
   PlexTracker — Design 2026
   Moderne, épuré, dense en information.
   Fichier partagé par index.html / dashboard.html / expenses.html
   ============================================================ */

:root {
  --bg: #0b0e14;
  --bg-gradient: radial-gradient(1200px 600px at 80% -10%, rgba(16,185,129,0.07), transparent 60%),
                 radial-gradient(900px 500px at 0% 110%, rgba(59,130,246,0.06), transparent 60%);
  --card: #12161f;
  --card-hover: #161b27;
  --accent: #10b981;
  --accent-soft: rgba(16,185,129,0.12);
  --accent2: #3b82f6;
  --accent2-soft: rgba(59,130,246,0.12);
  --text: #e6eaf2;
  --muted: #8b93a7;
  --border: #222a3a;
  --border-strong: #2e3850;
  --danger: #f87171;
  --danger-soft: rgba(248,113,113,0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251,191,36,0.12);
  --violet: #a78bfa;
  --sidebar: #0e1219;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.22);
  --shadow-lift: 0 2px 4px rgba(0,0,0,0.3), 0 16px 40px rgba(0,0,0,0.35);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-gradient: radial-gradient(1200px 600px at 80% -10%, rgba(16,185,129,0.08), transparent 60%),
                 radial-gradient(900px 500px at 0% 110%, rgba(59,130,246,0.07), transparent 60%);
  --card: #ffffff;
  --card-hover: #f8fafc;
  --accent: #059669;
  --accent-soft: rgba(5,150,105,0.1);
  --accent2: #2563eb;
  --accent2-soft: rgba(37,99,235,0.1);
  --text: #0f172a;
  --muted: #5b6472;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --danger: #dc2626;
  --danger-soft: rgba(220,38,38,0.08);
  --warn: #d97706;
  --warn-soft: rgba(217,119,6,0.1);
  --violet: #7c3aed;
  --sidebar: #eef1f8;
  --shadow: 0 1px 2px rgba(15,23,42,0.05), 0 8px 24px rgba(15,23,42,0.06);
  --shadow-lift: 0 2px 4px rgba(15,23,42,0.06), 0 16px 40px rgba(15,23,42,0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }

html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 236px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 16px 10px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  transition: width .3s cubic-bezier(.4,0,.2,1), padding .3s cubic-bezier(.4,0,.2,1), border-right-width .3s ease, opacity .25s ease;
  z-index: 50;
}
/* Sidebar repliée : se referme comme un accordéon */
body.sidebar-hidden .sidebar {
  width: 0;
  padding-left: 0;
  padding-right: 0;
  border-right-width: 0;
  opacity: .5;
}
body.sidebar-hidden .main { max-width: 100%; }
body.sidebar-hidden .sidebar-reopen { display: flex; }

/* Le logo/header devient le bouton toggle */
.sidebar-header {
  padding: 4px 10px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  user-select: none;
  transition: background .18s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-header:hover { background: var(--card); }
.sidebar-header h2 {
  font-size: 1.05rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex: 1;
}
.sidebar-header .sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 3px;
  font-weight: 500;
}
.sidebar-toggle-hint {
  font-size: 0.75rem;
  color: var(--muted);
  opacity: .7;
  transition: transform .3s ease, opacity .2s ease;
}
.sidebar-header:hover .sidebar-toggle-hint { opacity: 1; }

/* Bouton flottant pour rouvrir la sidebar quand elle est repliée */
.sidebar-reopen {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 60;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 1.15rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: all .18s ease;
}
.sidebar-reopen:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s ease;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
}
.nav-item:hover {
  color: var(--text);
  background: var(--card);
}
.nav-item.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}
.nav-item.active .icon { transform: scale(1.08); }
.nav-item .icon {
  font-size: 1.05rem;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  transition: transform .18s ease;
}
.nav-item.active .icon {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.sidebar-spacer { flex: 1; }
.sidebar-footer {
  padding: 12px 10px 4px;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ===== Main ===== */
.main {
  flex: 1;
  padding: 28px 36px 48px;
  overflow-y: auto;
  max-height: 100vh;
}
.main h1 {
  font-size: 1.55rem;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.main .subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
  max-width: 720px;
  line-height: 1.5;
}

/* ===== Layout générique ===== */
.grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
/* Empêche les contenus larges (tables) de pousser les colonnes hors écran */
.grid > .card {
  min-width: 0;
}
/* Tableau des annonces : cellules plus compactes */
#listingTable th, #listingTable td { padding: 8px 8px; }
@media(max-width:1100px){ .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.card:hover {
  border-color: var(--border-strong);
}
.card h2 {
  font-size: 1.05rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.card h2 .icon, .card h2 .emoji { font-size: 1.1rem; }

/* ===== Stats / summary ===== */
.summary-stats {
  display: flex;
  gap: 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  min-width: 130px;
  box-shadow: var(--shadow);
  transition: transform .18s ease, border-color .18s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}
.stat-card .stat-num {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.stat-card .stat-label {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.stat-card .stat-num.neg { color: var(--danger); }
.stat-card .stat-num.warn { color: var(--warn); }

/* ===== Tableaux ===== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th:hover { color: var(--text); }
tr { transition: background .12s ease; }
tr:hover { background: var(--card-hover); }
tr:last-child td { border-bottom: none; }
/* Ligne sélectionnée (annonce cliquée) */
#listingTable tbody tr.selected td {
  background: var(--accent-soft);
}
#listingTable tbody tr.selected:hover td { background: var(--accent-soft); }

/* ===== Badges (pill) ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge.duplex { background: rgba(59,130,246,0.14); color: #60a5fa; }
.badge.triplex { background: rgba(251,191,36,0.14); color: #fbbf24; }
.badge.quadruplex { background: rgba(167,139,250,0.14); color: #c4b5fd; }
.badge.quintuplex { background: rgba(16,185,129,0.14); color: #34d399; }
.badge.ville { background: rgba(99,102,241,0.14); color: #a5b4fc; }
.badge.commercial { background: rgba(248,113,113,0.14); color: #fca5a5; }
.badge.mixte { background: rgba(52,211,153,0.14); color: #6ee7b7; }
.badge.entretien { background: rgba(59,130,246,0.14); color: #60a5fa; }
.badge.renovation { background: rgba(251,191,36,0.14); color: #fbbf24; }
.badge.frais { background: rgba(167,139,250,0.14); color: #c4b5fd; }
.badge.service { background: rgba(16,185,129,0.14); color: #34d399; }
.badge.paye { background: var(--accent-soft); color: var(--accent); }
.badge.impaye { background: var(--danger-soft); color: var(--danger); }
.badge.annee { background: rgba(99,102,241,0.14); color: #a5b4fc; }
.badge.status { background: var(--warn-soft); color: var(--warn); }

.ratings { font-size: 0.8rem; }
.stars { color: var(--warn); }

/* ===== Formulaires ===== */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 500;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.86rem;
  font-family: inherit;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px var(--accent2-soft);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media(max-width:600px){ .form-row { grid-template-columns: 1fr; } }

/* ===== Boutons ===== */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.84rem;
  transition: all .18s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #0d9668);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-soft);
}
.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-soft);
}
.btn-secondary {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary:hover {
  background: var(--card-hover);
  border-color: var(--border-strong);
}
.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid transparent;
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}
.btn-sm { padding: 6px 12px; font-size: 0.75rem; border-radius: 8px; }
.btn-edit {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--accent2);
  padding: 5px 10px;
  cursor: pointer;
  border-radius: 8px;
  font-size: 0.8rem;
  transition: all .18s ease;
}
.btn-edit:hover {
  background: var(--accent2);
  color: #fff;
  border-color: var(--accent2);
}

/* ===== Recherche / filtres ===== */
.search-bar {
  width: 100%;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 0.9rem;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: border-color .18s ease, box-shadow .18s ease;
  font-family: inherit;
}
.search-bar:focus {
  outline: none;
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px var(--accent2-soft);
}
.export-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.type-filters { margin-bottom: 16px; }
.filter-header {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.filter-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filter-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.8rem;
}
.filter-checkbox input[type="checkbox"] { margin: 0; accent-color: var(--accent); }
.filter-checkbox .badge { margin: 0; pointer-events: none; }
.filter-checkbox input:not(:checked) + .badge { opacity: 0.3; }

/* ===== Résultats / stats rows ===== */
.results-box {
  margin-top: 16px;
  padding: 18px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.results-box h3 { font-size: 0.88rem; margin-bottom: 12px; font-weight: 600; }
.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.stat-row:last-child { border-bottom: none; }
.stat-row .label { color: var(--muted); }
.stat-row .value { font-weight: 600; }
.stat-row .value.green { color: var(--accent); }
.stat-row .value.red { color: var(--danger); }
.stat-row .value.yellow { color: var(--warn); }

/* ===== Onglets ===== */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tab {
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all .18s ease;
  font-family: inherit;
}
.tab:hover { color: var(--text); border-color: var(--border-strong); }
.tab.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

/* ===== Calculateur ===== */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media(max-width:600px){ .calc-grid { grid-template-columns: 1fr; } }
.calc-section-title {
  font-size: 0.78rem;
  font-weight: 600;
  margin: 14px 0 8px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ===== Comparateur ===== */
.compare-bar {
  position: fixed;
  bottom: 16px;
  left: 252px;
  right: 16px;
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 20px;
  display: none;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  box-shadow: var(--shadow-lift);
}
.compare-bar.visible { display: flex; }
.compare-bar .count { font-size: 0.84rem; color: var(--muted); }
.compare-bar .count strong { color: var(--accent); }
.compare-bar .previews { display: flex; gap: 8px; flex: 1; margin: 0 16px; overflow-x: auto; }
.compare-bar .preview-chip {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.compare-bar .preview-chip .remove {
  cursor: pointer;
  color: var(--danger);
  font-weight: bold;
  font-size: 1rem;
  line-height: 1;
}
.compare-bar .preview-chip .remove:hover { opacity: 0.7; }
.compare-bar-padding { display: block; height: 0; transition: height .2s; }
.compare-bar-padding.visible { height: 72px; }

.compare-panel { display: none; }
.compare-panel.visible { display: block; }
.compare-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.compare-header h2 { font-size: 1.1rem; margin: 0; }
.compare-grid {
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.compare-row {
  display: grid;
  gap: 1px;
  background: var(--border);
}
.compare-row > div {
  padding: 9px 12px;
  background: var(--card);
  font-size: 0.82rem;
}
.compare-row .label {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.compare-row .val { font-weight: 600; }
.compare-row .val.green { color: var(--accent); }
.compare-row .val.red { color: var(--danger); }
.compare-row .val.yellow { color: var(--warn); }
.compare-row .addr { font-size: 0.78rem; }
.compare-row .city { color: var(--muted); font-size: 0.75rem; }
.compare-row.best > div:not(.label) { background: var(--accent-soft); }
.compare-row.worst > div:not(.label) { background: var(--danger-soft); }
.compare-section { margin-bottom: 20px; }
.compare-section h3 {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.compare-summary { display: grid; gap: 10px; margin-bottom: 16px; }
.compare-summary .cs-row { display: grid; gap: 1px; background: var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.compare-summary .cs-row > div { background: var(--card); padding: 12px 14px; font-size: 0.82rem; display: flex; flex-direction: column; align-items: center; text-align: center; }
.compare-summary .cs-row > div .cs-label { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.compare-summary .cs-row > div .cs-value { font-size: 1.1rem; font-weight: 700; }
.compare-summary .cs-row > div .cs-sub { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }
.compare-score {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
}
.compare-score.high { background: var(--accent-soft); color: var(--accent); }
.compare-score.mid { background: var(--warn-soft); color: var(--warn); }
.compare-score.low { background: var(--danger-soft); color: var(--danger); }
.compare-assumptions {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.compare-assumptions h4 { font-size: 0.82rem; margin-bottom: 10px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.compare-assumptions .cass-row { display: flex; gap: 12px; flex-wrap: wrap; }
.compare-assumptions .cass-row .form-group { flex: 1; min-width: 100px; }
.compare-assumptions .cass-row .form-group label { font-size: 0.7rem; }
.compare-assumptions .cass-row .form-group input { font-size: 0.8rem; padding: 7px 9px; }

.compare-scores { display: grid; gap: 12px; margin-bottom: 16px; }
.compare-scores .cs-row { display: grid; gap: 1px; background: var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.compare-scores .cs-row > div { background: var(--card); padding: 12px 14px; font-size: 0.82rem; display: flex; flex-direction: column; align-items: center; text-align: center; }
.compare-scores .cs-row > div .cs-label { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.compare-scores .cs-row > div .cs-value { font-size: 1.1rem; font-weight: 700; }
.compare-score-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1.05rem;
}
.compare-score-badge.high { background: var(--accent-soft); color: var(--accent); }
.compare-score-badge.mid { background: var(--warn-soft); color: var(--warn); }
.compare-score-badge.low { background: var(--danger-soft); color: var(--danger); }

.cmp-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; margin-bottom: 20px; }
.cmp-table th, .cmp-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.cmp-table thead th {
  background: var(--card);
  font-weight: 600;
  font-size: 0.84rem;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 2px solid var(--accent);
  padding: 10px;
}
.cmp-table thead th .sub { font-weight: 400; font-size: 0.7rem; color: var(--muted); margin-top: 2px; }
.cmp-table tr.section-header td {
  background: var(--card);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--accent);
}
.cmp-table tr:nth-child(even):not(.section-header) td { background: rgba(255,255,255,0.015); }
.cmp-table .best { color: var(--accent); font-weight: 600; }
.cmp-table .worst { color: var(--danger); }
.cmp-table .positive { color: var(--accent); font-weight: 600; }
.cmp-table .negative { color: var(--danger); font-weight: 600; }
.cmp-table td:first-child { color: var(--muted); font-weight: 500; white-space: nowrap; width: 150px; }
.cmp-table .prop-name { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; font-weight: 600; color: var(--text); }
.cmp-table .prop-type { font-size: 0.7rem; color: var(--muted); }

/* ===== Dashboard : profil propriété ===== */
.profile-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 700px) { .profile-grid { grid-template-columns: 1fr; } }

.photo-container {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px dashed var(--border);
  background: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .3s ease;
}
.photo-container:hover {
  border-color: var(--accent2);
  background: var(--accent2-soft);
}
.photo-container img { width: 100%; height: 100%; object-fit: cover; }
.photo-container .placeholder { text-align: center; color: var(--muted); padding: 20px; }
.photo-container .placeholder .big-icon { font-size: 3rem; margin-bottom: 8px; }
.photo-container .placeholder .text { font-size: 0.76rem; }
.photo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .3s;
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
}
.photo-container:hover .photo-overlay { opacity: 1; }
.photo-container .edit-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--accent2);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity .3s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.photo-container:hover .edit-badge { opacity: 1; }
#photoInput { display: none; }

.profile-info { display: flex; flex-direction: column; gap: 12px; }
.profile-info .name { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }
.profile-info .address { font-size: 0.92rem; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.profile-info .tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0; }
.profile-info .tag {
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}
.tag.type { background: var(--accent-soft); color: var(--accent); }
.tag.ville { background: var(--accent2-soft); color: var(--accent2); }
.tag.status { background: var(--warn-soft); color: var(--warn); }
.tag.portes { background: rgba(167,139,250,0.15); color: var(--violet); }
.profile-actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

/* ===== Métriques ===== */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.metric-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: all .2s ease;
  position: relative;
  overflow: hidden;
}
.metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
  opacity: 0;
  transition: opacity .2s ease;
}
.metric-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}
.metric-card:hover::before { opacity: 1; }
.metric-card .metric-icon { font-size: 1.2rem; margin-bottom: 8px; }
.metric-card .metric-label {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.metric-card .metric-value {
  font-size: 1.45rem;
  font-weight: 700;
  margin: 5px 0 2px;
  letter-spacing: -0.02em;
}
.metric-card .metric-sub { font-size: 0.72rem; color: var(--muted); }
.metric-card .positive { color: var(--accent); }
.metric-card .negative { color: var(--danger); }
.metric-card .warn { color: var(--warn); }

/* ===== Sections ===== */
.section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 900px) { .section-grid { grid-template-columns: 1fr; } }

.inline-edit {
  cursor: pointer;
  border-bottom: 1px dashed var(--border);
  transition: border-color .2s;
}
.inline-edit:hover { border-color: var(--accent2); }

.status-indicator { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.green { background: var(--accent); box-shadow: 0 0 8px var(--accent-soft); }
.status-dot.yellow { background: var(--warn); }
.status-dot.red { background: var(--danger); }

.status-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.8rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.status-bar .divider { width: 1px; height: 24px; background: var(--border); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 22px;
  font-size: 0.85rem;
  color: var(--accent);
  box-shadow: var(--shadow-lift);
  display: none;
  z-index: 1000;
  animation: fadeIn .3s;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Modales ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  animation: fadeIn .2s;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  width: 90%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lift);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal h2 {
  font-size: 1.05rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}
.modal-close:hover { background: var(--danger-soft); color: var(--danger); }
.modal-body { padding: 18px 22px; }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
}
.modal-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }
.modal-actions .btn { min-width: 100px; }

/* ===== Actions rapides ===== */
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .2s ease;
  color: var(--text);
  font-size: 0.76rem;
  font-family: inherit;
}
.action-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}
.action-btn .icon { font-size: 1.4rem; }

/* ===== Locataires ===== */
.locataire-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.locataire-item:last-child { border-bottom: none; }
.locataire-item .avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent2-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.locataire-item .info { flex: 1; }
.locataire-item .name { font-weight: 600; }
.locataire-item .detail { font-size: 0.78rem; color: var(--muted); }
.locataire-item .status-badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
}
.badge-ok { background: var(--accent-soft); color: var(--accent); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

/* ===== États vides ===== */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state .big { font-size: 2.5rem; margin-bottom: 12px; }

/* ===== Divers ===== */
.muted { color: var(--muted); }
.positive { color: var(--accent); }
.negative { color: var(--danger); }
.green { color: var(--accent); }
.red { color: var(--danger); }
.yellow { color: var(--warn); }

/* Tableau de projection (calculateur) */
.proj-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem !important;
  margin: 8px 0 4px;
}
.proj-table thead th {
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  padding: 7px 7px;
  border-bottom: 1px solid var(--border-strong);
  text-align: right;
  white-space: nowrap;
}
.proj-table thead th:first-child,
.proj-table tbody td:first-child { text-align: left; }
.proj-table thead th.sub {
  font-size: 0.55rem;
  color: var(--muted);
  font-weight: 400;
  padding-top: 2px;
  border-bottom: none;
}
.proj-table tbody td {
  padding: 5px 7px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.proj-table tbody tr:hover { background: var(--card-hover); }
.proj-table tbody tr.row-debut td {
  color: var(--muted);
  font-style: italic;
}
.proj-table tbody tr.row-last td {
  background: var(--accent-soft);
  border-bottom: 2px solid var(--accent);
  font-weight: 600;
}
.proj-table tbody tr.row-total td {
  background: var(--card);
  border-top: 2px solid var(--accent);
  font-weight: 700;
}
.proj-table .pos { color: var(--accent); }
.proj-table .neg { color: var(--danger); }

/* Cartes KPI du calculateur */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.kpi-card {
  padding: 14px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  box-shadow: var(--shadow);
  transition: all .18s ease;
}
.kpi-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.kpi-card .kpi-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 6px;
}
.kpi-card .kpi-value {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.kpi-card .kpi-sub {
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 3px;
}
.kpi-card.kpi-accent { border-color: var(--accent); background: var(--accent-soft); }

/* Section dépenses année 1 (barres) */
.expense-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  font-size: 0.8rem;
}
.expense-bar-row .bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.expense-bar-row .bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
}
.expense-bar-row .exp-label { width: 110px; flex-shrink: 0; }
.expense-bar-row .exp-val { width: 90px; text-align: right; font-weight: 600; }

/* Badges R (réel) / ~E (estimé) — mode Estimation */
.est-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
  background: var(--border-strong);
  color: var(--muted);
  letter-spacing: .3px;
}
.est-badge.est {
  background: rgba(245, 158, 11, .15);
  color: var(--warn);
}
.est-legend { color: var(--warn); }

/* Badges calculateur v2 — R (vert, réel Centris) / ~E (jaune, estimé) / M (bleu, modifié) / ! (rouge, manquant) */
.calc-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
  letter-spacing: .3px;
}
.b-r { background: rgba(52, 211, 153, .15); color: #34d399; }
.b-e { background: rgba(251, 191, 36, .15); color: #fbbf24; }
.b-m { background: rgba(96, 165, 250, .15); color: #60a5fa; }
.b-x { background: rgba(248, 113, 113, .15); color: #f87171; }

/* Switch estimateur — style 2026 du site (gradient + glow comme .btn-primary) */
.switch-wrap { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; margin: 0; font-size: 13px; user-select: none; }
.switch-name { font-weight: 600; color: var(--text); display: inline-flex; align-items: center; gap: 5px; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-slider {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border-strong);
  transition: background .25s ease, border-color .25s ease, box-shadow .25s ease;
  cursor: pointer;
}
.switch-slider:before {
  content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--muted);
  transition: transform .25s cubic-bezier(.4,1.4,.6,1), background .25s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.45);
}
.switch input:checked + .switch-slider {
  background: linear-gradient(135deg, var(--accent), #0d9668);
  border-color: transparent;
  box-shadow: 0 2px 12px var(--accent-soft);
}
.switch input:checked + .switch-slider:before {
  transform: translateX(20px);
  background: #fff;
}
.switch-state { font-weight: 700; font-size: 11px; letter-spacing: .6px; }
.switch-state.on { color: var(--accent); }
.switch-state.off { color: var(--muted); }

/* Bordures lumineuses des champs selon leur situation (mode annonce) */
input.box-r, select.box-r {
  border-color: #34d399 !important;
  background: rgba(52,211,153,.07) !important;
  box-shadow: 0 0 0 1px rgba(52,211,153,.4), 0 0 14px rgba(52,211,153,.35) !important;
}
input.box-e, select.box-e {
  border-color: #fbbf24 !important;
  background: rgba(251,191,36,.07) !important;
  box-shadow: 0 0 0 1px rgba(251,191,36,.4), 0 0 14px rgba(251,191,36,.3) !important;
}
input.box-m, select.box-m {
  border-color: #60a5fa !important;
  background: rgba(96,165,250,.07) !important;
  box-shadow: 0 0 0 1px rgba(96,165,250,.4), 0 0 14px rgba(96,165,250,.35) !important;
}
input.box-x, select.box-x {
  border-color: #f87171 !important;
  background: rgba(248,113,113,.08) !important;
  box-shadow: 0 0 0 1px rgba(248,113,113,.5), 0 0 16px rgba(248,113,113,.55) !important;
}
.expense-bar-row .exp-pct { width: 44px; text-align: right; color: var(--muted); font-size: 0.72rem; }

/* Section titres dans les résultats */
.results-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 18px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.results-section-title:first-child { margin-top: 0; }

/* Tableau année 1 (revenus/dépenses) */
.y1-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.y1-table th {
  color: var(--muted);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 5px 8px;
  text-align: right;
  font-weight: 600;
}
.y1-table th:first-child, .y1-table td:first-child { text-align: left; }
.y1-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); text-align: right; font-variant-numeric: tabular-nums; }
.y1-table tr.row-nofinal td { border-bottom: none; }
.y1-table tr.row-income td { color: var(--accent); font-weight: 600; border-bottom: 1px solid var(--border-strong); }
.y1-table tr.row-neg td { color: var(--muted); }
.y1-table tr.row-total-dep td { font-weight: 700; border-top: 1px solid var(--border-strong); }
.y1-table tr.row-noi td { font-weight: 600; border-bottom: 1px solid var(--border-strong); }
.y1-table tr.row-cf td { font-weight: 700; border-top: 2px solid var(--accent); background: var(--accent-soft); }
.mini-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.72rem;
  color: var(--muted);
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.mini-stat strong { color: var(--text); font-size: 0.8rem; }

/* Légende des couleurs dans les résultats */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.72rem; color: var(--muted); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ===== Vue Année 1 : 3 graphiques sous onglets ===== */
.y1-viewer {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px;
  margin-top: 10px;
}
.y1-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--card);
  border-radius: 9px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.y1-tab {
  flex: 1;
  min-width: 90px;
  padding: 7px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s ease;
  font-family: inherit;
  white-space: nowrap;
}
.y1-tab:hover { color: var(--text); background: var(--card-hover); }
.y1-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.y1-pane { display: none; padding: 8px 6px 4px; }
.y1-pane.active { display: block; }
.y1-pane .expense-bar-row:first-child { margin-top: 0; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ===== Responsive ===== */
/* ---- Table des annonces en cartes (mobile) ---- */
@media(max-width:768px) {
  /* Le thead devient une rangée de chips de tri scrollable */
  #tableHead tr {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  #tableHead tr::-webkit-scrollbar { display: none; }
  #tableHead th {
    border: none;
    background: var(--card-hover);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.72rem;
    white-space: nowrap;
    flex-shrink: 0;
    text-transform: none;
    letter-spacing: 0;
  }
  /* Cacher les colonnes non-triables du header */
  #tableHead th:first-child,
  #tableHead th:nth-child(2),
  #tableHead th:nth-child(12),
  #tableHead th:nth-child(13),
  #tableHead th:nth-child(14) { display: none; }

  /* Sortir la table du modèle table → largeur fluide */
  #listingTable { display: block; width: 100%; }
  #listingTable thead, #listingTable tbody { display: block; width: 100%; }

  /* Chaque ligne devient une carte */
  #listingTable tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    gap: 6px 8px;
  }
  #listingTable tbody tr:hover { background: var(--card); }
  #listingTable tbody tr.selected { background: var(--accent-soft); border-color: var(--accent); }
  #listingTable tbody tr.selected td { background: transparent; }
  #listingTable tbody tr.selected:hover td { background: transparent; }
  #listingTable tbody td {
    border-bottom: none;
    padding: 2px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    min-width: 0;
  }
  /* Label au-dessus de la valeur (attribut data-label) */
  #listingTable tbody td::before {
    content: attr(data-label);
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    min-width: 64px;
  }
  /* Checkbox comparer : tout à gauche */
  #listingTable tbody td:first-child {
    order: -2;
    margin-right: auto;
    width: 32px;
  }
  #listingTable tbody td:first-child::before { content: none; }
  /* Étoile favori : tout à droite */
  #listingTable tbody td:nth-child(2) {
    order: -1;
    margin-left: auto;
    font-size: 1.1rem;
  }
  #listingTable tbody td:nth-child(2)::before { content: none; }
  /* Type : badge sans label */
  #listingTable tbody td:nth-child(3)::before { content: none; }
  /* Adresse en vedette */
  #listingTable tbody td:nth-child(4) {
    width: 100%;
    font-size: 1.02rem;
    font-weight: 600;
    color: var(--text);
  }
  #listingTable tbody td:nth-child(4)::before { content: none; }
  /* Ville */
  #listingTable tbody td:nth-child(5) { width: 100%; color: var(--muted); font-size: 0.85rem; }
  #listingTable tbody td:nth-child(5)::before { content: none; }
  /* Prix en gros */
  #listingTable tbody td:nth-child(8) {
    width: 100%;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
    margin-top: 2px;
  }
  #listingTable tbody td:nth-child(8)::before { content: none; }
  /* Portes / Const. / Ratio sur une ligne */
  #listingTable tbody td:nth-child(6),
  #listingTable tbody td:nth-child(7),
  #listingTable tbody td:nth-child(10) {
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--bg);
    border-radius: 10px;
    padding: 8px 10px;
  }
  #listingTable tbody td:nth-child(6)::before,
  #listingTable tbody td:nth-child(7)::before,
  #listingTable tbody td:nth-child(10)::before {
    min-width: 0;
    margin-bottom: 2px;
  }
  #listingTable tbody td:nth-child(6) { order: 1; }
  #listingTable tbody td:nth-child(7) { order: 2; }
  #listingTable tbody td:nth-child(10) { order: 3; }
  /* Revenus/an pleine largeur */
  #listingTable tbody td:nth-child(9) { width: 100%; margin-top: 2px; order: 4; }
  /* Données / Historique / Lien : icônes en bas, sans label */
  #listingTable tbody td:nth-child(11),
  #listingTable tbody td:nth-child(12),
  #listingTable tbody td:nth-child(13) {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    order: 5;
  }
  #listingTable tbody td:nth-child(11)::before,
  #listingTable tbody td:nth-child(12)::before,
  #listingTable tbody td:nth-child(13)::before { content: none; }
  #listingTable tbody td:nth-child(11) { margin-right: auto; }
  /* Message "Aucune annonce" */
  #listingTable tbody td[colspan] { justify-content: center; }
  #listingTable tbody td[colspan]::before { content: none; }
}

@media(max-width:700px) {
  .main { padding: 16px; }
  .sidebar { width: 64px; padding: 16px 6px; }
  .sidebar .nav-text, .sidebar-header .sub, .sidebar-footer { display: none; }
  .sidebar-header { padding: 4px 4px 12px; }
  .sidebar-header h2 { font-size: 0.9rem; justify-content: center; }
  .nav-item { justify-content: center; padding: 10px 4px; }
  .nav-item .icon { width: 32px; height: 32px; }
  .compare-bar { left: 76px; padding: 10px 14px; flex-wrap: wrap; }
  .compare-bar .previews { order: 3; width: 100%; margin: 8px 0 0; }
  .cmp-table { font-size: 0.75rem; }
  .cmp-table th, .cmp-table td { padding: 5px 6px; }
  .cmp-table td:first-child { width: 90px; }
  .stats-cards { grid-template-columns: 1fr 1fr; }
}

/* ===== Drawer mobile (sidebar coulissante) ===== */
/* Overlay caché par défaut — visible seulement en mobile quand le drawer est ouvert */
.sidebar-overlay {
  display: none;
}
@media(max-width:768px) {
  /* Overlay sombre derrière le drawer */
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(2px);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
  }
  body.drawer-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  /* La sidebar devient un drawer fixe, caché par défaut */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    width: 280px;
    max-width: 85vw;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-lg, 0 8px 30px rgba(0,0,0,.35));
    padding: 16px 10px;
    border-right: 1px solid var(--border);
    opacity: 1;
    overflow-y: auto;
  }
  body.drawer-open .sidebar { transform: translateX(0); }
  /* Ignorer l'état replié desktop dans le drawer */
  body.sidebar-hidden .sidebar {
    width: 280px;
    max-width: 85vw;
    padding: 16px 10px;
    border-right-width: 1px;
    opacity: 1;
  }
  body.sidebar-hidden.drawer-open .sidebar { transform: translateX(0); }

  /* Le bouton hamburger est TOUJOURS visible sur mobile */
  .sidebar-reopen {
    display: flex;
    top: 12px;
    left: 12px;
    width: 44px;
    height: 44px;
  }
  body.drawer-open .sidebar-reopen { display: none; }

  /* Navigation : plein format dans le drawer */
  .sidebar .nav-text, .sidebar-header .sub { display: block; }
  .sidebar-header h2 { font-size: 1.05rem; justify-content: flex-start; }
  .nav-item { justify-content: flex-start; padding: 12px 14px; }
  .nav-item .icon { width: 32px; height: 32px; font-size: 1.1rem; }
  .sidebar-footer { display: block; padding: 12px 10px 4px; }

  /* Le contenu prend toute la largeur (sidebar hors flux) */
  .main { max-width: 100%; padding-top: 68px; }
}

/* ===== Phase 3 : tableaux internes du calculateur en mobile ===== */
@media(max-width:768px) {
  /* KPI : 2 colonnes compactes */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .kpi-card { padding: 10px 8px; }
  .kpi-card .kpi-value { font-size: 1.05rem; }

  /* Onglets Année 1 : scroll horizontal fluide au lieu de wrap */
  .y1-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 6px;
  }
  .y1-tabs::-webkit-scrollbar { display: none; }
  .y1-tab { flex: 0 0 auto; min-width: 92px; }

  /* Tables : scroll horizontal fluide + première colonne sticky */
  .proj-table, .y1-table {
    font-size: 0.68rem !important;
  }
  .proj-table thead th { font-size: 0.52rem !important; padding: 4px 5px; }
  .proj-table tbody td { padding: 3px 5px; }
  /* Sticky colonne Année/Poste pour garder le contexte en scrollant */
  .proj-table thead th:first-child,
  .proj-table tbody td:first-child {
    position: sticky;
    left: 0;
    background: var(--card);
    z-index: 1;
    box-shadow: 2px 0 4px rgba(0,0,0,0.08);
  }
  .proj-table tbody tr:hover td:first-child { background: var(--card-hover); }
  .y1-table thead th:first-child,
  .y1-table tbody td:first-child {
    position: sticky;
    left: 0;
    background: var(--card);
    z-index: 1;
    box-shadow: 2px 0 4px rgba(0,0,0,0.08);
  }
  .y1-table tbody tr:hover td:first-child { background: var(--card-hover); }
  /* Fond des lignes spéciales (début/total) pour la colonne sticky — garder le fond card, pas inherit */
  .proj-table tbody tr.row-debut td:first-child,
  .proj-table tbody tr.row-total td:first-child { background: var(--card); }
  .proj-table tbody tr.row-last td:first-child { background: var(--accent-soft); }

  /* Indicateur de scroll horizontal : scrollbar fine visible */
  .y1-viewer { position: relative; }
  .y1-viewer > div { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

  /* Barres de dépenses : labels raccourcis */
  .expense-bar-row { font-size: 0.72rem; }
  .expense-bar-row .exp-label { width: 92px; }
  .expense-bar-row .exp-val { width: 78px; }
  .expense-bar-row .exp-pct { width: 38px; font-size: 0.65rem; }

  /* Mini-stats : flexibles */
  .mini-stat { font-size: 0.68rem; padding: 5px 8px; gap: 4px; }
  .mini-stat strong { font-size: 0.75rem; }

  /* Légende : plus compacte */
  .legend { gap: 8px; font-size: 0.68rem; }
}

/* ===== Phase 4 : polish tactile mobile ===== */
@media(max-width:768px) {
  /* Boutons : zone tactile ≥ 44px */
  .btn { min-height: 44px; padding: 12px 18px; font-size: 0.9rem; }
  .btn-sm { min-height: 44px; padding: 10px 14px; font-size: 0.8rem; }
  .btn-edit { min-height: 44px; padding: 10px 14px; }
  .btn-close { min-height: 44px; min-width: 44px; }

  /* Onglets Année 1 : zone tactile */
  .y1-tab { min-height: 42px; padding: 10px 12px; font-size: 0.8rem; }

  /* Inputs : padding généreux pour le pouce */
  .form-group input, .form-group select, .form-group textarea {
    padding: 12px 14px;
    font-size: 16px; /* ≥16px empêche le zoom iOS automatique au focus */
  }
  .compare-assumptions .cass-row .form-group input { font-size: 16px; padding: 10px 12px; }

  /* Checkbox / radio : plus grandes */
  input[type="checkbox"], input[type="radio"] {
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
  }
  .filter-checkbox { padding: 6px 0; }
  .filter-checkbox input[type="checkbox"] { width: 20px; height: 20px; }

  /* Modale : bottom sheet pleine largeur */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    margin: 0;
  }
  .modal-header { padding: 16px 18px; }
  .modal-body { padding: 16px 18px; }
  .modal-footer { padding: 14px 18px; }
  .modal-close { width: 40px; height: 40px; }
  .modal-actions { gap: 10px; }
  .modal-actions .btn { min-width: 0; flex: 1; justify-content: center; }

  /* Boutons de formulaire : pleine largeur sur mobile */
  .form-actions { flex-direction: column; gap: 10px; }
  .form-actions .btn { width: 100%; justify-content: center; }
}

@media(max-width:768px) {
  /* Comparateur : sticky colonne critère + compact */
  .cmp-table { font-size: 0.72rem; }
  .cmp-table th, .cmp-table td { padding: 6px 7px; }
  .cmp-table td:first-child {
    position: sticky;
    left: 0;
    background: var(--card);
    z-index: 1;
    width: 110px;
    min-width: 110px;
    box-shadow: 2px 0 4px rgba(0,0,0,0.08);
  }
  .cmp-table thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 3;
    background: var(--card);
  }
  .cmp-table tr:nth-child(even):not(.section-header) td:first-child { background: var(--card); }
  .cmp-table tr.section-header td:first-child { background: var(--card); }
}

/* ===== Comparateur amélioré : podium + graphiques ===== */
.compare-podium {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, var(--accent-soft), transparent 60%);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 16px;
}
.podium-icon { font-size: 1.8rem; }
.podium-text { font-size: 0.92rem; line-height: 1.5; }
.podium-text strong { font-size: 1.05rem; }
.podium-score {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  margin-left: 4px;
}
.podium-sub { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }

.compare-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
.chart-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.chart-block h4 { font-size: 0.82rem; margin: 0 0 12px; display: flex; align-items: center; gap: 6px; }

/* Barres comparatives */
.cmp-bar-row { margin-bottom: 12px; }
.cmp-bar-label { font-size: 0.7rem; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.cmp-bar-item { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.cmp-bar-fill {
  height: 12px;
  border-radius: 999px;
  min-width: 4px;
  transition: width .4s ease;
}
.cmp-bar-val { font-size: 0.68rem; color: var(--muted); white-space: nowrap; min-width: 70px; text-align: right; }

/* Radar */
.cmp-radar { display: block; margin: 0 auto; width: 100%; max-width: 260px; }
.radar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 10px;
  justify-content: center;
}
.radar-legend span { display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; color: var(--muted); }
.radar-legend .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

.rank-badge { font-size: 0.95rem; }

@media(max-width:768px) {
  .compare-charts { grid-template-columns: 1fr; }
  .compare-podium { padding: 12px 14px; }
  .podium-icon { font-size: 1.5rem; }
}

/* Légende radar enrichie (valeurs réelles) */
.radar-legend .legend-item {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 9px;
}
.radar-legend .legend-head {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  color: var(--text);
}
.radar-legend .legend-vals {
  font-size: 0.64rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Note d'échelle du radar */
.radar-scale {
  margin-top: 8px;
  font-size: 0.64rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
}

/* ===== Comparateur étapes 3-4 : breakdown score + alerte + lien ===== */
.compare-scores .cs-breakdown { margin-top: 0; border-radius: 0; }
.compare-scores .cs-breakdown .cs-cell-label {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
}
.compare-scores .cs-breakdown .cs-max { font-weight: 400; opacity: .6; }
.compare-scores .cs-breakdown .cs-cell {
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  flex-wrap: wrap;
}
.cs-bar {
  flex: 1 1 60px;
  min-width: 40px;
  height: 7px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  display: inline-block;
}
.cs-bar-fill { display: block; height: 100%; border-radius: 999px; }
.cs-pts { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cs-val { color: var(--muted); font-size: 0.66rem; white-space: nowrap; }

.compare-warn {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--warn-soft);
  border: 1px solid var(--warn);
  color: var(--warn);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.8rem;
}
.cw-item { background: var(--card); border-radius: 999px; padding: 2px 10px; font-size: 0.72rem; }

.cmp-link {
  font-size: 0.85rem;
  text-decoration: none;
  opacity: .8;
  transition: opacity .2s;
}
.cmp-link:hover { opacity: 1; }

@media(max-width:768px) {
  .compare-scores .cs-breakdown .cs-cell-label { font-size: 0.64rem; padding: 5px 8px; }
  .compare-scores .cs-breakdown .cs-cell { padding: 5px 8px; font-size: 0.66rem; gap: 4px; }
  .cs-bar { min-width: 30px; }
  .compare-warn { font-size: 0.72rem; padding: 8px 10px; }
}

/* ===== Table des annonces : responsive (14 colonnes, les CAPS restent toujours visibles) ===== */
@media(min-width:769px) {
  #listingTable { table-layout: fixed; }
  #listingTable th, #listingTable td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #listingTable th:nth-child(1) { width: 28px; }
  #listingTable th:nth-child(2) { width: 34px; }
  #listingTable th:nth-child(3) { width: 82px; }
  #listingTable th:nth-child(5) { width: 86px; }
  #listingTable th:nth-child(6) { width: 46px; }
  #listingTable th:nth-child(7) { width: 56px; }
  #listingTable th:nth-child(8) { width: 86px; }
  #listingTable th:nth-child(9) { width: 92px; }
  #listingTable th:nth-child(10) { width: 58px; }
  #listingTable th:nth-child(11) { width: 58px; }
  #listingTable th:nth-child(12) { width: 36px; }
  #listingTable th:nth-child(13) { width: 36px; }
  #listingTable th:nth-child(14) { width: 36px; }
  #listingTable { font-size: 0.74rem; }
  #listingTable th, #listingTable td { padding: 5px 7px; }
  #listingTable th { font-size: 0.58rem; }
  #listingTable td:nth-child(3) .badge { padding: 2px 7px; font-size: 0.66rem; }
  #listingTable td:nth-child(1) input { width: 14px; height: 14px; }
}
/* ≥1400px : côte à côte 1.3fr 1fr — masque Const. + Données, les CAPS restent */
@media(min-width:1400px) {
  .grid { grid-template-columns: 1.3fr 1fr; }
  #tableHead th:nth-child(7),
  #tableBody td:nth-child(7),
  #tableHead th:nth-child(12),
  #tableBody td:nth-child(12) { display: none; }
}
/* 1250-1399px : masque Ville + Const. + Données + Hist + Lien (les CAPS restent) */
@media(max-width:1399px) and (min-width:1250px) {
  .grid { grid-template-columns: 1.15fr 1fr; }
  #listingTable { font-size: 0.7rem; }
  #listingTable th, #listingTable td { padding: 4px 6px; }
  #tableHead th:nth-child(5),
  #tableBody td:nth-child(5),
  #tableHead th:nth-child(7),
  #tableBody td:nth-child(7),
  #tableHead th:nth-child(12),
  #tableBody td:nth-child(12),
  #tableHead th:nth-child(13),
  #tableBody td:nth-child(13),
  #tableHead th:nth-child(14),
  #tableBody td:nth-child(14) { display: none; }
}
/* 1101-1249px : empilé (1 colonne), table pleine largeur — tout visible */
@media(max-width:1249px) and (min-width:1101px) {
  .grid { grid-template-columns: 1fr; }
}
/* ≤1100px (empilé) : masque Données + Hist + Lien (les CAPS restent) */
@media(max-width:1100px) and (min-width:769px) {
  #tableHead th:nth-child(12),
  #tableBody td:nth-child(12),
  #tableHead th:nth-child(13),
  #tableBody td:nth-child(13),
  #tableHead th:nth-child(14),
  #tableBody td:nth-child(14) { display: none; }
}
/* ≤950px : masque Const. + Portes */
@media(max-width:950px) and (min-width:769px) {
  #tableHead th:nth-child(6),
  #tableBody td:nth-child(6),
  #tableHead th:nth-child(7),
  #tableBody td:nth-child(7) { display: none; }
}
/* ≤850px : masque Ville */
@media(max-width:850px) and (min-width:769px) {
  #tableHead th:nth-child(5),
  #tableBody td:nth-child(5) { display: none; }
}

/* ===== Comparateur étapes 3-4 : breakdown score + alerte + lien ===== */
.compare-scores .cs-breakdown { margin-top: 0; border-radius: 0; }
.compare-scores .cs-breakdown .cs-cell-label {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
}
.compare-scores .cs-breakdown .cs-max { font-weight: 400; opacity: .6; }
.compare-scores .cs-breakdown .cs-cell {
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  flex-wrap: wrap;
}
.cs-bar {
  flex: 1 1 60px;
  min-width: 40px;
  height: 7px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  display: inline-block;
}
.cs-bar-fill { display: block; height: 100%; border-radius: 999px; }
.cs-pts { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cs-val { color: var(--muted); font-size: 0.66rem; white-space: nowrap; }

.compare-warn {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--warn-soft);
  border: 1px solid var(--warn);
  color: var(--warn);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.8rem;
}
.cw-item { background: var(--card); border-radius: 999px; padding: 2px 10px; font-size: 0.72rem; }

.cmp-link {
  font-size: 0.85rem;
  text-decoration: none;
  opacity: .8;
  transition: opacity .2s;
}
.cmp-link:hover { opacity: 1; }

@media(max-width:768px) {
  .compare-scores .cs-breakdown .cs-cell-label { font-size: 0.64rem; padding: 5px 8px; }
  .compare-scores .cs-breakdown .cs-cell { padding: 5px 8px; font-size: 0.66rem; gap: 4px; }
  .cs-bar { min-width: 30px; }
  .compare-warn { font-size: 0.72rem; padding: 8px 10px; }
}

/* ===== Table des annonces : zéro scroll horizontal desktop ===== */
/* ===== Comparateur étapes 3-4 : breakdown score + alerte + lien ===== */
.compare-scores .cs-breakdown { margin-top: 0; border-radius: 0; }
.compare-scores .cs-breakdown .cs-cell-label {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
}
.compare-scores .cs-breakdown .cs-max { font-weight: 400; opacity: .6; }
.compare-scores .cs-breakdown .cs-cell {
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  flex-wrap: wrap;
}
.cs-bar {
  flex: 1 1 60px;
  min-width: 40px;
  height: 7px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  display: inline-block;
}
.cs-bar-fill { display: block; height: 100%; border-radius: 999px; }
.cs-pts { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cs-val { color: var(--muted); font-size: 0.66rem; white-space: nowrap; }

.compare-warn {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--warn-soft);
  border: 1px solid var(--warn);
  color: var(--warn);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.8rem;
}
.cw-item { background: var(--card); border-radius: 999px; padding: 2px 10px; font-size: 0.72rem; }

.cmp-link {
  font-size: 0.85rem;
  text-decoration: none;
  opacity: .8;
  transition: opacity .2s;
}
.cmp-link:hover { opacity: 1; }

@media(max-width:768px) {
  .compare-scores .cs-breakdown .cs-cell-label { font-size: 0.64rem; padding: 5px 8px; }
  .compare-scores .cs-breakdown .cs-cell { padding: 5px 8px; font-size: 0.66rem; gap: 4px; }
  .cs-bar { min-width: 30px; }
  .compare-warn { font-size: 0.72rem; padding: 8px 10px; }
}

/* ===== Fantômes 👻 : postes de dépense ignorés (global) ===== */
.ghost-btn {
  cursor: pointer;
  opacity: .3;
  font-size: .78rem;
  margin-left: 4px;
  user-select: none;
  transition: opacity .15s ease, transform .15s ease;
  display: inline-block;
}
.ghost-btn:hover { opacity: .7; transform: scale(1.15); }
.ghost-btn.on { opacity: 1; transform: scale(1.15); color: var(--accent); filter: drop-shadow(0 0 10px rgba(16,185,129,.9)) drop-shadow(0 0 2px rgba(16,185,129,.9)); }
.form-group.ghost {
  opacity: .4;
  filter: grayscale(.85);
}
.form-group.ghost input {
  border-color: var(--border-strong) !important;
  background: transparent !important;
  box-shadow: none !important;
}
.form-group.ghost .calc-badge { display: none !important; }

/* ===== Comparateur — dépenses communes (toggle + badges source R/~E) ===== */
.compare-expmode {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,.02);
}
.cem-label { font-weight: 700; font-size: .82rem; margin-right: 2px; }
.cem-btn {
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: .74rem;
  font-weight: 600;
  transition: all .15s ease;
}
.cem-btn:hover { color: var(--text); border-color: var(--accent); }
.cem-btn.on {
  background: linear-gradient(135deg, var(--accent), #0d9668);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 12px rgba(16,185,129,.35);
}
.cem-hint { font-size: .7rem; color: var(--muted); }
.exp-src {
  display: inline-block;
  font-size: .62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 6px;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1.3;
}
.exp-src.b-r { color: #34d399; background: rgba(52,211,153,.12); }
.exp-src.b-e { color: #fbbf24; background: rgba(251,191,36,.12); }
/* ===== Comparateur — REFONTE DESIGN (panneau pleine largeur + score) ===== */
.compare-panel { display: none; }
.compare-panel.visible {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-lift);
}
#compareHost { width: 100%; }

/* Table : ne déborde plus jamais de sa carte */
.cmp-wrap { overflow-x: auto; }
.cmp-table { min-width: 720px; }
.cmp-table th, .cmp-table td { white-space: nowrap; }

/* Score global : grille propre, cellules cards, barres compactes */
.compare-scores { display: grid; gap: 8px; margin-bottom: 18px; }
.compare-scores .cs-head, .compare-scores .cs-row { display: grid; gap: 8px; align-items: stretch; grid-column: 1 / -1; }
.compare-scores .cs-row { background: transparent; }
.compare-scores .cs-row > div {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex; flex-direction: row; align-items: center;
  min-width: 0;
}
.cs-prop {
  display: flex; align-items: center; gap: 6px;
  font-size: .78rem; font-weight: 600;
  padding: 6px 10px;
  border-bottom: 2px solid var(--border);
  min-width: 0;
}
.cs-prop-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-scores .cs-label-col, .compare-scores .cs-cell-label {
  background: transparent !important;
  border: none !important;
  font-size: .74rem; font-weight: 600; color: var(--muted);
  align-items: center;
}
.compare-scores .cs-score-cell { justify-content: center; padding: 10px 12px; }
.compare-scores .cs-score-cell.cs-winner { box-shadow: inset 0 0 0 2px var(--accent); }
.compare-score-badge {
  display: inline-block; padding: 6px 16px; border-radius: 999px;
  font-weight: 800; font-size: .95rem;
}
.compare-score-badge.high { background: var(--accent-soft); color: var(--accent); }
.compare-score-badge.mid { background: var(--warn-soft); color: var(--warn); }
.compare-score-badge.low { background: var(--danger-soft); color: var(--danger); }
.compare-scores .cs-cell { gap: 8px; }
.cs-bar { flex: 1; height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; min-width: 30px; }
.cs-bar-fill { display: block; height: 100%; border-radius: 999px; }
.cs-pts { font-size: .74rem; font-weight: 700; min-width: 24px; text-align: right; }
.cs-val { font-size: .68rem; color: var(--muted); white-space: nowrap; }
.cs-max { font-weight: 400; opacity: .55; }

/* ===== Badges value-add (tags description courtier) ===== */
.tags-line { margin-top: 2px; font-size: 0.82rem; line-height: 1.5; }
.tag-badge { cursor: help; margin-right: 3px; display: inline-block; }
.tag-badge.nouveau {
  background: var(--accent-soft); border: 1px solid var(--accent); color: var(--accent);
  border-radius: 999px; padding: 0 6px; font-size: 0.72rem; font-weight: 600;
  box-shadow: 0 0 8px var(--accent-soft);
}

/* ===== Filtres badges value-add (chips) ===== */
.tag-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  background: var(--card); border: 1px solid var(--border); color: var(--muted);
  padding: 5px 12px; border-radius: 999px; cursor: pointer; font-size: 0.85rem;
  transition: all .2s; font-family: inherit;
}
.tag-chip:hover { border-color: var(--accent); color: var(--text); }
.tag-chip.active {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
  box-shadow: 0 0 12px var(--accent-soft);
}
