:root {
  --brand: #C83E37;
  --brand-ink: #A8312B;
  --brand-soft: #FBECEA;
  --bg: #F6F5F3;
  --card: #FFFFFF;
  --ink: #25252B;
  --muted: #76757D;
  --line: #ECE9E5;
  --pos: #137A3A;
  --pos-soft: #E6F4EA;
  --neg: #B3261E;
  --neg-soft: #FCE8E6;
  --warn: #8A4B00;
  --warn-soft: #FFF2D9;
  --info-soft: #EAF1FB;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 1px 1px rgba(0,0,0,.04);
  --tabbar: 64px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .warn { color: var(--warn); }
.hidden { display: none !important; }

/* ---------- Démarrage / connexion ---------- */
.splash { min-height: 100vh; display: grid; place-content: center; text-align: center; gap: 8px; padding: 24px; }
.splash img { width: 240px; margin: 0 auto; }
/* Authentification : panneau blanc (formulaire) + panneau visuel texturé, rouge / blanc / noir. */
:root { --auth-black: #17171A; --auth-paper: #F2F1EE; --auth-pattern: rgba(23,23,26,.07); }
.auth { min-height: 100vh; width: 100%; max-width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); background: var(--card); overflow-x: clip; }
.auth form, .login .field { min-width: 0; }
.login .input { min-width: 0; width: 100%; }
.auth-pane { display: flex; flex-direction: column; min-width: 0; max-width: 100vw;
  padding-top: calc(20px + env(safe-area-inset-top, 0px)); padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.auth-brand img { height: 44px; width: auto; }
.auth-foot { margin-top: auto; padding-top: 28px; letter-spacing: .02em; }
.login { width: 100%; max-width: 400px; margin: 0 auto; padding: 8px 0 24px; }
.auth-pane .login { margin: auto; max-width: min(400px, 100%); }
.login .logo { display: block; width: 260px; margin: 8px auto 24px; }
.login h1 { font-size: 30px; line-height: 1.15; letter-spacing: -.02em; font-weight: 800; margin: 0 0 6px; color: var(--auth-black); text-wrap: balance; }
.login p { margin: 0 0 18px; }
.login .field { margin-bottom: 18px; }
.login .field > span { margin-bottom: 2px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.login .input { border: 0; border-bottom: 2px solid var(--auth-black); border-radius: 0; background: transparent; padding: 10px 0; font-size: 18px; font-weight: 600; color: var(--auth-black); }
.login .input::placeholder { font-weight: 400; color: #B7B5B0; }
.login .input:focus { outline: 0; border-bottom-color: var(--brand); box-shadow: 0 2px 0 0 var(--brand); }
.login .btn.primary { margin-top: 6px; padding: 14px 18px; font-weight: 800; font-size: 16px; border: 2px solid var(--auth-black); border-radius: 10px;
  background: var(--brand); color: #fff; box-shadow: 4px 4px 0 0 var(--auth-black); transition: transform .12s, box-shadow .12s; }
.login .btn.primary:hover { background: var(--brand-ink); }
.login .btn.primary:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 0 var(--auth-black); }
.login .btn.primary:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
.login a { color: var(--auth-black); font-weight: 600; text-underline-offset: 3px; }
.login a:hover { color: var(--brand-ink); }

.auth-visual { display: none; position: relative; overflow: hidden; background: var(--auth-paper);
  background-image: linear-gradient(135deg, var(--auth-pattern) 1px, transparent 1px), linear-gradient(45deg, var(--auth-pattern) 1px, transparent 1px);
  background-size: 28px 28px; }
.auth-visual::after { content: ""; position: absolute; inset: auto -120px -160px auto; width: 460px; height: 460px; border-radius: 50%; background: var(--brand); opacity: .9; }
.auth-card { position: absolute; border-radius: 18px; background: #fff; box-shadow: 0 18px 50px rgba(23,23,26,.14); z-index: 1; }
.auth-card-balance { left: 14%; top: 30%; width: min(360px, 60%); padding: 26px 26px 22px; background: var(--auth-black); color: #fff; z-index: 1; }
.auth-chip { width: 44px; height: 28px; border-radius: 8px; background: #fff; position: relative; margin-bottom: 26px; }
.auth-chip span { position: absolute; right: 5px; top: 5px; width: 18px; height: 18px; border-radius: 50%; background: var(--brand); }
.auth-balance { font-size: 30px; font-weight: 800; letter-spacing: -.01em; }
.auth-balance small { font-size: 14px; font-weight: 600; opacity: .7; }
.auth-balance-label { opacity: .75; margin-top: 2px; }
.auth-dots { margin-top: 28px; font-size: 13px; letter-spacing: .12em; opacity: .8; display: flex; gap: 18px; }
.auth-dots::before { content: "★★★★  ★★★★"; color: var(--brand); letter-spacing: .08em; }
.auth-card-chart { left: 6%; top: 56%; width: 180px; padding: 16px 16px 12px; z-index: 2; }
.auth-bars { display: flex; align-items: flex-end; gap: 8px; height: 56px; }
.auth-bars i { flex: 1; height: var(--h); border-radius: 4px; background: var(--auth-black); }
.auth-bars i.hi { background: var(--brand); box-shadow: 0 6px 14px rgba(200,62,55,.35); }
.auth-days { display: flex; justify-content: space-between; font-size: 9px; color: var(--muted); margin-top: 8px; }
.auth-days b { color: var(--auth-black); }
.auth-card-ops { right: 8%; top: 18%; width: 270px; padding: 18px 20px; z-index: 2; }
.auth-ops-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.auth-kebab { color: var(--auth-black); font-weight: 700; }
.auth-ops-title { font-size: 19px; font-weight: 700; margin: 2px 0 14px; color: var(--auth-black); }
.auth-ops-row { display: flex; align-items: center; justify-content: space-between; }
.auth-avatars { display: flex; }
.auth-avatars i { width: 36px; height: 36px; border-radius: 50%; border: 2px solid #fff; margin-right: -10px; display: grid; place-items: center;
  font-style: normal; font-size: 12px; font-weight: 700; color: #fff; background: var(--auth-black); }
.auth-avatars i:nth-child(2) { background: var(--brand); } .auth-avatars i:nth-child(3) { background: #6B6B72; }
.auth-plus { width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; }
@media (min-width: 900px) {
  .auth { grid-template-columns: minmax(420px, 46%) minmax(0, 1fr); }
  .auth-pane { padding-left: clamp(32px, 7vw, 96px); padding-right: 48px; }
  .auth-pane .login { margin-left: 0; margin-right: 0; }
  .auth-visual { display: block; }
}
@media (prefers-reduced-motion: reduce) { .login .btn.primary { transition: none; } }

/* ---------- Structure ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line);
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px; display: flex; align-items: center; gap: 12px; }
.topbar img { height: 30px; }
.topbar .title { flex: 1; font-weight: 650; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #B9B9C2; }
.live.on::before { background: #1FA552; box-shadow: 0 0 0 3px rgba(31,165,82,.18); }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--brand-soft); color: var(--brand-ink);
  font-weight: 700; font-size: 14px; cursor: pointer; flex: none; }
.user-dropdown { position: relative; margin-left: auto; flex: none; }
.user-dropdown > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; border-radius: 24px; }
.user-dropdown > summary::-webkit-details-marker { display: none; }
.user-dropdown > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; }
.topbar .user-dropdown .avatar { display: grid; place-items: center; }
.user-dropdown > summary > svg { width: 16px; height: 16px; transform: rotate(90deg); color: var(--muted); }
.user-name { display: none; }
.user-dropdown-panel { position: absolute; right: 0; top: calc(100% + 12px); width: 260px; max-width: calc(100vw - 32px);
  padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.12); }
.user-dropdown-info { display: grid; gap: 3px; padding: 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; overflow-wrap: anywhere; }
.user-dropdown-info span { font-size: 12px; color: var(--muted); }
.user-dropdown-panel button { display: block; width: 100%; padding: 12px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; font-size: 14px; }
.user-dropdown-panel button:hover, .user-dropdown-panel button:focus-visible { background: var(--brand-soft); }
.user-dropdown-panel .user-signout { color: var(--brand-ink); }
@media (min-width: 1000px) {
  .user-name { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
}
.banner { padding: 8px 16px; font-size: 13px; text-align: center; }
.banner.demo { background: var(--warn-soft); color: var(--warn); }
.banner.offline { background: var(--neg-soft); color: var(--neg); }
main { max-width: 760px; margin: 0 auto; padding: 16px 16px calc(var(--tabbar) + 24px + env(safe-area-inset-bottom)); }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line);
  display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { flex: 1; max-width: 150px; height: var(--tabbar); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 550; position: relative; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.active { color: var(--brand); }
.tabbar .badge { position: absolute; top: 7px; left: calc(50% + 6px); background: var(--brand); color: #fff; border-radius: 9px;
  font-size: 11px; min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; }

/* ---------- Blocs ---------- */
.section { margin: 0 0 20px; }
.section > h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px 4px; font-weight: 650;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 16px; }
.hero { background: var(--brand); color: #fff; border-radius: var(--radius); padding: 18px 18px 16px; margin-bottom: 16px; }
.hero .label { opacity: .9; font-size: 14px; }
.hero .big { font-size: 32px; font-weight: 750; letter-spacing: -.01em; margin: 2px 0; }
.hero .sub { font-size: 13px; opacity: .9; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 20px; }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; min-width: 0; }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi .value { font-size: 22px; font-weight: 750; margin-top: 4px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; }
.kpi .sub { font-size: 12px; color: #9A9AA3; margin-top: 2px; }
/* Alertes de solde : un bloc compact dépliable */
details.alertbox { border-radius: 12px; margin-bottom: 14px; font-size: 14px; }
details.alertbox.warn { background: var(--warn-soft); color: var(--warn); }
details.alertbox.bad { background: var(--neg-soft); color: var(--neg); }
details.alertbox > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 11px 14px; }
details.alertbox > summary::-webkit-details-marker { display: none; }
details.alertbox > summary svg { width: 18px; height: 18px; flex: none; transform: rotate(180deg); }
details.alertbox { border: 1px solid rgba(138,75,0,.18); }
details.alertbox > summary .more { margin-left: auto; font-size: 13px; color: var(--ink); opacity: .75; }
details.alertbox > summary::after { content: "›"; font-size: 20px; line-height: 1; transform: rotate(90deg); transition: transform .15s; }
details.alertbox[open] > summary::after { transform: rotate(-90deg); }
.alertlist { padding: 0 14px 12px; display: grid; gap: 6px; }
.alertlist > div { display: flex; justify-content: space-between; gap: 10px; color: var(--ink); background: rgba(255,255,255,.6); border-radius: 8px; padding: 7px 10px; }
.alertlist > div b { font-weight: 600; } .alertlist .btn { justify-self: start; margin-top: 2px; }

.list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); min-height: 56px;
  width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
.row:first-child { border-top: 0; }
button.row, a.row { cursor: pointer; color: inherit; text-decoration: none; }
button.row:active, a.row:active { background: #F6F6F8; }
.row .main { flex: 1; min-width: 0; }
.row > svg { width: 18px; height: 18px; color: #A0A0AA; flex: none; }
.row .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .s { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .end { text-align: right; flex: none; }
.row .amt { font-weight: 650; }
.row.cancelled .t, .row.cancelled .amt { text-decoration: line-through; color: var(--muted); }
.ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: 13px; font-weight: 700; }
.ico svg { width: 20px; height: 20px; }
.ico.in { background: var(--pos-soft); color: var(--pos); }
.ico.out { background: var(--neg-soft); color: var(--neg); }
.ico.rc { background: var(--brand-soft); color: var(--brand-ink); }
.ico.neu { background: #EEEEF2; color: #4A4A55; }
.empty { padding: 24px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.daytitle { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin: 16px 4px 6px; font-weight: 600; }

.tag { display: inline-block; font-size: 11.5px; font-weight: 650; padding: 2px 7px; border-radius: 6px; background: #EEEEF2; color: #4A4A55; vertical-align: 1px; }
.tag.red { background: var(--neg-soft); color: var(--neg); }
.tag.green { background: var(--pos-soft); color: var(--pos); }
.tag.amber { background: var(--warn-soft); color: var(--warn); }
.tag.brand { background: var(--brand-soft); color: var(--brand-ink); }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; margin-bottom: 8px; font-size: 14px; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.bad { background: var(--neg-soft); color: var(--neg); }
.alert.ok { background: var(--pos-soft); color: var(--pos); }
.alert.info { background: var(--info-soft); color: #1F4E8C; }
.alert a { color: inherit; font-weight: 650; }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); font-weight: 650; cursor: pointer; text-decoration: none; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:disabled { opacity: .5; }
.btn.danger { color: var(--neg); border-color: #F0C4C0; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--brand-ink); }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn svg { width: 20px; height: 20px; }
.actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 20px; }
.action { background: var(--card); border: 0; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 8px; display: flex; flex-direction: column;
  align-items: center; gap: 6px; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--ink); text-decoration: none; text-align: center; }
.action svg { width: 20px; height: 20px; color: var(--brand); flex: none; padding: 9px; box-sizing: content-box; background: var(--brand-soft); border-radius: 50%; }
.actions.four, .actions.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.actions.two .action { font-size: 13.5px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; } }

.prod { border: 0; border-radius: var(--radius); box-shadow: var(--shadow); background: var(--card); padding: 14px 12px; min-height: 76px;
  text-align: left; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; font-weight: 650; }
.prod .dir { font-size: 12px; font-weight: 650; }
.prod.in { border-left: 4px solid var(--pos); } .prod.in .dir { color: var(--pos); }
.prod.out { border-left: 4px solid var(--neg); } .prod.out .dir { color: var(--neg); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -2px 8px; scrollbar-width: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600;
  cursor: pointer; white-space: nowrap; min-height: 40px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .num { font-weight: 500; opacity: .8; margin-left: 4px; }

/* ---------- Formulaires ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.input, select.input, textarea.input { width: 100%; min-height: 48px; border: 1px solid #CFCFD6; border-radius: 12px; padding: 10px 12px; background: #fff; }
.input:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
.input.money { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
textarea.input { min-height: 72px; resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 550; }
.check input { width: 22px; height: 22px; accent-color: var(--brand); }
.calc { background: #F6F6F8; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.calc .line { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; padding: 3px 0; }
.calc .line.total { font-size: 18px; font-weight: 750; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }
.search { position: relative; margin-bottom: 12px; }
.search .input { padding-left: 42px; }
.search svg { position: absolute; left: 12px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--muted); }
.filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.filters .input { min-height: 44px; font-size: 15px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 9px 10px; border-top: 1px solid var(--line); text-align: left; }
.tbl th { font-size: 12px; color: var(--muted); font-weight: 650; border-top: 0; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl tr.total td { font-weight: 700; }
.scrollx { overflow-x: auto; }

/* ---------- Feuille (fenêtre du bas) ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(20,20,25,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s ease-out; }
.sheet { background: var(--card); width: 100%; max-width: 560px; max-height: 92vh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column;
  animation: up .18s ease-out; }
@media (min-width: 640px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 18px; } }
.sheet header { display: flex; align-items: center; gap: 8px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.sheet header h3 { flex: 1; margin: 0; font-size: 18px; }
.sheet .close { width: 40px; height: 40px; border-radius: 50%; border: 0; background: #F0F0F3; cursor: pointer; font-size: 20px; line-height: 1; }
.sheet .body { padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet .foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; gap: 10px; }
.sheet .foot .btn { flex: 1; }
@keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-weight: 550; overflow-wrap: anywhere; }

#toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: #1F1F24; color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; max-width: 520px; box-shadow: 0 6px 20px rgba(0,0,0,.2);
  animation: up .2s ease-out; }
.toast.ok { background: #145C2F; } .toast.bad { background: #9B1C16; }
/* ---------- Bouton central « + » (téléphone) ---------- */
.tabbar a.plus span.round { width: 46px; height: 46px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center;
  margin-top: -14px; box-shadow: 0 4px 12px rgba(229,43,47,.35); }
.tabbar a.plus span.round svg { width: 26px; height: 26px; }
.tabbar a.plus { color: var(--brand-ink); }
.newop { display: none; }
.agsel { width: auto; max-width: 170px; min-height: 36px; padding: 4px 8px; font-size: 14px; border-radius: 10px; flex: none; }
.agtag { flex: none; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 420px) { .topbar .live { display: none; } .agsel { max-width: 120px; font-size: 13px; } }
/* Téléphone : le logo laisse la place au titre quand le choix d'agence est affiché. */
@media (max-width: 999px) { .topbar:has(.agsel) > img { display: none; } }
/* ---------- Présentation « maquette » : titres, chiffres, actions rapides, comptes ---------- */
.topbar .tt { flex: 1; min-width: 0; }
.topbar .tt .title { display: block; }
.topbar .tsub { display: none; }
.section > h2 { font-size: 16px; text-transform: none; letter-spacing: 0; color: var(--ink); font-weight: 700; margin: 0 0 10px 2px; }
.section > h2 .small { font-weight: 500; }
.section { margin-bottom: 26px; }
.kpis.two { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px; }
.kpi { padding: 16px 18px; border: 1px solid var(--line); box-shadow: none; }
.kpi.accent { border-top: 3px solid var(--brand); }
.kpi .value .unit { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.kpi .sub { margin-top: 6px; }
.actions.quick { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.actions.quick .action { flex-direction: column; align-items: flex-start; justify-content: flex-start; text-align: left; gap: 14px;
  padding: 16px; min-height: 96px; font-size: 14px; font-weight: 600; border: 1px solid var(--line); box-shadow: none; }
.actions.quick .action svg, .actions.two .action svg { border-radius: 10px; }
.list.acccard, .list { border: 1px solid var(--line); box-shadow: none; }
details.accgrp > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; border-top: 1px solid var(--line); font-size: 15px; }
details.accgrp:first-child > summary { border-top: 0; }
details.accgrp > summary::-webkit-details-marker { display: none; }
details.accgrp > summary .sum { font-weight: 700; }
details.accgrp > summary::after { content: "›"; color: var(--muted); font-size: 20px; line-height: 1; transform: rotate(90deg); transition: transform .15s; margin-left: -4px; }
details.accgrp[open] > summary::after { transform: rotate(-90deg); }
details.accgrp > summary > span:first-child { flex: 1; min-width: 0; }
details.accgrp[open] > summary { background: #FAFAF9; }
.cnt { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 6px; background: #EFEFEC; color: var(--muted);
  font-size: 11.5px; font-weight: 600; margin-left: 6px; vertical-align: 1px; }
.ico.av { border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); font-size: 15px; font-weight: 600; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 20px; text-align: center; border: 1px solid var(--line); box-shadow: none; }
.empty-state svg { width: 22px; height: 22px; color: var(--muted); margin-bottom: 4px; }
.empty-state span { color: var(--muted); font-size: 14px; }
.empty-state a { margin-top: 10px; font-size: 14px; }
a.link2.red { color: var(--brand-ink); font-weight: 600; }
@media (min-width: 1000px) {
  .topbar { position: static; background: transparent; border-bottom: 0; padding: 28px 28px 6px; align-items: flex-start; max-width: 960px; }
  .topbar .title { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
  .topbar .tsub { display: block; font-size: 14px; color: var(--muted); margin-top: 2px; }
  main { max-width: 960px; padding-top: 16px; }
  .kpi .value { font-size: 30px; }
  .sidebar nav details.navfold { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 6px; }
  .sidebar nav details.navfold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; border-radius: 10px; font-weight: 500; font-size: 14.5px; }
  .sidebar nav details.navfold > summary::-webkit-details-marker { display: none; }
  .sidebar nav details.navfold > summary::after { content: "›"; font-size: 18px; color: var(--muted); transform: rotate(90deg); transition: transform .15s; }
  .sidebar nav details.navfold[open] > summary::after { transform: rotate(-90deg); }
  .sidebar nav details.navfold > summary:hover { background: #F4F4F6; }
}
/* ---------- Maquette AYAEL (référence) : barre du haut, titre, grilles ---------- */
.topbar .crumb { display: none; }
.pagehead { display: none; }
.day { font-size: 12px; color: var(--muted); border: 1px solid var(--line); background: var(--card); padding: 7px 11px; border-radius: 8px; white-space: nowrap; }
.section > h2 { font-size: 15px; font-weight: 600; }
.kpi .label { font-size: 12px; }
.kpi .value { font-weight: 650; letter-spacing: -.02em; }
.kpi .value .unit { font-size: 12px; font-weight: 400; }
.actions.quick .action { font-size: 13px; font-weight: 500; gap: 12px; padding: 16px 12px; }
.actions.quick .action svg, .actions.two .action svg { width: 18px; height: 18px; padding: 8px; border-radius: 9px; }
.list .row { padding: 13px 15px; }
details.accgrp > summary { font-size: 14px; }
.cols2 { display: block; }
@media (min-width: 800px) {
  .kpis.stats { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 11px; }
  .actions.quick { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
  .cols2 { display: grid; grid-template-columns: 1.07fr 1fr; gap: 0 18px; align-items: start; }
}
@media (min-width: 1000px) {
  .topbar { position: sticky; background: var(--card); border-bottom: 1px solid var(--line); padding: 14px 28px; align-items: center; max-width: none; }
  .topbar .tt .title { display: none; }
  .topbar .crumb { display: block; font-size: 13px; color: var(--muted); }
  .topbar .agsel, .topbar .agtag { border: 1px solid var(--line); background: var(--card); border-radius: 8px; font-size: 13px; }
  .pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1240px; margin: 0 auto; padding: 26px 28px 0; }
  .pagehead h1 { font-size: 26px; font-weight: 650; letter-spacing: -.03em; margin: 0; }
  .pagehead p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
  .sidebar nav a { font-size: 13.5px; padding: 9px 11px; border-radius: 8px; }
  .sidebar nav .sep { font-size: 10.5px; letter-spacing: .12em; margin: 20px 11px 5px; }
  .sidebar .hero-cta { border-radius: 10px; box-shadow: 0 5px 12px rgba(200,62,55,.13); }
}
/* Lien secondaire : discret (le rouge reste pour les actions importantes). */
a.link2 { text-transform: none; letter-spacing: 0; color: var(--ink); font-weight: 600; text-decoration: none; }
a.link2:hover { text-decoration: underline; }
/* Choix du produit (Nouvelle opération) : bouton qui ouvre le menu en tuiles. */
.pickbtn { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; cursor: pointer; font-weight: 600; }
.pickbtn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pickbtn span.muted { font-weight: 500; }
.pickbtn svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.picker .action { min-height: 96px; justify-content: center; }
.picker .action small { font-weight: 500; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
/* Blocs repliables (soldes par famille, filtres) : le total se voit, le détail au toucher. */
details.fold { margin-bottom: 14px; }
details.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; font-weight: 650; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary > span:first-child { flex: 1; min-width: 0; }
details.fold > summary .sum { font-variant-numeric: tabular-nums; white-space: nowrap; }
details.fold > summary::after { content: "›"; font-size: 22px; line-height: 1; color: var(--muted); transform: rotate(90deg); transition: transform .15s; }
details.fold[open] > summary::after { transform: rotate(-90deg); }
details.fold[open] > summary { border-radius: var(--radius) var(--radius) 0 0; }
details.fold > .list { border-top-left-radius: 0; border-top-right-radius: 0; margin-top: 0; }
details.filt { margin-bottom: 10px; }
details.filt > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px;
  color: var(--brand-ink); padding: 6px 2px; }
details.filt > summary::-webkit-details-marker { display: none; }
details.filt[open] > summary { margin-bottom: 8px; }
.hero-cta { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 64px; border: 0; border-radius: var(--radius);
  background: var(--brand); color: #fff; font-size: 18px; font-weight: 700; cursor: pointer; margin-bottom: 16px; box-shadow: 0 4px 14px rgba(229,43,47,.25); }
.hero-cta svg { width: 26px; height: 26px; }
.kbd { display: inline-block; font: 600 11px/1 ui-monospace, Consolas, monospace; padding: 3px 5px; border-radius: 5px; background: rgba(255,255,255,.25); margin-left: 4px; }
.btn .kbd { background: rgba(0,0,0,.08); }
.btn.primary .kbd { background: rgba(255,255,255,.25); }

/* ---------- Menu latéral (ordinateur) ---------- */
.sidebar { display: none; }
.newop-fab { position: fixed; right: max(16px, env(safe-area-inset-right));
  bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); z-index: 30;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px;
  padding: 14px 20px; border: 0; border-radius: 999px; background: var(--brand); color: #fff;
  font-size: 15px; font-weight: 650; cursor: pointer; box-shadow: 0 6px 20px rgba(200,62,55,.28); }
.newop-fab svg { width: 22px; height: 22px; flex: none; }
.newop-fab:hover { background: var(--brand-ink); }
.newop-fab:focus-visible { outline: 3px solid var(--brand-ink); outline-offset: 4px; }
.only-desktop, .desk-inline { display: none; }
@media (min-width: 1000px) { .desk-inline { display: inline; } }
@media (min-width: 1000px) {
  .sidebar { display: flex; flex-direction: column; position: fixed; left: 0; top: 0; bottom: 0; width: 248px; background: var(--card);
    border-right: 1px solid var(--line); padding: 16px 12px; z-index: 25; overflow-y: auto; }
  .sidebar .logo { width: 130px; height: auto; margin: 4px 8px 18px; }
  .sidebar .hero-cta { min-height: 50px; font-size: 15px; margin-bottom: 14px; white-space: nowrap; gap: 8px; }
  .sidebar .hero-cta svg { width: 22px; height: 22px; }
  .sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 10px; color: var(--ink); text-decoration: none;
    font-weight: 500; font-size: 14.5px; position: relative; }
  .sidebar nav a svg { width: 20px; height: 20px; color: var(--muted); }
  .sidebar nav a:hover { background: #F4F4F6; }
  .sidebar nav a.active { background: var(--brand-soft); color: var(--brand-ink); }
  .sidebar nav a.active svg { color: var(--brand); }
  .sidebar nav .sep { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 12px 4px; font-weight: 650; }
  .sidebar nav .sep:first-child { margin-top: 4px; }
  .sidebar nav .badge { margin-left: auto; background: var(--brand); color: #fff; border-radius: 9px; font-size: 11px; min-width: 20px; height: 20px;
    padding: 0 6px; display: grid; place-items: center; }
  .sidebar .who { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px 8px 0; border-top: 1px solid var(--line); cursor: pointer;
    background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
  .sidebar .who .t { font-weight: 600; font-size: 14px; } .sidebar .who .s { font-size: 12px; color: var(--muted); }
  .shell { margin-left: 248px; }
  .tabbar { display: none; }
  .newop-fab { right: 28px; bottom: 24px; }
  .topbar { padding: 12px 28px; }
  .topbar > img { display: none; }
  .topbar .title { font-size: 20px; }
  .topbar .avatar { display: none; }
  main { max-width: 1240px; padding: 24px 28px 48px; }
  #toast-root { bottom: 24px; left: 248px; }
  .cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 24px; align-items: start; }
  .only-mobile { display: none !important; }
  .only-desktop { display: block; }
  .actions.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .action { flex-direction: row; justify-content: flex-start; padding: 12px 14px; gap: 12px; text-align: left; }
  .kpi .value { font-size: 26px; }
  .sheet { max-width: 640px; }
  .sheet.wide { max-width: 1000px; }
  .vente { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
}

/* ---------- Tableau (journal sur ordinateur) ---------- */
.dtable { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 8px; }
.dtable table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dtable th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 650; padding: 10px 12px; background: #FAFAFB; border-bottom: 1px solid var(--line); }
.dtable td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.dtable tr:last-child td { border-bottom: 0; }
.dtable tbody tr { cursor: pointer; }
.dtable tbody tr:hover { background: #F8F8FA; }
.dtable .r { text-align: right; }
.dtable tr.cancelled td { color: var(--muted); }
.dtable tr.cancelled td.amt { text-decoration: line-through; }
.dtable .sub { font-size: 12.5px; color: var(--muted); }

/* ---------- Nouvelle opération ---------- */
.combo { position: relative; }
.combo .drop { margin-top: 4px; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.12); max-height: 320px; overflow-y: auto; }
.combo .opt { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; border-top: 1px solid var(--line); cursor: pointer; }
.combo .opt:first-child { border-top: 0; }
.combo .opt.hl, .combo .opt:hover { background: var(--brand-soft); }
.combo .opt .t { font-weight: 600; } .combo .opt .s { font-size: 12.5px; color: var(--muted); }
.clientcard { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--brand-soft); }
.clientcard .main { flex: 1; min-width: 0; } .clientcard .t { font-weight: 700; } .clientcard .s { font-size: 13px; color: var(--muted); }
.vline { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); }
.vline:first-child { border-top: 0; }
.vline .main { flex: 1; min-width: 0; } .vline .t { font-weight: 600; } .vline .s { font-size: 12.5px; color: var(--muted); }
.vline .x { border: 0; background: #F0F0F3; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 16px; flex: none; }
.vtotal { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; background: var(--ink); color: #fff; border-radius: 12px;
  margin: 10px 0 14px; font-weight: 700; }
.vtotal .num { font-size: 24px; }
.change { font-size: 22px; font-weight: 750; }
.panel { background: #F6F6F8; border-radius: 12px; padding: 12px; margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--muted); align-self: center; }

/* ---------- Relevé partenaire (impression A4) ---------- */
.releve { font: 10pt/1.4 Inter, "Segoe UI", Arial, sans-serif; color: #111; }
.releve img { height: 16mm; }
.releve h1 { font-weight: 400; font-size: 16pt; margin: 4mm 0 1mm; }
.releve p { color: #555; margin: 0 0 4mm; }
.releve table { width: 100%; border-collapse: collapse; font-size: 9pt; }
.releve th, .releve td { text-align: left; padding: 1.6mm 2mm; border-bottom: .2mm solid #ddd; vertical-align: top; }
.releve .r { text-align: right; white-space: nowrap; }
.releve .sub { color: #777; font-size: 8pt; }
.releve .fin { margin-top: 5mm; font-size: 12pt; color: #111; }

/* ---------- Espace partenaire ---------- */
.pcard { margin-bottom: 10px; }
.pc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.pc-big { font-size: 16px; margin-bottom: 4px; }
.pc-ref { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 18px; letter-spacing: .06em; font-weight: 650; }
.pc-acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ---------- Clients : fidélité et compte ---------- */
.clrow { display: flex; align-items: center; gap: 8px; }
.rowbtn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; background: none; border: 0; padding: 0; margin: 0;
  text-align: left; font: inherit; color: inherit; cursor: pointer; }
.rowbtn .main { flex: 1; min-width: 0; }
.clrow > .btn { flex: none; }
.tag.lvl { font-weight: 650; }
.tag.lvl.gold { background: #FBF1D3; color: #8A6400; }
.tag.lvl.silver { background: #ECEEF2; color: #4A5160; }
.tag.lvl.bronze { background: #F6E7DC; color: #8B4A1F; }
.avbox { background: #F6F6F8; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.avbox .field { margin: 8px 0 0; }

/* ---------- Reçu ---------- */
.ticket { background: #fff; color: #000; width: 300px; max-width: 100%; margin: 0 auto; padding: 14px 12px; border: 1px dashed #CFCFD6;
  font: 13px/1.35 ui-monospace, Consolas, "Courier New", monospace; }
.ticket .c { text-align: center; }
.ticket img { width: 150px; display: block; margin: 0 auto 6px; }
.ticket .co { font-weight: 700; font-size: 15px; }
.ticket hr { border: 0; border-top: 1px dashed #000; margin: 8px 0; }
.ticket .l { display: flex; justify-content: space-between; gap: 8px; }
.ticket .l > span:last-child { white-space: nowrap; }
.ticket .big { font-weight: 700; font-size: 15px; }
.ticket .x { text-decoration: line-through; }
.ticket .title { font-weight: 700; letter-spacing: .1em; }
#print-root { display: none; }

/* ---------- Bordereau (format DL 99 × 210 mm) : sobre, en gris, seul le logo en couleur ---------- */
.bd-wrap { overflow-x: auto; }
.bd { background: #fff; color: #1d1d1f; width: 99mm; min-height: 210mm; margin: 0 auto; padding: 8mm 7.5mm 6mm; box-sizing: border-box;
  display: flex; flex-direction: column; font: 300 8.6pt/1.45 Inter, "Segoe UI", Roboto, Arial, sans-serif; letter-spacing: .005em;
  border: 1px solid #E4E4E7; box-shadow: 0 2px 12px rgba(0,0,0,.05); font-variant-numeric: tabular-nums; }
.bd b { font-weight: 500; }
.bd-top { display: flex; justify-content: space-between; align-items: flex-start; }
.bd-top img { height: 12mm; width: auto; margin-left: -1mm; }
.bd-no { text-align: right; font-size: 7.4pt; color: #6e6e73; line-height: 1.6; }
.bd-no span { display: block; color: #1d1d1f; font-weight: 400; font-size: 8.4pt; letter-spacing: .06em; }
.bd-slogan { font-size: 7pt; color: #8e8e93; letter-spacing: .04em; margin-top: 1.5mm; }
.bd-title { font-weight: 300; font-size: 17pt; letter-spacing: -.01em; margin-top: 7mm; line-height: 1.15; }
.bd-sub { font-size: 7pt; text-transform: uppercase; letter-spacing: .18em; color: #8e8e93; margin-top: 1.2mm; }
.bd-block { margin-top: 5.5mm; }
.bd-cap { font-size: 6.6pt; text-transform: uppercase; letter-spacing: .16em; color: #8e8e93; padding-bottom: 1.4mm; border-bottom: .2mm solid #D1D1D6; margin-bottom: 1.6mm; }
.bd-cap2 { display: flex; justify-content: space-between; }
.bd-client { font-size: 10pt; font-weight: 400; }
.bd-muted { color: #6e6e73; }
.bd-item { padding: 1.8mm 0 2mm; border-bottom: .2mm solid #EBEBEF; break-inside: avoid; }
.bd-item.x { color: #9a9aa0; text-decoration: line-through; }
.bd-item em { font-style: normal; text-decoration: none; }
.bd-row { display: flex; justify-content: space-between; gap: 3mm; }
.bd-name { font-weight: 400; font-size: 9pt; }
.bd-val { font-weight: 400; font-size: 9pt; white-space: nowrap; }
.bd-kv { display: flex; justify-content: space-between; gap: 3mm; font-size: 7.6pt; color: #6e6e73; margin-top: .5mm; }
.bd-kv b { font-weight: 400; color: #1d1d1f; letter-spacing: .03em; text-align: right; overflow-wrap: anywhere; }
.bd-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 4mm; padding-top: 2.4mm; border-top: .35mm solid #1d1d1f; }
.bd-total span { font-size: 7pt; text-transform: uppercase; letter-spacing: .16em; color: #6e6e73; }
.bd-total b { font-size: 14pt; font-weight: 400; letter-spacing: -.01em; }
.bd-words { font-size: 7.6pt; color: #6e6e73; font-style: italic; text-align: right; margin-top: .6mm; }
.bd-pay { margin-top: 3.5mm; }
.bd-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 6mm; margin-top: auto; padding-top: 10mm; }
.bd-sign > div { font-size: 6.8pt; color: #8e8e93; text-align: center; }
.bd-sign span { display: block; height: 14mm; border-bottom: .2mm solid #AEAEB2; margin-bottom: 1.4mm; }
.bd-foot { margin-top: 5mm; text-align: center; font-size: 6.2pt; color: #8e8e93; line-height: 1.5; }
.bd-thanks { font-size: 7.6pt; color: #3a3a3c; margin-bottom: 1.2mm; }

@media print {
  body { background: #fff; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  #print-root .ticket { border: 0; margin: 0; padding: 0 2mm; width: auto; }
  #print-root.a4 .ticket { width: 120mm; margin: 0 auto; font-size: 12pt; }
  #print-root.dl .bd { border: 0; box-shadow: none; margin: 0; }
}

.spinner { width: 22px; height: 22px; border: 3px solid #DDD; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 24px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Ordinateur : tailles et graisses de la maquette (texte 14 px, titres semi-gras). */
@media (min-width: 1000px) {
  html, body { font-size: 14px; line-height: 1.5; }
  .row .t { font-size: 13.5px; font-weight: 600; }
  .row .s { font-size: 12px; }
  .row .amt { font-size: 13.5px; }
  .row { min-height: 50px; }
  .section > h2 { font-size: 14px; font-weight: 600; }
  .kpi .label { font-size: 11.5px; }
  .kpi .value { font-size: 25px !important; font-weight: 650; }
  .kpi .sub { font-size: 11.5px; }
  .actions.quick .action { font-size: 12.5px; font-weight: 500; }
  .sidebar nav a { font-size: 13px; font-weight: 500; }
  .sidebar nav .sep { font-size: 10px; }
  .sidebar .hero-cta { font-size: 14px; font-weight: 600; }
  .pagehead h1 { font-size: 25px; font-weight: 650; }
  .pagehead p { font-size: 12.5px; }
  .topbar .crumb { font-size: 12px; }
  details.accgrp > summary { font-size: 13px; }
  details.alertbox, details.alertbox > summary { font-size: 12.5px; }
  .field > span { font-size: 13px; }
  .input, select.input, textarea.input { font-size: 14px; min-height: 42px; }
  .btn { font-size: 14px; min-height: 42px; }
  .chip { font-size: 13px; min-height: 36px; padding: 6px 12px; }
  .tbl { font-size: 13px; }
}

/* Justificatifs partenaires : icône compacte, nom long autorisé à revenir à la ligne. */
a[data-piece] { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; overflow-wrap: anywhere; }
a[data-piece] > svg { width: 18px; height: 18px; flex: 0 0 18px; }


/* Solde du portail partenaire : présentation neutre et lisible. */
main:has(#neworder) .hero {
  background: #fff;
  color: #242424;
  border: 1px solid #dedee3;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
main:has(#neworder) .hero .label { color: #484852; opacity: 1; line-height: 1.5; }
main:has(#neworder) .hero .big { color: #242424; margin: 8px 0; line-height: 1.2; overflow-wrap: anywhere; }
main:has(#neworder) .hero .sub { color: #55555f; opacity: 1; line-height: 1.6; max-width: 75ch; }

/* ---------- Coquille v2 : menu latéral repliable, barre du haut, tableau de bord ---------- */
:root { --sbw: 248px; --sbw-min: 76px; --auth-black: #17171A; }
.sb-toggle, .sb-head .logo-mini { display: none; }
.topday { display: none; }
@media (min-width: 1000px) {
  .sidebar { width: var(--sbw); padding: 14px 12px 12px; transition: width .18s ease; }
  .shell { margin-left: var(--sbw); transition: margin-left .18s ease; }
  #toast-root { left: var(--sbw); }
  .sb-head { display: flex; align-items: center; min-height: 44px; margin: 0 0 16px; padding: 0 8px; }
  .sidebar .logo { width: 126px; margin: 0; }
  .sidebar .sb-sec { margin: -6px 0 12px; gap: 8px; white-space: nowrap; }
  .sidebar nav details.navfold > summary { gap: 12px; justify-content: flex-start; }
  .sidebar nav details.navfold > summary svg { width: 20px; height: 20px; color: var(--muted); }
  .sidebar nav details.navfold > summary span { flex: 1; }
  .sb-toggle { display: grid; place-items: center; position: absolute; right: -14px; top: 22px; width: 28px; height: 28px; border-radius: 50%;
    border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.08); z-index: 2; }
  .sb-toggle svg { width: 15px; height: 15px; }
  .sb-toggle:hover { color: var(--brand-ink); border-color: var(--brand); }
  .sidebar { overflow: visible; }
  .sidebar nav { overflow-y: auto; overflow-x: hidden; flex: 1; margin: 0 -6px; padding: 0 6px; }
  /* État réduit : rail d'icônes */
  body.sb-min { --sbw: var(--sbw-min); }
  body.sb-min .sidebar { padding-left: 10px; padding-right: 10px; }
  body.sb-min .sb-head { justify-content: center; padding: 0; }
  body.sb-min .sb-head .logo { display: none; }
  body.sb-min .sb-head .logo-mini { display: block; width: 40px; height: 40px; border-radius: 10px; }
  body.sb-min .lbl, body.sb-min .hero-cta .kbd, body.sb-min nav a > span, body.sb-min nav .navfold > summary > span { display: none; }
  body.sb-min .hero-cta, body.sb-min .sb-sec { padding: 0; min-height: 48px; width: 56px; margin-left: auto; margin-right: auto; justify-content: center; }
  body.sb-min .sb-sec { margin-top: -4px; margin-bottom: 10px; }
  body.sb-min nav a, body.sb-min nav .navfold > summary { justify-content: center; padding: 10px 0; gap: 0; }
  body.sb-min nav .navfold > summary::after { display: none; }
  body.sb-min nav .sep { height: 1px; margin: 12px 10px; padding: 0; background: var(--line); font-size: 0; }
  body.sb-min nav .badge { position: absolute; top: 4px; right: 8px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; margin: 0; }
  body.sb-min .who { justify-content: center; padding-left: 0; padding-right: 0; }
  /* Barre du haut */
  .topbar { min-height: 64px; padding: 10px 28px; gap: 10px; }
  .topbar .tt .title { display: block; font-size: 17px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
  .topbar .crumb { font-size: 12px; margin-top: 1px; }
  .topbar .day.topday { display: inline-block; text-transform: none; }
  .topbar .live { border: 1px solid var(--line); border-radius: 999px; padding: 6px 11px 6px 9px; background: var(--card); }
  .topbar .live.on { border-color: #CDEBD7; background: #F1FAF4; color: #176B38; }
  .topbar .btn.newop { border-radius: 999px; padding: 0 16px; min-height: 40px; }
  .topbar .user-dropdown > summary { padding: 4px 8px 4px 4px; border: 1px solid var(--line); border-radius: 999px; }
  .topbar .user-dropdown > summary:hover { background: var(--bg); }
  .topbar .user-dropdown .avatar { width: 32px; height: 32px; font-size: 13px; }
  .topbar .user-name { display: inline; font-size: 14px; font-weight: 600; }
  .pagehead { padding-top: 22px; }
  .pagehead .day { display: none; }
  /* Tableau de bord */
  .kpis.stats { gap: 14px; margin-bottom: 24px; }
  .kpi { border-radius: 16px; padding: 18px 20px; }
  .kpi .label { font-weight: 600; letter-spacing: .01em; }
  .kpi.accent { border: 0; background: var(--auth-black); color: #fff; position: relative; overflow: hidden; }
  .kpi.accent::after { content: ""; position: absolute; right: -46px; bottom: -58px; width: 130px; height: 130px; border-radius: 50%; background: var(--brand); opacity: .95; }
  .kpi.accent > * { position: relative; z-index: 1; }
  .kpi.accent .label, .kpi.accent .sub { color: rgba(255,255,255,.72); }
  .kpi.accent .value .unit { color: rgba(255,255,255,.7); }
  .actions.quick { display: flex; flex-wrap: wrap; gap: 10px; }
  .actions.quick .action { flex: 0 1 auto; flex-direction: row; align-items: center; gap: 10px; padding: 6px 16px 6px 6px; min-height: 0; height: 46px; aspect-ratio: auto; border-radius: 999px;
    border: 1px solid var(--line); box-shadow: none; font-weight: 600; line-height: 1.2; text-align: left; }
  .actions.quick .action svg { width: 16px; height: 16px; padding: 7px; }
  .actions.quick .action:hover { border-color: var(--brand); background: var(--brand-soft); }
  .section > h2 { font-size: 15px; font-weight: 700; }
}

/* ---------- Listes déroulantes avec recherche ---------- */
.sselect { position: relative; }
.sselect .sselect-native { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; margin: 0; padding: 0; border: 0; min-height: 0; }
.sselect-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; cursor: pointer; background: #fff; }
.sselect-btn .sv { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sselect-btn.ph .sv { color: var(--muted); }
.sselect-btn > svg { width: 16px; height: 16px; color: var(--muted); transform: rotate(90deg); flex: none; }
.sselect-btn[aria-expanded="true"] { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
.sselect-btn:disabled { background: var(--bg); color: var(--muted); cursor: default; }
.sselect .drop { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.12); overflow: hidden; }
.sselect .drop .search { position: relative; display: block; padding: 8px; border-bottom: 1px solid var(--line); }
.sselect .drop .search svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.sselect .drop .search .input { min-height: 38px; padding: 6px 10px 6px 34px; border-radius: 8px; width: 100%; }
.sselect .drop .opts { max-height: 240px; overflow-y: auto; }
.sselect .drop .opt { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; cursor: pointer; font-size: 15px; }
.sselect .drop .opt + .opt { border-top: 1px solid var(--line); }
.sselect .drop .opt.hl, .sselect .drop .opt:hover { background: var(--brand-soft); }
.sselect .drop .opt.sel { font-weight: 650; color: var(--brand-ink); }
.sselect .drop .opt:disabled { color: var(--muted); cursor: default; }
.sselect .drop .empty { padding: 12px; color: var(--muted); font-size: 14px; }
.login .sselect-btn { border: 0; border-bottom: 2px solid var(--auth-black); border-radius: 0; padding-left: 0; }

/* ---------- Marque : pictogramme SVG + nom ---------- */
.brand-name { font-weight: 800; letter-spacing: .04em; color: var(--brand); font-size: 18px; }
.sb-head .logo, .auth-brand img { width: 40px; height: 40px; }
.auth-brand img { width: 48px; height: 48px; }
.auth-brand .brand-name { font-size: 22px; }
.topbar > img { height: 32px; width: 32px; }
.splash img { width: 96px; }
.login .logo { width: 96px; margin: 8px auto 20px; }
@media (min-width: 1000px) {
  .sidebar .logo { width: 40px; height: 40px; margin: 0; }
  .sb-head { gap: 10px; }
  body.sb-min .sb-head .logo { display: block; width: 36px; height: 36px; }
  body.sb-min .brand-name { display: none; }
  .pagehead { display: none; }           /* le titre est déjà dans la barre du haut */
  main { padding-top: 22px; }
}
