/* Liais — Mode sombre architectural unifié + stabilité pixel de la barre de navigation */

html {
  scrollbar-gutter: stable;
}

@media (max-width: 780px) {
  /* Supprimer les flous GPU coûteux sur Chrome mobile pour un scroll fluide à 60 FPS */
  .topbar,
  .site-topbar,
  .biens-toolbar,
  .bp-head,
  .intent-bar,
  .tool-pill,
  .sidebar {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .nav-toggle,
  .site-nav-toggle {
    width: 42px !important;
    height: 42px !important;
  }
  .nav.open,
  .site-nav.open,
  .nav-links.open {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: #f6f3ec !important;
    z-index: 60 !important;
    padding: 12px 16px 16px !important;
    gap: 6px !important;
    box-shadow: 0 18px 40px rgba(24, 23, 21, 0.16) !important;
  }
  html.theme-dark .nav.open,
  html.theme-dark .site-nav.open,
  html.theme-dark .nav-links.open {
    background: #0e131a !important;
  }
  .nav.open a,
  .site-nav.open a,
  .nav-links.open a {
    flex: 1 0 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 10px 14px !important;
    font-size: 14.5px !important;
  }
  .nav.open .liais-theme-btn,
  .site-nav.open .liais-theme-btn,
  .nav-links.open .liais-theme-btn {
    width: 42px;
    height: 42px;
    margin: 8px 0 0 0;
  }
  .nav.open .liais-auth-slot,
  .site-nav.open .liais-auth-slot,
  .nav-links.open .liais-auth-slot {
    flex: 1;
    min-width: 0;
    height: 42px;
    justify-content: flex-end;
    margin: 8px 0 0 0;
  }
  .nav.open .liais-login-btn,
  .site-nav.open .liais-login-btn,
  .nav-links.open .liais-login-btn,
  .nav.open .liais-user-btn,
  .site-nav.open .liais-user-btn,
  .nav-links.open .liais-user-btn {
    min-height: 42px;
    padding: 8px 16px;
  }
}

.liais-auth-slot {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 112px;
  height: 33px;
  margin-left: 6px;
  flex-shrink: 0;
}

.liais-theme-btn {
  display: inline-grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border-radius: 999px;
  border: 1px solid #d8d0c0;
  background: #fffdf8;
  color: #181715;
  cursor: pointer;
  margin-left: 4px;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.liais-theme-btn:hover {
  border-color: #1c3d4f;
  background: #ede8dc;
}

html.theme-dark {
  color-scheme: dark;
  --stone-bg: #0e131a;
  --stone-card: #151c26;
  --stone-soft: #1e2734;
  --stone-border: #2a3647;
  --bg: #0e131a;
  --panel: rgba(16, 22, 31, 0.94);
  --card: #151c26;
  --soft: #1e2734;
  --card-soft: #1e2734;
  --border: #2a3647;
  --ink: #f1efe9;
  --text: #f1efe9;
  --ink-soft: #9aa6b6;
  --muted: #9aa6b6;
  --slate: #2b607c;
  --slate-hover: #357496;
  --slate-deep: #1b3d4f;
  --accent: #3d84a8;
  --accent-hover: #539cc2;
  --terracotta: #e37b59;
  --sage: #38c19e;
  --sage-bg: rgba(56, 193, 158, 0.14);
  --ochre-bg: rgba(226, 180, 131, 0.15);
  --ochre-ink: #f2cfa3;
  --good: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --shadow: 0 16px 42px rgba(0, 0, 0, 0.5);
}

html.theme-dark body {
  background: var(--stone-bg);
  color: var(--ink);
}

/* Navigation & bouton thème */
.brand-mark {
  background: #1c3d4f !important;
}

html.theme-dark .topbar,
html.theme-dark .site-topbar {
  background: rgba(14, 19, 26, 0.92);
  border-bottom-color: var(--stone-border);
}

html.theme-dark .nav a:hover,
html.theme-dark .site-nav a:hover,
html.theme-dark .nav-links a:hover {
  background: var(--stone-soft);
  color: var(--ink);
}

html.theme-dark .nav a.active,
html.theme-dark .site-nav a.active,
html.theme-dark .nav-links a.active {
  background: #2b607c;
  color: #ffffff;
}

@media (max-width: 780px) {
  html.theme-dark .nav,
  html.theme-dark .site-nav {
    background: rgba(14, 19, 26, 0.98);
    border-bottom-color: var(--stone-border);
  }
}

html.theme-dark .liais-theme-btn,
html.theme-dark .liais-login-btn,
html.theme-dark .liais-user-btn {
  background: #151c26;
  border-color: #2a3647;
  color: #f1efe9;
}

html.theme-dark .liais-theme-btn:hover,
html.theme-dark .liais-login-btn:hover,
html.theme-dark .liais-user-btn:hover {
  background: #1e2734;
  border-color: #539cc2;
  color: #ffffff;
}

html.theme-dark .liais-user-menu {
  background: #151c26;
  border-color: #2a3647;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55);
}

html.theme-dark .liais-um-head {
  border-bottom-color: #2a3647;
}

html.theme-dark .liais-um-name,
html.theme-dark .liais-um-item {
  color: #f1efe9;
}

html.theme-dark .liais-um-mail {
  color: #9aa6b6;
}

html.theme-dark .liais-um-item:hover {
  background: #1e2734;
}

html.theme-dark .liais-um-item.danger {
  color: #f87171;
}

html.theme-dark .liais-auth-modal {
  background: #151c26;
  border-color: #2a3647;
  color: #f1efe9;
}

html.theme-dark .liais-auth-modal p {
  color: #9aa6b6;
}

/* Surfaces claires codées en dur sur Accueil, Agences, Modèle, API, Compte */
html.theme-dark .hero-card-badge,
html.theme-dark .floating-kpi,
html.theme-dark .hero-map-pill,
html.theme-dark .parcel-art-cta {
  background: rgba(16, 22, 31, 0.94);
  border: 1px solid #2a3647;
  color: #f1efe9;
}

html.theme-dark .btn-light {
  background: #f6f3ec;
  color: #181715;
}

html.theme-dark .search-input,
html.theme-dark .btn-google,
html.theme-dark .profile-signout,
html.theme-dark .pill,
html.theme-dark .arr-pill,
html.theme-dark .toggle-row,
html.theme-dark .keys-input,
html.theme-dark .btn-secondary,
html.theme-dark .alert-modal-close,
html.theme-dark .bt-save-btn,
html.theme-dark .bp-agent-banner {
  background: #1a2330;
  border-color: #2a3647;
  color: #f1efe9;
}

html.theme-dark .btn-google:hover,
html.theme-dark .pill:hover,
html.theme-dark .arr-pill:hover,
html.theme-dark .toggle-row:hover {
  background: #222e3f;
  border-color: #539cc2;
}

html.theme-dark .btn-secondary:hover,
html.theme-dark .bt-save-btn:hover {
  background: #2b607c;
  border-color: #2b607c;
  color: #ffffff;
}

html.theme-dark .pill.selected,
html.theme-dark .arr-pill.selected,
html.theme-dark .profile-tab.active,
html.theme-dark .btn-primary,
html.theme-dark .primary-btn {
  background: #2b607c;
  border-color: #2b607c;
  color: #ffffff;
}

html.theme-dark .btn-primary:hover,
html.theme-dark .primary-btn:hover {
  background: #357496;
}

html.theme-dark .profile-signout:hover,
html.theme-dark .btn-danger {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(248, 113, 113, 0.45);
  color: #fca5a5;
}

html.theme-dark tbody tr:hover {
  background: #1a2330;
}

html.theme-dark .eyebrow,
html.theme-dark .badge-indep,
html.theme-dark .method.get,
html.theme-dark .listing-delta.good,
html.theme-dark .ux-lc-verdict.good,
html.theme-dark .bp-dpe-tag.good {
  background: rgba(56, 193, 158, 0.16);
  color: #6ee7b7;
}

html.theme-dark .method.post,
html.theme-dark .bp-dpe-tag.mid {
  background: rgba(251, 191, 36, 0.16);
  color: #fcd34d;
}

html.theme-dark .listing-delta.high,
html.theme-dark .ux-lc-verdict.high,
html.theme-dark .bp-dpe-tag.bad {
  background: rgba(248, 113, 113, 0.16);
  color: #fca5a5;
}

html.theme-dark code {
  background: #1e2734;
  color: #93c5fd;
}

html.theme-dark .auth-foot a,
html.theme-dark .bp-agent-banner a {
  color: #7cc4e8;
}

/* Cockpit /carte-des-biens en mode sombre */
html.theme-dark .bp-card.is-seen {
  background: #141b25;
  opacity: 0.88;
}

html.theme-dark .bp-badge.good {
  background: rgba(20, 83, 45, 0.92);
  color: #86efac;
}

html.theme-dark .bp-badge.fair {
  background: rgba(21, 28, 38, 0.92);
  color: #e2e8f0;
}

html.theme-dark .bp-badge.high {
  background: rgba(127, 29, 29, 0.92);
  color: #fecaca;
}

html.theme-dark .bp-act-btn {
  background: rgba(15, 20, 28, 0.86);
  color: #f1efe9;
}

html.theme-dark .bp-act-btn:hover {
  background: #1e2734;
}

html.theme-dark .bp-act-btn.fav.saved {
  background: #c45735;
  color: #ffffff;
}

html.theme-dark .bp-detail-bg,
html.theme-dark .bp-detail-card,
html.theme-dark .bp-drawer-topbar,
html.theme-dark .bp-drawer-footer {
  background: #111720;
  border-color: #232f40;
  color: #f1efe9;
}

html.theme-dark .bp-m4-range-bar {
  background: #1f2a3a;
}

html.theme-dark .bp-m4-range-pin {
  background: #f8fafc;
  border-color: #111720;
}

html.theme-dark .bp-cta-primary {
  background: #2b607c;
  color: #ffffff;
}

html.theme-dark .bt-popover,
html.theme-dark .map-prices-toggle {
  background: #151c26;
  border-color: #2a3647;
  color: #f1efe9;
}

html.theme-dark .map-prices-toggle.active {
  background: #2b607c;
  border-color: #2b607c;
  color: #ffffff;
}

html.theme-dark .bt-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 4.25L6 7.75L9.5 4.25' stroke='%23cbd5e1' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

html.theme-dark .bt-select.active {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 4.25L6 7.75L9.5 4.25' stroke='%23ffffff' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

html.theme-dark .alert-modal-frame {
  background: #0e131a;
}

/* Google Maps InfoWindow en mode sombre : garder la croix × bien lisible sur fond clair */
html.theme-dark .gm-style-iw-c {
  color: #181715;
  color-scheme: light;
}

html.theme-dark .gm-style-iw-c button.gm-ui-hover-effect {
  color: #181715 !important;
  opacity: 0.85 !important;
}

html.theme-dark .gm-style-iw-c button.gm-ui-hover-effect > span {
  background-color: #181715 !important;
}

html.theme-dark .gm-style-iw-c button.gm-ui-hover-effect:hover {
  opacity: 1 !important;
}

html.theme-dark footer,
html.theme-dark .site-footer {
  background: #0b1016;
  border-top-color: #2a3647;
}
