/* Couleurs de marque : --brand et --accent sont injectées depuis .env (BRAND_PRIMARY / BRAND_ACCENT). */
:root {
  --bg: #f5f6fa; --surface: #fff; --text: #0f172a; --muted: #64748b; --line: #e2e8f0;
  --ok: #16a34a; --warn: #d97706; --err: #dc2626; --radius: 14px;
  --brand-soft: color-mix(in srgb, var(--brand) 10%, white);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: .2rem 0 .8rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 1rem; }
h3 { font-size: 1rem; margin: 1.4rem 0 .7rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .02em; }
.break { word-break: break-all; }
.container { max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; }

/* Barre du haut */
.topbar { display: flex; align-items: center; gap: 16px; padding: 0 20px; height: 60px; background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 10; }
.topbar a { color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.logo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #fff; font-weight: 800; }
.logo.big { width: 52px; height: 52px; font-size: 1.5rem; border-radius: 14px; }
.topbar nav { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.topbar nav a, .topbar summary { padding: 7px 12px; border-radius: 8px; opacity: .88; white-space: nowrap; cursor: pointer; }
.topbar nav a:hover, .topbar nav a.active, .topbar summary:hover, .topbar summary.active, .topbar details[open] > summary {
  background: rgba(255,255,255,.16); opacity: 1; text-decoration: none; }
/* Menus déroulants (Gestion, compte) */
.topbar details.dd { position: relative; }
.topbar summary { list-style: none; display: flex; align-items: center; gap: 6px; }
.topbar summary::-webkit-details-marker { display: none; }
.topbar summary::after { content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px); opacity: .8; }
.dd-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 190px; background: #fff; border-radius: 10px; padding: 6px;
  box-shadow: 0 10px 30px rgba(15,23,42,.18); display: flex; flex-direction: column; z-index: 20; }
.dd-menu.dd-right { left: auto; right: 0; }
.topbar .dd-menu a { color: var(--text, #0f172a); opacity: 1; padding: 8px 12px; border-radius: 6px; }
.topbar .dd-menu a:hover, .topbar .dd-menu a.active { background: var(--brand-soft); color: var(--brand); }
.user-dd { margin-left: auto; font-size: .88rem; }
.user-dd summary { max-width: 260px; }
.user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.menu-btn { display: none; background: none; border: 0; color: #fff; font-size: 1.5rem; line-height: 1; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.menu-btn:hover, .menu-btn[aria-expanded="true"] { background: rgba(255,255,255,.16); }
.demo-banner { background: #fef3c7; color: #92400e; text-align: center; font-size: .85rem; padding: 6px 16px; }

/* Cartes & boutons */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--err); }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: progress; }
.flash { background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 30%, white); padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; }
.flash.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

/* Formulaires */
label { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; font-weight: 600; color: #334155; }
input, select { font: inherit; font-weight: 400; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; color: var(--text); width: 100%; min-height: 44px; }
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, white); border-color: var(--brand); }
input.invalid, select.invalid { border-color: var(--err); background: #fffafa; }
.opt { font-weight: 400; color: var(--muted); font-size: .78rem; }
.hint { font-weight: 400; color: var(--muted); }
.field-error { color: var(--err); font-size: .8rem; font-weight: 500; min-height: 0; }
.field-error:empty { display: none; }
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.col-2 { grid-column: span 2; } .col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; } .col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; } .col-8 { grid-column: span 8; } .col-9 { grid-column: span 9; } .col-12 { grid-column: span 12; }
.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; margin: 10px 0; line-height: 1.4; }
.check input { width: 20px; height: 20px; min-height: 0; margin-top: 1px; flex: none; accent-color: var(--brand); }

/* Étapes */
.stepper { display: flex; list-style: none; padding: 0; margin: 0 0 18px; gap: 6px; counter-reset: s; overflow-x: auto; }
.stepper li { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; counter-increment: s; font-size: .82rem; font-weight: 600; color: var(--muted); padding-top: 10px; border-top: 4px solid var(--line); }
.stepper li::before { content: counter(s) ". "; }
.stepper li.done { color: var(--text); border-color: color-mix(in srgb, var(--brand) 45%, white); }
.stepper li.current { color: var(--brand); border-color: var(--brand); }
.wizard-nav { display: flex; justify-content: space-between; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.wizard-nav .btn[hidden] { display: none; }
.wizard-nav { gap: 10px; }
.wizard-nav #skip { margin-left: auto; }
.pro-note { background: var(--brand-soft); border-radius: 10px; padding: 10px 14px; }
.pro-opt[hidden], .pro-note[hidden], .check[hidden] { display: none; }
#next { margin-left: auto; }
.form-error { margin-top: 16px; background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; border-radius: 10px; padding: 10px 14px; }

/* Pièces */
.docs { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-bottom: 8px; }
.doc { display: flex; gap: 14px; align-items: center; border: 2px dashed #cbd5e1; border-radius: 12px; padding: 12px; }
.doc.ok { border-style: solid; border-color: var(--ok); background: #f0fdf4; }
.doc-preview { width: 96px; height: 68px; border-radius: 8px; background: #f1f5f9; display: grid; place-items: center; overflow: hidden; flex: none; text-align: center; }
.doc-preview img { width: 100%; height: 100%; object-fit: cover; }
.doc-preview .small { font-size: .65rem; word-break: break-all; padding: 0 4px; }
.doc-icon { font-size: 1.8rem; }
.doc-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.doc-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.doc-actions label.btn { flex-direction: row; font-weight: 600; color: var(--text); }

/* Offres */
.offres { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.offre { position: relative; display: flex; border: 2px solid var(--line); border-radius: 16px; padding: 22px 20px; cursor: pointer; font-weight: 400; color: var(--text); gap: 6px; transition: border-color .15s, box-shadow .15s; }
.offre:hover { border-color: color-mix(in srgb, var(--brand) 50%, white); }
.offre:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.offre input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.offre.populaire { border-color: color-mix(in srgb, var(--accent) 60%, white); }
.tag { position: absolute; top: -11px; left: 18px; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
.offre-nom { font-weight: 700; font-size: 1.1rem; }
.offre-prix { font-size: 2rem; font-weight: 800; color: var(--brand); letter-spacing: -.02em; }
.prix-pro-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.prix-pro-row input { max-width: 140px; font-size: 1.1rem; font-weight: 700; }
.offre-prix small { font-size: .9rem; font-weight: 600; color: var(--muted); }
.offre ul { margin: 8px 0 0; padding-left: 18px; font-size: .88rem; color: #334155; }
.offre li { margin: 3px 0; }

.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.choice.disabled { opacity: .45; cursor: not-allowed; }
.choice { flex-direction: row; align-items: center; gap: 12px; border: 2px solid var(--line); border-radius: 12px; padding: 14px 16px; cursor: pointer; font-weight: 400; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice input { width: 20px; height: 20px; min-height: 0; accent-color: var(--brand); flex: none; }
.choice span { display: flex; flex-direction: column; }
.choice small { color: var(--muted); }
#porta-fields, #sim-fields { margin: 4px 0 22px; padding: 16px; background: #f8fafc; border-radius: 12px; }
#porta-fields[hidden], #sim-fields[hidden] { display: none; }

/* Réseau, pack téléphone, accessoires */
.reseaux { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.seg { flex-direction: row; cursor: pointer; font-weight: 600; }
.seg { position: relative; }
.seg input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.seg span { padding: 8px 16px; border: 2px solid var(--line); border-radius: 99px; background: #fff; }
.seg span small { font-weight: 500; color: var(--muted); }
.seg:has(input:checked) span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.seg:has(input:focus-visible) span { outline: 2px solid var(--brand); outline-offset: 2px; }
.offre-pack { margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); font-size: .82rem; color: #334155; }
.offre-pack strong { color: var(--accent); }
.offre.autre-reseau { opacity: .55; }
.offre[hidden], #gamme-row[hidden] { display: none; }
#gamme-row { margin: 6px 0 14px; }
#gamme-row small { display: block; font-weight: 400; font-size: .72rem; color: var(--muted); }
.warn-badge { background: #fff3cd; color: #8a6100; align-self: flex-start; }
.offre.autre-reseau:hover { opacity: .85; }
.reseau-only { display: block; margin-bottom: 4px; font-weight: 700; color: var(--brand); }
.offre { display: flex; }
.price-line { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; margin: 14px 0 4px; font-size: 1rem; }
.price-line:empty { display: none; }
.price-line span:first-child { text-decoration: line-through; color: var(--muted); }
.price-line .minus { color: var(--ok); font-weight: 600; }
.price-line strong { font-size: 1.4rem; color: var(--brand); }
#tel-fields { margin: 4px 0 18px; padding: 16px; background: #f8fafc; border-radius: 12px; }
.points-badge { font-size: .8rem; background: var(--brand-soft); color: var(--brand); border-radius: 99px; padding: 2px 10px; margin-left: 6px; }
.points-badge:empty { display: none; }
.points-badge.over { background: #fee2e2; color: #991b1b; }
.acc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.acc { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px 6px 12px; }
.acc.on { border-color: var(--brand); background: var(--brand-soft); }
.acc-name { flex: 1; font-size: .9rem; }
.acc-pts { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.stepper-q { display: flex; align-items: center; gap: 4px; }
.stepper-q .btn { width: 34px; height: 34px; padding: 0; font-size: 1.1rem; }
.stepper-q span { min-width: 18px; text-align: center; font-weight: 700; }
.pay-box:not(:empty) { border: 2px solid var(--brand); border-radius: 12px; padding: 14px 18px; max-width: 460px; margin-left: auto; }
.pay-box h3 { margin: 0 0 8px; }
.pay-box dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; margin: 0 0 8px; }
.pay-box dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.pay-box .total { font-weight: 800; font-size: 1.15rem; border-top: 1px solid var(--line); padding-top: 6px; color: var(--brand); }
.recap .big { font-size: 1.15rem; color: var(--brand); }
.encaisser { display: inline-flex; flex-direction: column; gap: 2px; background: var(--brand-soft); border-radius: 12px; padding: 12px 22px; margin-top: 6px; }
.encaisser strong { font-size: 1.6rem; color: var(--brand); }

/* Contrat */
.contract-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: start; }
#contract-frame { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: 10px; background: #f1f5f9; }
.recap { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; background: #f8fafc; border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.recap div { display: flex; flex-direction: column; font-size: .88rem; }
.recap span { color: var(--muted); font-size: .78rem; }
.sign-box { position: sticky; top: 80px; border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.sign-box h3 { margin-top: 0; }
#signature { width: 100%; height: 190px; border: 2px dashed #94a3b8; border-radius: 10px; background: #fff; touch-action: none; cursor: crosshair; display: block; margin-bottom: 8px; }

/* Fin */
.done { text-align: center; padding: 20px 0; }
.done-icon { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 2rem; display: grid; place-items: center; }
.done-icon.warn { background: var(--warn); }
.done-list { list-style: none; padding: 0; max-width: 560px; margin: 18px auto; text-align: left; }
.done-list li { padding: 10px 14px; border-radius: 10px; margin-bottom: 8px; background: #f8fafc; }
.done-list li.ok::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.done-list li.ko::before { content: "! "; color: var(--warn); font-weight: 700; }
.done-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.qr { width: 180px; height: 180px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: #fff; }

/* Caméra */
dialog#camera-dialog { border: none; border-radius: 16px; padding: 16px; width: min(720px, 94vw); }
dialog::backdrop { background: rgba(15,23,42,.6); }
.camera-head, .camera-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.camera-view { position: relative; margin: 12px 0 8px; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 4/3; }
.camera-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera-frame { position: absolute; inset: 12% 8%; border: 3px solid rgba(255,255,255,.9); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); pointer-events: none; }

/* Accueil, tableaux, détail */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.search-inline { display: flex; gap: 6px; }
.search-inline input { width: 200px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f8fafc; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .75rem; font-weight: 700; background: #e2e8f0; color: #334155; vertical-align: middle; }
.s-active { background: #dcfce7; color: #166534; }
.s-envoye, .s-planifie, .s-porta_en_cours { background: #dbeafe; color: #1e40af; }
.s-erreur, .s-suspendu { background: #fee2e2; color: #991b1b; }
.s-live { background: var(--brand-soft); color: var(--brand); }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.cols > .card { margin-bottom: 20px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.chip { display: inline-block; background: #f1f5f9; border-radius: 6px; padding: 1px 7px; margin: 0 4px 4px 0; font-size: .8rem; font-family: ui-monospace, Menlo, monospace; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.doc-thumb { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; color: var(--text); }
.doc-thumb img, .doc-thumb .doc-icon { width: 100%; height: 100px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: grid; place-items: center; background: #f1f5f9; }
.esim { display: flex; gap: 16px; align-items: center; }
.timeline { list-style: none; padding: 0; margin: 0 0 12px; }
.timeline li { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.timeline time { color: var(--muted); }
.search-big { display: flex; gap: 10px; }
.search-big input { font-size: 1.2rem; }
.conso { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.conso-item { display: flex; flex-direction: column; background: #f8fafc; border-radius: 10px; padding: 12px 14px; }
.conso-item strong { font-size: 1.3rem; }

/* Connexion */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, var(--brand), color-mix(in srgb, var(--brand) 60%, black)); }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login-head { text-align: center; }
.login-head h1 { margin: 10px 0 0; }
.login-head p { margin: 0; }

/* Tablette / mobile */
@media (max-width: 860px) {
  .contract-layout, .cols { grid-template-columns: 1fr; }
  .sign-box { position: static; }
}
/* Menu repliable (tablette / téléphone) : bouton ☰ */
@media (max-width: 1000px) {
  .menu-btn { display: block; order: 3; }
  .user-dd { order: 2; }
  .topbar nav { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--brand); padding: 8px 12px 14px; gap: 2px; box-shadow: 0 12px 24px rgba(15,23,42,.25); }
  .topbar nav.open { display: flex; }
  .topbar nav a, .topbar nav summary { padding: 11px 12px; }
  .topbar nav details.dd .dd-menu { position: static; box-shadow: none; background: rgba(255,255,255,.1); margin: 2px 0 4px 12px; }
  .topbar nav .dd-menu a { color: #fff; }
  .topbar nav .dd-menu a:hover, .topbar nav .dd-menu a.active { background: rgba(255,255,255,.16); color: #fff; }
  .user-dd summary { max-width: 180px; }
}
@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  .grid > * { grid-column: 1 / -1 !important; }
  .choice-row { grid-template-columns: 1fr; }
  .card { padding: 18px 16px; }
  .topbar { gap: 8px; padding: 0 12px; }
  .brand-name { display: none; }
  .user-dd .role { display: none; }
  .user-dd summary { max-width: 140px; }
  .recap { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 110px 1fr; }
  #contract-frame { height: 380px; }
  .search-inline input { width: 100%; }
}

/* Espace gérant */
.role { display: inline-block; background: var(--accent); color: #fff; border-radius: 99px; padding: 1px 8px; font-size: .72rem; font-weight: 700; }
.stock-table td { text-align: center; }
.stock-table td:first-child, .stock-table td:nth-child(2), .stock-table th:first-child, .stock-table th:nth-child(2) { text-align: left; }
.stock-table td.dispo { color: var(--ok); font-weight: 800; }
.actions-cell { display: flex; gap: 6px; }
.actions-cell form { margin: 0; }
.cmd-validee { background: #dcfce7; color: #166534; }
.cmd-en-attente, .cmd-prise-en-charge { background: #dbeafe; color: #1e40af; }
.cmd-annulee { background: #f1f5f9; color: #64748b; }

/* Résiliation */
.btn.danger-solid { background: var(--err); border-color: var(--err); color: #fff; }
.btn.danger-solid:hover { filter: brightness(1.08); }
dialog.resil-dialog { border: none; border-radius: 16px; padding: 22px; width: min(620px, 94vw); }
dialog.resil-dialog h2 { margin-bottom: 4px; }
.s-resiliation_en_cours, .s-resiliation_planifiee { background: #ffedd5; color: #9a3412; }
.s-resilie { background: #e2e8f0; color: #475569; }

/* Options de ligne */
.opt-head { display: flex; justify-content: space-between; align-items: baseline; }
.opt-total { background: var(--brand-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.opt-total strong { color: var(--brand); }
.opt-list { list-style: none; padding: 0; margin: 0; }
.opt-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.opt-list li.on .opt-name::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.opt-list li.blocked { opacity: .6; }
.opt-name { flex: 1; min-width: 160px; }
.opt-why { display: block; color: var(--muted); font-size: .78rem; }
.opt-prix { font-size: .85rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.opt-form { display: flex; align-items: center; gap: 8px; margin: 0; }
.opt-form .check { margin: 0; font-size: .78rem; }
.opt-list form { margin: 0; }
.cols-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.tarifs td, .tarifs th { white-space: normal; }
.prix-input { width: 80px; min-height: 36px; padding: 6px 8px; text-align: right; }
.tag-prot { display: inline-block; font-size: .7rem; font-weight: 700; background: #dcfce7; color: #166534; border-radius: 99px; padding: 1px 8px; vertical-align: middle; }
.opt-risk { display: block; color: var(--warn); font-size: .78rem; }
.conf-code { font-size: 1.6rem; font-weight: 800; letter-spacing: .25em; color: var(--brand); margin: 2px 0 10px; }
.codes-sim .secret { letter-spacing: .15em; font-weight: 700; }

/* Consommation */
.conso-head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.conso-head select { width: auto; min-width: 180px; }
.conso-zones { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.conso-zone { background: #f8fafc; border-radius: 10px; padding: 12px 14px; }
.cz-top { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; margin-bottom: 6px; }
.bar { height: 8px; background: #e2e8f0; border-radius: 99px; overflow: hidden; margin-bottom: 4px; }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.conso-item.hors { background: #fff7ed; }
.warn-txt { color: var(--warn); font-weight: 600; }
.conso-jours { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding: 4px 0 18px; overflow-x: auto; }
.cj { flex: 1; min-width: 14px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.cj span { width: 100%; background: color-mix(in srgb, var(--brand) 70%, white); border-radius: 4px 4px 0 0; }
.cj small { position: absolute; bottom: -16px; font-size: .65rem; color: var(--muted); }
.conso-table tr.hors td { background: #fff7ed; }
.raccourcis { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; font-weight: 400; }
.big-total { font-size: 2rem; font-weight: 800; color: var(--brand); margin: 0; }
.big-total small { font-size: 1rem; color: var(--muted); font-weight: 600; }

/* Choix du client */
#client-search { margin: 4px 0 14px; }
.client-results { list-style: none; padding: 0; margin: 6px 0 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.client-results:empty { display: none; }
.client-results li button { width: 100%; text-align: left; background: #fff; border: 0; border-bottom: 1px solid var(--line); padding: 10px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; font: inherit; }
.client-results li button:hover { background: var(--brand-soft); }
.client-results li.muted { padding: 10px 14px; }
.client-selected { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--brand-soft); border-radius: 12px; padding: 12px 16px; margin-bottom: 10px; }
.seg-row { display: flex; gap: 8px; margin: 4px 0 12px; }
#pro-fields { margin-bottom: 12px; }
.pf-box { border: 1px dashed #cbd5e1; border-radius: 12px; padding: 12px 14px; margin: 8px 0 6px; }
.pf-head { display: flex; flex-direction: column; margin-bottom: 8px; }
#sign-devis label { margin-top: 8px; }
#sign-devis .doc { margin-bottom: 6px; }

/* --- Comptes et sécurité --- */
.cols-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.narrow { max-width: 360px; }
.center { text-align: center; }
.align-end { display: flex; align-items: flex-end; }
.s-err { background: #fee2e2; color: #991b1b; }
tr.muted td { color: var(--muted); }
.code-input { font-size: 1.6rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; max-width: 220px; }
.login-card .code-input { max-width: none; }
.totp-qr { margin: 12px 0; }
.totp-qr img { width: 200px; height: 200px; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: #fff; }
.totp-key { word-break: break-all; }
.totp-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.steps-list { padding-left: 20px; display: flex; flex-direction: column; gap: 18px; }
.mdp-provisoire { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, white); }
.big-code { font-size: 1.6rem; font-weight: 700; letter-spacing: .05em; margin: 8px 0; user-select: all; }

/* Couverture réseau à l'adresse du client */
.couv-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: -6px 0 16px; background: #fff; }
.couv-box h3 { margin: 0 0 8px; font-size: 15px; }
.couv-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.couv-table th, .couv-table td { text-align: left; padding: 6px 8px; border-top: 1px solid var(--line); }
.couv-table th { font-weight: 600; color: var(--muted); border-top: 0; }
.couv-table tr.conseil td { background: var(--brand-soft); }
.couv-table tr.conseil td:first-child { font-weight: 700; color: var(--brand); }
.couv-n { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.couv-n::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.couv-n.n3 { --c: #16a34a; } .couv-n.n2 { --c: #ca8a04; } .couv-n.n1 { --c: #ea580c; } .couv-n.n0 { --c: #dc2626; }
.couv-note { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.seg .couv-star { color: var(--brand); font-weight: 700; }
.couv-box { overflow-x: auto; }
@media (max-width: 640px) { .couv-table .couv-5g { display: none; } .couv-table { font-size: 13px; } .couv-table th, .couv-table td { padding: 6px 4px; } .couv-n { white-space: normal; align-items: flex-start; } .couv-n::before { flex: none; margin-top: 4px; } }

/* Revendeurs */
.resil-demande { border-left: 4px solid #dc2626; }
.resil-demande .actions form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.filtre-rv select { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.inline-form { margin-top: 10px; }
.rv-cache { display: none !important; }
.ok-text { color: #16a34a; font-weight: 600; } .error-text { color: #dc2626; font-weight: 600; }

/* Stock : attribution aux revendeurs */
.cartes-table td:first-child, .cartes-table th:first-child { width: 36px; }
.attr-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.attr-bar select { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; min-width: 220px; }
.esim-form { display: flex; gap: 6px; align-items: center; }
.esim-form input { width: 80px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); }
.suppr-rv { margin-top: 8px; }
.suppr-rv > summary { list-style: none; display: inline-block; cursor: pointer; }
.suppr-rv > summary::-webkit-details-marker { display: none; }
.suppr-rv-form { margin-top: 10px; padding: 12px 14px; border: 1px solid #fecaca; background: #fef2f2; border-radius: 10px; display: flex; flex-direction: column; gap: 8px; max-width: 560px; }
.suppr-rv-form ul { margin: 0; padding-left: 18px; }
.suppr-rv-form input { display: block; margin-top: 4px; width: 100%; max-width: 320px; }
.suppr-rv-form button { align-self: flex-start; }

/* Commissions des revendeurs */
.dossiers-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.dossiers-layout > .card { margin: 0; }
.com-panel { position: sticky; top: 76px; }
.com-total { font-size: 2rem; font-weight: 800; margin: 4px 0; color: var(--brand); }
.com-jauge { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 10px 0 6px; }
.com-jauge span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.com-afficher { display: none; }
body.com-masque .com-panel, body.com-masque .com-col { display: none; }
body.com-masque .com-afficher { display: inline-flex; }
body.com-masque .dossiers-layout { grid-template-columns: 1fr; }
.com-resume { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.com-chiffre { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.com-chiffre span { font-size: .8rem; color: var(--muted); }
.com-chiffre strong { font-size: 1.5rem; }
.com-chiffre small { color: var(--muted); }
.com-objectif { border-color: var(--accent); }
.com-regles { margin: 12px 0 0; padding-left: 18px; color: var(--muted); }
.row-sel td { background: var(--brand-soft); }
@media (max-width: 1000px) { .dossiers-layout { grid-template-columns: 1fr; } .com-panel { position: static; } }

/* Gérant : vue « comme le revendeur » */
.vue-rv-banner { display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 16px;
  background: #0f172a; color: #fff; font-size: .9rem; position: sticky; top: 60px; z-index: 9; }
.vue-rv-banner form { margin: 0; }
body.benef-masque .benef { display: none !important; }
.ligne-magasin td { background: #f8fafc; }

/* Annonces aux revendeurs */
.annonces { border-left: 4px solid var(--brand); }
.annonce { padding: 10px 0; border-top: 1px solid var(--line); }
.annonces .annonce:first-of-type { border-top: 0; padding-top: 0; }
.annonce header { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.annonce-texte { margin: 6px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.annonce-importante header strong { color: var(--err); }
textarea { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; resize: vertical; }

/* Clés de sécurité (YubiKey) */
.cles-liste{list-style:none;padding:0;margin:0 0 1rem}
.cles-liste li{display:flex;justify-content:space-between;align-items:flex-start;gap:1rem;flex-wrap:wrap;padding:.6rem 0;border-bottom:1px solid var(--line,#e5e7eb)}
.cle-retirer summary{list-style:none;cursor:pointer}
.cle-retirer summary::-webkit-details-marker{display:none}
.cle-retirer[open] form{margin-top:.5rem}
.cle-ajout{display:flex;gap:.75rem;align-items:flex-end;flex-wrap:wrap}
.cle-ajout label{flex:1 1 220px}

/* Mode maintenance */
.maint-banner { display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 16px;
  background: #b91c1c; color: #fff; font-size: .9rem; }
.maint-banner form { margin: 0; }
.maint-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.maint-card { max-width: 520px; width: 100%; text-align: center; }
.maint-card .maint-icone { font-size: 3rem; line-height: 1; margin-bottom: 8px; }
.maint-card .maint-msg { white-space: pre-line; text-align: left; background: #f8fafc; border-radius: 10px; padding: 12px 16px; }
.maint-actif { border-left: 4px solid #b91c1c; }
