: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)); }
: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; }
.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.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 { 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); }
.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 { 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; }
