:root{font-family:Inter,Segoe UI,Arial,sans-serif;color:#242424;background:#f5f4f1}*{box-sizing:border-box}body{margin:0}header{height:58px;background:#fff;border-bottom:1px solid #ddd;display:flex;align-items:center;justify-content:space-between;padding:0 28px}.brand{font-weight:800;color:#222;text-decoration:none;font-size:19px}.brand span{font-weight:500;color:#777}main{max-width:1500px;margin:28px auto;padding:0 24px}h1{margin:5px 0;font-size:28px}h2{font-size:18px;margin-top:0}p{color:#686868}.titlebar,.row,.inline{display:flex;align-items:center;justify-content:space-between;gap:14px}.back{color:#777;text-decoration:none;font-size:13px}.card{background:#fff;border:1px solid #deddd9;border-radius:10px;padding:20px;box-shadow:0 1px 2px #00000008;margin-bottom:16px}.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(330px,1fr));gap:16px}.campaign{text-decoration:none;color:inherit}.campaign:hover{border-color:#aaa}.badge{font-size:11px;padding:4px 8px;background:#efefec;border-radius:999px}.metric{font-size:27px;font-weight:800}.metric small{font-size:12px;font-weight:500;color:#777}.stats{display:grid;grid-template-columns:repeat(3,160px);gap:12px;margin:18px 0}.stats .card{display:flex;flex-direction:column}.stats strong{font-size:25px}.stats span{font-size:12px;color:#777}button,.button{border:0;background:#292929;color:white;border-radius:7px;padding:10px 14px;font-weight:650;text-decoration:none;cursor:pointer}.secondary,.ghost{background:#ecebe7;color:#333}.danger{background:#8b2525}.ghost{padding:7px 10px}label{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:650}input,select,textarea{border:1px solid #ccc;border-radius:6px;padding:9px;background:white;font:inherit}.formgrid{display:grid;grid-template-columns:1fr 1fr;gap:18px;max-width:850px}.full{grid-column:1/-1}.login{max-width:400px;margin:80px auto}.login form{display:grid;gap:15px}.alert{background:#fee8e8;padding:10px;border-radius:6px;margin:10px 0}.success{background:#e7f5e8;padding:10px;border-radius:6px;margin:10px 0}.hint,.muted{font-size:12px;color:#888}.tablewrap{overflow:auto}table{width:100%;border-collapse:collapse;font-size:13px}th,td{text-align:left;padding:10px;border-bottom:1px solid #eee;vertical-align:top}th{font-size:11px;text-transform:uppercase;color:#777}.token{display:inline-block;max-width:240px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#888}.status{display:inline-block;padding:4px 7px;border-radius:999px;background:#eee;font-size:11px}.status-authorized{background:#e3f3e5;color:#276432}.status-failed{background:#fbe5e5;color:#8a2222}.status-processing,.status-checkout_created{background:#fff0cc;color:#765814}.status-released{background:#e8e8e8;color:#555}.error-inline{color:#8a2222;font-size:11px;max-width:260px;display:inline-block}.audit{margin-top:18px}.audit-details{font-size:11px;color:#777;max-width:520px}@media(max-width:700px){.formgrid{grid-template-columns:1fr}.stats{grid-template-columns:repeat(3,1fr)}.inline,.titlebar{align-items:flex-start;flex-direction:column}}.source-picker{display:grid;grid-template-columns:180px auto;gap:10px;align-items:end}.source-picker .full{grid-column:1/-1}.language-rule-row{display:grid;grid-template-columns:minmax(220px,1.4fr) 170px minmax(160px,1fr) 90px 42px;gap:8px;margin:8px 0;align-items:center}.rules-actions{display:flex;gap:8px;flex-wrap:wrap}.danger{background:#a83232!important;color:#fff!important}@media(max-width:800px){.source-picker,.language-rule-row{grid-template-columns:1fr}}

.rule-multi-value{min-height:84px;padding:6px;border:1px solid #ccc;border-radius:7px;background:#fff}
.rule-multi-value option{padding:4px 6px}

.danger-zone{margin-top:18px;border-color:#e4bcbc}
.danger-zone h2{margin-top:0}
.delete-campaign-confirm{margin-top:14px;padding-top:12px;border-top:1px solid #ead0d0}
.delete-campaign-confirm input{max-width:420px;margin-right:8px}
/* Slot 4.4 - harmonisation générale */
:root{--control-h:38px;--gap:10px;--radius:8px}
button,.button,input,select,textarea{box-sizing:border-box}
button,.button{
  min-height:var(--control-h);padding:8px 13px;border-radius:var(--radius);
  line-height:1.2;display:inline-flex;align-items:center;justify-content:center;
  gap:6px;vertical-align:middle
}
.actions,.campaign-actions,.batchbar,.field-actions,.action-stack,.inline,.rules-actions{
  display:flex;align-items:center;gap:8px;flex-wrap:wrap
}
.actions form,.campaign-actions form,.batchbar form,.action-stack form{margin:0}
.action-stack button,.action-stack .button{min-width:76px}
input:not([type="checkbox"]):not([type="radio"]),select,textarea{
  min-height:var(--control-h);border-radius:7px
}
.template-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(470px,1fr));gap:14px}
.template-card{min-width:0}
.variables-help{font-size:.86rem;color:#666;margin:4px 0 10px}
.variables-help code{background:#f1efeb;padding:2px 5px;border-radius:4px}
.html-editor{margin-top:5px}
.quill-host{min-height:260px;background:#fff}
.ql-toolbar.ql-snow{border-radius:8px 8px 0 0}
.ql-container.ql-snow{border-radius:0 0 8px 8px;min-height:260px;font-size:14px}
.ql-editor img{max-width:100%;height:auto}
.sms-counter{margin-top:6px;text-align:right}
.warning-text{color:#a44b00!important;font-weight:700}
.overview-card{
  background:#fff;border:1px solid #e1dfda;border-radius:12px;
  padding:15px 18px;margin:14px 0
}
.overview-head{
  display:flex;justify-content:space-between;align-items:baseline;
  gap:12px;margin-bottom:14px
}
.overview-head strong{font-size:1.65rem}
.overview-head span{margin-left:6px;color:#666}
.overview-mini{color:#777;font-size:.9rem}
.progress-grid{display:grid;grid-template-columns:1fr 1fr;gap:24px}
.progress-label{display:flex;justify-content:space-between;gap:10px;margin-bottom:6px}
.progress-track{
  width:100%;height:10px;background:#eceae6;border-radius:999px;
  overflow:hidden;margin-bottom:6px
}
.progress-value{height:100%;background:#2f2f2f;border-radius:inherit}
.return-progress{background:#747474}
.progress-block small{color:#777}
@media(max-width:900px){
  .template-grid{grid-template-columns:1fr}
  .progress-grid{grid-template-columns:1fr}
}
.field-filter{width:min(440px,100%);margin:8px 0}.source-fields-list{border:1px solid #e3e1dc;border-radius:9px;max-height:390px;overflow:auto}.source-field-row{display:grid;grid-template-columns:minmax(220px,1fr) 150px 110px;gap:10px;align-items:center;padding:8px 10px;margin:0;border-bottom:1px solid #eee}.source-field-row:last-child{border-bottom:0}.source-field-row:hover{background:#faf9f7}.source-field-name{display:flex;flex-direction:column}.source-field-name small{color:#888}.variable-picker{display:grid;grid-template-columns:minmax(180px,1fr) minmax(300px,1.6fr) auto;gap:8px;align-items:center;padding:10px;margin:10px 0 14px;background:#f7f6f2;border-radius:9px}.variable-picker input,.variable-picker select{width:100%}.tablewrap th small{display:block;font-weight:400;color:#888;margin-top:2px}@media(max-width:800px){.source-field-row,.variable-picker{grid-template-columns:1fr}}
/* Slot 4.4.3 — templates */
.template-stack{display:flex;flex-direction:column;gap:10px}
.template-card{width:100%;padding:0;overflow:visible}
.template-summary{list-style:none;cursor:pointer;padding:14px 16px;display:flex;align-items:center;justify-content:space-between;gap:12px;user-select:none}
.template-summary::-webkit-details-marker{display:none}
.template-summary>span:first-child{display:flex;align-items:baseline;gap:10px}
.template-summary small{color:#777}
.template-summary-right{display:flex;align-items:center;gap:10px}
.chevron{font-size:16px;transition:transform .15s ease}
.template-card[open] .chevron{transform:rotate(180deg)}
.template-form{border-top:1px solid #ece9e4;padding:15px 16px 17px}

.template-toolbar{display:flex;align-items:end;justify-content:space-between;gap:12px;margin-bottom:14px}
.variable-picker{flex:1 1 720px;min-width:0;display:grid;grid-template-columns:minmax(150px,.7fr) minmax(0,1.3fr) auto;align-items:end;gap:8px;padding:0;margin:0;background:transparent}
.variable-picker>*{min-width:0;max-width:100%}
.variable-select{width:100%;min-width:0}
.template-actions-top{display:flex;flex:0 0 auto;gap:8px;align-items:center;flex-wrap:wrap}

.preview-reference{border:1px solid #dedbd5;background:#f7f6f2;border-radius:9px;padding:9px 12px;margin-bottom:12px;color:#555}

.ql-toolbar.ql-snow{padding:5px 7px}
.ql-snow .ql-formats{margin-right:7px}
.ql-snow.ql-toolbar button,.ql-snow .ql-toolbar button{width:24px;height:24px;min-height:24px;padding:3px}
.ql-snow .ql-picker{font-size:12px}
.ql-snow .ql-picker-label{min-height:24px;padding-top:2px;padding-bottom:2px}
.ql-container.ql-snow{min-height:230px}

.sms-counter{text-align:left;padding:7px 9px;border-radius:7px;background:#f7f6f2}

.template-preview-dialog{width:min(820px,calc(100vw - 32px));max-height:calc(100vh - 50px);border:0;border-radius:12px;padding:0;box-shadow:0 15px 50px rgba(0,0,0,.25)}
.template-preview-dialog::backdrop{background:rgba(0,0,0,.35)}
.preview-dialog-head{position:sticky;top:0;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 15px;background:#fff;border-bottom:1px solid #e6e3de}
.preview-dialog-head>div{display:flex;flex-direction:column}
.preview-dialog-head small{color:#777}
.preview-close{width:32px;min-width:32px;padding:0;font-size:19px}
.preview-email-subject{padding:12px 18px;background:#f7f6f2;border-bottom:1px solid #e6e3de;font-weight:700}
.preview-content{padding:20px;overflow:auto}
.preview-email-body img{max-width:100%;height:auto}
.preview-sms-body{white-space:pre-wrap;font-size:16px}
.preview-sms-meta{margin:0 20px 20px;padding:9px 11px;background:#f7f6f2;border-radius:7px;color:#555}

@media(max-width:900px){
  .template-toolbar{flex-direction:column;align-items:stretch}
  .variable-picker{grid-template-columns:1fr}
  .template-actions-top{justify-content:flex-start}
}
/* Slot 4.5 — Gestion utilisateurs */
.header-user-actions{margin-left:auto;display:flex;align-items:center;gap:12px}.header-admin-link{text-decoration:none;font-weight:700;color:inherit}.header-user-name{color:#777;font-size:.88rem}
.users-overview{display:flex;gap:28px;align-items:center;margin-bottom:12px}.user-kpi{display:flex;align-items:baseline;gap:6px}.user-kpi strong{font-size:1.7rem}.user-kpi span{color:#777}
.users-table td:first-child{min-width:220px}.users-table td:first-child small{display:block;color:#777;margin-top:2px}.user-disabled{opacity:.58}
.role-badge{display:inline-flex;padding:4px 8px;border-radius:999px;background:#efede8;font-size:.82rem;font-weight:700}.role-admin{background:#dedbd3}
.status-dot{display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:5px;background:#aaa}.status-dot.active{background:#4b8b55}.status-dot.inactive{background:#aaa}
.user-actions{display:flex;gap:6px;align-items:center;flex-wrap:wrap}.user-actions form{margin:0}button.compact,.button.compact{min-height:32px;padding:5px 9px;font-size:.84rem}
.user-edit-card{max-width:820px}.user-active-check{align-self:end;min-height:38px}.info-box{margin:14px 0;padding:11px 13px;border-radius:8px;background:#f5f3ee;color:#555}.account-meta{display:flex;gap:20px;flex-wrap:wrap;margin:10px 0 15px;color:#777;font-size:.88rem}
.auth-card{width:min(520px,calc(100% - 24px));margin:50px auto}.login-help{margin:10px 0 0;text-align:right;font-size:.9rem}.password-help{margin:-3px 0 12px;color:#777;font-size:.85rem}
@media(max-width:800px){.users-overview{align-items:flex-start;flex-direction:column;gap:8px}.header-user-name{display:none}}
/* Slot 4.5.2 — Source HTML */
.html-source-wrap{margin-top:8px}
.html-source-head{display:flex;justify-content:space-between;gap:12px;align-items:baseline;margin-bottom:6px}
.html-source-head span{color:#777;font-size:.85rem}
.html-source{
  width:100%;min-height:330px;padding:12px;resize:vertical;
  font-family:Consolas,"Courier New",monospace;font-size:13px;line-height:1.45;
  tab-size:2;white-space:pre;overflow:auto;background:#171717;color:#f1f1f1;
  border:1px solid #333;border-radius:8px
}
.toggle-html-source{min-width:66px}

/* Slot 4.6 — batch preview */
.batch-preview-dialog,.batch-confirm-dialog{width:min(820px,92vw);border:0;border-radius:12px;padding:22px;box-shadow:0 18px 60px rgba(0,0,0,.28)}
.batch-preview-dialog::backdrop,.batch-confirm-dialog::backdrop{background:rgba(0,0,0,.45)}
.batch-preview-head,.batch-preview-meta,.batch-preview-nav{display:flex;align-items:center;justify-content:space-between;gap:12px}
.batch-preview-head small{display:block;margin-top:3px;color:#777}
.batch-preview-meta{margin:12px 0;color:#666;font-size:.92rem}
.batch-preview-subject{font-weight:700;border-bottom:1px solid #ddd;padding:10px 0;margin-bottom:12px}
.batch-preview-body{min-height:180px;max-height:52vh;overflow:auto;border:1px solid #ddd;border-radius:8px;padding:16px;background:#fff;white-space:pre-wrap}
.batch-preview-nav{margin-top:14px}
.batch-preview-confirm-actions{justify-content:flex-end;margin-top:18px}


/* Slot 4.6.1 — tri / filtres participants */
#participants-table .participant-sort-head th.sortable{
  cursor:pointer;
  user-select:none;
  white-space:nowrap;
}
#participants-table .participant-sort-head th.sortable:hover{
  text-decoration:underline;
}
#participants-table .sort-indicator::after{content:"↕";opacity:.28;font-size:.8em;margin-left:4px}
#participants-table th.sort-asc .sort-indicator::after{content:"▲";opacity:.9}
#participants-table th.sort-desc .sort-indicator::after{content:"▼";opacity:.9}
#participants-table .participant-filter-head th{
  padding-top:4px;
  padding-bottom:8px;
  vertical-align:top;
}
#participants-table .participant-filter-head input{
  width:100%;
  min-width:72px;
  padding:6px 7px;
  font-size:12px;
  border:1px solid #d8d8d8;
  border-radius:6px;
  box-sizing:border-box;
}
#participants-table .participant-filter-head input:focus{
  outline:2px solid rgba(0,0,0,.12);
  outline-offset:1px;
}
.table-filter-clear{
  min-width:28px;
  padding:5px 8px;
  line-height:1;
}
#participants-table tr[hidden]{display:none}
