:root {
  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --surface2: #F5F5F7;
  --surface3: #E8E8ED;
  --border: rgba(0,0,0,0.08);
  --border2: rgba(0,0,0,0.14);
  --text: #1D1D1F;
  --text2: #6E6E73;
  --text3: #AEAEB2;
  --blue: #0071E3;
  --blue-light: #E8F1FD;
  --green: #28CD41;
  --green-light: #EAF8EC;
  --amber: #FF9500;
  --amber-light: #FFF4E5;
  --red: #FF3B30;
  --red-light: #FFF0EF;
  --cyan: #06B6D4;
  --cyan-light: #ECFEFF;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 24px 64px rgba(0,0,0,0.12), 0 4px 16px rgba(0,0,0,0.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font-family: inherit; }

/* ── Accessibilité : focus clavier visible ── */
:focus { outline: none; }
:focus-visible {
  outline: 2.5px solid var(--blue);
  outline-offset: 2px;
  border-radius: 6px;
}
button:focus-visible, .btn:focus-visible, .nav-btn:focus-visible {
  outline: 2.5px solid var(--blue);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(0,113,227,0.15);
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--blue) !important;
  box-shadow: 0 0 0 3px rgba(0,113,227,0.15) !important;
}
.answer-item:focus-visible, .tree-item:focus-visible, .wf-card:focus-visible, .wf-list-row:focus-visible {
  outline: 2.5px solid var(--blue);
  outline-offset: 2px;
}
::-webkit-scrollbar { width: 5px; } ::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }
.app { display: flex; height: 100vh; overflow: hidden; }

/* SIDEBAR */
.sidebar { width: 236px; background: rgba(255,255,255,0.9); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.logo-wrap { padding: 22px 20px 16px; border-bottom: 1px solid var(--border); }
.logo { font-size: 17px; font-weight: 700; letter-spacing: -0.4px; color: var(--text); }
.logo span { color: var(--blue); }
.logo-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }
.mode-toggle { margin: 12px 12px 6px; display: flex; background: var(--surface3); border-radius: 10px; padding: 3px; gap: 2px; }
.mode-btn { flex: 1; padding: 7px 4px; border-radius: 8px; border: none; background: none; font-size: 12px; font-weight: 500; color: var(--text2); cursor: pointer; transition: all 0.2s; }
.mode-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.nav-section { padding: 8px 10px 4px; }
.nav-label { font-size: 10.5px; font-weight: 600; color: var(--text3); padding: 0 10px; margin-bottom: 4px; letter-spacing: 0.04em; text-transform: uppercase; display: block; }
.nav-btn { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border-radius: var(--radius); border: none; background: none; color: var(--text2); font-size: 13.5px; font-weight: 400; cursor: pointer; text-align: left; transition: all 0.15s; }
.nav-btn:hover { background: var(--surface3); color: var(--text); }
.nav-btn.active { background: var(--blue-light); color: var(--blue); font-weight: 500; }
.nav-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.nav-count { margin-left: auto; font-size: 11px; font-weight: 500; background: var(--surface3); color: var(--text3); padding: 1px 7px; border-radius: 20px; }
.nav-btn.active .nav-count { background: rgba(0,113,227,0.12); color: var(--blue); }
.sidebar-footer { margin-top: auto; padding: 14px 18px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: white; flex-shrink: 0; }
.user-name { font-size: 12.5px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text3); }

/* MAIN */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { background: rgba(255,255,255,0.85); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); padding: 0 26px; display: flex; align-items: center; gap: 12px; flex-shrink: 0; height: 54px; }
.topbar-title { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; }
.topbar-sub { font-size: 11.5px; color: var(--text3); }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.content { flex: 1; overflow-y: auto; padding: 22px 26px; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 13px; border-radius: var(--radius); border: 1px solid var(--border2); background: var(--surface); color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; white-space: nowrap; box-shadow: var(--shadow-sm); }
.btn:hover { background: var(--surface2); }
.btn:disabled { opacity: 0.28; cursor: not-allowed; box-shadow: none; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: white; box-shadow: 0 1px 4px rgba(0,113,227,0.3); }
.btn-primary:hover { background: #0063CC; border-color: #0063CC; }
.btn-success { background: var(--green-light); border-color: rgba(40,205,65,0.25); color: #1A9130; box-shadow: none; }
.btn-success:hover { background: #D5F5DB; }
.btn-danger { background: var(--red-light); border-color: rgba(255,59,48,0.18); color: var(--red); box-shadow: none; }
.btn-danger:hover { background: #FFE3E1; }
.btn-ghost { background: none; border-color: transparent; box-shadow: none; color: var(--text2); }
.btn-ghost:hover { background: var(--surface3); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn svg { width: 13px; height: 13px; }

/* CARD */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 13px; font-weight: 600; }
.card-body { padding: 16px 18px; }

/* BADGES */
.badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 5px; }
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-green { background: var(--green-light); color: #1E9630; }
.badge-amber { background: var(--amber-light); color: #B36800; }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-gray { background: var(--surface3); color: var(--text2); }

/* SEARCH */
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 13px; height: 13px; color: var(--text3); pointer-events: none; }
.search-input { width: 230px; padding: 7px 12px 7px 30px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 13px; color: var(--text); outline: none; transition: all 0.2s; box-shadow: var(--shadow-sm); }
.search-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,113,227,0.1); }
.search-input::placeholder { color: var(--text3); }

/* WF GRID */
.wf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(256px, 1fr)); gap: 12px; }
.wf-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; cursor: pointer; transition: all 0.2s ease; box-shadow: var(--shadow-sm); }
.wf-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: rgba(0,113,227,0.18); }
.wf-card-icon { width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; margin-bottom: 13px; }
.wf-card-title { font-size: 13.5px; font-weight: 600; margin-bottom: 5px; letter-spacing: -0.1px; }
.wf-card-desc { font-size: 12px; color: var(--text2); line-height: 1.55; margin-bottom: 13px; }
.wf-card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wf-usage { font-size: 11px; color: var(--text3); margin-left: auto; }
.wf-trees-count { font-size: 11px; color: var(--text3); display: flex; align-items: center; gap: 4px; }

/* List view */
.wf-list { display: flex; flex-direction: column; gap: 5px; }
.wf-list-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 16px; cursor: pointer; transition: all 0.15s ease; box-shadow: var(--shadow-sm); display: flex; align-items: center; gap: 14px; }
.wf-list-row:hover { background: var(--blue-light); border-color: rgba(0,113,227,0.2); box-shadow: var(--shadow); }
.wf-list-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.wf-list-title { font-size: 13.5px; font-weight: 600; letter-spacing: -0.1px; }
.wf-list-desc { font-size: 12px; color: var(--text2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 400px; }
.wf-list-badges { display: flex; align-items: center; gap: 5px; flex-shrink: 0; margin-left: auto; }
.wf-list-usage { font-size: 11px; color: var(--text3); margin-left: 8px; white-space: nowrap; font-weight: 500; }
.view-toggle { display: flex; background: var(--surface3); border-radius: 8px; padding: 3px; gap: 2px; }
.view-toggle-btn { padding: 5px 8px; border: none; border-radius: 6px; background: none; cursor: pointer; color: var(--text3); transition: all 0.15s; display: flex; align-items: center; }
.view-toggle-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.view-toggle-btn svg { width: 14px; height: 14px; }

/* SORT CONTROL */
.sort-control { display: flex; align-items: center; background: var(--surface3); border-radius: 8px; padding: 3px; gap: 2px; }
.sort-select { appearance: none; -webkit-appearance: none; border: none; background: var(--surface); padding: 4px 24px 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 500; color: var(--text); cursor: pointer; box-shadow: var(--shadow-sm); transition: all 0.15s; background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 16 16' fill='none' stroke='%236E6E73' stroke-width='2' stroke-linecap='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 7px center; background-size: 10px; }
.sort-select:focus { outline: none; box-shadow: 0 0 0 2px rgba(0,113,227,0.2); }
.sort-select:hover { background-color: var(--surface2); }
.sort-dir-btn { border: none; background: none; padding: 4px 6px; border-radius: 6px; cursor: pointer; color: var(--text2); display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.sort-dir-btn:hover { background: var(--surface); color: var(--blue); box-shadow: var(--shadow-sm); }

/* ── MULTI-PATH RUNNER ── */
.runner-wrap { max-width: 640px; margin: 0 auto; }

/* Incident card */
.incident-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 22px; margin-bottom: 22px; box-shadow: var(--shadow-sm); }
.incident-tag { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--red); margin-bottom: 8px; }
.incident-title { font-size: 16px; font-weight: 700; letter-spacing: -0.3px; margin-bottom: 6px; }
.incident-desc { font-size: 12.5px; color: var(--text2); line-height: 1.5; }
.incident-meta { display: flex; gap: 7px; margin-top: 12px; flex-wrap: wrap; }

/* Tree selector list */
.section-label { font-size: 10.5px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.trees-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.tree-item { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-lg); padding: 15px 17px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 13px; box-shadow: var(--shadow-sm); }
.tree-item:hover { border-color: rgba(0,113,227,0.3); box-shadow: var(--shadow); transform: translateY(-1px); }
.tree-item.tree-active { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,113,227,0.08), var(--shadow); }
.tree-item.tree-done { border-color: rgba(40,205,65,0.4); background: var(--green-light); }
.tree-item.tree-failed { border-color: rgba(255,59,48,0.28); background: var(--red-light); opacity: 0.8; }
.tree-icon-wrap { width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tree-item-title { font-size: 13.5px; font-weight: 600; letter-spacing: -0.1px; }
.tree-item-desc { font-size: 12px; color: var(--text2); margin-top: 2px; }
.tree-item-prog { font-size: 11px; color: var(--text3); margin-top: 3px; }
.tree-status-badge { font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 6px; flex-shrink: 0; }

/* Summary */
.summary-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.summary-title { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 12px; }
.summary-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.summary-row:last-child { border-bottom: none; }

/* NODE RUNNER */
.prog-wrap { margin-bottom: 20px; }
.prog-header { display: flex; justify-content: space-between; margin-bottom: 7px; }
.prog-title { font-size: 12px; color: var(--text2); font-weight: 500; }
.prog-pct { font-size: 12px; color: var(--text3); }
.prog-track { height: 3px; background: var(--surface3); border-radius: 2px; }
.prog-fill { height: 100%; background: var(--blue); border-radius: 2px; transition: width 0.4s ease; }

.node-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 6px; box-shadow: var(--shadow-sm); transition: all 0.2s; }
.node-card.current { border-color: rgba(0,113,227,0.3); box-shadow: 0 0 0 3px rgba(0,113,227,0.06), var(--shadow-sm); }
.node-card.done { opacity: 0.42; box-shadow: none; cursor: pointer; }
.node-card.done:hover { opacity: 0.65; }
.node-card.end-ok { border-color: rgba(40,205,65,0.35); background: var(--green-light); }
.node-card.end-ko { border-color: rgba(255,59,48,0.28); background: var(--red-light); }

.node-type-label { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 7px; }
.node-type-label.start { color: var(--blue); }
.node-type-label.question { color: var(--amber); }
.node-type-label.action { color: var(--green); }
.node-type-label.end { color: var(--red); }
.node-text { font-size: 14px; line-height: 1.55; color: var(--text); }
.rte-content img { max-width: 100%; border-radius: 6px; margin: 4px 0; display: block; }
.rte-content a { color: var(--blue); text-decoration: underline; }
.rte-content a[href^="http"] { /* rel handled by DOMPurify config */ }
.rte-content ul, .rte-content ol { padding-left: 18px; margin: 4px 0; }
.rte-content li { margin-bottom: 2px; }

.answers-list { display: flex; flex-direction: column; gap: 5px; margin-top: 11px; }
.answer-item { display: flex; align-items: center; gap: 10px; padding: 9px 13px; border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: all 0.15s; background: var(--bg); font-size: 13px; color: var(--text2); }
.answer-item:hover { border-color: var(--blue); background: var(--blue-light); color: var(--text); }
.answer-item.selected { border-color: var(--blue); background: var(--blue-light); color: var(--blue); font-weight: 500; }
.answer-item.readonly { cursor: default; }
.answer-item.dimmed { opacity: 0.35; }
.radio-dot { width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid var(--border2); flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.answer-item.selected .radio-dot { border-color: var(--blue); background: var(--blue); }
.answer-item.selected .radio-dot::after { content:''; width: 5px; height: 5px; border-radius: 50%; background: white; display: block; }

.action-row { display: flex; align-items: center; gap: 10px; padding: 10px 13px; border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: all 0.15s; background: var(--bg); font-size: 13px; color: var(--text2); margin-top: 10px; }
.action-row:hover { border-color: var(--green); background: var(--green-light); }
.action-row.checked { border-color: var(--green); background: var(--green-light); color: #1A9130; font-weight: 500; }
.check-sq { width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--border2); flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.action-row.checked .check-sq { border-color: var(--green); background: var(--green); }

.chosen-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 500; margin-top: 8px; }
.connector-line { display: flex; justify-content: center; padding: 0; margin: -1px 0; }
.connector-line div { width: 1.5px; height: 14px; background: var(--surface3); }

.end-actions { display: flex; gap: 7px; margin-top: 13px; flex-wrap: wrap; }
.back-hint { font-size: 11px; color: var(--text3); margin-top: 6px; }

/* NODE CONNECTOR WITH LABEL */
.node-connector { display: flex; flex-direction: column; align-items: center; margin: -1px 0; padding: 2px 0; }
.node-connector .line { width: 1.5px; height: 14px; }
.node-connector .label { font-size: 10px; font-weight: 500; padding: 1px 8px; border-radius: 10px; margin: 1px 0; }
.node-connector .arrow { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 18px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm); }
.stat-val { font-size: 28px; font-weight: 700; letter-spacing: -1px; }
.stat-lbl { font-size: 12px; color: var(--text3); margin-top: 3px; }

/* TABLE */
.table { width: 100%; border-collapse: collapse; }
.table th { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--border); background: var(--bg); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--surface2); }

/* FORMS */
.form-group { margin-bottom: 13px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 5px; display: block; }
.form-input, .form-select, .form-textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--border2); border-radius: var(--radius); font-size: 13px; color: var(--text); background: var(--surface); outline: none; transition: all 0.15s; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,113,227,0.1); }
.form-input::placeholder { color: var(--text3); }
.form-select { appearance: none; cursor: pointer; }
.form-textarea { resize: vertical; min-height: 78px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }

/* NODE EDITOR */
.node-editor { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 7px; overflow: hidden; }
.node-editor-head { display: flex; align-items: center; gap: 9px; padding: 11px 14px; cursor: pointer; transition: background 0.12s; }
.node-editor-head:hover { background: var(--surface3); }
.node-pip { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.node-editor-body { padding: 14px 16px; border-top: 1px solid var(--border); background: var(--surface); }
.answer-row { display: flex; gap: 7px; margin-bottom: 6px; align-items: center; }
.remove-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: none; color: var(--text3); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.15s; font-size: 12px; }
.remove-btn:hover { border-color: var(--red); color: var(--red); background: var(--red-light); }
.add-answer-btn { width: 100%; padding: 8px; margin-top: 6px; border: 1.5px dashed var(--border2); border-radius: var(--radius); background: none; color: var(--text3); font-size: 12.5px; cursor: pointer; transition: all 0.15s; }
.add-answer-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }
.add-node-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 11px 14px; background: var(--bg); border-top: 1px solid var(--border); }
.bo-layout { display: grid; grid-template-columns: 1fr 290px; gap: 16px; }

/* Tree editor in backoffice */
.tree-editor-section { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 10px; overflow: hidden; }
.tree-editor-head { display: flex; align-items: center; gap: 9px; padding: 12px 14px; cursor: pointer; transition: background 0.12s; }
.tree-editor-head:hover { background: var(--surface3); }
.tree-editor-body { padding: 14px 16px; border-top: 1px solid var(--border); background: var(--surface); }
.tree-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.add-tree-btn { width: 100%; padding: 10px; border: 1.5px dashed var(--border2); border-radius: var(--radius-lg); background: none; color: var(--text3); font-size: 13px; cursor: pointer; transition: all 0.15s; margin-bottom: 10px; }
.add-tree-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }

/* NEXT NODE SELECT (for node editor) */
.next-select-wrap { position: relative; }
.next-select-wrap::after { content:'▾'; position:absolute; right:10px; top:50%; transform:translateY(-50%); font-size:10px; color:var(--text3); pointer-events:none; }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.28); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 100; display: none; align-items: center; justify-content: center; padding: 24px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); width: 100%; max-width: 490px; max-height: 88vh; overflow-y: auto; border: 1px solid var(--border); }
.modal-header { padding: 20px 22px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; }
.modal-close { width: 26px; height: 26px; border-radius: 50%; border: none; background: var(--surface3); cursor: pointer; color: var(--text2); font-size: 12px; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.modal-close:hover { background: var(--border2); }
.modal-body { padding: 18px 22px; }
.modal-footer { padding: 12px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.empty-state { text-align: center; padding: 56px 20px; }
.empty-title { font-size: 14px; font-weight: 600; color: var(--text2); margin-bottom: 5px; }
.empty-sub { font-size: 12.5px; color: var(--text3); }

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeUp 0.22s ease forwards; }
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(1.3)} }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(2,1fr); } .bo-layout { grid-template-columns: 1fr; } }
@media (max-width: 860px) { .sidebar { width: 200px; } }

/* ── Mobile / petit écran ── */
@media (max-width: 720px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 200;
    width: 236px !important;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.32);
    backdrop-filter: blur(2px); z-index: 199;
  }
  .sidebar-backdrop.open { display: block; }
  .hamburger-btn {
    display: flex !important;
  }
  .main { width: 100%; }
  .topbar { padding: 0 14px; gap: 8px; flex-wrap: wrap; min-height: 54px; height: auto; padding-top: 8px; padding-bottom: 8px; }
  .topbar-actions { flex-wrap: wrap; gap: 6px; }
  .search-input { width: 160px; }
  .sort-select { font-size: 11px; padding: 4px 20px 4px 8px; }
  .content { padding: 14px 16px; }
  .wf-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
}
.hamburger-btn {
  display: none;
  align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid var(--border2); border-radius: var(--radius);
  background: var(--surface); color: var(--text2);
  cursor: pointer; flex-shrink: 0;
  transition: all .15s;
}
.hamburger-btn:hover { background: var(--surface3); }

/* ── Thème sombre — activé par data-theme="dark" sur <html> ── */
[data-theme="dark"] {
  --bg: #1C1C1E;
  --surface: #2C2C2E;
  --surface2: #3A3A3C;
  --surface3: #48484A;
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.14);
  --text: #F2F2F7;
  --text2: #AEAEB2;
  --text3: #6E6E73;
  --blue-light: rgba(0,113,227,0.18);
  --green-light: rgba(40,205,65,0.14);
  --amber-light: rgba(255,149,0,0.14);
  --red-light: rgba(255,59,48,0.14);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow: 0 4px 16px rgba(0,0,0,0.4), 0 1px 4px rgba(0,0,0,0.2);
  --shadow-lg: 0 24px 64px rgba(0,0,0,0.5), 0 4px 16px rgba(0,0,0,0.3);
}
[data-theme="dark"] .sidebar { background: rgba(28,28,30,0.95); }
[data-theme="dark"] .topbar { background: rgba(28,28,30,0.9); }
[data-theme="dark"] .modal { background: var(--surface); }
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,0.5); }
[data-theme="dark"] .search-input { background: var(--surface2); color: var(--text); }
[data-theme="dark"] .sort-select { background-color: var(--surface); color: var(--text); background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 16 16' fill='none' stroke='%23AEAEB2' stroke-width='2' stroke-linecap='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); }
[data-theme="dark"] .sort-select:hover { background-color: var(--surface2); }
[data-theme="dark"] .form-input, [data-theme="dark"] .form-select, [data-theme="dark"] .form-textarea { background: var(--surface2); color: var(--text); border-color: var(--border2); }
[data-theme="dark"] .wf-card, [data-theme="dark"] .wf-list-row, [data-theme="dark"] .card, [data-theme="dark"] .stat-card, [data-theme="dark"] .node-card, [data-theme="dark"] .tree-item, [data-theme="dark"] .summary-card { background: var(--surface); }
[data-theme="dark"] .answer-item { background: var(--surface2); }
[data-theme="dark"] .node-card.end-ok { background: rgba(40,205,65,0.1); }
[data-theme="dark"] .node-card.end-ko { background: rgba(255,59,48,0.1); }
[data-theme="dark"] .btn { background: var(--surface2); border-color: var(--border2); color: var(--text); }
[data-theme="dark"] .btn:hover { background: var(--surface3); }
[data-theme="dark"] .btn-primary { background: var(--blue); color: white; }
[data-theme="dark"] .btn-ghost { background: none; }

/* Système — suit le système si pas de préférence manuelle */
@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    --bg: #1C1C1E; --surface: #2C2C2E; --surface2: #3A3A3C; --surface3: #48484A;
    --border: rgba(255,255,255,0.08); --border2: rgba(255,255,255,0.14);
    --text: #F2F2F7; --text2: #AEAEB2; --text3: #6E6E73;
    --blue-light: rgba(0,113,227,0.18); --green-light: rgba(40,205,65,0.14);
    --amber-light: rgba(255,149,0,0.14); --red-light: rgba(255,59,48,0.14);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow: 0 4px 16px rgba(0,0,0,0.4), 0 1px 4px rgba(0,0,0,0.2);
    --shadow-lg: 0 24px 64px rgba(0,0,0,0.5), 0 4px 16px rgba(0,0,0,0.3);
  }
  [data-theme="system"] .sidebar { background: rgba(28,28,30,0.95); }
  [data-theme="system"] .topbar { background: rgba(28,28,30,0.9); }
  [data-theme="system"] .modal { background: var(--surface); }
  [data-theme="system"] .modal-overlay { background: rgba(0,0,0,0.5); }
  [data-theme="system"] .search-input { background: var(--surface2); color: var(--text); }
  [data-theme="system"] .sort-select { background-color: var(--surface); color: var(--text); background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 16 16' fill='none' stroke='%23AEAEB2' stroke-width='2' stroke-linecap='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); }
  [data-theme="system"] .sort-select:hover { background-color: var(--surface2); }
  [data-theme="system"] .form-input, [data-theme="system"] .form-select, [data-theme="system"] .form-textarea { background: var(--surface2); color: var(--text); border-color: var(--border2); }
  [data-theme="system"] .wf-card, [data-theme="system"] .wf-list-row, [data-theme="system"] .card, [data-theme="system"] .stat-card, [data-theme="system"] .node-card, [data-theme="system"] .tree-item, [data-theme="system"] .summary-card { background: var(--surface); }
  [data-theme="system"] .answer-item { background: var(--surface2); }
  [data-theme="system"] .btn { background: var(--surface2); border-color: var(--border2); color: var(--text); }
  [data-theme="system"] .btn:hover { background: var(--surface3); }
  [data-theme="system"] .btn-primary { background: var(--blue); color: white; }
  [data-theme="system"] .btn-ghost { background: none; }
}

/* Theme toggle — icône sobre dans la topbar */
.theme-icon-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--border2); border-radius: var(--radius);
  background: var(--surface); color: var(--text2);
  cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  overflow: hidden;
  padding: 0;
}
.theme-icon-btn:hover { background: var(--surface3); color: var(--text); }
.theme-icon-btn svg { width: 13px; height: 13px; flex-shrink: 0; display: block; }

/* Loading overlay */
.tf-loading-overlay {
  position:fixed;top:0;left:0;width:100%;height:100%;
  background:var(--bg);z-index:99999;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:16px;transition:opacity .3s;
}
.tf-loading-overlay.hidden { opacity:0; pointer-events:none; }
.tf-spinner {
  width:36px;height:36px;border:3px solid var(--border2);
  border-top-color:var(--blue);border-radius:50%;
  animation:tfSpin .8s linear infinite;
}
@keyframes tfSpin { to { transform:rotate(360deg); } }

/* ── Sidebar collapsible ─────────────────────────────────────────────────── */
.sidebar.collapsed { width: 0px; min-width: 0; overflow: hidden; border-right: none; }
.sidebar.collapsed * { opacity: 0; pointer-events: none; }
#sidebar-expand-btn {
  position: fixed; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 20px; height: 56px; background: var(--blue);
  border: none; border-radius: 0 10px 10px 0; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  z-index: 100; color: #fff; transition: background .15s, width .15s;
  box-shadow: 2px 0 10px rgba(0,113,227,0.35);
}
#sidebar-expand-btn:hover { width: 26px; background: var(--blue-dark, #005bbf); }
#sidebar-expand-btn:hover { background: var(--surface3); color: var(--text); }
#sidebar-expand-btn.visible { display: flex; }
.sidebar { transition: width .2s ease; }

/* ── Component filter bar ────────────────────────────────────────────────── */
.comp-filter-section { padding: 2px 0 12px; }
.comp-filter-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text3); margin-bottom: 8px; padding-left: 2px;
}
.comp-filter-grid { display: flex; flex-wrap: wrap; gap: 7px; align-items: flex-start; }

.comp-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px 7px 10px; border-radius: 11px;
  border: 1.5px solid var(--border); background: var(--surface);
  cursor: pointer; transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none; position: relative;
}
.comp-chip:hover { border-color: var(--border2); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.comp-chip:active { transform: scale(0.97); }
.comp-chip.active { border-color: transparent; box-shadow: var(--shadow); transform: translateY(-1px); }

.comp-chip-icon {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: all 0.22s; flex-shrink: 0;
}
.comp-chip.active .comp-chip-icon { transform: scale(1.05); }

.comp-chip-info { display: flex; flex-direction: column; gap: 1px; }
.comp-chip-name { font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; line-height: 1.2; }
.comp-chip-sub { font-size: 10.5px; color: var(--text3); white-space: nowrap; line-height: 1.2; transition: color 0.22s; }
.comp-chip.active .comp-chip-sub { color: var(--text2); }

.comp-chip-count {
  font-size: 10.5px; font-weight: 500; color: var(--text3);
  background: var(--surface2); padding: 2px 7px; border-radius: 6px;
  margin-left: 2px; flex-shrink: 0; transition: all 0.22s;
}

.comp-chip-chevron {
  display: inline-block; width: 11px; height: 11px; flex-shrink: 0;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1); opacity: 0.35;
}
.comp-chip.active .comp-chip-chevron { transform: rotate(90deg); opacity: 0.7; }

.comp-chip-all {
  padding: 7px 16px; border-radius: 11px;
  border: 1.5px solid var(--border); background: var(--surface);
  cursor: pointer; font-size: 12.5px; font-weight: 500;
  color: var(--text2); transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1); user-select: none;
}
.comp-chip-all:hover { border-color: var(--border2); color: var(--text); }
.comp-chip-all.active { background: var(--surface2); border-color: var(--border2); color: var(--text); font-weight: 600; }

/* Children row (positioned under parent via JS) */
.comp-children-row {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 6px 0 2px;
  transition: opacity 0.25s ease, max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden; max-height: 0; opacity: 0;
}
.comp-children-row.visible { max-height: 100px; opacity: 1; }

.comp-children-line {
  display: inline-block; width: 18px; height: 1.5px;
  border-radius: 1px; margin-right: 4px; flex-shrink: 0;
}

.comp-child-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px 4px 8px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-size: 11.5px; font-weight: 500;
  color: var(--text2); transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1); user-select: none;
}
.comp-child-chip:hover { border-color: var(--border2); transform: translateY(-1px); }
.comp-child-chip.active { font-weight: 600; }

.comp-child-dot {
  width: 6px; height: 6px; border-radius: 50%;
  flex-shrink: 0; transition: transform 0.18s;
}
.comp-child-chip.active .comp-child-dot { transform: scale(1.4); }

/* Badges composants sur les cartes workflow */
.wf-comp-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 5px;
  font-size: 10.5px; font-weight: 500; white-space: nowrap;
}




/* ═══════════════════════════════════════════════════════════════════════════
   CLASSES EXTRAITES DES STYLES INLINE — Refactoring v3
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Stats dashboard ─────────────────────────────────────────────────────── */
.stats-kpi-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:20px; }
.stats-kpi-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:18px 20px; box-shadow:var(--shadow-sm); }
.stats-kpi-icon { width:32px; height:32px; border-radius:8px; display:flex; align-items:center; justify-content:center; margin-bottom:14px; }
.stats-kpi-val { font-size:28px; font-weight:700; color:var(--text); letter-spacing:-1px; line-height:1; }
.stats-kpi-label { font-size:13px; font-weight:500; color:var(--text); margin-top:4px; }
.stats-kpi-sub { font-size:11px; color:var(--text3); margin-top:2px; }
.stats-main-grid { display:grid; grid-template-columns:1fr 240px; gap:12px; margin-bottom:12px; }
.stats-secondary-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:12px; }
.stats-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); box-shadow:var(--shadow-sm); overflow:hidden; }
.stats-card-inner { padding:16px 18px; }
.stats-top-banner { display:flex; align-items:center; gap:14px; padding:14px 16px; background:var(--blue-light); border-radius:10px; margin-bottom:16px; }
.stats-top-banner-icon { width:40px; height:40px; border-radius:10px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.stats-top-banner-eyebrow { font-size:10px; font-weight:600; color:var(--blue); text-transform:uppercase; letter-spacing:.06em; margin-bottom:2px; }
.stats-top-banner-title { font-size:13px; font-weight:600; color:var(--text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.stats-top-banner-sub { font-size:11px; color:var(--text3); margin-top:1px; }
.stats-top-banner-count { font-size:26px; font-weight:700; color:var(--blue); letter-spacing:-1px; flex-shrink:0; }
.stats-bar-row { margin-bottom:14px; }
.stats-bar-header { display:flex; align-items:center; gap:8px; margin-bottom:5px; }
.stats-bar-dot { width:6px; height:6px; border-radius:50%; flex-shrink:0; }
.stats-bar-name { font-size:12.5px; font-weight:500; color:var(--text); flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.stats-bar-track { height:4px; background:var(--surface3); border-radius:4px; overflow:hidden; }
.stats-bar-fill { height:100%; border-radius:4px; }
.stats-donut-wrap { display:flex; justify-content:center; margin-bottom:16px; }
.stats-legend-row { display:flex; align-items:center; gap:8px; padding:5px 0; }
.stats-legend-dot { width:7px; height:7px; border-radius:50%; flex-shrink:0; }
.stats-legend-label { font-size:12px; color:var(--text); flex:1; }
.stats-legend-val { font-size:12px; font-weight:600; color:var(--text); min-width:20px; text-align:right; }
.stats-legend-pct { font-size:11px; color:var(--text3); min-width:32px; text-align:right; }
.stats-attention-row { display:flex; align-items:center; gap:12px; padding:10px 0; border-bottom:1px solid var(--border); }
.stats-attention-score { width:36px; height:36px; border-radius:10px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.stats-attention-title { font-size:13px; font-weight:500; color:var(--text); margin-bottom:2px; }
.stats-attention-issues { font-size:11px; color:var(--text3); }
.stats-user-row { display:flex; align-items:center; gap:12px; padding:10px 0; border-bottom:1px solid var(--border); }
.stats-user-avatar { width:34px; height:34px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:700; color:#fff; flex-shrink:0; }
.stats-user-name-row { display:flex; align-items:center; justify-content:space-between; margin-bottom:5px; }
.stats-user-name { font-size:13px; font-weight:500; color:var(--text); }
.stats-user-count { font-size:13px; font-weight:600; color:var(--text); }
.stats-user-bar { height:3px; background:var(--surface3); border-radius:3px; overflow:hidden; margin-bottom:4px; }
.stats-user-bar-fill { height:100%; border-radius:3px; }
.stats-user-fav { font-size:11px; color:var(--text3); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.stats-empty { color:var(--text3); font-size:13px; text-align:center; padding:20px 0; }
.stats-ok-banner { display:flex; align-items:center; gap:10px; color:var(--green); font-size:13px; }
.stats-table-td-wf { display:flex; align-items:center; gap:8px; }
.stats-table-wf-dot { width:6px; height:6px; border-radius:50%; flex-shrink:0; }
.stats-health-bar-wrap { display:flex; align-items:center; gap:7px; }
.stats-health-bar { width:40px; height:3px; background:var(--surface3); border-radius:2px; overflow:hidden; }
.stats-health-fill { height:100%; border-radius:2px; }

/* ── Tech / WF List ──────────────────────────────────────────────────────── */
.wf-onboarding { display:flex; flex-direction:column; align-items:center; justify-content:center; min-height:60vh; text-align:center; padding:40px 20px; }
.wf-onboarding-icon { width:64px; height:64px; border-radius:18px; background:var(--blue-light); display:flex; align-items:center; justify-content:center; margin-bottom:20px; }
.wf-onboarding-title { font-size:18px; font-weight:700; color:var(--text); margin-bottom:8px; letter-spacing:-.3px; }
.wf-onboarding-sub { font-size:13.5px; color:var(--text2); max-width:380px; line-height:1.6; margin-bottom:28px; }
.wf-onboarding-actions { display:flex; gap:10px; flex-wrap:wrap; justify-content:center; }
.wf-in-progress-badge { display:inline-flex; align-items:center; gap:4px; font-size:10px; font-weight:600; padding:2px 8px; border-radius:20px; background:var(--amber-light); color:var(--amber); }
.wf-in-progress-dot { width:6px; height:6px; border-radius:50%; background:var(--amber); animation:pulse 1.4s infinite; }
.wf-found-in-nodes { display:inline-flex; align-items:center; gap:4px; font-size:10px; color:var(--text3); margin-bottom:6px; }
.wf-list-in-progress-badge { display:inline-flex; align-items:center; gap:3px; font-size:10px; font-weight:600; padding:1px 7px; border-radius:20px; background:var(--amber-light); color:var(--amber); }
.wf-list-in-progress-dot { width:5px; height:5px; border-radius:50%; background:var(--amber); animation:pulse 1.4s infinite; }
.wf-list-found-in-nodes { display:inline-flex; align-items:center; gap:3px; font-size:10px; color:var(--text3); }

/* ── Runner ──────────────────────────────────────────────────────────────── */
.runner-done-banner { display:flex; align-items:center; gap:10px; padding:14px 16px; background:var(--green-light); border:1px solid rgba(40,205,65,0.22); border-radius:var(--radius-lg); color:#1A9130; font-size:13.5px; font-weight:500; margin-top:8px; }
.tree-in-progress-badge { display:inline-flex; align-items:center; gap:4px; background:var(--amber-light); color:var(--amber); font-size:11px; font-weight:500; padding:2px 9px; border-radius:6px; }
.tree-in-progress-dot { width:6px; height:6px; border-radius:50%; background:var(--amber); animation:pulse 1.4s infinite; }
.incident-card-resolved { border-color:rgba(40,205,65,0.35); background:var(--green-light); }
.incident-tag-resolved { color:var(--green); }

/* ── Backoffice — confirm resume dialog ──────────────────────────────────── */
.resume-dialog-icon { width:36px; height:36px; border-radius:10px; background:var(--amber-light); display:flex; align-items:center; justify-content:center; flex-shrink:0; }

/* ── Editor core — topbar + rail ────────────────────────────────────────── */
.editor-wrap { display:flex; flex-direction:column; height:100%; background:#F5F5F7; overflow:hidden; }
.editor-topbar { background:rgba(255,255,255,0.92); backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px); border-bottom:1px solid rgba(0,0,0,0.08); padding:0 16px; height:52px; display:flex; align-items:center; gap:10px; flex-shrink:0; z-index:2; }
.editor-topbar-sep { width:1px; height:20px; background:rgba(0,0,0,0.08); }
.editor-topbar-title { font-size:13px; font-weight:600; color:#1D1D1F; letter-spacing:-.2px; }
.editor-topbar-actions { margin-left:auto; display:flex; gap:6px; align-items:center; }
.editor-btn-back { display:inline-flex; align-items:center; gap:5px; padding:5px 11px; border:1px solid rgba(0,0,0,0.1); border-radius:8px; background:transparent; color:#6E6E73; font-size:12px; font-weight:500; cursor:pointer; transition:all .15s; }
.editor-btn-back:hover { background:#E8E8ED; }
.editor-add-node-btn { padding:5px 10px; border-radius:7px; font-size:11px; font-weight:600; cursor:pointer; white-space:nowrap; transition:all .15s; }
.editor-undo-group { display:flex; gap:2px; background:var(--surface3); border-radius:8px; padding:3px; }
.editor-undo-btn { padding:4px 7px; border:none; border-radius:6px; background:none; cursor:pointer; color:var(--text3); display:flex; align-items:center; transition:all .15s; }
.editor-undo-btn:disabled { opacity:0.3; cursor:not-allowed; }
.editor-view-btn { padding:5px 11px; border:1px solid rgba(0,0,0,0.1); border-radius:8px; font-size:11px; font-weight:600; cursor:pointer; display:inline-flex; align-items:center; gap:5px; transition:all .15s; }
.editor-save-btn { padding:5px 14px; border:none; border-radius:8px; background:#3B82F6; color:white; font-size:12px; font-weight:600; cursor:pointer; transition:all .15s; }
.editor-save-btn:hover { background:#2563EB; }
.editor-cancel-btn { padding:5px 12px; border:1px solid rgba(0,0,0,0.1); border-radius:8px; background:transparent; color:#6E6E73; font-size:12px; font-weight:500; cursor:pointer; }
.editor-autosave { font-size:11px; color:#AEAEB2; display:none; align-items:center; gap:4px; }
.editor-body { flex:1; display:flex; overflow:hidden; }
.editor-rail { width:158px; background:#FFFFFF; border-right:1px solid rgba(0,0,0,0.07); display:flex; flex-direction:column; overflow:hidden; flex-shrink:0; }
.editor-rail-header { padding:12px 12px 8px; border-bottom:1px solid rgba(0,0,0,0.06); }
.editor-rail-label { font-size:9.5px; font-weight:700; color:#AEAEB2; text-transform:uppercase; letter-spacing:.1em; margin-bottom:2px; }
.editor-rail-sub { font-size:10.5px; color:#6E6E73; }
.editor-rail-list { flex:1; overflow-y:auto; padding:8px 8px 4px; }
.editor-rail-add { padding:8px; border-top:1px solid rgba(0,0,0,0.06); }
.editor-rail-add-btn { width:100%; padding:8px; border:1.5px dashed rgba(0,0,0,0.15); border-radius:9px; background:none; color:#AEAEB2; font-size:11.5px; font-weight:500; cursor:pointer; transition:all .15s; display:flex; align-items:center; justify-content:center; gap:5px; }
.editor-rail-add-btn:hover { border-color:#3B82F6; color:#3B82F6; background:rgba(59,130,246,.06); }
.editor-tree-card { position:relative; padding:11px 12px; border-radius:10px; cursor:pointer; transition:all .15s; margin-bottom:4px; }
.editor-tree-card-strip { position:absolute; left:0; top:8px; bottom:8px; width:3px; border-radius:0 3px 3px 0; }
.editor-tree-card-title { font-size:12px; margin-left:6px; margin-bottom:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.editor-tree-card-meta { display:flex; align-items:center; gap:5px; margin-left:6px; }
.editor-tree-del-btn { position:absolute; top:6px; right:6px; width:18px; height:18px; border:none; border-radius:5px; background:rgba(239,68,68,.12); color:#EF4444; font-size:10px; cursor:pointer; display:none; align-items:center; justify-content:center; line-height:1; }
.editor-canvas-wrap { flex:1; position:relative; overflow:hidden; cursor:default; }
.editor-form-wrap { flex:1; overflow-y:auto; background:#F5F5F7; }
.editor-form-inner { max-width:900px; margin:0 auto; padding:20px 32px 40px; }
.editor-panel { width:264px; background:#FFFFFF; border-left:1px solid rgba(0,0,0,0.08); display:flex; flex-direction:column; overflow:hidden; flex-shrink:0; }
.editor-canvas-legend { position:absolute; bottom:12px; right:14px; font-size:10px; color:#C7C7CC; pointer-events:none; user-select:none; }
.editor-canvas-types { position:absolute; bottom:12px; left:14px; display:flex; gap:12px; pointer-events:none; }
.editor-canvas-type-item { display:flex; align-items:center; gap:5px; font-size:10px; color:#AEAEB2; }
.editor-canvas-type-dot { width:6px; height:6px; border-radius:50%; }
.editor-fitview-btn { padding:5px 9px; border:1px solid rgba(0,0,0,0.1); border-radius:8px; background:transparent; color:#AEAEB2; font-size:13px; cursor:pointer; transition:all .15s; }
.editor-fitview-btn:hover { color:#6E6E73; }

/* ── Editor panel ────────────────────────────────────────────────────────── */
.ep-section { padding:14px; border-bottom:1px solid rgba(0,0,0,0.06); }
.ep-section-label { font-size:9.5px; font-weight:700; color:#AEAEB2; text-transform:uppercase; letter-spacing:.1em; margin-bottom:10px; }
.ep-grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:6px; margin-bottom:7px; }
.ep-grid-label-color { display:grid; grid-template-columns:1fr auto; gap:6px; align-items:center; }
.ep-color-input { width:32px; height:32px; border:1px solid rgba(0,0,0,0.12); border-radius:7px; padding:2px; cursor:pointer; background:#F5F5F7; }
.ep-node-header { display:flex; align-items:center; gap:7px; margin-bottom:14px; }
.ep-node-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.ep-node-type-lbl { font-size:9.5px; font-weight:700; text-transform:uppercase; letter-spacing:.1em; }
.ep-node-del-btn { margin-left:auto; padding:3px 9px; border:none; border-radius:6px; background:rgba(239,68,68,.12); color:#EF4444; font-size:11px; cursor:pointer; transition:all .15s; }
.ep-node-del-btn:hover { background:rgba(239,68,68,.22); }
.ep-field { margin-bottom:9px; }
.ep-connections { margin-top:12px; }
.ep-connections-label { font-size:9.5px; font-weight:700; color:#AEAEB2; text-transform:uppercase; letter-spacing:.1em; margin-bottom:8px; }
.ep-answer-card { background:#F5F5F7; border:1px solid rgba(0,0,0,0.08); border-radius:8px; padding:9px 10px; margin-bottom:6px; }
.ep-answer-footer { display:flex; align-items:center; gap:5px; }
.ep-answer-arrow { font-size:10px; color:#AEAEB2; flex-shrink:0; }
.ep-answer-del-btn { width:26px; height:26px; border:none; border-radius:6px; background:rgba(239,68,68,.12); color:#EF4444; cursor:pointer; font-size:12px; flex-shrink:0; }
.ep-add-answer-btn { width:100%; padding:7px; border:1px dashed rgba(0,0,0,0.14); border-radius:7px; background:none; color:#AEAEB2; font-size:11px; cursor:pointer; transition:all .15s; }
.ep-next-wrap { margin-top:12px; }
.ep-next-label { font-size:9.5px; font-weight:700; color:#AEAEB2; text-transform:uppercase; letter-spacing:.1em; margin-bottom:6px; }
.ep-empty { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:20px; text-align:center; color:#6E6E73; }
.ep-empty-icon { margin-bottom:12px; opacity:.4; }
.ep-empty-title { font-size:12px; font-weight:600; color:#6E6E73; margin-bottom:4px; }
.ep-empty-sub { font-size:11px; color:#AEAEB2; line-height:1.5; }
.ep-rte-wrap { border:1px solid rgba(0,0,0,0.12); border-radius:8px; overflow:hidden; background:#FFFFFF; }
.ep-rte-toolbar { display:flex; flex-wrap:wrap; gap:2px; padding:5px 6px; background:var(--surface2); border-bottom:1px solid var(--border); }
.ep-rte-btn { display:inline-flex; align-items:center; justify-content:center; width:26px; height:26px; border:none; border-radius:5px; background:none; cursor:pointer; font-size:12px; color:var(--text); transition:background .1s; }
.ep-rte-btn:hover { background:var(--surface3); }
.ep-rte-sep { width:1px; height:18px; background:rgba(0,0,0,0.12); margin:2px; }
.ep-rte-body { min-height:90px; max-height:220px; overflow-y:auto; padding:8px 10px; font-size:12.5px; color:var(--text); background:var(--surface); line-height:1.6; outline:none; word-break:break-word; }
.ep-rte-hint { font-size:10px; color:var(--text3); padding:4px 10px; background:var(--surface2); border-top:1px solid var(--border); }

/* ── Bo-settings ─────────────────────────────────────────────────────────── */
.bs-section { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:20px; margin-bottom:16px; box-shadow:var(--shadow-sm); }
.bs-section-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.bs-section-title { font-size:13.5px; font-weight:600; }
.bs-tile-list { display:flex; flex-wrap:wrap; gap:8px; min-height:40px; }
.bs-tile { display:inline-flex; align-items:center; gap:6px; padding:6px 12px; background:var(--surface2); border:1px solid var(--border); border-radius:8px; cursor:grab; font-size:13px; user-select:none; transition:all .15s; }
.bs-tile:hover { box-shadow:var(--shadow-sm); }
.bs-tile.dragging { opacity:.4; }
.bs-tile-del { border:none; background:none; color:var(--text3); cursor:pointer; font-size:14px; padding:0; line-height:1; margin-left:2px; }
.bs-tile-del:hover { color:var(--red); }
.bs-tile-drag { color:var(--text3); font-size:12px; cursor:grab; }
.bs-add-row { display:flex; gap:7px; margin-top:10px; }
.bs-add-input { flex:1; padding:7px 11px; border:1px solid var(--border2); border-radius:8px; font-size:13px; background:var(--surface); color:var(--text); outline:none; }
.bs-add-input:focus { border-color:var(--blue); }

/* ── Bo-audit ────────────────────────────────────────────────────────────── */
.ba-filters { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:16px; }
.ba-filter-select { padding:7px 10px; border:1px solid var(--border2); border-radius:8px; font-size:12.5px; background:var(--surface); color:var(--text); outline:none; cursor:pointer; }
.ba-log-row { display:flex; align-items:flex-start; gap:14px; padding:12px 0; border-bottom:1px solid var(--border); }
.ba-log-row:last-child { border-bottom:none; }
.ba-log-icon { width:34px; height:34px; border-radius:9px; display:flex; align-items:center; justify-content:center; flex-shrink:0; font-size:15px; margin-top:1px; }
.ba-log-action { font-size:12.5px; font-weight:600; color:var(--text); }
.ba-log-meta { font-size:11.5px; color:var(--text3); margin-top:2px; }
.ba-log-details { font-size:11px; color:var(--text2); margin-top:3px; line-height:1.4; }
.ba-log-time { font-size:11px; color:var(--text3); flex-shrink:0; white-space:nowrap; }
.ba-undo-btn { padding:4px 11px; border:1px solid var(--border2); border-radius:7px; background:var(--surface2); color:var(--text2); font-size:11.5px; font-weight:500; cursor:pointer; transition:all .15s; white-space:nowrap; }
.ba-undo-btn:hover { background:var(--amber-light); color:var(--amber); border-color:rgba(255,149,0,.35); }
.ba-empty { text-align:center; padding:40px 20px; color:var(--text3); font-size:13px; }

/* ── Bo-components ───────────────────────────────────────────────────────── */
.bc-comp-card { background:var(--surface); border:1.5px solid var(--border); border-radius:var(--radius-lg); padding:14px 16px; margin-bottom:8px; cursor:pointer; transition:all .15s; }
.bc-comp-card:hover { border-color:var(--border2); box-shadow:var(--shadow-sm); }
.bc-comp-header { display:flex; align-items:center; gap:11px; }
.bc-comp-icon { width:36px; height:36px; border-radius:10px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.bc-comp-name { font-size:13.5px; font-weight:600; color:var(--text); }
.bc-comp-sub { font-size:11.5px; color:var(--text3); margin-top:1px; }
.bc-comp-count { font-size:11px; color:var(--text3); padding:2px 8px; background:var(--surface2); border-radius:6px; }
.bc-comp-actions { display:flex; gap:6px; margin-left:auto; }
.bc-child-list { margin-top:10px; padding-top:10px; border-top:1px solid var(--border); display:flex; flex-wrap:wrap; gap:6px; }
.bc-child-chip { display:inline-flex; align-items:center; gap:5px; padding:4px 10px; border-radius:7px; border:1px solid var(--border); background:var(--surface2); font-size:12px; color:var(--text2); cursor:pointer; transition:all .15s; }
.bc-child-chip:hover { border-color:var(--blue); color:var(--blue); }

/* ── Bo-workflows ────────────────────────────────────────────────────────── */
.bw-list { display:flex; flex-direction:column; gap:8px; }
.bw-row { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:14px 18px; display:flex; align-items:center; gap:14px; transition:all .15s; box-shadow:var(--shadow-sm); }
.bw-row:hover { border-color:var(--border2); box-shadow:var(--shadow); }
.bw-icon { width:38px; height:38px; border-radius:10px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.bw-title { font-size:13.5px; font-weight:600; color:var(--text); }
.bw-meta { display:flex; align-items:center; gap:6px; margin-top:3px; flex-wrap:wrap; }
.bw-actions { display:flex; gap:6px; margin-left:auto; align-items:center; flex-shrink:0; }
.bw-usage { font-size:11px; color:var(--text3); white-space:nowrap; }

/* ── Bo-users ────────────────────────────────────────────────────────────── */
.bu-row { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:13px 18px; display:flex; align-items:center; gap:12px; margin-bottom:8px; box-shadow:var(--shadow-sm); }
.bu-avatar { width:38px; height:38px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:700; color:#fff; flex-shrink:0; }
.bu-name { font-size:13.5px; font-weight:600; color:var(--text); }
.bu-meta { font-size:11.5px; color:var(--text3); margin-top:1px; }
.bu-actions { display:flex; gap:6px; margin-left:auto; }
.bu-badge-admin { font-size:10px; font-weight:600; padding:2px 8px; border-radius:5px; background:var(--blue-light); color:var(--blue); }
.bu-badge-cw { font-size:10px; font-weight:600; padding:2px 8px; border-radius:5px; background:var(--green-light); color:#1A9130; }
.bu-badge-inactive { font-size:10px; font-weight:600; padding:2px 8px; border-radius:5px; background:var(--surface3); color:var(--text3); }

/* ── Bo-settings refactoring v3 ─────────────────────────────────────────── */

/* Settings grid */
.sw-grid { display:grid; grid-template-columns:1fr 1fr 1fr; gap:16px; max-width:1400px; margin:0 auto; }

/* Widget card */
.sw-widget { background:var(--surface); border:1px solid var(--border); border-radius:12px; overflow:hidden; position:relative; min-height:120px; display:flex; flex-direction:column; }
.sw-placeholder { background:var(--blue-light); border:2px dashed var(--blue); border-radius:12px; opacity:.4; transition:min-height .15s; }
.sw-header { display:flex; align-items:center; justify-content:space-between; padding:12px 14px 10px; cursor:grab; user-select:none; border-bottom:1px solid var(--border); }
.sw-header-left { display:flex; align-items:center; gap:8px; }
.sw-header-right { display:flex; align-items:center; gap:6px; }
.sw-grip { opacity:.5; flex-shrink:0; }
.sw-title { font-size:13px; font-weight:600; color:var(--text); }
.sw-sub { font-size:11px; color:var(--text3); margin-top:1px; }
.sw-width-btn { width:24px; height:24px; border:1px solid var(--border2); border-radius:6px; background:transparent; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; color:var(--text3); font-size:10px; transition:background .15s; }
.sw-width-btn:hover { background:var(--surface2); }
.sw-body { padding:12px 14px; flex:1; overflow-y:auto; }
.sw-resize { position:absolute; bottom:0; right:0; width:16px; height:16px; cursor:nwse-resize; display:flex; align-items:center; justify-content:center; opacity:.3; transition:opacity .15s; }
.sw-resize:hover { opacity:1; }

/* Settings list rows (categories/levels) */
.bset-list-row { display:flex; align-items:center; gap:8px; padding:8px 0; border-bottom:1px solid var(--border); }
.bset-list-label { flex:1; font-size:13px; color:var(--text); }
.bset-add-row { display:flex; gap:8px; margin-top:10px; }
.bset-add-row .form-input { flex:1; }
.bset-empty { text-align:center; padding:16px; color:var(--text3); font-size:12px; }

/* Component drag cards */
.bset-drop-zone { margin-bottom:12px; padding:6px; border-radius:10px; border:2px dashed transparent; transition:border-color .2s, background .2s; min-height:28px; }
.bset-drop-zone.active, .bset-drop-zone[style*="border-color: var(--blue)"] { border-color:var(--blue); background:var(--blue-light); }
.bset-drop-label { font-size:10.5px; font-weight:700; color:var(--text3); text-transform:uppercase; letter-spacing:.06em; margin-bottom:6px; }
.bset-drop-empty { padding:10px; text-align:center; font-size:11px; color:var(--text3); border:1px dashed var(--border); border-radius:8px; opacity:.6; }
.bset-comp-card { background:var(--surface2); border:1px solid var(--border); border-radius:10px; padding:10px 12px; margin-bottom:6px; cursor:grab; transition:opacity .2s; }
.bset-comp-row { display:flex; align-items:center; justify-content:space-between; }
.bset-comp-left { display:flex; align-items:center; gap:8px; }
.bset-drag-grip { opacity:.3; flex-shrink:0; }
.bset-comp-icon { width:28px; height:28px; border-radius:7px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.bset-comp-name { font-weight:600; font-size:12.5px; color:var(--text); }
.bset-comp-sub { font-size:10.5px; color:var(--text3); margin-top:1px; }
.bset-comp-actions { display:flex; gap:3px; }
.bset-comp-actions--sm .btn { font-size:9px; padding:1px 5px; }
.bset-child-list { margin-top:6px; padding-left:36px; display:flex; flex-direction:column; gap:3px; }
.bset-child-row { display:flex; align-items:center; justify-content:space-between; padding:5px 8px; background:var(--surface); border-radius:6px; border:1px solid var(--border); }
.bset-child-left { display:flex; align-items:center; gap:5px; }
.bset-child-dot { width:6px; height:6px; border-radius:50%; flex-shrink:0; }
.bset-child-name { font-weight:500; color:var(--text); font-size:11.5px; }
.bset-child-url { font-size:9px; color:var(--text3); }

/* Editor views panel */
.bset-view-row { display:flex; align-items:center; justify-content:space-between; padding:10px 12px; border-radius:10px; background:var(--surface2); border:1px solid var(--border); margin-bottom:10px; }
.bset-view-row:last-child { margin-bottom:0; }
.bset-view-name { font-size:13px; font-weight:600; color:var(--text); }
.bset-view-desc { font-size:11px; color:var(--text3); margin-top:1px; }
.bset-view-badge { font-size:11px; font-weight:500; color:var(--text3); padding:3px 10px; background:var(--surface3); border-radius:6px; white-space:nowrap; }

/* Backup panel */
.bset-backup-section { padding:14px; border-radius:10px; background:var(--surface2); border:1px solid var(--border); margin-bottom:12px; }
.bset-backup-section:last-child { margin-bottom:0; }
.bset-backup-heading { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.bset-backup-title { font-weight:600; font-size:13px; color:var(--text); }
.bset-backup-desc { font-size:11.5px; color:var(--text3); margin-bottom:10px; line-height:1.5; }
.bset-backup-full-btn { width:100%; justify-content:center; }
.bset-drop-zone-upload { border:2px dashed var(--border2); border-radius:10px; padding:20px; text-align:center; cursor:pointer; transition:all .2s; margin-bottom:10px; }
.bset-drop-zone-upload.active, .bset-drop-zone-upload:hover { border-color:var(--blue); background:var(--blue-light); }
.bset-drop-primary { font-size:12px; color:var(--text2); margin-bottom:4px; }
.bset-drop-secondary { font-size:11px; color:var(--text3); }
.bset-file-chosen { display:flex; align-items:center; gap:8px; justify-content:center; }
.bset-file-name { font-size:12px; font-weight:500; color:var(--text); }
.bset-file-size { font-size:11px; color:var(--text3); }
.bset-mode-label { font-size:11px; font-weight:600; color:var(--text2); margin-bottom:8px; }
.bset-mode-list { display:flex; flex-direction:column; gap:6px; margin-bottom:12px; }
.bset-mode-opt { display:flex; align-items:flex-start; gap:8px; padding:8px 10px; border-radius:8px; border:1px solid var(--border); cursor:pointer; transition:background .15s; }
.bset-mode-opt:hover { background:var(--surface3); }
.bset-mode-opt input[type="radio"] { margin-top:2px; flex-shrink:0; }
.bset-mode-name { font-size:12px; font-weight:500; color:var(--text); }
.bset-mode-danger { color:var(--red); }
.bset-mode-desc { font-size:10.5px; color:var(--text3); margin-top:1px; }
.bset-restore-warning { padding:10px; border-radius:8px; background:rgba(239,68,68,.08); border:1px solid rgba(239,68,68,.2); font-size:11.5px; color:var(--red); line-height:1.5; margin-bottom:8px; }
.bset-backup-actions { display:flex; gap:8px; margin-top:12px; }
.bset-backup-actions .btn { flex:1; justify-content:center; }

/* Preview report */
.bset-preview-card { padding:12px; border-radius:8px; background:var(--surface); border:1px solid var(--border); }
.bset-preview-title { font-size:11px; font-weight:600; color:var(--text2); margin-bottom:8px; }
.bset-preview-date { font-size:10.5px; color:var(--text3); margin-bottom:8px; }
.bset-preview-rows { display:flex; flex-direction:column; gap:0; font-size:12px; }
.bset-preview-row { display:flex; justify-content:space-between; padding:4px 0; }
.bset-preview-row--border { border-bottom:1px solid var(--border); }
.bset-preview-label { color:var(--text2); }
.bset-preview-add { color:var(--green); font-weight:500; }
.bset-preview-upd { color:var(--amber); font-weight:500; }
.bset-preview-skip { color:var(--text3); }

/* Modal helpers */
.bset-modal-info { font-size:13px; color:var(--text2); margin-bottom:14px; }
.bset-label-opt { color:var(--text3); font-weight:400; }
