/* ============================================================================
   Postman · Console — feuille de style
   Sobre et dense, pensée pour un téléphone en pleine soirée :
   fond neutre, bordures fines, chiffres alignés, couleur réservée aux états
   (vert = ça marche, orange = à surveiller, rouge = à traiter, bleu = action).
   ============================================================================ */

:root {
  color-scheme: dark;
  --bg: #0b0c0f;
  --surface: #121419;
  --surface-2: #171a20;
  --surface-3: #1e2229;
  --press: #272c35;
  --border: #22262e;
  --border-2: #2e333d;
  --text: #e9eaee;
  --text-2: #a2a7b2;
  --text-3: #6d7280;
  --accent: #5b8cff;
  --accent-press: #4a78e6;
  --green: #35c37b;
  --amber: #f0b42a;
  --red: #f0585e;
  --accent-bg: rgba(91, 140, 255, .13);
  --green-bg: rgba(53, 195, 123, .12);
  --amber-bg: rgba(240, 180, 42, .12);
  --red-bg: rgba(240, 88, 94, .12);
  --r: 12px;
  --r-sm: 9px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabs-h: 54px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 15px/1.4 var(--font); -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; margin: 0; touch-action: manipulation; }
a { color: var(--accent); }
b { font-weight: 600; }
svg { display: block; }
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mt6 { margin-top: 6px; }
.mb12 { margin-bottom: 12px; }

/* ----------------------------------------------------------------- champs */
.inp {
  width: 100%; min-height: 40px; padding: 8px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text);
  font-size: 16px; /* 16 px : iOS ne zoome pas au toucher */ outline: none; -webkit-appearance: none; appearance: none;
}
textarea.inp { resize: vertical; min-height: 96px; line-height: 1.4; }
.inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.inp::placeholder { color: var(--text-3); }
input[type=search]::-webkit-search-cancel-button { display: none; }
.num-in { width: 72px; text-align: center; font-variant-numeric: tabular-nums; }
.sel-in { width: auto; min-width: 128px; padding-right: 28px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }

/* ----------------------------------------------------------------- boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 8px 14px; border-radius: var(--r-sm);
  background: var(--surface-3); border: 1px solid var(--border-2); color: var(--text);
  font-size: 14.5px; font-weight: 600; line-height: 1.2; text-align: center; transition: background .12s, opacity .12s;
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:active { background: var(--press); }
.btn.acc { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.acc:active { background: var(--accent-press); }
.btn.red { background: var(--red-bg); border-color: rgba(240, 88, 94, .45); color: var(--red); }
.btn.amb { background: var(--amber-bg); border-color: rgba(240, 180, 42, .45); color: var(--amber); }
.btn.ghost { background: transparent; border-color: var(--border-2); color: var(--text-2); }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 13.5px; }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: .42; pointer-events: none; }
.btn.busy { opacity: .6; pointer-events: none; }
.icbtn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; border-radius: var(--r-sm); color: var(--text-2);
  border: 1px solid var(--border); background: var(--surface);
}
.icbtn svg { width: 18px; height: 18px; }
.icbtn:active { background: var(--press); }
.icbtn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.row { display: flex; align-items: center; }
.row > * { min-width: 0; }
.row .grow { flex: 1; }
.row.gap { gap: 8px; }

/* ----------------------------------------------------------------- connexion */
.screen { min-height: 100dvh; }
#login { display: flex; align-items: center; justify-content: center; padding: calc(24px + var(--safe-t)) 20px calc(24px + var(--safe-b)); }
.login-box { width: 100%; max-width: 360px; }
#login .logo {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 18px;
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text);
}
#login .logo svg { width: 26px; height: 26px; }
#login h1 { margin: 0 0 26px; font-size: 24px; font-weight: 650; letter-spacing: -.01em; }
#login h1 span { display: block; margin-top: 2px; font-size: 14.5px; font-weight: 400; color: var(--text-2); letter-spacing: 0; }
#login-form label { display: block; margin-bottom: 6px; font-size: 12.5px; color: var(--text-2); }
#login-form .inp { margin-bottom: 12px; }
.login-msg { min-height: 20px; margin: 14px 0 0; font-size: 14px; color: var(--text-2); }

/* ----------------------------------------------------------------- en-tête */
header {
  position: sticky; top: 0; z-index: 20; padding-top: var(--safe-t);
  background: rgba(11, 12, 15, .88); -webkit-backdrop-filter: saturate(150%) blur(14px); backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.hrow { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 12px; }
.brand { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--text-2); }
.brand svg { width: 17px; height: 17px; }
header .title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#h-title { font-size: 15.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#h-sub { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; flex: none; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 11px; font-weight: 650; letter-spacing: .06em; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border-2);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.pill.on { background: var(--green-bg); color: var(--green); border-color: rgba(53, 195, 123, .35); }
.pill.on .dot { background: var(--green); box-shadow: 0 0 0 3px rgba(53, 195, 123, .18); }
.pill.off { background: var(--red-bg); color: var(--red); border-color: rgba(240, 88, 94, .35); }
.pill.off .dot { background: var(--red); }
.banner { padding: 8px 14px; font-size: 13px; background: var(--amber-bg); color: var(--amber); border-top: 1px solid rgba(240, 180, 42, .25); }

#ptr {
  position: fixed; left: 50%; top: calc(var(--safe-t) + 46px); z-index: 30; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; transform: translate(-50%, 0); opacity: 0; pointer-events: none;
  background: var(--surface-3); border: 1px solid var(--border-2); color: var(--text-2);
}
#ptr svg { width: 17px; height: 17px; }
#ptr.ready { color: var(--accent); }
#ptr.loading svg { animation: spin .8s linear infinite; }

/* ----------------------------------------------------------------- structure */
main { padding: 12px 12px calc(var(--tabs-h) + var(--safe-b) + 16px); max-width: 640px; margin: 0 auto; }
main.loading .card, main.loading .kpis { opacity: .55; }
section.tab { display: none; }
section.tab.active { display: block; animation: fade .14s ease-out; }
@keyframes fade { from { opacity: .4; } to { opacity: 1; } }

nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex;
  height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(11, 12, 15, .92); -webkit-backdrop-filter: saturate(150%) blur(14px); backdrop-filter: saturate(150%) blur(14px);
  border-top: 1px solid var(--border);
}
nav.tabs button {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); font-size: 10.5px; font-weight: 600; letter-spacing: .01em;
}
nav.tabs button .ic { width: 22px; height: 22px; }
nav.tabs button.active { color: var(--text); }
nav.tabs button.active .ic { color: var(--accent); }
nav.tabs button .badge {
  position: absolute; top: 5px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--amber); color: #111; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
}
body.kb nav.tabs { display: none; }
body.kb main { padding-bottom: 16px; }

/* ----------------------------------------------------------------- cartes */
.card {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 12px 14px; margin-bottom: 10px;
}
.card.flush { padding: 0; overflow: hidden; }
.sec-h {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px;
  font-size: 11.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3);
}
.sec-h .meta { font-weight: 500; letter-spacing: 0; text-transform: none; font-size: 12px; color: var(--text-3); text-align: right; }
.empty { padding: 14px 4px; text-align: center; font-size: 13.5px; color: var(--text-3); }
.card.flush .empty { padding: 22px 12px; }
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 14px; }
.kv span:first-child { color: var(--text-2); flex: none; }
.kv span:last-child { text-align: right; min-width: 0; }

/* interrupteur (ON/OFF, options) */
.switch {
  position: relative; flex: none; width: 52px; height: 32px; border-radius: 999px; cursor: pointer;
  background: var(--surface-3); border: 1px solid var(--border-2); transition: background .15s, border-color .15s; touch-action: manipulation;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #cfd3db; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: transform .18s ease;
}
.switch.on { background: var(--green); border-color: var(--green); }
.switch.on::after { transform: translateX(20px); background: #fff; }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch::before, .icbtn::before, .toolbar button::before { content: ""; position: absolute; inset: -6px; } /* zone de toucher plus large que le dessin */
.icbtn, .toolbar button { position: relative; }
.switch.busy { opacity: .55; pointer-events: none; }
.switch.mini { width: 46px; height: 32px; }
.switch.mini::after { top: 4px; left: 4px; width: 22px; height: 22px; }
.switch.mini.on::after { transform: translateX(14px); }

/* ----------------------------------------------------------------- Soirée */
.status { display: flex; align-items: center; gap: 12px; }
.st-text { flex: 1; min-width: 0; }
.status .big { font-size: 17px; font-weight: 650; letter-spacing: -.005em; }
.status .big::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 8px 2px 0; background: var(--red); vertical-align: middle; }
#hero.on .status .big::before { background: var(--green); box-shadow: 0 0 0 3px rgba(53, 195, 123, .18); }
.status .sub { font-size: 12.5px; color: var(--text-2); margin-top: 1px; }
.issues { margin-top: 10px; border-top: 1px solid var(--border); }
.issue { display: flex; align-items: center; gap: 10px; padding: 9px 0 0; font-size: 13.5px; line-height: 1.35; }
.issue + .issue { margin-top: 6px; }
.issue .lv { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.issue.warn .lv { background: var(--amber); }
.issue.info .lv { background: var(--accent); }
.issue .tx { flex: 1; min-width: 0; color: var(--text); }
.issue.info .tx { color: var(--text-2); }
.issue .go { flex: none; }
.issue.ok { color: var(--text-2); }
.issue.ok .lv { background: var(--green); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.tile {
  position: relative; display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 60px; min-width: 0;
  padding: 9px 9px 8px; border-radius: var(--r-sm); text-align: left;
  background: var(--surface); border: 1px solid var(--border);
}
button.tile:active { background: var(--press); }
button.tile::after {
  content: ""; position: absolute; top: 9px; right: 8px; width: 5px; height: 5px;
  border-top: 1.5px solid var(--text-3); border-right: 1.5px solid var(--text-3); transform: rotate(45deg);
}
.tile .v { font-size: 19px; font-weight: 650; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
.tile .l { font-size: 11px; color: var(--text-2); line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile.warn .v { color: var(--amber); }
.tile.bad .v { color: var(--red); }
.tile.good .v { color: var(--green); }
.tile.bump { animation: bump .5s ease-out; }
@keyframes bump { 0% { border-color: var(--accent); } 100% { border-color: var(--border); } }
.tile.sk .v, .tile.sk .l { border-radius: 4px; background: var(--surface-3); color: transparent; }
.tile.sk .l { width: 70%; }

.cost-card { display: flex; align-items: center; gap: 12px; padding-right: 48px; }
.cost-l { flex: 1; min-width: 0; }
.cost-l .lbl { font-size: 11.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 2px; }
.cost { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.cost .usd { font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.cost .usd.bump { animation: flash .6s ease-out; }
@keyframes flash { from { color: var(--accent); } to { color: var(--text); } }
.cost .eur { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.cost-r { margin: 0; display: grid; gap: 3px; flex: none; }
.cost-r div { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.cost-r dt { color: var(--text-3); }
.cost-r dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.icbtn.info { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border: 0; background: transparent; color: var(--text-3); }
.icbtn.info svg { width: 17px; height: 17px; }

.act-card .sec-h { margin-bottom: 8px; }
.spark { width: 100%; height: 46px; }
.spark rect { fill: var(--accent); opacity: .45; }
.spark rect.peak { opacity: 1; }
.spark rect.zero { fill: var(--border-2); opacity: 1; }
.sparkx { display: flex; justify-content: space-between; margin-top: 4px; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.top { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.top::-webkit-scrollbar { display: none; }
.top .lbl { flex: none; font-size: 11.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-right: 2px; }
.top .empty { padding: 0; font-size: 12.5px; text-align: left; }
.rank {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border-2); font-size: 13px; font-variant-numeric: tabular-nums;
}
.rank:active { background: var(--press); }
.rank .num { font-weight: 650; }
.rank .num::before { content: "N° "; font-weight: 500; color: var(--text-3); }
.rank .tot { color: var(--text-2); }

.opts { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.opts-l { flex: none; font-size: 11.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.opts .opt { flex: 1; min-width: 0; display: flex; }
/* les options sont des puces : point vert = relayé */
.opts .switch.mini {
  flex: 1; width: auto; height: 32px; padding: 0 8px 0 24px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-2);
  font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden;
}
.opts .switch.mini::after { top: 50%; left: 11px; width: 8px; height: 8px; margin-top: -4px; background: var(--text-3); box-shadow: none; transform: none; }
.opts .switch.mini.on { background: var(--green-bg); border-color: rgba(53, 195, 123, .4); color: var(--green); }
.opts .switch.mini.on::after { background: var(--green); transform: none; }

/* ----------------------------------------------------------------- Inscrits */
.search { position: relative; display: flex; gap: 8px; margin-bottom: 8px; }
.search .s-ic { position: absolute; left: 11px; top: 11px; width: 18px; height: 18px; color: var(--text-3); pointer-events: none; }
.search .inp { padding-left: 36px; }
.search .icbtn { width: 40px; height: 40px; }
.filters { display: flex; gap: 6px; overflow-x: auto; margin: 0 -12px 10px; padding: 0 12px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border-2); color: var(--text-2); font-size: 13.5px; font-weight: 600;
}
.filters button:active { background: var(--press); }
.filters button.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.cnt { min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--surface-3); color: var(--text-2); font-size: 11.5px; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.active > .cnt { background: rgba(0, 0, 0, .14); color: inherit; }

.person {
  display: flex; align-items: center; gap: 11px; width: 100%; min-height: 58px; padding: 9px 12px; text-align: left;
  border-top: 1px solid var(--border);
}
.person:first-child { border-top: 0; }
.person:active { background: var(--surface-2); }
.person .num {
  flex: none; min-width: 42px; height: 30px; padding: 0 6px; border-radius: 7px; display: grid; place-items: center;
  background: var(--surface-3); border: 1px solid var(--border-2); font-size: 14.5px; font-weight: 650; font-variant-numeric: tabular-nums;
}
.person .num.blocked { background: var(--red-bg); border-color: rgba(240, 88, 94, .4); color: var(--red); }
.person .n { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.person .n b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .n small { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { flex: none; display: flex; align-items: center; gap: 5px; }
.chip {
  display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 6px; font-size: 11.5px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.chip.r { background: var(--red-bg); border-color: rgba(240, 88, 94, .35); color: var(--red); }
.chip.a { background: var(--amber-bg); border-color: rgba(240, 180, 42, .35); color: var(--amber); }
.chev { flex: none; width: 7px; height: 7px; margin-left: 2px; border-top: 1.5px solid var(--text-3); border-right: 1.5px solid var(--text-3); transform: rotate(45deg); }

/* ----------------------------------------------------------------- Journal */
.ev { display: grid; grid-template-columns: 40px 8px minmax(0, 1fr); align-items: baseline; gap: 9px; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 13.5px; }
.ev:first-child { border-top: 0; }
.ev .t { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ev .ic { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); align-self: center; }
.ev .ic.k-relay { background: var(--green); }
.ev .ic.k-pending { background: var(--amber); }
.ev .ic.k-error { background: var(--red); }
.ev .ic.k-guest { background: var(--accent); }
.ev .ic.k-gate { background: var(--text-3); }
.ev .ic.k-admin { background: #b48cff; }
.ev .d { min-width: 0; overflow-wrap: anywhere; }
.ev .d small { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.sheet .ev { padding-left: 0; padding-right: 0; }

/* ----------------------------------------------------------------- Annonce */
.composer { padding-bottom: 10px; }
.composer-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.modes { display: flex; padding: 2px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); flex: none; }
.modes button { height: 32px; padding: 0 10px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.modes button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.toolbar { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.toolbar::-webkit-scrollbar { display: none; }
.toolbar button {
  flex: none; width: 32px; height: 34px; border-radius: 7px; display: grid; place-items: center;
  color: var(--text-2); font-size: 15px; font-weight: 600;
}
.toolbar button svg { width: 17px; height: 17px; }
.toolbar button:active { background: var(--press); }
.toolbar button.b { font-weight: 800; }
.toolbar button.i { font-style: italic; font-family: Georgia, "Times New Roman", serif; font-size: 17px; }
.toolbar button.s { text-decoration: line-through; }
.toolbar button.m { font-family: var(--mono); font-size: 11.5px; }
.toolbar button.c { font-size: 13px; }
.toolbar button.on { background: var(--accent-bg); color: var(--accent); }
.composer.preview-mode .toolbar { visibility: hidden; }
.editor {
  min-height: 116px; max-height: 46dvh; overflow-y: auto; padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--border-2); font-size: 16px; line-height: 1.45; outline: none;
  white-space: pre-wrap; overflow-wrap: anywhere; -webkit-user-select: text; user-select: text;
}
.editor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.editor:empty::before { content: attr(data-ph); color: var(--text-3); pointer-events: none; }
.editor b, .editor strong { font-weight: 700; }
.editor code { font-family: var(--mono); font-size: 14px; padding: 1px 4px; border-radius: 4px; background: var(--surface-3); }
.pane-preview { min-height: 116px; }
.count { font-size: 11.5px; color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }
.count:not(:empty) { margin-top: 4px; }
.count.over { color: var(--red); font-weight: 600; }
#attach-zone:not(:empty) { margin-top: 6px; }
.attach, .rec {
  display: flex; align-items: center; gap: 9px; padding: 8px 8px 8px 11px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--border-2); font-size: 13.5px;
}
.attach .kind { flex: none; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.attach .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach .st { flex: none; font-size: 12px; color: var(--text-2); }
.attach .st.ready { color: var(--green); }
.attach .x { flex: none; width: 32px; height: 32px; border-radius: 7px; display: grid; place-items: center; color: var(--text-2); }
.attach .x svg { width: 16px; height: 16px; }
.attach .x:active { background: var(--press); }
.rec { border-color: rgba(240, 88, 94, .45); }
.rec .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); animation: blink 1s ease-in-out infinite; flex: none; }
@keyframes blink { 50% { opacity: .25; } }
.rec .muted { margin-left: auto; font-size: 12px; }
.mediabar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.mbtn {
  display: flex; align-items: center; justify-content: center; gap: 6px; height: 38px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 13px; font-weight: 600;
}
.mbtn svg { width: 17px; height: 17px; flex: none; }
.mbtn:active { background: var(--press); }
.mbtn.on { background: var(--red-bg); border-color: rgba(240, 88, 94, .45); color: var(--red); }

.preview {
  padding: 10px; border-radius: var(--r-sm); min-height: 116px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  background: #0b141a; border: 1px solid var(--border);
}
.bubble {
  position: relative; max-width: 86%; padding: 6px 9px 18px; border-radius: 9px 2px 9px 9px;
  background: #005c4b; color: #e9edef; font-size: 14.5px; line-height: 1.38; white-space: pre-wrap; overflow-wrap: anywhere;
}
.bubble .meta { position: absolute; right: 8px; bottom: 3px; font-size: 10.5px; color: rgba(233, 237, 239, .62); }
.bubble img, .bubble video { display: block; width: 100%; max-width: 260px; max-height: 260px; object-fit: cover; border-radius: 6px; margin: 0 0 4px; background: #000; }
.bubble .vocal { display: flex; align-items: center; gap: 8px; min-width: 190px; padding: 4px 0; }
.bubble .vocal .play { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .14); font-size: 11px; }
.bubble .vocal .wave { flex: 1; height: 16px; border-radius: 3px; background: repeating-linear-gradient(90deg, rgba(233, 237, 239, .5) 0 2px, transparent 2px 5px); }
.bubble .vocal .dur { font-size: 11.5px; color: rgba(233, 237, 239, .75); font-variant-numeric: tabular-nums; }
.bubble code { font-family: var(--mono); font-size: 13px; }
.bubble .muted { color: rgba(233, 237, 239, .55); }

.seg { display: flex; padding: 2px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button {
  flex: 1; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 6px;
  border-radius: 7px; color: var(--text-2); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.seg button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.seg button:disabled { opacity: .45; }
/* sections repliables (ce qui sert moins reste à un appui) */
details.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; min-height: 32px; margin: -4px 0; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary .sec-h { flex: 1; min-width: 0; margin: 0; }
details.fold > summary::after {
  content: ""; flex: none; width: 7px; height: 7px; margin-right: 3px; border-right: 1.5px solid var(--text-3); border-bottom: 1.5px solid var(--text-3);
  transform: rotate(45deg) translateY(-2px); transition: transform .15s;
}
details.fold[open] > summary::after { transform: rotate(225deg) translate(-2px, 0); }
details.fold[open] > summary { margin-bottom: 8px; }
.ai-card .seg { margin-bottom: 8px; }
.ai-card .sec-h .meta.off { color: var(--amber); }

.send-card .seg { margin-bottom: 10px; }
.costnote { font-size: 13.5px; color: var(--text-2); margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.costnote b { color: var(--text); }
.costnote .muted { margin-top: 3px; font-size: 12.5px; color: var(--text-3); }
.test-row { display: flex; gap: 8px; margin-bottom: 10px; }
.test-row .inp { flex: 1; min-width: 0; }
.test-row .btn { flex: none; min-height: 40px; }
.progress { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin-bottom: 10px; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }
#a-send.stop { background: var(--surface-3); border-color: var(--border-2); color: var(--text); }
#a-result:empty { display: none; }
.result { padding: 12px 14px; border-radius: var(--r); margin-bottom: 10px; background: var(--green-bg); border: 1px solid rgba(53, 195, 123, .35); font-size: 14px; }
.result.warn { background: var(--amber-bg); border-color: rgba(240, 180, 42, .35); }
.result b { display: block; margin-bottom: 2px; }
.result .muted { font-size: 13px; }
.result .actions { display: flex; gap: 8px; margin-top: 10px; }
.result .actions .btn { flex: 1; }
.fail-list { margin-top: 8px; font-size: 13px; }
.fail-list b { display: inline; }
.fail-list small { display: block; margin-top: 3px; color: var(--text-2); }

/* ----------------------------------------------------------------- Réglages */
.set { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); }
.sec-h + .set { border-top: 0; padding-top: 0; }
.set .l { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; }
.set .l small { display: block; margin-top: 1px; font-size: 12px; font-weight: 400; color: var(--text-3); }
.set .btn { flex: none; }
.card > .btn.block { margin-top: 10px; }
.link-state { font-size: 13.5px; margin-bottom: 10px; }
.link-state .st { display: flex; align-items: center; gap: 8px; }
.link-state .st::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.link-state .st.ok::before { background: var(--green); }
.link-state .st.warn::before { background: var(--amber); }
.link-state .st.ko::before { background: var(--red); }
#diag-out:not(:empty) { margin-top: 10px; border-top: 1px solid var(--border); }
.check { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.check .ic { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--text-3); }
.check.ok .ic { background: var(--green); }
.check.warn .ic { background: var(--amber); }
.check.ko .ic { background: var(--red); }
.check b { display: block; font-size: 13.5px; }
.check small { display: block; font-size: 12px; color: var(--text-2); overflow-wrap: anywhere; }
.check.ko b { color: var(--red); }
.check.warn b { color: var(--amber); }
.bl { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.bl:first-child { border-top: 0; padding-top: 0; }
.bl .n { flex: 1; min-width: 0; }
.bl .n b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.bl .n small { display: block; font-size: 12px; color: var(--text-3); }
#bl-list .empty { padding: 4px 0; text-align: left; }
.card .kv:first-of-type { margin-top: 2px; }

/* ----------------------------------------------------------------- feuilles du bas */
.sheetwrap { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.sheetwrap .bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); opacity: 0; transition: opacity .18s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 640px; margin: 0 auto; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 16px calc(16px + var(--safe-b)); border-radius: 16px 16px 0 0;
  background: var(--surface); border: 1px solid var(--border-2); border-bottom: 0;
  transform: translateY(105%); transition: transform .22s cubic-bezier(.2, .8, .2, 1);
}
.sheetwrap.open { pointer-events: auto; }
.sheetwrap.open .bg { opacity: 1; }
.sheetwrap.open .sheet { transform: none; }
.sheet .grab { width: 36px; height: 4px; border-radius: 2px; background: var(--border-2); margin: 0 auto 12px; }
.sheet h2 { margin: 0 0 4px; font-size: 17px; font-weight: 650; letter-spacing: -.005em; }
.sheet .sub { margin-bottom: 14px; font-size: 14px; color: var(--text-2); line-height: 1.45; }
.sheet .sub b { color: var(--text); }
.sheet .subhead { margin: 16px 0 4px; font-size: 11.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.sheet .actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.sheet .actions .btn { width: 100%; }
.sheet .inp + .check-line, .sheet .sub .check-line { margin-top: 12px; }
.sheet .inp { margin-bottom: 4px; }
.sheet .kv:first-of-type { border-top: 0; }
.sheet .preview { min-height: 0; }
.p-head { display: flex; align-items: center; gap: 8px; }
.p-head .chip { margin-left: auto; }
.p-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.p-actions .btn { width: 100%; }
.p-actions .wide { grid-column: 1 / -1; }
.check-line { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--text); cursor: pointer; }
.check-line input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); }
.info-list { margin: 0; padding: 0; list-style: none; }
.info-list li { padding: 7px 0; border-top: 1px solid var(--border); font-size: 14px; color: var(--text-2); }
.info-list li:first-child { border-top: 0; }
.info-list b { color: var(--text); }

/* ----------------------------------------------------------------- message qui passe */
#toast {
  /* en haut, par-dessus l'en-tête : ne cache jamais un bouton, une liste ou une feuille du bas */
  position: fixed; left: 50%; top: calc(var(--vv-top, 0px) + var(--safe-t) + 8px); z-index: 60;
  display: flex; align-items: center; gap: 10px; width: max-content; max-width: min(460px, calc(100% - 24px));
  padding: 11px 14px; border-radius: 12px; border: 1px solid var(--border-2, rgba(255, 255, 255, .14));
  background: #1d2028; color: var(--text); font-size: 14px; font-weight: 600; line-height: 1.35;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .6); transform: translate(-50%, -10px); opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s;
}
#toast::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { border-color: rgba(240, 88, 94, .5); background: #2a1719; }
#toast.err::before { background: var(--red); }

@media (min-width: 700px) {
  .kpis { gap: 10px; }
  .tile { min-height: 70px; padding: 12px; }
  .tile .v { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
