:root {
  --bg: #f4f6f9; --panel: #fff; --ink: #1b2330; --muted: #6b7686; --line: #e2e6ec;
  --accent: #1f6feb; --accent-ink: #fff; --ok: #1a7f37; --warn: #b26b00; --err: #cf222e;
  --nav: #111827; --nav-ink: #cbd5e1; --radius: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif; font-size: 14px; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 17px; margin: 28px 0 10px; } h3 { margin: 0 0 8px; font-size: 15px; } h4 { margin: 16px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .right { text-align: right; } .nowrap { white-space: nowrap; } .center { align-items: center; text-align: center; }
.grow { flex: 1; }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: inherit; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
textarea { width: 100%; resize: vertical; }
button, .btn { font: inherit; padding: 7px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
button:hover, .btn:hover { border-color: #c4ccd6; background: #f8fafc; }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, var(--line)); }
button.danger:hover { background: #fff0f0; }
button.sm { padding: 4px 9px; font-size: 13px; }
button.icon { padding: 5px 8px; }
button.link { border: none; background: none; color: var(--muted); text-decoration: underline; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label, .form-grid label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: 13px; }
label.check { flex-direction: row !important; align-items: center; gap: 8px; font-weight: 400; }
.row { display: flex; gap: 6px; align-items: center; } .row.wrap { flex-wrap: wrap; } .row input { flex: 1; }
.inline { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.narrow { max-width: 380px; }
.err { color: var(--err); font-size: 13px; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; background: #eef2f7; color: #475467; font-size: 11px; margin: 2px 4px 0 0; }
.badge:not(:empty) { background: var(--err); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11px; margin-left: auto; }
code { background: #eef2f7; padding: 2px 5px; border-radius: 4px; }

/* Écrans d'authentification */
body.auth { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(160deg, #0f172a, #1e3a8a); }
.auth-card { background: var(--panel); width: min(420px, 92vw); border-radius: 14px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.auth-card.wide { width: min(560px, 94vw); }
/* Accroche éditeur sur la page de connexion */
.auth-wrap { display: flex; align-items: center; gap: 48px; max-width: 920px; width: 94vw; }
.auth-wrap .auth-card { flex: 0 0 auto; }
.auth-hero { color: #e5edff; flex: 1 1 auto; }
.auth-logo { width: 68px; height: 68px; border-radius: 16px; object-fit: contain; background: #fff; padding: 6px; }
.auth-hero .logo { width: 68px; height: 68px; font-size: 34px; border-radius: 16px; }
.auth-brandname { font-size: 30px; font-weight: 800; margin: 16px 0 2px; letter-spacing: -.5px; }
.auth-brandname span { color: #93c5fd; font-weight: 600; }
.auth-tagline { font-size: 18px; color: #c7d2fe; margin-bottom: 18px; }
.auth-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.auth-points li { font-size: 14px; color: #dbeafe; }
@media (max-width: 760px) { .auth-wrap { flex-direction: column; gap: 22px; } .auth-hero { text-align: center; } .auth-points { display: none; } }
/* Champ mot de passe avec œil */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 40px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 16px; padding: 4px 6px; line-height: 1; }
.link { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px; padding: 4px; text-decoration: underline; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; margin-bottom: 18px; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 16px; }
.qr { display: grid; place-items: center; } .qr svg { max-width: 230px; height: auto; border-radius: 6px; }
.secret { display: block; margin-top: 6px; word-break: break-all; font-size: 13px; }
input.code { font-size: 26px; letter-spacing: .3em; text-align: center; font-family: ui-monospace, monospace; }
input.code-sm { width: 150px; letter-spacing: .1em; font-family: ui-monospace, monospace; }
.bigcode { font-size: 38px; letter-spacing: .15em; font-family: ui-monospace, monospace; text-align: center; font-weight: 700; padding: 10px; background: #eef4ff; border-radius: 10px; }
.consent { background: #f6f8fb; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; font-size: 13px; }
.consent ul { margin: 6px 0; padding-left: 18px; }
.spinner { width: 34px; height: 34px; border: 3px solid #dbe3ee; border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Mise en page principale */
body.main { height: 100vh; overflow: hidden; }
body.main #app { display: grid; grid-template-columns: 220px 1fr; height: 100vh; overflow: hidden; }
#nav { background: var(--nav); color: var(--nav-ink); display: flex; flex-direction: column; padding: 14px 10px; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; overscroll-behavior: contain; }
#nav::-webkit-scrollbar { width: 8px; } #nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 8px; }
#nav .brand { color: #fff; padding: 4px 8px 14px; margin: 0; font-size: 14px; }
#nav a { display: flex; align-items: center; gap: 10px; color: var(--nav-ink); text-decoration: none; padding: 8px 10px; border-radius: 6px; }
#nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
#nav a.active { background: rgba(31,111,235,.25); color: #fff; }
#nav .ic { width: 20px; text-align: center; }
.conn { font-size: 12px; color: #f87171; padding: 8px 10px; } .conn.on { color: #4ade80; }
#main { padding: 24px 30px; max-width: 1400px; overflow-y: auto; min-height: 0; }
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search { width: 100%; max-width: 480px; margin-bottom: 14px; }
.empty { padding: 40px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }
table.grid { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.grid th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); background: #f9fafb; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.grid td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid tr:last-child td { border-bottom: none; }
table.grid td .muted { font-size: 12px; }
table.grid td button { margin-left: 4px; }
table.compact td { padding: 5px 8px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; margin-top: 4px; }
.dot.on { background: #22c55e; box-shadow: 0 0 0 3px #dcfce7; } .dot.busy { background: #f59e0b; box-shadow: 0 0 0 3px #fef3c7; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card .actions { display: flex; gap: 6px; margin-top: 12px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.cols .card p { color: #3b4655; }
.locked { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px; background: var(--panel); border-radius: var(--radius); border: 1px solid var(--line); }
.locked .big { font-size: 48px; }
.copyrow { display: flex; gap: 6px; align-items: stretch; } .copyrow input, .copyrow textarea { flex: 1; font-family: ui-monospace, monospace; font-size: 12px; }
table.kv { width: 100%; border-collapse: collapse; font-size: 12px; } table.kv th { text-align: left; color: var(--muted); font-weight: 500; padding: 3px 8px 3px 0; width: 35%; vertical-align: top; } table.kv td { padding: 3px 0; word-break: break-word; white-space: pre-wrap; }

/* Modales et notifications */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--panel); border-radius: 12px; width: min(520px, 100%); max-height: 90vh; overflow: auto; padding: 18px 20px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h3 { margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .actions { display: flex; gap: 8px; }
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: 380px; }
.toast { background: #1f2937; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); border-left: 4px solid var(--accent); transition: opacity .4s, transform .4s; }
.toast.ok { border-color: #22c55e; } .toast.warn { border-color: #f59e0b; } .toast.err { border-color: #ef4444; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* Session */
#session { position: fixed; inset: 0; background: #0b1220; z-index: 40; display: flex; flex-direction: column; }
#toolbarWrap { background: #111827; color: #e5e7eb; border-bottom: 1px solid #1f2937; }
#toolbar { display: flex; gap: 6px; align-items: center; padding: 6px 10px; flex-wrap: wrap; }
#toolbar .title { margin-right: 6px; }
#toolbar button, #toolbar select { background: #1f2937; color: #e5e7eb; border-color: #374151; padding: 5px 9px; font-size: 13px; }
#toolbar button:hover { background: #273449; }
#toolbar button.on { background: #14532d; border-color: #166534; }
#toolbar button.danger { color: #fca5a5; }
#toolbar .tag { background: #1e3a8a; color: #bfdbfe; }
#status { display: none; background: #78350f; color: #fde68a; padding: 4px 12px; font-size: 13px; } #status.show { display: block; }
#sessBody { flex: 1; display: grid; grid-template-columns: 1fr 360px; min-height: 0; }
body.side-hidden #sessBody { grid-template-columns: 1fr 0; } body.side-hidden #side { display: none; }
#stage { position: relative; display: grid; place-items: center; overflow: hidden; background: #0b1220; }
#screen { max-width: 100%; max-height: 100%; object-fit: contain; outline: none; cursor: default; image-rendering: auto; background: #000; }
canvas#screen:focus { box-shadow: 0 0 0 2px #2563eb; }
#stageMsg { position: absolute; color: #94a3b8; font-size: 15px; }
#dropHint { display: none; position: absolute; inset: 12px; border: 3px dashed #60a5fa; border-radius: 12px; background: rgba(37,99,235,.15); color: #dbeafe; font-size: 20px; place-items: center; pointer-events: none; }
#stage.dragging #dropHint { display: grid; }
#side { background: var(--panel); display: flex; flex-direction: column; min-height: 0; border-left: 1px solid #1f2937; }
#side .tabs { display: flex; border-bottom: 1px solid var(--line); }
#side .tabs button { flex: 1; border: none; border-radius: 0; padding: 10px 4px; background: #f9fafb; border-bottom: 2px solid transparent; justify-content: center; }
#side .tabs button.active { background: #fff; border-bottom-color: var(--accent); font-weight: 600; }
#side .pane { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; min-height: 0; }
.chatlog { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.msg { background: #f1f5f9; padding: 7px 10px; border-radius: 10px; max-width: 90%; align-self: flex-start; }
.msg.tech { background: #dbeafe; align-self: flex-end; } .msg.system { background: none; color: var(--muted); font-size: 12px; align-self: center; }
.msg div { white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
#chatForm, .chat form { display: flex; gap: 6px; margin-top: 8px; } #chatForm input, .chat form input { flex: 1; }
.visio video { width: 100%; background: #0f172a; border-radius: 8px; display: none; margin-bottom: 8px; } .visio video.on { display: block; }
.dropzone { border: 2px dashed #b6c2d2; border-radius: 10px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; background: #fafbfd; }
.dropzone.dragging, #fmList.dragging { border-color: var(--accent); background: #eef4ff; }
.xfer { display: flex; flex-direction: column; gap: 3px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.xfer .xname { word-break: break-all; } .xfer small { color: var(--muted); } .xfer.err small { color: var(--err); }
.progress { height: 5px; background: #e5e7eb; border-radius: 3px; overflow: hidden; } .progress .bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; } .xfer.ok .bar { background: #22c55e; }
.fm-path { display: flex; gap: 4px; margin-bottom: 6px; } .fm-path input { flex: 1; font-family: ui-monospace, monospace; font-size: 12px; }
.fm-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
#fmList { border: 2px solid transparent; border-radius: 8px; max-height: 45vh; overflow: auto; }
.fm-table tr { cursor: default; user-select: none; } .fm-table tr:hover td { background: #f8fafc; } .fm-table tr.sel td { background: #dbeafe; }
.notes { white-space: pre-wrap; background: #fffbea; padding: 8px; border-radius: 6px; font-size: 13px; }
details.inv { margin-top: 14px; } details.inv summary { cursor: pointer; font-weight: 600; }

/* Page aidé */
body.guest-active { background: var(--bg); display: block; }
.guest header { display: flex; align-items: center; gap: 10px; padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; }
.live { color: var(--ok); font-size: 13px; }
.guest-body { display: grid; grid-template-columns: 1fr 380px; gap: 16px; padding: 16px; max-width: 1200px; margin: 0 auto; }
.guest-body section { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.guest-body .chat { height: calc(100vh - 100px); position: sticky; top: 70px; }
.videos { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; } .videos video { width: 100%; background: #0f172a; border-radius: 8px; display: none; } .videos video.on { display: block; }

@media (max-width: 900px) {
  body.main { height: auto; overflow: visible; }
  body.main #app { grid-template-columns: 1fr; height: auto; overflow: visible; } #main { overflow: visible; }
  #nav { position: static; height: auto; overflow: visible; flex-direction: row; flex-wrap: wrap; } #nav .grow { display: none; }
  #sessBody { grid-template-columns: 1fr; grid-template-rows: 1fr 45vh; } .guest-body { grid-template-columns: 1fr; } .guest-body .chat { height: 60vh; position: static; }
  .form-grid { grid-template-columns: 1fr; }
}

/* Accès par ID */
.devid { font-family: ui-monospace, monospace; color: #334155; }
.tag.pw-rotating { background: #e0f2fe; } .tag.pw-fixed { background: #fef3c7; } .tag.pw-none { background: #fee2e2; }
fieldset.access { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 10px; }
fieldset.access legend { font-weight: 600; padding: 0 6px; }
.idline { display: flex; align-items: center; gap: 12px; }
.bigid { font-family: ui-monospace, monospace; font-size: 22px; font-weight: 700; letter-spacing: .06em; color: var(--accent); }
.check { font-weight: 400; display: inline-flex; align-items: center; gap: 6px; }

/* Groupes de postes */
.dev-layout { display: grid; grid-template-columns: 240px 1fr; gap: 18px; align-items: start; }
#groupPane { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; position: sticky; top: 12px; max-height: calc(100vh - 40px); overflow: auto; }
.gitem { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; border: 2px solid transparent; }
.gitem:hover { background: #f1f5f9; } .gitem.active { background: #e8f0fe; font-weight: 600; } .gitem.drop { border-color: var(--accent); background: #eef4ff; }
.gitem .gname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gitem .gcount { font-size: 12px; color: var(--muted); background: #f1f5f9; border-radius: 10px; padding: 0 7px; }
.gitem .gedit { padding: 0 5px; border: none; background: none; opacity: 0; } .gitem:hover .gedit { opacity: 1; }
.gicon { width: 14px; text-align: center; font-size: 12px; }
.gdot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.ghead { display: flex; justify-content: space-between; align-items: center; margin: 12px 8px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.ghead button { padding: 0 7px; font-size: 15px; }
.gempty { padding: 4px 8px; }
.gchip { display: inline-block; font-size: 11px; border: 1px solid; border-radius: 10px; padding: 0 7px; margin: 3px 4px 0 0; background: #fff; }
.tag.unatt { background: #ede9fe; color: #5b21b6; margin-left: 6px; }
.bulkbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: #eef4ff; border: 1px solid #c7d7fe; border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
table.grid tr.sel td { background: #f0f6ff; }
table.grid tr[draggable] { cursor: grab; }
.swatches { display: flex; gap: 8px; margin-top: 4px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.swatch input { appearance: none; width: 10px; height: 10px; border-radius: 50%; margin: 0; } .swatch input:checked { background: #fff; }
.unatt-box { background: #f5f3ff; border: 1px solid #ddd6fe; border-radius: 8px; padding: 10px; align-items: flex-start !important; }
.groups-box { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.groups-box legend { font-weight: 600; padding: 0 6px; }
.gpick { gap: 6px; }
@media (max-width: 900px) { .dev-layout { grid-template-columns: 1fr; } #groupPane { position: static; } }

/* Multi-locataire */
.rolechip { margin: 0 8px 10px; padding: 4px 10px; background: rgba(31,111,235,.18); border-radius: 6px; font-size: 12px; color: #cfe0ff; display: flex; flex-direction: column; }
.rolechip small { color: #93a7c4; font-size: 11px; }

/* Client universel mis en avant */
.card.highlight { border: 2px solid var(--accent); background: linear-gradient(180deg, #f5f9ff, #fff); margin-bottom: 14px; }
.card.highlight h3 { color: var(--accent); }

/* ======================= Couche commerciale (supervision, sociétés, offres) ======================= */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi-v { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.kpi-l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.hot { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); background: color-mix(in srgb, var(--ok) 7%, var(--panel)); }
.kpi.hot .kpi-v { color: var(--ok); }
.kpi.eur .kpi-v { color: var(--accent); }
.kpi.clickable { transition: border-color .12s, background .12s, transform .06s; }
.kpi.clickable:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.kpi.clickable:active { transform: translateY(1px); }
.kpi.kpi-active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
tr.clickable:hover > td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.chart-wrap { overflow-x: auto; padding: 8px 0 4px; }

.card-list { display: flex; flex-direction: column; gap: 10px; }
.soc-card { display: flex; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.soc-card.muted { opacity: .6; }
.soc-logo { flex: 0 0 56px; width: 56px; height: 56px; border-radius: 10px; background: #eef2f7; display: grid; place-items: center; overflow: hidden; font-weight: 700; color: var(--accent); }
.soc-logo img { width: 100%; height: 100%; object-fit: contain; }
.soc-body { flex: 1; min-width: 0; }
.soc-name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.soc-stats { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; color: #475467; }
.soc-stats .err { color: var(--err); font-weight: 600; }
.soc-actions { display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 640px) { .soc-card { flex-wrap: wrap; } .soc-actions { flex-direction: row; } }

.quota { margin: 8px 0; }
.quota-l { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.quota-l b { color: var(--ink); }
.quota-bar { height: 8px; background: #eef2f7; border-radius: 6px; overflow: hidden; }
.quota-fill { height: 100%; background: var(--accent); border-radius: 6px; transition: width .3s; }
.quota-fill.over { background: var(--err); }
tr.row-warn { background: color-mix(in srgb, var(--err) 6%, transparent); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tab { border: none; background: none; border-radius: 0; border-bottom: 2px solid transparent; padding: 8px 12px; color: var(--muted); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tabbody { min-height: 60px; }

.opt-box { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; max-height: 240px; overflow: auto; }
.opt-row { display: flex; align-items: center; gap: 10px; padding: 4px 2px; font-weight: 400; }
.opt-name { flex: 1; }
.opt-row .qty, input.qty { width: 64px; min-width: 64px; flex: 0 0 auto; }
.line-row { display: grid; grid-template-columns: 1fr 70px 90px auto; gap: 8px; margin-bottom: 6px; }

.sim-wrap { background: #f6f8fb; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.sim-price { font-size: 18px; font-weight: 700; color: var(--accent); }
.sim-q { font-size: 12px; color: var(--muted); margin-top: 2px; }

.logo-row { display: flex; align-items: center; gap: 12px; }
.logo-prev { width: 72px; height: 72px; border-radius: 8px; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; background: #fafbfc; }
.logo-prev img { max-width: 100%; max-height: 100%; }
textarea.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 12.5px; }

/* ---- Éditions, clés de licence, remises ---- */
.ed-essai { background:#e0e7ff; color:#3730a3; }
.ed-particulier { background:#dcfce7; color:#166534; }
.ed-essentiel { background:#e2e8f0; color:#334155; }
.ed-pro { background:#1f6feb; color:#fff; }
.ed-business { background:#111827; color:#fff; }
.licensekey { display:block; font-family:ui-monospace,Menlo,Consolas,monospace; font-size:13px; line-height:1.7; letter-spacing:.5px; word-break:break-all; }
.keybox { background:#0f172a; color:#d1fae5; border-radius:8px; padding:12px 14px; max-height:180px; overflow:auto; }
.sim .disc { display:inline-block; background:#fef3c7; color:#92400e; border-radius:6px; padding:1px 7px; font-size:11px; }
.keyverdict { margin-top:10px; padding:10px 12px; border-radius:8px; }
.keyverdict.ok { background:#dcfce7; color:#166534; }
.keyverdict.bad { background:#fee2e2; color:#991b1b; }
table.grid.compact td, table.grid.compact th { padding:5px 8px; font-size:12px; }

/* ---- Page Licence (bandeau d'état) ---- */
.lic-banner { display:flex; align-items:center; gap:16px; border-radius:12px; padding:16px 20px; border:1px solid var(--line); background:var(--panel); }
.lic-banner .lic-ic { width:46px; height:46px; border-radius:12px; display:grid; place-items:center; font-size:22px; flex:0 0 auto; }
.lic-title { font-size:17px; font-weight:600; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.lic-sub { color:var(--muted); font-size:13px; margin-top:2px; }
.lic-banner.ok { border-color:color-mix(in srgb,var(--ok) 40%,var(--line)); background:color-mix(in srgb,var(--ok) 6%,var(--panel)); }
.lic-banner.ok .lic-ic { background:color-mix(in srgb,var(--ok) 15%,#fff); color:var(--ok); }
.lic-banner.warn { border-color:color-mix(in srgb,var(--warn) 45%,var(--line)); background:color-mix(in srgb,var(--warn) 8%,var(--panel)); }
.lic-banner.warn .lic-ic { background:color-mix(in srgb,var(--warn) 18%,#fff); color:var(--warn); }
.lic-banner.danger { border-color:color-mix(in srgb,var(--err) 45%,var(--line)); background:color-mix(in srgb,var(--err) 8%,var(--panel)); }
.lic-banner.danger .lic-ic { background:color-mix(in srgb,var(--err) 15%,#fff); color:var(--err); }
label .hint { font-weight:400; color:var(--muted); font-size:11px; }
button.ghost { background:#fff; }

/* ---- Planches commerciales ---- */
.planche-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:14px; }
.planche-card { background:var(--panel); border:1px solid var(--line); border-radius:12px; overflow:hidden; }
.planche-card.muted { opacity:.55; }
.planche-hero { height:120px; display:flex; align-items:flex-end; padding:12px; }
.planche-aud { background:rgba(255,255,255,.9); color:#1e293b; font-size:11px; font-weight:600; border-radius:6px; padding:2px 8px; text-transform:uppercase; letter-spacing:.05em; }
.planche-b { padding:12px 14px; }
.planche-t { font-weight:600; font-size:15px; }
.planche-preview { max-height:70vh; overflow:auto; }

/* ---- Conformité ---- */
.conf-chip { display:inline-block; padding:2px 9px; border-radius:20px; font-size:12px; font-weight:600; }
.conf-ok { background:#dcfce7; color:#166534; }
.conf-near { background:#fef3c7; color:#92400e; }
.conf-over { background:#fee2e2; color:#991b1b; }
.conf-none { background:#eef2f7; color:#64748b; }
details.archive summary { cursor:pointer; color:var(--muted); font-size:13px; padding:6px 0; }
details.archive[open] summary { color:var(--ink); font-weight:600; }

/* ---- Versioning, sections de nav, séparation éditeur/clients ---- */
.nav-group { font-size:10px; text-transform:uppercase; letter-spacing:.08em; color:#64748b; margin:12px 10px 3px; font-weight:700; }
#nav a + .nav-group { margin-top:14px; }
.nav-ver { color:#475569; font-size:11px; text-align:center; padding:6px 0 2px; }
.seg { display:inline-flex; gap:4px; }
.lic-editor { border:1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); background:color-mix(in srgb, var(--accent) 5%, var(--panel)); }
label.inline { flex-direction:row; align-items:center; gap:6px; font-size:12px; color:var(--muted); }
label.inline input { width:70px; }

/* ---- Temps & facturation ---- */
a.btn-link { display:inline-block; padding:7px 13px; border:1px solid var(--line); border-radius:8px; background:#fff; color:var(--ink); text-decoration:none; font-size:13px; }
a.btn-link:hover { border-color:var(--accent); color:var(--accent); }

/* ---- Chrono de session (forfait / facturable) ---- */
#sessTimer { font-variant-numeric: tabular-nums; margin-left: 4px; }
#sessTimer .bill-ok { color: #4ade80; }
#sessTimer .bill-warn { color: #fbbf24; }

/* Messagerie */
.msg-layout { display: grid; grid-template-columns: 260px 1fr; gap: 14px; align-items: start; }
.msg-threads { border: 1px solid var(--line, #e2e8f0); border-radius: 10px; overflow: hidden; max-height: 60vh; overflow-y: auto; background: var(--card, #fff); }
.msg-thread { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--line, #eef2f7); }
.msg-thread:hover { background: rgba(31,111,235,.06); }
.msg-thread.active { background: rgba(31,111,235,.12); }
.msg-thread .mt-top { display: flex; justify-content: space-between; align-items: center; }
.badge-num { background: #ef4444; color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; }
.msg-main { border: 1px solid var(--line, #e2e8f0); border-radius: 10px; display: flex; flex-direction: column; min-height: 60vh; background: var(--card, #fff); }
.msg-head { padding: 10px 14px; border-bottom: 1px solid var(--line, #eef2f7); }
.msg-stream { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; max-height: 52vh; }
.bubble { max-width: 72%; padding: 8px 12px; border-radius: 12px; font-size: 14px; }
.bubble.me { align-self: flex-end; background: #1f6feb; color: #fff; border-bottom-right-radius: 3px; }
.bubble.them { align-self: flex-start; background: #f1f5f9; color: #0f172a; border-bottom-left-radius: 3px; }
.bubble .b-meta { font-size: 11px; opacity: .8; margin-bottom: 2px; }
.bubble.me .b-meta { color: #dbeafe; }
.bubble .b-body { white-space: pre-wrap; }
.msg-send { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line, #eef2f7); }
.msg-send input { flex: 1; }
/* Marque blanche */
.brand-grid { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
@media (max-width: 860px) { .brand-grid, .msg-layout { grid-template-columns: 1fr; } }

/* RMM */
.gauge { position: relative; background: #e9eef5; border-radius: 6px; height: 16px; width: 92px; overflow: hidden; }
.gauge-bar { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; }
.gauge-txt { position: absolute; inset: 0; font-size: 11px; line-height: 16px; text-align: center; color: #1f2937; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.on { background: #22c55e; } .dot.off { background: #cbd5e1; }
textarea.mono, pre.scriptout { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
pre.scriptout { background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 8px; max-height: 50vh; overflow: auto; white-space: pre-wrap; }

/* Lisibilité des statuts de licence (vert = valide, rouge = périmée) */
.lic-pill { display: inline-block; font-weight: 700; font-size: 12px; padding: 2px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.lic-pill.ok   { color: #15803d; background: #dcfce7; border-color: #bbf7d0; }
.lic-pill.near { color: #b45309; background: #fef3c7; border-color: #fde68a; }
.lic-pill.susp { color: #b45309; background: #fef3c7; border-color: #fde68a; }
.lic-pill.exp  { color: #b91c1c; background: #fee2e2; border-color: #fecaca; }
td.lic-ok  { color: #15803d; font-weight: 600; }
td.lic-exp { color: #b91c1c; font-weight: 700; }

/* Déploiement logiciel : sélection de postes */
.pick-actions { display: flex; gap: 8px; margin-bottom: 6px; }
.pick-list { max-height: 44vh; overflow-y: auto; border: 1px solid var(--line, #e2e8f0); border-radius: 8px; padding: 6px 10px; }
.pick-row { display: flex; align-items: center; gap: 6px; padding: 5px 2px; border-bottom: 1px solid var(--line, #eef2f7); cursor: pointer; }
.pick-row:last-child { border-bottom: none; }

/* Proposition de 2FA (choix du client) */
.offer-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.offer-btns button { width: 100%; padding: 10px; }

/* Fonctions incluses (par édition/contrat) */
.feat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.feat-item { background: #f6f8fb; border: 1px solid var(--line, #e2e8f0); border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.feat-ok { color: #15803d; font-weight: 700; }
.feat-item.soon { opacity: .72; }
.feat-soon { font-size: 10px; background: #fef3c7; color: #b45309; border-radius: 8px; padding: 1px 6px; margin-left: 6px; }

/* Console à distance (session) */
.console{display:flex;flex-direction:column;gap:8px;height:100%}
.console-out{flex:1;min-height:160px;overflow:auto;background:#0b1020;color:#d7e0f5;border-radius:8px;padding:10px;font:12px/1.5 Consolas,ui-monospace,monospace;white-space:pre-wrap;word-break:break-word;margin:0}
.console-cmd{color:#7aa2ff;margin-top:6px}
.console-res{color:#c9d4ea}
.console-res.err{color:#ff9a9a}
#consoleIn{flex:1;font-family:Consolas,ui-monospace,monospace}

/* Retour visible sur ordinateur, tablette et téléphone. */
.page-back{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:46px;padding:11px 18px!important;border:2px solid #79b9ee!important;border-radius:10px!important;background:#163d62!important;color:#fff!important;font-size:15px!important;font-weight:750!important;white-space:nowrap;cursor:pointer}
.page-back:focus-visible{outline:3px solid #ffd166;outline-offset:3px}.page-head .page-back{flex-shrink:0}.modal-head .modal-return{margin-left:auto}
@media(max-width:700px){.page-head{flex-wrap:wrap;gap:10px}.page-head>.page-back{order:-1}.page-head>h1{flex-basis:100%;font-size:1.35rem}.modal-head{flex-wrap:wrap}.modal-head .modal-return{margin-left:0}}
