/* KISSAI Mail : console */
:root {
  --bg: #05070d; --bg2: #0a0e18; --bg3: #0f1422; --panel: rgba(255,255,255,.035); --panel2: rgba(255,255,255,.06);
  --brd: rgba(255,255,255,.08); --brd2: rgba(255,255,255,.14);
  --txt: #eaf0f7; --txt2: #9aa7b8; --txt3: #6b7789;
  --accent: #29a3dd; --accent2: #5b8cff; --accent-soft: rgba(41,163,221,.14);
  --good: #0aac23; --warn: #fbb315; --serious: #f18a59; --bad: #dc3c3d;
  --s1: #338ced; --s2: #e76624; --s3: #00a888;
  --r: 12px; --r2: 8px;
  --fd: 'Manrope', system-ui, sans-serif; --fb: 'Inter', system-ui, sans-serif;
  --side: 232px;
}
* { box-sizing: border-box; margin: 0; padding: 0 }
html, body { height: 100% }
body { background: var(--bg); color: var(--txt); font: 14px/1.5 var(--fb); -webkit-font-smoothing: antialiased }
a { color: var(--accent); text-decoration: none } a:hover { text-decoration: underline }
h1, h2, h3, h4 { font-family: var(--fd); letter-spacing: -.01em; font-weight: 700 }
h1 { font-size: 24px } h2 { font-size: 18px } h3 { font-size: 15px } h4 { font-size: 13px; color: var(--txt2); text-transform: uppercase; letter-spacing: .08em; font-weight: 600 }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px }
hr { border: 0; border-top: 1px solid var(--brd); margin: 16px 0 }
::selection { background: rgba(41,163,221,.35) }

/* Mise en page */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh }
.side { background: var(--bg2); border-right: 1px solid var(--brd); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; font-family: var(--fd); font-weight: 800; letter-spacing: .12em; font-size: 14px }
.side .brand img { height: 22px }
.side .brand small { display: block; font-size: 10.5px; letter-spacing: .14em; color: var(--txt3); font-weight: 600 }
.side nav { padding: 6px 10px 20px; display: flex; flex-direction: column; gap: 1px }
.side nav .sec { font-size: 10.5px; letter-spacing: .14em; color: var(--txt3); text-transform: uppercase; padding: 14px 10px 6px; font-weight: 600 }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--txt2); font-weight: 500 }
.side nav a:hover { background: var(--panel); color: var(--txt); text-decoration: none }
.side nav a.on { background: var(--accent-soft); color: var(--txt) }
.side nav a .ico { width: 18px; text-align: center; opacity: .9 }
.side .foot { margin-top: auto; padding: 14px 18px; border-top: 1px solid var(--brd); font-size: 12px; color: var(--txt3) }
.main { min-width: 0 }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: rgba(5,7,13,.86); backdrop-filter: blur(12px); border-bottom: 1px solid var(--brd) }
.top .crumbs { color: var(--txt2); font-size: 13px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.top .crumbs b { color: var(--txt) }
.content { padding: 24px 28px 80px; max-width: 1400px }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap }
.pagehead p { color: var(--txt2); margin-top: 4px; max-width: 720px }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap }
.row.between { justify-content: space-between }
.grow { flex: 1 }
.grid { display: grid; gap: 16px }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)) } .g3 { grid-template-columns: repeat(3, minmax(0,1fr)) } .g4 { grid-template-columns: repeat(4, minmax(0,1fr)) }
.g-side { grid-template-columns: minmax(0,1fr) 340px }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, 1fr) } .g3, .g-side { grid-template-columns: 1fr } }
@media (max-width: 800px) { .app { grid-template-columns: 1fr } .side { position: relative; height: auto } .g2 { grid-template-columns: 1fr } .content { padding: 16px } }
.mt { margin-top: 16px } .mt2 { margin-top: 24px } .mb { margin-bottom: 16px } .muted { color: var(--txt2) } .dim { color: var(--txt3) } .small { font-size: 12.5px } .right { text-align: right } .nowrap { white-space: nowrap }

/* Cartes */
.card { background: var(--panel); border: 1px solid var(--brd); border-radius: var(--r); padding: 18px }
.card.pad0 { padding: 0 } .card h3 { margin-bottom: 12px }
.card .cardhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px }
.card .cardhead h3 { margin: 0 }
.kpi { background: var(--panel); border: 1px solid var(--brd); border-radius: var(--r); padding: 16px 18px }
.kpi .lbl { color: var(--txt2); font-size: 12.5px } .kpi .val { font-family: var(--fd); font-size: 28px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em }
.kpi .sub { color: var(--txt3); font-size: 12px; margin-top: 2px }

/* Boutons et champs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--brd2); background: var(--panel2); color: var(--txt); font: 600 13.5px var(--fd); padding: 8px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap; transition: .15s }
.btn:hover { border-color: var(--accent); text-decoration: none }
.btn.primary { background: linear-gradient(100deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff }
.btn.primary:hover { filter: brightness(1.08) }
.btn.danger { border-color: rgba(220,60,61,.5); color: #ff8a8b } .btn.danger:hover { background: rgba(220,60,61,.12) }
.btn.ghost { background: transparent; border-color: transparent; color: var(--txt2) } .btn.ghost:hover { color: var(--txt); background: var(--panel) }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px }
.btn:disabled { opacity: .5; cursor: not-allowed }
label.f { display: block; margin-bottom: 12px }
label.f > span { display: block; font-size: 12.5px; color: var(--txt2); margin-bottom: 5px; font-weight: 500 }
label.f > small { display: block; color: var(--txt3); font-size: 12px; margin-top: 4px }
input, select, textarea { width: 100%; background: var(--bg3); border: 1px solid var(--brd2); color: var(--txt); border-radius: 8px; padding: 8px 10px; font: 14px var(--fb); outline: none }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft) }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent) }
input[type=color] { padding: 2px; height: 36px; width: 56px }
textarea { min-height: 90px; resize: vertical }
textarea.code { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; min-height: 360px; line-height: 1.45 }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; cursor: pointer }
.check input { margin-top: 3px }
.check b { display: block; font-weight: 600 } .check small { color: var(--txt2) }
.inline { display: flex; gap: 8px; align-items: center } .inline > * { flex: 1 }
.search { max-width: 280px }

/* Tableaux */
.tbl { width: 100%; border-collapse: collapse }
.tbl th { text-align: left; font-weight: 600; font-size: 12px; color: var(--txt2); padding: 10px 12px; border-bottom: 1px solid var(--brd); white-space: nowrap; position: sticky; top: 0; background: var(--bg2) }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--brd); vertical-align: middle }
.tbl tr.click { cursor: pointer } .tbl tr.click:hover td { background: var(--panel) }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums }
.tblwrap { overflow: auto; max-height: 70vh; border-radius: var(--r) }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; border: 1px solid var(--brd2); color: var(--txt2); white-space: nowrap }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9 }
.badge.plain::before { display: none }
.b-good { color: #45d460; border-color: rgba(10,172,35,.4); background: rgba(10,172,35,.08) }
.b-warn { color: var(--warn); border-color: rgba(251,179,21,.4); background: rgba(251,179,21,.07) }
.b-bad { color: #ff7a7b; border-color: rgba(220,60,61,.45); background: rgba(220,60,61,.08) }
.b-info { color: var(--accent); border-color: rgba(41,163,221,.4); background: var(--accent-soft) }
.b-mute { color: var(--txt3) }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle }

/* Onglets, étapes */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--brd); margin-bottom: 18px; overflow-x: auto }
.tabs a { padding: 10px 14px; color: var(--txt2); font-weight: 600; font-family: var(--fd); border-bottom: 2px solid transparent; white-space: nowrap }
.tabs a:hover { color: var(--txt); text-decoration: none } .tabs a.on { color: var(--txt); border-color: var(--accent) }
.steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap }
.steps a { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--brd); color: var(--txt2); font-weight: 600; font-family: var(--fd); font-size: 13px }
.steps a b { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--panel2); font-size: 11px }
.steps a.on { border-color: var(--accent); color: var(--txt); background: var(--accent-soft) } .steps a.on b { background: var(--accent); color: #fff }
.steps a.done b { background: rgba(10,172,35,.25); color: #45d460 }
.steps a:hover { text-decoration: none; color: var(--txt) }

/* Barre de progression, jauges */
.bar { height: 6px; background: var(--panel2); border-radius: 99px; overflow: hidden }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 99px }
.score { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; font: 800 28px var(--fd) }

/* Modale, tiroir, toasts */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade .15s }
.modal { background: var(--bg2); border: 1px solid var(--brd2); border-radius: 14px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,.6) }
.modal.wide { width: min(980px, 100%) } .modal.xwide { width: min(1280px, 100%) }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--brd); position: sticky; top: 0; background: var(--bg2); z-index: 2 }
.modal .body { padding: 20px } .modal footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--brd); position: sticky; bottom: 0; background: var(--bg2) }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--bg2); border-left: 1px solid var(--brd2); z-index: 101; overflow: auto; animation: slide .2s; box-shadow: -30px 0 80px rgba(0,0,0,.5) }
.drawer header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--brd); position: sticky; top: 0; background: var(--bg2) }
.drawer .body { padding: 20px }
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 420px }
.toast { background: var(--bg3); border: 1px solid var(--brd2); border-left: 3px solid var(--accent); border-radius: 10px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: slide .2s }
.toast.err { border-left-color: var(--bad) } .toast.ok { border-left-color: var(--good) }
@keyframes fade { from { opacity: 0 } } @keyframes slide { from { transform: translateX(20px); opacity: 0 } }

/* Divers */
.empty { text-align: center; padding: 48px 20px; color: var(--txt2) }
.empty h3 { color: var(--txt); margin-bottom: 6px }
.spin { width: 18px; height: 18px; border: 2px solid var(--brd2); border-top-color: var(--accent); border-radius: 50%; animation: rot .7s linear infinite; display: inline-block }
@keyframes rot { to { transform: rotate(360deg) } }
.loading { display: flex; gap: 10px; align-items: center; color: var(--txt2); padding: 30px }
.notice { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--brd2); background: var(--panel); color: var(--txt2) }
.notice.warn { border-color: rgba(251,179,21,.35); background: rgba(251,179,21,.06); color: #f6d48a }
.notice.bad { border-color: rgba(220,60,61,.4); background: rgba(220,60,61,.07); color: #ffb3b3 }
.notice.good { border-color: rgba(10,172,35,.35); background: rgba(10,172,35,.07); color: #9be6a8 }
.notice b { color: var(--txt) }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: 13.5px } .kv dt { color: var(--txt2) }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--brd); font-size: 12px; margin: 2px }
.chip button { background: none; border: 0; color: var(--txt3); cursor: pointer }
.copy { display: flex; gap: 8px } .copy input { font-family: ui-monospace, Menlo, monospace; font-size: 12px }
.swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; vertical-align: middle; border: 1px solid var(--brd2) }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--txt2) } .legend span { display: inline-flex; gap: 6px; align-items: center }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block }
.chart { position: relative } .chart svg { display: block; width: 100%; overflow: visible }
.tip { position: absolute; pointer-events: none; background: var(--bg3); border: 1px solid var(--brd2); border-radius: 8px; padding: 8px 10px; font-size: 12px; white-space: nowrap; z-index: 5; box-shadow: 0 8px 24px rgba(0,0,0,.4) }
.hbar { display: grid; grid-template-columns: 140px 1fr 56px; gap: 10px; align-items: center; font-size: 13px; margin: 7px 0 }
.hbar .t { height: 10px; background: var(--panel2); border-radius: 4px; overflow: hidden } .hbar .t i { display: block; height: 100%; background: var(--s1); border-radius: 4px }
.funnel { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px }
.preview-frame { width: 100%; border: 0; background: #fff; border-radius: 8px; display: block }
.device { margin: 0 auto; transition: width .25s }
.device.mobile { width: 390px; border: 10px solid #1d2230; border-radius: 34px; overflow: hidden }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 500px at 80% -10%, rgba(91,140,255,.18), transparent 60%), radial-gradient(700px 500px at 0% 10%, rgba(45,226,230,.1), transparent 55%), var(--bg) }
.login .card { width: min(400px, 100%); padding: 30px }

/* Éditeur d'e-mail */
.ed { display: grid; grid-template-columns: 220px minmax(0,1fr) 320px; gap: 0; border: 1px solid var(--brd); border-radius: var(--r); overflow: hidden; min-height: 75vh; background: var(--bg2) }
@media (max-width: 1200px) { .ed { grid-template-columns: 180px minmax(0,1fr) 280px } }
.ed .pal { border-right: 1px solid var(--brd); padding: 12px; overflow: auto }
.ed .pal button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 10px; margin-bottom: 4px; border-radius: 8px; border: 1px solid var(--brd); background: var(--panel); color: var(--txt); cursor: pointer; font: 500 13px var(--fb) }
.ed .pal button:hover { border-color: var(--accent) }
.ed .canvas { background: #e9ebef; overflow: auto; padding: 24px 12px }
.ed .canvas .doc { margin: 0 auto; transition: width .2s }
.ed .blk { position: relative; outline: 1px dashed transparent; cursor: pointer }
.ed .blk:hover { outline-color: rgba(41,163,221,.6) } .ed .blk.sel { outline: 2px solid var(--accent) }
.ed .blk .tools { position: absolute; top: -1px; right: -1px; display: none; gap: 2px; background: var(--accent); border-radius: 0 0 0 6px; padding: 2px; z-index: 3 }
.ed .blk.sel .tools, .ed .blk:hover .tools { display: flex }
.ed .blk .tools button { background: none; border: 0; color: #fff; cursor: pointer; padding: 2px 6px; font-size: 12px }
.ed .insp { border-left: 1px solid var(--brd); padding: 14px; overflow: auto }
.ed .insp h3 { margin-bottom: 12px }
.ed [contenteditable] { outline: none } .ed [contenteditable]:focus { box-shadow: inset 0 0 0 1px rgba(41,163,221,.5) }
.rt { display: flex; gap: 4px; margin-bottom: 8px; flex-wrap: wrap } .rt button { padding: 4px 8px }

/* Constructeur de scénario */
.flow { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 10px 0 40px }
.flow .node { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--brd2); border-radius: 12px; padding: 12px 14px; position: relative }
.flow .node.trigger { border-color: rgba(41,163,221,.6); background: var(--accent-soft) }
.flow .node .t { font: 700 12px var(--fd); letter-spacing: .08em; text-transform: uppercase; color: var(--txt2); margin-bottom: 4px }
.flow .node .act { position: absolute; top: 8px; right: 8px; display: flex; gap: 2px }
.flow .link { width: 2px; height: 22px; background: var(--brd2) }
.flow .add { width: 28px; height: 28px; border-radius: 50%; border: 1px dashed var(--brd2); background: var(--bg2); color: var(--txt2); cursor: pointer; font-size: 16px }
.flow .add:hover { border-color: var(--accent); color: var(--accent) }
.flow .branches { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; width: 100%; border-top: 2px solid var(--brd2); padding-top: 0 }
.flow .branch { display: flex; flex-direction: column; align-items: center }
.flow .branch .lbl { font-size: 12px; font-weight: 700; margin: 6px 0; padding: 2px 10px; border-radius: 99px }
