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

    body {
      font-family: 'Nunito', sans-serif;
      background: linear-gradient(135deg, #0369a1 0%, #0ea5e9 60%, #e0f2fe 100%);
      min-height: 100vh;
      padding: 20px;
    }

    .container { max-width: 1200px; margin: 0 auto; }

    /* ── Header ── */
    .header {
      background: white; border-radius: 12px; padding: 20px 24px;
      margin-bottom: 16px; display: flex; justify-content: space-between;
      align-items: center; box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }
    .header-left { display: flex; align-items: center; gap: 16px; }
    .header-left img { height: 40px; }
    .badge { background: #f97316; color: white; padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; }
    .header-right { display: flex; align-items: center; gap: 16px; }
    .user-info { text-align: right; font-size: 13px; color: #666; }
    .logout-btn { background: #ef4444; color: white; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 700; }
    .logout-btn:hover { background: #dc2626; }
    .breadcrumb { margin-bottom: 16px; }
    .breadcrumb a { color: white; text-decoration: none; font-size: 14px; font-weight: 600; opacity: 0.9; }
    .breadcrumb a:hover { opacity: 1; }

    /* ── Message ── */
    .message { padding: 12px 18px; border-radius: 8px; font-size: 13px; font-weight: 600;
      margin-bottom: 14px; display: none; }
    .message.active { display: block; }
    .message.success { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
    .message.error   { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }

    /* ── Tabs ── */
    .tabs-bar {
      display: flex; gap: 4px; background: white; border-radius: 12px;
      padding: 6px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }
    .tab-btn {
      flex: 1; padding: 10px 16px; border: none; border-radius: 8px; cursor: pointer;
      font-family: 'Nunito', sans-serif; font-size: 14px; font-weight: 700;
      background: transparent; color: #64748b; transition: all 0.18s;
    }
    .tab-btn:hover { background: #f1f5f9; color: #1e293b; }
    .tab-btn.active { background: #0ea5e9; color: white; }

    .tab-panel { display: none; }
    .tab-panel.active { display: block; }

    /* ── Cards ── */
    .card {
      background: white; border-radius: 12px; padding: 24px;
      margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }
    .card h2 { font-size: 16px; font-weight: 800; color: #1e293b; margin-bottom: 14px; }
    .section-desc { font-size: 12px; color: #64748b; margin-bottom: 18px; line-height: 1.6; }

    /* ── Forms ── */
    .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
    @media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
    .form-group { display: flex; flex-direction: column; gap: 5px; }
    .form-group label { font-size: 12px; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: 0.4px; }
    .form-group input {
      padding: 9px 12px; border: 1.5px solid #e2e8f0; border-radius: 8px;
      font-size: 14px; font-family: 'Nunito', sans-serif; color: #1e293b;
      transition: border-color 0.2s; outline: none;
    }
    .form-group input:focus { border-color: #0ea5e9; }
    .form-desc { font-size: 11px; color: #94a3b8; }

    /* ── Save button ── */
    .save-btn {
      display: flex; align-items: center; justify-content: center; gap: 8px;
      width: 100%; padding: 12px; background: #0ea5e9; color: white; border: none;
      border-radius: 10px; font-size: 14px; font-weight: 800; cursor: pointer;
      font-family: 'Nunito', sans-serif; transition: background 0.2s;
    }
    .save-btn:hover { background: #0369a1; }
    .save-btn:disabled { background: #94a3b8; cursor: not-allowed; }

    /* ── Spinner ── */
    .spinner { width: 22px; height: 22px; border: 3px solid #e2e8f0; border-top-color: #0ea5e9; border-radius: 50%; animation: spin 0.8s linear infinite; margin: 20px auto; }
    @keyframes spin { to { transform: rotate(360deg); } }
    .loading { display: flex; justify-content: center; padding: 20px; }

    /* ── Module accordion (chiffrage) ── */
    .module-section { border: 1.5px solid #e2e8f0; border-radius: 10px; margin-bottom: 8px; overflow: hidden; }
    .module-section.collapsed .module-body { display: none; }
    .module-section.collapsed .module-toggle { transform: rotate(-90deg); }
    .module-header {
      display: flex; align-items: center; gap: 10px; padding: 12px 16px;
      cursor: pointer; background: #f8fafc; transition: background 0.15s;
    }
    .module-header:hover { background: #f1f5f9; }
    .module-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
    .module-label { flex: 1; font-size: 13px; font-weight: 700; color: #1e293b; }
    .module-total { font-size: 12px; font-weight: 700; color: #0ea5e9; background: #e0f2fe; padding: 2px 8px; border-radius: 20px; }
    .module-toggle { font-size: 11px; color: #94a3b8; transition: transform 0.2s; }
    .module-body { padding: 0 16px 16px; }
    .table { width: 100%; border-collapse: collapse; margin-top: 12px; }
    .table th { background: #f1f5f9; padding: 8px 12px; text-align: left; font-size: 11px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.4px; }
    .table td { padding: 8px 12px; border-bottom: 1px solid #f1f5f9; font-size: 13px; color: #334155; vertical-align: middle; }
    .table tr:last-child td { border-bottom: none; }
    .table tbody tr:hover { background: #f8fafc; }
    .table input[type="number"] {
      width: 80px; padding: 5px 8px; border: 1.5px solid #e2e8f0; border-radius: 6px;
      font-size: 13px; font-family: 'Nunito', sans-serif; text-align: right; outline: none;
    }
    .table input[type="number"]:focus { border-color: #0ea5e9; }
    .table input[type="text"].madper-input {
      width: 100%; padding: 5px 8px; border: 1.5px solid #e2e8f0; border-radius: 6px;
      font-size: 13px; font-family: 'Nunito', sans-serif; outline: none; box-sizing: border-box;
    }
    .table input[type="text"].madper-input:focus { border-color: #0ea5e9; }
    .btn-add-row {
      display: inline-flex; align-items: center; gap: 5px;
      margin: 8px 0 4px; padding: 5px 12px; border-radius: 6px;
      background: #f0f9ff; border: 1.5px dashed #0ea5e9; color: #0ea5e9;
      font-size: 12px; font-weight: 700; cursor: pointer; transition: all 0.15s;
    }
    .btn-add-row:hover { background: #e0f2fe; }
    .btn-del-row {
      display: inline-flex; align-items: center; justify-content: center;
      width: 22px; height: 22px; border-radius: 4px;
      background: #fee2e2; border: none; color: #ef4444;
      font-size: 14px; font-weight: 700; cursor: pointer; line-height: 1;
      transition: background 0.15s; flex-shrink: 0;
    }
    .btn-del-row:hover { background: #fca5a5; }
    .table .col-del { width: 36px; text-align: center; padding: 4px 6px; }
    .btn-move-row {
      display: inline-flex; align-items: center; justify-content: center;
      width: 20px; height: 20px; border-radius: 4px;
      background: #f1f5f9; border: 1px solid #cbd5e1; color: #475569;
      font-size: 11px; font-weight: 700; cursor: pointer; line-height: 1;
      transition: background 0.15s; flex-shrink: 0; padding: 0;
    }
    .btn-move-row:hover { background: #e2e8f0; }
    .table .col-order { width: 48px; text-align: center; padding: 4px 4px; white-space: nowrap; }
    .custom-sections-area { margin-top: 20px; }
    .custom-sections-area h3 { font-size: 14px; font-weight: 700; color: #1e293b; margin: 0 0 12px; }
    .custom-section-block {
      border: 1.5px solid #e2e8f0; border-radius: 10px; margin-bottom: 12px; overflow: hidden;
    }
    .custom-section-header {
      display: flex; align-items: center; gap: 10px; padding: 10px 14px;
      background: #f8fafc;
    }
    .custom-section-title-input {
      flex: 1; padding: 5px 8px; border: 1.5px solid #e2e8f0; border-radius: 6px;
      font-size: 13px; font-weight: 700; font-family: 'Nunito', sans-serif; outline: none; color: #1e293b;
    }
    .custom-section-title-input:focus { border-color: #0ea5e9; }
    .btn-del-section {
      padding: 4px 10px; border-radius: 6px; background: #fee2e2; border: none;
      color: #ef4444; font-size: 12px; font-weight: 700; cursor: pointer;
      transition: background 0.15s; white-space: nowrap;
    }
    .btn-del-section:hover { background: #fca5a5; }
    .custom-section-body { padding: 8px 14px 12px; }
    .btn-add-section {
      display: inline-flex; align-items: center; gap: 6px;
      margin-top: 8px; padding: 8px 16px; border-radius: 8px;
      background: #f0fdf4; border: 1.5px dashed #10b981; color: #059669;
      font-size: 13px; font-weight: 700; cursor: pointer; transition: all 0.15s;
    }
    .btn-add-section:hover { background: #dcfce7; }

    /* ── Onglet 3 : Contenu des modules ── */
    .mod-selector {
      display: flex; flex-wrap: wrap; gap: 8px; padding: 16px;
      background: #f8fafc; border-radius: 10px; margin-bottom: 16px;
    }
    .mod-chip {
      display: inline-flex; align-items: center; gap: 5px;
      padding: 6px 10px 6px 14px; border-radius: 20px; border: 1.5px solid #e2e8f0;
      font-size: 12px; font-weight: 700; cursor: pointer; color: #64748b;
      background: white; transition: all 0.15s; white-space: nowrap;
    }
    .mod-chip:hover { border-color: #0ea5e9; color: #0369a1; }
    .mod-chip.active { background: #0ea5e9; border-color: #0ea5e9; color: white; }
    .chip-edit-btn {
      opacity: 0; font-size: 11px; line-height: 1; padding: 1px 3px;
      border-radius: 4px; transition: opacity 0.15s, background 0.15s;
    }
    .mod-chip:hover .chip-edit-btn { opacity: 0.6; }
    .chip-edit-btn:hover { opacity: 1 !important; background: rgba(0,0,0,0.08); }

    .sp-section { border: 1.5px solid #e2e8f0; border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
    .sp-section.collapsed .sp-body { display: none; }
    .sp-section.collapsed .sp-toggle { transform: rotate(-90deg); }
    .sp-header {
      display: flex; align-items: center; gap: 10px; padding: 10px 14px;
      cursor: pointer; background: #f8fafc; user-select: none;
    }
    .sp-header:hover { background: #f1f5f9; }
    .sp-label { flex: 1; font-size: 13px; font-weight: 700; color: #334155; }
    .sp-count { font-size: 11px; color: #94a3b8; font-weight: 600; }
    .sp-toggle { font-size: 11px; color: #94a3b8; transition: transform 0.2s; }
    .sp-header-actions { display: flex; gap: 6px; }
    .sp-body { padding: 10px 14px; }

    .row-item {
      display: flex; align-items: center; gap: 8px; padding: 7px 10px;
      border-radius: 8px; transition: background 0.12s;
    }
    .row-item:hover { background: #f1f5f9; }
    .row-item.inactive { opacity: 0.45; }
    .row-drag { cursor: grab; color: #cbd5e1; font-size: 14px; flex-shrink: 0; }
    .row-label-text { flex: 1; font-size: 13px; color: #334155; line-height: 1.4; }
    .row-label-input {
      flex: 1; font-size: 13px; font-family: 'Nunito', sans-serif; color: #1e293b;
      border: 1.5px solid #0ea5e9; border-radius: 6px; padding: 4px 8px; outline: none;
    }
    .row-actions { display: flex; gap: 4px; flex-shrink: 0; }
    .btn-icon {
      width: 28px; height: 28px; border: none; border-radius: 6px; cursor: pointer;
      display: flex; align-items: center; justify-content: center; font-size: 13px;
      transition: all 0.15s; background: transparent; color: #94a3b8;
    }
    .btn-icon:hover { background: #e2e8f0; color: #475569; }
    .btn-icon.danger:hover { background: #fee2e2; color: #ef4444; }
    .btn-icon.active-toggle { color: #22c55e; }
    .btn-icon.inactive-toggle { color: #94a3b8; }

    .add-row-btn {
      display: flex; align-items: center; gap: 7px; width: 100%;
      padding: 7px 10px; border: 1.5px dashed #e2e8f0; border-radius: 8px;
      background: transparent; cursor: pointer; color: #94a3b8; font-size: 12px;
      font-weight: 700; font-family: 'Nunito', sans-serif; margin-top: 6px;
      transition: all 0.15s;
    }
    .add-row-btn:hover { border-color: #0ea5e9; color: #0369a1; background: #f0f9ff; }

    .add-sp-btn {
      display: flex; align-items: center; gap: 8px; width: 100%;
      padding: 10px 14px; border: 1.5px dashed #cbd5e1; border-radius: 10px;
      background: transparent; cursor: pointer; color: #64748b; font-size: 13px;
      font-weight: 700; font-family: 'Nunito', sans-serif; margin-top: 8px;
      transition: all 0.15s;
    }
    .add-sp-btn:hover { border-color: #0ea5e9; color: #0369a1; background: #f0f9ff; }

    .edit-sp-input {
      font-size: 13px; font-family: 'Nunito', sans-serif; font-weight: 700; color: #1e293b;
      border: 1.5px solid #0ea5e9; border-radius: 6px; padding: 3px 8px; outline: none; width: 200px;
    }

    .warn-badge {
      font-size: 10px; background: #fef9c3; color: #a16207; border: 1px solid #fde047;
      padding: 2px 7px; border-radius: 4px; font-weight: 700;
    }

    .mod-empty { text-align: center; padding: 32px; color: #94a3b8; font-size: 14px; }

    .rows-loading { display: flex; align-items: center; gap: 8px; padding: 20px; color: #64748b; font-size: 13px; }

    .fold-bar {
      display: flex; justify-content: flex-end; padding: 0 2px 10px;
    }
    .fold-btn {
      background: transparent; border: 1.5px solid #e2e8f0; border-radius: 8px;
      padding: 5px 12px; font-family: 'Nunito', sans-serif; font-size: 12px;
      font-weight: 700; color: #64748b; cursor: pointer; transition: all 0.15s;
    }
    .fold-btn:hover { border-color: #0ea5e9; color: #0369a1; background: #f0f9ff; }
  