/* Panel admin — Cartes QR */
:root {
  --bg: #F5F6F8;
  --panel: #FFFFFF;
  --panel-2: #F9FAFB;
  --text: #14161B;
  --muted: #667085;
  --line: #E6E8EC;
  --accent: #0F766E;
  --accent-soft: #E6F3F1;
  --danger: #C2410C;
  --danger-soft: #FFF1EA;
  --side: #111318;
  --side-text: #C8CCD4;
  --c1: #4F46E5;   /* scans */
  --c2: #059669;   /* enregistrements */
  --c3: #D97706;   /* clics */
  --c4: #DB2777;
  --c5: #0891B2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0C0D10;
    --panel: #15171C;
    --panel-2: #1A1D23;
    --text: #EEF0F3;
    --muted: #98A0AD;
    --line: #262A31;
    --accent: #2DB3A4;
    --accent-soft: #12302D;
    --danger: #F97316;
    --danger-soft: #2E1A10;
    --side: #08090B;
    --c1: #818CF8;
    --c2: #34D399;
    --c3: #FBBF24;
    --c4: #F472B6;
    --c5: #22D3EE;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2, h3 { letter-spacing: -.01em; }
.muted { color: var(--muted); }
svg { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Boutons & champs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--panel-2); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #06201D; } }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; color: var(--text); cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; }

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; }
.field small { color: var(--muted); font-size: 12.5px; }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=password], input[type=search], select, textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font: inherit; font-size: 14.5px;
}
textarea { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 0; border-color: var(--accent); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- Connexion ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 32px 28px; display: grid; gap: 16px; box-shadow: 0 20px 50px -30px rgba(0,0,0,.35); }
.login-card h1 { margin: 6px 0 0; font-size: 22px; }
.login-card p { margin: 0; }
.error { color: var(--danger); min-height: 1.2em; font-size: 13.5px; margin: 0; }

.brand-mark { width: 26px; height: 26px; border-radius: 8px; display: inline-block; flex: none;
  background:
    linear-gradient(var(--accent), var(--accent)) 5px 5px / 6px 6px no-repeat,
    linear-gradient(var(--accent), var(--accent)) 15px 5px / 6px 6px no-repeat,
    linear-gradient(var(--accent), var(--accent)) 5px 15px / 6px 6px no-repeat,
    linear-gradient(var(--accent), var(--accent)) 16px 16px / 4px 4px no-repeat,
    #fff; }
.brand-mark.lg { width: 44px; height: 44px; border-radius: 12px; background-size: 10px 10px, 10px 10px, 10px 10px, 7px 7px, auto;
  background-position: 9px 9px, 25px 9px, 9px 25px, 27px 27px, 0 0; border: 1px solid var(--line); }

/* ---------- Mise en page ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-text); padding: 18px 12px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 15.5px; padding: 4px 8px; }
.nav { display: grid; gap: 2px; }
.nav a, .nav-logout { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: var(--side-text); text-decoration: none; font-weight: 550; font-size: 14px; background: none; border: 0; font-family: inherit; cursor: pointer; text-align: left; }
.nav a svg, .nav-logout svg { width: 18px; height: 18px; opacity: .85; }
.nav a:hover, .nav-logout:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.nav-logout { margin-top: auto; }
.scrim { display: none; }

.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); min-height: 66px; flex-wrap: wrap; }
.topbar h1 { font-size: 19px; margin: 0; flex: 1; min-width: 0; }
.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.menu-btn { display: none; }
.view { padding: 24px 28px 60px; max-width: 1280px; }

/* ---------- Panneaux ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 0; }
.panel-h h2 { font-size: 15px; margin: 0; }
.panel-h p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.panel-b { padding: 16px 18px 18px; }
.grid { display: grid; gap: 16px; }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mt { margin-top: 16px; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; }
.kpi .lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .lbl i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }
.kpi .val { font-size: 26px; font-weight: 750; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12.5px; font-weight: 600; margin-top: 2px; color: var(--muted); }
.kpi .delta.up { color: #059669; }
.kpi .delta.down { color: var(--danger); }
@media (prefers-color-scheme: dark) { .kpi .delta.up { color: #34D399; } }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }

/* Graphiques */
.ch { position: relative; }
.ch svg { display: block; max-width: 100%; height: auto; overflow: visible; stroke: none; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-axis { fill: var(--muted); font-size: 11px; font-family: var(--font); stroke: none; }
.ch-big { fill: var(--text); font-size: 24px; font-weight: 750; font-family: var(--font); stroke: none; }
.ch-cursor { stroke: var(--muted); stroke-dasharray: 3 3; stroke-width: 1; }
.ch-tip { position: absolute; display: none; pointer-events: none; background: var(--text); color: var(--panel); padding: 8px 10px; border-radius: 9px; font-size: 12.5px; min-width: 130px; z-index: 2; box-shadow: 0 10px 24px -10px rgba(0,0,0,.4); transform: translateY(-8px); }
.ch-tip strong { display: block; margin-bottom: 4px; font-weight: 650; }
.ch-tip div { display: flex; align-items: center; gap: 6px; }
.ch-tip i { width: 8px; height: 8px; border-radius: 2px; }
.ch-tip b { margin-left: auto; padding-left: 12px; font-variant-numeric: tabular-nums; }
.ch-empty { color: var(--muted); font-size: 13.5px; text-align: center; padding: 30px 0; margin: 0; }
.ch-donut { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.ch-legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; flex: 1; min-width: 120px; }
.ch-legend li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.ch-legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.ch-legend b { margin-left: auto; font-variant-numeric: tabular-nums; }
.hb-row { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 10px; padding: 5px 0; font-size: 13.5px; }
.hb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.hb-fill { display: block; height: 100%; border-radius: 4px; }
.hb-val { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; text-align: right; min-width: 70px; }

/* Segmented */
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 11px; height: 30px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--accent-soft); color: var(--accent); }
.top-actions select { width: auto; min-width: 180px; height: 38px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.who { display: flex; align-items: center; gap: 11px; min-width: 200px; }
.who strong { display: block; font-weight: 650; }
.who span { color: var(--muted); font-size: 13px; }
.av { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: var(--accent); }
.badge { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 650; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.premium { background: color-mix(in srgb, var(--c3) 16%, transparent); color: color-mix(in srgb, var(--c3) 75%, var(--text)); border-color: transparent; }
.badge.scan { color: var(--c1); background: color-mix(in srgb, var(--c1) 12%, transparent); border-color: transparent; }
.badge.save { color: var(--c2); background: color-mix(in srgb, var(--c2) 12%, transparent); border-color: transparent; }
.badge.click { color: var(--c3); background: color-mix(in srgb, var(--c3) 14%, transparent); border-color: transparent; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.slug { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; text-decoration: none; }
.minibar { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.minibar span { display: inline-block; height: 6px; border-radius: 3px; background: var(--c1); }

.switch { position: relative; width: 38px; height: 22px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; cursor: pointer; transition: background .15s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px; border-bottom: 1px solid var(--line); }
.toolbar input { max-width: 320px; }
.toolbar select { max-width: 180px; }

.empty { text-align: center; padding: 48px 20px; }
.empty h2 { margin: 0 0 6px; font-size: 18px; }
.empty p { margin: 0 0 18px; color: var(--muted); }

/* ---------- Éditeur ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.form-sec { padding: 18px; }
.form-sec + .form-sec { border-top: 1px solid var(--line); }
.form-sec h2 { font-size: 15px; margin: 0 0 4px; }
.form-sec > p { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fields .full { grid-column: 1 / -1; }
.photo-row { display: flex; gap: 12px; align-items: center; }
.photo-row img, .photo-row .av { width: 56px; height: 56px; font-size: 18px; }
.photo-row input[type=text] { flex: 1; }
.swatches { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.swatches button { width: 28px; height: 28px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.swatches button.on { border-color: var(--text); }
.swatches input[type=color] { width: 40px; height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--panel); cursor: pointer; }
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.radio-cards label { border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; display: grid; gap: 2px; }
.radio-cards label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-cards input { position: absolute; opacity: 0; }
.radio-cards strong { font-size: 14.5px; }
.radio-cards span { font-size: 12.5px; color: var(--muted); }
.prefix { display: flex; align-items: stretch; }
.prefix span { display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--line); border-right: 0; border-radius: 10px 0 0 10px; background: var(--panel-2); color: var(--muted); font-size: 13px; white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.prefix input { border-radius: 0 10px 10px 0; }
.note { font-size: 13px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.note.warn { background: color-mix(in srgb, var(--c3) 10%, transparent); border-color: color-mix(in srgb, var(--c3) 35%, transparent); color: var(--text); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; padding: 16px 18px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--panel); border-radius: 0 0 var(--radius) var(--radius); }
.form-actions .spacer { flex: 1; }

.preview { position: sticky; top: 90px; }
.phone { width: 100%; max-width: 340px; margin: 0 auto; aspect-ratio: 9 / 18.5; border-radius: 40px; border: 10px solid #15171C; overflow: hidden; background: #000; box-shadow: 0 30px 60px -30px rgba(0,0,0,.45); }
.phone iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.preview p { text-align: center; color: var(--muted); font-size: 12.5px; }

/* ---------- Modale ---------- */
.modal { border: 0; padding: 0; border-radius: 18px; background: var(--panel); color: var(--text); width: min(560px, calc(100% - 24px)); box-shadow: 0 40px 80px -30px rgba(0,0,0,.5); }
.modal::backdrop { background: rgba(10, 12, 16, .55); backdrop-filter: blur(2px); }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 0; }
.modal-h h2 { margin: 0; font-size: 17px; }
.modal-b { padding: 16px 20px; display: grid; gap: 14px; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 0 20px 20px; }
.qr-box { display: grid; grid-template-columns: 200px 1fr; gap: 18px; align-items: start; }
.qr-preview { background: #fff; border-radius: 12px; border: 1px solid var(--line); padding: 8px; }
.qr-preview svg { display: block; width: 100%; height: auto; stroke: none; }
.qr-meta { display: grid; gap: 10px; font-size: 13.5px; }
.qr-meta .url { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; word-break: break-all; background: var(--panel-2); padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); }
.qr-meta dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.qr-meta dt { color: var(--muted); }
.qr-meta dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.inline-fields { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.inline-fields .field { flex: 1; min-width: 120px; }
pre.code { margin: 0; max-height: 340px; overflow: auto; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 12.5px; line-height: 1.5; }

/* ---------- Comptes & espace client ---------- */
.owner { display: block; font-size: 12px !important; color: var(--accent) !important; margin-top: 2px; }
.btn.danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; }
.kpis.k5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
fieldset.fields { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.fields:disabled { opacity: .5; }
.form-sec h2 .badge { vertical-align: 2px; margin-left: 6px; }
.upsell { display: grid; gap: 6px; justify-items: start; padding: 14px 16px; margin-bottom: 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--c3) 10%, transparent); border: 1px solid color-mix(in srgb, var(--c3) 35%, transparent); }
.upsell span { color: var(--muted); font-size: 13.5px; }
.upsell em { font-size: 13.5px; }
.upsell .btn { margin-top: 4px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.auth-tabs button { border: 0; background: none; font: inherit; font-weight: 600; font-size: 14px; color: var(--muted); height: 34px; border-radius: 7px; cursor: pointer; }
.auth-tabs button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.lien { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; font-size: 13.5px; justify-self: start; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head .av { width: 46px; height: 46px; font-size: 16px; }
.card-head strong { display: block; font-size: 16px; }
.card-head .grow { flex: 1; min-width: 160px; }
.ok { color: var(--c2); font-weight: 600; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 14px); background: var(--text); color: var(--panel); padding: 11px 16px; border-radius: 12px; font-weight: 550; opacity: 0; pointer-events: none; transition: .2s; z-index: 100; max-width: calc(100% - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpis, .kpis.k5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .editor { grid-template-columns: 1fr; }
  .preview { position: static; }
}
@media (max-width: 900px) {
  .g-3 { grid-template-columns: 1fr; }
  .g-2 { grid-template-columns: 1fr; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  #menu:checked ~ .app .sidebar { transform: none; }
  #menu:checked ~ .app .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 20; }
  .menu-btn { display: grid; }
  .topbar { padding: 12px 16px; }
  .view { padding: 18px 16px 50px; }
}
@media (max-width: 600px) {
  .kpis, .kpis.k5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields { grid-template-columns: 1fr; }
  .qr-box { grid-template-columns: 1fr; }
  .qr-preview { max-width: 240px; margin: 0 auto; }
  .top-actions { width: 100%; }
  .top-actions select { flex: 1; min-width: 0; }
  .radio-cards { grid-template-columns: 1fr; }
}

/* ---------- Version Flask (pages générées en Python) ---------- */
.menu-case { display: none; }
label.menu-btn, label.scrim { cursor: pointer; }
.messages { display: grid; gap: 8px; margin-bottom: 16px; }
.note.ok { background: color-mix(in srgb, var(--c2) 10%, transparent); border-color: color-mix(in srgb, var(--c2) 35%, transparent); color: var(--text); }
.note.err { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--text); }
.note ul { margin: 6px 0 0; padding-left: 18px; }
.lien-copie { display: grid; gap: 8px; }
.lien-copie input { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.seg a { display: inline-flex; align-items: center; text-decoration: none; font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 11px; height: 30px; border-radius: 7px; }
.seg a.on { background: var(--accent-soft); color: var(--accent); }
.couleur-ligne { display: flex; align-items: center; gap: 10px; }
.couleur-ligne input[type=color] { width: 56px; height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--panel); cursor: pointer; }
.couleur-ligne label { display: inline-flex; }
.couleur-ligne .pastille { width: 26px; height: 26px; border-radius: 8px; display: inline-block; border: 2px solid transparent; }
.photo-row img { border-radius: 50%; object-fit: cover; }
.photo-row .field { flex: 1; }
input[type=file] { font: inherit; font-size: 13.5px; }
.qr-panneau { display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: center; }
.qr-panneau img { width: 100%; background: #fff; border-radius: 10px; border: 1px solid var(--line); padding: 6px; }
.qr-panneau .liens { display: flex; flex-wrap: wrap; gap: 8px; }
.qr-panneau code { font-size: 12.5px; word-break: break-all; }
.inline { display: inline; margin: 0; }
.vide-stats { color: var(--muted); text-align: center; padding: 26px 0; margin: 0; }
.tabs-liens { display: grid; grid-template-columns: 1fr 1fr; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.tabs-liens a { display: grid; place-items: center; height: 34px; border-radius: 7px; font-weight: 600; color: var(--muted); text-decoration: none; }
.tabs-liens a.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.choix-carte { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
@media (max-width: 600px) { .qr-panneau { grid-template-columns: 110px 1fr; } }

fieldset.blocs { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 10px; }
fieldset.blocs:disabled { opacity: .5; }
.bloc-edit { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--panel-2); }
.bloc-edit summary { cursor: pointer; list-style: none; }
.bloc-edit summary::-webkit-details-marker { display: none; }
.bloc-edit[open] summary { margin-bottom: 12px; }

/* ---------- Commande : aperçu de la carte physique ---------- */
.commande { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.physique { margin: 0; position: sticky; top: 90px; }
.physique figcaption { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 14px; }
.physique-carte {
  container-type: inline-size;                 /* les tailles en « cqw » suivent la largeur de la carte */
  aspect-ratio: 85 / 54; border-radius: 8px; padding: 3cqw 2cqw;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3cqw;
  color: #F4F4F5;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.028) 0 1px, transparent 1px 3px),   /* couches d'impression 3D */
    radial-gradient(120% 90% at 0% 0%, #2A2B30 0%, transparent 60%),
    #0D0E11;
  box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, 0 30px 60px -25px rgba(0,0,0,.6), 0 12px 24px -12px rgba(0,0,0,.45);
}
.physique-texte { align-self: start; display: grid; gap: 1.6cqw; min-width: 0; }
.physique-nom { font-size: 10cqw; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; overflow-wrap: anywhere; }
.physique-poste { font-size: 5cqw; line-height: 1.3; }
.physique-entreprise { font-size: 5cqw; line-height: 1.3; }
.physique-qr { width: 36cqw; height: 36cqw; background: #fff; border-radius: 2.4cqw; display: block; }
.quantites { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.quantites label { border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 6px; text-align: center; cursor: pointer; font-weight: 650; }
.quantites label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.quantites input { position: absolute; opacity: 0; }
.quantites small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.badge.statut-nouvelle { color: var(--c1); background: color-mix(in srgb, var(--c1) 12%, transparent); border-color: transparent; }
.badge.statut-production { color: var(--c3); background: color-mix(in srgb, var(--c3) 14%, transparent); border-color: transparent; }
.badge.statut-expediee { color: var(--c2); background: color-mix(in srgb, var(--c2) 12%, transparent); border-color: transparent; }
@media (max-width: 1000px) { .commande { grid-template-columns: 1fr; } .physique { position: static; max-width: 520px; margin: 0 auto; width: 100%; } }
@media (max-width: 600px) { .quantites { grid-template-columns: repeat(3, 1fr); } }

/* --- Sélecteur de couleurs --- */
.couleurs-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}
.color-option {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}
.color-option input {
  position: absolute;
  opacity: 0;
}
.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: block;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.color-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* --- Variantes de la carte physique --- */
.physique-carte[data-couleur="noir"] {
  color: #F4F4F5;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.028) 0 1px, transparent 1px 3px), 
              radial-gradient(120% 90% at 0% 0%, #2A2B30 0%, transparent 60%), 
              #0D0E11;
}
.physique-carte[data-couleur="noir"] .physique-qr {
  background: #0D0E11;
  filter: invert(1); /* Inverse le QR code classique (noir sur blanc -> blanc sur fond noir) */
}

.physique-carte[data-couleur="blanc"] {
  color: #18181B;
  background: linear-gradient(135deg, #ffffff 0%, #f4f4f5 100%);
  box-shadow: 0 1px 3px rgba(0,0,0,.1), 0 30px 60px -25px rgba(0,0,0,.2);
}
.physique-carte[data-couleur="blanc"] .physique-qr {
  background: #FFFFFF;
  filter: none;
}

.physique-carte[data-couleur="bois"] {
  color: #1C1917;
  background: #B09581;
  box-shadow: 0 1px 2px rgba(0,0,0,.2), 0 30px 60px -25px rgba(0,0,0,.4);
}
.physique-carte[data-couleur="bois"] .physique-qr {
  background: #B09581;
}

.physique-carte[data-couleur="bois"] .physique-qr img,
.physique-carte[data-couleur="bois"] .physique-qr svg {
  filter: invert(1); /* Transforme le QR code en blanc pour contraster avec le fond marron */
}

@media (max-width: 600px) {
  .couleurs-options {
    grid-template-columns: repeat(3, 1fr);
  }
}