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

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: #f8f9fa;
    color: #333;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

html.dark-mode body {
    background-color: #121212;
    color: #f0f0f0;
}

/* Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: white;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: all 0.3s;
}

html.dark-mode .topbar {
    background-color: #1e1e1e;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Boutons topbar */
.btn-logout{
  display:flex;
  align-items:center;
  gap:.5rem;
  padding:.6rem 1.2rem;
  background-color:#f8f9fa;
  border:1px solid #e0e0e0;
  border-radius:10px;
  color:#666;
  font-size:.9rem;
  cursor:pointer;
  transition:all .2s;
  text-decoration:none;
}


html.dark-mode .btn-logout {
    background-color: #2d2d2d;
    border-color: #444;
    color: #aaa;
}

.btn-logout:hover {
    background-color: #f0f0f0;
    transform: translateY(-1px);
}

html.dark-mode .btn-logout:hover {
    background-color: #3a3a3a;
}

.btn-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background-color: #4a6fa5;
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.btn-profile:hover {
    background-color: #3a5a8c;
    transform: translateY(-1px);
}

/* Popup iOS-style */
.profile-popup {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.8rem;
    background-color: white;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    width: 220px;
    padding: 0.5rem 0;
    z-index: 200;
    display: none;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

html.dark-mode .profile-popup {
    background-color: #2d2d2d;
    border-color: #444;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.profile-popup.show {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.profile-popup:before {
    content: '';
    position: absolute;
    top: -8px;
    left: 20px;
    width: 16px;
    height: 16px;
    background-color: inherit;
    transform: rotate(45deg);
    border-left: 1px solid #e0e0e0;
    border-top: 1px solid #e0e0e0;
}

html.dark-mode .profile-popup:before {
    border-left: 1px solid #444;
    border-top: 1px solid #444;
}

.popup-item {
    padding: 0.9rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
    color: #333;
    font-size: 0.95rem;
    transition: background-color 0.2s;
}

html.dark-mode .popup-item {
    color: #f0f0f0;
}

.popup-item:hover {
    background-color: #f8f9fa;
}

html.dark-mode .popup-item:hover {
    background-color: #3a3a3a;
}

.popup-divider {
    height: 1px;
    background-color: #e0e0e0;
    margin: 0.3rem 0;
}

html.dark-mode .popup-divider {
    background-color: #444;
}

/* Infos utilisateur */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: 500;
}

.user-name {
    font-size: 1rem;
}

.user-role {
    font-size: 0.85rem;
    color: #4a6fa5;
    background-color: rgba(74, 111, 165, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
}

html.dark-mode .user-role {
    color: #8bb4ff;
    background-color: rgba(74, 111, 165, 0.2);
}

/* Indicateurs */
.indicators {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.language-flag,
.theme-icon {
    font-size: 1.2rem;
    opacity: 0.8;
}

/* Modale changement mot de passe / langue */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background-color: white;
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

html.dark-mode .modal {
    background-color: #1e1e1e;
}

.modal-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

html.dark-mode .modal-header {
    border-bottom-color: #444;
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #777;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #333;
}

html.dark-mode .modal-close {
    color: #aaa;
}

html.dark-mode .modal-close:hover {
    color: #fff;
}

.modal-body {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

html.dark-mode .form-label {
    color: #ccc;
}

.form-input {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.2s;
    background-color: #f9f9f9;
}

html.dark-mode .form-input {
    background-color: #2d2d2d;
    border-color: #444;
    color: #f0f0f0;
}

.form-input:focus {
    outline: none;
    border-color: #4a6fa5;
    background-color: white;
}

html.dark-mode .form-input:focus {
    background-color: #333;
}

.modal-footer {
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

html.dark-mode .modal-footer {
    border-top-color: #444;
}

.btn-secondary {
    padding: 0.8rem 1.5rem;
    background-color: #f0f0f0;
    border: none;
    border-radius: 10px;
    color: #555;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

html.dark-mode .btn-secondary {
    background-color: #3a3a3a;
    color: #ccc;
}

.btn-secondary:hover {
    background-color: #e0e0e0;
}

html.dark-mode .btn-secondary:hover {
    background-color: #4a4a4a;
}

.btn-primary {
    padding: 0.8rem 1.5rem;
    background-color: #4a6fa5;
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background-color: #3a5a8c;
}

/* Contenu principal */
.main-content {
    min-height: calc(100vh - 80px);
}

/* Options de langue */
.language-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.language-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

html.dark-mode .language-option {
    border-color: #444;
}

.language-option:hover,
.language-option.selected {
    background-color: #f0f0f0;
    border-color: #4a6fa5;
}

html.dark-mode .language-option:hover,
html.dark-mode .language-option.selected {
    background-color: #2d2d2d;
    border-color: #5a7bb5;
}

.language-flag-option {
    font-size: 1.8rem;
}

.language-name {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
    .topbar {
        padding: 1rem;
    }

    .user-name {
        display: none;
    }

    .btn-logout span,
    .btn-profile span {
        display: none;
    }

    .btn-logout,
    .btn-profile {
        padding: 0.6rem;
    }

    /* ✅ Masquer langue + thème en mobile */
    .language-flag,
    .theme-icon {
        display: none !important;
    }
}

.language-flag {
    display: flex;
    align-items: center;
}

.language-flag img {
    width: 24px;
    height: 16px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
}

.topbar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(74, 111, 165, 0.1);
    color: #4a6fa5;
    font-size: 1.25rem;
    margin-right: 0.5rem;
}

/* Dark mode */
html.dark-mode .topbar-logo {
    background: rgba(139, 180, 255, 0.15);
    color: #8bb4ff;
}

/* ===========================
   NAV LOADER (page transition)
   =========================== */
.nav-loader {
  position: fixed;
  inset: 0;
  display: none;              /* caché par défaut */
  align-items: center;
  justify-content: center;
  z-index: 9999;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

html.dark-mode .nav-loader {
  background: rgba(18, 18, 18, 0.55);
}

.nav-loader.show {
  display: flex;
  animation: navLoaderFadeIn 140ms ease-out;
}

.nav-loader-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.9rem 1.1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 12px 35px rgba(0,0,0,0.12);
}

html.dark-mode .nav-loader-card {
  background: rgba(30, 30, 30, 0.88);
  border-color: rgba(255, 255, 255, 0.10);
  box-shadow: 0 12px 35px rgba(0,0,0,0.45);
}

.nav-loader-icon {
  font-size: 1.35rem;
  color: #4a6fa5;
  transform-origin: center;
  animation: navLoaderStack 850ms ease-in-out infinite;

  will-change: transform, opacity;
  transform: translateZ(0);
}

html.dark-mode .nav-loader-icon {
  color: #8bb4ff;
}

.nav-loader-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  letter-spacing: -0.01em;
}

html.dark-mode .nav-loader-text {
  color: #f0f0f0;
}

@keyframes navLoaderStack {
  0%   { transform: translateY(7px) scale(0.92); opacity: 0.55; }
  40%  { transform: translateY(-2px) scale(1.03); opacity: 1; }
  70%  { transform: translateY(0px) scale(1); opacity: 0.92; }
  100% { transform: translateY(7px) scale(0.92); opacity: 0.55; }
}

@keyframes navLoaderFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}


/* Page container */
.page-container{
    padding: 2.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Header de page (sous topbar) */
.page-header{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0.5rem 0 1.2rem;
}

.page-header-right{
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: nowrap; /* garde sur une seule ligne en desktop */
}

/* Header actions : même hauteur et alignement */
.page-header-right .btn-logout,
.page-header-right .btn-primary{
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

/* Nouveau bien doit adopter le gabarit de btn-logout (dans le header uniquement) */
.page-header-right .btn-new-property{
    padding: 0.6rem 1.2rem;  /* comme .btn-logout */
    font-size: 0.9rem;       /* comme .btn-logout */
    border-radius: 10px;     /* comme .btn-logout */
    gap: 0.5rem;
}

.page-title{
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

/* (Optionnel) zone contenu */
.page-body{
    min-height: 200px;
}

@media (max-width: 768px){
    .page-container{
        padding: 1.5rem;
    }

    .page-title{
        font-size: 1.35rem;
    }

    /* Header actions en mobile : boutons icône-only */
    .page-header-right .btn-logout span,
    .page-header-right .btn-new-property .btn-text{
        display: none;
    }

    .page-header-right .btn-logout,
    .page-header-right .btn-new-property{
        width: 44px;
        padding: 0;                 /* icône centré */
        border-radius: 14px;        /* “cercle” iOS-like (plus rond) */
        gap: 0;
    }

    .page-header-right .btn-logout i,
    .page-header-right .btn-new-property i{
        margin: 0;
        font-size: 1rem;
    }
}

/* =========================
   GLOBAL CONFIRM MODAL (macOS-style)
   ========================= */

.confirm-overlay{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  background: rgba(0,0,0,0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 16px;
}

html.dark-mode .confirm-overlay{
  background: rgba(0,0,0,0.45);
}

.confirm-overlay.show{
  display: flex;
  animation: confirmFadeIn 140ms ease-out;
}

.confirm-modal{
  width: min(520px, 100%);
  border-radius: 16px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(0,0,0,0.10);
  box-shadow: 0 20px 60px rgba(0,0,0,0.22);
  overflow: hidden;
  transform: translateY(8px) scale(0.98);
  animation: confirmPop 160ms ease-out forwards;
}

html.dark-mode .confirm-modal{
  background: rgba(30,30,30,0.92);
  border-color: rgba(255,255,255,0.10);
  box-shadow: 0 25px 80px rgba(0,0,0,0.55);
}

.confirm-head{
  display: grid;
  grid-template-columns: 44px 1fr 32px;
  gap: 12px;
  align-items: start;
  padding: 16px 16px 12px;
}

.confirm-icon{
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(74,111,165,0.12);
  color: #4a6fa5;
  font-size: 1.15rem;
}

html.dark-mode .confirm-icon{
  background: rgba(139,180,255,0.14);
  color: #8bb4ff;
}

.confirm-title{
  font-weight: 700;
  letter-spacing: -0.015em;
  font-size: 1.05rem;
  color: #111;
  margin-top: 2px;
}

html.dark-mode .confirm-title{ color: #f2f2f2; }

.confirm-message{
  margin-top: 4px;
  font-size: 0.95rem;
  color: rgba(0,0,0,0.68);
  line-height: 1.35;
}

html.dark-mode .confirm-message{ color: rgba(255,255,255,0.72); }

.confirm-x{
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.10);
  background: rgba(255,255,255,0.6);
  color: rgba(0,0,0,0.65);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 120ms ease, background 120ms ease;
}

html.dark-mode .confirm-x{
  border-color: rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.70);
}

.confirm-x:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,0.9);
}

html.dark-mode .confirm-x:hover{
  background: rgba(255,255,255,0.10);
}

.confirm-actions{
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.55);
}

html.dark-mode .confirm-actions{
  border-top-color: rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
}

.confirm-btn{
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 12px;
  padding: 0.65rem 1rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.confirm-btn:active{ transform: translateY(1px); }

.confirm-cancel{
  background: rgba(255,255,255,0.9);
  color: rgba(0,0,0,0.75);
}

html.dark-mode .confirm-cancel{
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.78);
  border-color: rgba(255,255,255,0.10);
}

.confirm-ok{
  background: #4a6fa5;
  color: #fff;
  border-color: rgba(0,0,0,0.0);
  box-shadow: 0 10px 25px rgba(74,111,165,0.25);
}

html.dark-mode .confirm-ok{
  background: #5a7bb5;
  box-shadow: 0 10px 25px rgba(90,123,181,0.25);
}

.confirm-btn:hover{
  transform: translateY(-1px);
}

@keyframes confirmFadeIn{
  from{ opacity: 0; }
  to{ opacity: 1; }
}

@keyframes confirmPop{
  to{ transform: translateY(0) scale(1); }
}

/* =========================
   GLOBAL TOASTS (top-center)
   ========================= */

.toast-host{
  position: fixed;
  top: 72px; /* ~ hauteur topbar + un petit spacing */
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;
  width: min(560px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none; /* le conteneur laisse cliquer en dessous */
  align-items: center;
}



@media (max-width: 768px){
  .toast-host{ top: 64px; }
}

.toast{
  pointer-events: auto;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 12px;
  border-radius: 14px;

  background: rgba(255,255,255,0.84);
  border: 1px solid rgba(0,0,0,0.10);
  box-shadow: 0 18px 55px rgba(0,0,0,0.14);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  transform: translateY(-8px) scale(0.985);
  opacity: 0;
  animation: toastIn 170ms ease-out forwards;
  overflow: hidden;
}

.toast{
  width: min(360px, calc(100vw - 24px)); /* ✅ taille normale + responsive */
}

.toast-content{
  padding-right: 0.25rem;
}

.toast-message{
  font-size: 0.9rem;
  line-height: 1.22;
}

html.dark-mode .toast{
  background: rgba(30,30,30,0.88);
  border-color: rgba(255,255,255,0.10);
  box-shadow: 0 22px 75px rgba(0,0,0,0.55);
}

.toast-icon{
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;

  background: rgba(74,111,165,0.12);
  color: #4a6fa5;
}

html.dark-mode .toast-icon{
  background: rgba(139,180,255,0.14);
  color: #8bb4ff;
}

.toast-body{
  min-width: 0;
}

.toast-title{
  font-weight: 750;
  letter-spacing: -0.015em;
  font-size: 0.98rem;
  color: rgba(0,0,0,0.85);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html.dark-mode .toast-title{
  color: rgba(255,255,255,0.90);
}

.toast-message{
  margin-top: 3px;
  font-size: 0.92rem;
  color: rgba(0,0,0,0.64);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

html.dark-mode .toast-message{
  color: rgba(255,255,255,0.70);
}

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

.toast-action{
  border: 1px solid rgba(0,0,0,0.10);
  background: rgba(255,255,255,0.70);
  color: rgba(0,0,0,0.78);
  border-radius: 12px;
  padding: 8px 10px;
  font-weight: 650;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

html.dark-mode .toast-action{
  border-color: rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.82);
}

.toast-action:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,0.92);
}

html.dark-mode .toast-action:hover{
  background: rgba(255,255,255,0.10);
}

.toast-close{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.10);
  background: rgba(255,255,255,0.60);
  color: rgba(0,0,0,0.65);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 120ms ease, background 120ms ease;
}

html.dark-mode .toast-close{
  border-color: rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.70);
}

.toast-close:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,0.92);
}

html.dark-mode .toast-close:hover{
  background: rgba(255,255,255,0.10);
}

/* Progress bar (auto-dismiss) */
.toast-progress{
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: rgba(0,0,0,0.06);
}

html.dark-mode .toast-progress{
  background: rgba(255,255,255,0.08);
}

.toast-progress > span{
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left;
  transform: scaleX(1);
  background: rgba(74,111,165,0.55);
}

html.dark-mode .toast-progress > span{
  background: rgba(139,180,255,0.55);
}

/* Variants */
.toast.success .toast-icon{
  background: rgba(46,204,113,0.14);
  color: #2ecc71;
}
.toast.error .toast-icon{
  background: rgba(231,76,60,0.14);
  color: #e74c3c;
}
.toast.warning .toast-icon{
  background: rgba(241,196,15,0.16);
  color: #b8860b;
}
.toast.info .toast-icon{
  background: rgba(74,111,165,0.12);
  color: #4a6fa5;
}

.toast.success .toast-progress > span{ background: rgba(46,204,113,0.55); }
.toast.error   .toast-progress > span{ background: rgba(231,76,60,0.55); }
.toast.warning .toast-progress > span{ background: rgba(241,196,15,0.55); }

.toast.out{
  animation: toastOut 160ms ease-in forwards;
}

@keyframes toastIn{
  to{ transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes toastOut{
  to{ transform: translateY(-8px) scale(0.985); opacity: 0; }
}

.brand-primary { color: #4a6fa5; }   /* bleu logo */
.brand-secondary { color: inherit; } /* noir/ blanc selon thème */
.brand-suffix { color: inherit; }    /* suffixe normal */


/* ===========================
   macOS window (draggable/resizable, no overlay)
   =========================== */
.cw-window{
    position: fixed;
    top: 140px;
    left: 50%;
    transform: translateX(-50%);
    width: 520px;
    max-width: calc(100vw - 24px);
    height: 320px;
    max-height: calc(100vh - 160px);

    border-radius: 14px;
    background: rgba(255,255,255,0.98);
    border: 1px solid rgba(0,0,0,0.10);
    box-shadow: 0 18px 50px rgba(0,0,0,0.18);

    display: flex;
    flex-direction: column;

    /* IMPORTANT: pas de z-index "énorme" ; juste au-dessus du contenu */
    z-index: 110;

    /* Redimensionnable (natif) */
    resize: both;
    overflow: hidden; /* ✅ empêche le scroll global (header/footer fixes) */
}

.cw-window-header,
.cw-window-footer{
  flex: 0 0 auto;
  overflow: hidden;
}

.cw-window-body{
  flex: 1 1 auto;
  overflow-y: auto;   /* ✅ scroll uniquement ici */
  overflow-x: hidden;
  padding-right: 8px; /* confort: texte pas collé au scroll */
}

html.dark-mode .cw-window{
    background: rgba(30,30,30,0.98);
    border-color: rgba(255,255,255,0.12);
    box-shadow: 0 18px 55px rgba(0,0,0,0.55);
}

.cw-window-header{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    padding: 12px 14px;
    border-bottom: 1px solid rgba(0,0,0,0.08);

    cursor: grab;
    user-select: none;
}

.cw-window-header:active{
    cursor: grabbing;
}

html.dark-mode .cw-window-header{
    border-bottom-color: rgba(255,255,255,0.10);
}

.cw-window-title{
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.cw-dot{
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
    opacity: 0.95;
}

.cw-dot-red{ background: #ff5f57; }
.cw-dot-yellow{ background: #febc2e; }
.cw-dot-green{ background: #28c840; }

.cw-window-title-text{
    font-weight: 700;
    font-size: 0.95rem;
    color: #222;
    margin-left: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

html.dark-mode .cw-window-title-text{
    color: #f0f0f0;
}

.cw-window-controls{
    display: flex;
    align-items: center;
    gap: 8px;
}

.cw-window-close{
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.10);
    background: rgba(248,249,250,0.9);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #444;
    transition: transform 0.15s, background-color 0.15s;
}

.cw-window-close:hover{
    background: rgba(240,240,240,0.95);
    transform: translateY(-1px);
}

html.dark-mode .cw-window-close{
    background: rgba(45,45,45,0.9);
    border-color: rgba(255,255,255,0.12);
    color: #ddd;
}

html.dark-mode .cw-window-close:hover{
    background: rgba(58,58,58,0.95);
}

.cw-window-body{
    padding: 14px;
    flex: 1;
}

.cw-window-placeholder{
    padding: 14px;
    border-radius: 12px;
    border: 1px dashed rgba(0,0,0,0.18);
    color: #666;
    background: rgba(255,255,255,0.6);
}

html.dark-mode .cw-window-placeholder{
    border-color: rgba(255,255,255,0.18);
    color: #bbb;
    background: rgba(30,30,30,0.45);
}

.cw-window-footer{
    padding: 12px 14px 14px;
    border-top: 1px solid rgba(0,0,0,0.08);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

html.dark-mode .cw-window-footer{
    border-top-color: rgba(255,255,255,0.10);
}

/* Responsive */
@media (max-width: 768px){
    .cw-window{
        width: calc(100vw - 20px);
        left: 50%;
        transform: translateX(-50%);
        top: 120px;
        height: 360px;
    }
}

.cw-window::-webkit-resizer {
    border: 2px solid #4a6fa5;
    border-top: none;
    border-left: none;
    border-radius: 0 0 6px 0;
    background-color: rgba(255, 255, 255, 0.8);
    width: 18px;
    height: 18px;
}

html.dark-mode .cw-window::-webkit-resizer {
    border-color: #8bb4ff;
    background-color: rgba(30, 30, 30, 0.8);
}


/* ===========================
   HTMX: animation légère au swap
   =========================== */
.cw-htmx-panel.htmx-swapping{
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 140ms ease, transform 140ms ease;
}
.cw-htmx-panel.htmx-settling{
    opacity: 1;
    transform: translateY(0);
    transition: opacity 180ms ease, transform 180ms ease;
}

/* ===========================
   Tables (SethImmo)
   =========================== */
.cw-table-wrap{
    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.06);
    overflow: hidden;
}

html.dark-mode .cw-table-wrap{
    background: rgba(30,30,30,0.88);
    border-color: rgba(255,255,255,0.10);
    box-shadow: 0 18px 55px rgba(0,0,0,0.45);
}

.cw-table-head{
    padding: 14px 16px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
html.dark-mode .cw-table-head{
    border-bottom-color: rgba(255,255,255,0.08);
}

.cw-table-title{
    display:flex;
    align-items:center;
    gap:10px;
    font-weight: 750;
    letter-spacing: -0.015em;
    color: rgba(0,0,0,0.85);
}
html.dark-mode .cw-table-title{
    color: rgba(255,255,255,0.90);
}

.cw-table-subtitle{
    margin-top: 4px;
    font-size: 0.92rem;
    color: rgba(0,0,0,0.55);
}
html.dark-mode .cw-table-subtitle{
    color: rgba(255,255,255,0.62);
}

.cw-table-scroll{
    overflow-x: auto;
}

.cw-table{
    width: 100%;
    border-collapse: collapse;
    min-width: 980px; /* pour bien respirer */
}

.cw-table thead th{
    text-align: left;
    font-size: 0.85rem;
    font-weight: 700;
    color: rgba(0,0,0,0.60);
    padding: 12px 14px;
    background: rgba(248,249,250,0.85);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    white-space: nowrap;
}
html.dark-mode .cw-table thead th{
    color: rgba(255,255,255,0.65);
    background: rgba(255,255,255,0.04);
    border-bottom-color: rgba(255,255,255,0.08);
}

.cw-table tbody td{
    padding: 12px 14px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    color: rgba(0,0,0,0.78);
    vertical-align: top;
    font-size: 0.92rem;
}
html.dark-mode .cw-table tbody td{
    border-bottom-color: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.80);
}

.cw-th-actions{ width: 90px; text-align: right; }
.cw-actions{ text-align: right; }

/* Empty state inside table */
.cw-td-empty{
    padding: 26px 14px !important;
    border-bottom: none !important;
}

.cw-empty{
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 18px 10px;
    gap: 6px;
}

.cw-empty-icon{
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display:flex;
    align-items:center;
    justify-content:center;
    background: rgba(74,111,165,0.12);
    color: #4a6fa5;
    font-size: 1.1rem;
}
html.dark-mode .cw-empty-icon{
    background: rgba(139,180,255,0.14);
    color: #8bb4ff;
}

.cw-empty-title{
    font-weight: 750;
    letter-spacing: -0.015em;
}
.cw-empty-subtitle{
    font-size: 0.92rem;
    color: rgba(0,0,0,0.55);
    max-width: 520px;
}
html.dark-mode .cw-empty-subtitle{
    color: rgba(255,255,255,0.62);
}

/* Mini composants cellules (prêts pour quand tu ajoutes les données) */
.cw-money{ font-weight: 750; white-space: nowrap; }


.cw-idcard .cw-id{
    font-size: 0.82rem;
    font-weight: 800;
    color: rgba(0,0,0,0.62);
}
html.dark-mode .cw-idcard .cw-id{
    color: rgba(255,255,255,0.65);
}

.cw-idcard .cw-name{
    margin-top: 3px;
    font-weight: 700;
    line-height: 1.1;
}

.cw-date{ white-space: nowrap; }

.cw-deposit{
    display:flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
}

.cw-deposit-top,
.cw-deposit-bottom{
    display:flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.08);
    background: rgba(255,255,255,0.60);
}
html.dark-mode .cw-deposit-top,
html.dark-mode .cw-deposit-bottom{
    border-color: rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.05);
}

.cw-deposit-top{ color: #4a6fa5; }     /* payé en bleu */
.cw-deposit-bottom{ color: #2ecc71; }  /* restant en vert */

.cw-deposit-label{
    font-size: 0.82rem;
    font-weight: 800;
    opacity: 0.9;
}
.cw-deposit-amount{
    font-weight: 850;
    white-space: nowrap;
}

.btn-profile.is-active{
  background-color: #3a5a8c;
  box-shadow: 0 10px 22px rgba(74,111,165,0.25);
}

html.dark-mode .btn-profile.is-active{
  background-color: #5a7bb5;
  box-shadow: 0 10px 22px rgba(90,123,181,0.25);
}

/* ===== Onglets Biens (plus visible) ===== */
.btn-tab{
  background: rgba(74,111,165,0.12) !important;   /* clair */
  color: #2f4e7a !important;
  border: 1px solid rgba(74,111,165,0.22) !important;
  box-shadow: none !important;
}

.btn-tab:hover{
  background: rgba(74,111,165,0.18) !important;
}

/* Etat actif : plein + glow + petit "lift" */
.btn-tab.is-active{
  background: #4a6fa5 !important;                 /* plein */
  color: #fff !important;
  border-color: rgba(0,0,0,0) !important;
  box-shadow: 0 14px 26px rgba(74,111,165,0.28) !important;
  transform: translateY(-1px);
}

/* Petit indicateur visuel en bas (très lisible) */
.btn-tab.is-active::after{
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -7px;
  height: 3px;
  border-radius: 999px;
  background: rgba(74,111,165,0.85);
}

/* Dark mode */
html.dark-mode .btn-tab{
  background: rgba(139,180,255,0.14) !important;
  color: #cfe0ff !important;
  border-color: rgba(139,180,255,0.20) !important;
}

html.dark-mode .btn-tab.is-active{
  background: #5a7bb5 !important;
  box-shadow: 0 14px 26px rgba(90,123,181,0.28) !important;
}

html.dark-mode .btn-tab.is-active::after{
  background: rgba(139,180,255,0.85);
}

/* ===== Table card + head ===== */
.cw-table-card{
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 18px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.05);
  overflow: hidden;
}

html.dark-mode .cw-table-card{
  background: #1e1e1e;
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 18px 55px rgba(0,0,0,0.50);
}

.cw-table-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

html.dark-mode .cw-table-head{
  border-bottom-color: rgba(255,255,255,0.08);
}

.cw-table-head-left{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 0;
}

.cw-table-title{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color:#111;
  min-width: 0;
}

html.dark-mode .cw-table-title{ color:#f2f2f2; }

.cw-table-title-text{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cw-count-pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(74,111,165,0.10);
  color:#2f4e7a;
  font-weight: 750;
  font-size: 0.85rem;
}

html.dark-mode .cw-count-pill{
  background: rgba(139,180,255,0.12);
  color:#cfe0ff;
}

/* ===== Search input (taille max ~ 2x bouton retour) ===== */
.cw-table-head-right{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-shrink: 0;
}

.cw-search-wrap{
  position: relative;
  display:flex;
  align-items:center;
  border: 1px solid rgba(0,0,0,0.10);
  background: rgba(248,249,250,0.90);
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  gap: 8px;

  width: min(360px, 100%);
  max-width: 340px; /* ✅ environ 2x le bouton retour */
}

html.dark-mode .cw-search-wrap{
  background: rgba(45,45,45,0.90);
  border-color: rgba(255,255,255,0.10);
}

.cw-search-wrap i{
  opacity: 0.65;
}

.cw-search-input{
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 0.92rem;
  color: #222;
}

html.dark-mode .cw-search-input{ color: #f0f0f0; }

/* ===== Table scroll wrapper (pour responsive plus tard) ===== */
.cw-table-scroll{
  width: 100%;
  overflow-x: auto;
}

.cw-table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

/* mini style headers */
.cw-table thead th{
  text-align:left;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 12px 14px;
  color: rgba(0,0,0,0.62);
  background: rgba(0,0,0,0.02);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  white-space: nowrap;
}

html.dark-mode .cw-table thead th{
  color: rgba(255,255,255,0.70);
  background: rgba(255,255,255,0.04);
  border-bottom-color: rgba(255,255,255,0.08);
}

.cw-table tbody td{
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

html.dark-mode .cw-table tbody td{
  border-bottom-color: rgba(255,255,255,0.06);
}

/* =========================================================
   RESPONSIVE — TABLEAUX UNIQUEMENT (cw-table-card)
   Ne touche PAS topbar / page header / boutons du haut
   ========================================================= */

@media (max-width: 900px){
  /* Head du tableau : autorise le wrap sans casser */
  .cw-table-head{
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
  }

  .cw-table-head-left{
    flex: 1 1 auto;
    min-width: 0;
  }

  .cw-table-head-right{
    flex: 1 1 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 768px){
  /* Head du tableau en 2 lignes propres :
     ligne 1 = titre + compteur
     ligne 2 = recherche + imprimer
  */
  .cw-table-head-right{
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  /* Recherche : prend la place dispo */
  .cw-search-wrap{
    width: 100%;
    max-width: none;     /* override ton max-width desktop */
    flex: 1 1 auto;
  }

  /* Bouton imprimer : ne déborde jamais */
  .cw-table-head-right [data-cw-print]{
    flex: 0 0 auto;
    height: 44px;
  }

  /* Table : scroll OK + densité un peu réduite */
  .cw-table{
    min-width: 860px; /* au lieu de 980px/valeur desktop, plus confortable sur mobile */
  }

  .cw-table thead th{
    font-size: 0.85rem;
    padding: 10px 12px;
  }

  .cw-table tbody td{
    font-size: 0.88rem;
    padding: 10px 12px;
  }

  /* Cellules “dépôt” : un peu plus compact */
  .cw-deposit{
    min-width: 120px;
  }
  .cw-deposit-top,
  .cw-deposit-bottom{
    padding: 7px 9px;
    border-radius: 11px;
  }
}

@media (max-width: 420px){
  /* Micro-écrans : le head respire */
  .cw-table-title{
    font-size: 0.95rem;
  }
  .cw-count-pill{
    font-size: 0.82rem;
  }

  /* Table encore plus dense */
  .cw-table{
    min-width: 820px;
  }
}

/* =========================================================
   CW TOGGLE (global, réutilisable)
   - HTML attendu :
     <label class="cw-toggle">
       <input type="checkbox">
       <span class="cw-toggle__switch" aria-hidden="true"></span>
       <span class="cw-toggle__label">...</span>
     </label>
   ========================================================= */

/* Container */
.cw-toggle{
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

/* Hide native checkbox (mais accessible) */
.cw-toggle > input{
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

/* Label text */
.cw-toggle__label{
  font-size: 13px;
  line-height: 1;
  font-weight: 500;
  opacity: 0.95;
  color: #333;
}

html.dark-mode .cw-toggle__label{
  color: rgba(255,255,255,0.88);
}

/* Switch (OFF) */
.cw-toggle__switch{
  width: 46px;
  height: 26px;
  border-radius: 999px;
  position: relative;

  background: linear-gradient(180deg, #f2f4f7 0%, #e6eaf0 100%);
  border: 1px solid rgba(0,0,0,0.18);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.35),
    inset 0 -1px 0 rgba(0,0,0,0.10);
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

html.dark-mode .cw-toggle__switch{
  background: linear-gradient(180deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.06) 100%);
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 -1px 0 rgba(0,0,0,0.35);
}

/* Thumb */
.cw-toggle__switch::after{
  content: "";
  position: absolute;
  top: 50%;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  transform: translateY(-50%);

  background: linear-gradient(180deg, #ffffff 0%, #f3f5f8 100%);
  box-shadow:
    0 8px 18px rgba(0,0,0,0.28),
    inset 0 1px 0 rgba(255,255,255,0.9);
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}

html.dark-mode .cw-toggle__switch::after{
  background: linear-gradient(180deg, #ffffff 0%, #e9edf3 100%);
  box-shadow:
    0 10px 22px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,255,255,0.9);
}

/* ON */
.cw-toggle > input:checked + .cw-toggle__switch{
  background: linear-gradient(180deg, #4a6fa5 0%, #3a5a8c 100%);
  border-color: rgba(255,255,255,0.14);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    inset 0 -1px 0 rgba(0,0,0,0.18);
}

.cw-toggle > input:checked + .cw-toggle__switch::after{
  transform: translate(20px, -50%);
}

/* Focus clavier (accessibilité) */
.cw-toggle > input:focus-visible + .cw-toggle__switch{
  outline: none;
  box-shadow:
    0 0 0 3px rgba(74, 111, 165, 0.28),
    inset 0 1px 0 rgba(255,255,255,0.10);
}

/* ===== Context menu (réutilisable partout) ===== */
.cw-row-menu-btn{
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.10);
  background: rgba(255,255,255,0.85);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

.cw-row-menu-btn:hover{
  background: rgba(255,255,255,1);
  border-color: rgba(0,0,0,0.16);
  transform: translateY(-1px);
}

html.dark-mode .cw-row-menu-btn{
  background: rgba(30,30,30,0.75);
  border-color: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.88);
}

html.dark-mode .cw-row-menu-btn:hover{
  background: rgba(40,40,40,0.95);
  border-color: rgba(255,255,255,0.18);
}

.cw-context-menu{
  position: fixed;
  min-width: 200px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(0,0,0,0.10);
  box-shadow: 0 18px 40px rgba(0,0,0,0.18);
  z-index: 20000;
  display: none;
}

html.dark-mode .cw-context-menu{
  background: rgba(28,28,28,0.98);
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 18px 40px rgba(0,0,0,0.55);
}

.cw-context-item{
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #222;
  font-weight: 600;
  font-size: 13px;
  text-align: left;
}

html.dark-mode .cw-context-item{
  color: rgba(255,255,255,0.88);
}

.cw-context-item:hover{
  background: rgba(0,0,0,0.05);
}

html.dark-mode .cw-context-item:hover{
  background: rgba(255,255,255,0.07);
}

.cw-context-divider{
  height: 1px;
  margin: 6px 6px;
  background: rgba(0,0,0,0.08);
}

html.dark-mode .cw-context-divider{
  background: rgba(255,255,255,0.10);
}

.cw-context-item.is-danger{
  color: #d93025; /* rouge lisible */
}

html.dark-mode .cw-context-item.is-danger{
  color: #ff6b6b;
}

/* ===== Confirm modal: variant danger (OK en rouge) ===== */
.confirm-ok.is-danger{
  background: #e74c3c;
  border-color: #e74c3c;
  color: #fff;
}

.confirm-ok.is-danger:hover{
  background: #c0392b;
  border-color: #c0392b;
}

.confirm-ok.is-danger:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.25);
}

/* ===== Confirm modal : icon danger ===== */
.confirm-modal.is-danger .confirm-icon{
  background: rgba(231, 76, 60, 0.12);
  color: #e74c3c;
}

html.dark-mode .confirm-modal.is-danger .confirm-icon{
  background: rgba(231, 76, 60, 0.18);
  color: #ff6b6b;
}

/* ===== Confirm OK danger (dark mode clean) ===== */
html.dark-mode .confirm-ok.is-danger{
  background: #e74c3c;
  border-color: #e74c3c;
  box-shadow: none;          /* ❌ enlève le glow bleu */
  outline: none;
}

html.dark-mode .confirm-ok.is-danger:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.35);
}

html.dark-mode .confirm-ok.is-danger:hover{
  background: #c0392b;
  border-color: #c0392b;
}

.cw-caution-paid{
  font-weight: 750;
  color: #4a6fa5;
  white-space: nowrap;
}

html.dark-mode .cw-caution-paid{
  color: #8bb4ff;
}

/* ✅ FORCE couleur LOYER (gagne contre les styles td existants) */
.cw-table tbody td.cw-loyer{
  color: #2ecc71 !important;
}

html.dark-mode .cw-table tbody td.cw-loyer{
  color: #2ecc71 !important;
}

/* Statut (pill) */
.cw-pill{
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  font-weight: 750;
  font-size: 0.82rem;
  white-space: nowrap;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(0,0,0,0.03);
  color: rgba(0,0,0,0.72);
}

html.dark-mode .cw-pill{
  border-color: rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.78);
}

/* Vacant (vert doux) */
.cw-pill--vacant{
  background: rgba(46, 204, 113, 0.12);
  border-color: rgba(46, 204, 113, 0.22);
  color: #2ecc71;
}

html.dark-mode .cw-pill--vacant{
  background: rgba(46, 204, 113, 0.16);
  border-color: rgba(46, 204, 113, 0.28);
  color: #2ecc71;
}

/* =========================
   CONTACTS (TEL + EMAIL)
   ========================= */

.cw-contact{
  display:flex;
  flex-direction:column;
  gap:4px;
  line-height:1.2;
}

.cw-contact-phone{
  font-size:13px;
  font-weight:700;
  color:#111827;
  white-space:nowrap;
}

.cw-contact-email{
  font-size:12px;
  font-weight:500;
  color:#6b7280;
  white-space:nowrap;
}

/* Dark mode */
html.dark-mode .cw-contact-phone{
  color:#e5e7eb;
}

html.dark-mode .cw-contact-email{
  color:#9ca3af;
}

/* Par défaut : on cache la checkbox, on montre le menu */
.cw-row-checkwrap { display: none; }

/* Quand le mode groupé est actif sur la page */
.cw-bulk-on .cw-row-menu-btn { display: none; }
.cw-bulk-on .cw-row-checkwrap { display: inline-flex; align-items: center; justify-content: center; }

/* UI checkbox (style propre, discret) */
.cw-row-checkwrap { cursor: pointer; }
.cw-row-check { position: absolute; opacity: 0; pointer-events: none; }

.cw-row-checkui{
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.25);
  background: rgba(255,255,255,0.9);
  display: inline-block;
  position: relative;
}

html.dark-mode .cw-row-checkui{
  border-color: rgba(255,255,255,0.25);
  background: rgba(18,18,18,0.6);
}

.cw-row-check:checked + .cw-row-checkui{
  border-color: rgba(0,0,0,0.35);
}

.cw-row-check:checked + .cw-row-checkui::after{
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  opacity: 0.95;
}

/* =========================
   BADGES – SEXE
   ========================= */

/* Homme — BLEU */
.cw-badge-male {
  background-color: rgba(59, 130, 246, 0.12); /* bleu doux */
  color: #2563eb;                            /* bleu lisible */
  border: 1px solid rgba(59, 130, 246, 0.35);
}

/* Femme — VIOLET */
.cw-badge-female {
  background-color: rgba(168, 85, 247, 0.12); /* violet doux */
  color: #7c3aed;                             /* violet lisible */
  border: 1px solid rgba(168, 85, 247, 0.35);
}

/* =========================
   BADGES – SEXE (DARK MODE)
   ========================= */

html.dark-mode .cw-badge-male {
  background-color: rgba(59, 130, 246, 0.18);
  color: #93c5fd; /* bleu clair */
  border: 1px solid rgba(59, 130, 246, 0.4);
}

html.dark-mode .cw-badge-female {
  background-color: rgba(168, 85, 247, 0.18);
  color: #d8b4fe; /* violet clair */
  border: 1px solid rgba(168, 85, 247, 0.4);
}

/* =========================
   BADGES – STATUT LOYER
   ========================= */

.cw-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

/* À jour — VERT */
.cw-badge-success {
  background-color: rgba(34, 197, 94, 0.12);   /* vert doux */
  color: #16a34a;                              /* vert lisible */
  border: 1px solid rgba(34, 197, 94, 0.35);
}

/* En retard — ROUGE */
.cw-badge-danger {
  background-color: rgba(239, 68, 68, 0.12);   /* rouge doux */
  color: #dc2626;                              /* rouge lisible */
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* Avance — ORANGE */
.cw-badge-warning {
  background-color: rgba(249, 115, 22, 0.12);  /* orange doux */
  color: #ea580c;                              /* orange lisible */
  border: 1px solid rgba(249, 115, 22, 0.35);
}

/* Badge neutre (CNI / Passeport / Permis) */
html.dark-mode .cw-badge-neutral {
  background-color: rgba(148, 163, 184, 0.12); /* gris très doux */
  color: #cbd5f5;                              /* texte clair */
  border: 1px solid rgba(148, 163, 184, 0.25);
}

/* =========================
   SCROLL MODALES CW
   ========================= */

.cw-window-body{
  scrollbar-width: thin;
  scrollbar-color: rgba(74,111,165,0.45) transparent;
}

.cw-window-body::-webkit-scrollbar{
  width: 8px;
}

.cw-window-body::-webkit-scrollbar-track{
  background: transparent;
}

.cw-window-body::-webkit-scrollbar-thumb{
  background-color: rgba(74,111,165,0.35);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.cw-window-body::-webkit-scrollbar-thumb:hover{
  background-color: rgba(74,111,165,0.55);
}


/* =========================
   SCROLL GLOBAL APP
   ========================= */

html,
body{
  scrollbar-width: thin;                 /* Firefox */
  scrollbar-color: rgba(74,111,165,0.45) transparent;
}

/* Chrome / Edge / Safari */
html::-webkit-scrollbar,
body::-webkit-scrollbar{
  width: 10px;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track{
  background: transparent;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb{
  background-color: rgba(74,111,165,0.35); /* couleur app harmonisée */
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover{
  background-color: rgba(74,111,165,0.55);
}

.cw-namecell{
  display:flex;
  flex-direction:column;
  gap:4px;
  line-height:1.2;
}
.cw-namecell-top{ font-weight:700; }
.cw-namecell-sub{ font-size:12px; opacity:0.8; }

/* Notes */
.cw-notes{
  font-size:12px;
  line-height:1.3;
  opacity:0.9;
}

/* Dark mode */
html.dark-mode .cw-namecell-top{ color:#e5e7eb; }
html.dark-mode .cw-namecell-sub{ color:#9ca3af; }
html.dark-mode .cw-notes{ color:#d1d5db; }

.cw-badge-neutral {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background-color: rgba(148, 163, 184, 0.18); /* gris doux */
  color: #475569; /* gris lisible */
  border: 1px solid rgba(148, 163, 184, 0.35);
}

/* =========================
   LIGNES CLIQUABLES (NOTES)
   ========================= */

/* Ligne cliquable */
tr[data-cw-row]{
  cursor: pointer;
}

/* Évite la sélection de texte quand on clique/drag */
tr[data-cw-row] td{
  user-select: none;
}

/* MAIS on garde la sélection possible dans les zones utiles */
tr[data-cw-row] .cw-note-preview{
  user-select: text; /* si tu veux pouvoir copier la note */
}

/* Les vrais contrôles gardent leur curseur normal */
tr[data-cw-row] .cw-row-menu-btn,
tr[data-cw-row] .cw-row-checkwrap,
tr[data-cw-row] input,
tr[data-cw-row] button,
tr[data-cw-row] a{
  cursor: pointer;
}


/* Light */
.cw-table td.cw-money,
.cw-table td.cw-money-base,
.cw-table td.cw-money-paid,
.cw-table td.cw-money-due{
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .2px;
  white-space: nowrap;
}

.cw-table td.cw-money-base{ color:#1f2937 !important; }
.cw-table td.cw-money-paid{ color:#16a34a !important; }
.cw-table td.cw-money-due{  color:#dc2626 !important; }

/* Dark */
html.dark-mode .cw-table td.cw-money-base{ color:#cbd5f5 !important; }
html.dark-mode .cw-table td.cw-money-paid{ color:#86efac !important; }
html.dark-mode .cw-table td.cw-money-due{  color:#fca5a5 !important; }

.cw-table-pagination {
  display: flex;
  justify-content: center;
  padding: 12px 0;
}

.cw-pagination {
  display: flex;
  gap: 6px;
}

.cw-page {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 600;
  background: rgba(0,0,0,0.03);
  color: rgba(0,0,0,0.72);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s, transform 0.2s;
}

.cw-page:hover {
  background: rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.cw-page.active {
  background: #4a6fa5;
  color: #fff;
  cursor: default;
  transform: none;
  box-shadow: 0 4px 12px rgba(74,111,165,0.25);
}

.cw-page.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: rgba(0,0,0,0.02);
  transform: none;
}

.cw-page.dots {
  cursor: default;
  background: transparent;
  color: rgba(0,0,0,0.5);
}

.cw-page.dots:hover {
  background: transparent;
  transform: none;
}

/* Dark mode */
html.dark-mode .cw-page {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.78);
  border: 1px solid rgba(255,255,255,0.1);
}

html.dark-mode .cw-page:hover {
  background: rgba(255,255,255,0.12);
}

html.dark-mode .cw-page.active {
  background: #5a7bb5;
  box-shadow: 0 4px 12px rgba(90,123,181,0.3);
}

html.dark-mode .cw-page.disabled {
  background: rgba(255,255,255,0.02);
}

html.dark-mode .cw-page.dots {
  background: transparent;
  border-color: transparent;
  color: rgba(255,255,255,0.5);
}

.cw-month-pop {
  position: fixed;
  display: none;
  width: 220px;
  max-height: 280px;
  overflow-y: auto;
  
  /* Style élégant */
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.08),
    0 12px 32px rgba(0, 0, 0, 0.12);
  
  z-index: 9999;
  padding: 8px;
  
  /* Animation subtile */
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.cw-month-pop.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Style dark mode */
html.dark-mode .cw-month-pop {
  background: rgba(30, 30, 30, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.2),
    0 12px 32px rgba(0, 0, 0, 0.3);
}

/* Items */
.cw-month-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  margin: 2px 0;
  
  background: transparent;
  border: none;
  border-radius: 8px;
  
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.8);
  text-align: left;
  cursor: pointer;
  
  transition: all 0.12s ease;
}

/* Hover */
.cw-month-item:hover {
  background: rgba(74, 111, 165, 0.08);
  color: #4a6fa5;
}

/* Active (sélectionné) */
.cw-month-item.is-active {
  background: rgba(74, 111, 165, 0.12);
  color: #4a6fa5;
  font-weight: 600;
}

/* Indicateur de sélection (petit point bleu) */
.cw-month-item.is-active::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4a6fa5;
  margin-right: 10px;
}

/* Dark mode items */
html.dark-mode .cw-month-item {
  color: rgba(255, 255, 255, 0.85);
}

html.dark-mode .cw-month-item:hover {
  background: rgba(139, 180, 255, 0.08);
  color: #8bb4ff;
}

html.dark-mode .cw-month-item.is-active {
  background: rgba(139, 180, 255, 0.12);
  color: #8bb4ff;
}

html.dark-mode .cw-month-item.is-active::before {
  background: #8bb4ff;
}

/* Scrollbar */
.cw-month-pop::-webkit-scrollbar {
  width: 4px;
}

.cw-month-pop::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 3px;
  margin: 2px 0;
}

.cw-month-pop::-webkit-scrollbar-thumb {
  background: rgba(74, 111, 165, 0.3);
  border-radius: 3px;
}

.cw-month-pop::-webkit-scrollbar-thumb:hover {
  background: rgba(74, 111, 165, 0.4);
}

/* Dark mode scrollbar */
html.dark-mode .cw-month-pop::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
}

html.dark-mode .cw-month-pop::-webkit-scrollbar-thumb {
  background: rgba(139, 180, 255, 0.3);
}

html.dark-mode .cw-month-pop::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 180, 255, 0.4);
}

/* =========================
   PILL DU MOIS (bouton déclencheur)
   ========================= */

.cw-pill-month {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 20px;
  
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.1);
  
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.8);
  
  cursor: pointer;
  transition: all 0.2s ease;
}

.cw-pill-month:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(74, 111, 165, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.cw-pill-caret {
  font-size: 0.8rem;
  opacity: 0.6;
  transition: transform 0.2s ease;
}

.cw-pill-month:hover .cw-pill-caret {
  opacity: 0.8;
}

/* État ouvert */
.cw-month-wrap.active .cw-pill-month {
  background: rgba(74, 111, 165, 0.1);
  border-color: rgba(74, 111, 165, 0.3);
  color: #4a6fa5;
}

.cw-month-wrap.active .cw-pill-caret {
  transform: rotate(180deg);
}

/* Dark mode pill */
html.dark-mode .cw-pill-month {
  background: rgba(30, 30, 30, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.85);
}

html.dark-mode .cw-pill-month:hover {
  background: rgba(40, 40, 40, 0.9);
  border-color: rgba(139, 180, 255, 0.3);
}

html.dark-mode .cw-month-wrap.active .cw-pill-month {
  background: rgba(139, 180, 255, 0.12);
  border-color: rgba(139, 180, 255, 0.3);
  color: #8bb4ff;
}

/* =========================
   METRICS HEADER
   ========================= */

.cw-table-metrics {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: 12px;
}

/* Pills pour les totaux */
.cw-pill-total {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1;
  
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.7);
  color: rgba(0, 0, 0, 0.9);
}

.cw-pill-total strong {
  font-weight: 700;
}

/* Entrées (vert doux) */
.cw-pill-in {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.2);
  color: #166534;
}

/* Dépenses (rouge doux) */
.cw-pill-out {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
  color: #7f1d1d;
}

/* Net (bleu doux) */
.cw-pill-net {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.2);
  color: #1e40af;
}

/* Net négatif */
.cw-pill-net.is-negative {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
  color: #7f1d1d;
}

/* Dark mode totals */
html.dark-mode .cw-pill-total {
  background: rgba(30, 30, 30, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
}

html.dark-mode .cw-pill-in {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.25);
  color: #86efac;
}

html.dark-mode .cw-pill-out {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

html.dark-mode .cw-pill-net {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}

html.dark-mode .cw-pill-net.is-negative {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

/* =========================
   CODE CELL
   ========================= */

.cw-code{
  display:inline-block;
  font-weight:800;
  letter-spacing:0.2px;
  color:#111827;
}

html.dark-mode .cw-code{ color:#e5e7eb; }

/* =========================
   TRANSFERT (FOND/COMPTE)
   ========================= */

.cw-xfer{
  display:flex;
  flex-direction:column;
  gap:4px;
  line-height:1.15;
}

.cw-xfer-top{
  font-weight:800;
  font-size:12.5px;
  color:#111827;
}

.cw-xfer-mid{
  font-size:12px;
  opacity:0.75;
  display:flex;
  align-items:center;
  gap:6px;
}

.cw-xfer-bot{
  font-weight:700;
  font-size:12px;
  color:#6b7280;
}

html.dark-mode .cw-xfer-top{ color:#e5e7eb; }
html.dark-mode .cw-xfer-bot{ color:#9ca3af; }

/* Cell simple (fond / compte / représentant) */
.cw-linecell{
  display:flex;
  flex-direction:column;
  gap:4px;
  line-height:1.2;
}

.cw-linecell-top{
  font-weight:700;
  font-size:13px;
  color:#111827;
}

html.dark-mode .cw-linecell-top{ color:#e5e7eb; }

/* =========================
   RESPONSIVE - Badges sous le titre sur mobile
   ========================= */

@media (max-width: 768px) {
  /* Head du tableau en 2 lignes propres :
     ligne 1 = titre + compteur
     ligne 2 = badges métrics + recherche + imprimer
  */
  .cw-table-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .cw-table-head-left {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  /* Métrics passe sous le titre */
  .cw-table-metrics {
    margin-left: 0;
    margin-top: 4px;
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
  }
  
  /* Réduire encore un peu les badges en mobile */
  .cw-pill-total {
    padding: 5px 10px;
    font-size: 0.78rem;
  }
  
  /* Ajuster l'espacement du header right sur mobile */
  .cw-table-head-right {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  /* Recherche : prend la place dispo */
  .cw-search-wrap {
    width: 100%;
    max-width: none;
    flex: 1 1 auto;
  }

  /* Bouton imprimer : ne déborde jamais */
  .cw-table-head-right [data-cw-print] {
    flex: 0 0 auto;
    height: 44px;
  }
}


/* ===========================
   LOADER MOBILE - Style glass (iOS-like)
   =========================== */
@media (max-width: 768px) {
    .nav-loader-card {
        background: rgba(255, 255, 255, 0.75);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.3);
        box-shadow: 
            0 8px 32px rgba(0, 0, 0, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.6);
        padding: 1.5rem;
        border-radius: 20px;
    }
    
    html.dark-mode .nav-loader-card {
        background: rgba(30, 30, 30, 0.65);
        border: 1px solid rgba(255, 255, 255, 0.15);
        box-shadow: 
            0 8px 32px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    
    .nav-loader-icon {
        font-size: 1.8rem;
        color: #4a6fa5;
    }
    
    html.dark-mode .nav-loader-icon {
        color: #8bb4ff;
    }
    
    .nav-loader-text {
        display: none; /* Cache toujours le texte en mobile */
    }
}

