/* EnigmaTeams — Organizer Dashboard */
:root {
  --bg: #f0f2f8;
  --surface: #ffffff;
  --surface2: #f7f8fc;
  --primary: #6C63FF;
  --primary-light: #ede9ff;
  --accent: #FF6584;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text: #1e1b38;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.12);
  --radius: 16px;
  --sidebar-w: 220px;
  --font: 'Inter', system-ui, sans-serif;
  --font-head: 'Space Grotesk', system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.5; overflow-x: hidden; }
.hidden { display: none !important; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: none; }
a { color: inherit; text-decoration: none; }

/* LOGIN */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f0e17 0%, #1a1928 100%); padding: 20px; }
.login-card { background: #1e1c30; border: 1px solid rgba(255,255,255,0.08); border-radius: 24px; padding: 40px; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 20px; box-shadow: var(--shadow-lg); }
.login-logo { font-family: var(--font-head); font-size: 1.4rem; font-weight: 700; color: #6C63FF; text-align: center; }
.login-card h2 { font-family: var(--font-head); font-size: 1.5rem; text-align: center; color: #fff; }
.login-card p { color: rgba(255,255,255,0.5); font-size: 0.9rem; text-align: center; }
.login-card .form-group label { color: rgba(255,255,255,0.6); }
.login-card input { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); color: #fff; border-radius: 12px; padding: 13px 16px; }
.login-card input::placeholder { color: rgba(255,255,255,0.25); }
.login-card input:focus { outline: none; border-color: #6C63FF; }
.login-hint { text-align: center; font-size: 0.82rem; color: rgba(255,255,255,0.35); }
.login-hint code { background: rgba(255,255,255,0.08); padding: 2px 8px; border-radius: 6px; font-family: monospace; }

/* DASHBOARD LAYOUT */
.dashboard { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: #fff; border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 50; overflow-y: auto; }
.sidebar-logo { font-family: var(--font-head); font-size: 1.1rem; font-weight: 700; color: var(--primary); padding: 24px 20px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.snav-btn { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: transparent; color: var(--text-muted); font-size: 0.9rem; font-weight: 600; text-align: left; transition: all 0.18s; width: 100%; }
.snav-btn:hover { background: var(--primary-light); color: var(--primary); }
.snav-btn.active { background: var(--primary-light); color: var(--primary); }
.sidebar-footer { padding: 16px 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.sidebar-link { padding: 8px 12px; border-radius: 8px; color: var(--text-muted); font-size: 0.85rem; font-weight: 600; transition: color 0.2s; }
.sidebar-link:hover { color: var(--primary); background: var(--primary-light); }
/* Quick copy buttons in sidebar */
.sidebar-quick-copy { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.sqc-btn { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; background: var(--primary-light); border: 1px solid rgba(108,99,255,0.2); color: var(--primary); font-size: 0.82rem; font-weight: 700; cursor: pointer; transition: all 0.2s; text-align: left; width: 100%; }
.sqc-btn:hover { background: rgba(108,99,255,0.2); border-color: var(--primary); }
.sqc-btn.copied { background: rgba(67,232,183,0.15); border-color: var(--accent); color: var(--accent); }
/* Résultats tab */
.results-podium { display: flex; align-items: flex-end; justify-content: center; gap: 12px; margin: 24px auto; max-width: 440px; }
.rp-slot { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; }
.rp-avatar { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 1rem; margin: 0 auto; }
.rp-slot.rank-1 .rp-avatar { background: linear-gradient(135deg,#FFD166,#FF9F1C); width: 58px; height: 58px; font-size: 1.2rem; }
.rp-slot.rank-2 .rp-avatar { background: linear-gradient(135deg,#C0C7D5,#8E97A8); }
.rp-slot.rank-3 .rp-avatar { background: linear-gradient(135deg,#CD7F32,#A0522D); }
.rp-name { font-size: 0.82rem; font-weight: 700; text-align: center; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-score { font-size: 0.78rem; color: var(--text-muted); }
.rp-bar { border-radius: 8px 8px 0 0; width: 100%; }
.rp-slot.rank-1 .rp-bar { background: linear-gradient(180deg,rgba(255,209,102,0.35),transparent); height: 80px; }
.rp-slot.rank-2 .rp-bar { background: linear-gradient(180deg,rgba(192,199,213,0.25),transparent); height: 56px; }
.rp-slot.rank-3 .rp-bar { background: linear-gradient(180deg,rgba(205,127,50,0.25),transparent); height: 40px; }
.rp-medal { font-size: 1.3rem; }
.results-lb-entry { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px; margin-bottom: 6px; background: var(--surface); border: 1px solid var(--border); }
.results-lb-entry.top3 { border-color: rgba(108,99,255,0.3); }
.rlb-rank { font-size: 1rem; font-weight: 900; min-width: 28px; text-align: center; }
.rlb-info { flex: 1; }
.rlb-name { font-weight: 700; font-size: 0.9rem; }
.rlb-team { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.rlb-score { font-weight: 800; font-size: 0.95rem; color: var(--primary); }
.rlb-sub { font-size: 0.72rem; color: var(--text-muted); text-align: right; margin-top: 2px; }
.results-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; padding: 16px; background: var(--surface); border-radius: 12px; border: 1px solid var(--border); }
.results-empty { text-align: center; padding: 60px 24px; color: var(--text-muted); }
.results-share-link { background: rgba(67,232,183,0.1); border: 1px solid rgba(67,232,183,0.3); border-radius: 8px; padding: 8px 12px; font-size: 0.82rem; color: var(--accent); font-family: monospace; word-break: break-all; margin-top: 12px; }
/* Template tab styles */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: 12px; margin-top: 16px; }
.template-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 8px; transition: border-color 0.2s; }
.template-card:hover { border-color: rgba(108,99,255,0.4); }
.tc-name { font-weight: 700; font-size: 0.9rem; }
.tc-date { font-size: 0.75rem; color: var(--text-muted); }
.tc-actions { display: flex; gap: 8px; margin-top: 4px; }
.tc-btn { flex: 1; padding: 6px 10px; border-radius: 6px; font-size: 0.78rem; font-weight: 600; cursor: pointer; border: 1px solid var(--border); background: var(--primary-light); color: var(--primary); transition: all 0.2s; }
.tc-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.tc-btn.danger { background: rgba(255,87,87,0.1); border-color: rgba(255,87,87,0.3); color: var(--danger); }
.tc-btn.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.dash-main { margin-left: var(--sidebar-w); flex: 1; padding: 32px; min-height: 100vh; }

/* TABS */
.tab-section { display: none; }
.tab-section.active { display: block; }
.tab-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.tab-header h2 { font-family: var(--font-head); font-size: 1.5rem; font-weight: 700; }
.tab-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.tab-desc { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 24px; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; }

/* KPIs */
.kpis-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi-card { background: var(--surface); border-radius: var(--radius); padding: 20px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.kpi-label { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 6px; }
.kpi-value { font-family: var(--font-head); font-size: 2rem; font-weight: 700; color: var(--text); }
.kpi-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

/* STATUS BADGE */
.status-badge { padding: 6px 14px; border-radius: 999px; font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.status-badge.setup { background: #fef3c7; color: #92400e; }
.status-badge.live { background: #dcfce7; color: #15803d; }
.status-badge.finished { background: #e0e7ff; color: #4338ca; }

/* CONTROL GRID */
.control-grid { display: grid; grid-template-columns: 300px 1fr; gap: 20px; }
.control-card { background: var(--surface); border-radius: var(--radius); padding: 24px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.control-card h3 { font-family: var(--font-head); font-size: 1rem; font-weight: 700; margin-bottom: 16px; color: var(--text); }
.action-stack { display: flex; flex-direction: column; gap: 8px; }
.btn-action { background: var(--primary-light); color: var(--primary); border-radius: 10px; padding: 11px 16px; font-size: 0.9rem; font-weight: 600; text-align: left; transition: all 0.18s; }
.btn-action:hover { background: var(--primary); color: #fff; }
.btn-action-ghost { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); border-radius: 10px; padding: 11px 16px; font-size: 0.9rem; font-weight: 600; text-align: left; transition: all 0.18s; }
.btn-action-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-action-accent { background: #fff0f3; color: var(--accent); border-radius: 10px; padding: 11px 16px; font-size: 0.9rem; font-weight: 600; text-align: left; transition: all 0.18s; }
.btn-action-accent:hover { background: var(--accent); color: #fff; }
.btn-action-danger { background: #fef2f2; color: var(--danger); border-radius: 10px; padding: 11px 16px; font-size: 0.9rem; font-weight: 600; text-align: left; transition: all 0.18s; }
.btn-action-danger:hover { background: var(--danger); color: #fff; }

/* PARTICIPANTS PROGRESS */
.participants-progress { display: flex; flex-direction: column; gap: 10px; max-height: 400px; overflow-y: auto; }
.pp-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface2); border-radius: 10px; border: 1px solid var(--border); }
.pp-name { font-weight: 600; font-size: 0.9rem; min-width: 80px; }
.pp-bar-wrap { flex: 1; }
.pp-bar-track { height: 6px; background: var(--border); border-radius: 4px; overflow: hidden; }
.pp-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #a29bfe); border-radius: 4px; transition: width 0.4s; }
.pp-status { font-size: 0.8rem; min-width: 60px; text-align: right; }
.pp-present { width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex-shrink: 0; }
.pp-absent { width: 8px; height: 8px; border-radius: 50%; background: var(--border); flex-shrink: 0; }

/* FORM CARDS */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.form-card { background: var(--surface); border-radius: var(--radius); padding: 24px; border: 1px solid var(--border); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; }
.form-card h3 { font-family: var(--font-head); font-size: 1rem; font-weight: 700; color: var(--text); padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 0.82rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.form-group input, .form-group select, .form-group textarea { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 13px; color: var(--text); font-size: 0.9rem; transition: border-color 0.2s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-msg { font-size: 0.85rem; min-height: 1.4em; color: var(--text-muted); margin-top: 4px; }
.form-msg.success { color: var(--success); }
.form-msg.error { color: var(--danger); }
.color-row { display: flex; align-items: center; gap: 8px; }
.color-row input[type="color"] { width: 40px; height: 36px; border-radius: 8px; padding: 2px; border: 1px solid var(--border); cursor: pointer; }
.hex-input { flex: 1; font-family: monospace; }
.toggle-group { flex-direction: row; align-items: center; justify-content: space-between; }
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--border); border-radius: 24px; transition: 0.2s; cursor: pointer; }
.toggle-slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.2s; }
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* FIELDS LIST */
.fields-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.field-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.field-item-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.field-badge { font-size: 0.75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.field-badge.quiz { background: var(--primary-light); color: var(--primary); }
.field-badge.info { background: var(--surface2); color: var(--text-muted); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row-toggles { display: flex; gap: 16px; margin-top: 6px; flex-wrap: wrap; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.checkbox-label input { width: 16px; height: 16px; accent-color: var(--primary); }
.btn-remove { background: #fef2f2; color: var(--danger); border-radius: 8px; padding: 5px 12px; font-size: 0.8rem; font-weight: 600; transition: all 0.18s; border: none; }
.btn-remove:hover { background: var(--danger); color: #fff; }
.drag-handle { color: var(--text-muted); font-size: 1.1rem; cursor: grab; padding: 4px; }

/* STAGES LIST */
.stages-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.stage-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.stage-item-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; background: var(--surface2); border-bottom: 1px solid var(--border); }
.stage-item-title { font-family: var(--font-head); font-size: 1rem; font-weight: 700; }
.stage-item-num { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary-light); color: var(--primary); font-weight: 700; font-size: 0.85rem; }
.stage-item-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.stage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stage-fields-wrap { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; background: var(--surface2); border-radius: 10px; border: 1px solid var(--border); }
.fragments-list { display: flex; flex-direction: column; gap: 6px; }
.fragment-row { display: flex; align-items: center; gap: 8px; }
.fragment-row input { flex: 1; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 0.88rem; color: var(--text); }
.fragment-row input:focus { outline: none; border-color: var(--primary); }
.btn-add-fragment { background: var(--primary-light); color: var(--primary); border-radius: 8px; padding: 7px 14px; font-size: 0.82rem; font-weight: 600; border: none; cursor: pointer; transition: all 0.18s; }
.btn-add-fragment:hover { background: var(--primary); color: #fff; }

/* PARTICIPANTS TABLE */
.participants-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); font-size: 0.9rem; }
thead { background: var(--surface2); }
th { padding: 12px 16px; text-align: left; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); border-bottom: 1px solid var(--border); }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; }
.badge-present { background: #dcfce7; color: #15803d; }
.badge-absent { background: var(--surface2); color: var(--text-muted); }
.inline-input { border: 1px solid var(--border); border-radius: 10px; padding: 9px 13px; font-size: 0.9rem; color: var(--text); background: var(--surface); transition: border-color 0.2s; }
.inline-input:focus { outline: none; border-color: var(--primary); }

/* BUTTONS GLOBAL */
.btn-primary { background: var(--primary); color: #fff; border-radius: 10px; padding: 11px 20px; font-size: 0.9rem; font-weight: 700; transition: opacity 0.2s; border: none; }
.btn-primary:hover { opacity: 0.88; }
.btn-outline { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 10px 18px; font-size: 0.9rem; font-weight: 600; transition: all 0.18s; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-full { width: 100%; }

/* TEMPLATES MODAL */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); }
.modal-box { position: relative; background: var(--surface); border-radius: 24px; max-width: 600px; width: 100%; max-height: 80vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-family: var(--font-head); font-size: 1.1rem; font-weight: 700; }
.modal-close { background: var(--surface2); border: none; width: 32px; height: 32px; border-radius: 50%; font-size: 0.9rem; cursor: pointer; transition: background 0.2s; }
.modal-close:hover { background: var(--border); }
.modal-desc { padding: 12px 24px 0; color: var(--text-muted); font-size: 0.88rem; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.templates-list { flex: 1; overflow-y: auto; padding: 16px 24px; display: flex; flex-direction: column; gap: 8px; }
.template-category { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); padding: 8px 0 4px; }
.template-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); cursor: pointer; transition: all 0.18s; }
.template-item:hover { border-color: var(--primary); background: var(--primary-light); }
.template-item.selected { border-color: var(--primary); background: var(--primary-light); }
.template-item input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; flex-shrink: 0; }
.template-item-label { font-size: 0.9rem; font-weight: 600; }
.template-item-sub { font-size: 0.8rem; color: var(--text-muted); }

/* EXPORT */
.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.file-label-org { display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border: 1px dashed var(--border); border-radius: 10px; cursor: pointer; font-size: 0.9rem; font-weight: 600; color: var(--text-muted); transition: all 0.18s; }
.file-label-org:hover { border-color: var(--primary); color: var(--primary); }
.file-label-org input { display: none; }

/* KPI number alias */
.kpi-num { font-family: var(--font-head); font-size: 2rem; font-weight: 700; color: var(--text); }

/* PARTICIPANT PROGRESS ROWS (JS-generated) */
.participant-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface2); border-radius: 10px; border: 1px solid var(--border); }
.pr-name { font-weight: 600; font-size: 0.9rem; min-width: 90px; flex-shrink: 0; }
.pr-progress { flex: 1; display: flex; align-items: center; gap: 8px; }
.pr-bar-track { flex: 1; height: 6px; background: var(--border); border-radius: 4px; overflow: hidden; }
.pr-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #a29bfe); border-radius: 4px; transition: width 0.4s; }
.pr-bar-fill.completed { background: linear-gradient(90deg, var(--success), #86efac); }
.pr-label { font-size: 0.8rem; color: var(--text-muted); min-width: 32px; text-align: right; }

/* FIELD ITEM (JS-generated new layout) */
.field-item { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: flex-start; }
.field-drag { color: var(--text-muted); font-size: 1.1rem; cursor: grab; padding: 2px; line-height: 1; margin-top: 6px; flex-shrink: 0; }
.field-body { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.field-row-top { display: flex; gap: 8px; flex-wrap: wrap; }
.field-row-top .fi-label { flex: 1; min-width: 160px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px; font-size: 0.9rem; color: var(--text); }
.field-row-top .fi-type { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px; font-size: 0.88rem; color: var(--text); }
.field-row-mid .fi-placeholder { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px; font-size: 0.88rem; color: var(--text-muted); }
.field-row-bot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.fi-check { display: flex; align-items: center; gap: 5px; font-size: 0.82rem; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.fi-check input { accent-color: var(--primary); width: 14px; height: 14px; }
.fi-options-wrap { display: flex; flex-direction: column; gap: 3px; }
.fi-options-wrap.hidden { display: none; }
.fi-options { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 0.85rem; color: var(--text); width: 260px; }
.fi-options-hint { font-size: 0.75rem; color: var(--text-muted); }
.field-actions { flex-shrink: 0; }
.btn-field-del { background: #fef2f2; color: var(--danger); border-radius: 8px; padding: 6px 10px; font-size: 0.85rem; font-weight: 700; border: none; cursor: pointer; transition: all 0.18s; }
.btn-field-del:hover { background: var(--danger); color: #fff; }
.field-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* STAGE ITEM (JS-generated new layout) */
.stage-header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--surface2); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.stage-num { font-family: var(--font-head); font-size: 0.82rem; font-weight: 700; color: var(--primary); background: var(--primary-light); padding: 3px 10px; border-radius: 999px; flex-shrink: 0; }
.si-title { flex: 1; background: transparent; border: none; border-bottom: 2px solid var(--border); padding: 4px 8px; font-family: var(--font-head); font-size: 1rem; font-weight: 700; color: var(--text); min-width: 120px; }
.si-title:focus { outline: none; border-bottom-color: var(--primary); }
.btn-stage-del { background: #fef2f2; color: var(--danger); border-radius: 8px; padding: 5px 10px; font-size: 0.8rem; font-weight: 700; border: none; cursor: pointer; transition: all 0.18s; margin-left: auto; }
.btn-stage-del:hover { background: var(--danger); color: #fff; }
.stage-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.stage-body .form-group { margin: 0; }
.stage-body input[type="text"], .stage-body input[type="number"], .stage-body textarea {
  width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font-size: 0.88rem; color: var(--text);
}
.stage-body input:focus, .stage-body textarea:focus { outline: none; border-color: var(--primary); }
.sf-fields-grid { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px; background: var(--surface2); border-radius: 10px; border: 1px solid var(--border); }
.sf-check { display: flex; align-items: center; gap: 5px; font-size: 0.85rem; color: var(--text-muted); cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: background 0.15s; }
.sf-check:hover { background: var(--primary-light); color: var(--primary); }
.sf-check input { accent-color: var(--primary); }

/* PARTICIPANTS TABLE (JS-generated) */
.participants-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); font-size: 0.9rem; }
.participants-table thead { background: var(--surface2); }
.participants-table th { padding: 12px 16px; text-align: left; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.participants-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.participants-table tr:last-child td { border-bottom: none; }
.participants-table tr:hover td { background: var(--surface2); }
.btn-table-del { background: #fef2f2; color: var(--danger); border: none; border-radius: 6px; padding: 4px 10px; font-size: 0.82rem; font-weight: 700; cursor: pointer; transition: all 0.18s; }
.btn-table-del:hover { background: var(--danger); color: #fff; }

/* TEMPLATES MODAL (JS-generated) */
.tpl-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.tpl-cat { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); padding: 6px 4px 2px; }
.tpl-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); cursor: pointer; transition: all 0.15s; }
.tpl-item:hover:not(.tpl-existing) { border-color: var(--primary); background: var(--primary-light); }
.tpl-existing { opacity: 0.5; cursor: default; }
.tpl-info { flex: 1; }
.tpl-label { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.tpl-example { display: block; font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; font-style: italic; }
.tpl-badge { background: var(--primary-light); color: var(--primary); padding: 2px 8px; border-radius: 999px; font-size: 0.73rem; font-weight: 700; flex-shrink: 0; }

/* ── SIDEBAR EVENT CODE ─────────────────────────────────────── */
.sidebar-event-code { margin: 0 12px 12px; padding: 10px 14px; background: var(--primary-light); border-radius: 10px; text-align: center; }
.sidebar-event-code .sec-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--primary); margin-bottom: 2px; }
.sidebar-event-code .sec-value { font-family: monospace; font-size: 1.4rem; font-weight: 800; letter-spacing: 0.2em; color: var(--primary); }

/* ── LOGIN 2-STEP ───────────────────────────────────────────── */
.login-or { display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,0.3); font-size: 0.82rem; }
.login-or::before, .login-or::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.1); }
.login-step-indicator { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 4px; }
.lsi-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.15); transition: background 0.2s; }
.lsi-dot.active { background: var(--primary); }
.login-back-btn { background: transparent; border: none; color: rgba(255,255,255,0.4); font-size: 0.85rem; cursor: pointer; padding: 4px 0; transition: color 0.2s; }
.login-back-btn:hover { color: rgba(255,255,255,0.8); }

/* ── LINKS TAB ──────────────────────────────────────────────── */
.access-code-display { background: var(--surface); border: 2px solid var(--primary); border-radius: var(--radius); padding: 28px; display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; box-shadow: var(--shadow); margin-bottom: 0; }
.acd-item { text-align: center; }
.acd-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 8px; }
.acd-value { font-family: monospace; font-size: 2.6rem; font-weight: 900; letter-spacing: 0.25em; color: var(--primary); line-height: 1; margin-bottom: 4px; display: block; }
.acd-value.acd-pin { color: var(--accent); letter-spacing: 0.2em; }
.acd-code { font-family: monospace; font-size: 3.2rem; font-weight: 900; letter-spacing: 0.3em; color: var(--primary); line-height: 1; margin-bottom: 4px; }
.acd-hint { font-size: 0.82rem; color: var(--text-muted); }
.links-list { display: flex; flex-direction: column; gap: 16px; }
.link-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; box-shadow: var(--shadow); }
.li-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
.li-title { font-family: var(--font-head); font-size: 0.95rem; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.li-label { font-family: var(--font-head); font-size: 0.9rem; font-weight: 700; margin-bottom: 6px; }
.li-desc { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 12px; }
.li-url-wrap { display: flex; align-items: center; gap: 8px; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; }
.li-url { flex: 1; font-family: monospace; font-size: 0.82rem; color: var(--text-muted); word-break: break-all; }
.btn-copy { display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; background: var(--primary-light); color: var(--primary); border: none; border-radius: 8px; font-size: 0.82rem; font-weight: 700; cursor: pointer; transition: all 0.18s; flex-shrink: 0; }
.btn-copy:hover { background: var(--primary); color: #fff; }
.btn-copy.copied { background: #dcfce7; color: #15803d; }
.qr-placeholder { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qr-mock { width: 120px; height: 120px; border-radius: 12px; border: 1px solid var(--border); overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--surface2); }
.qr-mock img { width: 100%; height: 100%; object-fit: contain; }
.qr-mock-inner { font-size: 0.75rem; color: var(--text-muted); text-align: center; padding: 8px; }
.qr-hint { font-size: 0.78rem; color: var(--text-muted); text-align: center; }
.qr-dl-btn { display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: all 0.18s; }
.qr-dl-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ── QUESTIONNAIRE TAB — registration toggle ─────────────────── */
.questionnaire-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.registration-toggle { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.toggle-label { font-size: 0.88rem; font-weight: 600; color: var(--text); }
.reg-status { padding: 4px 12px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; }
.reg-status.open { background: #dcfce7; color: #15803d; }
.reg-status.closed { background: var(--surface2); color: var(--text-muted); }

/* ── AI BANNER & MODAL ──────────────────────────────────────── */
.ai-banner { display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, #f0edff, #ede9ff); border: 1px solid rgba(108,99,255,0.25); border-radius: 14px; padding: 16px 20px; margin-bottom: 16px; }
.ai-banner-icon { font-size: 1.8rem; flex-shrink: 0; }
.ai-banner-text { flex: 1; }
.ai-banner-text strong { font-size: 0.92rem; font-weight: 700; color: var(--primary); display: block; margin-bottom: 2px; }
.ai-banner-text span { font-size: 0.82rem; color: var(--text-muted); }
.btn-ai-open { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; background: var(--primary); color: #fff; border: none; border-radius: 10px; font-size: 0.85rem; font-weight: 700; cursor: pointer; transition: opacity 0.2s, transform 0.15s; flex-shrink: 0; }
.btn-ai-open:hover { opacity: 0.88; transform: translateY(-1px); }

/* AI Modal */
.ai-modal-box { max-width: 680px; }
.ai-modal-body { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.ai-context-form { display: flex; flex-direction: column; gap: 12px; background: var(--surface2); border-radius: 12px; padding: 16px; border: 1px solid var(--border); }
.ai-context-form label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 4px; display: block; }
.ai-context-form input, .ai-context-form textarea { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font: inherit; font-size: 0.9rem; color: var(--text); width: 100%; transition: border-color 0.2s; }
.ai-context-form input:focus, .ai-context-form textarea:focus { outline: none; border-color: var(--primary); }
.ai-generate-btn { background: var(--primary); color: #fff; border: none; border-radius: 10px; padding: 12px 20px; font: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: opacity 0.2s; }
.ai-generate-btn:hover { opacity: 0.88; }
.ai-generate-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ai-results { display: flex; flex-direction: column; gap: 16px; }
.ai-section { background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.ai-section-title { font-family: var(--font-head); font-size: 0.9rem; font-weight: 700; color: var(--text); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.ai-q-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.ai-q-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; background: var(--surface); border-radius: 8px; border: 1px solid var(--border); }
.ai-q-num { font-family: var(--font-head); font-size: 0.75rem; font-weight: 700; color: var(--primary); background: var(--primary-light); width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
.ai-q-text { font-size: 0.88rem; line-height: 1.5; flex: 1; }
.ai-frags { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.ai-frag-item { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 0.85rem; font-style: italic; color: var(--text); line-height: 1.5; }
.btn-ai-stage { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; background: var(--primary); color: #fff; border: none; border-radius: 8px; font-size: 0.82rem; font-weight: 700; cursor: pointer; transition: opacity 0.2s; }
.btn-ai-stage:hover { opacity: 0.88; }
.btn-ai-q { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; font-size: 0.82rem; font-weight: 700; cursor: pointer; transition: all 0.18s; }
.btn-ai-q:hover { border-color: var(--primary); color: var(--primary); }
.ai-result-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.ai-spinner { display: flex; align-items: center; justify-content: center; padding: 24px; gap: 10px; color: var(--text-muted); font-size: 0.9rem; }
.ai-error { background: #fef2f2; border: 1px solid #fca5a5; border-radius: 10px; padding: 14px; color: var(--danger); font-size: 0.88rem; }

/* ── PARTICIPANTS TAB V3 ─────────────────────────────────────── */
.participants-legend { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 0.82rem; color: var(--text-muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-dot.present { background: var(--success); }
.legend-dot.absent { background: var(--border); }
.legend-dot.registered { background: var(--primary); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.pr-team-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; background: rgba(255,101,132,0.12); color: var(--accent); font-size: 0.75rem; font-weight: 700; }
.badge-registered { background: #ede9ff; color: var(--primary); }

/* ── SETTINGS TAB — teams config ─────────────────────────────── */
.teams-config { background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.teams-config label { font-size: 0.82rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; display: block; }
.teams-config textarea { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font: inherit; font-size: 0.88rem; color: var(--text); resize: vertical; min-height: 80px; transition: border-color 0.2s; }
.teams-config textarea:focus { outline: none; border-color: var(--primary); }
.teams-config p { font-size: 0.8rem; color: var(--text-muted); }
.plan-info-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-radius: 999px; font-size: 0.82rem; font-weight: 700; }
.plan-info-badge.free { background: #f0f2f8; color: var(--text-muted); border: 1px solid var(--border); }
.plan-info-badge.pro { background: var(--primary-light); color: var(--primary); border: 1px solid rgba(108,99,255,0.25); }

/* ── STAGE ITEM V3 EXTRA ─────────────────────────────────────── */
.stage-ai-row { display: flex; align-items: center; justify-content: flex-end; padding: 8px 18px 12px; }

@media (max-width: 1100px) { .kpis-row { grid-template-columns: 1fr 1fr; } .control-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .sidebar { display: none; } .dash-main { margin-left: 0; padding: 20px; } .form-grid-2, .stage-grid, .field-grid, .export-grid { grid-template-columns: 1fr; } .plans-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .result-grid { grid-template-columns: 1fr; } .ai-result-btns { flex-direction: column; } }

/* ── PLAN ENFORCEMENT ─────────────────────────────────────────── */
/* Overlay Pro sur sections entières */
.pro-overlay {
  position: absolute;
  inset: 0;
  background: rgba(240,242,248,0.88);
  backdrop-filter: blur(4px);
  z-index: 10;
  border-radius: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
.pro-overlay-card {
  background: #fff;
  border-radius: 20px;
  padding: 36px 40px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  max-width: 380px;
  width: calc(100% - 40px);
  border: 2px solid rgba(108,99,255,0.15);
}
.pro-overlay-icon { font-size: 2.5rem; margin-bottom: 12px; }
.pro-overlay-title { font-size: 1.2rem; font-weight: 800; color: #1e1b38; margin-bottom: 10px; font-family: var(--font-head); }
.pro-overlay-msg { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; margin-bottom: 24px; }
.pro-overlay-btn {
  display: inline-block;
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  transition: opacity .2s;
}
.pro-overlay-btn:hover { opacity: 0.88; }

/* Badge Pro inline (dans le banner IA stages) */
.pro-inline-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(108,99,255,0.12);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  margin-left: 8px;
  border: 1px solid rgba(108,99,255,0.25);
}

/* Bouton IA Pro lock (dans le banner quand Free) */
.btn-ai-pro-lock {
  background: var(--border) !important;
  color: var(--text-muted) !important;
  cursor: default !important;
  text-decoration: none;
  pointer-events: auto !important;
  font-size: 0.82rem;
  padding: 10px 16px;
  border-radius: 10px;
  display: inline-block;
  transition: none !important;
}
.btn-ai-pro-lock:hover { opacity: 1 !important; background: linear-gradient(135deg, var(--primary), var(--accent)) !important; color: #fff !important; }

/* Badge Pro sur les boutons sidebar */
.snav-pro-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  margin-left: auto;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.snav-pro-badge-soft {
  background: rgba(108,99,255,0.15);
  color: var(--primary);
  border: 1px solid rgba(108,99,255,0.3);
}
/* Sidebar nav flex pour aligner le badge à droite */
.snav-btn { display: flex; align-items: center; gap: 8px; }

/* Badge Pro sur la section Équipes (Settings) */
.pro-section-badge {
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(108,99,255,0.08);
  border: 1px solid rgba(108,99,255,0.2);
  border-radius: 10px;
  font-size: 0.84rem;
  color: var(--primary);
  line-height: 1.5;
}

/* Indicateur de plan dans la sidebar */
.sidebar-plan-info {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}
.sidebar-plan-info.plan-free { background: #f0f2f8; color: var(--text-muted); border: 1px solid var(--border); }
.sidebar-plan-info.plan-pro { background: var(--primary-light); color: var(--primary); border: 1px solid rgba(108,99,255,0.25); }
.sidebar-plan-info.plan-white-label { background: rgba(255,101,132,0.1); color: var(--accent); border: 1px solid rgba(255,101,132,0.25); }

/* ============================================================
   PREMIUM ENHANCEMENTS v4.0
   ============================================================ */

/* ── KPI CARDS ENRICHED ──────────────────────────────────────── */
.kpi-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #a29bfe);
  opacity: 0.6;
}
.kpi-card.kpi-success::before { background: linear-gradient(90deg, var(--success), #86efac); }
.kpi-card.kpi-accent::before  { background: linear-gradient(90deg, var(--accent), #f9a8d4); }
.kpi-card.kpi-warn::before    { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.kpi-icon {
  font-size: 1.5rem;
  margin-bottom: 6px;
  opacity: 0.7;
}
.kpi-delta {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  display: inline-block;
  margin-top: 2px;
}
.kpi-delta.up   { background: #dcfce7; color: #15803d; }
.kpi-delta.down { background: #fef2f2; color: var(--danger); }

/* ── ONBOARDING CHECKLIST ────────────────────────────────────── */
.onboarding-banner {
  background: linear-gradient(135deg, #f0edff 0%, #fff7ed 100%);
  border: 1px solid rgba(108,99,255,0.2);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  animation: slideInBanner 0.4s ease both;
}
@keyframes slideInBanner {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ob-emoji { font-size: 2rem; flex-shrink: 0; }
.ob-content { flex: 1; }
.ob-title { font-family: var(--font-head); font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.ob-steps { display: flex; flex-direction: column; gap: 8px; }
.ob-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.15s;
}
.ob-step:hover { background: rgba(108,99,255,0.08); }
.ob-step-check {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem;
  flex-shrink: 0;
  transition: all 0.2s;
}
.ob-step.done .ob-step-check {
  background: var(--success);
  border-color: var(--success);
  color: white;
}
.ob-step.done span { text-decoration: line-through; opacity: 0.6; }
.ob-progress {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.ob-track { flex: 1; height: 5px; background: var(--border); border-radius: 999px; overflow: hidden; }
.ob-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--success)); border-radius: 999px; transition: width 0.5s ease; }
.ob-dismiss { margin-top: 10px; background: none; border: none; font-size: 0.8rem; color: var(--text-muted); cursor: pointer; padding: 2px; }
.ob-dismiss:hover { color: var(--primary); }

/* ── LIVE STATS BANNER ───────────────────────────────────────── */
.live-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #dcfce7, #f0fdf4);
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 20px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #15803d;
}
.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: livePulse 1.5s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes livePulse {
  0%,100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  50% { transform: scale(1.1); box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}
.live-banner span { flex: 1; }
.live-time { font-size: 0.78rem; opacity: 0.7; white-space: nowrap; }

/* ── PARTICIPANT MINI CARDS (Dashboard overview) ─────────────── */
.participants-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding: 2px;
}
.pmc-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s;
  cursor: default;
}
.pmc-card:hover { border-color: var(--primary); background: var(--primary-light); }
.pmc-card.present { border-color: rgba(34,197,94,0.3); }
.pmc-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pmc-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head);
  font-size: 0.85rem;
  font-weight: 800;
  flex-shrink: 0;
}
.pmc-name { font-size: 0.88rem; font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pmc-status { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pmc-status.present { background: var(--success); }
.pmc-status.absent  { background: var(--border); }
.pmc-progress { height: 4px; background: var(--border); border-radius: 999px; overflow: hidden; }
.pmc-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #a29bfe); border-radius: 999px; transition: width 0.4s; }
.pmc-fill.full { background: linear-gradient(90deg, var(--success), #86efac); }
.pmc-label { font-size: 0.72rem; color: var(--text-muted); }

/* ── QUICK ACTIONS ENRICHED ──────────────────────────────────── */
.quick-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.qa-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  box-shadow: var(--shadow);
}
.qa-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.qa-btn.qa-primary { border-color: rgba(108,99,255,0.3); background: var(--primary-light); }
.qa-btn.qa-accent { border-color: rgba(255,101,132,0.3); background: #fff0f3; }
.qa-btn.qa-accent:hover { background: #ffe4ec; }
.qa-icon { font-size: 1.5rem; }
.qa-label { font-family: var(--font-head); font-size: 0.88rem; font-weight: 700; color: var(--text); }
.qa-sub { font-size: 0.75rem; color: var(--text-muted); }

/* ── TIMELINE / ACTIVITY LOG ─────────────────────────────────── */
.activity-log {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}
.activity-log::before {
  content: '';
  position: absolute;
  left: 12px; top: 10px; bottom: 10px;
  width: 2px;
  background: var(--border);
}
.al-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 0;
  position: relative;
}
.al-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: all 0.2s;
}
.al-item.event .al-dot { border-color: var(--primary); background: var(--primary-light); }
.al-item.success .al-dot { border-color: var(--success); background: #dcfce7; }
.al-item.warn .al-dot { border-color: var(--warning); background: #fef3c7; }
.al-content { flex: 1; }
.al-text { font-size: 0.88rem; color: var(--text); font-weight: 500; }
.al-time { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ── EMPTY STATES ────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 48px 24px;
  text-align: center;
}
.es-icon { font-size: 3rem; opacity: 0.4; }
.es-title { font-family: var(--font-head); font-size: 1.1rem; font-weight: 700; color: var(--text); }
.es-sub { font-size: 0.88rem; color: var(--text-muted); max-width: 280px; line-height: 1.6; }

/* ── DASHBOARD TOPBAR ────────────────────────────────────────── */
.dash-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.dash-topbar-left { display: flex; flex-direction: column; gap: 2px; }
.dash-topbar-title { font-family: var(--font-head); font-size: 1.6rem; font-weight: 800; color: var(--text); }
.dash-topbar-sub { font-size: 0.88rem; color: var(--text-muted); }
.dash-topbar-actions { display: flex; gap: 10px; align-items: center; }

/* ── EVENT STATUS CHIP ───────────────────────────────────────── */
.event-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}
.event-status-chip.setup    { background: #fef3c7; color: #92400e; }
.event-status-chip.live     { background: #dcfce7; color: #15803d; animation: chipPulse 2s ease-in-out infinite; }
.event-status-chip.finished { background: #e0e7ff; color: #4338ca; }
@keyframes chipPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.3); }
  50% { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}

/* ── CARD HOVER EFFECTS ──────────────────────────────────────── */
.form-card, .control-card, .link-item {
  transition: transform 0.2s, box-shadow 0.2s;
}
.form-card:hover, .control-card:hover { box-shadow: var(--shadow-lg); }

/* ── STAGES PREMIUM ──────────────────────────────────────────── */
.stage-item {
  transition: box-shadow 0.2s;
}
.stage-item:hover { box-shadow: var(--shadow-lg); }
.stage-num-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
}

/* ── UPGRADE CTA IN SIDEBAR ──────────────────────────────────── */
.sidebar-upgrade-cta {
  margin: 0 10px 10px;
  padding: 14px;
  background: linear-gradient(135deg, #6C63FF, #9b5cff);
  border-radius: 12px;
  color: white;
  text-align: center;
}
.suc-title { font-size: 0.82rem; font-weight: 800; margin-bottom: 4px; }
.suc-sub { font-size: 0.72rem; opacity: 0.8; margin-bottom: 10px; }
.suc-btn {
  display: block;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: background 0.2s;
}
.suc-btn:hover { background: rgba(255,255,255,0.3); }

/* ── NOTIFICATION BADGE ──────────────────────────────────────── */
.snav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px; height: 18px;
  border-radius: 999px;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0 5px;
  margin-left: auto;
  animation: badgePop 0.3s cubic-bezier(0.4,0,0.2,1) both;
}
@keyframes badgePop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* ── MOBILE SIDEBAR TOGGLE ───────────────────────────────────── */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 200;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  width: 40px; height: 40px;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  align-items: center;
  justify-content: center;
}
.sidebar.mobile-open { display: flex !important; }
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 49;
}
.sidebar-overlay.visible { display: block; }

/* ── SECTION STATS CARDS (control tab extras) ────────────────── */
.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}
.stat-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.stat-value { font-family: var(--font-head); font-size: 1.5rem; font-weight: 800; color: var(--text); }
.stat-sub   { font-size: 0.72rem; color: var(--text-muted); }

/* ── STAGE PROGRESS INDICATOR (control tab) ──────────────────── */
.stage-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 16px 0;
  overflow-x: auto;
  padding-bottom: 4px;
}
.ss-step {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}
.ss-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  transition: all 0.25s;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.ss-dot.current { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 0 0 4px rgba(108,99,255,0.2); }
.ss-dot.done    { background: var(--success); border-color: var(--success); color: #fff; }
.ss-line {
  height: 2px;
  width: 40px;
  background: var(--border);
  flex-shrink: 0;
  transition: background 0.25s;
}
.ss-line.done { background: var(--success); }
.ss-label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 4px;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  pointer-events: none;
}
.ss-step-wrap { display: flex; flex-direction: column; align-items: center; gap: 0; }

/* ── TOPBAR QUICK LINKS ──────────────────────────────────────── */
.topbar-quick-links {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.tql-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.tql-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.tql-btn.tql-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.tql-btn.tql-primary:hover { opacity: 0.88; color: #fff; }

/* ── SECTION TITLE WITH HELP ─────────────────────────────────── */
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 10px;
  flex-wrap: wrap;
}
.section-title-row h3 {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-help {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--border);
}

/* ── INSIGHT CARDS (control tab) ─────────────────────────────── */
.insights-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.insight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.insight-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.insight-icon { font-size: 1.6rem; flex-shrink: 0; }
.insight-body {}
.insight-title { font-size: 0.88rem; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.insight-desc  { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }

/* ── RESPONSIVE IMPROVEMENTS ─────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar-toggle { display: flex; }
  .sidebar {
    display: none;
    position: fixed;
    left: 0; top: 0;
    height: 100vh;
    z-index: 100;
    box-shadow: var(--shadow-lg);
  }
  .dash-main { margin-left: 0 !important; padding: 20px 16px 20px 16px; padding-top: 60px; }
  .form-grid-2, .stage-grid, .field-grid, .export-grid { grid-template-columns: 1fr; }
  .control-grid { grid-template-columns: 1fr; }
  .kpis-row { grid-template-columns: 1fr 1fr; }
  .quick-actions-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .onboarding-banner { flex-direction: column; }
  .participants-mini-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .dash-topbar { flex-direction: column; align-items: flex-start; }
  .topbar-quick-links { width: 100%; }
}
@media (max-width: 480px) {
  .quick-actions-grid { grid-template-columns: 1fr; }
  .kpis-row { grid-template-columns: 1fr 1fr; }
  .stat-row { grid-template-columns: 1fr; }
  .insights-row { grid-template-columns: 1fr; }
}


/* ── QR Code & Links améliorés ────────────────────────────── */
.li-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.btn-share-wa {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  background: rgba(37,211,102,0.1);
  color: #25d366;
  border: 1px solid rgba(37,211,102,0.25);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s;
  flex-shrink: 0;
}
.btn-share-wa:hover {
  background: rgba(37,211,102,0.2);
  border-color: rgba(37,211,102,0.4);
}
.link-item-email {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.qr-img-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* ── Statistiques post-event ─────────────────────────────── */
.event-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.sc-val {
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
}
.sc-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sc-section-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.export-stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.stats-leaderboard-mini {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.slb-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface2);
  border-radius: 10px;
  font-size: 0.83rem;
  border: 1px solid var(--border);
}
.slb-rank { font-size: 1rem; min-width: 26px; text-align: center; }
.slb-name { flex: 1; font-weight: 700; color: var(--text); }
.slb-team { font-size: 0.75rem; color: var(--text-muted); }
.slb-score { font-weight: 800; color: var(--primary); min-width: 50px; text-align: right; }
.slb-correct { font-size: 0.75rem; color: var(--success); min-width: 30px; text-align: right; }
.slb-stages { font-size: 0.75rem; color: var(--text-muted); min-width: 55px; text-align: right; }
.lb-empty-org {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 16px;
  font-style: italic;
}
.mt-16 { margin-top: 16px; }

/* ===== TEAM LEADERBOARD — ORGANIZER ===== */
.stats-team-leaderboard {
  margin-top: 4px;
}
.slb-team-entry {
  background: linear-gradient(135deg, rgba(108,99,255,0.06) 0%, rgba(255,101,132,0.04) 100%);
  border-color: rgba(108,99,255,0.18);
}
.slb-team-entry:first-child {
  background: linear-gradient(135deg, rgba(255,209,102,0.1) 0%, rgba(255,180,50,0.05) 100%);
  border-color: rgba(255,209,102,0.25);
}
.slb-team-name {
  flex: 1;
  font-weight: 800;
  color: var(--text);
  font-size: 0.88rem;
}
.slb-team-members {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(108,99,255,0.1);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.slb-avg {
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 55px;
  text-align: right;
}
.slb-team-score {
  font-weight: 800;
  color: var(--primary);
  min-width: 50px;
  text-align: right;
}

/* ===== AUTO-ASSIGN BUTTON ===== */
.btn-auto-assign {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  margin-top: 12px;
  box-shadow: 0 2px 8px rgba(108,99,255,0.3);
}
.btn-auto-assign:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(108,99,255,0.4);
}
.btn-auto-assign:active {
  transform: translateY(0);
}
#btn-auto-assign-teams {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  margin-top: 12px;
  box-shadow: 0 2px 8px rgba(108,99,255,0.3);
}
#btn-auto-assign-teams:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(108,99,255,0.4);
}
#btn-auto-assign-teams::before {
  content: '🔀';
}

/* ===== LANG SELECTOR — ORGANIZER ===== */
.sidebar-lang-slot {
  padding: 4px 0 8px;
}
.sidebar-lang-slot .lang-selector-inline {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 4px 8px;
}
.sidebar-lang-slot .lang-selector-btn {
  flex: 1;
  min-width: 50px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.sidebar-lang-slot .lang-selector-btn.active,
.sidebar-lang-slot .lang-selector-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.login-lang-slot {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  gap: 8px;
}
.login-lang-slot .lang-selector-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.login-lang-slot .lang-selector-btn.active,
.login-lang-slot .lang-selector-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ===== BRANDING LANG SELECT ===== */
.b-lang-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M6 8L0 0h12z' fill='%236C63FF'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  transition: border-color 0.15s;
}
.b-lang-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.15);
}

/* ===== ORGANIZER STAT CHIPS EXTRA ===== */
.stat-chip-team {
  background: linear-gradient(135deg, rgba(108,99,255,0.08) 0%, rgba(255,101,132,0.06) 100%);
  border: 1px solid rgba(108,99,255,0.2);
}

/* ===== ANALYTICS SECTION ===== */
.analytics-loading,
.analytics-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 24px;
  font-style: italic;
}
.analytics-stage {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.analytics-stage-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.analytics-stage-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}
.analytics-stage-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
}
.analytics-stage-kpis {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.analytics-kpi {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(108,99,255,0.1);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.analytics-kpi-success {
  background: rgba(74,222,128,0.1);
  color: #4ade80;
  border-color: rgba(74,222,128,0.2);
}
.analytics-kpi-rate {
  background: rgba(255,165,0,0.08);
  color: #facc15;
  border-color: rgba(255,165,0,0.2);
}
.analytics-chart-wrap {
  margin-top: 8px;
}
.analytics-chart-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.analytics-chart-scroll {
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.analytics-chart-scroll svg {
  display: block;
  min-width: 100%;
}
.analytics-bar-group { cursor: default; }
.analytics-bar-group:hover rect { opacity: 1 !important; filter: brightness(1.15); }
.analytics-legend {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== BROADCAST PANEL ===== */
.broadcast-panel textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  padding: 10px 12px;
  transition: border-color 0.15s;
}
.broadcast-panel textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.12);
}
.broadcast-status {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.broadcast-status.success { color: #4ade80; background: rgba(74,222,128,0.1); }
.broadcast-status.error   { color: #f87171; background: rgba(248,113,113,0.1); }

/* ===== MICRO POLISH — KPI CARDS ===== */
.kpi-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

/* ===== PARTICIPANTS MINI GRID ===== */
.pmc-card {
  transition: transform 0.15s, box-shadow 0.15s;
}
.pmc-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* ===== SMOOTH TAB TRANSITIONS ===== */
.tab-section {
  animation: tabFadeIn 0.22s ease;
}
@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== FORM CARDS HOVER ===== */
.form-card {
  transition: border-color 0.2s;
}
.form-card:hover {
  border-color: rgba(108,99,255,0.2);
}

/* ============================================================
   AUTO-REFRESH INDICATOR (Bug 2.1)
   ============================================================ */
#org-refresh-indicator {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.35);
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  transition: color 0.4s, border-color 0.4s;
  white-space: nowrap;
}
#org-refresh-indicator:not(:empty) {
  color: #43E8B7;
  border-color: rgba(67,232,183,0.25);
}

/* ============================================================
   INFO message type (for email import dedup)
   ============================================================ */
.form-msg.info { color: #6C63FF; }
.form-msg.warning { color: #92400e; font-weight: 500; }

/* ============================================================
   Sections collapsables onglet Contrôle (Bug 2.8)
   ============================================================ */
.control-sections { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }

.ctrl-section {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
}
.ctrl-section-hd {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  cursor: pointer; list-style: none;
  background: rgba(108,99,255,0.05);
  transition: background 0.2s;
  user-select: none;
}
.ctrl-section-hd::-webkit-details-marker { display: none; }
.ctrl-section:hover .ctrl-section-hd { background: rgba(108,99,255,0.1); }
.ctrl-section[open] .ctrl-section-hd { background: rgba(108,99,255,0.08); border-bottom: 1px solid var(--border); }

.ctrl-section-icon { font-size: 1.1rem; flex-shrink: 0; }
.ctrl-section-title { font-family: var(--font-head, 'Space Grotesk', sans-serif); font-size: 0.95rem; font-weight: 700; color: var(--text); }
.ctrl-section-sub { font-size: 0.78rem; color: var(--text-muted); margin-left: 4px; }
.ctrl-section-arrow { margin-left: auto; color: var(--text-muted); font-size: 0.8rem; transition: transform 0.2s; }
.ctrl-section[open] .ctrl-section-arrow { transform: rotate(180deg); }
.ctrl-section-body { padding: 16px; }

/* Badge email manquant + champ inline (Bug 2.6) */
.badge-email-ok { font-size: 0.78rem; color: #43E8B7; font-weight: 600; }
.badge-email-missing { font-size: 0.75rem; color: #f59e0b; font-weight: 700; background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.3); border-radius: 6px; padding: 1px 6px; display: inline-block; }
.inline-email-input { width: 140px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); padding: 3px 7px; font-size: 0.78rem; margin: 2px 4px 0; }
.inline-email-input.input-error { border-color: var(--danger); }
.btn-inline-save-email { background: rgba(67,232,183,0.15); border: 1px solid rgba(67,232,183,0.4); color: #43E8B7; border-radius: 6px; padding: 3px 8px; font-size: 0.78rem; cursor: pointer; transition: background 0.2s; }
.btn-inline-save-email:hover { background: rgba(67,232,183,0.25); }
.td-email { max-width: 220px; }

/* Fragment count hint (Bug 2.9) */
.fragment-count-hint { font-size: 0.78rem; margin-top: 6px; padding: 5px 10px; border-radius: 8px; font-weight: 600; }
.fragment-count-hint.fch-ok   { color: #43E8B7; background: rgba(67,232,183,0.08); border: 1px solid rgba(67,232,183,0.2); }
.fragment-count-hint.fch-warn { color: #f59e0b; background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.25); }
.fragment-count-hint.fch-info { color: var(--text-muted); background: rgba(108,99,255,0.06); border: 1px solid rgba(108,99,255,0.15); }

/* Export bouton dans onglet Contrôle */
#btn-export-ctrl { width: 100%; }

/* Leaderboard final (section Après le jeu) */
.final-lb { display: flex; flex-direction: column; gap: 6px; }
.flb-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: rgba(108,99,255,0.06); border-radius: 8px; }
.flb-rank { font-size: 1.1rem; min-width: 32px; }
.flb-name { flex: 1; font-weight: 600; font-size: 0.9rem; }
.flb-score { font-weight: 700; color: var(--accent); font-size: 0.9rem; }

/* ============================================================ */
/* Onglet Historique (Bug 2.11)                                  */
/* ============================================================ */
.history-toolbar {
  display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap;
}
.history-search-input {
  flex: 1; min-width: 180px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 7px 12px; border-radius: 8px; font-size: 0.88rem; outline: none;
  transition: border-color 0.2s;
}
.history-search-input:focus { border-color: var(--primary); }
.history-list { display: flex; flex-direction: column; gap: 4px; }
.history-entry {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  background: rgba(255,255,255,0.03);
  border-left: 3px solid transparent;
  transition: background 0.15s;
}
.history-entry:hover { background: rgba(108,99,255,0.07); }
.history-action-checkin         { border-left-color: #43E8B7; }
.history-action-start-game      { border-left-color: #6C63FF; }
.history-action-game-finished   { border-left-color: #f59e0b; }
.history-action-reset-game      { border-left-color: #FF6584; }
.history-action-broadcast       { border-left-color: #38bdf8; }
.history-action-lock-attendance { border-left-color: #a78bfa; }
.history-action-next-stage      { border-left-color: #34d399; }
.he-icon { font-size: 1rem; min-width: 22px; }
.he-body { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.he-label { font-size: 0.88rem; font-weight: 600; color: var(--text); }
.he-detail { font-size: 0.78rem; color: var(--text-muted); }
.he-time {
  font-size: 0.72rem; color: var(--text-muted); white-space: nowrap;
  font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
}
.history-empty { color: var(--text-muted); font-size: 0.88rem; padding: 16px 0; text-align: center; }

/* ============================================================ */
/* Modale preview email (Bug 2.10)                               */
/* ============================================================ */
.ep-modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.72);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.ep-modal {
  background: var(--surface, #1a1928);
  border: 1px solid var(--border, #2a2845);
  border-radius: 16px;
  width: 100%; max-width: 560px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.ep-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border, #2a2845);
}
.ep-modal-header h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.ep-close {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 1.1rem; padding: 4px 8px; border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.ep-close:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.ep-modal-meta {
  padding: 12px 20px;
  background: rgba(108,99,255,0.05);
  border-bottom: 1px solid var(--border, #2a2845);
  display: flex; flex-direction: column; gap: 6px;
}
.ep-meta-row { display: flex; gap: 8px; align-items: flex-start; }
.ep-meta-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 700; min-width: 52px; padding-top: 1px; }
.ep-meta-val { font-size: 0.84rem; color: var(--text); word-break: break-word; }
.ep-body {
  flex: 1; overflow-y: auto;
  padding: 16px 20px;
  font-size: 0.88rem; color: var(--text); line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
  font-family: var(--font-body, sans-serif);
  background: rgba(255,255,255,0.02);
  border-radius: 0 0 8px 8px;
}
.ep-modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--border, #2a2845);
}

/* ── B5.1 Templates manquants ─────────────────────────────── */
.tc-meta { font-size: 0.75rem; color: var(--text-muted); }
.tc-actions { display: flex; gap: 6px; margin-top: 4px; }
.tc-btn { font-size: 0.8rem; padding: 4px 12px; }

/* ── B5.4 Durée limite étape ──────────────────────────────── */
.si-timeLimit { max-width: 90px; }

/* ── B5.6 Podium résultats ────────────────────────────────── */
.rp-podium { display: flex; justify-content: center; align-items: flex-end; gap: 8px; padding: 24px 12px 12px; }
.rp-slot { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 80px; }
.rp-rank-1 .rp-avatar { background: linear-gradient(135deg,#FFD166,#FF9F1C); width: 56px; height: 56px; font-size: 1.1rem; }
.rp-rank-2 .rp-avatar { background: linear-gradient(135deg,#C0C7D5,#8E97A8); }
.rp-rank-3 .rp-avatar { background: linear-gradient(135deg,#CD7F32,#A0522D); }
.rp-base { width: 100%; border-radius: 8px 8px 0 0; }
.rp-rank-1 .rp-base { background: rgba(255,209,102,0.18); }
.rp-rank-2 .rp-base { background: rgba(192,199,213,0.12); }
.rp-rank-3 .rp-base { background: rgba(205,127,50,0.12); }
.rp-team { font-size: 0.7rem; color: var(--accent); }

/* ── Résultats leaderboard complet ───────────────────────── */
.results-lb-header { font-size: 0.82rem; color: var(--text-muted); padding: 8px 14px; margin-top: 16px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.rlb-top { border-color: rgba(108,99,255,0.35) !important; background: rgba(108,99,255,0.05) !important; }
.rlb-name { flex: 1; font-weight: 700; }
.rlb-score { font-weight: 800; color: var(--primary); min-width: 60px; text-align: right; }
.rlb-stages { font-size: 0.75rem; color: var(--text-muted); min-width: 60px; text-align: right; }
.rlb-correct { font-size: 0.8rem; color: #4ade80; min-width: 40px; text-align: right; }

/* ── B5.3 Analytics questions table ──────────────────────── */
.analytics-questions-table { margin-top: 10px; display: flex; flex-direction: column; gap: 3px; }
.aqt-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; background: rgba(255,255,255,0.03); font-size: 0.8rem; }
.aqt-num { font-weight: 700; color: var(--primary); min-width: 24px; }
.aqt-prompt { flex: 1; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aqt-rate { font-weight: 700; min-width: 38px; text-align: right; }
.aqt-green { color: #4ade80; } .aqt-yellow { color: #facc15; } .aqt-red { color: #f87171; }
.aqt-time { color: rgba(255,255,255,0.4); min-width: 52px; text-align: right; font-size: 0.75rem; }

/* ── D2 Mode Selector (Quiz / CityHunt) ──────────────────── */
.mode-selector { display: flex; gap: 12px; margin-top: 6px; }
.mode-option { flex: 1; }
.mode-option input[type="radio"] { display: none; }
.mode-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 10px; border-radius: 10px; cursor: pointer;
  border: 2px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  transition: border-color .15s, background .15s;
}
.mode-card:hover { border-color: rgba(108,99,255,0.4); background: rgba(108,99,255,0.05); }
.mode-option input[type="radio"]:checked + .mode-card {
  border-color: var(--primary);
  background: rgba(108,99,255,0.12);
}
.mode-icon { font-size: 1.6rem; line-height: 1; }
.mode-label { font-size: 0.82rem; font-weight: 700; color: var(--text); }
.mode-desc { font-size: 0.73rem; color: var(--text-muted); text-align: center; }
.mode-hint-bar {
  margin-bottom: 10px; padding: 8px 14px; border-radius: 8px;
  background: rgba(108,99,255,0.12); color: var(--primary);
  font-size: 0.82rem; font-weight: 600; border-left: 3px solid var(--primary);
}

/* ── D3 Multi-PIN ────────────────────────────────────────── */
.form-card-header { margin-bottom: 16px; }
.form-card-header h3 { margin-bottom: 4px; }
.form-card-desc { font-size: 0.82rem; color: var(--text-muted); margin: 0; }
.badge-pro { display: inline-block; font-size: 0.65rem; padding: 1px 7px; border-radius: 20px; background: linear-gradient(90deg,#6C63FF,#43E8B7); color: #fff; font-weight: 700; vertical-align: middle; margin-left: 6px; }
.st-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-height: 32px; }
.st-empty { font-size: 0.82rem; color: var(--text-muted); padding: 8px 0; }
.st-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07); border-radius: 8px; }
.st-icon { font-size: 1rem; flex-shrink: 0; }
.st-info { flex: 1; min-width: 0; }
.st-label { font-weight: 700; font-size: 0.88rem; }
.st-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.st-preview { font-family: monospace; font-size: 0.78rem; color: var(--primary); background: rgba(108,99,255,0.1); padding: 1px 5px; border-radius: 4px; }
.st-add-row { display: flex; gap: 10px; align-items: center; }
.st-label-input { flex: 1; }
.btn-xs { padding: 4px 10px; font-size: 0.78rem; border-radius: 6px; }
.btn-danger { background: rgba(248,113,113,0.12); border: 1px solid rgba(248,113,113,0.3); color: #f87171; cursor: pointer; font-weight: 600; transition: background .15s; }
.btn-danger:hover { background: rgba(248,113,113,0.22); }
.st-token-reveal { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,0.2); border-radius: 6px; padding: 6px 10px; margin: 6px 0; font-family: monospace; font-size: 0.88rem; word-break: break-all; }
