/* ── Module Offres/Devis v2.0.0 ─────────────────────────── */

/* Layout principal */
.of-wrapper {
  display: flex;
  align-items: flex-start;
  min-height: 500px;
  background: #f8f9fc;
  border-radius: 0 0 6px 6px;
}

.of-list-panel {
  width: 230px;
  min-width: 200px;
  border-right: 1px solid #e5e7eb;
  background: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
}

.of-list-header {
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.of-list-header h3 {
  margin: 0 0 8px 0;
  font-size: 12px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.of-create-btn {
  width: 100%;
  padding: 8px;
  background: #185fa5;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s;
}
.of-create-btn:hover { background: #042c53; }

.of-list-body {
  flex: 1;
  overflow-y: auto;
}

.of-offer-item {
  padding: 10px 12px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background .1s;
}
.of-offer-item:hover { background: #f0f4ff; }
.of-offer-item.active { background: #eff6ff; border-left: 3px solid #185fa5; }

.of-offer-num {
  font-size: 12px;
  font-weight: 700;
  color: #185fa5;
}
.of-offer-title {
  font-size: 11px;
  color: #374151;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.of-offer-meta {
  font-size: 10px;
  color: #9ca3af;
  margin-top: 3px;
}
.of-offer-ttc {
  font-size: 13px;
  font-weight: 700;
  color: #042c53;
  margin-top: 4px;
}

/* Status badges */
.of-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}
.of-badge-draft { background: #f3f4f6; color: #6b7280; }
.of-badge-sent { background: #dbeafe; color: #1d4ed8; }
.of-badge-waiting_signature { background: #fef3c7; color: #b45309; }
.of-badge-accepted { background: #d1fae5; color: #065f46; }
.of-badge-refused { background: #fee2e2; color: #991b1b; }
.of-badge-cancelled { background: #f9fafb; color: #9ca3af; }

/* Type badges pour les lignes */
.of-type {
  display: inline-block;
  padding: 0 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
}
.of-type-material { background: #dbeafe; color: #1d4ed8; }
.of-type-labor { background: #d1fae5; color: #065f46; }
.of-type-admin { background: #e5e7eb; color: #374151; }
.of-type-ecotax { background: #fef3c7; color: #92400e; }
.of-type-discount { background: #fee2e2; color: #991b1b; }
.of-type-service { background: #ede9fe; color: #5b21b6; }

/* Éditeur principal */
.of-editor {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.of-editor-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 14px;
}

.of-editor-header {
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.of-editor-title {
  flex: 1;
}
.of-editor-number {
  font-size: 16px;
  font-weight: 700;
  color: #042c53;
}
.of-editor-subtitle {
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
}

.of-action-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.of-btn {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all .15s;
  white-space: nowrap;
}
.of-btn:hover { background: #f9fafb; border-color: #9ca3af; }
.of-btn-primary { background: #185fa5; color: #fff; border-color: #185fa5; }
.of-btn-primary:hover { background: #042c53; border-color: #042c53; }
.of-btn-danger { background: #fff; color: #dc2626; border-color: #fca5a5; }
.of-btn-danger:hover { background: #fee2e2; }
.of-btn-sm { padding: 3px 8px; font-size: 11px; }

/* Status selector */
.of-status-select {
  padding: 5px 8px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
  background: #f9fafb;
}

/* Corps éditeur */
.of-editor-body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.of-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
}

.of-section-head {
  padding: 8px 14px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: #042c53;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.of-section-body { padding: 12px 14px; }

/* Info offre (titre, date) */
.of-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.of-field label {
  display: block;
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 3px;
  font-weight: 600;
}

.of-field input, .of-field select, .of-field textarea {
  width: 100%;
  padding: 6px 9px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  font-size: 13px;
  color: #111827;
  box-sizing: border-box;
  transition: border-color .15s;
}
.of-field input:focus, .of-field select:focus, .of-field textarea:focus {
  outline: none;
  border-color: #185fa5;
}

/* Tableau des lignes */
.of-lines-table-wrap {
  overflow-x: auto;
}

.of-lines-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.of-lines-table th {
  background: #f9fafb;
  color: #6b7280;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 6px 8px;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.of-lines-table td {
  padding: 5px 6px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

.of-lines-table tr:hover td { background: #f9fafb; }

.of-lines-table td input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 3px 5px;
  font-size: 12px;
  background: transparent;
  box-sizing: border-box;
}
.of-lines-table td input:focus {
  border-color: #185fa5;
  background: #fff;
  outline: none;
}

.of-lines-table td select {
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 3px 4px;
  font-size: 11px;
  background: transparent;
  cursor: pointer;
}
.of-lines-table td select:focus {
  border-color: #185fa5;
  background: #fff;
  outline: none;
}

.of-line-margin {
  font-size: 10px;
  color: #10b981;
  display: block;
  margin-top: 1px;
}
.of-line-margin.negative { color: #dc2626; }

.of-line-actions {
  width: 28px;
  text-align: center;
}

.of-del-btn {
  background: none;
  border: none;
  color: #d1d5db;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 3px;
  transition: color .1s;
}
.of-del-btn:hover { color: #dc2626; background: #fee2e2; }

/* Barre add-line */
.of-add-bar {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.of-discount-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  padding: 8px 12px;
  background: #fefce8;
  border-radius: 5px;
  border: 1px solid #fef08a;
  font-size: 12px;
  flex-wrap: wrap;
}

.of-discount-row label { color: #78350f; font-weight: 600; }
.of-discount-row input {
  width: 80px;
  padding: 4px 6px;
  border: 1px solid #fde68a;
  border-radius: 4px;
  font-size: 12px;
}

/* Financement */
.of-fin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

/* Sidebar droite */
.of-sidebar {
  width: 270px;
  min-width: 240px;
  border-left: 1px solid #e5e7eb;
  background: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
}

.of-sidebar-section {
  padding: 12px 14px;
  border-bottom: 1px solid #f3f4f6;
}

.of-sidebar-section h4 {
  margin: 0 0 8px 0;
  font-size: 10px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* Totaux */
.of-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 3px 0;
  color: #374151;
}
.of-total-row.subtotal { color: #6b7280; font-size: 11px; }
.of-total-row.discount { color: #dc2626; }
.of-total-row.grand {
  font-size: 15px;
  font-weight: 700;
  color: #042c53;
  padding: 6px 0;
  border-top: 2px solid #e5e7eb;
  margin-top: 4px;
}

/* Marge */
.of-margin-box {
  padding: 10px;
  background: #f0fdf4;
  border-radius: 5px;
  border: 1px solid #bbf7d0;
}
.of-margin-box.low-margin {
  background: #fff1f2;
  border-color: #fecdd3;
}

.of-margin-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  padding: 2px 0;
  color: #374151;
}
.of-margin-row.bold { font-weight: 700; font-size: 13px; color: #065f46; }
.of-margin-box.low-margin .of-margin-row.bold { color: #991b1b; }

.of-margin-warn {
  font-size: 10px;
  font-weight: 700;
  color: #991b1b;
  text-align: center;
  margin-top: 6px;
}

/* Activité */
.of-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 11px;
}
.of-activity-list li {
  padding: 5px 0;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
}
.of-activity-list li:last-child { border-bottom: none; }
.of-activity-time { font-size: 10px; color: #9ca3af; display: block; }
.of-activity-actor { color: #185fa5; font-weight: 600; }

/* Modals */
.of-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.of-modal {
  background: #fff;
  border-radius: 8px;
  padding: 20px 24px;
  min-width: 340px;
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
}

.of-modal h3 {
  margin: 0 0 16px 0;
  font-size: 15px;
  color: #042c53;
}

.of-modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

/* Kit list dans modal */
.of-kit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
}
.of-kit-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background .1s;
}
.of-kit-list li:hover { background: #eff6ff; }
.of-kit-name { font-size: 13px; color: #111827; font-weight: 600; }
.of-kit-price { font-size: 12px; color: #6b7280; }

/* État vide */
.of-empty {
  text-align: center;
  padding: 30px 20px;
  color: #9ca3af;
  font-size: 13px;
}
.of-empty-icon { font-size: 32px; margin-bottom: 8px; }

/* Responsive */
@media (max-width: 900px) {
  .of-wrapper { flex-direction: column; }
  .of-list-panel { width: 100%; min-width: unset; border-right: none; border-bottom: 1px solid #e5e7eb; max-height: 200px; position: static; }
  .of-sidebar { width: 100%; min-width: unset; border-left: none; border-top: 1px solid #e5e7eb; position: static; max-height: none; }
}

/* ── BRIEF-COMM-007 additions ──────────────────────────── */

/* Drag & drop ghost */
.of-sortable-ghost { opacity: 0.4; background: #eff6ff; }

/* Modal head row */
.of-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  font-weight: 600;
  font-size: 14px;
}

/* Descriptif enrichi sous une ligne */
.of-rich-desc { font-size: 11px; color: #6b7280; margin-top: 2px; line-height: 1.5; }
.of-rich-desc ul { margin: 2px 0 2px 14px; padding: 0; }
.of-rich-desc li { margin: 1px 0; }

/* Section métier block */
.of-section-block { margin-bottom: 4px; }
