.facturation-page {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.facturation-tabs-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
}

.facturation-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.facturation-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

.facturation-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.facturation-tab.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.28), rgba(139, 92, 246, 0.22));
  box-shadow: 0 4px 18px rgba(236, 72, 153, 0.12);
}

.facturation-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
}

.facturation-topbar-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.facturation-topbar-right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-select-modern {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.06);
  color: #fff;
  border-radius: 14px;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
  backdrop-filter: blur(10px);
  min-width: 190px;
  height: 44px;
}

.filter-select-modern:hover {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.16);
}

.filter-select-modern:focus {
  outline: none;
  border-color: rgba(236,72,153,0.35);
  box-shadow: 0 0 0 4px rgba(236,72,153,0.12);
}

.filter-select-modern option {
  background: #0f172a;
  color: #fff;
}

.action-btn {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.06);
  color: #fff;
  border-radius: 14px;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
  backdrop-filter: blur(10px);
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.action-btn:hover {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.16);
  transform: translateY(-1px);
}

.action-btn.primary,
.action-btn.active {
  background: linear-gradient(135deg, rgba(236,72,153,0.24), rgba(139,92,246,0.24));
  border-color: rgba(236,72,153,0.35);
  box-shadow: 0 10px 25px rgba(236,72,153,0.15);
  color: #fff;
}

.facturation-card {
  padding: 0;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

/* Même famille visuelle que la liste Artificiers (artificiers-list-shell + artificiers-table) */
.documents-table-shell.documents-table-wrap {
  padding: 8px 16px 20px;
  overflow-x: auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.055) 0%,
    rgba(255, 255, 255, 0.03) 45%,
    rgba(139, 92, 246, 0.04) 100%
  );
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}

.documents-table-wrap {
  overflow-x: auto;
}

.documents-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
}

.documents-table thead th {
  text-align: left;
  padding: 6px 12px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.45);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
  background: transparent;
}

.documents-table thead .actions-col {
  text-align: right;
}

.documents-table tbody tr.documents-row {
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease;
}

.documents-table tbody tr.documents-row:hover {
  transform: translateY(-1px);
}

.documents-table tbody tr.documents-row:hover td.doc-cell {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 28px rgba(236, 72, 153, 0.08);
}

.documents-table tbody td.doc-cell {
  padding: 8px 12px;
  border: none;
  color: #fff;
  font-size: 13px;
  line-height: 1.3;
  vertical-align: middle;
  background: rgba(255, 255, 255, 0.045);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.documents-table tbody td.doc-cell:first-child {
  border-top-left-radius: 14px;
  border-bottom-left-radius: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.documents-table tbody td.doc-cell:last-child {
  border-top-right-radius: 14px;
  border-bottom-right-radius: 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  text-align: right;
  white-space: nowrap;
}

.documents-table tbody tr.documents-row:hover td.doc-cell:first-child {
  border-left-color: rgba(236, 72, 153, 0.35);
  box-shadow: inset 3px 0 0 0 rgba(236, 72, 153, 0.65);
}

.documents-table tbody tr.documents-row td.doc-cell {
  border-top-color: rgba(255, 255, 255, 0.06);
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.doc-cell-numero {
  width: 1%;
  white-space: nowrap;
}

.doc-numero-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.92);
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.18), rgba(139, 92, 246, 0.16));
  border: 1px solid rgba(236, 72, 153, 0.32);
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.1);
}

.documents-table tbody tr.documents-row:hover .doc-numero-pill {
  background: rgba(236, 72, 153, 0.12);
  border-color: rgba(236, 72, 153, 0.35);
}

.doc-cell-client {
  font-weight: 600;
  color: #fff;
  max-width: 220px;
}

.doc-cell-project {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
  max-width: 300px;
  vertical-align: middle;
}

.doc-project-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
  min-width: 0;
}

.doc-cell-date {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.52);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.doc-cell-total {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.doc-cell-actions {
  width: 1%;
  min-width: 172px;
  vertical-align: middle;
  text-align: right;
}

.actions-col {
  text-align: right;
}

.doc-actions-icons {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
  padding: 2px 4px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.07);
  width: max-content;
  max-width: none;
  margin-left: auto;
}

.doc-actions-icons .project-btn,
.doc-actions-icons button.project-btn {
  flex: 0 0 auto;
  margin: 0 !important;
}

/* Boutons : mêmes bases que .artificiers-table .project-btn */
.documents-table td .project-btn,
.documents-table td button.project-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
  backdrop-filter: blur(10px);
  margin: 0 !important;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.documents-table td .project-btn:hover,
.documents-table td button.project-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

.documents-table td .project-btn:focus-visible,
.documents-table td button.project-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(12, 18, 34, 0.95), 0 0 0 4px rgba(236, 72, 153, 0.45);
}

.documents-table td .project-btn.icon-btn,
.documents-table td button.project-btn.icon-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  border-radius: 8px;
}

.documents-table td .project-btn.icon-btn svg,
.documents-table td button.project-btn.icon-btn svg {
  width: 15px;
  height: 15px;
}

/* Variante destructive */
.documents-table td .delete-btn,
.documents-table td button.delete-btn {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
}

.documents-table td .delete-btn:hover,
.documents-table td button.delete-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fff;
}

/* Si besoin d'un vrai badge type plus tard */
.doc-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.doc-type-devis {
  background: rgba(59,130,246,0.12);
  color: #93c5fd;
  border: 1px solid rgba(59,130,246,0.25);
}

.doc-type-facture {
  background: rgba(34,197,94,0.12);
  color: #86efac;
  border: 1px solid rgba(34,197,94,0.25);
}

.empty-documents {
  text-align: center;
  padding: 40px 24px !important;
  color: rgba(255, 255, 255, 0.55) !important;
  font-size: 14px;
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px dashed rgba(255, 255, 255, 0.12) !important;
  border-radius: 16px !important;
  box-shadow: none !important;
}

.pdf-viewer-box {
  width: min(1200px, 92vw);
  height: 88vh;
  background: rgba(12, 18, 34, 0.96);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}

.pdf-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: #fff;
}

.pdf-viewer-header span {
  font-size: 15px;
  font-weight: 600;
}

.pdf-viewer-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

/* Modal premium */
#confirmModal.modal {
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(6px);
}

.modern-modal-content {
  width: min(440px, 92vw);
  background: rgba(12, 18, 34, 0.94);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 28px 24px 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  backdrop-filter: blur(18px);
  position: relative;
}

.modern-modal-content h2 {
  margin: 0 0 18px;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
}

.modern-modal-content .form-group {
  margin-bottom: 8px;
}

.modern-modal-content .form-group label {
  margin-bottom: 0;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255,255,255,0.78);
}

.modern-modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.modern-cancel-btn,
.modern-confirm-btn {
  border-radius: 14px;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
  backdrop-filter: blur(10px);
}

.modern-cancel-btn {
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.modern-cancel-btn:hover {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.16);
  transform: translateY(-1px);
}

.modern-confirm-btn {
  border: 1px solid rgba(236,72,153,0.35);
  background: linear-gradient(135deg, rgba(236,72,153,0.24), rgba(139,92,246,0.24));
  color: #fff;
  box-shadow: 0 10px 25px rgba(236,72,153,0.15);
}

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

.modern-modal-content .modal-close {
  top: 14px;
  right: 16px;
  font-size: 24px;
  color: rgba(255,255,255,0.56);
  transition: 0.2s ease;
}

.modern-modal-content .modal-close:hover {
  color: #fff;
}

@media (max-width: 1200px) {
  .documents-table {
    min-width: 1100px;
  }
}

@media (max-width: 980px) {
  .facturation-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .facturation-topbar-right {
    justify-content: flex-start;
  }

  .filter-select-modern {
    width: 100%;
  }
}