/* Typographies de la charte MLOCTET+ : DIN Pro (textes), Roketto (titre principal, avec parcimonie) */
@font-face { font-family: "DIN Pro"; src: url("/fonts/dinpro-300.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "DIN Pro"; src: url("/fonts/dinpro-400.woff2") format("woff2"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "DIN Pro"; src: url("/fonts/dinpro-700.woff2") format("woff2"); font-weight: 600 800; font-display: swap; }
@font-face { font-family: "Roketto"; src: url("/fonts/roketto.woff2") format("woff2"); font-display: swap; }
.brand-title { font-family: "Roketto", "DIN Pro", system-ui, sans-serif; font-weight: 400; letter-spacing: .01em; }

:root {
  /* Charte MLOCTET+ : bleu #16417b, crème #fff0db, blanc */
  --blue: #16417b;
  --cream: #fff0db;
  --bg: #fdf8f0;
  --surface: #ffffff;
  --surface-2: #fff4e4;
  --text: #0f2747;
  --muted: #5d6c83;
  --border: #eadfcc;
  --brand: #16417b;
  --brand-ink: #fff0db;
  --brand-soft: #fff0db;
  --nav-bg: #16417b;
  --nav-ink: #fff0db;
  --ok: #18794e;
  --ok-soft: #e3f4ea;
  --warn: #a35200;
  --warn-soft: #fde9cf;
  --bad: #c42b2b;
  --bad-soft: #fbe5e5;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(22, 65, 123, .06), 0 2px 6px rgba(22, 65, 123, .06);
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
    --bg: #0a182c;
    --surface: #10243f;
    --surface-2: #17304f;
    --text: #fff6ea;
    --muted: #a9b6cb;
    --border: #213d63;
    --brand: #fff0db;
    --brand-ink: #16417b;
    --brand-soft: #1b3a63;
    --nav-bg: #0d1f38;
    --nav-ink: #fff0db;
    --ok: #4cc38a;
    --ok-soft: #12301f;
    --warn: #f0a548;
    --warn-soft: #33240f;
    --bad: #ff7b7b;
    --bad-soft: #3a1a1d;
    --shadow: none;
    color-scheme: dark;
  } }
:root[data-theme="dark"] {
    --bg: #0a182c;
    --surface: #10243f;
    --surface-2: #17304f;
    --text: #fff6ea;
    --muted: #a9b6cb;
    --border: #213d63;
    --brand: #fff0db;
    --brand-ink: #16417b;
    --brand-soft: #1b3a63;
    --nav-bg: #0d1f38;
    --nav-ink: #fff0db;
    --ok: #4cc38a;
    --ok-soft: #12301f;
    --warn: #f0a548;
    --warn-soft: #33240f;
    --bad: #ff7b7b;
    --bad-soft: #3a1a1d;
    --shadow: none;
    color-scheme: dark;
  }
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15.5px/1.45 "DIN Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand); text-decoration: none; }
h1 { font-size: 24px; font-weight: 700; margin: 0 0 4px; color: var(--brand); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) h1 { color: var(--text); } }
:root[data-theme="dark"] h1 { color: var(--text); }
h2 { font-size: 16px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13.5px; }

/* --- layout --- */
.app { display: flex; min-height: 100vh; }
.nav {
  /* La zone de la barre d'accueil iPhone s'AJOUTE à la hauteur de la barre (elle ne doit pas l'écraser). */
  position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 20;
  display: flex; background: var(--nav-bg); border-top: 0;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav .brand { display: none; }
.nav .brand img { width: 168px; display: block; }
.topbar { display: flex; align-items: center; justify-content: center; background: var(--nav-bg); padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); }
.topbar img { height: 34px; }
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--nav-ink); opacity: .72; font-size: 11.5px; font-weight: 600; position: relative;
}
.nav a svg { width: 24px; height: 24px; flex-shrink: 0; }
.nav a.active { color: var(--nav-ink); opacity: 1; }
.nav a.active svg { stroke-width: 2.4; }
.nav .badge { position: absolute; top: 6px; left: calc(50% + 6px); }
main { flex: 1; min-width: 0; padding: 16px 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px); max-width: 1100px; margin: 0 auto; }
@media (min-width: 900px) {
  .nav { position: sticky; top: 0; height: 100vh; width: 220px; flex-direction: column; border-top: 0; border-right: 1px solid var(--border); padding: 16px 10px; gap: 2px; }
  .nav .brand { display: block; padding: 8px 10px 26px; }
  .topbar { display: none; }
  .nav a { flex: none; flex-direction: row; justify-content: flex-start; gap: 10px; font-size: 14.5px; padding: 10px 12px; border-radius: 8px; }
  .nav a:hover { opacity: 1; background: rgba(255, 240, 219, .08); }
  .nav a.active { background: rgba(255, 240, 219, .16); }
  .nav .who { margin-top: auto; color: var(--nav-ink); opacity: .7; font-size: 12.5px; padding: 8px 12px; }
  .nav .badge { position: static; margin-left: auto; }
  main { padding: 28px 32px 40px; }
}

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

/* --- surfaces --- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card, .stack > * + * { margin-top: 12px; }
.grid > .card + .card { margin-top: 0; }
.grid { display: grid; gap: 12px; }
.grid.kpis { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .grid.kpis { grid-template-columns: repeat(4, 1fr); } .grid.two { grid-template-columns: 1fr 1fr; } }
.kpi { padding: 14px 16px; }
.kpi .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 13px; }
.kpi.alert { border-color: var(--warn); background: var(--warn-soft); }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.list > li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.list a.row { display: flex; align-items: center; gap: 12px; color: inherit; width: 100%; }
.qty { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 17px; text-align: right; white-space: nowrap; }

/* --- controls --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 10px; cursor: pointer; min-height: 44px;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 13.5px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions.end { justify-content: flex-end; }

label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); width: 100%;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--brand); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }


.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--surface); padding: 6px 12px; border-radius: 99px; font: inherit; font-size: 13.5px; cursor: pointer; color: var(--text); }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: var(--bad); color: #fff; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.brand { background: var(--brand-soft); color: var(--brand); }

.notice { padding: 12px 14px; border-radius: 10px; background: var(--brand-soft); font-size: 14px; }
.notice.warn { background: var(--warn-soft); }


/* --- toast / modal --- */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
@media (min-width: 900px) { #toasts { bottom: 24px; } }
.toast { padding: 12px 14px; border-radius: 10px; background: var(--text); color: var(--bg); font-weight: 500; box-shadow: 0 6px 24px rgba(0,0,0,.2); animation: pop .15s ease-out; }
.toast.ok { background: var(--ok); color: #fff; } .toast.bad { background: var(--bad); color: #fff; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal .sheet { background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 18px; }
@media (min-width: 700px) { .modal { align-items: center; } .modal .sheet { border-radius: 16px; } }

.empty { text-align: center; color: var(--muted); padding: 28px 10px; }
.skeleton { color: var(--muted); padding: 30px; text-align: center; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12.5px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
table.t td { padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.scroll-x { overflow-x: auto; }
.login { max-width: 380px; margin: 14vh auto 0; text-align: center; }
.login img { width: 240px; margin: 4px auto 14px; display: block; }
.login form { text-align: left; }
.nav .who { display: none; }
@media (min-width: 900px) { .nav .who { display: block; } }
.kpi .v { color: var(--brand); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .kpi .v { color: var(--text); } }
:root[data-theme="dark"] .kpi .v { color: var(--text); }
.nav:empty { display: none; }

/* ================================================================ Espace client */
:root { --s-cur: #2a5ea8; --s-prev: #c8742a; --grid: #ece3d4; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --s-cur: #5b8fe0; --s-prev: #d07f28; --grid: #213d63; } }
:root[data-theme="dark"] { --s-cur: #5b8fe0; --s-prev: #d07f28; --grid: #213d63; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t th.num { text-align: right; }
.sub { color: var(--muted); font-size: 13px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 22px 0 10px; flex-wrap: wrap; }
.section-title h2 { margin: 0; }
.kpi .d { font-size: 12.5px; margin-top: 2px; color: var(--muted); }
.kpi a { color: inherit; }
.kpi.click { cursor: pointer; }
.kpi.click:hover { border-color: var(--brand); }
.form-grid { display: grid; gap: 0 12px; }
@media (min-width: 600px) { .form-grid { grid-template-columns: 1fr 1fr; } }
input[type=radio] { width: 20px; height: 20px; min-height: 0; flex: none; padding: 0; accent-color: var(--brand); }
select.sm, input.sm { min-height: 34px; padding: 4px 8px; font-size: 13.5px; width: auto; }
textarea { min-height: 110px; resize: vertical; }
textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13.5px; min-height: 260px; }
.grid.three { grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid.three { grid-template-columns: repeat(3, 1fr); } }
.right { margin-left: auto; }
.row-flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }

/* connexion et double authentification */
.login .card { text-align: left; }
.login h2 { margin-top: 0; }
.qr { background: #fff; padding: 12px; border-radius: 12px; width: 220px; margin: 8px auto 12px; }
.qr img { width: 100%; display: block; image-rendering: pixelated; }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; background: var(--surface-2); padding: 8px 10px; border-radius: 8px; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 16px; background: var(--surface-2); padding: 14px; border-radius: 10px; margin: 10px 0; }
input.otp { font-size: 24px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.linkbtn { background: none; border: 0; color: var(--brand); font: inherit; cursor: pointer; padding: 6px 0; text-decoration: underline; }
.steps { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.login-links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .login img.logo-light { content: url("/icons/logo-cream.svg"); } }
:root[data-theme="dark"] .login img.logo-light { content: url("/icons/logo-cream.svg"); }

/* barre du haut (mobile) : cloche */
.topbar { position: relative; }
.topbar-actions { position: absolute; right: 12px; top: calc(8px + env(safe-area-inset-top)); display: flex; gap: 4px; }
.iconbtn { position: relative; background: transparent; border: 0; color: var(--nav-ink); width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.iconbtn svg { width: 22px; height: 22px; }
.iconbtn .badge { position: absolute; top: 2px; right: 0; }
.nav .bell { margin: 0 0 14px; display: none; }
@media (min-width: 900px) {
  .nav { overflow-y: auto; }
  .nav .bell { display: flex; align-items: center; gap: 10px; color: var(--nav-ink); opacity: .85; padding: 10px 12px; border-radius: 8px; background: rgba(255, 240, 219, .08); font-size: 14px; font-weight: 600; cursor: pointer; border: 0; font-family: inherit; width: 100%; }
  .nav .bell svg { width: 20px; height: 20px; }
  .nav .bell .badge { margin-left: auto; }
  .nav .navgroup { color: var(--nav-ink); opacity: .5; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; padding: 14px 12px 4px; }
}
.nav .navgroup { display: none; }
@media (min-width: 900px) { .nav .navgroup { display: block; } }
/* mobile : barre du bas limitée aux 5 premiers onglets, le reste dans « Plus » */
@media (max-width: 899px) { .nav a.extra { display: none; } }

/* sélecteur de société et bandeau « vue client » */
.ctxbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: 12px; background: var(--brand-soft); margin-bottom: 14px; font-size: 14px; }
.ctxbar.staff { background: var(--warn-soft); }
.ctxbar select { width: auto; min-height: 34px; padding: 4px 8px; }

/* listes et statuts */
.tag.info { background: var(--brand-soft); color: var(--brand); }
.list .meta { color: var(--muted); font-size: 13px; }
.list > li.clickable { cursor: pointer; }
.list > li.clickable:hover .title { color: var(--brand); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.search { max-width: 320px; }

/* fil de discussion d'un ticket */
.thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.thread li { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); max-width: 92%; }
.thread li.mine { align-self: flex-end; background: var(--brand-soft); }
.thread li .who { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.thread li .txt { white-space: pre-wrap; word-break: break-word; }

/* documents rédigés (Markdown simplifié) */
.doc { line-height: 1.6; }
.doc h1 { font-size: 22px; } .doc h2 { font-size: 18px; margin-top: 18px; } .doc h3 { font-size: 16px; margin-top: 14px; }
.doc table { border-collapse: collapse; width: 100%; } .doc td, .doc th { border: 1px solid var(--border); padding: 6px 8px; }
.doc code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 13.5px; }
.doc blockquote { border-left: 3px solid var(--brand); margin: 10px 0; padding: 4px 12px; color: var(--muted); }
.md-toolbar { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.md-toolbar button { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.editor { display: grid; gap: 12px; }
@media (min-width: 900px) { .editor { grid-template-columns: 1fr 1fr; } }
.editor .preview { border: 1px dashed var(--border); border-radius: 10px; padding: 12px; min-height: 260px; max-height: 60vh; overflow: auto; }

/* matrice des droits */
table.perms td, table.perms th { text-align: center; }
table.perms td:first-child, table.perms th:first-child { text-align: left; }
table.perms tr.grp td { background: var(--surface-2); font-weight: 700; font-size: 13px; }

/* modèles d'e-mail */
.tagchips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.tagchips button { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; }
.mailframe { width: 100%; height: 420px; border: 1px solid var(--border); border-radius: 10px; background: #fdf8f0; }

/* catalogue et panier */
.products { display: grid; gap: 12px; }
@media (min-width: 700px) { .products { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .products { grid-template-columns: repeat(3, 1fr); } }
.product { display: flex; flex-direction: column; gap: 8px; }
.product .price { font-size: 20px; font-weight: 700; color: var(--brand); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .product .price { color: var(--text); } }
:root[data-theme="dark"] .product .price { color: var(--text); }
.product ul { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--muted); }
.product .grow { flex: 1; }
.cart { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px); z-index: 10; margin-top: 16px; border-color: var(--brand); }
@media (min-width: 900px) { .cart { bottom: 16px; } }
.qtyin { width: 90px; text-align: center; }

/* graphiques */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.tip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); font-size: 12.5px; padding: 8px 10px; border-radius: 8px; white-space: nowrap; z-index: 5; box-shadow: 0 4px 16px rgba(0,0,0,.18); transform: translate(-50%, calc(-100% - 10px)); }
.tile { display: flex; gap: 12px; align-items: center; color: inherit; }
.tile .ic { width: 42px; height: 42px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; flex: none; }
.tile .ic svg { width: 22px; height: 22px; }

/* notifications */
.notif { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); cursor: pointer; }
.notif:first-child { border-top: 0; }
.notif.unread .t { font-weight: 700; }
.notif .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-top: 7px; flex: none; }
.notif:not(.unread) .dot { background: transparent; }

@media print {
  .nav, .topbar, .ctxbar, .no-print, #toasts { display: none !important; }
  main { padding: 0 !important; max-width: none; }
  .card { border: 0; box-shadow: none; }
  body { background: #fff; color: #000; }
}
.list a.row > svg { width: 20px; height: 20px; flex: none; color: var(--muted); }
.tile > svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.grid.top { align-items: start; }

/* journal d'activité */
.jfilters { display: grid; gap: 0 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) { .jfilters { grid-template-columns: repeat(4, 1fr); } }
table.journal { min-width: 980px; }
table.journal td { vertical-align: top; }
table.journal tr.clickable { cursor: pointer; }
table.journal tr.clickable:hover td { background: var(--surface-2); }
table.journal tr.fail td { background: var(--bad-soft); }
.nowrap { white-space: nowrap; }

/* commande : sélecteur de quantité, article choisi */
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper input { width: 64px; min-height: 34px; padding: 4px 6px; text-align: center; }
.stepper .btn { min-width: 34px; padding: 4px 0; font-size: 17px; }
.product.selected { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok) inset; }
.tag.grey { background: var(--surface-2); color: var(--muted); }
.genopts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
h2 > svg { width: 20px; height: 20px; vertical-align: -3px; margin-right: 6px; }
.pl { list-style: none; margin: 0; padding: 0; }
.pl li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.pl li:first-child { border-top: 0; }
.pl li.total { font-weight: 700; font-size: 17px; border-top: 2px solid var(--border); }
.pl li .k { color: var(--muted); }
.pl li.total .k { color: var(--text); }

/* statuts des tickets : rouge ouvert, bleu en attente, gris résolu */
.tag.t-open { background: #fbe5e5; color: #c42b2b; }
.tag.t-wait { background: #e1ecfb; color: #1f5fbf; }
.tag.t-done { background: #eceef1; color: #5d6c83; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag.t-open { background: #3a1a1d; color: #ff7b7b; } :root:not([data-theme="light"]) .tag.t-wait { background: #15305a; color: #8db8ff; } :root:not([data-theme="light"]) .tag.t-done { background: #26334a; color: #a9b6cb; } }
:root[data-theme="dark"] .tag.t-open { background: #3a1a1d; color: #ff7b7b; }
:root[data-theme="dark"] .tag.t-wait { background: #15305a; color: #8db8ff; }
:root[data-theme="dark"] .tag.t-done { background: #26334a; color: #a9b6cb; }

/* tuiles des outils internes */
.card.tool .tile { gap: 10px; }
.toolkpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.toolkpis > div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.toolkpis .v { font-size: 19px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toolkpis .v { color: var(--text); } }
:root[data-theme="dark"] .toolkpis .v { color: var(--text); }
.toolkpis .l { font-size: 12.5px; color: var(--muted); }
.toolkpis .h { font-size: 11.5px; color: var(--muted); }
.toolkpis .alert { background: var(--warn-soft); }
.toolkpis .alert .v { color: var(--warn); }

.prewrap { white-space: pre-line; }
.card.answer { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; border-color: var(--brand); margin-bottom: 0; }
.picker { margin: 10px 0; }
.picker .list { max-height: 320px; overflow: auto; }
.picker .list li.sel { background: var(--surface-2); }
.picker .list li { padding: 8px 6px; }

/* sélection des personnes en copie d'un ticket */
.flabel { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.ccpick { position: relative; }
.ccmenu { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); max-height: 320px; overflow: auto; padding: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.ccmenu .list li { padding: 6px 0; }
.ccmenu label.check { align-items: flex-start; }
.ccmenu label.check input { margin-top: 3px; }

/* icônes dans les encarts d'information : taille du texte */
.notice svg { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.notice.inv-result { width: 100%; margin-top: 6px; padding: 8px 12px; }
.notice.inv-result.ok { display: flex; gap: 8px; align-items: center; background: var(--ok-soft); color: var(--ok); }
.notice.inv-result.ok b { color: var(--ok); }

.numprev { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); margin-bottom: 8px; }
.numprev b { font-size: 20px; font-variant-numeric: tabular-nums; color: var(--brand); }

/* Apparence : sélecteur de thème (clair / sombre / automatique), comme dvexperts.mloctet.com */
.themesel { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; flex: none; }
.themesel button { border: 0; background: var(--surface); color: var(--text); font: inherit; font-weight: 600; padding: 9px 14px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; min-height: 0; }
.themesel button + button { border-left: 1px solid var(--border); }
.themesel button.on { background: var(--brand); color: var(--brand-ink); }
.themesel svg { width: 16px; height: 16px; }
.nav .themequick { display: none; }
@media (min-width: 900px) {
  .nav .themequick { display: flex; margin: auto 12px 4px; border-color: rgba(255, 240, 219, .25); }
  .nav .themequick button { flex: 1; justify-content: center; padding: 6px 10px; background: transparent; color: var(--nav-ink); }
  .nav .themequick button + button { border-left-color: rgba(255, 240, 219, .25); }
  .nav .themequick button.on { background: rgba(255, 240, 219, .2); color: var(--nav-ink); }
  .nav .themequick + .who { margin-top: 0; }
}

/* ================================================================ Mobile et tablette (audit 320 → 1024 px) */
/* Aucun élément ne doit élargir la page : les champs peuvent rétrécir, les tableaux défilent dans leur carte */
input, select, textarea { min-width: 0; max-width: 100%; }
.card:has(table.t) { overflow-x: auto; }
img, svg { max-width: 100%; }
/* Sélecteur d'apparence sur petit écran : pleine largeur, texte seul */
@media (max-width: 420px) {
  .card .themesel { width: 100%; }
  .card .themesel button { flex: 1; justify-content: center; padding: 10px 6px; font-size: 14px; }
  .card .themesel svg { display: none; }
}
/* Écrans tactiles : zones de toucher d'au moins 40 px, et pas de zoom automatique d'iPhone sur les champs (16 px minimum) */
@media (pointer: coarse) {
  input, select, textarea, select.sm, input.sm, .qtyin { font-size: 16px; }
  .themesel button { min-height: 40px; }
  .tagchips button { min-height: 34px; padding: 6px 10px; }
  a.small, .linkbtn { display: inline-block; padding: 8px 0; }
  table.t td a { display: inline-block; padding: 6px 0; }
  .chip { min-height: 36px; }
}
@media (max-width: 480px) { .jfilters { grid-template-columns: 1fr; } }
@media (pointer: coarse) { .btn.sm { min-width: 38px; min-height: 38px; } }
.nav .lbl-long { display: none; }
@media (min-width: 900px) { .nav .lbl-long { display: inline; } .nav .lbl-short { display: none; } }
@media (max-width: 899px) { .nav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; } }
