/**
 * App Chiffrage - AIR-ELEC V2
 * Devis et chiffrages — Design V2 épuré, données V1
 */

/* ─── Layout ─── */
.chiffrage-app {
  height: 100%;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  position: relative;
  overflow: hidden;
}
.chiffrage-view-body { flex: 1; overflow-y: auto; padding: 20px; background: var(--gray-50); }
.chiffrage-view-body::-webkit-scrollbar { width: 6px; }
.chiffrage-view-body::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }

/* ─── Vue Liste ─── */
.chiffrage-view { display: flex; flex-direction: column; height: 100%; }
.chiffrage-view.hidden { display: none; }

.chiffrage-view-header {
  padding: 12px 20px 8px;
  display: flex; align-items: center; gap: 12px; background: white;
}
.chiffrage-view-title { font-size: 15px; font-weight: 600; color: var(--gray-900); flex: 1; }
.chiffrage-view-toggle { display: flex; gap: 2px; background: var(--gray-100); border-radius: 6px; padding: 2px; }
.chiffrage-view-toggle-btn {
  padding: 5px 8px; background: transparent; border: none; border-radius: 5px; cursor: pointer;
  color: var(--gray-500); display: flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.chiffrage-view-toggle-btn:hover { color: var(--gray-700); }
.chiffrage-view-toggle-btn.active { background: white; color: var(--gray-900); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

.chiffrage-ios-nav { display: none; }
.chiffrage-ios-search-wrap { display: none; }
.chiffrage-ios-segment { display: none; }
.chiffrage-ios-editor-overlay { display: none; }

.chiffrage-filterbar {
  display: flex; align-items: center; gap: 10px; padding: 8px 20px 12px;
  background: white; border-bottom: 0.5px solid var(--gray-200); flex-wrap: wrap;
}
.chiffrage-search {
  padding: 7px 12px 7px 32px;
  background: var(--gray-50) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") 10px center no-repeat;
  border: 0.5px solid var(--gray-200); border-radius: 7px; font-size: 13px; outline: none;
  font-family: var(--font-sans); width: 200px; transition: all 0.15s;
}
.chiffrage-search:focus { background-color: white; border-color: var(--green); width: 260px; }
.chiffrage-filters { display: flex; gap: 4px; }
.chiffrage-filter-btn {
  padding: 5px 12px; background: transparent; border: 0.5px solid var(--gray-200); border-radius: 6px;
  font-size: 12px; font-weight: 500; color: var(--gray-600); cursor: pointer; transition: all 0.15s; font-family: var(--font-sans);
}
.chiffrage-filter-btn:hover { background: rgba(0,0,0,0.04); }
.chiffrage-filter-btn.active { background: var(--green); border-color: var(--green); color: white; }
.chiffrage-filterbar-actions { margin-left: auto; display: flex; gap: 6px; }

/* ─── KPIs — migrated to unified kpi.css ─── */
/* Replaced by .kpi-grid / .kpi-card / .kpi-card--X / .kpi-card-value--X */

/* ─── Devis list ─── */
.chiffrage-list-view { background: white; border-radius: 10px; border: 0.5px solid var(--gray-200); overflow: hidden; }

/* ─── Devis grid ─── */
.chiffrage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.chiffrage-grid-item {
  background: white;
  border-radius: 12px;
  border: 0.5px solid var(--gray-200);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chiffrage-grid-item:hover {
  border-color: var(--green);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}
.chiffrage-grid-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}
.chiffrage-grid-icon--accepte { background: var(--green); }
.chiffrage-grid-icon--attente { background: var(--orange); }
.chiffrage-grid-icon--brouillon { background: var(--gray-400); }
.chiffrage-grid-icon--refuse { background: var(--red); }
.chiffrage-grid-icon--envoye { background: var(--green); }
.chiffrage-grid-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
}
.chiffrage-grid-client {
  font-size: 12px;
  color: var(--gray-500);
}
.chiffrage-grid-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 10px;
  border-top: 0.5px solid var(--gray-100);
}
.chiffrage-grid-stat {
  font-size: 11px;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  gap: 4px;
}
.chiffrage-grid-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
}
.chiffrage-grid-badge--accepte { background: rgba(90,158,53,0.12); color: var(--green); }
.chiffrage-grid-badge--attente { background: rgba(255,149,0,0.12); color: var(--orange); }
.chiffrage-grid-badge--brouillon { background: rgba(142,142,147,0.12); color: var(--gray-500); }
.chiffrage-grid-badge--refuse { background: rgba(255,59,48,0.12); color: var(--red); }
.chiffrage-grid-badge--envoye { background: rgba(90,158,53,0.12); color: var(--green); }
.chiffrage-list-header {
  display: grid; grid-template-columns: 0.4fr 2fr 1.5fr 1fr 1fr 0.8fr;
  padding: 10px 16px; background: var(--gray-50); border-bottom: 0.5px solid var(--gray-200);
  font-size: 11px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.3px;
}
.chiffrage-list-row {
  display: grid; grid-template-columns: 0.4fr 2fr 1.5fr 1fr 1fr 0.8fr;
  padding: 12px 16px; border-bottom: 0.5px solid var(--gray-100); align-items: center; cursor: pointer; transition: background 0.15s;
}
.chiffrage-list-row:last-child { border-bottom: none; }
.chiffrage-list-row:hover { background: var(--gray-50); }
.chiffrage-list-num { font-size: 12px; font-weight: 600; color: var(--gray-400); font-family: var(--font-mono); }
.chiffrage-list-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chiffrage-list-name { font-size: 13px; font-weight: 600; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chiffrage-list-client { font-size: 12px; color: var(--gray-500); }
.chiffrage-list-date { font-size: 13px; color: var(--gray-600); }
.chiffrage-list-montant { font-size: 14px; font-weight: 600; font-family: var(--font-mono); color: var(--gray-900); text-align: right; }
.chiffrage-list-badge { display: inline-flex; padding: 3px 8px; border-radius: 5px; font-size: 11px; font-weight: 500; justify-self: end; }
.chiffrage-list-badge--accepte { background: rgba(90,158,53,0.12); color: var(--green); }
.chiffrage-list-badge--attente { background: rgba(255,149,0,0.12); color: var(--orange); }
.chiffrage-list-badge--refuse { background: rgba(255,59,48,0.12); color: var(--red); }
.chiffrage-list-badge--brouillon { background: rgba(142,142,147,0.12); color: var(--gray-500); }
.chiffrage-list-badge--envoye { background: rgba(90,158,53,0.12); color: var(--green); }
.chiffrage-list-chevron { color: var(--gray-300); display: flex; justify-content: flex-end; }

/* ==========================================================================
   ÉDITEUR — Design V2 propre, données riches V1
   ========================================================================== */
.chiffrage-editor { display: none; flex-direction: column; height: 100%; }
.chiffrage-editor.active { display: flex; }

.chiffrage-editor-ref-input {
  font-size: 14px; font-weight: 600; color: var(--gray-900);
  border: 0.5px solid transparent; border-radius: 5px; padding: 2px 6px; width: 150px;
  background: transparent; font-family: var(--font-mono); outline: none; transition: all 0.15s;
}
.chiffrage-editor-ref-input:hover,
.chiffrage-editor-ref-input:focus { border-color: var(--gray-200); background: white; }

.chiffrage-editor-save-status { font-size: 11px; font-weight: 500; margin-left: 6px; padding: 2px 8px; border-radius: 999px; opacity: 0; transition: opacity 0.3s; }
.ce-save--ok { opacity: 1; color: var(--green); background: rgba(90,158,53,0.1); }

/* Layout 2 colonnes V2 */
.chiffrage-editor-layout {
  flex: 1; overflow-y: auto; padding: 16px 20px; background: var(--gray-50);
  display: grid; grid-template-columns: 1fr 280px; gap: 16px; align-items: start;
}
.chiffrage-editor-layout::-webkit-scrollbar { width: 6px; }
.chiffrage-editor-layout::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }
.chiffrage-editor-main { min-width: 0; }
.chiffrage-editor-sidebar { position: sticky; top: 0; }

/* ─── Info cards V2 ─── */
.chiffrage-editor-info {
  background: white; border-radius: 12px; border: 0.5px solid var(--gray-200);
  padding: 16px 20px; margin-bottom: 14px;
}
.chiffrage-editor-info-row { display: flex; gap: 12px; margin-bottom: 10px; }
.chiffrage-editor-info-row:last-child { margin-bottom: 0; }
.chiffrage-editor-field { flex: 1; min-width: 0; }
.chiffrage-editor-field label {
  display: block; font-size: 10px; font-weight: 600; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 4px;
}
.chiffrage-editor-field select,
.chiffrage-editor-field input[type="text"],
.chiffrage-editor-field input[type="number"] {
  width: 100%; padding: 7px 10px; border: 0.5px solid var(--gray-200); border-radius: 8px;
  font-size: 13px; font-family: var(--font-sans); outline: none; background: white;
  color: var(--gray-900); box-sizing: border-box; transition: border-color 0.15s;
}
.chiffrage-editor-field select:focus,
.chiffrage-editor-field input:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(90,158,53,0.08); }

/* ─── Lines card V2 ─── */
.chiffrage-lines-card {
  background: white; border-radius: 12px; border: 0.5px solid var(--gray-200);
  overflow: hidden; margin-bottom: 14px;
}
.chiffrage-lines-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 0.5px solid var(--gray-200);
  font-size: 13px; font-weight: 600; color: var(--gray-700); gap: 8px; flex-wrap: wrap;
}
.chiffrage-lines-toolbar span { display: flex; align-items: center; gap: 6px; }
.chiffrage-lines-add-btns { display: flex; gap: 4px; }
.cl-add-line {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; background: var(--gray-100); border: none; border-radius: 6px;
  font-size: 11px; font-weight: 500; color: var(--gray-600); cursor: pointer;
  font-family: var(--font-sans); transition: all 0.15s;
}
.cl-add-line:hover { background: var(--green); color: white; }

/* ─── Line items table V2 ─── */
.cl-table-wrap { overflow-x: auto; }
.cl-table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 760px; }
.cl-table thead th {
  font-size: 10px; font-weight: 600; color: var(--gray-500); text-transform: uppercase;
  letter-spacing: 0.3px; padding: 8px 8px; text-align: left; white-space: nowrap;
  border-bottom: 0.5px solid var(--gray-200); background: var(--gray-50);
}
.cl-table thead th:not(:first-child) { text-align: right; }
.cl-table thead th:last-child { text-align: center; width: 28px; }
.th-unit-short { display: none; }

.cl-table tbody td { padding: 6px 8px; border-bottom: 0.5px solid var(--gray-50); vertical-align: middle; }
.cl-table tbody td:not(:first-child) { text-align: right; }
.cl-table tbody td:last-child { text-align: center; padding: 6px 2px; }

/* ─── Section band ─── */
.cl-section { cursor: pointer; }
.cl-section td { padding: 0 !important; border-bottom: 0.5px solid rgba(90,158,53,0.15); }
.cl-section-band {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; background: #eaf6e0; user-select: none;
  transition: background 0.15s;
}
.cl-section-band:hover { background: #e2f3d6; }
.cl-section-chevron {
  width: 18px; height: 18px; display: flex; align-items: center; justify-content: center;
  color: var(--green); cursor: pointer; transition: transform 0.2s var(--ease-ios);
  flex-shrink: 0;
}
.cl-section.collapsed .cl-section-chevron { transform: rotate(-90deg); }
.cl-section-name {
  flex: 1; font-size: 13px; font-weight: 700; color: #3f7224;
  display: flex; align-items: center; gap: 6px; min-width: 0;
}
.cl-section-total {
  font-size: 12px; font-weight: 700; font-family: var(--font-mono); color: var(--green);
  white-space: nowrap; margin-right: 8px;
}
.cl-section-menu {
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  border-radius: 5px; cursor: pointer; color: var(--gray-400);
  font-size: 16px; line-height: 1; flex-shrink: 0;
}
.cl-section-menu:hover { background: rgba(0,0,0,0.06); color: var(--gray-700); }

/* Section body (collapsible) */
.cl-section-body { }
.cl-section.collapsed ~ .cl-section-body { display: none; }

/* Add buttons under section */
.cl-section-add td { padding: 6px 14px 8px !important; background: var(--gray-50); }
.cl-section-add-btns { display: flex; gap: 4px; }
.cl-section-add-btn {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 4px 10px; border: 0.5px solid var(--gray-200); border-radius: 5px;
  font-size: 11px; font-weight: 500; cursor: pointer; font-family: var(--font-sans);
  background: white; color: var(--gray-600); transition: all 0.15s;
}
.cl-section-add-btn:hover { border-color: var(--green); color: var(--green); background: rgba(90,158,53,0.04); }
.cl-section-add-btn--primary { background: var(--green); border-color: var(--green); color: white; }
.cl-section-add-btn--primary:hover { background: var(--green-light); }

/* ─── Composite sub-lines ─── */
.cl-tr-subline td {
  padding: 3px 8px 3px 28px !important; font-size: 11px; color: var(--gray-500);
  border-bottom: 0.5px solid var(--gray-50); vertical-align: middle;
  border-left: 2px solid var(--gray-100);
}
.cl-tr-subline td:first-child { padding-left: 32px !important; }
.cl-tr-subline .cel-subline-dash { color: var(--gray-300); margin-right: 4px; }
.cl-tr-subline .cel-subline-total { font-family: var(--font-mono); font-weight: 500; color: var(--gray-600); }

/* Edit link for composite */
.cl-section-edit-link td { padding: 2px 14px 6px 32px !important; border-bottom: 0.5px solid var(--gray-50); }
.cl-section-edit-link a {
  font-size: 11px; color: var(--green); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
}
.cl-section-edit-link a:hover { text-decoration: underline; color: #3f7224; }

/* ─── Marge lock ─── */
.cl-marge-wrap {
  display: inline-flex; align-items: center; gap: 3px;
}
.cl-marge-lock {
  width: 14px; height: 14px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--gray-300); cursor: pointer; flex-shrink: 0;
}
.cl-marge-lock:hover { color: var(--gray-500); }
.cl-marge-lock.locked { color: var(--green); }

/* ─── Hide number spinners on devis lines ─── */
.cl-table input[type="number"]::-webkit-inner-spin-button,
.cl-table input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}
.cl-table input[type="number"] {
  -moz-appearance: textfield;
}

/* ─── Inline cells V2 ─── */
.cel-desc {
  width: 100%; border: 0.5px solid transparent; border-radius: 5px;
  background: transparent; font-size: 12px; font-weight: 500;
  font-family: var(--font-sans); padding: 5px 6px; color: var(--gray-900);
  box-sizing: border-box; outline: none; transition: all 0.15s;
}
.cel-desc:hover { border-color: var(--gray-200); background: var(--gray-50); }
.cel-desc:focus { border-color: var(--green); background: white; box-shadow: 0 0 0 2px rgba(90,158,53,0.06); }

.cel-qte, .cel-pa, .cel-marge, .cel-pv {
  width: 100%; border: 0.5px solid transparent; border-radius: 5px;
  background: transparent; font-size: 12px; font-family: var(--font-mono);
  padding: 5px 6px; color: var(--gray-900); text-align: right;
  box-sizing: border-box; outline: none; transition: all 0.15s;
}
.cel-qte:hover, .cel-pa:hover, .cel-marge:hover, .cel-pv:hover { border-color: var(--gray-200); background: var(--gray-50); }
.cel-qte:focus, .cel-pa:focus, .cel-marge:focus, .cel-pv:focus { border-color: var(--green); background: white; box-shadow: 0 0 0 2px rgba(90,158,53,0.06); }

.cel-unite, .cel-tva, .cel-type {
  width: 100%; border: 0.5px solid transparent; border-radius: 5px;
  background: transparent; font-size: 11px; font-family: var(--font-sans);
  padding: 5px 2px; text-align: right; color: var(--gray-700); outline: none; cursor: pointer;
  box-sizing: border-box; transition: all 0.15s;
}
.cel-unite:hover, .cel-tva:hover, .cel-type:hover { border-color: var(--gray-200); background: var(--gray-50); }
.cel-unite:focus, .cel-tva:focus, .cel-type:focus { border-color: var(--green); background: white; }

.cel-line-total { font-size: 12px; font-weight: 700; font-family: var(--font-mono); color: var(--gray-900); white-space: nowrap; }
.cel-pv-total { display: none; }
/* ─── Reorder ─── */
.cl-reorder {
  display: inline-flex; align-items: center; gap: 1px; vertical-align: middle;
}
.cl-drag-handle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 20px; cursor: grab; color: var(--gray-300);
  transition: color 0.15s; touch-action: none;
}
.cl-drag-handle:hover { color: var(--gray-500); }
.cl-drag-handle:active { cursor: grabbing; }
.cl-reorder-up, .cl-reorder-down {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 14px; cursor: pointer; color: var(--gray-300);
  border: none; background: transparent; padding: 0; transition: color 0.15s;
}
.cl-reorder-up:hover, .cl-reorder-down:hover { color: var(--green); }
.cl-tr-line.cl-dragging { opacity: 0.4; background: rgba(90,158,53,0.08) !important; }
.cl-tr-line.cl-drag-over { border-top: 2px solid var(--green) !important; }
/* SortableJS ghost placeholder */
.sortable-ghost { opacity: 0.3; background: rgba(90,158,53,0.12) !important; }
.sortable-ghost > td { border-top: 2px dashed var(--green); }
.sortable-drag { background: white !important; box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.cl-actions-cell {
  display: inline-flex; align-items: center; gap: 2px;
}

.cel-rm-line {
  width: 24px; height: 24px; border: none; border-radius: 5px; background: transparent;
  cursor: pointer; color: var(--gray-400); display: inline-flex; align-items: center;
  justify-content: center; transition: all 0.15s;
}
.cel-rm-line:hover { background: rgba(255,59,48,0.1); color: var(--red); }

.cl-cell-muted { color: var(--gray-400); font-size: 11px; }
.cl-tr-line--texte { background: var(--gray-50); }
.cl-tr-line--texte:hover { background: var(--gray-50) !important; }

/* ─── Options grid V2 (acompte, retenue, mentions, dechets) ─── */
.chiffrage-options-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.chiffrage-option-block {
  background: white; border-radius: 10px; border: 0.5px solid var(--gray-200);
  padding: 14px 16px;
}
.chiffrage-option-title {
  font-size: 12px; font-weight: 600; color: var(--gray-700);
  margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.chiffrage-option-row {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--gray-600);
}
.chiffrage-option-row input[type="number"] {
  padding: 5px 8px; border: 0.5px solid var(--gray-200); border-radius: 6px;
  font-size: 12px; font-family: var(--font-mono); outline: none; text-align: right; box-sizing: border-box;
}
.chiffrage-option-row input[type="number"]:focus { border-color: var(--green); }
.chiffrage-option-result { font-size: 13px; font-weight: 700; font-family: var(--font-mono); color: var(--green); }

/* ─── Mentions textarea V2 ─── */
.chiffrage-option-block textarea {
  width: 100%; padding: 6px 8px; border: 0.5px solid var(--gray-200); border-radius: 6px;
  font-size: 12px; font-family: var(--font-sans); outline: none; resize: vertical;
  box-sizing: border-box; transition: border-color 0.15s;
}
.chiffrage-option-block textarea:focus { border-color: var(--green); }

/* ==========================================================================
   SIDEBAR V2 (totaux) — carte propre
   ========================================================================== */
.ce-sidebar-block {
  background: white; border-radius: 12px; border: 0.5px solid var(--gray-200);
  overflow: hidden; margin-bottom: 12px;
}
.ce-sidebar-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
  color: var(--gray-500); padding: 14px 18px 8px;
}
.ce-totaux { padding: 0 18px 12px; }
.ce-totaux-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; font-size: 13px; color: var(--gray-600); border-bottom: 0.5px solid var(--gray-100);
}
.ce-totaux-row span:last-child { font-weight: 600; font-family: var(--font-mono); color: var(--gray-900); }
.ce-totaux-row--sub { font-size: 12px; padding: 5px 0; }
.ce-totaux-row--sub span:last-child { font-weight: 500; color: var(--gray-700); }
.ce-totaux-divider { height: 0.5px; background: var(--gray-200); margin: 8px 0; }
.ce-totaux-row--big span:last-child { font-size: 16px; font-weight: 800; color: var(--green); }
.ce-totaux-row--net {
  background: var(--green); margin: 6px -18px -12px; padding: 10px 18px; border: none;
}
.ce-totaux-row--net span { color: white; font-weight: 700; }
.ce-totaux-row--net span:last-child { color: white; font-weight: 800; font-size: 14px; }

.ce-remise-controls { display: flex; gap: 4px; align-items: center; }
.ce-remise-controls select {
  font-size: 11px; padding: 3px 4px; border: 0.5px solid var(--gray-200); border-radius: 5px;
  background: white; font-family: var(--font-sans); outline: none;
}
.ce-remise-controls input {
  font-size: 11px; padding: 3px 4px; border: 0.5px solid var(--gray-200); border-radius: 5px;
  font-family: var(--font-mono); outline: none; text-align: right; width: 55px; box-sizing: border-box;
}

/* ─── Ventilation rows V2 ─── */
.ce-vent-values {
  padding: 0 18px 10px;
}
.ce-vent-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0; font-size: 12px; color: var(--gray-600);
  border-bottom: 0.5px solid var(--gray-100);
}
.ce-vent-row span:last-child { font-weight: 600; font-family: var(--font-mono); color: var(--gray-900); }
.ce-vent-row--last { border-bottom: none; }

/* ─── URSSAF vent bar V2 ─── */
.ce-vent-bar {
  height: 6px; border-radius: 999px; background: var(--orange);
  overflow: hidden; margin: 0 18px 6px;
}
.ce-vent-bar-fill { height: 100%; background: var(--blue); border-radius: 999px 0 0 999px; transition: width 0.3s; }
.ce-vent-legend {
  display: flex; justify-content: space-between; padding: 0 18px 8px; font-size: 10px; color: var(--gray-500);
}
.ce-vent-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 3px; }
.ce-vent-dot--presta { background: var(--blue); }
.ce-vent-dot--vente { background: var(--orange); }

/* ─── Confirmation V2 ─── */
.chiffrage-confirm-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.3); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 50;
}
.chiffrage-confirm-box {
  background: white; border-radius: 14px; padding: 24px 28px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15); max-width: 320px; text-align: center;
}
.chiffrage-confirm-box p { font-size: 14px; color: var(--gray-700); margin: 0 0 16px; line-height: 1.4; }
.chiffrage-confirm-actions { display: flex; gap: 8px; justify-content: center; }

/* ─── Compact view ─── */
.chiffrage-list-view--compact {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px; margin: 16px 20px; background: transparent; border: none; border-radius: 0;
}
.chiffrage-list-row--compact { display: block !important; padding: 0 !important; border: none !important; cursor: pointer; background: transparent !important; grid-template-columns: none !important; }
.chiffrage-compact-card { background: white; border-radius: 12px; border: 0.5px solid var(--gray-200); padding: 14px 16px; transition: all 0.2s; }
.chiffrage-list-row--compact:hover .chiffrage-compact-card { border-color: var(--green); box-shadow: 0 2px 8px rgba(0,0,0,0.08); transform: translateY(-1px); }
.chiffrage-compact-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.chiffrage-compact-ref { font-size: 14px; font-weight: 600; color: var(--gray-900); }
.chiffrage-compact-client { font-size: 12px; color: var(--gray-600); display: flex; align-items: center; gap: 4px; margin-bottom: 3px; }
.chiffrage-compact-chantier { font-size: 12px; color: var(--gray-500); display: flex; align-items: center; gap: 4px; margin-bottom: 10px; }
.chiffrage-compact-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; border-top: 0.5px solid var(--gray-100); }
.chiffrage-compact-date { font-size: 11px; color: var(--gray-400); }
.chiffrage-compact-montant { font-size: 15px; font-weight: 700; font-family: var(--font-mono); color: var(--gray-900); }

/* ─── Toolbar ─── */
.chiffrage-toolbar {
  padding: 10px 16px; border-bottom: 0.5px solid var(--gray-200);
  display: flex; align-items: center; gap: 10px; background: white; flex-shrink: 0;
}
.chiffrage-back-btn {
  padding: 5px 8px; background: var(--gray-100); border: none; border-radius: 6px;
  cursor: pointer; color: var(--gray-700); display: flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500; font-family: var(--font-sans);
}
.chiffrage-back-btn:hover { background: var(--gray-200); }
.chiffrage-toolbar-title { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.chiffrage-toolbar-actions { display: flex; gap: 6px; flex-shrink: 0; }
.chiffrage-btn {
  padding: 6px 12px; border-radius: 6px; font-size: 12px; font-weight: 500; cursor: pointer;
  border: 0.5px solid var(--gray-200); background: white; color: var(--gray-700);
  display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-sans);
}
.chiffrage-btn:hover { background: var(--gray-50); }
.chiffrage-btn--primary { background: var(--green); border-color: var(--green); color: white; }
.chiffrage-btn--primary:hover { background: var(--green-light); }
.chiffrage-btn--success { background: var(--green); border-color: var(--green); color: white; }
.chiffrage-btn--success:hover { background: var(--green-light); }
.chiffrage-btn--danger { background: var(--red); border-color: var(--red); color: white; }
.chiffrage-btn--danger:hover { background: #e0342c; }

.chiffrage-new-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
  background: var(--green); color: white; border: none; border-radius: 8px;
  font-size: 12px; font-weight: 600; cursor: pointer; font-family: var(--font-sans); transition: all 0.15s;
}
.chiffrage-new-btn:hover { background: var(--green-light); }

/* ==========================================================================
   MOBILE iOS (< 768px)
   ========================================================================== */
@media (max-width: 767px) {
  .chiffrage-list-header { display: none; }
  .chiffrage-ios-nav { display: none; }
  .chiffrage-ios-search-wrap { display: none; }
  .chiffrage-ios-segment { display: none; }

  .chiffrage-view-header { padding: 10px 14px 6px; gap: 8px; }
  .chiffrage-view-title { font-size: 14px; }
  .chiffrage-view-toggle-btn { padding: 7px 9px; }

  .chiffrage-filterbar { padding: 8px 14px 10px; gap: 8px; }
  .chiffrage-search { width: 100%; padding: 10px 12px 10px 34px; font-size: 16px; }
  .chiffrage-search:focus { width: 100%; }
  .chiffrage-filters { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; width: 100%; gap: 6px; flex-wrap: nowrap; }
  .chiffrage-filters::-webkit-scrollbar { height: 0; }
  .chiffrage-filter-btn { flex-shrink: 0; padding: 8px 14px; font-size: 13px; -webkit-tap-highlight-color: transparent; }
  .chiffrage-filterbar-actions { width: 100%; margin-left: 0; }
  .chiffrage-new-btn { width: 100%; justify-content: center; padding: 10px; }

  /* KPI cards: handled by kpi.css media query */

  .chiffrage-view-body { padding: 14px; }
  .chiffrage-list-view { margin: 0; border-radius: 0; border: none; background: transparent; }
  .chiffrage-grid { grid-template-columns: 1fr; }
  .chiffrage-grid-item { padding: 14px; }
  .chiffrage-list-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; grid-template-columns: none; cursor: default; min-height: 48px; }
  .chiffrage-list-num { display: none; }
  .chiffrage-list-info { flex: 1; }
  .chiffrage-list-client { display: none; }
  .chiffrage-list-date { display: none; }
  .chiffrage-list-badge { flex-shrink: 0; }
  .chiffrage-list-montant { font-size: 15px; text-align: right; flex-shrink: 0; min-width: 80px; }
  .chiffrage-list-chevron { display: flex; }

  /* ─── iOS Éditeur — propre, aéré, adapté mobile ─── */
  .chiffrage-editor-layout { grid-template-columns: 1fr; padding: 16px; gap: 16px; }
  .chiffrage-editor-sidebar { position: static; }
  .chiffrage-editor-main { display: flex; flex-direction: column; gap: 12px; }

  /* Barre d'outils */
  .chiffrage-toolbar {
    padding: 4px 4px 4px 8px; gap: 4px;
    padding-top: calc(4px + env(safe-area-inset-top, 0px));
  }
  .chiffrage-back-btn {
    width: 36px; height: 36px; padding: 0;
    background: transparent; color: var(--green);
    font-size: 0; display: inline-flex; align-items: center; justify-content: center; gap: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .chiffrage-back-btn:hover { background: transparent; }
  .chiffrage-back-btn:active { opacity: 0.5; }
  .chiffrage-back-btn svg { width: 20px !important; height: 20px !important; }
  .chiffrage-toolbar-actions .chiffrage-btn {
    width: 36px; height: 36px; padding: 0;
    font-size: 0; display: inline-flex; align-items: center; justify-content: center; gap: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .chiffrage-toolbar-actions .chiffrage-btn:active { opacity: 0.7; }
  .chiffrage-toolbar-actions .chiffrage-btn svg { width: 20px !important; height: 20px !important; }
  .chiffrage-toolbar-actions .chiffrage-btn--danger { width: 36px; height: 36px; }
  .chiffrage-editor-ref-input { font-size: 17px; font-weight: 700; width: 140px; }

  /* Info — groupe type Réglages iOS */
  .chiffrage-editor-info {
    margin: 0; border-radius: 12px; border: 0.5px solid var(--gray-200);
    padding: 0 16px;
  }
  .chiffrage-editor-info-row { flex-direction: column; gap: 0; }
  .chiffrage-editor-field {
    padding: 10px 0;
    border-bottom: 0.5px solid var(--gray-100);
  }
  .chiffrage-editor-field:last-child { border-bottom: none; }
  .chiffrage-editor-field label {
    font-size: 12px; margin-bottom: 3px; font-weight: 500;
    color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.2px;
  }
  .chiffrage-editor-field select,
  .chiffrage-editor-field input[type="text"],
  .chiffrage-editor-field input[type="number"] {
    font-size: 16px; padding: 4px 0; border: none; background: transparent;
    color: var(--gray-900); -webkit-tap-highlight-color: transparent;
  }

  /* Lignes — carte arrondie */
  .chiffrage-lines-card {
    margin: 0; border-radius: 12px; border: 0.5px solid var(--gray-200);
  }
  .chiffrage-lines-toolbar { padding: 10px 14px; }
  .chiffrage-lines-toolbar span { font-size: 15px; }
  .chiffrage-lines-add-btns { display: none; }
  .cl-add-line {
    padding: 8px 14px; font-size: 13px; min-height: 38px;
    -webkit-tap-highlight-color: transparent; flex-shrink: 0;
  }
  .cl-add-line:active { background: var(--green); color: white; }

  /* Tableau 4 colonnes */
  .cl-table-wrap { -webkit-overflow-scrolling: touch; overflow-x: auto; }
  .cl-table { width: 100%; min-width: 460px; font-size: 13px; table-layout: fixed; }
  .cl-table thead th { padding: 10px 4px; font-size: 11px; white-space: nowrap; }
  .cl-table tbody td { padding: 10px 4px; border-bottom: 0.5px solid var(--gray-100); vertical-align: middle; white-space: nowrap; }
  /* Colonnes masquées */
  .cl-table thead th:nth-child(4),
  .cl-table thead th:nth-child(5),
  .cl-table thead th:nth-child(7),
  .cl-table thead th:nth-child(8),
  .cl-table thead th:nth-child(10),
  .cl-tr-line td:nth-child(4),
  .cl-tr-line td:nth-child(5),
  .cl-tr-line td:nth-child(7),
  .cl-tr-line td:nth-child(8),
  .cl-tr-line td:nth-child(10),
  .cl-tr-subline td:nth-child(4),
  .cl-tr-subline td:nth-child(5),
  .cl-tr-subline td:nth-child(7),
  .cl-tr-subline td:nth-child(8),
  .cl-tr-subline td:nth-child(10) { display: none; width: 0 !important; border: none !important; }
  /* Désignation */
  .cl-table thead th:first-child { width: 40% !important; }
  .cel-desc { font-size: 15px; font-weight: 500; padding: 6px 4px; border-color: transparent !important; background: transparent !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cel-desc:hover { border-color: transparent !important; background: transparent !important; }
  /* Qté + Unité — sur la même ligne, sans retour */
  .cl-table thead th:nth-child(2) { width: 12% !important; text-align: right; padding: 10px 0 10px 2px; }
  .cl-table tbody td:nth-child(2),
  .cl-tr-subline td:nth-child(2) { width: auto; text-align: right; padding: 10px 0 10px 2px; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cl-table tbody td:nth-child(2) input { width: 24px; text-align: right; display: inline; }
  .cl-table thead th:nth-child(3) { width: 8% !important; text-align: left; padding: 10px 0; }
  .cl-table thead th:nth-child(3) .th-unit-full { display: none; }
  .cl-table thead th:nth-child(3) .th-unit-short { display: inline; }
  .cl-table tbody td:nth-child(3) { width: auto; text-align: left; padding: 10px 0; font-size: 13px; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cl-table td:nth-child(3) select { width: auto; min-width: 18px; border: none; background: transparent; padding: 0; font-size: 14px; color: var(--gray-500); -webkit-appearance: none; }
  .cl-tr-line[data-type-ligne="main_oeuvre"] td:nth-child(3) { display: none; }
  /* PV HT */
  .cl-table thead th:nth-child(6) { width: 20% !important; text-align: right; white-space: nowrap; }
  .cl-table tbody td:nth-child(6) { width: auto; text-align: right; white-space: nowrap; overflow: hidden; }
  .cl-table tbody td:nth-child(6) input { width: auto; min-width: 40px; max-width: calc(100% - 14px); text-align: right; font-size: 14px; box-sizing: border-box; }
  .cl-table tbody td:nth-child(6) .cel-pv-currency { font-size: 14px; color: var(--gray-900); margin-left: 2px; }
  .cl-tr-line[data-type-ligne="main_oeuvre"] td:nth-child(6) .cel-pv { display: none; }
  .cl-tr-line[data-type-ligne="main_oeuvre"] td:nth-child(6) .cel-pv-currency { display: none; }
  .cl-tr-line[data-type-ligne="main_oeuvre"] td:nth-child(6) .cel-pv-total { display: inline; font-weight: 700; font-family: var(--font-mono); color: var(--gray-900); }
  /* Total HT */
  .cl-table thead th:nth-child(9) { width: 20% !important; text-align: right; white-space: nowrap; }
  .cl-table tbody td:nth-child(9) { width: auto; text-align: right; white-space: nowrap; overflow: hidden; }
  .cel-line-total { font-size: 15px; font-weight: 700; white-space: nowrap; }

  /* Sections */
  .cl-section-band { padding: 12px 14px; min-height: 44px; }
  .cl-section-name { font-size: 15px; }
  .cl-section-total { font-size: 14px; }
  .cl-section-menu { width: 32px; height: 32px; font-size: 18px; }
  .cl-section-add td { padding: 8px 14px 10px !important; }
  .cl-section-add-btn {
    padding: 8px 14px; font-size: 13px; min-height: 38px;
    -webkit-tap-highlight-color: transparent;
  }
  .cl-section-add-btn:active { opacity: 0.7; }
  .cl-tr-subline td { padding: 4px 6px 4px 16px !important; font-size: 12px; }
  .cl-tr-subline td:first-child { padding-left: 20px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* Options — 2 colonnes arrondies */
  .chiffrage-options-grid { grid-template-columns: 1fr; gap: 12px; }
  .chiffrage-option-block {
    margin: 0; border-radius: 12px; border: 0.5px solid var(--gray-200);
    padding: 12px 14px;
  }
  .chiffrage-option-block--retenue { display: none; }
  .chiffrage-option-block:nth-child(3),
  .chiffrage-option-block:nth-child(4) { grid-column: 1 / -1; }
  .chiffrage-option-title { font-size: 14px; }
  .chiffrage-option-row input[type="number"] { font-size: 15px; padding: 6px 8px; min-height: 36px; }
  .chiffrage-option-block textarea { font-size: 15px; padding: 6px 8px; }

  /* Sidebar totaux — arrondie */
  .ce-sidebar-block { margin: 0; border-radius: 12px; border: 0.5px solid var(--gray-200); }
  .chiffrage-editor-sidebar .ce-sidebar-block + .ce-sidebar-block { margin-top: 12px; }
  .ce-sidebar-title { font-size: 13px; padding: 14px 18px 10px; }
  .ce-totaux-row { padding: 8px 0; font-size: 15px; }
  .ce-totaux-row--sub { font-size: 14px; padding: 6px 0; }
  .ce-totaux-row--big span:last-child { font-size: 18px; }
  .ce-totaux-row--net { margin: 6px -18px -12px; padding: 12px 18px; }
  .ce-vent-row { padding: 6px 0; font-size: 14px; }

  .chiffrage-list-view--compact { grid-template-columns: 1fr; margin: 12px 14px; gap: 10px; }
  .chiffrage-compact-card { padding: 12px 14px; }

  /* ═══ iOS LINE EDITOR SHEET ═══ */
  .chiffrage-ios-editor-overlay {
    position: absolute; inset: 0; z-index: 100;
    background: rgba(0,0,0,0.3); backdrop-filter: blur(10px);
    display: none; align-items: flex-end; justify-content: center;
  }
  .chiffrage-ios-editor-overlay.active { display: flex; }

  .chiffrage-ios-editor-sheet {
    width: 100%; max-height: 85%; background: #f2f2f6;
    border-radius: 14px 14px 0 0; overflow: hidden;
    display: flex; flex-direction: column;
    animation: chiffrage-ios-slide-up 0.3s var(--ease-ios);
  }
  @keyframes chiffrage-ios-slide-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .chiffrage-ios-editor-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px 8px; background: #f2f2f6;
    border-bottom: 0.5px solid rgba(0,0,0,0.08); flex-shrink: 0;
  }
  .chiffrage-ios-editor-header button {
    background: none; border: none; font-size: 16px; font-weight: 500;
    font-family: var(--font-sans); cursor: pointer; padding: 4px 0;
    -webkit-tap-highlight-color: transparent;
  }
  .chiffrage-ios-editor-cancel { color: var(--gray-500); }
  .chiffrage-ios-editor-cancel:active { opacity: 0.5; }
  .chiffrage-ios-editor-save { color: var(--green); font-weight: 600; }
  .chiffrage-ios-editor-save:active { opacity: 0.5; }
  .chiffrage-ios-editor-title {
    font-size: 16px; font-weight: 600; color: var(--gray-900);
  }

  .chiffrage-ios-editor-scroll {
    flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 0 0 16px;
  }

  /* Type selector */
  .chiffrage-ios-edit-type {
    display: flex; gap: 0; margin: 12px 16px; padding: 2px;
    background: #e5e5ea; border-radius: 9px; overflow: hidden;
  }
  .chiffrage-ios-edit-type-btn {
    flex: 1; padding: 8px 0; border: none; background: transparent;
    font-size: 13px; font-weight: 500; color: var(--gray-600);
    font-family: var(--font-sans); border-radius: 7px; cursor: pointer;
    transition: all 0.15s; -webkit-tap-highlight-color: transparent;
  }
  .chiffrage-ios-edit-type-btn.active {
    background: white; color: var(--gray-900); font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  }
  .chiffrage-ios-edit-type-btn:active { opacity: 0.7; }

  /* iOS form groups (iOS settings style) */
  .ios-edit-fields {
    background: white; border-radius: 10px; margin: 0 16px 12px;
    overflow: hidden;
  }
  .chiffrage-ios-field-group {
    padding: 10px 16px; border-bottom: 0.5px solid var(--gray-100);
  }
  .chiffrage-ios-field-group:last-child { border-bottom: none; }
  .chiffrage-ios-field-group label {
    display: block; font-size: 12px; font-weight: 500; color: var(--gray-500);
    margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.2px;
  }
  .chiffrage-ios-input {
    width: 100%; border: none; background: transparent;
    font-size: 16px; font-family: var(--font-sans); color: var(--gray-900);
    outline: none; padding: 4px 0; box-sizing: border-box;
    -webkit-appearance: none;
  }
  .chiffrage-ios-input::placeholder { color: var(--gray-300); }
  .chiffrage-ios-select {
    width: 100%; border: none; background: transparent;
    font-size: 16px; font-family: var(--font-sans); color: var(--gray-900);
    outline: none; padding: 4px 0; -webkit-appearance: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' fill='none'/%3E%3C/svg%3E") right center no-repeat;
    padding-right: 16px;
  }

  .chiffrage-ios-field-row {
    display: flex; gap: 0;
  }
  .chiffrage-ios-field-row .chiffrage-ios-field-group {
    flex: 1; border-right: 0.5px solid var(--gray-100);
  }
  .chiffrage-ios-field-row .chiffrage-ios-field-group:last-child { border-right: none; }
  .chiffrage-ios-field-row.three-col .chiffrage-ios-field-group { flex: 1; }
  .flex-1 { flex: 1; }

  /* Delete button */
  .chiffrage-ios-editor-delete-wrap {
    margin: 0 16px; background: white; border-radius: 10px; overflow: hidden;
  }
  .chiffrage-ios-editor-delete {
    width: 100%; padding: 14px 16px; border: none; background: white;
    font-size: 16px; color: var(--red); font-family: var(--font-sans);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    gap: 8px; font-weight: 500; -webkit-tap-highlight-color: transparent;
  }
  .chiffrage-ios-editor-delete:active { background: var(--gray-50); }
}
