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

:root {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-card: #222639;
  --bg-hover: #2a2e42;
  --border: #2e3348;
  --text-primary: #e8eaf0;
  --text-secondary: #8b8fa3;
  --text-muted: #5c6078;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.12);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.12);
  --orange: #f59e0b;
  --orange-bg: rgba(245, 158, 11, 0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

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

body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
}
.btn-danger:hover {
  background: var(--red);
  color: white;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-success {
  background: var(--green);
  color: white;
}
.btn-success:hover {
  background: #16a34a;
  transform: translateY(-1px);
}

.btn-accent {
  background: var(--primary);
  color: white;
}
.btn-accent:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.facture-progress {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
}
.facture-progress-bar {
  height: 100%;
  background: var(--green);
  border-radius: 6px;
  transition: width 0.3s ease;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Barre boutons devis */
.devis-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.devis-actions-left,
.devis-actions-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Bandeau statut devis (mode lecture seule) */
.devis-readonly-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--green-bg);
  border: 1px solid var(--green);
  margin-bottom: 16px;
}
.devis-readonly-banner .devis-statut-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--green);
}
.devis-readonly-banner .devis-statut-actions {
  display: flex;
  gap: 8px;
}

/* Inputs */
input, select {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

input:focus, select:focus {
  border-color: var(--accent);
}

input::placeholder {
  color: var(--text-muted);
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.header h1 {
  font-size: 20px;
  font-weight: 700;
}

.header h1 span {
  color: var(--accent);
}

/* Auth page */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-box {
  width: 100%;
  max-width: 400px;
}

.auth-box h1 {
  font-size: 28px;
  margin-bottom: 8px;
  text-align: center;
}

.auth-box h1 span {
  color: var(--accent);
}

.auth-box p {
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 32px;
  font-size: 14px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form .btn {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 15px;
}

.auth-toggle {
  text-align: center;
  margin-top: 20px;
  color: var(--text-secondary);
  font-size: 13px;
}

.auth-toggle a {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.auth-toggle a:hover {
  text-decoration: underline;
}

.error-msg {
  background: var(--red-bg);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: none;
}

.error-msg.visible {
  display: block;
}

/* Zone de drop */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.06);
  color: var(--text-primary);
}

.drop-zone .icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.drop-zone .title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.drop-zone .subtitle {
  font-size: 13px;
}

/* Tableau des opérations */
.ops-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ops-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.ops-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.ops-table tbody tr:hover {
  background: var(--bg-hover);
}

.ops-table td {
  padding: 10px 12px;
  vertical-align: middle;
}

.ops-table .amount {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  white-space: nowrap;
}

.ops-table .amount.debit {
  color: var(--red);
}

.ops-table .amount.credit {
  color: var(--green);
}

.ops-table .libelle {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops-table select {
  width: auto;
  padding: 4px 8px;
  font-size: 12px;
  background: var(--bg-secondary);
}

/* Statut facture */
.statut-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.statut-badge.ok {
  background: var(--green-bg);
  color: var(--green);
}

.statut-badge.manquante {
  background: var(--red-bg);
  color: var(--red);
}

.statut-badge.exclue {
  background: var(--bg-secondary);
  color: var(--text-muted);
}

.statut-badge.exoneration {
  background: rgba(245, 158, 11, 0.10);
  color: var(--orange);
  font-weight: 500;
  font-size: 10px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mini drop zone sur chaque ligne */
.mini-drop {
  width: 100%;
  min-height: 32px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.mini-drop:hover, .mini-drop.drag-over {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.06);
  color: var(--accent);
}

.mini-drop.has-file {
  border-color: var(--green);
  border-style: solid;
  color: var(--green);
  background: var(--green-bg);
}

/* Progress bar */
.progress-container {
  margin: 20px 0;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.progress-score {
  font-size: 24px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.progress-label {
  color: var(--text-secondary);
  font-size: 13px;
}

.progress-bar {
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
  background: linear-gradient(90deg, var(--accent), var(--green));
}

.progress-fill.complete {
  background: linear-gradient(90deg, var(--green), #4ade80);
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.stat-card .stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 600;
}

.stat-card .stat-value.green { color: var(--green); }
.stat-card .stat-value.red { color: var(--red); }
.stat-card .stat-value.orange { color: var(--orange); }

/* Sections */
.section {
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 18px;
  font-weight: 600;
}

/* Période sélecteur */
.periode-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.periode-tab {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.periode-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.periode-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Victory overlay */
.victory-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.victory-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.victory-box {
  text-align: center;
  animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.victory-box .emoji {
  font-size: 80px;
  margin-bottom: 16px;
}

.victory-box h2 {
  font-size: 32px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--green), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.victory-box p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

/* Loading spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

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

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }

/* Association modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  animation: bounceIn 0.3s ease-out;
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 16px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-facture-summary {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-facture-summary .montant {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 15px;
}

.modal-search {
  margin-bottom: 16px;
}

.modal-search input {
  width: 100%;
}

.modal-actions-top {
  margin-bottom: 16px;
  display: flex;
  gap: 8px;
}

.modal-period-group {
  margin-bottom: 12px;
}

.modal-period-group .period-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 4px 0;
  margin-bottom: 4px;
}

.modal-op-item {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-op-item:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.modal-op-item .op-libelle {
  font-size: 13px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-op-item .op-montant {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.modal-op-item .op-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.modal-op-item .op-factures-count {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-muted);
}

/* Unmatched factures grid */
.unmatched-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.unmatched-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.unmatched-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  transform: translateY(-2px);
}

.unmatched-card .card-filename {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 8px;
}

.unmatched-card .card-supplier {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.unmatched-card .card-amount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 600;
  color: var(--red);
}

.unmatched-card .card-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Suggestions d'association */
.card-suggestions {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  border: 1px solid var(--border);
}

.suggestion-item.strong {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.06);
}

.suggestion-item.strong.highlight {
  border-color: var(--green);
  background: rgba(34, 197, 94, 0.12);
}

.suggestion-item.possible {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.06);
}

.suggestion-info {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.suggestion-icon {
  flex-shrink: 0;
  font-size: 10px;
}

.suggestion-item.strong .suggestion-icon { color: var(--green); }
.suggestion-item.possible .suggestion-icon { color: var(--orange); }

.suggestion-date {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text-muted);
}

.suggestion-libelle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.suggestion-amount {
  flex-shrink: 0;
  font-size: 10px;
  white-space: nowrap;
}

.suggestion-diff {
  color: var(--orange);
  font-size: 9px;
}

.suggestion-manual {
  width: 100%;
  justify-content: center;
  margin-top: 2px;
  font-size: 11px;
  padding: 4px 8px;
}

.suggestion-item .btn {
  flex-shrink: 0;
  padding: 2px 8px;
  font-size: 10px;
}

/* Bandeau mémoriser alias (inline dans le DOM) */
.memoriser-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin-bottom: 16px;
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius);
  font-size: 13px;
  animation: banner-in 0.3s ease;
}

@keyframes banner-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.memoriser-banner-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.memoriser-banner-text {
  flex: 1;
  min-width: 0;
}

.memoriser-banner .btn {
  flex-shrink: 0;
}

/* Sens incertain banner */
.unmatched-card.sens-incertain {
  border-color: var(--orange);
  border-style: dashed;
}

.sens-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(255, 160, 50, 0.1);
  border: 1px solid var(--orange);
  border-radius: 6px;
}

.sens-banner-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--orange);
  flex: 1;
}

.sens-banner .btn {
  flex-shrink: 0;
  font-size: 11px;
  padding: 3px 10px;
}

/* Multi-facture display in table */
.multi-facture-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.multi-facture-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.multi-facture-calc {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

/* Type badge (facture/avoir) */
.type-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.type-badge.facture {
  background: var(--green-bg);
  color: var(--green);
}

.type-badge.avoir {
  background: var(--orange-bg);
  color: var(--orange);
}

.type-badge.vente {
  background: var(--green-bg);
  color: var(--green);
}

/* Match indicator */
.match-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 6px;
}

.match-indicator.exact {
  background: var(--green);
}

.match-indicator.partial {
  background: var(--orange);
}

/* Sub-operation rows (multi-taux TVA) */
.sub-operation-row {
  background: var(--bg-secondary);
  border-bottom: none !important;
}

.sub-operation-row td {
  padding: 4px 12px !important;
  font-size: 12px;
}

.sub-operation-row:hover {
  background: var(--bg-secondary) !important;
}

.sub-indicator {
  color: var(--text-muted);
  margin-right: 4px;
  font-size: 11px;
}

.multi-tva-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
}

/* Section Hors TVA */
.hors-tva-header {
  cursor: pointer;
  user-select: none;
}

.hors-tva-header:hover h2 {
  color: var(--text-secondary);
}

.hors-tva-chevron {
  color: var(--text-muted);
  font-size: 12px;
  transition: transform 0.2s;
}

.hors-tva-table {
  opacity: 0.7;
}

.hors-tva-table tbody tr {
  background: var(--bg-secondary);
}

.hors-tva-table tbody tr:hover {
  opacity: 1;
}

/* Modal Mémoriser checkbox */
.modal-memoriser {
  padding: 6px 0 2px;
  font-size: 12px;
  color: var(--text-secondary);
}

.memoriser-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.memoriser-label input[type="checkbox"] {
  margin: 0;
  accent-color: var(--accent);
}

/* Marketplace tag in modal */
.marketplace-tag {
  font-size: 9px;
  background: var(--orange-bg);
  color: var(--orange);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  font-weight: 500;
  vertical-align: middle;
}

.modal-op-item .op-main-line {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.marketplace-hint {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
  padding-left: 56px;
  margin-top: 2px;
}

.modal-op-item.marketplace-op {
  flex-wrap: wrap;
}

/* Bulk upload progress */
.bulk-progress {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.bulk-progress-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 500;
}

.bulk-progress-bar-container {
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.bulk-progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width 0.3s ease;
  animation: bulkProgressPulse 1.5s ease-in-out infinite;
}

@keyframes bulkProgressPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.bulk-progress-bar-fill.done {
  background: linear-gradient(90deg, var(--green), #4ade80);
  animation: none;
}

.bulk-progress-filename {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 768px) {
  .ops-table {
    font-size: 12px;
  }
  .ops-table td, .ops-table th {
    padding: 8px 6px;
  }
  .ops-table .libelle {
    max-width: 150px;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .header h1 {
    font-size: 16px;
  }
  .container {
    padding: 0 12px;
  }
  .card {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .ops-table-wrapper {
    overflow-x: auto;
  }
}

/* Recap TVA table */
.recap-tva-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.recap-tva-table th {
  padding: 8px 12px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.recap-tva-table td {
  padding: 6px 12px;
  color: var(--text-primary);
}
.recap-tva-table .right {
  text-align: right;
}
.recap-section-header td {
  font-weight: 600;
  color: var(--text-secondary);
  padding-top: 14px !important;
  padding-bottom: 6px !important;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border);
}
.recap-subtotal td {
  font-weight: 500;
  border-top: 1px solid var(--border);
  padding-top: 8px !important;
  padding-bottom: 10px !important;
}
.recap-total td {
  border-top: 2px solid var(--border);
  padding-top: 12px !important;
  padding-bottom: 12px !important;
  font-size: 14px;
}
.recap-info td {
  color: var(--text-muted);
  font-size: 12px;
  padding-top: 8px !important;
}
.recap-warning td {
  color: var(--orange);
}

/* ========================================
   MODULE FACTURATION
   ======================================== */

/* Navigation principale TVA / Facturation */
.main-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
}

.main-nav-tab {
  flex: 1;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.main-nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.main-nav-tab.active {
  background: var(--accent);
  color: white;
}

/* Sous-navigation facturation */
.fact-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
}

.fact-nav-tab {
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.fact-nav-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.fact-nav-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Formulaires facturation */
.fact-form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.fact-form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.fact-form-group label {
  margin-bottom: 4px;
  font-size: 12px;
}

.fact-form-group input,
.fact-form-group select {
  font-size: 13px;
  padding: 8px 10px;
}

.fact-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px 12px;
  margin-bottom: 16px;
}

.fact-fieldset legend {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  padding: 0 8px;
}

/* Logo */
.logo-preview {
  width: 120px;
  height: 80px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 0.2s, background 0.2s;
}
.logo-preview:hover {
  border-color: var(--accent);
  background: var(--bg-hover, rgba(37,99,235,0.05));
}

.logo-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.logo-placeholder {
  font-size: 11px;
  color: var(--text-muted);
}

/* Tableau clients */
.clients-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.clients-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.clients-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.clients-table tbody tr:hover {
  background: var(--bg-hover);
}

.clients-table td {
  padding: 10px 12px;
  vertical-align: middle;
}

.clients-table .client-name {
  font-weight: 600;
}

.clients-table .client-address {
  color: var(--text-secondary);
  font-size: 12px;
}

.clients-table .client-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.clients-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Profile completion banner */
.profil-banner {
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--orange);
}

/* API verified fields */
.api-locked {
  background: var(--green-bg, #f0fdf4) !important;
  cursor: not-allowed;
  opacity: 0.85;
}
.api-verified-banner {
  background: var(--green-bg, #f0fdf4);
  border: 1px solid var(--green, #22c55e);
  color: var(--green-dark, #15803d);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.api-verified-banner a {
  color: var(--accent);
  text-decoration: underline;
  font-weight: normal;
}

/* Company search dropdown */
.company-search-wrapper {
  position: relative;
}

.company-search-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  margin-top: 4px;
}

.company-search-item {
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}

.company-search-item:last-child {
  border-bottom: none;
}

.company-search-item:hover {
  background: var(--bg-hover);
}

.company-search-item-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}

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

.company-search-empty,
.company-search-loading {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* === DEVIS === */
.devis-lignes-wrapper { overflow-x: auto; }
.devis-lignes-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.devis-lignes-table thead th {
  padding: 8px 6px; text-align: left; font-weight: 600; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.devis-lignes-table tbody tr { border-bottom: 1px solid var(--border); }
.devis-lignes-table tbody tr:hover { background: var(--bg-hover); }
.devis-lignes-table td { padding: 4px; vertical-align: middle; }
.devis-input {
  width: 100%; padding: 6px 8px !important; font-size: 12px !important;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
}
.devis-input:focus { border-color: var(--accent); outline: none; }
.devis-input-num { text-align: right; font-family: 'JetBrains Mono', monospace; }
.devis-input-num::-webkit-inner-spin-button,
.devis-input-num::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.devis-input-num { -moz-appearance: textfield; }
.devis-totaux {
  display: flex; flex-direction: column; gap: 6px; max-width: 350px;
  margin-left: auto; margin-top: 16px; padding: 16px 20px;
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius);
}
.devis-totaux-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.devis-totaux-detail { font-size: 11px; color: var(--text-secondary); }
.devis-totaux-ttc {
  font-size: 16px; font-weight: 700; padding-top: 8px;
  border-top: 2px solid var(--border); margin-top: 4px; color: var(--accent);
}
.devis-line-total { white-space: nowrap; font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.statut-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.statut-badge.ok { background: rgba(34,197,94,0.15); color: var(--green); }
.statut-badge.exclue { background: rgba(100,100,100,0.15); color: var(--text-muted); }
.statut-badge.manquante { background: rgba(245,158,11,0.15); color: var(--orange); }
.statut-badge.brouillon { background: rgba(100,100,100,0.15); color: var(--text-muted); }
.statut-badge.finalise { background: rgba(37,99,235,0.15); color: #2563eb; }
.statut-badge.envoye { background: rgba(245,158,11,0.15); color: #d97706; }
.statut-badge.accepte { background: rgba(34,197,94,0.15); color: #16a34a; }
.statut-badge.refuse { background: rgba(220,38,38,0.15); color: #dc2626; }
.statut-badge.facture { background: rgba(139,92,246,0.15); color: #7c3aed; }

/* Bandeau vert sélection entreprise client */
.client-search-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--green-bg);
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--green);
  font-weight: 500;
}
.client-search-banner-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Switcher type client (Pro / Particulier) */
.client-type-switcher {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  width: fit-content;
}
.client-type-btn {
  padding: 8px 20px;
  border: none;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.client-type-btn:not(:last-child) {
  border-right: 1px solid var(--border);
}
.client-type-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.client-type-btn.active {
  background: var(--accent);
  color: white;
}

/* Bibliothèque d'ouvrages */
.ouvrages-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ouvrages-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.ouvrages-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.ouvrages-table tbody tr:hover {
  background: var(--bg-hover);
}
.ouvrages-table td {
  padding: 10px 12px;
  vertical-align: middle;
}
.ouvrages-table .ouvrage-ref {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}
.ouvrages-table .ouvrage-cat {
  font-size: 11px;
  color: var(--text-secondary);
}
.ouvrages-table .ouvrage-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* Dropdown recherche ouvrage dans devis */
.ouvrage-search-cell {
  position: relative;
}
.ouvrage-dropdown {
  position: fixed;
  z-index: 9999;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 250px;
  overflow-y: auto;
  width: 350px;
}
.ouvrage-dropdown input {
  width: 100%;
  padding: 8px 10px;
  font-size: 12px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.ouvrage-dropdown input:focus { outline: none; }
.ouvrage-dropdown-item {
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 12px;
}
.ouvrage-dropdown-item:hover {
  background: var(--bg-hover);
}
.ouvrage-dropdown-ref {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.ouvrage-dropdown-empty {
  padding: 10px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* Boutons discrets 📚 et 💾 dans lignes devis */
.ouvrage-pick-btn,
.ouvrage-save-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 5px;
  line-height: 1;
  transition: all 0.15s;
}
.ouvrage-pick-btn:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}
.ouvrage-save-btn:hover {
  border-color: var(--green);
  background: rgba(34, 197, 94, 0.08);
}

/* Lignes titre/section dans devis */
.devis-titre-row { background: #eef2ff !important; }
.devis-titre-row:hover { background: #e0e7ff !important; }
.devis-titre-input {
  font-weight: 700 !important; font-size: 13px !important;
  text-transform: uppercase; width: 100%;
  border: none !important; background: transparent !important;
  padding: 6px 8px !important;
}
.devis-move-cell { text-align: center; vertical-align: middle !important; }
.devis-move-btn {
  display: block; margin: 0 auto; background: none; border: none;
  cursor: pointer; font-size: 9px; line-height: 1; padding: 1px 3px;
  color: var(--text-muted); opacity: 0.4;
}
.devis-move-btn:hover { opacity: 1; color: var(--accent); }

/* Bouton correction orthographique */
.input-with-correct {
  display: flex;
  gap: 4px;
  align-items: center;
}
.input-with-correct input,
.input-with-correct textarea {
  flex: 1;
}
.correct-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  padding: 4px 6px;
  line-height: 1;
  transition: all 0.15s;
  flex-shrink: 0;
}
.correct-btn:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}
.correct-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.correct-btn.correct-ok {
  border-color: var(--green);
  color: var(--green);
  font-size: 11px;
}

/* Autocomplete désignation devis */
.devis-desig-cell {
  position: relative;
}
.desig-autocomplete {
  width: 350px;
}

/* Autosave indicator */
.autosave-indicator {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 12px;
  transition: opacity 0.3s;
}
.autosave-indicator.saving {
  color: var(--accent);
}

/* Resume devis banner */
.devis-resume-banner {
  background: var(--bg-secondary);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.devis-resume-banner span {
  font-size: 13px;
  color: var(--text-primary);
}
.devis-resume-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Envoi email */
.send-email-form input[type="text"],
.send-email-form input[type="email"] {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.envoi-history {
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 6px;
}
.envoi-history:empty {
  display: none;
}
.envoi-history-title {
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}
.envoi-history-item {
  padding: 4px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.envoi-history-item + .envoi-history-item {
  border-top: 1px solid var(--border-light, #eee);
}

/* ============================================
   MOBILE CARD LAYOUTS (replace tables on mobile)
   ============================================ */
.mobile-cards {
  display: none;
  flex-direction: column;
  gap: 10px;
}
.mobile-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.mobile-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.mobile-card-title {
  font-weight: 600;
  font-size: 14px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mobile-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mobile-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.mobile-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* Hide nav close button on desktop */
.nav-close-btn {
  display: none;
}

/* Hamburger menu button */
.hamburger-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 20px;
  padding: 6px 10px;
  cursor: pointer;
  line-height: 1;
  min-height: 44px;
  min-width: 44px;
  align-items: center;
  justify-content: center;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* --- Tablet & below (768px) --- */
@media (max-width: 768px) {
  .fact-form-row {
    flex-direction: column;
    gap: 8px;
  }
  .main-nav {
    flex-direction: column;
  }
  .ops-table {
    font-size: 12px;
  }
  .ops-table td, .ops-table th {
    padding: 8px 6px;
  }
  .ops-table .libelle {
    max-width: 150px;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .header h1 {
    font-size: 16px;
  }
  .container {
    padding: 0 12px;
  }
  .card {
    padding: 16px;
  }
  .devis-readonly-banner {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }
  .devis-readonly-banner .devis-statut-actions {
    flex-wrap: wrap;
  }
  .devis-actions-bar {
    flex-direction: column;
    gap: 12px;
  }
  .devis-actions-left,
  .devis-actions-right {
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
  }
  .devis-totaux {
    max-width: 100%;
  }
}

/* --- Mobile (480px) --- */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .container {
    padding: 0 8px;
  }
  .header {
    padding: 10px 0;
    margin-bottom: 12px;
  }
  .header h1 {
    font-size: 15px;
  }

  /* Hamburger visible, hide desktop nav */
  .hamburger-btn {
    display: flex;
  }
  .main-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 2000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    border: none;
    border-radius: 0;
  }
  .main-nav.show {
    display: flex;
  }
  .main-nav-tab {
    width: 100%;
    max-width: 300px;
    text-align: center;
    padding: 16px 20px;
    font-size: 16px;
    min-height: 52px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  .main-nav-tab.active {
    background: var(--accent);
    border-color: var(--accent);
  }
  .main-nav .nav-close-btn {
    display: block;
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
  }

  /* Header: hide TVA info text to save space */
  #tvaInfoLabel {
    display: none !important;
  }
  #userName {
    font-size: 11px !important;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Buttons: 44px touch target */
  .btn {
    min-height: 44px;
    padding: 10px 16px;
  }
  .btn-sm {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 13px;
  }

  /* Section headers stack */
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .section-header h2 {
    font-size: 16px;
  }

  /* Modals: full screen on mobile */
  .modal-box {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
    animation: none;
  }
  .modal-header {
    padding: 16px;
  }
  .modal-body {
    padding: 16px;
  }

  /* Fieldsets adapt */
  .fact-fieldset {
    padding: 12px 14px 10px;
  }
  .fact-fieldset legend {
    font-size: 12px;
  }

  /* Drop zone smaller */
  .drop-zone {
    padding: 24px 16px;
  }
  .drop-zone .icon {
    font-size: 36px;
  }
  .drop-zone .title {
    font-size: 14px;
  }
  .drop-zone .subtitle {
    font-size: 12px;
  }

  /* Hide tables, show mobile cards (via JS class) */
  .clients-table,
  .ouvrages-table {
    display: none;
  }
  .mobile-cards {
    display: flex;
  }

  /* Devis list table → cards */
  .clients-table[data-devis-table] {
    display: none;
  }

  /* Filter buttons wrap */
  .section-header > div {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Devis form: lignes table scroll */
  .devis-lignes-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -14px;
    padding: 0 14px;
  }
  .devis-lignes-table {
    min-width: 600px;
  }

  /* Period tabs scroll */
  .periode-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .periode-tab {
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Fact sub-nav scroll */
  .fact-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }
  .fact-nav-tab {
    flex-shrink: 0;
    white-space: nowrap;
    min-height: 44px;
  }

  /* Ops table on mobile: scroll horizontal */
  .ops-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -8px;
    padding: 0 8px;
  }
  .ops-table {
    min-width: 500px;
  }

  /* Toast adapts */
  .toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  /* Victory overlay */
  .victory-box h2 {
    font-size: 24px;
  }
  .victory-box .emoji {
    font-size: 60px;
  }

  /* Gear menu wider on mobile */
  #gearMenu {
    min-width: 220px !important;
    right: -8px !important;
  }

  /* Client type switcher full width */
  .client-type-switcher {
    width: 100%;
  }
  .client-type-btn {
    flex: 1;
    min-height: 44px;
  }

  /* Company search dropdown */
  .company-search-dropdown {
    max-height: 200px;
  }

  /* Unmatched grid single column */
  .unmatched-grid {
    grid-template-columns: 1fr;
  }

  /* Stat values smaller */
  .stat-card .stat-value {
    font-size: 18px;
  }

  /* Logo preview smaller */
  .logo-preview {
    width: 80px;
    height: 60px;
  }

  /* Envoi history items stack */
  .envoi-history-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  /* Ouvrage dropdown width on mobile */
  .ouvrage-dropdown {
    width: 280px;
  }

  /* Devis resume banner stack */
  .devis-resume-banner {
    flex-direction: column;
    align-items: flex-start;
  }
  .devis-resume-actions {
    width: 100%;
  }
  .devis-resume-actions .btn {
    flex: 1;
  }
}

/* === MODULE FACTURES MANQUANTES === */
.manq-month-block {
  margin-bottom: 24px;
}
.manq-month-header {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 10px 0 8px;
  border-bottom: 2px solid var(--accent);
  margin-bottom: 8px;
}
.manq-month-header .manq-count {
  font-weight: 400;
  font-size: 13px;
  color: var(--text-muted);
}
.manq-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.manq-table th {
  text-align: left;
  padding: 8px 10px;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.manq-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}
.manq-table tbody tr:hover {
  background: var(--bg-secondary);
}
.manq-table tr.manq-sub td {
  color: var(--text-secondary);
  font-style: italic;
}
.manq-alias {
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.manq-no-alias {
  color: var(--text-muted);
}
.manq-subtotal td {
  font-weight: 700;
  border-top: 2px solid var(--border);
  border-bottom: none;
  color: var(--text-primary);
  padding-top: 10px;
}
.manq-total {
  background: var(--red);
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  margin-bottom: 16px;
  text-align: right;
}
.manq-empty {
  text-align: center;
  color: var(--green);
  padding: 40px 0;
  font-size: 15px;
}
@media (max-width: 600px) {
  .manq-table { font-size: 12px; }
  .manq-table th, .manq-table td { padding: 6px 6px; }
}
