/* ==========================================================================
   NEXTOUR COMPTA - THEME CLAIR EPURE & EFFICACE (LIGHT ERP)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Couleurs de marque Nextour */
  --brand-teal: #008fa0;
  --brand-teal-light: #e6f7f9;
  --brand-teal-hover: #007685;
  --brand-orange: #ea580c;
  --brand-orange-light: #fff3ed;

  /* Thème clair & neutres */
  --bg-page: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-subtle: #f8fafc;
  --border-color: #cbd5e1;
  --border-light: #e2e8f0;
  --border-focus: #008fa0;

  /* Typographie & contraste */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* États */
  --color-success: #16a34a;
  --color-success-bg: #f0fdf4;
  --color-success-border: #bbf7d0;
  --color-error: #dc2626;
  --color-error-bg: #fef2f2;
  --color-error-border: #fecaca;
  --color-warning: #d97706;
  --color-warning-bg: #fffbeb;

  /* Polices & Tailles */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.view-section {
  display: none;
  width: 100%;
  height: 100%;
}

.view-section.active {
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   ECRAN DE CONNEXION (Simple, centré & net)
   ========================================================================== */
.login-wrapper {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #f8fafc;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 36px 30px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  text-align: center;
}

.logo-container {
  margin-bottom: 24px;
}

.brand-logo {
  height: 60px;
  width: auto;
  object-fit: contain;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}

.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-light);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.form-input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0, 143, 160, 0.15);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-primary {
  background: var(--color-success);
  color: #ffffff;
}

.btn-primary:hover {
  background: #15803d;
}

.btn-brand {
  background: var(--brand-teal);
  color: #ffffff;
}

.btn-brand:hover {
  background: var(--brand-teal-hover);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--text-muted);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8125rem;
}

.alert-banner {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
}

.alert-danger {
  background: var(--color-error-bg);
  border: 1px solid var(--color-error-border);
  color: var(--color-error);
}

/* ==========================================================================
   MODAL DE SELECTION DES SOCIETES (Capture 2)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal-card {
  width: 100%;
  max-width: 460px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 14px 18px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-title-icon {
  width: 18px;
  height: 18px;
  color: var(--brand-teal);
}

.modal-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-body {
  padding: 16px 18px;
  max-height: 55vh;
  overflow-y: auto;
}

.company-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.company-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.company-item:hover {
  background: var(--brand-teal-light);
  border-color: var(--brand-teal);
}

.company-item.selected {
  background: var(--brand-teal-light);
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 2px rgba(0, 143, 160, 0.2);
}

.company-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
}

.company-details {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-teal {
  background: var(--brand-teal-light);
  color: var(--brand-teal);
}

.badge-orange {
  background: var(--brand-orange-light);
  color: var(--brand-orange);
}

.badge-muted {
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.modal-footer {
  padding: 12px 18px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ==========================================================================
   APP HEADER
   ========================================================================== */
.app-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  flex-shrink: 0;
  position: relative;
  z-index: 600;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  height: 28px;
  width: auto;
}

.header-divider {
  width: 1px;
  height: 20px;
  background: var(--border-color);
}

.company-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-teal-light);
  border: 1px solid rgba(0, 143, 160, 0.25);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--brand-teal-hover);
}

.company-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-teal);
}

.company-pill-db {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-selector-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.btn-lang-toggle {
  background: transparent;
  border: none;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.btn-lang-toggle:hover {
  color: var(--text-main);
}

.btn-lang-toggle.active {
  background: var(--brand-teal);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  padding: 3px 10px;
  border-radius: 9999px;
  border: 1px solid var(--border-light);
}

.user-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand-teal);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.6875rem;
}

.user-name {
  font-size: 0.75rem;
  font-weight: 600;
}

.btn-logout {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  padding: 4px 10px;
  font-size: 0.75rem;
}

.btn-logout:hover {
  background: var(--color-error-bg);
  border-color: var(--color-error-border);
  color: var(--color-error);
}

/* ==========================================================================
   NAVIGATION MENU (Barre de Menu Extensible)
   ========================================================================== */
.app-nav {
  position: relative;
  z-index: 500;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  padding: 0 18px;
  display: flex;
  align-items: center;
  height: 38px;
  flex-shrink: 0;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}

.nav-item {
  position: relative;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.nav-btn:hover:not(.disabled) {
  background: #e2e8f0;
}

.nav-btn.active {
  background: var(--brand-teal);
  color: #ffffff;
}

.nav-btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  min-width: 250px;
  display: none;
  flex-direction: column;
  padding: 4px;
  margin-top: 2px;
  z-index: 1000;
}

.nav-dropdown-menu.show {
  display: flex;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: left;
  white-space: nowrap;
  transition: background 0.12s ease;
}

.dropdown-item:hover {
  background: var(--brand-teal-light);
  color: var(--brand-teal-hover);
}

.menu-tag-future {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  background: #e2e8f0;
  color: var(--text-muted);
  padding: 1px 4px;
  border-radius: 3px;
}

/* ==========================================================================
   DESKTOP HOME / ACCUEIL (Quand le facturier est fermé)
   ========================================================================== */
.desktop-home {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  padding: 30px;
}

.desktop-welcome-box {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 36px 40px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  max-width: 460px;
}

/* ==========================================================================
   LE FACTURIER - WORKSPACE & TABLE (Capture 4)
   ========================================================================== */
.facturier-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f1f5f9;
  padding: 10px 14px;
  gap: 8px;
}

/* Barre de filtres & recherche */
.facturier-filter-bar {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  flex-shrink: 0;
}

.filter-group-left, .filter-group-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
}

.filter-date-input {
  padding: 4px 8px;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  color: var(--text-main);
  background: #ffffff;
}

.filter-date-input:focus {
  border-color: var(--brand-teal);
}

.quick-search-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.quick-search-input {
  padding: 5px 8px;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  width: 180px;
}

.quick-search-input:focus {
  border-color: var(--brand-teal);
}

/* Body: Table + Actions Sidebar */
.facturier-body {
  flex: 1;
  display: flex;
  gap: 8px;
  overflow: hidden;
}

/* Table */
.table-container {
  flex: 1;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: auto;
  box-shadow: var(--shadow-sm);
}

.facturier-table {
  width: 100%;
  min-width: 1750px;
  border-collapse: collapse;
  font-size: 0.8125rem;
  text-align: left;
}

.facturier-table thead {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 5;
  border-bottom: 2px solid var(--border-color);
}

.facturier-table th {
  padding: 8px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.25px;
  white-space: nowrap;
  border-right: 1px solid var(--border-light);
  user-select: none;
}

.facturier-table th:last-child {
  border-right: none;
}

.facturier-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.1s ease;
}

.facturier-table tbody tr:hover {
  background: #f1f5f9;
}

.facturier-table tbody tr.selected {
  background: var(--brand-teal-light) !important;
  color: var(--text-main);
  outline: 1px solid var(--brand-teal);
}

.facturier-table td {
  padding: 6px 10px;
  white-space: nowrap;
  border-right: 1px solid var(--border-light);
  color: var(--text-main);
}

.facturier-table td:last-child {
  border-right: none;
}

.piece-num {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--brand-teal-hover);
}

.dossier-num {
  font-family: var(--font-mono);
  font-weight: 600;
  color: #0369a1;
}

.badge-facture {
  background: #e0f2fe;
  color: #0369a1;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.6875rem;
  font-weight: 700;
}

.badge-avoir {
  background: #fef3c7;
  color: #b45309;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.6875rem;
  font-weight: 700;
}

.check-icon-valid {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  background: #0f172a;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.check-icon-empty {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid #94a3b8;
  border-radius: 2px;
  background: #ffffff;
}

.table-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

/* Sidebar d'actions (Capture 4 droite) */
.facturier-actions-sidebar {
  width: 130px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.btn-action-side {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 6px 10px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-action-side:hover:not(:disabled) {
  background: var(--bg-subtle);
  border-color: var(--brand-teal);
  color: var(--brand-teal);
}

.btn-action-side:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: #f8fafc;
  border-color: var(--border-light);
}

.btn-act-primary {
  background: var(--brand-teal);
  border-color: var(--brand-teal);
  color: #ffffff;
}

.btn-act-primary:hover:not(:disabled) {
  background: var(--brand-teal-hover);
  border-color: var(--brand-teal-hover);
  color: #ffffff;
}

.btn-act-excel {
  display: none !important;
  color: #15803d;
}

.btn-act-excel:hover:not(:disabled) {
  background: var(--color-success-bg);
  border-color: var(--color-success);
  color: #15803d;
}

.btn-act-danger {
  color: var(--color-error);
}

.btn-act-danger:hover:not(:disabled) {
  background: var(--color-error-bg);
  border-color: var(--color-error);
  color: var(--color-error);
}

.action-divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 0;
}

/* Footer Status Bar */
.facturier-footer {
  height: 26px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Spinner */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 143, 160, 0.25);
  border-top-color: var(--brand-teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   FICHE FACTURE CLIENT (FEN_FACTURE_FICHE / Captures 6, 7 & PJ)
   ========================================================================== */
.invoice-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 2800 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.invoice-sheet-card {
  width: 1100px;
  max-width: 98vw;
  max-height: 96vh;
  background: #ffffff;
  border: 1px solid #94a3b8;
  border-radius: 6px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.invoice-sheet-header {
  height: 38px;
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  color: #ffffff;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  flex-shrink: 0;
}

.invoice-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.invoice-window-icon {
  font-size: 0.95rem;
}

.invoice-sheet-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
  color: #ffffff;
  letter-spacing: 0.01em;
}

.invoice-pill-num {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  background: rgba(255, 255, 255, 0.18);
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 700;
  color: #38bdf8;
}

.btn-window-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  transition: all 0.15s ease;
}

.btn-window-close:hover {
  background: #dc2626;
  color: #ffffff;
}

/* Alertes de Verrou & Validation */
.invoice-alert-banner {
  padding: 7px 14px;
  font-size: 0.8125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid transparent;
  flex-shrink: 0;
}

.alert-locked {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.alert-validated {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}

/* Corps de fiche */
.invoice-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.invoice-top-layout {
  display: flex;
  gap: 14px;
}

.invoice-fields-grid {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.inv-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.inv-field-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.inv-label {
  font-size: 0.725rem;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
}

.inv-input, .inv-select, .inv-textarea {
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 4px 6px;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  background: #ffffff;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s ease;
}

.inv-input:focus, .inv-select:focus, .inv-textarea:focus {
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 1px var(--brand-teal);
}

.inv-input-lookup-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-inv-lookup {
  padding: 4px 8px;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  font-weight: 700;
  font-size: 0.8125rem;
  cursor: pointer;
}

.btn-inv-lookup:hover:not(:disabled) {
  background: #cbd5e1;
}

.btn-inv-icon {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 4px 8px;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-inv-force-danger {
  background: #ffffff;
  border: 1px solid #fca5a5;
  color: #dc2626;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 3px;
  padding: 5px 8px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-inv-force-danger:hover {
  background: #fef2f2;
}

/* Panneau Droit : Totaux & Commandes */
.invoice-top-right-panel {
  width: 220px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.inv-totals-box {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.inv-tot-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
}

.inv-tot-label {
  color: #475569;
}

.inv-tot-val {
  font-weight: 600;
  color: #0f172a;
}

.inv-tot-ttc {
  border-top: 1px solid #e2e8f0;
  padding-top: 4px;
  margin-top: 2px;
}

.inv-tot-ttc .inv-tot-val {
  font-size: 0.9375rem;
  color: var(--brand-teal);
}

.inv-top-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.btn-inv-cmd {
  width: 100%;
  height: 29px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-inv-cmd:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #94a3b8;
}

.btn-inv-cmd:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f1f5f9;
}

.btn-inv-green {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
}

.btn-inv-green:hover:not(:disabled) {
  background: #15803d;
  border-color: #15803d;
  color: #ffffff;
}

/* Onglets */
.invoice-tabs-container {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.invoice-tab-nav {
  display: flex;
  background: #e2e8f0;
  border-bottom: 1px solid #cbd5e1;
}

.inv-tab-btn {
  padding: 8px 18px;
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.inv-tab-btn:hover {
  color: #1e293b;
}

.inv-tab-btn.active {
  background: #ffffff;
  color: var(--brand-teal);
  border-bottom: 2px solid var(--brand-teal);
}

.inv-tab-pane {
  display: none;
  padding: 12px;
}

.inv-tab-pane.active {
  display: block;
}

/* Onglet 1 : Customer & File Information */
.customer-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.customer-info-left, .customer-info-right {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.inv-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
}

.inv-textarea {
  width: 100%;
  resize: vertical;
}

/* Onglet 2 : Invoice Detail */
.detail-lines-wrapper {
  display: flex;
  gap: 10px;
}

.detail-lines-table-container {
  flex: 1;
  max-height: 270px;
  overflow: auto;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  background: #ffffff;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.775rem;
}

.detail-table th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  padding: 5px 6px;
  font-weight: 600;
  color: #334155;
  text-align: left;
  z-index: 2;
}

.detail-table td {
  border-bottom: 1px solid #f1f5f9;
  padding: 3px 6px;
  color: #0f172a;
}

.detail-table tr:hover {
  background: #f8fafc;
}

.detail-table tr.selected {
  background: #e0f2fe;
}

.detail-input {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 2px 4px;
  font-family: var(--font-sans);
  font-size: 0.775rem;
  color: inherit;
  border-radius: 2px;
}

.detail-input:focus {
  border-color: var(--brand-teal);
  background: #ffffff;
  outline: none;
}

.detail-input:disabled {
  cursor: not-allowed;
  color: #64748b;
  pointer-events: none;
}

.detail-table tfoot td {
  background: #f8fafc;
  border-top: 2px solid #cbd5e1;
  padding: 6px 8px;
}

.detail-lines-actions {
  width: 150px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.btn-line-cmd {
  width: 100%;
  padding: 5px 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  color: #1e293b;
  text-align: left;
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-line-cmd:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.btn-line-cmd:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: #f8fafc;
}

/* Pied de fiche */
.invoice-sheet-footer {
  height: 38px;
  background: #e2e8f0;
  border-top: 1px solid #cbd5e1;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.775rem;
  flex-shrink: 0;
}

.inv-footer-meta {
  display: flex;
  gap: 12px;
  color: #475569;
}

.inv-footer-checks {
  display: flex;
  gap: 16px;
}

.btn-inv-delete-red {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #ffffff;
  border: 1px solid #fca5a5;
  color: #dc2626;
  font-family: var(--font-sans);
  font-size: 0.775rem;
  font-weight: 700;
  border-radius: 3px;
  cursor: pointer;
}

.btn-inv-delete-red:hover:not(:disabled) {
  background: #fef2f2;
}

.btn-inv-delete-red:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: #e2e8f0;
  color: #94a3b8;
  background: #f8fafc;
}

/* ==========================================================================
   STYLE JAUNE PASTEL POUR FACTURE VALIDÉE (WinDev: JaunePastel / Capture 6, 7)
   ========================================================================== */
.invoice-locked-pastel input,
.invoice-locked-pastel select,
.invoice-locked-pastel textarea,
.invoice-locked-pastel .detail-table tbody td {
  background-color: #FFFFC8 !important;
  color: #1e293b !important;
  border-color: #fef08a !important;
  cursor: not-allowed;
}

.invoice-locked-pastel .detail-lines-table-container {
  background-color: #FFFFC8 !important;
}

/* ==========================================================================
   MODALES DE RECHERCHE CLIENTS & DOSSIERS [...]
   ========================================================================== */
.lookup-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 3500 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lookup-modal-card {
  width: 780px;
  max-width: 95vw;
  height: 82vh;
  background: #ffffff;
  border: 1px solid #94a3b8;
  border-radius: 6px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lookup-modal-header {
  height: 38px;
  background: #1e293b;
  color: #ffffff;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.lookup-modal-header h3 {
  font-size: 0.8125rem;
  margin: 0;
  color: #ffffff;
}

.lookup-modal-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.lookup-search-bar {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.lookup-search-input {
  flex: 1;
  padding: 6px 10px;
  font-size: 0.8125rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
}

.lookup-search-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.lookup-table-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
}

.lookup-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.775rem;
}

.lookup-table th {
  background: #f1f5f9;
  padding: 7px 10px;
  border-bottom: 1px solid #cbd5e1;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 2;
  font-weight: 600;
  color: #334155;
}

.lookup-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lookup-table tbody tr:hover {
  background: #e0f2fe;
}

.lookup-table tbody tr.selected {
  background-color: #bae6fd !important;
  font-weight: 600;
}

/* CXD Row Highlight WinDev (RougeClair + PoliceGras) */
.facturier-table tbody tr.row-cxd {
  background-color: #fee2e2 !important;
  font-weight: 700;
}

.facturier-table tbody tr.row-cxd:hover {
  background-color: #fecaca !important;
}

.facturier-table tbody tr.row-cxd.selected {
  background-color: #fca5a5 !important;
}

/* ==========================================================================
   POPUP DE DIALOGUE ERP MODERNE (ALERTE / CONFIRMATION - REMPLACE ALERT/CONFIRM)
   ========================================================================== */
.dialog-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999 !important;
  padding: 16px;
  animation: fadeInDialog 0.15s ease-out;
}

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

.dialog-modal-card {
  background: #ffffff;
  border-radius: 8px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  border: 1px solid #cbd5e1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: popDialog 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popDialog {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.dialog-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.dialog-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dialog-icon-wrap.icon-info {
  background: #e0f2fe;
  color: #0284c7;
}

.dialog-icon-wrap.icon-success {
  background: #dcfce7;
  color: #16a34a;
}

.dialog-icon-wrap.icon-warning {
  background: #fef3c7;
  color: #d97706;
}

.dialog-icon-wrap.icon-error {
  background: #fee2e2;
  color: #dc2626;
}

.dialog-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}

.dialog-modal-body {
  padding: 20px 18px;
  color: #334155;
  font-size: 0.9375rem;
  line-height: 1.5;
  white-space: pre-line;
}

.dialog-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

/* Modale Edition de Facture (FEN_FACTURE_CLIENT_EDITION) */
.edition-table-container {
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  max-height: 220px;
  overflow-y: auto;
}

.edition-mention-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.edition-mention-table tr {
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.12s ease;
  user-select: none;
}

.edition-mention-table tr:nth-child(even) {
  background-color: #f8fafc;
}

.edition-mention-table tr:hover {
  background-color: #e0f2fe;
}

.edition-mention-table tr.selected {
  background-color: #0284c7 !important;
  color: #ffffff !important;
  font-weight: 700;
}

.edition-mention-table td {
  padding: 7px 12px;
}

#invoice-edition-modal {
  z-index: 3200 !important;
}

#invoice-edition-modal .modal-card {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
  border: 1px solid #cbd5e1;
}

/* ==========================================================================
   MODULE FILES: LISTE ANALYTIQUE (Captures 2026-10-21_11h04_56 & 11h06_06)
   ========================================================================== */
.dossiers-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-page);
  padding: 14px 18px;
  overflow: hidden;
  height: calc(100vh - 48px - 38px);
}

.dossiers-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.dossiers-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dossiers-title-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dossiers-window-title {
  font-size: 0.9375rem;
  font-weight: 800;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.dossiers-sub-sep {
  color: var(--text-light);
  font-weight: 700;
}

.dossiers-annee-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--brand-teal);
  background: var(--brand-teal-light);
  padding: 2px 8px;
  border-radius: 4px;
}

.dossiers-search-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dossiers-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-danger-soft {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  font-weight: 600;
}

.btn-danger-soft:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

/* Grille & Tableau des dossiers */
.dossiers-grid-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.dossiers-table-wrapper {
  flex: 1;
  overflow: auto;
  position: relative;
}

.dossiers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.dossiers-table thead {
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  color: #ffffff;
}

.dossiers-table th {
  padding: 8px 10px;
  text-align: left;
  font-weight: 700;
  font-size: 0.78rem;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  user-select: none;
}

.dossiers-table th:hover {
  background: rgba(255, 255, 255, 0.1);
}

.dossiers-table th .sort-icon {
  font-size: 0.65rem;
  opacity: 0.7;
  margin-left: 3px;
}

.dossiers-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.1s ease;
}

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

.dossiers-table tbody tr:hover {
  background-color: #e0f2fe;
}

.dossiers-table tbody tr.selected {
  background-color: #0284c7 !important;
  color: #ffffff !important;
}

.dossiers-table tbody tr.selected td {
  color: #ffffff !important;
}

.dossiers-table td {
  padding: 7px 10px;
  color: var(--text-main);
  border-right: 1px solid var(--border-light);
}

.dossiers-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-color);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
  flex-shrink: 0;
}

/* Modale Exercices WinDev */
.windev-exercice-table {
  width: 100%;
  border-collapse: collapse;
}

.windev-exercice-row {
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.1s ease;
}

.windev-exercice-row:hover {
  background-color: #e0f2fe;
}

.windev-exercice-row.selected {
  background-color: #0284c7 !important;
  color: #ffffff !important;
}

.windev-exercice-row.selected td {
  color: #ffffff !important;
}

/* Formulaires ERP pour Modale Nouveau Dossier (Fidélité WinDev) */
.erp-form-row {
  display: flex;
  align-items: center;
  margin-bottom: 9px;
}

.erp-field-label {
  width: 105px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #1e293b;
  flex-shrink: 0;
}

.erp-field-control {
  flex: 1;
}

.erp-win-input,
.erp-win-select {
  height: 26px;
  border: 1px solid #94a3b8;
  border-radius: 3px;
  padding: 2px 7px;
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  background: #ffffff;
  color: #0f172a;
  box-sizing: border-box;
}

.erp-win-input:focus,
.erp-win-select:focus {
  border-color: #0284c7;
  outline: none;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.25);
}

/* Combobox de recherche Client (WinDev Look & Feel) */
.erp-searchable-combobox-wrap {
  position: relative;
  width: 270px;
}

.erp-combobox-input {
  width: 100%;
  height: 26px;
  background: #ffffff;
  border: 1px solid #94a3b8;
  border-radius: 3px;
  padding: 2px 24px 2px 7px;
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  color: #0f172a;
  box-sizing: border-box;
}

.erp-combobox-input:focus {
  border-color: #0284c7;
  outline: none;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.25);
}

.erp-combobox-arrow {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  width: 22px;
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
  border: 1px solid #cbd5e1;
  border-radius: 0 2px 2px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  color: #475569;
}

.erp-combobox-arrow:hover {
  background: #cbd5e1;
}

.erp-combobox-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #94a3b8;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  max-height: 220px;
  overflow-y: auto;
  z-index: 3500;
  margin-top: 2px;
}

.erp-combobox-item {
  padding: 6px 10px;
  font-size: 0.8125rem;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.1s ease;
}

.erp-combobox-item:hover,
.erp-combobox-item.active {
  background-color: #e0f2fe;
}

.erp-combobox-item.selected {
  background-color: #0284c7 !important;
  color: #ffffff !important;
  font-weight: 700;
}

.erp-combobox-item-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 175px;
}

.erp-combobox-item-meta {
  font-size: 0.75rem;
  color: #64748b;
  margin-left: 8px;
  flex-shrink: 0;
}

.erp-combobox-item.selected .erp-combobox-item-meta {
  color: #e0f2fe;
}

.erp-combobox-empty {
  padding: 10px;
  text-align: center;
  font-size: 0.8125rem;
  color: #94a3b8;
  font-style: italic;
}

/* Boutons d'Action WinDev (Valider / Annuler) */
.btn-windev-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  border: 1px solid #94a3b8;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  user-select: none;
  transition: all 0.12s ease;
}

.btn-windev-action:hover {
  background: #e2e8f0;
  border-color: #64748b;
}

.btn-windev-action:active {
  background: #cbd5e1;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
}

.windev-icon-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
}

.windev-icon-circle.green {
  background-color: #16a34a;
}

.windev-icon-circle.red {
  background-color: #dc2626;
}

/* Modales Dossiers (Fidélité WinDev) */
#modal-nouveau-dossier {
  z-index: 2400 !important;
}

#modal-nouveau-dossier .modal-card-dossier {
  background: #f1f3f5;
  border: 1px solid #64748b;
  box-shadow: 0 20px 35px rgba(0, 0, 0, 0.35);
  border-radius: 5px;
  overflow: visible !important;
}

#modal-nouveau-dossier .modal-header,
#modal-dossier-cree .modal-header {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  padding: 7px 12px;
  border-bottom: 1px solid #334155;
}

#modal-nouveau-dossier .modal-title,
#modal-dossier-cree .modal-title {
  color: #ffffff;
  font-size: 0.9375rem;
  font-weight: 700;
}

.modal-card-dossier-cree {
  background: #f8fafc;
  border: 1px solid #64748b;
  box-shadow: 0 25px 45px rgba(0, 0, 0, 0.45);
  border-radius: 5px;
}

/* ==========================================================================
   MODULE CLIENTS: FICHIER CLIENTS (Captures 2026-10-21_15h01_33 & 15h02_02)
   ========================================================================== */
.clients-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-page);
  padding: 14px 18px;
  overflow: hidden;
  height: calc(100vh - 48px - 38px);
}

.clients-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.clients-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.clients-title-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.clients-window-title {
  font-size: 0.9375rem;
  font-weight: 800;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.clients-sub-sep {
  color: var(--text-light);
  font-weight: 700;
}

.clients-count-badge {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--brand-teal);
  background: var(--brand-teal-light);
  padding: 2px 8px;
  border-radius: 12px;
}

.clients-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.clients-body-layout {
  flex: 1;
  display: flex;
  gap: 14px;
  min-height: 0;
}

.clients-grid-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-width: 0;
}

.clients-table-wrapper {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  background: #ffffff;
}

.clients-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  user-select: none;
}

.clients-table thead th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  padding: 7px 10px;
  border-bottom: 2px solid #cbd5e1;
  border-right: 1px solid #e2e8f0;
  text-align: left;
  white-space: nowrap;
  z-index: 10;
  cursor: pointer;
}

.clients-table thead th .sort-icon {
  font-size: 10px;
  opacity: 0.6;
  margin-left: 4px;
}

.clients-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.clients-table tbody tr:hover {
  background-color: #f8fafc;
}

.clients-table tbody tr.selected {
  background-color: #0284c7 !important;
  color: #ffffff !important;
}

.clients-table tbody tr.selected td {
  color: #ffffff !important;
  font-weight: 600;
}

.clients-table tbody td {
  padding: 6px 10px;
  border-right: 1px solid #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #1e293b;
}

.clients-table .scan-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 11px;
}

.clients-bottom-bar {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  gap: 10px;
  flex-shrink: 0;
}

.clients-actions-panel {
  width: 140px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.btn-side-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.15s ease;
  width: 100%;
  justify-content: flex-start;
}

.btn-side-action:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-side-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: #f8fafc;
  border-color: #e2e8f0;
}

.btn-side-action.btn-side-danger {
  color: #b91c1c;
}

.btn-side-action.btn-side-danger:hover:not(:disabled) {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.btn-side-icon {
  font-size: 14px;
}

/* Modal Demande Création Client (WinDev Haute Fidélité) */
#modal-demande-creation-client {
  z-index: 2500 !important;
}

#modal-demande-creation-client .modal-demande-client {
  background: #f1f3f5;
  border: 1px solid #64748b;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
  border-radius: 6px;
}

#modal-demande-creation-client .modal-header {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  padding: 8px 14px;
  border-bottom: 1px solid #334155;
}

#modal-demande-creation-client .modal-title {
  color: #ffffff;
  font-size: 0.9375rem;
  font-weight: 700;
}

.address-fieldset {
  background: #ffffff;
}

/* Modale Fiche Client (Consultation WinDev) */
#modal-fiche-client {
  z-index: 2500 !important;
}

#modal-fiche-client .modal-fiche-client-card {
  background: #f1f3f5;
  border: 1px solid #64748b;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.4);
  border-radius: 6px;
  overflow: hidden;
}

#modal-fiche-client .modal-header {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  padding: 8px 14px;
  border-bottom: 1px solid #334155;
}

#modal-fiche-client .modal-title {
  color: #ffffff;
  font-size: 0.9375rem;
  font-weight: 700;
}

.fc-input-ro {
  background-color: #f8fafc !important;
  color: #1e293b !important;
  border: 1px solid #cbd5e1 !important;
  cursor: default !important;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 3px;
}

.fc-tabs-bar {
  display: flex;
  background: #e2e8f0;
  border-bottom: 2px solid #0284c7;
  padding: 4px 6px 0 6px;
  gap: 4px;
}

.fc-tab-btn {
  background: #cbd5e1;
  color: #334155;
  border: 1px solid #94a3b8;
  border-bottom: none;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.fc-tab-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.fc-tab-btn.active {
  background: #ffffff;
  color: #0284c7;
  border-color: #0284c7 #0284c7 #ffffff #0284c7;
  font-weight: 700;
}

/* ============================================================================
   MODULE SOLDES PAR PIÈCE OU PAR DOSSIER (FEN_SOLDES_CLIENTS_PAR_PIECE_OU_DOSSIER)
   ============================================================================ */
.soldes-table {
  border-collapse: collapse;
  width: 100%;
}

.soldes-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  font-size: 11.5px;
  font-weight: 700;
  background-color: #e2e8f0;
  border-bottom: 2px solid #cbd5e1;
}

.soldes-table tbody tr {
  cursor: pointer;
  transition: background-color 0.12s ease;
  border-bottom: 1px solid #e2e8f0;
}

.soldes-table tbody tr:hover {
  background-color: #f1f5f9;
}

.soldes-table tbody tr.selected {
  background-color: #0284c7 !important;
  color: #ffffff !important;
}

.soldes-table tbody tr.selected td {
  color: #ffffff !important;
}

.soldes-table td {
  padding: 6px 10px;
  vertical-align: middle;
}

.soldes-table td.amount {
  font-family: monospace;
  font-weight: 600;
  text-align: right;
}

/* ============================================================================
   MODULE REPORTING : TABLEAU DE MARGE (FEN_MARGE_TABLEAU_DE_MARGE)
   ============================================================================ */

/* Modale 1 : Sélection Dossier (FEN_MARGE_TABLEAU_SELECT) */
#modal-marge-select {
  z-index: 2500 !important;
}

#modal-marge-select .modal-marge-card {
  background: #f8fafc;
  border: 1px solid #64748b;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.4);
  border-radius: 6px;
  overflow: hidden;
  width: 440px;
}

/* Modale 2 : Tableau de Marge (FEN_MARGE_TABLEAU_DE_MARGE) */
#modal-tableau-marge {
  z-index: 2400 !important;
}

.modal-tm-card {
  background: #f1f5f9;
  border: 1px solid #475569;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
  border-radius: 6px;
  overflow: hidden;
  width: 96vw;
  max-width: 1440px;
  height: 92vh;
  display: flex;
  flex-direction: column;
}

.tm-modal-header {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #334155;
  flex-shrink: 0;
}

.tm-header-banner {
  background: #ffffff;
  border-bottom: 1px solid #cbd5e1;
  padding: 10px 18px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tm-dossier-headline {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0369a1;
  margin-bottom: 8px;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tm-meta-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  font-size: 0.8125rem;
}

.tm-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tm-meta-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.4px;
}

.tm-meta-val {
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Conteneur 2 tables côte à côte */
.tm-main-content {
  flex: 1;
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  overflow: hidden;
  min-height: 0;
}

.tm-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  min-height: 0;
}

.tm-pane-title {
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
  border-bottom: 1px solid #cbd5e1;
  padding: 6px 12px;
  font-size: 0.8125rem;
  font-weight: 800;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.5px;
}

.tm-table-wrapper {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  min-height: 180px;
}

.tm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.tm-table thead th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  padding: 5px 8px;
  border-bottom: 2px solid #cbd5e1;
  border-right: 1px solid #e2e8f0;
  white-space: nowrap;
  z-index: 1;
}

.tm-table tbody tr {
  cursor: pointer;
  border-bottom: 1px solid #e2e8f0;
  transition: background-color 0.1s ease;
}

.tm-table tbody tr:hover {
  background: #f8fafc;
}

.tm-table tbody tr.selected {
  background: #0284c7 !important;
  color: #ffffff !important;
}

.tm-table tbody tr.selected td {
  color: #ffffff !important;
}

.tm-table td {
  padding: 5px 8px;
  border-right: 1px solid #f1f5f9;
  vertical-align: middle;
}

.tm-table td.amount {
  font-family: var(--font-mono);
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.tm-pane-sum-bar {
  background: #f8fafc;
  border-top: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
  padding: 6px 12px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #0f172a;
}

.tm-pane-sum-val {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: #0369a1;
}

/* Sous-table par devise */
.tm-devise-box {
  background: #fdfdfd;
  padding: 6px 12px;
  max-height: 110px;
  overflow-y: auto;
}

.tm-devise-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.tm-devise-table th {
  text-align: left;
  font-size: 0.6875rem;
  text-transform: uppercase;
  color: #64748b;
  padding: 3px 6px;
  border-bottom: 1px solid #e2e8f0;
}

.tm-devise-table td {
  padding: 3px 6px;
  border-bottom: 1px solid #f1f5f9;
}

/* Zone basse : Totaux, Marges et Commentaires */
.tm-bottom-section {
  background: #ffffff;
  border-top: 1px solid #cbd5e1;
  padding: 10px 16px;
  display: flex;
  gap: 16px;
  flex-shrink: 0;
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.03);
}

.tm-metrics-panel {
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
}

.tm-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tm-metric-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}

.tm-metric-input {
  width: 110px;
  height: 24px;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  font-weight: 700;
  text-align: right;
  background: #ffffff;
  color: #0f172a;
}

.tm-metric-input:read-only {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #cbd5e1;
}

.tm-comments-panel {
  flex: 1;
  display: flex;
  gap: 12px;
}

.tm-comm-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tm-comm-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
}

.tm-comm-textarea {
  flex: 1;
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 6px 8px;
  font-size: 0.75rem;
  font-family: var(--font-sans);
  resize: none;
  background: #ffffff;
  color: #0f172a;
  min-height: 60px;
}

.tm-comm-textarea:focus {
  border-color: #0284c7;
  outline: none;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.tm-footer-bar {
  background: #f8fafc;
  border-top: 1px solid #cbd5e1;
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

/* ==========================================================================
   MODALE FACTURE FOURNISSEUR (CONSULTATION FEN_FACTURE_FOURNISSEUR_FICHE)
   ========================================================================== */
#modal-facture-fournisseur {
  z-index: 2900 !important;
}

.modal-ff-card {
  width: 1140px;
  max-width: 98vw;
  height: 90vh;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  border: 1px solid #64748b;
  border-radius: 6px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.modal-ff-card .form-input[readonly] {
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  cursor: default;
}

.tm-col-achat-piece:hover {
  color: #0369a1 !important;
  text-decoration: underline;
}

