/* MysCom — portail pharmacies. Aucune ressource externe. */
:root {
  /* Palette : blanc (fonds), bleu (identité, navigation, actions), vert (validation, disponibilité), jaune (attention, repères).
     Le rouge est réservé aux erreurs et aux refus. */
  --bg: #f3f6fb; --surface: #fff; --surface-2: #f6f9fd; --ink: #0f1f3d; --muted: #55647e; --line: #d9e2ef; --line-2: #eaeff7;
  --brand: #1a56c4; --brand-dark: #123f95; --brand-soft: #e4edfc; --side: #0d2f6e; --side-2: #0a2454; --side-ink: #c9d7f2;
  --blue: #1a56c4; --blue-soft: #e4edfc;
  --green: #137a3a; --green-dark: #0e5f2d; --green-soft: #dbf4e3; --green-bright: #6fe0a0;
  --yellow: #f6b90a; --yellow-dark: #d99e00; --amber: #855800; --amber-soft: #fff3c7; --yellow-line: #f0d273;
  --red: #b3261a; --red-soft: #fde5e1; --gray-soft: #e8edf6;
  --radius: 12px; --shadow: 0 1px 2px rgba(15, 31, 61, .05), 0 6px 18px -10px rgba(15, 31, 61, .2);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); }
body.no-scroll { overflow: hidden; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.2; letter-spacing: -.01em; }
h2 { font-size: 17px; line-height: 1.3; }
h3 { font-size: 15px; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.ico { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 650; }
.loading { padding: 70px 20px; text-align: center; color: var(--muted); }
.hide { display: none !important; }

/* ---------- Structure ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: linear-gradient(180deg, var(--side), var(--side-2)); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: hidden; }
.brand { display: grid; gap: 8px; padding: 14px 16px 8px; flex: none; color: #fff; font-weight: 750; font-size: 16px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
/* Logo : toujours posé sur une plaque blanche, pour rester lisible sur le bleu du menu. */
.brand-logo { background: #fff; border-radius: 12px; padding: 9px 12px; display: grid; place-items: center; box-shadow: 0 0 0 1px rgba(255, 255, 255, .4), 0 12px 24px -14px rgba(0, 0, 0, .7); transition: transform .15s; }
.brand:hover .brand-logo { transform: translateY(-1px); }
.brand-logo img { display: block; width: 100%; max-width: 180px; height: auto; }
.brand-name { display: flex; align-items: baseline; gap: 8px; padding: 0 3px; white-space: nowrap; }
.brand .brand-name small { display: inline; font-size: 11.5px; }
.print-head { display: none; }
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--side-ink); letter-spacing: .02em; }
.nav { padding: 6px 10px 18px; display: grid; gap: 2px; align-content: start; flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .28) transparent; }
.nav-title { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #9fb5e6; padding: 14px 10px 6px; font-weight: 650; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-ink); font-size: 14.5px; }
.nav a:hover { background: rgba(255, 255, 255, .09); color: #fff; text-decoration: none; }
.nav a.on { background: rgba(255, 255, 255, .15); color: #fff; font-weight: 650; box-shadow: inset 3px 0 0 var(--yellow); }
.nav a.on .ico { color: var(--yellow); }
.nav a .count { margin-left: auto; background: var(--yellow); color: #2b1d00; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 0 7px; min-width: 20px; text-align: center; }
.side-foot { flex: none; padding: 12px 18px; font-size: 12px; color: #9fb5e6; border-top: 1px solid rgba(255, 255, 255, .12); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 10px 24px; min-height: 58px; }
.topbar .who { min-width: 0; line-height: 1.25; }
.topbar .who strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .who span { font-size: 12.5px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.icon-btn { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid transparent; background: none; border-radius: 10px; color: var(--ink); flex: none; }
.icon-btn:hover { background: var(--gray-soft); text-decoration: none; }
.icon-btn .dot { position: absolute; top: 3px; right: 2px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 999px; min-width: 17px; height: 17px; padding: 0 4px; display: grid; place-items: center; }
.cart-btn { display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: 10px; background: var(--green); color: #fff; font-weight: 600; white-space: nowrap; }
.cart-btn:hover { background: var(--green-dark); text-decoration: none; }
.cart-btn .count { background: var(--yellow); color: #2b1d00; border-radius: 999px; padding: 0 7px; font-size: 12.5px; font-weight: 750; }
.menu-btn { display: none; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 6px; border-radius: 10px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--gray-soft); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; font-weight: 700; flex: none; }
.user-menu .menu { position: absolute; right: 0; top: calc(100% + 6px); width: 250px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 40px -14px rgba(15, 31, 61, .35); padding: 6px; z-index: 40; }
.menu-head { padding: 9px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.menu-head strong, .menu-head span { display: block; overflow: hidden; text-overflow: ellipsis; }
.menu-head span { font-size: 12.5px; color: var(--muted); }
.menu a, .menu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; color: var(--ink); text-align: left; }
.menu a:hover, .menu button:hover { background: var(--gray-soft); text-decoration: none; }
.actas { background: var(--amber-soft); color: #553800; border-bottom: 1px solid var(--yellow-line); padding: 8px 24px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.actas .btn { margin-left: auto; }
.content { padding: 24px; max-width: 1320px; width: 100%; margin: 0 auto; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { color: var(--muted); margin-top: 4px; max-width: 760px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; margin-bottom: 8px; color: var(--muted); }

/* ---------- Éléments ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--brand); background: var(--brand); color: #fff; font-weight: 600; font-size: 14.5px; line-height: 1.3; white-space: nowrap; }
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); text-decoration: none; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--surface); }
.btn.go { background: var(--green); border-color: var(--green); }
.btn.go:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.ghost.danger { background: var(--surface); color: var(--red); border-color: #eec5c0; }
.btn.ghost.danger:hover { border-color: var(--red); color: var(--red); }
.btn.sm { padding: 5px 10px; font-size: 13.5px; border-radius: 8px; }
.btn.lg { padding: 12px 20px; font-size: 16px; }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.busy { opacity: .7; cursor: progress; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 650; white-space: nowrap; background: var(--gray-soft); color: #3c4a66; }
.pill .ico { width: 13px; height: 13px; }
.table td.wrap .tags .pill { white-space: normal; border-radius: 9px; }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.blue { background: var(--blue-soft); color: var(--brand-dark); }
.pill.violet { background: var(--side); color: #fff; }
.pill.green { background: var(--green-soft); color: var(--green-dark); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.teal { background: var(--green-soft); color: var(--green-dark); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.card-body { padding: 16px 18px; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cols.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 10px; background: var(--blue-soft); color: #123a80; font-size: 14px; }
.alert.warn { background: var(--amber-soft); color: #553800; }
.alert.error { background: var(--red-soft); color: #7d1a11; }
.alert.ok { background: var(--green-soft); color: #0c4a24; }
.alert .ico { margin-top: 2px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 2px; box-shadow: var(--shadow); color: var(--ink); min-width: 0; border-top: 3px solid var(--brand); }
.kpi:nth-child(3n+2) { border-top-color: var(--green); }
.kpi:nth-child(3n) { border-top-color: var(--yellow); }
a.kpi:hover { box-shadow: 0 2px 4px rgba(15, 31, 61, .06), 0 12px 26px -12px rgba(15, 31, 61, .32); text-decoration: none; }
.kpi span { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi strong { font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: -.01em; overflow-wrap: anywhere; }
.kpi em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.kpi.alerte strong { color: var(--red); }
.dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 18px; font-size: 14.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.bar { height: 8px; background: var(--gray-soft); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.bar.amber > i { background: var(--yellow); }
.bar.red > i { background: var(--red); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 9px 14px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; white-space: nowrap; margin-bottom: -1px; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--brand-dark); border-bottom-color: var(--brand); }
.tabs button.on .count { background: var(--yellow); color: #2b1d00; }
.tabs .count { font-size: 12px; background: var(--gray-soft); border-radius: 999px; padding: 0 7px; margin-left: 5px; color: var(--ink); }

/* ---------- Formulaires ---------- */
.field { display: grid; gap: 5px; margin-bottom: 13px; min-width: 0; }
.field > span { font-size: 13.5px; font-weight: 600; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
.field small { color: var(--muted); font-size: 12.5px; }
input[type=text], input[type=search], input[type=password], input[type=email], input[type=tel], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid #c5d0e2; border-radius: 9px; background: var(--surface); min-height: 38px; }
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 14.5px; padding: 4px 0; cursor: pointer; }
.check input { width: 17px; height: 17px; margin-top: 2px; flex: none; accent-color: var(--brand); }
.field-error { color: var(--red); font-size: 13.5px; font-weight: 550; margin: 4px 0 10px; }
.search-field { position: relative; display: block; }
.search-field .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-field input { padding-left: 36px; }
.picker { position: relative; }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 36px -14px rgba(15, 31, 61, .4); z-index: 5; max-height: 250px; overflow-y: auto; padding: 4px; }
.picker-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 7px; }
.picker-list button:hover, .picker-list button:focus { background: var(--brand-soft); }
.picker-list .none { padding: 9px 10px; color: var(--muted); font-size: 13.5px; }
.picked { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }

/* ---------- Tableaux et journaux ---------- */
.journal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.journal-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.journal-bar .search-field { flex: 1 1 220px; }
.journal-bar select { width: auto; }
.journal-bar [data-export] { margin-left: auto; }
.date-field { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); }
.date-field input { width: 150px; }
.table-wrap { overflow-x: auto; container-type: inline-size; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 10px 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table th.num { text-align: right; }
.table td { padding: 10px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; white-space: nowrap; }
.table td.wrap { white-space: normal; min-width: 150px; }
.table th:first-child, .table td:first-child { padding-left: 14px; }
.table th:last-child, .table td:last-child { padding-right: 14px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table.clickable tbody tr[data-i] { cursor: pointer; }
.table tbody tr[data-i]:hover { background: #f1f6fe; }
.table td.actions { text-align: right; }
.table td.actions .cell { display: inline-flex; gap: 6px; }
.table tfoot td { background: var(--surface-2); font-weight: 650; border-top: 1px solid var(--line); border-bottom: 0; }
.empty-row td { text-align: center; color: var(--muted); padding: 40px 14px; white-space: normal; }
.journal-foot { padding: 10px 14px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); background: var(--surface-2); }
.journal-foot strong { color: var(--ink); }
.sub { display: block; font-size: 12.5px; color: var(--muted); white-space: normal; }
.tags { display: inline-flex; gap: 4px; flex-wrap: wrap; vertical-align: middle; }
.empty { text-align: center; padding: 54px 20px; display: grid; justify-items: center; gap: 8px; }
.empty-ico { width: 56px; height: 56px; border-radius: 16px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.empty-ico .ico { width: 26px; height: 26px; }
.empty p { color: var(--muted); max-width: 440px; margin-bottom: 8px; }

/* ---------- Catalogue ---------- */
.filters { display: grid; grid-template-columns: minmax(220px, 1.6fr) minmax(150px, 1fr) minmax(150px, 1fr); gap: 10px; margin-bottom: 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 13.5px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.chip .ico { width: 14px; height: 14px; }
.chip:hover { border-color: var(--brand); color: var(--brand-dark); }
.chip.on, .chip.on:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.chips .check { margin-left: auto; padding: 0; font-size: 13.5px; }
.prod-name { font-weight: 650; white-space: normal; }
.stepper { display: inline-grid; grid-template-columns: 30px 58px 30px; align-items: stretch; border: 1px solid #c5d0e2; border-radius: 9px; overflow: hidden; background: var(--surface); height: 34px; }
.stepper button { border: 0; background: var(--surface-2); font-size: 17px; line-height: 1; color: var(--ink); }
.stepper button:hover { background: var(--gray-soft); }
.stepper input { border: 0; border-inline: 1px solid var(--line); border-radius: 0; text-align: center; padding: 0 2px; min-height: 0; height: 100%; -moz-appearance: textfield; font-variant-numeric: tabular-nums; font-weight: 600; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper.in { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.stepper.in input { color: var(--green-dark); }
.stepper.off { opacity: .45; pointer-events: none; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px; }
.stock { font-size: 12.5px; font-weight: 650; }
.stock.ok { color: var(--green); } .stock.low { color: var(--amber); } .stock.out { color: var(--red); }

/* ---------- Panier, documents ---------- */
.totals { display: grid; gap: 7px; font-size: 14.5px; }
.totals > div { display: flex; justify-content: space-between; gap: 16px; }
.totals > div span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.totals .grand { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 3px; font-size: 18px; font-weight: 750; }
.line-error { color: var(--red); font-size: 13px; font-weight: 550; white-space: normal; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 3px; }
.lots { display: block; font-size: 12.5px; color: var(--muted); white-space: normal; }
.offer-box { border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; }
.offer-box + .offer-box { margin-top: 10px; }
.ladder { display: flex; gap: 8px; flex-wrap: wrap; }
.step { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; min-width: 104px; background: var(--surface-2); }
.step b { display: block; font-size: 19px; color: var(--brand-dark); }
.step span { font-size: 12.5px; color: var(--muted); display: block; }
.step.on { border-color: var(--green); background: var(--green-soft); }
.step.on b { color: var(--green-dark); }
.thread { display: grid; gap: 12px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 12px; background: var(--gray-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { justify-self: end; background: var(--brand-soft); }
.msg-meta { font-size: 12px; color: var(--muted); margin-bottom: 3px; white-space: normal; }
.notif { display: flex; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line-2); align-items: flex-start; }
.notif:last-child { border-bottom: 0; }
.notif.unread { background: #f1f6fe; box-shadow: inset 3px 0 0 var(--yellow); }
.notif-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; flex: none; }
.notif-body { min-width: 0; flex: 1; }
.notif time { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

/* ---------- Connexion ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
.auth-side { background: linear-gradient(160deg, #1549ab 0%, var(--side) 55%, var(--side-2) 100%); color: #dbe6fb; padding: 44px 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 30px; }
.auth-side .brand { padding: 0; justify-items: start; gap: 12px; font-size: 19px; }
.auth-side .brand-logo { padding: 16px 22px; border-radius: 16px; }
.auth-side .brand-logo img { width: 280px; max-width: 100%; }
.auth-side .brand .brand-name small { font-size: 13px; }
.auth-side h1 { color: #fff; font-size: 32px; line-height: 1.15; margin: 26px 0 12px; max-width: 460px; }
.auth-side h1::after { content: ""; display: block; width: 78px; height: 5px; margin-top: 18px; border-radius: 99px; background: linear-gradient(90deg, #fff 0 33.3%, var(--green-bright) 33.3% 66.6%, var(--yellow) 66.6%); }
.auth-side ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 11px; }
.auth-side li { display: flex; gap: 10px; align-items: flex-start; }
.auth-side li .ico { color: var(--yellow); margin-top: 3px; }
.auth-main { display: grid; place-items: center; padding: 34px 22px; }
.auth-box { width: min(440px, 100%); }
.auth-box.wide { width: min(640px, 100%); }
.auth-box h2 { font-size: 23px; margin-bottom: 6px; }
.auth-box > p { color: var(--muted); margin-bottom: 20px; }
.auth-links { margin-top: 16px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.demo-box { margin-top: 20px; border: 1px dashed #b3c3de; border-radius: 12px; padding: 12px 14px; font-size: 13.5px; background: var(--surface); }
.demo-box table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.demo-box td { padding: 4px 0; vertical-align: middle; }
.demo-box code { background: var(--gray-soft); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }

/* ---------- Modales et toasts ---------- */
.modal-back { position: fixed; inset: 0; z-index: 60; background: rgba(10, 24, 54, .55); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal { width: min(520px, 100%); background: var(--surface); border-radius: 16px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5); }
.modal.wide { width: min(780px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 14px 12px 20px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px 20px 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.confirm-text { color: var(--muted); }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: grid; gap: 10px; justify-items: end; pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; max-width: 400px; padding: 11px 15px; border-radius: 11px; background: var(--side); color: #fff; box-shadow: 0 14px 34px -12px rgba(0, 0, 0, .5); transition: opacity .2s, transform .2s; font-size: 14.5px; }
.toast .ico { color: var(--green-bright); margin-top: 2px; }
.toast.error { background: #8d2217; }
.toast.error .ico { color: #ffd3cc; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- Adaptation ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols, .cols.even { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1240px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 50; left: 0; top: 0; width: 264px; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .side { transform: none; box-shadow: 20px 0 50px -20px rgba(0, 0, 0, .5); }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(10, 24, 54, .5); z-index: 45; }
  .menu-btn { display: grid; }
}
@media (max-width: 960px) {
  .topbar { padding: 8px 14px; }
  .content { padding: 16px 14px 28px; }
  .actas { padding: 8px 14px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-side { padding: 26px 22px; }
  .auth-side h1 { font-size: 24px; margin-top: 16px; }
  .auth-side .brand { gap: 9px; font-size: 16px; }
  .auth-side .brand-logo { padding: 10px 14px; border-radius: 12px; }
  .auth-side .brand-logo img { width: 180px; }
  .auth-side ul, .auth-side .foot { display: none; }
  .filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .filters .search-field { grid-column: 1 / -1; }
  .journal-bar [data-export] { margin-left: 0; }
  .date-field input { width: 138px; }
}
@media (max-width: 600px) {
  h1 { font-size: 20px; }
  .kpis { gap: 8px; }
  .kpi { padding: 11px 12px; }
  .kpi strong { font-size: 17px; }
  .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .topbar .who span, .cart-btn .lbl, .user-menu .user-name { display: none; }
  .msg { max-width: 92%; }
  .tabs button { padding: 9px 10px; font-size: 14px; }
  .toasts { left: 12px; right: 12px; justify-items: stretch; }
  .toast { max-width: none; }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .dl dd { margin-bottom: 8px; }
  .chips .check { margin-left: 0; width: 100%; }
}
/* Tableaux en cartes : selon la largeur disponible pour le tableau (et non celle de l'écran).
   Les tableaux de plus de cinq colonnes (.wide) basculent plus tôt. */
@container (max-width: 560px) {
  .table thead { display: none; }
  .table, .table tbody, .table tfoot, .table tr, .table td { display: block; width: 100%; }
  .table tr[data-i], .table tr.row { padding: 11px 14px; border-bottom: 1px solid var(--line); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td, .table td.wrap { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 3px 0; border: 0; white-space: normal; min-width: 0; text-align: right; }
  .table td::before { content: attr(data-label); flex: none; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); text-align: left; }
  .table td:first-child, .table td:last-child { padding-left: 0; padding-right: 0; }
  .table td:first-child { display: block; text-align: left; padding-bottom: 6px; }
  .table td:first-child::before { display: none; }
  .table td > .cell { min-width: 0; }
  .table td.actions { justify-content: flex-end; padding-top: 8px; }
  .table td.actions::before { display: none; }
  .table td.actions:has(.cell:empty) { display: none; }
  .table td[data-label=""]::before { display: none; }
  .table .empty-row td { display: block; text-align: center; }
  .table tfoot tr { padding: 10px 14px; }
}
@container (max-width: 880px) {
  .table.wide thead { display: none; }
  .table.wide, .table.wide tbody, .table.wide tfoot, .table.wide tr, .table.wide td { display: block; width: 100%; }
  .table.wide tr[data-i], .table.wide tr.row { padding: 11px 14px; border-bottom: 1px solid var(--line); }
  .table.wide tbody tr:last-child { border-bottom: 0; }
  .table.wide td, .table.wide td.wrap { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 3px 0; border: 0; white-space: normal; min-width: 0; text-align: right; }
  .table.wide td::before { content: attr(data-label); flex: none; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); text-align: left; }
  .table.wide td:first-child, .table.wide td:last-child { padding-left: 0; padding-right: 0; }
  .table.wide td:first-child { display: block; text-align: left; padding-bottom: 6px; }
  .table.wide td:first-child::before { display: none; }
  .table.wide td > .cell { min-width: 0; }
  .table.wide td.actions { justify-content: flex-end; padding-top: 8px; }
  .table.wide td.actions::before { display: none; }
  .table.wide td.actions:has(.cell:empty) { display: none; }
  .table.wide td[data-label=""]::before { display: none; }
  .table.wide .empty-row td { display: block; text-align: center; }
  .table.wide tfoot tr { padding: 10px 14px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  .side, .topbar, .actas, .no-print, .toasts { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .card, .journal { box-shadow: none; }
  .print-head { display: flex; align-items: center; gap: 14px; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 2px solid var(--brand); font-weight: 700; font-size: 15px; }
  .print-head img { width: 140px; height: auto; }
}

/* Détail technique d'une erreur serveur (back-office) */
.err-detail { max-width: 760px; margin: 0 auto 16px; padding: 10px 14px; text-align: left; font: 12px/1.5 ui-monospace, Consolas, monospace; color: #7f1d1d; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; overflow-wrap: anywhere; }
.err-detail strong { display: block; margin-bottom: 4px; font-family: inherit; }
