/* ==========================================================================
   CDVR Community — Récapitulatif Mensuel des Règlements de Locations (Paysage)
   ========================================================================== */

/* Conteneur principal plein écran */
.rental-recap-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #ffffff;
  color: #0f172a;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="dark"] .rental-recap-container {
  background: #0b1329;
  color: #f8fafc;
}

/* Forçage de l'orientation Paysage STRICTEMENT sur Mobile tactile tenu en Portrait */
@media (max-width: 900px) and (orientation: portrait) and (hover: none) and (pointer: coarse) {
  .rental-recap-container.force-landscape {
    width: 100vh !important;
    width: 100dvh !important;
    height: 100vw !important;
    height: 100dvw !important;
    transform: rotate(90deg) translateY(-100%);
    transform-origin: top left;
  }
}

/* Rotation manuelle forcée */
.rental-recap-container.manual-rotated {
  width: 100vh !important;
  width: 100dvh !important;
  height: 100vw !important;
  height: 100dvw !important;
  transform: rotate(90deg) translateY(-100%);
  transform-origin: top left;
}

/* Barre d'outils supérieure */
.rental-recap-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #ffffff;
  border-bottom: 1px solid #cbd5e1;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  z-index: 30;
}

[data-theme="dark"] .rental-recap-toolbar {
  background: #131d38;
  border-bottom-color: #233358;
}

.rental-recap-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.rental-recap-title-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(26, 99, 201, 0.1);
  color: var(--bleu_cdvr, #1a63c9);
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.4px;
  border: 1px solid rgba(26, 99, 201, 0.25);
  white-space: nowrap;
}

[data-theme="dark"] .rental-recap-title-badge {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}

.rental-recap-select {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  height: 34px;
  transition: all 0.15s ease;
}

[data-theme="dark"] .rental-recap-select {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}

.rental-recap-select:focus {
  border-color: var(--bleu_cdvr, #1a63c9);
  box-shadow: 0 0 0 2px rgba(26, 99, 201, 0.2);
}

.rental-recap-toolbar-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rental-recap-status-toggle {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
  border: 1px solid #e2e8f0;
}

[data-theme="dark"] .rental-recap-status-toggle {
  background: #1e293b;
  border-color: #334155;
}

.rental-recap-status-btn {
  border: none;
  background: transparent;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.15s ease;
  white-space: nowrap;
}

[data-theme="dark"] .rental-recap-status-btn {
  color: #94a3b8;
}

.rental-recap-status-btn.active {
  background: #ffffff;
  color: var(--bleu_cdvr, #1a63c9);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .rental-recap-status-btn.active {
  background: var(--bleu_cdvr, #1a63c9);
  color: #ffffff;
}

.rental-recap-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rental-recap-btn-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  height: 34px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

[data-theme="dark"] .rental-recap-btn-action {
  background: #1e293b;
  border-color: #334155;
  color: #cbd5e1;
}

.rental-recap-btn-action:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

[data-theme="dark"] .rental-recap-btn-action:hover {
  background: #334155;
  color: #ffffff;
}

.rental-recap-btn-close {
  background: #ef4444 !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
}

.rental-recap-btn-close:hover {
  background: #dc2626 !important;
}

/* Bandeau de synthèse ultra-compact (repliable) */
.rental-recap-kpi-summary-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 14px;
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  font-size: 0.76rem;
  color: #334155;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
  user-select: none;
}

[data-theme="dark"] .rental-recap-kpi-summary-strip {
  background: #101a33;
  border-bottom-color: #1e293b;
  color: #cbd5e1;
}

.rental-recap-kpi-summary-strip:hover {
  background: #e2e8f0;
}

[data-theme="dark"] .rental-recap-kpi-summary-strip:hover {
  background: #17274a;
}

.kpi-strip-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kpi-strip-sep {
  color: #94a3b8;
  font-weight: 700;
}

.kpi-strip-paid {
  color: #059669;
}
[data-theme="dark"] .kpi-strip-paid {
  color: #34d399;
}

.kpi-strip-due {
  color: #d97706;
}
[data-theme="dark"] .kpi-strip-due {
  color: #fbbf24;
}

.kpi-strip-future {
  color: #6366f1;
}
[data-theme="dark"] .kpi-strip-future {
  color: #818cf8;
}

.kpi-strip-avg {
  color: #0284c7;
}
[data-theme="dark"] .kpi-strip-avg {
  color: #38bdf8;
}

.kpi-strip-toggle-btn {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--bleu_cdvr, #1a63c9);
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(26, 99, 201, 0.08);
  border: 1px solid rgba(26, 99, 201, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

[data-theme="dark"] .kpi-strip-toggle-btn {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.25);
}

/* Grille détaillée des 4 cartes KPI */
.rental-recap-kpi-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
  overflow-x: auto;
  transition: all 0.2s ease;
}

.rental-recap-kpi-bar.collapsed {
  display: none !important;
}

[data-theme="dark"] .rental-recap-kpi-bar {
  background: #0f172a;
  border-bottom-color: #1e293b;
}

.rental-recap-kpi-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 12px;
  min-width: 170px;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .rental-recap-kpi-card {
  background: #17233f;
  border-color: #27385e;
}

.rental-recap-kpi-icon {
  font-size: 1.25rem;
}

.rental-recap-kpi-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

[data-theme="dark"] .rental-recap-kpi-label {
  color: #94a3b8;
}

.rental-recap-kpi-val {
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
}

[data-theme="dark"] .rental-recap-kpi-val {
  color: #f8fafc;
}

.rental-recap-kpi-sub {
  font-size: 0.68rem;
  font-weight: 600;
  color: #64748b;
}

.kpi-total .rental-recap-kpi-val { color: var(--bleu_cdvr, #1a63c9); }
[data-theme="dark"] .kpi-total .rental-recap-kpi-val { color: #38bdf8; }

.kpi-paid .rental-recap-kpi-val { color: #059669; }
[data-theme="dark"] .kpi-paid .rental-recap-kpi-val { color: #34d399; }

.kpi-pending .rental-recap-kpi-val { color: #d97706; }
[data-theme="dark"] .kpi-pending .rental-recap-kpi-val { color: #fbbf24; }

.kpi-future .rental-recap-kpi-val { color: #6366f1; }
[data-theme="dark"] .kpi-future .rental-recap-kpi-val { color: #818cf8; }

/* Zone du tableau quadrillé */
.rental-recap-table-wrapper {
  flex: 1 1 0%;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto !important;
  overflow-x: auto !important;
  position: relative;
  background: #ffffff;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  overscroll-behavior: contain;
  cursor: grab;
}

.rental-recap-table-wrapper:active {
  cursor: grabbing;
}

[data-theme="dark"] .rental-recap-table-wrapper {
  background: #0b1329;
}

/* Ascenseurs (Scrollbars) personnalisés, très visibles et faciles à attraper sur PC */
.rental-recap-table-wrapper::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.rental-recap-table-wrapper::-webkit-scrollbar-track {
  background: #e2e8f0;
  border-radius: 6px;
}

.rental-recap-table-wrapper::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 6px;
  border: 2px solid #e2e8f0;
}

.rental-recap-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

.rental-recap-table-wrapper::-webkit-scrollbar-corner {
  background: #cbd5e1;
}

/* Mode sombre */
[data-theme="dark"] .rental-recap-table-wrapper::-webkit-scrollbar-track {
  background: #17233f;
}

[data-theme="dark"] .rental-recap-table-wrapper::-webkit-scrollbar-thumb {
  background: #38bdf8;
  border: 2px solid #17233f;
}

[data-theme="dark"] .rental-recap-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #7dd3fc;
}

[data-theme="dark"] .rental-recap-table-wrapper::-webkit-scrollbar-corner {
  background: #101a33;
}

/* Support Firefox */
.rental-recap-table-wrapper {
  scrollbar-width: auto;
  scrollbar-color: #94a3b8 #e2e8f0;
}

[data-theme="dark"] .rental-recap-table-wrapper {
  scrollbar-color: #38bdf8 #17233f;
}

.rental-recap-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
  min-width: 1240px;
}

/* Boutons de navigation rapide pour défilement horizontal */
.rental-recap-nav-scroll-group {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 2px 4px;
  gap: 4px;
}

[data-theme="dark"] .rental-recap-nav-scroll-group {
  background: #17233f;
  border-color: #2a3d66;
}

.rental-recap-nav-scroll-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--bleu_cdvr, #1a63c9);
  border-radius: 6px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

[data-theme="dark"] .rental-recap-nav-scroll-btn {
  background: #1e2d4f;
  border-color: #334875;
  color: #38bdf8;
}

.rental-recap-nav-scroll-btn:hover {
  background: var(--bleu_cdvr, #1a63c9);
  color: #ffffff;
  border-color: var(--bleu_cdvr, #1a63c9);
  transform: scale(1.05);
}

[data-theme="dark"] .rental-recap-nav-scroll-btn:hover {
  background: #38bdf8;
  color: #0b1329;
  border-color: #38bdf8;
}

.rental-recap-nav-scroll-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #475569;
  padding: 0 4px;
  user-select: none;
}

[data-theme="dark"] .rental-recap-nav-scroll-label {
  color: #94a3b8;
}

.rental-recap-footer-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* En-tête */
.rental-recap-table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #f1f5f9;
  color: #334155;
  font-weight: 800;
  padding: 8px 10px;
  text-align: right;
  border-bottom: 2px solid #cbd5e1;
  border-right: 1px solid #e2e8f0;
  white-space: nowrap;
}

[data-theme="dark"] .rental-recap-table thead th {
  background: #17233f;
  color: #e2e8f0;
  border-bottom-color: #27385e;
  border-right-color: #233358;
}

.rental-recap-table thead th:first-child {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 30;
  text-align: left;
  min-width: 220px;
  max-width: 260px;
  background: #f1f5f9;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .rental-recap-table thead th:first-child {
  background: #17233f;
}

.rental-recap-table thead th.col-total {
  background: #e2ecf9;
  color: var(--bleu_cdvr, #1a63c9);
  min-width: 130px;
}

[data-theme="dark"] .rental-recap-table thead th.col-total {
  background: #1b3658;
  color: #38bdf8;
}

/* Lignes du corps */
.rental-recap-table tbody tr {
  transition: background 0.12s ease;
}

.rental-recap-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

[data-theme="dark"] .rental-recap-table tbody tr:nth-child(even) {
  background: #101a33;
}

.rental-recap-table tbody tr:hover {
  background: rgba(26, 99, 201, 0.05);
}

[data-theme="dark"] .rental-recap-table tbody tr:hover {
  background: rgba(56, 189, 248, 0.08);
}

.rental-recap-table tbody td {
  padding: 7px 10px;
  text-align: right;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #f1f5f9;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

[data-theme="dark"] .rental-recap-table tbody td {
  border-bottom-color: #1e293b;
  border-right-color: #16223d;
}

/* Colonne Loueur sticky gauche */
.rental-recap-table tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 10;
  background: #ffffff;
  text-align: left;
  font-weight: 700;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .rental-recap-table tbody td:first-child {
  background: #0b1329;
}

.rental-recap-table tbody tr:nth-child(even) td:first-child {
  background: #f8fafc;
}

[data-theme="dark"] .rental-recap-table tbody tr:nth-child(even) td:first-child {
  background: #101a33;
}

.rental-recap-table tbody tr:hover td:first-child {
  background: #eff6ff;
}

[data-theme="dark"] .rental-recap-table tbody tr:hover td:first-child {
  background: #17274a;
}

/* Cellule Loueur */
.renter-cell-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.renter-cell-name {
  font-weight: 700;
  font-size: 0.84rem;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-theme="dark"] .renter-cell-name {
  color: #f8fafc;
}

.renter-cell-sub {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 500;
}

[data-theme="dark"] .renter-cell-sub {
  color: #94a3b8;
}

.renter-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.renter-badge.regular {
  background: rgba(14, 165, 233, 0.15);
  color: #0284c7;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.renter-badge.occasional {
  background: rgba(168, 85, 247, 0.15);
  color: #9333ea;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

/* Cellule mensuelle */
.month-cell {
  cursor: pointer;
  transition: all 0.12s ease;
  position: relative;
}

.month-cell:hover {
  background: rgba(26, 99, 201, 0.12) !important;
  transform: scale(1.02);
}

.month-amount {
  font-weight: 700;
  font-size: 0.8rem;
}

.month-amount.zero {
  color: #94a3b8;
  font-weight: 500;
}

[data-theme="dark"] .month-amount.zero {
  color: #475569;
}

/* Badges de statuts dans les cellules */
.month-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.77rem;
}

.month-pill.paid-all {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .month-pill.paid-all {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

.month-pill.pending-past {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

[data-theme="dark"] .month-pill.pending-past {
  background: rgba(245, 158, 11, 0.22);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.45);
}

.month-pill.overdue-all {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

[data-theme="dark"] .month-pill.overdue-all {
  background: rgba(239, 68, 68, 0.22);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.45);
}

.month-pill.future-all {
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

[data-theme="dark"] .month-pill.future-all {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  border-color: rgba(99, 102, 241, 0.35);
}

.month-pill.mixed {
  background: rgba(100, 116, 139, 0.12);
  color: #334155;
  border: 1px solid rgba(100, 116, 139, 0.25);
}

[data-theme="dark"] .month-pill.mixed {
  background: rgba(100, 116, 139, 0.25);
  color: #cbd5e1;
  border-color: rgba(100, 116, 139, 0.4);
}

/* Colonne Total Loueur */
.cell-row-total {
  font-weight: 800;
  font-size: 0.85rem;
  background: rgba(26, 99, 201, 0.04);
}

[data-theme="dark"] .cell-row-total {
  background: rgba(56, 189, 248, 0.05);
}

.row-total-sub {
  font-size: 0.68rem;
  font-weight: 600;
  display: block;
}

/* Pied de tableau (TFOOT) */
.rental-recap-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: #f1f5f9;
  color: #0f172a;
  font-weight: 800;
  font-size: 0.84rem;
  padding: 10px 10px;
  text-align: right;
  border-top: 2px solid #94a3b8;
  border-right: 1px solid #cbd5e1;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .rental-recap-table tfoot td {
  background: #17233f;
  color: #f8fafc;
  border-top-color: #334155;
  border-right-color: #27385e;
}

.rental-recap-table tfoot td:first-child {
  position: sticky;
  left: 0;
  bottom: 0;
  z-index: 30;
  background: #f1f5f9;
  text-align: left;
  box-shadow: 2px -2px 5px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .rental-recap-table tfoot td:first-child {
  background: #17233f;
}

.rental-recap-table tfoot td.col-total {
  background: #dbe8f7;
  color: var(--bleu_cdvr, #1a63c9);
  font-size: 0.92rem;
}

[data-theme="dark"] .rental-recap-table tfoot td.col-total {
  background: #1e3f6b;
  color: #38bdf8;
}

/* Pied de page modal / informations d'aide */
.rental-recap-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  font-size: 0.74rem;
  color: #64748b;
  flex-shrink: 0;
}

[data-theme="dark"] .rental-recap-footer-bar {
  background: #131d38;
  border-top-color: #233358;
  color: #94a3b8;
}

/* Modal détail d'un mois / loueur */
.recap-detail-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.recap-detail-dialog {
  background: #ffffff;
  border-radius: 14px;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  border: 1px solid #cbd5e1;
}

[data-theme="dark"] .recap-detail-dialog {
  background: #17233f;
  border-color: #27385e;
  color: #f8fafc;
}

.recap-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

[data-theme="dark"] .recap-detail-header {
  background: #131d38;
  border-bottom-color: #233358;
}

.recap-detail-header h3 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
  color: #0f172a;
}

[data-theme="dark"] .recap-detail-header h3 {
  color: #f8fafc;
}

.recap-detail-body {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
}

/* Synthese Pills dans l'en-tête */
.recap-detail-summary-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.recap-summary-pill {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.recap-summary-pill.total {
  background: rgba(26, 99, 201, 0.1);
  color: #1a63c9;
}

.recap-summary-pill.paid {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.recap-summary-pill.unpaid {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
  font-weight: 800;
}

/* Groupe par réservation */
.recap-group-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .recap-group-card {
  background: #101a33;
  border-color: #233358;
}

.recap-group-header {
  padding: 9px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

[data-theme="dark"] .recap-group-header {
  background: #162244;
  border-bottom-color: #233358;
}

.recap-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
  flex-wrap: wrap;
}

[data-theme="dark"] .recap-group-title {
  color: #f1f5f9;
}

/* Lignes compactes par séance */
.recap-session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.82rem;
  transition: background 0.15s ease;
  gap: 10px;
}

[data-theme="dark"] .recap-session-row {
  border-bottom-color: #1a284a;
}

.recap-session-row:last-child {
  border-bottom: none;
}

.recap-session-row:hover {
  background: #f8fafc;
}

[data-theme="dark"] .recap-session-row:hover {
  background: #172445;
}

.recap-session-date {
  font-weight: 700;
  color: #0f172a;
  min-width: 125px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

[data-theme="dark"] .recap-session-date {
  color: #f8fafc;
}

.recap-session-badge {
  font-size: 0.73rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.recap-badge-paid {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.recap-badge-pending {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
}

.recap-badge-overdue {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
  font-weight: 800;
}

.recap-session-amount {
  font-weight: 800;
  font-size: 0.95rem;
  color: #1a63c9;
  min-width: 80px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

[data-theme="dark"] .recap-session-amount {
  color: #38bdf8;
}

.recap-detail-item {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 10px;
  gap: 8px;
}

[data-theme="dark"] .recap-detail-item {
  background: #101a33;
  border-color: #233358;
  color: #e2e8f0;
}

.recap-slot-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 600;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 2px 7px;
  color: #1e293b;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .recap-slot-chip {
  background: #17233f;
  border-color: #2e4374;
  color: #f1f5f9;
}

.recap-slot-chip .chip-time {
  color: #0284c7;
  font-weight: 700;
  font-size: 0.72rem;
}

[data-theme="dark"] .recap-slot-chip .chip-time {
  color: #38bdf8;
}

/* Interrupteur Mode Affichage (Chiffres / Graphique) */
.rental-recap-view-toggle {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
  border: 1px solid #cbd5e1;
  gap: 2px;
}

[data-theme="dark"] .rental-recap-view-toggle {
  background: #1e293b;
  border-color: #334155;
}

.rental-recap-mode-btn {
  border: none;
  background: transparent;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

[data-theme="dark"] .rental-recap-mode-btn {
  color: #94a3b8;
}

.rental-recap-mode-btn.active {
  background: var(--bleu_cdvr, #1a63c9);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(26, 99, 201, 0.35);
}

[data-theme="dark"] .rental-recap-mode-btn.active {
  background: #38bdf8;
  color: #0b1329;
}

/* ==========================================================================
   MODE GRAPHIQUE (Histogramme 12 mois + Barres horizontales)
   ========================================================================== */

.rental-recap-chart-wrapper {
  flex: 1 1 0%;
  min-height: 0;
  height: 0;
  overflow-y: auto !important;
  overflow-x: hidden;
  padding: 12px 16px;
  display: block;
  background: #f8fafc;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
}

[data-theme="dark"] .rental-recap-chart-wrapper {
  background: #0b1329;
}

.rental-recap-chart-wrapper::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.rental-recap-chart-wrapper::-webkit-scrollbar-track {
  background: #e2e8f0;
  border-radius: 5px;
}

.rental-recap-chart-wrapper::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 5px;
  border: 2px solid #e2e8f0;
}

.rental-recap-chart-wrapper::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

[data-theme="dark"] .rental-recap-chart-wrapper::-webkit-scrollbar-track {
  background: #17233f;
}

[data-theme="dark"] .rental-recap-chart-wrapper::-webkit-scrollbar-thumb {
  background: #38bdf8;
  border: 2px solid #17233f;
}

.rental-recap-chart-wrapper {
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 #e2e8f0;
}

[data-theme="dark"] .rental-recap-chart-wrapper {
  scrollbar-color: #38bdf8 #17233f;
}

/* Onglets sous-mode Graphique (Histogramme / Classement / Tout) */
.rental-chart-tab-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  background: #e2e8f0;
  border-radius: 8px;
  padding: 3px;
  gap: 4px;
  margin-bottom: 12px;
}

[data-theme="dark"] .rental-chart-tab-bar {
  background: #1e293b;
}

.rental-chart-tab-btn {
  border: none;
  background: transparent;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.15s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

[data-theme="dark"] .rental-chart-tab-btn {
  color: #94a3b8;
}

.rental-chart-tab-btn.active {
  background: #ffffff;
  color: var(--bleu_cdvr, #1a63c9);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .rental-chart-tab-btn.active {
  background: var(--bleu_cdvr, #1a63c9);
  color: #ffffff;
}

.rental-chart-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
}

[data-theme="dark"] .rental-chart-card {
  background: #131d38;
  border-color: #233358;
}

.rental-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.rental-chart-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

[data-theme="dark"] .rental-chart-title {
  color: #f8fafc;
}

.rental-chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.74rem;
  font-weight: 700;
  flex-wrap: wrap;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #475569;
}

[data-theme="dark"] .chart-legend-item {
  color: #94a3b8;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.dot-paid { background: #10b981; }
.dot-pending { background: #f59e0b; }
.dot-overdue { background: #ef4444; }
.dot-future { background: #818cf8; }

/* Conteneur principal de l'histogramme */
.rental-histogram-area {
  display: flex;
  align-items: stretch;
  height: 240px;
  position: relative;
  margin-top: 10px;
  padding-left: 55px; /* espace pour l'axe Y */
  padding-bottom: 35px; /* espace pour les labels de mois */
}

/* Grille de fond et Axe Y */
.histogram-y-axis {
  position: absolute;
  top: 0;
  bottom: 35px;
  left: 0;
  width: 50px;
  display: flex;
  flex-direction: column-reverse;
  justify-content: space-between;
  pointer-events: none;
  font-size: 0.68rem;
  font-weight: 700;
  color: #94a3b8;
  text-align: right;
  padding-right: 6px;
}

.histogram-grid-lines {
  position: absolute;
  top: 0;
  bottom: 35px;
  left: 55px;
  right: 0;
  display: flex;
  flex-direction: column-reverse;
  justify-content: space-between;
  pointer-events: none;
}

.histogram-grid-line {
  border-top: 1px dashed #e2e8f0;
  width: 100%;
}

[data-theme="dark"] .histogram-grid-line {
  border-top-color: #1e293b;
}

/* Zone des 12 barres mensuelles */
.histogram-bars-container {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 5;
  gap: 8px;
}

.histogram-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end; /* ancre les barres sur la ligne de base (en bas) */
  height: 100%;
  position: relative;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.histogram-bar-col:hover {
  transform: translateY(-2px);
}

.histogram-bar-col:hover .bar-track-wrapper {
  filter: brightness(1.08);
}

/* Montant au dessus de la barre */
.bar-amount-top {
  position: absolute;
  top: -22px;
  font-size: 0.68rem;
  font-weight: 800;
  color: #334155;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.9);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  pointer-events: none;
  opacity: 0.95;
}

[data-theme="dark"] .bar-amount-top {
  background: rgba(19, 29, 56, 0.95);
  color: #f8fafc;
  border-color: #27385e;
}

/* Piste de la barre (track) */
.bar-track-wrapper {
  width: 70%;
  max-width: 44px;
  min-width: 16px;
  height: 100%;          /* prend toute la hauteur de la colonne */
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
  border-radius: 6px 6px 2px 2px;
  overflow: hidden;
  background: rgba(226, 232, 240, 0.4);
  transition: all 0.3s ease;
  position: relative;
}

[data-theme="dark"] .bar-track-wrapper {
  background: rgba(30, 41, 59, 0.5);
}

/* Segments empilés de la barre */
.bar-segment {
  width: 100%;
  transition: height 0.35s ease;
  position: relative;
}

.seg-paid {
  background: linear-gradient(180deg, #34d399, #059669);
}

.seg-pending {
  background: linear-gradient(180deg, #fbbf24, #d97706);
}

.seg-overdue {
  background: linear-gradient(180deg, #f87171, #dc2626);
}

.seg-future {
  background: linear-gradient(180deg, #a5b4fc, #6366f1);
}

/* Base vide (0 F) */
.bar-zero-line {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: #cbd5e1;
}

[data-theme="dark"] .bar-zero-line {
  background: #334155;
}

/* Label mois SOUS la barre (dans la zone padding du graphique) */
.bar-label-bottom {
  position: absolute;
  top: 100%;            /* juste en dessous de la colonne */
  height: 35px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}

.bar-month-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: #334155;
  line-height: 1;
}

[data-theme="dark"] .bar-month-name {
  color: #cbd5e1;
}

.bar-month-year {
  font-size: 0.60rem;
  font-weight: 500;
  color: #94a3b8;
  margin-top: 2px;
}

[data-theme="dark"] .bar-month-year {
  color: #64748b;
}

/* ==========================================================================
   GRAPHIQUE SECONDAIRE : Barres horizontales par Loueur / Espace
   ========================================================================== */

.rental-hbars-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rental-hbar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.12s ease;
}

.rental-hbar-item:hover {
  background: rgba(26, 99, 201, 0.05);
}

[data-theme="dark"] .rental-hbar-item:hover {
  background: rgba(56, 189, 248, 0.08);
}

.hbar-renter-info {
  width: 220px;
  min-width: 180px;
  flex-shrink: 0;
  overflow: hidden;
}

.hbar-renter-name {
  font-weight: 700;
  font-size: 0.84rem;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="dark"] .hbar-renter-name {
  color: #f8fafc;
}

.hbar-renter-sub {
  font-size: 0.7rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hbar-track {
  flex: 1;
  height: 22px;
  background: #f1f5f9;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  position: relative;
  border: 1px solid #e2e8f0;
}

[data-theme="dark"] .hbar-track {
  background: #1e293b;
  border-color: #334155;
}

.hbar-fill-paid {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  transition: width 0.3s ease;
}

.hbar-fill-due {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #d97706);
  transition: width 0.3s ease;
}

.hbar-fill-overdue {
  height: 100%;
  background: linear-gradient(90deg, #ef4444, #dc2626);
  transition: width 0.3s ease;
}

.hbar-fill-future {
  height: 100%;
  background: linear-gradient(90deg, #818cf8, #6366f1);
  transition: width 0.3s ease;
}

.hbar-amount-label {
  width: 140px;
  text-align: right;
  font-weight: 800;
  font-size: 0.86rem;
  color: #0f172a;
  flex-shrink: 0;
}

[data-theme="dark"] .hbar-amount-label {
  color: #f8fafc;
}

.hbar-amount-sub {
  font-size: 0.68rem;
  font-weight: 600;
  color: #059669;
}

/* Styles pour l'impression / export PDF */
@media print {
  body * {
    visibility: hidden;
  }
  .rental-recap-container,
  .rental-recap-container * {
    visibility: visible;
  }
  .rental-recap-container {
    position: absolute;
    left: 0;
    top: 0;
    width: 100% !important;
    height: auto !important;
    transform: none !important;
    overflow: visible !important;
    background: #ffffff !important;
    color: #000000 !important;
  }
  .rental-recap-toolbar-right,
  .rental-recap-status-toggle,
  .rental-recap-view-toggle,
  .hide-print {
    display: none !important;
  }
  .rental-recap-table-wrapper,
  .rental-recap-chart-wrapper {
    overflow: visible !important;
  }
  .rental-recap-table thead th,
  .rental-recap-table tfoot td,
  .rental-recap-table tbody td:first-child {
    position: static !important;
    box-shadow: none !important;
  }
}

/* ==========================================================================
   OPTIMISATIONS COMPACTES STRICTES : MOBILE PAYSAGE & PETITES HAUTEURS (< 600px)
   Maximise la surface utile de données (tableaux/graphiques)
   ========================================================================== */

@media (max-height: 600px), (max-width: 900px) {
  /* Toolbar compacte */
  .rental-recap-toolbar {
    padding: 3px 8px;
    gap: 6px;
    min-height: 36px;
  }

  .rental-recap-title-badge {
    padding: 2px 6px;
    font-size: 0.72rem;
  }

  .rental-recap-title-text {
    display: none; /* Cache le libellé long pour libérer de l'espace horizontal */
  }

  .rental-recap-select {
    height: 28px;
    padding: 2px 6px;
    font-size: 0.75rem;
    max-width: 135px;
  }

  .rental-recap-mode-btn {
    padding: 2px 7px;
    font-size: 0.73rem;
  }

  .rental-recap-status-btn {
    padding: 2px 7px;
    font-size: 0.72rem;
  }

  .rental-recap-btn-action {
    height: 28px;
    padding: 2px 7px;
    font-size: 0.75rem;
  }

  /* Bandeau synthèse repliable */
  .rental-recap-kpi-summary-strip {
    padding: 2px 10px;
    font-size: 0.7rem;
    min-height: 22px;
  }

  /* Cartes KPI si déployées manuellement */
  .rental-recap-kpi-bar {
    padding: 4px 8px;
    gap: 8px;
  }

  .rental-recap-kpi-card {
    padding: 3px 8px;
    min-width: 125px;
    gap: 6px;
  }

  .rental-recap-kpi-val {
    font-size: 0.82rem;
  }

  .rental-recap-kpi-icon {
    font-size: 0.95rem;
  }

  .rental-recap-kpi-label {
    font-size: 0.62rem;
  }

  /* Tableau quadrillé ultra-dense */
  .rental-recap-table {
    font-size: 0.74rem;
  }

  .rental-recap-table thead th {
    padding: 3px 5px;
    font-size: 0.71rem;
    line-height: 1.1;
  }

  .rental-recap-table thead th:first-child {
    min-width: 140px;
    max-width: 170px;
  }

  .rental-recap-table tbody td {
    padding: 2px 5px;
    font-size: 0.73rem;
    height: 27px;
  }

  .renter-cell-name {
    font-size: 0.75rem;
    line-height: 1.1;
  }

  .renter-cell-sub {
    font-size: 0.64rem;
    line-height: 1;
  }

  .renter-badge {
    font-size: 0.58rem;
    padding: 1px 3px;
  }

  .month-pill {
    padding: 1px 4px;
    font-size: 0.69rem;
    border-radius: 4px;
  }

  /* Ligne TOTAL MENSUEL en bas de tableau */
  .rental-recap-table tfoot td {
    padding: 3px 5px;
    font-size: 0.73rem;
    line-height: 1.1;
  }

  .rental-recap-table tfoot td.col-total {
    font-size: 0.79rem;
  }

  /* MASQUAGE COMPLET de la barre de légende inférieure pour dégager la zone utile */
  .rental-recap-footer-bar {
    display: none !important;
  }

  /* Mode graphique compact */
  .rental-chart-tab-bar {
    padding: 2px;
    gap: 2px;
    margin-bottom: 2px;
  }

  .rental-chart-tab-btn {
    padding: 2px 7px;
    font-size: 0.68rem;
  }

  .rental-recap-chart-wrapper {
    padding: 8px 10px;
  }

  .rental-chart-card {
    padding: 10px 12px;
    margin-bottom: 10px;
  }

  .rental-chart-header {
    margin-bottom: 8px;
  }

  .rental-histogram-area {
    height: 150px;
    padding-bottom: 24px;
    padding-left: 45px;
  }

  .histogram-y-axis {
    bottom: 24px;
    width: 40px;
    font-size: 0.6rem;
  }

  .histogram-grid-lines {
    bottom: 24px;
    left: 45px;
  }

  .bar-amount-top {
    font-size: 0.6rem;
    top: -18px;
    padding: 0 3px;
  }

  .bar-track-wrapper {
    height: calc(100% - 24px);
  }

  .bar-month-name {
    font-size: 0.65rem;
  }

  .bar-month-year {
    font-size: 0.55rem;
  }

  .hbar-renter-info {
    width: 140px;
    min-width: 110px;
  }

  .hbar-track {
    height: 18px;
  }

  .hbar-amount-label {
    width: 100px;
    font-size: 0.75rem;
  }
}

