:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #f0eee8;
  --ink: #1f2328;
  --ink-2: #4a5059;
  --muted: #6b7280;
  --line: #e2dfd7;
  --accent: #1d5c63;
  --accent-ink: #ffffff;
  --accent-soft: #e3efef;
  --ok: #2e6b3a;
  --ok-soft: #e4f1e6;
  --warn: #8a5a00;
  --warn-soft: #fbf0d9;
  --danger: #a3302a;
  --danger-soft: #f9e3e1;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(31, 35, 40, .06);
  color-scheme: light;
}

/* Thème foncé : choisi dans Mon compte, ou automatique selon le réglage de l'appareil. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]), :root[data-theme="auto"] {
    --bg: #15171a;
    --surface: #1d2024;
    --surface-2: #24282d;
    --ink: #e9e7e2;
    --ink-2: #c3c0b9;
    --muted: #9a9890;
    --line: #33373d;
    --accent: #6fb3b8;
    --accent-ink: #0f2a2c;
    --accent-soft: #1f3a3c;
    --ok: #8fcf9a;
    --ok-soft: #1f3324;
    --warn: #e7c06b;
    --warn-soft: #3a2f17;
    --danger: #f0938c;
    --danger-soft: #3d201e;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="fonce"] {
  --bg: #15171a;
  --surface: #1d2024;
  --surface-2: #24282d;
  --ink: #e9e7e2;
  --ink-2: #c3c0b9;
  --muted: #9a9890;
  --line: #33373d;
  --accent: #6fb3b8;
  --accent-ink: #0f2a2c;
  --accent-soft: #1f3a3c;
  --ok: #8fcf9a;
  --ok-soft: #1f3324;
  --warn: #e7c06b;
  --warn-soft: #3a2f17;
  --danger: #f0938c;
  --danger-soft: #3d201e;
  --shadow: none;
  color-scheme: dark;
}

/* Thèmes blanc/couleur : fond clair, barre du haut et menu de gauche dans la couleur du thème. */
:root[data-theme="bleu"] { --accent: #24408f; --accent-soft: #e5ebf7; --band: #1f3577; }
:root[data-theme="rouge"] { --accent: #a3232b; --accent-soft: #f8e4e5; --band: #8c1c23; }
:root[data-theme="vert"] { --accent: #1f6e45; --accent-soft: #e2f1e8; --band: #1c5c3a; }
:root[data-theme="bleu"], :root[data-theme="rouge"], :root[data-theme="vert"] {
  --band-ink: #ffffff;
  --band-muted: rgba(255, 255, 255, .78);
  --band-hover: rgba(255, 255, 255, .12);
  --band-active: rgba(255, 255, 255, .22);
}
:root[data-theme="bleu"] .topbar, :root[data-theme="rouge"] .topbar, :root[data-theme="vert"] .topbar,
:root[data-theme="bleu"] .sidebar, :root[data-theme="rouge"] .sidebar, :root[data-theme="vert"] .sidebar {
  background: var(--band); border-color: transparent; color: var(--band-ink);
}
:root[data-theme] .topbar .brand, :root[data-theme] .topbar .user a, :root[data-theme] .topbar .user button { color: var(--band-ink, inherit); }
:root[data-theme] .topbar .brand small { color: var(--band-muted, var(--muted)); }
/* Bouton ⚙ Paramètres sur la barre colorée : transparent, contour fin et texte blanc (sinon blanc sur blanc). */
:root[data-theme="bleu"] .topbar .mode-switch, :root[data-theme="rouge"] .topbar .mode-switch, :root[data-theme="vert"] .topbar .mode-switch {
  background: transparent; color: var(--band-ink); border: 1px solid var(--band-muted); box-shadow: none;
}
:root[data-theme="bleu"] .topbar .mode-switch:hover, :root[data-theme="rouge"] .topbar .mode-switch:hover, :root[data-theme="vert"] .topbar .mode-switch:hover {
  background: var(--band-hover); border-color: var(--band-ink);
}
:root[data-theme] .sidebar a { color: var(--band-muted, var(--ink-2)); }
:root[data-theme] .sidebar a:hover { background: var(--band-hover, var(--surface-2)); color: var(--band-ink, var(--ink-2)); }
:root[data-theme] .sidebar a.active { background: var(--band-active, var(--accent-soft)); color: var(--band-ink, var(--accent)); }
:root[data-theme="bleu"] .topbar .search input, :root[data-theme="rouge"] .topbar .search input, :root[data-theme="vert"] .topbar .search input {
  background: #fff; color: #1f2328; border-color: transparent;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  display: grid;
  grid-template-columns: 210px 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0 0 .4rem; font-weight: 650; letter-spacing: -.01em; }
h1 a { color: inherit; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; font-weight: 600; }
h2 small, h1 small { color: var(--muted); font-weight: 400; font-size: .85rem; margin-left: .35rem; }
h3 { font-size: .95rem; margin: 1rem 0 .4rem; }
.muted { color: var(--muted); }
.notes { white-space: pre-wrap; background: var(--surface-2); padding: .6rem .8rem; border-radius: 8px; }

/* Structure */
.topbar {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .6rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; color: var(--ink); font-size: 1.05rem; display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; line-height: 1.1; min-width: 170px; }
.brand span { display: flex; flex-direction: column; }
/* Logo sur fond blanc : reste lisible en mode sombre */
.brand-logo { height: 52px; width: auto; background: #fff; border-radius: 6px; padding: 3px; }
.brand small { font-weight: 400; color: var(--muted); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.brand:hover { text-decoration: none; }
.search { flex: 1; max-width: 520px; position: relative; }
.search input { width: 100%; }
.user { margin-left: auto; display: flex; gap: .75rem; align-items: center; color: var(--ink-2); }
.sidebar {
  padding: 1rem .6rem;
  display: flex; flex-direction: column; gap: 2px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.sidebar a { padding: .5rem .75rem; border-radius: 8px; color: var(--ink-2); }
.sidebar a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.content { padding: 1.5rem 1.75rem 3rem; min-width: 0; max-width: 1280px; }
.content.bare { grid-column: 1 / -1; grid-row: 1 / -1; display: grid; place-items: center; max-width: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.buttons { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  min-width: 0;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid2 > .card, .grid3 > .card { margin-bottom: 1rem; }

/* Tuiles */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 1rem 0; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .2rem; box-shadow: var(--shadow); }
.tile span { color: var(--muted); font-size: .85rem; }
.tile strong { font-size: 1.6rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile small { color: var(--muted); }
.stats p { margin: .3rem 0; }

/* Formulaires */
input, select, textarea, button, .button {
  font: inherit;
  color: var(--ink);
}
input, select, textarea {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 7px;
  padding: .45rem .6rem;
  min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--ink-2); }
label.inline { flex-direction: row; align-items: center; gap: .4rem; }
label.check { flex-direction: row; align-items: center; gap: .45rem; font-size: .95rem; color: var(--ink); display: inline-flex; margin-right: 1.25rem; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .9rem; }
legend { color: var(--ink-2); font-size: .85rem; padding: 0 .3rem; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .85rem 1rem; }
.form-grid .span2 { grid-column: span 2; }
.form-grid .span3 { grid-column: 1 / -1; }
.form-row { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; margin-top: .75rem; }
.form-row label { flex: 1; min-width: 110px; }
.actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: .45rem .9rem;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
button:hover, .button:hover { background: var(--surface-2); text-decoration: none; }
.primary, button.primary, .button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.primary:hover, .button.primary:hover { filter: brightness(1.08); background: var(--accent); }
button:disabled, button:disabled:hover { opacity: .45; cursor: not-allowed; filter: none; }
button.link, .link { background: none; border: none; padding: 0; color: var(--accent); cursor: pointer; }
button.link:hover { text-decoration: underline; background: none; }
form.inline { display: inline; }
.danger-zone { margin-top: 1.5rem; }
.danger-zone .link, .danger-zone button { color: var(--danger); }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem; align-items: center; }
.filters input[type=search] { flex: 1; min-width: 220px; max-width: 420px; }

/* Tableaux */
table { border-collapse: collapse; width: 100%; }
.list th, .list td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.list thead th { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.list tbody tr:hover { background: var(--surface-2); }
.list tfoot td { border-bottom: none; padding: .3rem .6rem; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.due { color: var(--danger); font-weight: 600; }
.inactive td { color: var(--muted); }
.inactive a { color: var(--muted); }
.ellipsis { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 2rem; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; color: var(--muted); }
.card > .list { margin: 0 -.6rem; width: calc(100% + 1.2rem); }

/* Tableau de mesures */
.rx { width: auto; min-width: 340px; margin: .5rem 0; }
.rx th, .rx td { padding: .35rem .75rem; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.rx thead th { font-size: .8rem; color: var(--muted); font-weight: 600; }
.rx tbody th { text-align: left; font-weight: 500; color: var(--ink-2); }
.rx-form input { width: 120px; text-align: right; }
.rx-form td[colspan] input { width: 100%; text-align: left; }

dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .3rem 1rem; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: break-word; }
dd button.link { white-space: normal; text-align: left; padding: 0; }
dl.inline { margin-bottom: .75rem; }

.badge { display: inline-block; font-size: .75rem; padding: .1rem .5rem; border-radius: 999px; font-weight: 600; vertical-align: middle; }
.badge-neutral { background: var(--surface-2); color: var(--ink-2); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }

.flash { background: var(--ok-soft); color: var(--ok); padding: .6rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 500; }
.error { background: var(--danger-soft); color: var(--danger); padding: .5rem .8rem; border-radius: 7px; }

/* Lignes de vente */
.lines th { font-size: .8rem; color: var(--muted); text-align: left; padding: .4rem; font-weight: 600; }
.lines td { padding: .3rem .4rem; vertical-align: top; }
.lines input, .lines select { width: 100%; }
.lines .qty { width: 70px; }
.lines .price { width: 110px; }
.lines .discount, .lines .discount-eur { width: 80px; }
.product-cell { position: relative; min-width: 280px; }
.suggestions {
  position: absolute; left: .4rem; right: .4rem; top: 100%; z-index: 10;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12);
  max-height: 300px; overflow: auto;
}
.suggestions button { display: flex; width: 100%; justify-content: space-between; gap: 1rem; border: 0; border-radius: 0; text-align: left; padding: .45rem .7rem; }
.suggestions button small { color: var(--muted); }
.suggestions a { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem .75rem; color: var(--ink); border-bottom: 1px solid var(--line); }
.suggestions a:last-child { border-bottom: 0; }
.suggestions a:hover, .suggestions a.active { background: var(--line); text-decoration: none; }
.suggestions a small { color: var(--muted); white-space: nowrap; }
.suggestions p { margin: 0; padding: .6rem .75rem; }
.search .suggestions { left: 0; right: 0; top: calc(100% + 4px); max-height: 420px; }
.line-total { padding-top: .75rem !important; }
.pick { list-style: none; padding: 0; }
.pick li { padding: .4rem 0; border-bottom: 1px solid var(--line); display: flex; gap: 1rem; justify-content: space-between; }

/* Graphique */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .baseline { stroke: var(--ink-2); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .bar path { fill: var(--accent); }
.chart .bar .hit { fill: transparent; }
.chart .bar .value { fill: var(--ink-2); font-size: 11px; opacity: 0; }
.chart .bar:hover .value, .chart .bar:focus .value { opacity: 1; }
.chart .bar:hover path, .chart .bar:focus path { filter: brightness(1.15); }
.chart .bar:focus { outline: none; }

/* Connexion */
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 2rem; width: min(380px, 92vw); box-shadow: var(--shadow); }
.login-card form { display: flex; flex-direction: column; gap: .9rem; margin-top: 1rem; }

/* Tablettes et téléphones */
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px; } /* évite le zoom automatique sur iPhone/iPad */
  button, .button, input, select { min-height: 42px; }
  .sidebar a { padding: .65rem .85rem; }
  .list td, .list th { padding-top: .65rem; padding-bottom: .65rem; }
}

@media (max-width: 1024px) {
  /* Une colonne : barre du haut, menu, contenu. Seul le contenu s'étire (sinon le menu remplit l'écran sur une page courte). */
  body { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
  .topbar { flex-wrap: wrap; gap: .5rem 1rem; padding: .5rem 1rem; padding-top: max(.5rem, env(safe-area-inset-top)); }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .sidebar {
    flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line);
    padding: .4rem .6rem; position: sticky; top: 0; z-index: 4; scrollbar-width: none;
  }
  .sidebar a { white-space: nowrap; }
  .content { padding: 1.1rem; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .grid3 > .card:last-child { grid-column: 1 / -1; }
  .card > .list { margin: 0; width: 100%; }
}

@media (max-width: 700px) {
  html { font-size: 15px; }
  .brand { min-width: 0; }
  .user { font-size: .9rem; }
  h1 { font-size: 1.3rem; }
  .content { padding: .9rem .75rem 3rem; }
  .tiles, .grid2, .grid3, .form-grid { grid-template-columns: 1fr; }
  .tile strong { font-size: 1.35rem; }
  .form-grid .span2 { grid-column: auto; }
  .page-head .buttons { width: 100%; }
  .page-head .buttons > * { flex: 1 1 auto; }
  .card { padding: .9rem; }
  .hide-sm { display: none; }
  .filters input[type=search] { min-width: 0; max-width: none; flex-basis: 100%; }
  .filters > * { flex: 1 1 auto; }
  .ellipsis { max-width: 160px; }
  .rx { min-width: 0; width: 100%; }
  .rx-form input { width: 100%; }
  .pager { font-size: .85rem; }

  /* Lignes de vente empilées */
  .lines thead { display: none; }
  .lines, .lines tbody, .lines tfoot { display: block; }
  .lines tr.line {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .4rem;
    border: 1px solid var(--line); border-radius: 8px; padding: .6rem; margin-bottom: .6rem; position: relative;
  }
  .lines tr.line td { padding: 0; display: block; }
  .lines tr.line td[data-label]::before { content: attr(data-label); display: block; font-size: .75rem; color: var(--muted); margin-bottom: .15rem; }
  .lines tr.line td:first-child { grid-column: 1 / -1; padding-right: 2rem; }
  .lines tr.line .product-cell { grid-column: 1 / -1; min-width: 0; }
  .lines tr.line td:last-child { position: absolute; top: .7rem; right: .6rem; }
  .lines .qty, .lines .price, .lines .discount, .lines .discount-eur { width: 100%; }
  .lines .line-total { grid-column: 1 / -1; text-align: right; padding: 0 !important; font-weight: 600; }
  .lines tfoot tr { display: flex; justify-content: space-between; align-items: center; }
  .lines tfoot td { display: block; }
  .lines tfoot td:empty { display: none; }
}

@media print {
  .topbar, .sidebar, .buttons, .danger-zone, .actions, .mda-box { display: none !important; }
  body { display: block; background: #fff; }
  .card { border: none; box-shadow: none; }
}

/* Formulaires empilés, code de sécurité */
form.stack { display: flex; flex-direction: column; gap: .75rem; }
.twofa ol { padding-left: 1.2rem; }
.twofa li { margin-bottom: .9rem; }
.qr { width: 220px; max-width: 100%; margin: .6rem 0; background: #fff; border-radius: 8px; }
.qr svg { display: block; width: 100%; height: auto; }
code { background: var(--surface-2); padding: .1rem .35rem; border-radius: 4px; font-size: .95em; letter-spacing: .05em; }

/* Fenêtres */
.dialog {
  border: 1px solid var(--line); border-radius: 14px; padding: 1.4rem 1.5rem; width: min(520px, 94vw);
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.dialog::backdrop { background: rgba(20, 22, 26, .45); }
.dialog form { display: flex; flex-direction: column; gap: .9rem; }
.dialog h2 { margin: 0; }
.pay-lines th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 600; padding: .2rem .3rem; }
.pay-lines td { padding: .25rem .3rem; }
.pay-lines input, .pay-lines select { width: 100%; }
.pay-check { color: var(--ink-2); font-size: .9rem; padding-top: .5rem !important; }

/* Hauteur de montage */
.mount-heights { margin: 1rem 0; }
.mount-heights h3 { margin-top: 0; }
.mount-heights h3 small { color: var(--muted); font-weight: 400; }
.mh { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.mh-side { position: relative; display: flex; flex-direction: column; gap: .25rem; }
.mh-label { font-size: .85rem; color: var(--ink-2); }
.mh-value { justify-content: space-between; font-size: 1.1rem; font-weight: 600; min-height: 44px; }
.mh-pop {
  position: absolute; top: 100%; left: 0; z-index: 20; width: min(440px, 92vw); margin-top: .3rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .7rem; box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
.mh-side[data-side="l"] .mh-pop { left: auto; right: 0; }
.grid-h { display: grid; grid-template-columns: repeat(9, 1fr); gap: .3rem; }
.hc { min-height: 42px; padding: 0; font-variant-numeric: tabular-nums; }
.hc.sel { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.mh-other { display: flex; gap: .5rem; align-items: center; margin-top: .6rem; flex-wrap: wrap; }
.mh-other input { width: 110px; }
@media (max-width: 700px) {
  .grid-h { grid-template-columns: repeat(7, 1fr); }
  .mh-pop { width: calc(200% + 1rem); }
}

[hidden] { display: none !important; }

/* Lien discret sur un titre + point rouge (remarque client) */
.title-link { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; min-height: 0; }
.title-link:hover { background: none; text-decoration: underline dotted; text-underline-offset: 3px; }
.note-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); display: inline-block; }
.note-form { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .8rem; }
.note-form textarea { width: 100%; }

@media (max-width: 700px) {
  .brand { flex-direction: row; align-items: center; gap: .55rem; }
  .brand-logo { height: 38px; }
}

/* Comptabilité */
.acc-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin: .5rem 0 1rem; overflow-x: auto; scrollbar-width: none; }
.acc-tabs a { padding: .5rem .8rem; white-space: nowrap; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.acc-tabs a:hover { color: var(--ink); text-decoration: none; }
.acc-tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.acc-periods { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.acc-periods .button { padding: .3rem .7rem; font-size: .9rem; }
td.num, th.num { text-align: right; white-space: nowrap; }
.list tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
.card:has(> .list) { overflow-x: auto; }
@media (max-width: 700px) { .acc-tabs { margin-left: -.75rem; margin-right: -.75rem; padding: 0 .75rem; } }

/* Panier moyen */
.baskets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.basket.current { border-right: 1px solid var(--line); padding-right: 1rem; }
.basket.current strong { color: var(--accent); }
.basket { display: flex; flex-direction: column; gap: .2rem; padding: .25rem 0; }
.basket span { color: var(--muted); font-size: .85rem; }
.basket strong { font-size: 1.5rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.basket small { color: var(--muted); }
.trend { display: inline-flex; align-items: center; gap: .3rem; font-weight: 650; width: fit-content; padding: .15rem .55rem .15rem .35rem; border-radius: 999px; }
.trend svg { width: 1.25rem; height: 1.25rem; fill: currentColor; }
.trend.up { color: var(--ok); background: var(--ok-soft); }
.trend.down { color: var(--danger); background: var(--danger-soft); }
.trend.flat { color: var(--muted); }
@media (max-width: 1000px) { .baskets { grid-template-columns: repeat(2, 1fr); } .basket.current { border-right: 0; padding-right: 0; } }
@media (max-width: 700px) { .baskets { grid-template-columns: 1fr; } .basket { border-top: 1px solid var(--line); padding-top: .6rem; } .basket:first-child { border-top: 0; padding-top: .25rem; } }
.flash.danger { background: var(--danger-soft); color: var(--danger); }
.backups td:last-child { text-align: right; white-space: nowrap; }

/* Lecture de la carte d'identité */
.id-reader { border-style: dashed; }
.id-reader.drop { border-color: var(--accent); background: var(--accent-soft); }
.id-reader h2 { margin-top: 0; }
.id-reader .buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.id-reader .button { cursor: pointer; }
.id-hint { margin: .6rem 0 0; font-size: .9rem; }
.id-result { margin-top: .8rem; padding: .7rem .9rem; border-radius: 8px; background: var(--surface-2); }
.id-result.ok { background: var(--ok-soft); }
.id-result.warn { background: var(--warn-soft); }
.id-result.error { background: var(--danger-soft); color: var(--danger); }
.id-result p { margin: .3rem 0; }
.id-result .warn-line { color: var(--warn); font-weight: 500; }
.id-result .dup { margin-top: .6rem; padding: .6rem .8rem; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.id-result .loading::before { content: ""; display: inline-block; width: .9em; height: .9em; margin-right: .5em; vertical-align: -.1em;
  border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
input.from-id, select.from-id { background: var(--ok-soft); }
input.to-check, select.to-check { background: var(--warn-soft); }

/* Photo du client */
.page-head .who { display: flex; gap: 1rem; align-items: center; }
img.client-photo { width: 72px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); }
.client-photo-field { display: flex; align-items: center; gap: 1rem; }
.client-photo-field[hidden] { display: none; }
.id-crop { margin-top: .8rem; }
.crop-area { position: relative; display: inline-block; max-width: 100%; touch-action: none; user-select: none; }
.crop-area canvas { display: block; max-width: 100%; max-height: 60vh; border-radius: 8px; }
.crop-box { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .45); cursor: move; }
.crop-handle { position: absolute; right: -11px; bottom: -11px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; cursor: nwse-resize; }
.crop-area { overflow: hidden; border-radius: 8px; }

/* Scanner l'ordonnance */
.rx-crop { margin-top: .6rem; }
.rx-frame { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .45); cursor: move; }
.rx-mask-box { position: absolute; background: #000; cursor: move; display: grid; place-items: center; }
.rx-mask-box .rx-label { color: #fff; font-size: .75rem; opacity: .7; pointer-events: none; }
.rx-mask-box .rx-del { position: absolute; top: -12px; right: -12px; width: 24px; height: 24px; padding: 0; border-radius: 50%;
  background: var(--danger); color: #fff; border: 2px solid #fff; line-height: 1; cursor: pointer; }
.rx-result { margin-top: .8rem; padding: .7rem .9rem; border-radius: 8px; background: var(--surface-2); }
.rx-result.ok { background: var(--ok-soft); }
.rx-result.warn { background: var(--warn-soft); }
.rx-result.error { background: var(--danger-soft); color: var(--danger); }
.rx-result p { margin: .3rem 0; }
.rx-result .warn-line { color: var(--warn); font-weight: 500; }
.rx-result .loading::before { content: ""; display: inline-block; width: .9em; height: .9em; margin-right: .5em; vertical-align: -.1em;
  border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.rx-compare { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.rx-compare img { width: 100%; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
@media (max-width: 700px) { .rx-compare { grid-template-columns: 1fr; } }
.rx-form input.from-id { background: var(--ok-soft); }
.rx-form input.to-check { background: var(--warn-soft); }
.code-mini { width: 6.5em; }

/* Annexe 15 */
.warn-box { background: var(--warn-soft); color: var(--warn); border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; }
.warn-box ul, .notes-box ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.notes-box { background: var(--accent-soft); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.annex-lines { min-width: 1060px; font-size: .9rem; }
.annex-lines th, .annex-lines td { padding: .4rem .25rem; }
.annex-lines th { white-space: normal; line-height: 1.2; }
.annex-lines input, .annex-lines select { padding: .35rem .4rem; font-size: .9rem; }
.annex-lines td.num { white-space: nowrap; padding-top: .7rem; }
.annex-lines td { vertical-align: top; }
.annex-lines tr.off td:not(:first-child) { opacity: .45; }
.annex-lines input, .annex-lines select { width: 100%; min-width: 0; }
.annex-lines .w-label { min-width: 18rem; }
.annex-lines .w-code { width: 5.6rem; }
.annex-lines .w-num { width: 4.9rem; text-align: right; }
.annex-lines .w-qty { width: 3.6rem; }
.annex-lines select { width: 5.2rem; }
.annex-lines small { display: block; margin-top: .2rem; }
.annex-lines tfoot th { text-align: right; }
.inami-fields .form-grid { margin: 0 0 .75rem; }
.form-row .grow { flex: 1 1 22rem; }
.signature-preview { max-height: 80px; max-width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 4px; }
.annex-lines .lens-type { display: flex; gap: .25rem; margin-top: .3rem; flex-wrap: wrap; }
.annex-lines .lens-type select { width: auto; flex: 1 1 0; min-width: 0; }
.annex-lines small.article { color: var(--ink-2); font-weight: 500; }
.annex-lines .lens-type select:first-child { flex-basis: 100%; }

/* Peppol */
.peppol-box { margin-top: 1rem; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.peppol-box p { margin: .4rem 0; }
.peppol-box form { margin-top: .4rem; }

/* Achats : rapprochement */
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.tabs a { padding: .4rem .8rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); text-decoration: none; }
.tabs a.active { background: var(--accent); color: var(--accent-ink); }
.bl-card .page-head { margin-bottom: .3rem; align-items: center; }
.bl-lines { margin: .3rem 0 .6rem; padding-left: 1.1rem; }
.candidate { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; padding: .35rem 0; border-top: 1px solid var(--line); }
.candidate input[name="numero"] { width: 11rem; }

/* Choix du thème (Mon compte) */
.theme-choice { display: flex; flex-wrap: wrap; gap: .75rem; margin: .5rem 0 1rem; }
.theme-choice label { display: flex; flex-direction: column; align-items: center; gap: .35rem; cursor: pointer; font-size: .9rem; }
.theme-choice input { position: absolute; opacity: 0; }
.theme-swatch { width: 96px; height: 64px; border-radius: 8px; border: 2px solid var(--line); display: grid; grid-template-columns: 26px 1fr; grid-template-rows: 14px 1fr; overflow: hidden; }
.theme-swatch i:first-child { grid-column: 1 / -1; }
.theme-choice input:checked + .theme-swatch { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-choice input:focus-visible + .theme-swatch { outline: 2px solid var(--accent); outline-offset: 2px; }
.id-reader .eid-reader.ready::after { content: ' ●'; color: #6fdc8c; }

/* Fiche optométrique : tableau à gauche, remarques à droite ; prismes OD / OG sous le tableau */
.measure-layout { display: grid; grid-template-columns: auto minmax(260px, 1fr); gap: 1.5rem; align-items: start; }
.measure-notes label, .measure-notes textarea { width: 100%; }
.measure-notes textarea { min-height: 12rem; }
.measure-notes h3:first-child { margin-top: .5rem; }
.prisms { margin: .5rem 0 1rem; }
.prism-row { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem 1rem; margin-bottom: .5rem; }
.prism-row > strong { min-width: 7.5rem; padding-bottom: .5rem; font-weight: 500; }
.prism-field span { display: flex; align-items: center; gap: .3rem; }
.prism-field input { width: 90px; text-align: right; }
.rx.pd { min-width: 0; width: 100%; margin-top: 0; }
.rx.pd input { width: 80px; }
.measure-notes > label { display: block; margin-top: .75rem; }
.measure-notes > label input { display: block; width: 100%; margin-top: .25rem; }
.prism-line { margin: .3rem 0; }
@media (max-width: 800px) { .measure-layout { grid-template-columns: 1fr; } }

/* ---------- Tableau de bord configurable ---------- */
.badge-info { background: var(--accent-soft); color: var(--accent); }
.dashboard { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.dashboard > .card { margin: 0; min-width: 0; }
.dashboard .span-1 { grid-column: span 1; }
.dashboard .span-2 { grid-column: span 2; }
.dashboard .span-3 { grid-column: 1 / -1; }
.dashboard.calm .fun { display: none; }
/* Sans vide entre les widgets : chaque carte occupe autant de petites rangées que sa hauteur (calculé par dashboard.js). */
.dashboard.masonry { grid-auto-rows: 4px; row-gap: 0; grid-auto-flow: row dense; align-items: start; }
.widget h2 { font-size: 1rem; margin: 0 0 .75rem; }
.widget-more { margin: .75rem 0 0; font-size: .9rem; }
.w-ok { color: var(--ok); margin: 0; }
.w-big { font-size: 2rem; font-weight: 700; margin: 0 0 .25rem; color: var(--accent); }
.w-count { font-size: 1.6rem; font-weight: 700; margin: -.4rem 0 .5rem; color: var(--accent); }
.w-count small { font-size: .85rem; font-weight: 400; color: var(--muted); }
.w-list { list-style: none; margin: 0; padding: 0; }
.w-list li { display: flex; align-items: center; gap: .6rem; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.w-list li:last-child { border-bottom: 0; }
.w-list.compact li { justify-content: space-between; padding: .3rem 0; }
.w-list li.today a { font-weight: 600; }
.w-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.w-main small { color: var(--muted); }
.w-time { font-variant-numeric: tabular-nums; font-weight: 600; width: 3.2rem; }
.avatar { width: 2rem; height: 2rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; flex: none; }
.button.small { padding: .2rem .6rem; font-size: .85rem; }
.w-table { margin: 0; }
.w-table td { padding: .35rem .3rem; }
.w-alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.w-alerts a { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; color: inherit; text-decoration: none; }
.w-alerts a:hover { background: var(--surface-2); }
.alert-icon { width: 1.8rem; height: 1.8rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.alert-danger .alert-icon { background: var(--danger-soft); color: var(--danger); }
.alert-warn .alert-icon { background: var(--warn-soft); color: var(--warn); }
.alert-info .alert-icon { background: var(--accent-soft); color: var(--accent); }
.w-kpis { display: grid; gap: .6rem; }
.w-kpi { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 0 .5rem; }
.w-kpi span { color: var(--muted); font-size: .85rem; }
.w-kpi strong { font-size: 1.25rem; grid-column: 1; }
.w-kpi .trend { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.w-kpi small { color: var(--muted); grid-column: 1 / -1; font-size: .78rem; }
.w-goal { display: flex; align-items: center; gap: 1rem; }
.w-goal p { margin: .2rem 0; }
.w-goal-msg { margin: .5rem 0 0; color: var(--ink-2); }
.gauge { width: 130px; height: 130px; flex: none; }
.gauge circle { fill: none; stroke-width: 11; }
.gauge-bg { stroke: var(--surface-2); }
.gauge-fg { stroke: var(--accent); stroke-linecap: round; }
.gauge-pct { font-size: 22px; font-weight: 700; fill: var(--ink); }
.gauge-sub { font-size: 9px; fill: var(--muted); }
.accent { color: var(--accent); }
.bar { display: inline-block; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; flex: 1; min-width: 40px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bar.wide { display: block; margin-top: .5rem; }
.w-stock { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.w-stock li { display: grid; grid-template-columns: minmax(0, 1.4fr) 1fr auto; align-items: center; gap: .6rem; }
.w-stock li a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-stock .bar i { background: var(--danger); }
.w-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.w-bars li { display: grid; grid-template-columns: minmax(0, 1fr) 1fr auto; align-items: center; gap: .6rem; }
.w-todo { list-style: none; margin: 0 0 .5rem; padding: 0; }
.w-todo form { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.w-todo span { flex: 1; display: flex; flex-direction: column; }
.w-todo li.done span { text-decoration: line-through; color: var(--muted); }
.w-todo .check { width: 1.4rem; height: 1.4rem; padding: 0; border-radius: 4px; border: 1.5px solid var(--accent); background: var(--surface); color: var(--accent); font-size: .8rem; line-height: 1; }
.w-add { display: flex; gap: .4rem; }
.w-add input { flex: 1; min-width: 0; }
.w-notes textarea { width: 100%; }
.w-notes-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: .4rem; }
.shortcuts { display: grid; gap: .5rem; }
.shortcut { display: flex; align-items: center; gap: .7rem; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; background: var(--surface-2); }
.shortcut:hover { border-color: var(--accent); }
.w-clock { display: flex; flex-direction: column; }
.clock-time { font-size: 2.8rem; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.clock-date { color: var(--muted); }
.w-weather { display: flex; align-items: center; gap: 1rem; min-height: 4rem; }
.wx-now { display: flex; align-items: center; gap: .5rem; }
.wx-now strong { font-size: 2rem; }
.wx-icon { font-size: 2.2rem; }
.wx-info { display: flex; flex-direction: column; }
.wx-info small { color: var(--muted); }
.w-quote { margin: 0; font-size: 1.05rem; line-height: 1.5; border-left: 3px solid var(--accent); padding-left: .8rem; }
.w-quote cite { display: block; margin-top: .4rem; font-size: .85rem; color: var(--muted); font-style: italic; }
.w-countdown { display: flex; flex-direction: column; gap: .15rem; }
.cd-title { font-weight: 600; }
.cd-days { font-size: 2.2rem; color: var(--accent); }
.w-photo { margin: 0; }
.w-photo img { width: 100%; max-height: 260px; object-fit: cover; border-radius: 8px; display: block; }
.w-photo figcaption { margin-top: .4rem; color: var(--muted); font-size: .9rem; }
.w-pause { display: flex; align-items: center; gap: .7rem; font-size: 1.05rem; padding: .4rem .6rem; border-radius: 8px; }
.w-pause > span:first-child { font-size: 1.8rem; }
.w-pause.soon { background: var(--warn-soft); }
.dash-head .buttons { display: flex; gap: .5rem; }
@media (max-width: 1100px) { .dashboard { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dashboard .span-2 { grid-column: 1 / -1; } }
@media (max-width: 700px) { .dashboard { grid-template-columns: 1fr; } .dashboard .span-1, .dashboard .span-2 { grid-column: 1 / -1; } }

/* Configuration des widgets */
.widget-order { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .4rem; }
.widget-order li { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: .75rem; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); opacity: .7; }
.widget-order li.on { background: var(--surface); opacity: 1; border-color: var(--accent); }
.widget-order li.dragging { outline: 2px dashed var(--accent); }
.widget-order .handle { cursor: grab; color: var(--muted); font-size: 1.2rem; }
.widget-order label.check { display: flex; gap: .6rem; align-items: flex-start; margin: 0; }
.widget-order .moves button { font-size: 1.1rem; padding: 0 .3rem; }
.config-photo { max-width: 320px; border-radius: 8px; }
.config-links { margin: 0; padding-left: 1.2rem; line-height: 1.9; }
@media (max-width: 700px) { .widget-order li { grid-template-columns: auto 1fr; } .widget-order select, .widget-order .moves { grid-column: 2; } }

/* Agenda */
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: .4rem; margin-bottom: 1rem; }
.week-strip a { display: flex; flex-direction: column; align-items: center; padding: .45rem .3rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); text-decoration: none; font-size: .85rem; }
.week-strip a strong { font-size: 1.1rem; color: var(--accent); }
.week-strip a.today { border-color: var(--accent); }
.week-strip a.active { background: var(--accent); color: var(--accent-ink); }
.week-strip a.active strong { color: var(--accent-ink); }
.agenda td.time { font-weight: 600; font-variant-numeric: tabular-nums; width: 3.5rem; }
.status-form select { padding: .2rem .4rem; }
.client-pick { position: relative; }
.client-pick .suggestions { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; }
.appointment-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.appointment-form input, .appointment-form select { width: 100%; min-width: 0; box-sizing: border-box; }
@media (max-width: 1100px) { .appointment-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } .appointment-form .span3 { grid-column: 1 / -1; } }
.rx-form tr.prism-head th { padding-top: 1rem; font-size: .8rem; color: var(--muted); font-weight: 600; text-align: right; }
.rx-form tr.prism-head th:first-child { text-align: left; }
.prism-note { margin: 0; padding: .5rem .75rem; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-weight: 500; }
.update-banner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-color: var(--accent); background: var(--accent-soft); }
.update-banner h2 { margin: 0 0 .3rem; }
.update-banner ul { margin: 0; padding-left: 1.1rem; }
.big-button { font-size: 1.15rem; padding: .9rem 1.6rem; border-radius: 10px; }
.one-click { border-color: var(--accent); }
.gh-settings { margin-top: 1rem; }
.gh-settings summary { cursor: pointer; color: var(--muted); }
.account-update { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.account-update h2 { margin: 0 0 .2rem; }
.account-update p { margin: 0; }
.widget-maj { padding: .7rem 1rem; display: flex; align-items: center; gap: .5rem; }
.widget-maj .w-update { flex: 1; min-width: 0; }
.w-close button { font-size: 1.4rem; line-height: 1; padding: .2rem .45rem; color: var(--muted); text-decoration: none; }
.w-close button:hover { color: inherit; }
.w-update { display: flex; align-items: center; gap: 1rem; color: inherit; text-decoration: none; }
.w-update .w-main strong { font-size: 1.05rem; }
.w-update-icon { width: 2.4rem; height: 2.4rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; background: var(--ok-soft); color: var(--ok); flex: none; }
.w-update.new .w-update-icon { background: var(--accent); color: var(--accent-ink); }
.widget-maj:has(.w-update.new) { border-color: var(--accent); background: var(--accent-soft); }
.w-update .button { white-space: nowrap; }
.news-new { border-color: var(--accent); background: var(--accent-soft); }
.news-list { margin: .3rem 0 1rem; padding-left: 1.2rem; line-height: 1.55; }
.news-list li { margin-bottom: .35rem; }
/* Sur GSM : icône et texte sur toute la largeur, bouton en dessous, croix de fermeture dans le coin. */
.w-update:hover, .w-update:hover * { text-decoration: none; }
.w-update:hover strong { text-decoration: underline; }
@media (max-width: 700px) {
  .widget-maj { position: relative; display: block; padding: .8rem 2.6rem .8rem .9rem; }
  .w-close { position: absolute; top: .3rem; right: .3rem; }
  .w-update { flex-wrap: wrap; gap: .5rem .8rem; }
  .w-update-icon { width: 2rem; height: 2rem; }
  .w-update .w-main { flex: 1 1 calc(100% - 3rem); }
  .w-update .w-main strong { font-size: 1rem; }
  .w-update .w-main small { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .w-update .button { flex: 1 1 100%; text-align: center; white-space: normal; }
}

/* MyCareNet : réponse complète et scénarios de test */
.mda-result { display: grid; grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr); gap: .4rem 1rem; margin: .5rem 0; }
.mda-result dt { color: var(--muted); }
.mda-result dd { margin: 0; overflow-wrap: anywhere; }
.mda-faults { color: var(--danger, #b42318); margin: .5rem 0; }
.mda-scenarios td { vertical-align: top; font-size: .92rem; }
.mda-scenarios td a { white-space: nowrap; }

/* Doublons */
.dup-warning { border: 1px solid var(--warn, #b7791f); background: var(--warn-soft, #fdf3e1); border-radius: 10px; padding: .7rem 1rem; }
.dup-warning ul { margin: .4rem 0; padding-left: 1.2rem; }
.dup-list { display: grid; gap: .6rem; }
.dup-pair { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .4rem 1rem; align-items: center; border: 1px solid var(--line, #e5e2da); border-radius: 10px; padding: .7rem 1rem; }
.dup-sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.dup-sides > div { min-width: 0; overflow-wrap: anywhere; }
.dup-why { grid-column: 2 / 3; }
.dup-actions { grid-row: 1 / 3; grid-column: 3; display: flex; flex-direction: column; gap: .3rem; align-items: flex-end; }
.dup-score { grid-row: 1 / 3; font-weight: 700; font-size: 1.05rem; width: 3.6rem; text-align: center; border-radius: 8px; padding: .4rem 0; background: var(--surface-2); }
.dup-score.high { background: var(--danger-soft); color: var(--danger); }
.dup-score.mid { background: var(--warn-soft, #fdf3e1); color: var(--warn, #b7791f); }
.dup-table th[scope], .dup-table tbody th { text-align: left; color: var(--muted); font-weight: 500; width: 12rem; }
.dup-table tr.diff td { background: var(--warn-soft, #fdf3e1); }
.dup-table td { overflow-wrap: anywhere; vertical-align: top; }
.dup-table thead th { vertical-align: top; text-transform: none; letter-spacing: 0; font-size: .95rem; color: var(--ink, inherit); }
.dup-table thead th a { display: block; margin-top: .3rem; }
@media (max-width: 700px) {
  .dup-pair { grid-template-columns: minmax(0, 1fr); }
  .dup-sides { grid-template-columns: minmax(0, 1fr); }
  .dup-score, .dup-why, .dup-actions { grid-row: auto; grid-column: auto; align-items: flex-start; }
}
.dup-auto { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; padding: .8rem 1rem; margin-bottom: 1rem; border-radius: 10px; background: var(--accent-soft, var(--surface-2)); }
.dup-auto .muted { flex: 1 1 20rem; }

/* SAV, inventaire, signature, propositions, RGPD */
.sav-history { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.inventory-form { display: flex; gap: .5rem; }
.inventory-form input { flex: 1; font-size: 1.2rem; padding: .6rem .8rem; }
.inventory-last { font-weight: 600; min-height: 1.4em; }
.inventory-last.ok { color: var(--ok); }
.inventory-last.error { color: var(--danger); }
.inventory-qty { width: 5rem; text-align: right; }
.signature-pad { width: 100%; max-width: 600px; height: auto; aspect-ratio: 3 / 1; border: 2px dashed var(--line); border-radius: 10px; background: #fff; touch-action: none; display: block; }
.signature-img { max-width: 320px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.signature-form { display: grid; gap: .7rem; margin-top: 1rem; }
.quote-box tr.current { background: var(--accent-soft); }
.quote-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.quote-col { border: 1px solid var(--line); border-radius: 10px; padding: .8rem; }
.quote-total { font-size: 1.1rem; text-align: right; }
.rgpd-dl { display: grid; grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr); gap: .2rem 1rem; margin: .3rem 0 .8rem; padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.rgpd-dl dt { color: var(--muted); }
.rgpd-dl dd { margin: 0; overflow-wrap: anywhere; }
@media print { .no-print { display: none !important; } }
.reminder-type { border: 1px solid var(--line); border-radius: 10px; padding: .6rem 1rem; margin: 0 0 .8rem; }
.reminder-type legend { display: flex; flex-wrap: wrap; gap: .2rem .8rem; align-items: baseline; padding: 0 .3rem; }
.reminder-client .check { display: flex; margin: .2rem 0; }
.reminder-types { margin: .5rem 0 .3rem 1.2rem; }

/* Prise de rendez-vous en ligne (page publique) */
.booking-page { background: var(--bg, #f5f3ee); }
.booking-main { max-width: 760px; margin: 0 auto; padding: 1rem 16px 3rem; }
.booking-head { display: flex; gap: 1rem; align-items: center; margin: .5rem 0 1rem; }
.booking-head h1 { margin: 0; font-size: 1.4rem; }
.booking-head p { margin: .2rem 0 0; }
.booking-logo { width: 56px; height: auto; }
.booking-form fieldset { border: 0; padding: 0; margin: 0 0 1.2rem; }
.booking-form legend { font-weight: 700; margin-bottom: .5rem; }
.booking-choices, .booking-slots { display: flex; flex-wrap: wrap; gap: .5rem; }
.booking-choice input, .booking-slot input { position: absolute; opacity: 0; pointer-events: none; }
.booking-choice span, .booking-slot span { display: inline-flex; flex-direction: column; padding: .6rem .9rem; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--surface, #fff); }
.booking-choice small { color: var(--muted); }
.booking-choice input:checked + span, .booking-slot input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.booking-choice input:checked + span small { color: inherit; }
.booking-choice input:focus-visible + span, .booking-slot input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.booking-day { font-size: 1rem; padding: .5rem; min-width: 14rem; }
.booking-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.booking-done h2 { color: var(--ok); }
.booking-actions { display: flex; gap: .4rem; margin-top: .3rem; }
.booking-hours input[type=time] { width: 7rem; }

/* SMS */
.sms-providers { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1rem; }
.sms-provider.active { border-color: var(--accent); }
.sms-qr { float: right; width: 9rem; margin: 0 0 .5rem 1rem; text-align: center; }
.sms-qr div { background: #fff; border-radius: 8px; padding: .2rem; }
.sms-qr small { color: var(--muted); font-size: .75rem; }
.sms-strategy { margin-top: 1.5rem; }
.sms-config .check { display: flex; margin: .3rem 0; }
.sms-client textarea { width: 100%; }
.sms-client .actions { display: flex; justify-content: space-between; align-items: center; margin-top: .4rem; }
@media (max-width: 700px) { .sms-qr { float: none; margin: 0 auto .5rem; } }
.rx-scanner.dragging { outline: 3px dashed var(--accent); outline-offset: -6px; }
.rx-pages { align-items: center; }

/* Photo du client sur sa fiche (+ remarque visible dans Coordonnées) */
.photo-box { position: relative; }
.photo-open { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 8px; }
.page-head .who img.client-photo, .client-photo.empty { width: 96px; height: 128px; }
.client-photo.empty { display: flex; align-items: center; justify-content: center; border: 2px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: .9rem; background: var(--surface-2); }
.photo-menu { position: absolute; z-index: 30; top: calc(100% + .4rem); left: 0; width: min(92vw, 560px); box-shadow: 0 10px 30px rgba(0, 0, 0, .2); }
.photo-menu[hidden], .photo-camera-view[hidden] { display: none; }
.photo-menu h3 { margin-top: 0; }
.photo-camera-view video { display: block; width: 100%; max-height: 60vh; border-radius: 8px; background: #000; margin-top: .8rem; }
.client-note { display: block; width: 100%; text-align: left; margin-top: .8rem; padding: .6rem .8rem; border: 1px solid #f0d36a; border-left: 4px solid #e0b400;
  border-radius: 8px; background: #fff8d6; color: #4a3b00; font: inherit; white-space: normal; cursor: pointer; }
.client-note strong { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; margin-bottom: .2rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .client-note, :root[data-theme="auto"] .client-note { background: #3a3110; border-color: #6b5a14; color: #f5e7b0; } }
:root[data-theme="fonce"] .client-note { background: #3a3110; border-color: #6b5a14; color: #f5e7b0; }

/* Lecture complète de l'ordonnance : données du patient à reporter sur la fiche client */
.rx-client { margin-top: .8rem; border-top: 1px solid var(--line); padding-top: .6rem; }
.rx-client table { width: 100%; }

/* Parcours client : barre des 5 étapes, widget, choix commande / devis */
.parcours-bar { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; padding: 0; margin: 0 0 1rem; counter-reset: none; }
.parcours-bar li { flex: 1 1 8rem; display: flex; align-items: center; gap: .5rem; padding: .55rem .8rem; border-radius: 10px;
  background: var(--surface-2); color: var(--muted); font-weight: 500; }
.parcours-bar li a { display: flex; align-items: center; gap: .5rem; color: inherit; text-decoration: none; }
.parcours-bar li span { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: var(--line); color: var(--ink); font-size: .85rem; flex: none; }
.parcours-bar li.done { color: var(--ok); background: var(--ok-soft); }
.parcours-bar li.done span { background: var(--ok); color: #fff; }
.parcours-bar li.current { background: var(--accent); color: var(--accent-ink); }
.parcours-bar li.current span { background: #fff; color: var(--accent); }
.widget-parcours { display: flex; gap: .6rem; align-items: stretch; }
.widget-parcours a.button { display: flex; align-items: center; justify-content: center; min-height: 3.6rem; box-sizing: border-box; text-align: center; }
.widget-parcours a.big-button { flex: 3 1 0; }
.widget-parcours a.small-client { flex: 1 1 0; font-size: .9rem; }
.parcours-choice .buttons { display: flex; flex-wrap: wrap; gap: .8rem; }
@media (max-width: 640px) { .parcours-bar li { flex: 1 1 auto; padding: .35rem .55rem; font-size: .9rem; } }

/* Carte d'identité insérée n'importe où : petit message en bas de l'écran */
.eid-toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 50; background: var(--ink); color: var(--surface);
  padding: .7rem 1.1rem; border-radius: 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); max-width: min(92vw, 520px); text-align: center; }

/* Mon compte : tuiles par groupe, une page par réglage */
.account-group { margin: 1.4rem 0 .6rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.account-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .8rem; }
.account-tile { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: .8rem; row-gap: .4rem; align-items: center;
  padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); }
.account-tile:hover { border-color: var(--accent); text-decoration: none; }
.account-tile-icon { font-size: 1.6rem; grid-row: 1 / span 2; }
.account-tile-text { display: flex; flex-direction: column; }
.account-tile-text small { color: var(--muted); }
.account-tile .badge { justify-self: start; grid-column: 2; }
.account-narrow { max-width: 520px; }
.eid-update { border-left: 4px solid var(--accent); }
.eid-update ul { margin: .2rem 0 .6rem; padding-left: 1.2rem; }

/* Signature MyOpticalSuite sous le nom du magasin (casse d'origine, « Optical » mis en avant). */
.brand .mos-mark { display: inline; white-space: nowrap; text-transform: none; letter-spacing: 0; }
.mos-mark b { font-weight: 800; font-size: 1.15em; }

/* Réception de marchandise : une carte par ligne du bon, couleur selon la proposition */
.rec-line { border-left: 4px solid var(--line); margin: 0 0 .75rem; min-width: 0; }
.rec-line.rec-ok { border-left-color: var(--ok); }
.rec-line.rec-warn { border-left-color: var(--warn); }
.rec-line.rec-info { border-left-color: var(--accent); }
.rec-line.rec-muted { opacity: .8; }
.rec-head { display: flex; flex-wrap: wrap; gap: .4rem .75rem; align-items: baseline; margin-bottom: .6rem; }
.rec-action { display: block; margin-bottom: .6rem; }
.rec-action select { width: 100%; }
.rec-fields { margin-top: .4rem; }
.rec-line[data-action="ignore"] .rec-fields, .rec-line[data-action^="link"] .rec-fields { display: none; }

/* Articles sans prix : progression de la recherche */
.price-progress { margin: .75rem 0 .25rem; display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.price-progress progress { width: min(320px, 100%); }
.price-log { margin: .25rem 0 0; padding-left: 1.2rem; font-size: .9rem; }

/* Photos des montures */
.frame-photo { display: grid; gap: .6rem; }
.frame-current { max-width: min(420px, 100%); border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.frame-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.frame-pick { display: flex; flex-direction: column; gap: .3rem; padding: .4rem; height: auto; white-space: normal; }
.frame-pick img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; border-radius: 6px; }
.frame-pick small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.frame-take { position: relative; }

/* Aide au choix de monture */
.face-zone { display: grid; gap: .6rem; margin-bottom: .75rem; }
.face-canvas { max-width: min(360px, 100%); border-radius: 8px; border: 1px solid var(--line); }
.advisor-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.advisor-card { border: 1px solid var(--line); border-radius: 10px; padding: .8rem; display: flex; flex-direction: column; gap: .4rem; background: var(--surface); }
.advisor-card img, .advisor-nophoto { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; border-radius: 6px; }
.advisor-nophoto { display: grid; place-items: center; color: var(--muted); border: 1px dashed var(--line); }
.advisor-card h3 { margin: .2rem 0 0; font-size: 1.05rem; }
.advisor-card p { margin: 0; }
.advisor-price { font-size: 1.25rem; font-weight: 700; }
.advisor-why { color: var(--ink-2); flex: 1; }
.advisor-card form { margin-top: .4rem; }

/* Aide au choix des verres : Good / Better / Best */
.lens-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.lens-card { border: 1px solid var(--line); border-top: 5px solid var(--line); border-radius: 10px; padding: .8rem; display: flex; flex-direction: column; gap: .35rem; background: var(--surface); }
.lens-card.lens-good { border-top-color: #8aa3b5; }
.lens-card.lens-better { border-top-color: var(--accent); }
.lens-card.lens-best { border-top-color: #c9a227; }
.lens-tier { margin: 0; text-transform: uppercase; letter-spacing: .06em; font-size: .8rem; color: var(--ink-2); }
.lens-card h3 { margin: 0; font-size: 1.05rem; }
.lens-card h4 { margin: .4rem 0 0; font-size: .85rem; color: var(--ink-2); }
.lens-card ul { margin: .1rem 0 0; padding-left: 1.1rem; }
.lens-pros li::marker { content: '✓  '; color: var(--ok); }
.lens-cons li::marker { content: '–  '; color: var(--muted); }
.lens-match { margin: 0; color: var(--accent); font-weight: 600; }
.lens-card form { margin-top: auto; padding-top: .5rem; }

/* Mode paramètres : même mise en page, fond teinté pour ne pas confondre avec le mode vente */
.mode-switch { padding: .3rem .7rem; font-size: .9rem; }
body.settings-mode { --bg: #eef1f6; }
body.settings-mode .content { background: repeating-linear-gradient(135deg, transparent 0 22px, rgba(60, 80, 120, .025) 22px 44px); }
body.settings-mode .sidebar { background: #e3e8f1; }
body.settings-mode .sidebar .disabled { display: block; padding: .5rem .75rem; color: var(--muted); opacity: .45; cursor: not-allowed; }
.sidebar .mode-label { margin: .2rem .75rem .6rem; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: #46608a; font-weight: 700; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.settings-mode .sidebar { background: #1d2533; }
  :root:not([data-theme="light"]) body.settings-mode { --bg: #151b25; }
}

/* « conseillé par … » à côté du nom du client */
.seller-note { font-size: .8rem; font-weight: 400; color: var(--muted); white-space: nowrap; }

/* Fenêtre « Contacter le client » et historique des contacts */
.contact-dialog { width: min(620px, 94vw); max-width: 94vw; box-sizing: border-box; }
.contact-dialog form { display: grid; gap: .6rem; min-width: 0; }
.contact-dialog input, .contact-dialog select, .contact-dialog textarea { box-sizing: border-box; max-width: 100%; }
.contact-channels, .contact-mode { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }
.contact-dialog textarea { width: 100%; }
.contact-bar { margin: -.5rem 0 1rem; align-items: center; }
.contact-top { margin: 0 0 .6rem; }
.contact-history { list-style: none; margin: 0; padding: 0; }
.contact-history li { border-bottom: 1px solid var(--line, #e5e5e5); }
.contact-history li:last-child { border-bottom: 0; }
.contact-history summary { display: grid; grid-template-columns: 6.4rem 5.6rem minmax(0, 1fr) auto; align-items: baseline; gap: .6rem; padding: .3rem 0; cursor: pointer; list-style: none; min-width: 0; }
.contact-history summary::-webkit-details-marker { display: none; }
.contact-history .ch-when { color: var(--muted); font-variant-numeric: tabular-nums; }
.contact-history .ch-what { font-weight: 600; }
.contact-history .ch-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-history .ch-how { color: var(--muted); }
.contact-history li.failed .ch-what, .contact-history li.failed .ch-how { color: var(--danger, #b42318); }
.contact-history .ch-full { padding: .1rem 0 .6rem 13.2rem; }
@media (max-width: 640px) { .contact-history summary { grid-template-columns: auto auto minmax(0, 1fr); } .contact-history .ch-how { display: none; } .contact-history .ch-full { padding-left: 0; } }
.nowrap { white-space: nowrap; }
.small-link { font-size: .85rem; }
/* Moyen de contact indisponible (coordonnée absente, envoi non configuré) : nettement grisé */
.contact-dialog label.unavailable { opacity: .4; cursor: not-allowed; text-decoration: line-through; text-decoration-thickness: 1px; }
.contact-dialog label.unavailable input { cursor: not-allowed; }
.contact-missing { margin: 0; font-size: .85rem; }

/* Boutons d'impression regroupés dans un cadre (en-tête de la vente) */
.print-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .3rem .4rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.print-group-label { font-size: .8rem; color: var(--muted); padding: 0 .2rem; white-space: nowrap; }
@media (max-width: 640px) { .page-head .buttons > .print-group { flex: 1 1 100%; } .print-group > .button { flex: 1 1 auto; } }

/* Annuaire des marques */
.dir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem; }
.dir-card { display: flex; gap: .8rem; align-items: center; color: inherit; text-decoration: none; margin: 0; }
.dir-card:hover { border-color: var(--accent); }
.dir-card-text { display: grid; gap: .15rem; min-width: 0; }
.dir-logo { width: 72px; height: 48px; object-fit: contain; flex: none; background: #fff; border-radius: 6px; padding: 4px; box-sizing: border-box; border: 1px solid var(--line); }
.dir-logo-empty { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); background: var(--surface-2); }
.dir-logo-big { width: 140px; height: 90px; }
.dir-logo-small { width: 48px; height: 32px; padding: 2px; }
.dir-kinds, .dir-provinces { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.dir-kinds legend, .dir-provinces legend { font-size: .9rem; color: var(--muted); margin-bottom: .3rem; }
.dir-logo-edit { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.dir-tabs { justify-content: flex-end; }
.dir-box textarea, .dir-paste textarea { width: 100%; box-sizing: border-box; }
/* Bascule Tuiles / Liste */
.view-switch { display: inline-flex; }
.view-switch .button { border-radius: 0; }
.view-switch .button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.view-switch .button:last-child { border-radius: 0 var(--radius) var(--radius) 0; margin-left: -1px; }
.dir-list td { vertical-align: middle; }
/* Centrales d'achat : fiches de conditions */
.cond-doc { border-top: 1px solid var(--line); padding-top: .6rem; margin-top: .6rem; }
.cond-doc:first-of-type { border-top: 0; margin-top: 0; }
.cond-text { white-space: pre-wrap; font: inherit; font-size: .85rem; background: var(--surface-2); padding: .6rem; border-radius: 6px; max-height: 28rem; overflow: auto; }
.cond-member { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.dir-names { line-height: 1.9; }

/* Studio de centrage : QR code pour le GSM (fiche client) et page ouverte sur le GSM */
.centrage-dialog { width: min(420px, 94vw); text-align: center; }
.centrage-dialog .actions { display: flex; justify-content: center; gap: .6rem; margin-top: .6rem; }
.centrage-qr { width: min(280px, 100%); margin: .6rem auto; background: #fff; border-radius: 8px; }
.centrage-qr svg { display: block; width: 100%; height: auto; }
.centrage-wait { display: flex; align-items: center; justify-content: center; gap: .5rem; }
.centrage-wait .spinner { display: inline-block; width: .9em; height: .9em; border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite; }
.centrage-left { color: var(--muted); font-variant-numeric: tabular-nums; }
.centrage-error { color: var(--danger); }
.centrage-mobile form { margin-top: 1rem; }
.centrage-mobile button { width: 100%; padding: .9rem; font-size: 1.05rem; }
.centrage-done { color: var(--ok); font-weight: 600; }
.centrage-alert { background: var(--danger-soft); color: var(--danger); padding: .6rem .8rem; border-radius: 8px; }
.centrage-mobile [data-studio-start] { width: 100%; padding: .9rem; font-size: 1.05rem; }

/* Studio de centrage sur le GSM : plein écran, caméra, niveau à bulle et bouton de capture */
body.studio-open { overflow: hidden; }
.studio { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: #000; color: #fff; }
.studio-view { position: relative; flex: 1; min-height: 0; }
.studio-video, .studio-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.studio-level { position: absolute; left: 50%; top: 50%; width: 132px; height: 132px; margin: -66px 0 0 -66px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .85); box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); pointer-events: none; }
.studio-target { position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, .85); }
.studio-target::before, .studio-target::after { content: ""; position: absolute; background: rgba(255, 255, 255, .6); }
.studio-target::before { left: -46px; right: -46px; top: 50%; height: 1px; }
.studio-target::after { top: -46px; bottom: -46px; left: 50%; width: 1px; }
.studio-bubble { position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%;
  background: #d93025; box-shadow: 0 0 0 2px #fff; will-change: transform; }
.studio.is-level .studio-bubble { background: #1e8e3e; }
.studio-info { position: absolute; left: 12px; right: 12px; top: calc(env(safe-area-inset-top) + 12px); margin: 0; padding: .5rem .8rem;
  border-radius: 8px; background: rgba(0, 0, 0, .6); text-align: center; font-size: .95rem; }
.studio-info:empty { display: none; }
.studio-info.error { background: rgba(185, 28, 28, .9); color: #fff; } /* la classe générale .error mettait le texte en rouge foncé */
.studio.is-dragging .studio-info { visibility: hidden; }
.studio-bar { display: flex; justify-content: center; align-items: center; min-height: 96px; padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px); }
.studio-shoot { width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff; background: #1e8e3e; cursor: pointer; transition: background .15s; }
.studio-shoot:disabled { background: #d93025; cursor: not-allowed; opacity: .9; }
.studio-after { display: flex; flex-direction: column; gap: .6rem; width: 100%; max-width: 560px; }
.studio-actions { display: flex; gap: .8rem; }
.studio-actions > * { flex: 1; display: flex; margin: 0; }
.studio-actions button { flex: 1; justify-content: center; padding: .85rem; font-size: 1rem; }
.studio-marks { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
.studio-cotes { display: flex; gap: .6rem; }
.studio-cotes label { flex: 1; display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; color: #ddd; }
.studio-cotes input { width: 100%; box-sizing: border-box; padding: .55rem .6rem; font-size: 1.05rem; border-radius: 8px; border: 1px solid #666;
  background: #1c1c1c; color: #fff; }
.studio-cotes input:invalid, .studio-cotes input.bad { border-color: #d93025; }
.studio-results { margin: 0; font-size: .95rem; text-align: center; font-variant-numeric: tabular-nums; }
.studio-results strong { color: #7ee2a8; }
.studio-results.missing { color: #ffb4ab; }

/* Studio de centrage : couleurs du canvas (lues par static/centrage-analyse.js), à accorder à la charte du magasin.
   Les lignes restent claires et douces : elles se posent sur une photo, quel que soit le thème choisi. */
.studio {
  --studio-accent: var(--accent, #1d5c63);           /* croix de montage, valeurs des badges */
  --studio-line: rgba(196, 214, 232, .78);           /* lignes de mesure (bleu-gris doux) */
  --studio-guide: rgba(255, 255, 255, .45);          /* verticale du nez, milieu du pont */
  --studio-frame: rgba(232, 214, 160, .85);          /* repères de la monture */
  --studio-handle: #ffffff;                          /* poignées */
  --studio-shadow: rgba(10, 16, 24, .45);            /* ombre portée des poignées et des badges */
  --studio-badge: rgba(255, 255, 255, .94);          /* fond des badges */
  --studio-badge-ink: #1f2933;                       /* texte des badges */
  --studio-badge-muted: #6b7280;                     /* intitulé des badges */
  --studio-aberration: rgba(214, 72, 66, .30);       /* zones de déformation du progressif (bords) */
  --studio-aberration-soft: rgba(214, 72, 66, .14);  /* … plus légère près du couloir */
  --studio-lens: rgba(255, 255, 255, .55);           /* contour du verre simulé */
}
.studio-tools { display: flex; gap: .5rem; }
.studio-toggle { flex: 1; padding: .55rem .6rem; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .08);
  color: #fff; font-size: .95rem; font-weight: 600; cursor: pointer; }
.studio-toggle[aria-pressed="true"] { background: #fff; color: var(--studio-accent); border-color: #fff; }
.studio-toggle:disabled { opacity: .45; cursor: not-allowed; }
/* Mode client : rien à toucher ni de cote brute ; seules les mesures essentielles et les boutons du mode restent. */
.studio.is-client .studio-cotes, .studio.is-client .studio-actions, .studio.is-client .studio-info { display: none; }
.studio.is-client .studio-results { font-size: 1.1rem; }
.studio-send { margin: 0; padding: .55rem .8rem; border-radius: 8px; background: rgba(185, 28, 28, .9); color: #fff; font-size: .95rem; text-align: center; }
.studio-send.is-busy { background: rgba(255, 255, 255, .12); }
.centrage-card li { margin-bottom: .6rem; }
.centrage-thanks { text-align: center; padding: 1.5rem .5rem; }
.centrage-thanks .check { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%;
  background: var(--ok-soft); color: var(--ok); font-size: 2rem; margin-bottom: .8rem; }
/* Outils du formulaire de vente : aide au choix (monture, verres) et studio de centrage */
.sale-tools { display: flex; flex-direction: column; gap: .3rem; align-self: end; }
.sale-tools-label { font-size: .85rem; color: var(--muted); }
.sale-tools .buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.centrage-result { margin: .3rem 0 0; padding: .5rem .7rem; border-radius: 8px; background: var(--ok-soft); color: var(--ok); font-weight: 500; }

/* Vente de lunettes à plusieurs équipements : un cadre par équipement (nom modifiable), articles en plus, total */
.equipments { display: flex; flex-direction: column; gap: 1rem; margin: 1rem 0; }
.equipment { border: 2px solid var(--accent); border-radius: var(--radius); padding: .8rem 1rem 1rem; margin: 0; min-width: 0; }
.eq-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .6rem; }
.eq-label { flex: 1; font-size: 1.15rem; font-weight: 700; color: var(--accent); border: 1px dashed transparent; background: transparent; padding: .25rem .4rem; border-radius: 6px; }
.eq-label:hover, .eq-label:focus { border-color: var(--line); background: var(--surface); }
.eq-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.2rem; }
.eq-foot .add-line { margin-right: auto; }
.eq-action-field { display: inline-flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--muted); }
.eq-action-field select { width: auto; min-width: 14rem; }
.eq-total-box { white-space: nowrap; }
.eq-action-amount { color: var(--ok); font-size: .9rem; }
.sale-extra { margin-top: .5rem; }
.sale-extra h3 small, .eq-view-head h2 small { color: var(--muted); font-weight: 400; }
.sale-grand-total { text-align: right; font-size: 1.1rem; margin: .8rem .4rem; }
.table-total { float: right; }
.actions .add-equipment { margin-right: auto; }
.equipment-view { border-left: 4px solid var(--accent); }
.eq-view-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; }
.eq-view-head h2 { margin: 0; }
.eq-rx { margin-top: .6rem; }
.eq-rx summary { cursor: pointer; color: var(--muted); }
tr.action-row td { color: var(--ok); }
.sale-actions-list td { vertical-align: middle; }
.annex-equipments { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 1rem; }
/* Équipement : fiche optométrique et type de vision étroits, les trois outils sur une ligne (écrans larges) */
@media (min-width: 761px) {
  .equipment > .form-grid { grid-template-columns: minmax(0, 13rem) minmax(0, 13rem) minmax(0, 1fr); }
}
@media (min-width: 1200px) {
  .equipment .sale-tools .buttons { flex-wrap: nowrap; }
  .equipment .sale-tools .button { white-space: nowrap; }
}
/* Signalements de l'annuaire */
.report-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.report-list li { padding: .5rem 0; border-bottom: 1px solid var(--line); }
.report-reply { display: inline-block; margin-top: .3rem; padding: .3rem .6rem; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 4px; }
.report-answer { display: grid; gap: .4rem; min-width: 16rem; text-align: left; }
.report-answer textarea { width: 100%; box-sizing: border-box; }
.report-summary { margin: 0 0 1rem; }

/* Options des verres : icône avec étiquette (pleine = comprise, contour = en option, cadre = choisie) */
.lens-ico { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; width: 3.2rem; min-height: 3rem; padding: .25rem .1rem .2rem;
  border-radius: 8px; border: 1.5px solid transparent; color: var(--accent); vertical-align: middle; box-sizing: border-box; }
.lens-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.lens-ico em { font-style: normal; font-size: .66rem; font-weight: 700; line-height: 1.1; color: var(--ink-2); text-align: center; max-width: 100%; overflow-wrap: anywhere; }
.lens-ico.inc { background: var(--accent-soft); }
.lens-ico.opt { border: 1.5px dashed var(--muted); color: var(--muted); }
.lens-ico.on { border-color: var(--accent); background: var(--accent-soft); }
.lens-versions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.lens-options fieldset { min-width: 0; }
@media (max-width: 700px) { .lens-versions { grid-template-columns: minmax(0, 1fr); } }
.lens-versions .form-grid { grid-template-columns: repeat(auto-fit, minmax(min(7.5rem, 100%), 1fr)); }
.lens-versions legend label.check { font-weight: 600; margin: 0; }
.lens-versions p.muted { margin: .5rem 0 0; font-size: .85rem; }
.lens-opt-family { margin-bottom: .9rem; }
.lens-opt-family legend { font-weight: 600; }
.lens-opt-family > p.muted { margin: 0 0 .5rem; font-size: .85rem; }
.lens-opt-family details { margin-top: .4rem; }
.lens-opt-family summary { cursor: pointer; color: var(--accent); font-size: .9rem; }
.lens-opt-table td { vertical-align: middle; padding-top: .3rem; padding-bottom: .3rem; }
.lens-opt-table input[type="number"] { max-width: 6.5rem; }
.lens-opt-table .lens-tag-input { max-width: 6rem; }
.lens-opt-table label.check { font-size: .85rem; color: var(--ink-2); margin: 0; white-space: nowrap; }
.lens-opt-table tr.inactive td { opacity: .55; }
.lens-level { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; padding: 1px 7px; border-radius: 999px; font-weight: 700; vertical-align: middle; }
.lens-level.opticien { background: var(--surface-2); color: var(--ink-2); }
.lens-level.atelier { background: var(--warn-soft); color: var(--warn); }
.lens-options .actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; }
.lens-copy { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.lens-option-list h2 { margin-top: 1.2rem; }
.lens-option-list h2:first-of-type { margin-top: 0; }

/* Pop-up des commandes du site (tous les postes) */
.site-alert { width: min(560px, 94vw); border-top: 6px solid var(--accent, #1d5c63); }
.site-alert-order { border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; margin: .6rem 0; }
.site-alert-order p { margin: 0 0 .6rem; }
.site-alert-msg { color: #b91c1c; font-weight: 600; margin: 0; }
.site-alert-msg:empty { display: none; }
.web-order-note { margin: .3rem 0 0; }

/* Étiquettes rondes et scanner à la caméra */
.labels-form .label-qty { width: 4.5rem; }
.labels-form .actions { align-items: center; flex-wrap: wrap; gap: .5rem; }
dialog.scanner { width: min(520px, 100vw); max-width: 100vw; max-height: 100vh; padding: .8rem; box-sizing: border-box; border: 0; border-radius: var(--radius); }
dialog.scanner::backdrop { background: rgba(0, 0, 0, .7); }
.scanner-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.scanner-view { position: relative; background: #000; border-radius: 8px; overflow: hidden; aspect-ratio: 4 / 3; }
.scanner-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-aim { position: absolute; inset: 22% 30%; border: 4px solid #e5383b; border-radius: 12px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .25); transition: border-color .15s, box-shadow .15s; }
/* Signal du scanner : rouge en attente, vert quand un code est reconnu, rouge clignotant si le code est inconnu. */
.scanner-light { width: 1.4rem; height: 1.4rem; border-radius: 50%; background: #e5383b; box-shadow: 0 0 .5rem #e5383b; flex: none; margin-right: .5rem; transition: background .15s, box-shadow .15s; }
.scanner-head strong { flex: 1; }
dialog.scanner.scan-ok .scanner-aim { border-color: #2fbf4a; box-shadow: 0 0 0 999px rgba(47, 191, 74, .28), 0 0 1.2rem #2fbf4a inset; }
dialog.scanner.scan-ok .scanner-light { background: #2fbf4a; box-shadow: 0 0 .8rem #2fbf4a; }
dialog.scanner.scan-ko .scanner-aim, dialog.scanner.scan-ko .scanner-light { animation: scan-blink .3s 3; }
@keyframes scan-blink { 50% { opacity: .2; } }
.scanner-msg { font-weight: 600; margin: .6rem 0 .3rem; }
.scanner-msg.ok { color: var(--ok); }
.scanner-log { list-style: none; margin: 0; padding: 0; max-height: 9rem; overflow: auto; font-size: .9rem; }
.scanner-log li { padding: .2rem 0; border-bottom: 1px solid var(--line); }
/* Utilitaire d'étiquettes : filtres (période, marques), tuiles photo */
.labels-filters .label-dates { grid-column: 1 / -1; align-items: center; flex-wrap: wrap; }
.label-brands { margin: .6rem 0; }
.label-brands summary { cursor: pointer; padding: .3rem 0; }
.label-brand-search { width: min(320px, 100%); margin: .4rem 0; }
.label-brand-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .2rem .8rem; max-height: 18rem; overflow: auto; padding: .3rem 0; }
.label-brand { margin-right: 0; }
.label-select { margin: .6rem 0; }
.label-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .8rem; margin: .6rem 0; }
.label-tile { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: .5rem; display: flex; flex-direction: column; gap: .3rem; }
.label-tile:has(.label-pick:not(:checked)) { opacity: .45; }
.label-tile-pick { display: flex; flex-direction: column; gap: .25rem; cursor: pointer; font-weight: normal; position: relative; }
.label-tile-pick .label-pick { position: absolute; top: .3rem; left: .3rem; width: 1.2rem; height: 1.2rem; }
.label-tile-pick img, .label-nophoto { width: 100%; aspect-ratio: 2 / 1; object-fit: contain; background: #fff; border-radius: 6px; }
.label-nophoto { display: grid; place-items: center; color: var(--muted); font-size: .85rem; background: var(--surface-2); }
.label-tile-foot { display: flex; justify-content: space-between; align-items: center; margin: 0; }
.label-tile-foot .label-qty { width: 3.5rem; }
.label-brand[hidden] { display: none; }
/* Identifier une étiquette : fiche de la monture lue, sous la caméra */
.scanner-card { display: flex; gap: .8rem; align-items: center; padding: .6rem; margin: .3rem 0 .6rem; border: 2px solid var(--accent); border-radius: var(--radius); background: var(--surface); }
.scanner-card img, .scanner-nophoto { width: 40%; max-width: 200px; aspect-ratio: 2 / 1; object-fit: contain; background: #fff; border-radius: 6px; flex: none; }
.scanner-nophoto { display: grid; place-items: center; color: var(--muted); font-size: .85rem; background: var(--surface-2); }
.scanner-card > div { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.scanner-card-name { font-size: 1.25rem; }
.scanner-card-price { font-weight: 600; }
.scanner-card .button { align-self: flex-start; margin-top: .2rem; }
.scan-big { font-size: 1.2rem; padding: .9rem 1.4rem; }
/* Articles & stock en tuiles : photo de la monture, modèle, couleur, prix et stock */
.article-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; margin: .6rem 0 1rem; }
.article-tile { display: flex; flex-direction: column; gap: .25rem; padding: .5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: inherit; text-decoration: none; }
.article-tile:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.article-tile img, .article-nophoto { width: 100%; aspect-ratio: 2 / 1; object-fit: contain; background: #fff; border-radius: 6px; }
.article-nophoto { display: grid; place-items: center; color: var(--muted); font-size: .85rem; background: var(--surface-2); }
.article-tile strong { color: var(--accent); }
.article-tile-foot { display: flex; justify-content: space-between; margin-top: auto; padding-top: .2rem; }
/* Photo de l'ordonnance gardée avec la mesure */
.rx-photo img { display: block; max-width: min(420px, 100%); max-height: 420px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: #fff; margin-bottom: .4rem; }
@media print { .rx-photo form { display: none; } }
/* Environnement de test : bandeau toujours visible, pour ne jamais le confondre avec la production */
.test-banner { position: sticky; top: 0; z-index: 50; background: #c2410c; color: #fff; text-align: center; padding: .45rem 1rem; font-weight: 700; border-radius: 8px; margin-bottom: 1rem; }
