/* =========================================================
   MediStock — feuille de style
   ========================================================= */
:root {
  --g-950: #063d23;
  --g-900: #0a5c34;
  --g-700: #0e7a43;
  --g-600: #12884b;
  --g-500: #22a35a;
  --g-200: #c8ead4;
  --g-100: #e4f4ea;
  --g-50:  #f2faf5;
  --bg: #f3f6f4;
  --card: #ffffff;
  --line: #e5ece8;
  --line-2: #eef3f0;
  --text: #13241b;
  --text-2: #3c4d44;
  --muted: #74847b;
  --warn: #f59e0b;
  --warn-bg: #fff4dc;
  --warn-text: #b45309;
  --danger: #e5484d;
  --danger-bg: #fde8e8;
  --danger-text: #c81e25;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(10, 60, 35, .05), 0 6px 22px rgba(10, 60, 35, .06);
  --shadow-lg: 0 20px 50px rgba(10, 60, 35, .16);
  --sidebar: 262px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; zoom: var(--scale, 1); }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--g-700); text-decoration: none; }
img, svg { display: block; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
p { margin: 0; }
code { font-size: .9em; background: var(--g-50); padding: 1px 6px; border-radius: 6px; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.ic { width: 20px; height: 20px; flex: none; }
.mobile-only { display: none !important; }

/* ---------------- Sidebar ---------------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--card); border-right: 1px solid var(--line);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; z-index: 30; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); padding: 0 6px; }
.logo-mark { width: 42px; height: 42px; flex: none; }
.brand-text { display: flex; flex-direction: column; }
.brand-text strong { font-size: 24px; font-weight: 800; color: var(--g-900); letter-spacing: -.02em; line-height: 1.05; }
.brand-text small { font-size: 12px; color: var(--text-2); white-space: nowrap; }

.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a { display: flex; align-items: center; gap: 13px; padding: 11px 14px; border-radius: 12px; color: var(--text-2); font-weight: 500; font-size: 14.5px; transition: background .15s, color .15s; }
.side-nav a:hover { background: var(--g-50); color: var(--g-900); }
.side-nav a.active { background: var(--g-700); color: #fff; font-weight: 600; box-shadow: 0 6px 16px rgba(14, 122, 67, .28); }
.side-nav a .badge { margin-left: auto; }
.badge { font-style: normal; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; display: inline-grid; place-items: center; }

.family-card { margin-top: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--card); position: relative; }
.family-card summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.family-card summary::-webkit-details-marker { display: none; }
.family-card .family-name { font-weight: 600; font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.family-card .ic { width: 16px; color: var(--muted); }
.family-pop { padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line-2); padding-top: 10px; }
.fam-member { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.avatars { display: flex; }
.avatars .avatar + .avatar { margin-left: -8px; }
.avatar { --c: var(--g-700); width: 34px; height: 34px; border-radius: 50%; background: var(--c); color: #fff; font-size: 13px; font-weight: 700; display: inline-grid; place-items: center; border: 2px solid var(--card); flex: none; letter-spacing: .02em; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }
.side-quote { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: 12.5px; font-style: italic; padding: 0 6px; }
.side-quote .ic { color: var(--g-500); width: 22px; height: 22px; }
.link-sm { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.link-sm .ic { width: 15px; height: 15px; }

/* ---------------- Main / topbar ---------------- */
.main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 14px 32px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--text-2); position: relative; background: transparent; border: 0; cursor: pointer; }
.icon-btn:hover { background: var(--card); }
.bell-dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg); }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 600; font-size: 14px; padding: 4px 6px 4px 4px; border-radius: 22px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--card); }
.user-menu summary .ic { width: 16px; color: var(--muted); }
.menu-pop { position: absolute; right: 0; top: calc(100% + 8px); background: var(--card); border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); min-width: 230px; padding: 8px; display: flex; flex-direction: column; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 6px; display: flex; flex-direction: column; }
.menu-head small { color: var(--muted); font-size: 12.5px; }
.menu-pop a, .menu-pop button, .sheet-panel a, .sheet-panel button { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; color: var(--text-2); font-size: 14px; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; font-weight: 500; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--g-50); color: var(--g-900); }
.menu-pop .ic { width: 18px; }

.content { padding: 4px 32px 40px; max-width: 1360px; width: 100%; }

/* ---------------- Flash ---------------- */
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.flash-success { background: var(--g-100); color: var(--g-900); }
.flash-error { background: var(--danger-bg); color: var(--danger-text); }
.flash-info { background: #e8f1fd; color: #1d4ed8; }
.flash span { flex: 1; }
.flash-close { background: none; border: 0; cursor: pointer; opacity: .6; padding: 0; color: inherit; }
.flash-close .ic { width: 16px; }

/* ---------------- Typo pages ---------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 6px 0 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; font-weight: 800; color: var(--g-900); display: flex; align-items: center; gap: 10px; }
.page-head p { color: var(--text-2); font-size: 16px; margin-top: 6px; }
.wave { display: inline-block; transform-origin: 70% 70%; animation: wave 2.4s ease-in-out 1; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(-4deg); } 50% { transform: rotate(10deg); } }

/* ---------------- Cards ---------------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(229, 236, 232, .7); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 8px; gap: 10px; }
.card-head h2 { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.card-head h2 .ic { color: var(--g-700); }
.see-all { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.see-all .ic { width: 15px; height: 15px; }

/* Dashboard grid */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.dash-main, .dash-side { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi { padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 4px; color: var(--text); transition: transform .15s, box-shadow .15s; }
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi-icon { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 10px; }
.kpi-icon .ic { width: 22px; height: 22px; }
.kpi-ok { background: var(--g-100); color: var(--g-700); }
.kpi-ok .ic { background: var(--g-600); color: #fff; border-radius: 50%; padding: 4px; width: 28px; height: 28px; stroke-width: 2.6; }
.kpi-warn { background: var(--warn-bg); color: var(--warn); }
.kpi-warn .ic { background: var(--warn); color: #fff; border-radius: 50%; padding: 5px; width: 28px; height: 28px; stroke-width: 3; }
.kpi-danger { background: var(--danger-bg); color: var(--danger); }
.kpi-neutral { background: var(--g-50); color: var(--g-700); }
.kpi strong { font-size: 15px; font-weight: 600; }
.kpi .num { font-size: 30px; font-weight: 800; line-height: 1.1; }
.kpi .num.warn { color: var(--warn-text); }
.kpi .num.danger { color: var(--danger); }
.kpi small { color: var(--muted); font-size: 13.5px; }

/* Lists */
.list { list-style: none; margin: 0; padding: 4px 10px 10px; }
.row { display: grid; grid-template-columns: 64px minmax(0, 1.6fr) minmax(0, 1fr) 150px minmax(0, 1fr) 22px; align-items: center; gap: 14px; padding: 11px 12px; border-radius: 12px; color: var(--text); }
.row + .row { border-top: 1px solid var(--line-2); }
a.row:hover { background: var(--g-50); }
.row .title strong { display: block; font-weight: 600; font-size: 14.5px; }
.row .title small, .row .meta { color: var(--muted); font-size: 13px; }
.row .chev { color: var(--muted); width: 18px; }
.thumb { width: 60px; height: 44px; display: grid; place-items: center; background: var(--g-50); border-radius: 10px; flex: none; }
.thumb svg { width: 52px; height: 40px; }
.thumb.sm { width: 48px; height: 38px; }
.thumb.sm svg { width: 42px; height: 32px; }
.thumb.lg { width: 110px; height: 84px; border-radius: 16px; }
.thumb.lg svg { width: 96px; height: 72px; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 20px; font-size: 12.5px; font-weight: 600; white-space: nowrap; justify-self: start; }
.pill .ic { width: 14px; height: 14px; }
.pill-ok { background: var(--g-100); color: var(--g-700); }
.pill-warn { background: var(--warn-bg); color: var(--warn-text); }
.pill-danger { background: var(--danger-bg); color: var(--danger-text); }
.pill-muted { background: var(--line-2); color: var(--text-2); }

.dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }
.dot .ic { width: 15px; height: 15px; stroke-width: 2.8; }
.dot-ok { background: var(--g-600); }
.dot-warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-bg); }
.dot-danger { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-bg); }

/* Promo card */
.promo { overflow: hidden; }
.promo-visual { height: 150px; background: linear-gradient(135deg, #d9efe2, #f6fbf8 55%, #e7f3ec); display: grid; place-items: center; position: relative; }
.promo-visual svg.box3d { width: 210px; height: 140px; filter: drop-shadow(0 14px 18px rgba(10, 60, 35, .18)); }
.promo-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.promo-body h3 { display: flex; gap: 12px; align-items: center; font-size: 17px; font-weight: 700; }
.promo-body h3 .logo-mark { width: 34px; height: 34px; }
.promo-body p { color: var(--text-2); font-size: 13.5px; }

.reminders .list { padding-top: 0; }
.rem { display: flex; align-items: center; gap: 12px; padding: 12px; color: var(--text); border-radius: 12px; }
.rem + .rem { border-top: 1px solid var(--line-2); }
a.rem:hover { background: var(--g-50); }
.rem .grow { flex: 1; min-width: 0; }
.rem strong { font-weight: 600; font-size: 14px; display: block; }
.rem small { font-size: 12.5px; font-weight: 500; }
.rem small.warn { color: var(--warn-text); }
.rem small.danger { color: var(--danger-text); }
.rem small.ok { color: var(--g-700); }
.rem .chev { color: var(--muted); width: 18px; }

.info-box { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px; background: var(--g-50); border: 1px solid var(--g-100); border-radius: var(--radius); color: var(--text-2); font-size: 13px; }
.info-box .ic-wrap { width: 30px; height: 30px; border-radius: 50%; background: var(--g-700); color: #fff; display: grid; place-items: center; flex: none; }
.info-box .ic-wrap .ic { width: 17px; }
.info-box.tip .ic-wrap { background: var(--g-100); color: var(--g-700); }

/* Categories */
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; padding: 6px 22px 22px; }
.cat { border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 4px; color: var(--text); transition: border-color .15s, background .15s; }
.cat:hover, .cat.active { border-color: var(--g-500); background: var(--g-50); }
.cat .ic { color: var(--g-700); width: 26px; height: 26px; margin-bottom: 8px; }
.cat span { font-size: 13px; font-weight: 500; color: var(--text-2); }
.cat strong { font-size: 15px; }

/* Table */
.table-wrap { overflow-x: auto; padding: 0 10px 12px; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .cell-med { display: flex; align-items: center; gap: 12px; }
.table .cell-med small { display: block; color: var(--muted); font-size: 12px; }
.table .ico-cell { width: 38px; height: 38px; border-radius: 10px; background: var(--g-50); color: var(--g-700); display: grid; place-items: center; }
.t-warn { color: var(--warn-text); font-weight: 600; }
.t-danger { color: var(--danger-text); font-weight: 600; }
.t-ok { color: var(--g-700); font-weight: 600; }
.t-right { text-align: right; }

/* ---------------- Buttons & forms ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: 14.5px; cursor: pointer; border: 1.5px solid transparent; text-decoration: none; transition: background .15s, box-shadow .15s, transform .05s; white-space: nowrap; line-height: 1.2; }
.btn:active { transform: translateY(1px); }
.btn .ic { width: 19px; height: 19px; }
.btn-primary { background: var(--g-700); color: #fff; box-shadow: 0 6px 16px rgba(14, 122, 67, .25); }
.btn-primary:hover { background: var(--g-900); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-outline { background: var(--card); color: var(--g-700); border-color: var(--g-700); }
.btn-outline:hover { background: var(--g-50); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--line-2); }
.btn-danger { background: var(--card); color: var(--danger-text); border-color: #f4c3c5; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 20px; font-size: 15.5px; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
.field.full { grid-column: 1 / -1; }
.input, .select, textarea.input { width: 100%; font: inherit; font-size: 15px; font-weight: 400; color: var(--text); padding: 11px 13px; border-radius: 11px; border: 1.5px solid var(--line); background: var(--card); outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus, .select:focus { border-color: var(--g-500); box-shadow: 0 0 0 4px rgba(34, 163, 90, .12); }
.input::placeholder { color: #a5b2ab; }
textarea.input { min-height: 90px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2374847b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 38px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 16px; }
.hint { font-size: 13px; color: var(--muted); font-weight: 400; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--g-700); }

.stepper { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 11px; overflow: hidden; background: var(--card); }
.stepper input { border: 0; text-align: center; width: 100%; min-width: 0; padding: 11px 4px; font: inherit; font-size: 15px; outline: none; }
.stepper button { width: 42px; height: 44px; background: var(--g-50); border: 0; cursor: pointer; display: grid; place-items: center; color: var(--g-700); flex: none; }
.stepper button:hover { background: var(--g-100); }
.stepper .ic { width: 18px; }

.form-card { max-width: 860px; }
.form-card form { display: flex; flex-direction: column; gap: 18px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; flex-wrap: wrap; }
.form-actions .spacer { flex: 1; }

/* Segmented tabs */
.tabs { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.tabs a:hover { background: var(--g-50); }
.tabs a.active { background: var(--g-700); color: #fff; }
.tabs a.active.danger { background: var(--danger); }
.tabs a .ic { width: 16px; height: 16px; }
.tabs.full { display: flex; width: 100%; }
.tabs.full a { flex: 1; justify-content: center; }

.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.search { position: relative; flex: 1; min-width: 220px; }
.search .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; }
.search .input { padding-left: 40px; }

/* Stock list */
.stock-list .row { grid-template-columns: 64px minmax(0, 1.7fr) minmax(0, 1fr) 150px 150px 22px; }
.qty-ctl { display: inline-flex; align-items: center; gap: 4px; background: var(--g-50); border-radius: 10px; padding: 3px; justify-self: start; }
.qty-ctl button { width: 30px; height: 30px; border-radius: 8px; border: 0; background: var(--card); color: var(--g-700); cursor: pointer; display: grid; place-items: center; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.qty-ctl button:hover { background: var(--g-100); }
.qty-ctl button .ic { width: 15px; height: 15px; }
.qty-ctl output { min-width: 64px; text-align: center; font-size: 13px; font-weight: 600; }

.empty { text-align: center; padding: 46px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty .empty-ic { width: 64px; height: 64px; border-radius: 50%; background: var(--g-50); display: grid; place-items: center; color: var(--g-700); }
.empty .empty-ic .ic { width: 30px; height: 30px; }
.empty h3 { color: var(--text); font-size: 17px; }

/* Med detail */
.med-hero { display: flex; gap: 20px; align-items: center; padding: 22px; flex-wrap: wrap; }
.med-hero h1 { font-size: 24px; font-weight: 800; color: var(--g-900); }
.med-hero .sub { color: var(--muted); margin-top: 4px; }
.med-hero .grow { flex: 1; min-width: 200px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0; border-top: 1px solid var(--line-2); }
.fact { padding: 16px 22px; border-right: 1px solid var(--line-2); }
.fact small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.fact strong { font-size: 15px; }

/* History */
.timeline { list-style: none; margin: 0; padding: 6px 22px 18px; }
.timeline li { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-2); align-items: center; }
.timeline li:last-child { border-bottom: 0; }
.tl-ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--g-50); color: var(--g-700); }
.tl-ic .ic { width: 17px; }
.tl-ic.del { background: var(--danger-bg); color: var(--danger); }
.tl-ic.adj { background: #e8f1fd; color: #2563eb; }
.timeline .grow { flex: 1; min-width: 0; }
.timeline small { color: var(--muted); font-size: 12.5px; }
.day-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 16px 22px 0; }

/* Admin */
.admin-tabs { margin-bottom: 18px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form .input, .inline-form .select { width: auto; flex: 1; min-width: 140px; padding: 8px 11px; font-size: 14px; }
.icon-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-pick label { cursor: pointer; }
.icon-pick input { display: none; }
.icon-pick span { width: 38px; height: 38px; border-radius: 10px; border: 1.5px solid var(--line); display: grid; place-items: center; color: var(--text-2); }
.icon-pick input:checked + span { border-color: var(--g-700); background: var(--g-50); color: var(--g-700); }
.code-block { background: var(--g-950); color: #d1f4df; border-radius: 12px; padding: 12px 14px; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; overflow-x: auto; white-space: pre; }
.section-gap > * + * { margin-top: 22px; }

/* ---------------- Scan ---------------- */
body.scan-mode { background: #0b1410; }
.scan-wrap { position: relative; border-radius: 22px; overflow: hidden; background: #111; aspect-ratio: 4 / 3; max-height: 70vh; width: 100%; }
.scan-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.scan-frame .frame { width: min(60%, 280px); aspect-ratio: 1; position: relative; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .38); border-radius: 18px; }
.scan-frame .frame i { position: absolute; width: 46px; height: 46px; border: 4px solid #3ddc84; }
.scan-frame .frame i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 18px; }
.scan-frame .frame i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 18px; }
.scan-frame .frame i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 18px; }
.scan-frame .frame i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 18px; }
.scan-frame .laser { position: absolute; left: 8%; right: 8%; height: 2px; background: linear-gradient(90deg, transparent, #3ddc84, transparent); top: 10%; animation: laser 2s ease-in-out infinite alternate; }
@keyframes laser { to { top: 88%; } }
.scan-msg { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; color: #fff; font-size: 14px; font-weight: 500; text-shadow: 0 1px 4px rgba(0, 0, 0, .5); padding: 0 20px; }
.scan-state { position: absolute; inset: 0; display: grid; place-items: center; color: #cfe; text-align: center; padding: 24px; gap: 12px; align-content: center; }
.scan-state .ic { width: 40px; height: 40px; margin: 0 auto; }
.scan-controls { display: flex; align-items: center; justify-content: center; gap: 34px; padding: 22px 0 6px; }
.shutter { width: 74px; height: 74px; border-radius: 50%; border: 4px solid var(--g-700); background: #fff; cursor: pointer; box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 30px var(--g-50); }
.shutter:active { transform: scale(.96); }
.round-btn { width: 50px; height: 50px; border-radius: 50%; border: 0; background: var(--card); color: var(--text-2); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); }
.round-btn.on { background: #fde68a; color: #92400e; }
.scan-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.scan-result { display: none; }
.scan-result.show { display: flex; }

/* ---------------- Sheets (mobile) ---------------- */
.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(6, 30, 18, .35); animation: fade .2s; }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; background: var(--card); border-radius: 22px 22px 0 0; padding: 10px 14px calc(18px + var(--safe-b)); display: flex; flex-direction: column; gap: 2px; animation: up .22s ease-out; }
.sheet-panel form { margin: 0; }
.sheet-panel .ic { color: var(--g-700); }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 2px auto 10px; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

/* ---------------- Bottom nav ---------------- */
.bottom-nav { display: none; }

/* ---------------- Auth / install ---------------- */
body.auth { background: linear-gradient(160deg, #eaf6ef, #f7fbf9 45%, #e3f2e9); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; max-width: 1180px; margin: 0 auto; gap: 40px; padding: 40px 28px; align-items: center; }
.auth-brand { display: flex; flex-direction: column; gap: 30px; align-items: center; text-align: center; padding: 20px; }
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.logo-xl { width: 84px; height: 84px; margin-bottom: 8px; }
.logo-lg { width: 52px; height: 52px; }
.auth-logo h2 { font-size: 46px; font-weight: 800; color: var(--g-900); letter-spacing: -.03em; }
.auth-logo p { font-size: 18px; color: var(--text-2); }
.auth-brand h3 { font-size: 26px; font-weight: 700; color: var(--g-900); line-height: 1.3; }
.features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 22px; text-align: left; max-width: 400px; }
.features li { display: flex; gap: 18px; align-items: center; }
.features li > span { width: 64px; height: 64px; border-radius: 50%; background: var(--g-700); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 10px 22px rgba(14, 122, 67, .25); }
.features li > span .ic { width: 28px; height: 28px; }
.features strong { font-size: 16px; color: var(--text); }
.features p { color: var(--text-2); font-size: 14px; margin-top: 3px; }
.script { font-family: "Caveat", cursive; font-size: 30px; color: var(--g-700); transform: rotate(-6deg); }
.auth-form { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.auth-mobile-logo { display: none; }
.auth-card { width: 100%; max-width: 480px; background: var(--card); border-radius: 22px; box-shadow: var(--shadow-lg); padding: 30px; display: flex; flex-direction: column; gap: 16px; }
.auth-card.install { max-width: 620px; }
.auth-card h1 { font-size: 24px; font-weight: 800; color: var(--g-900); }
.auth-card fieldset { border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px 18px; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-card legend { font-weight: 700; font-size: 15px; padding: 0 8px; display: flex; gap: 8px; align-items: center; }
.step { width: 24px; height: 24px; border-radius: 50%; background: var(--g-700); color: #fff; font-size: 12.5px; display: grid; place-items: center; }
.eyebrow { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; font-weight: 700; color: var(--g-700); background: var(--g-50); border-radius: 20px; padding: 5px 11px; align-self: flex-start; text-transform: uppercase; letter-spacing: .04em; }
.eyebrow .ic { width: 15px; height: 15px; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 13px; }
.checks li { display: flex; gap: 7px; align-items: center; }
.checks .ic { width: 16px; height: 16px; stroke-width: 2.6; }
.checks .ok { color: var(--g-700); }
.checks .ko { color: var(--danger-text); font-weight: 600; }
.auth-foot { text-align: center; font-size: 14px; color: var(--text-2); }
.auth-foot a { font-weight: 600; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1200px) {
  .dash { grid-template-columns: 1fr; }
  .dash-side { display: grid; grid-template-columns: 1fr 1fr; }
  .scan-layout { grid-template-columns: 1fr; }
}

@media (max-width: 1020px) {
  .row, .stock-list .row { grid-template-columns: 56px minmax(0, 1fr) auto 22px; }
  .row .hide-md { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  :root { --sidebar: 0px; }
  .mobile-only { display: revert !important; }
  .mobile-only.icon-btn { display: grid !important; }
  .mobile-brand { display: flex !important; align-items: center; gap: 8px; font-weight: 800; color: var(--g-900); font-size: 19px; }
  .mobile-brand .logo-mark { width: 30px; height: 30px; }
  .desktop-only { display: none !important; }
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: calc(84px + var(--safe-b)); }
  .topbar { padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top, 0px)); background: color-mix(in srgb, var(--bg) 92%, transparent); }
  .mobile-title { font-size: 19px; font-weight: 700; }
  .content { padding: 2px 16px 24px; }
  .page-head { margin: 4px 0 16px; }
  .page-head h1 { font-size: 22px; }
  .page-head p { font-size: 14px; }
  .page-head.hide-mobile-title h1, .page-head.hide-mobile-title > div > p { display: none; }
  .dash, .dash-main, .dash-side { gap: 16px; }
  .dash-side { display: flex; }
  .kpis { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .kpi { padding: 12px 10px; border-radius: 14px; }
  .kpi-icon { width: 30px; height: 30px; margin-bottom: 6px; }
  .kpi-icon .ic, .kpi-ok .ic, .kpi-warn .ic { width: 20px; height: 20px; padding: 3px; }
  .kpi-danger .ic, .kpi-neutral .ic { width: 18px; height: 18px; padding: 0; }
  .kpi strong { font-size: 11.5px; line-height: 1.2; min-height: 2.4em; }
  .kpi .num { font-size: 22px; }
  .kpi small { display: none; }
  .card-head { padding: 14px 16px 4px; }
  .card-head h2 { font-size: 15.5px; }
  .list { padding: 2px 6px 8px; }
  .row, .stock-list .row { grid-template-columns: 52px minmax(0, 1fr) auto 16px; gap: 10px; padding: 10px 8px; }
  .thumb { width: 52px; height: 40px; }
  .thumb svg { width: 46px; height: 34px; }
  .cats { grid-template-columns: repeat(3, 1fr); padding: 4px 14px 16px; gap: 8px; }
  .cat { padding: 10px; }
  .cat .ic { width: 22px; height: 22px; margin-bottom: 4px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-2.keep { grid-template-columns: 1fr 1fr; }
  .toolbar { gap: 10px; }
  .tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .tabs a { white-space: nowrap; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
  .form-actions .spacer { display: none; }
  .table-hide-sm { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .facts { grid-template-columns: 1fr 1fr; }
  .med-hero { padding: 18px; }
  .hide-mobile { display: none !important; }
  .dash-side .promo { order: 2; }
  .dash-side .reminders { order: 1; }

  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--card); border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + var(--safe-b)); box-shadow: 0 -6px 20px rgba(10, 60, 35, .06);
  }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); background: none; border: 0; padding: 6px 0; position: relative; cursor: pointer; }
  .bottom-nav .ic { width: 23px; height: 23px; }
  .bottom-nav .active { color: var(--g-700); }
  .bottom-nav .badge { position: absolute; top: 0; left: 52%; height: 17px; min-width: 17px; font-size: 10px; border: 2px solid var(--card); }
  .bottom-nav .fab { width: 60px; height: 60px; border-radius: 50%; background: var(--g-700); color: #fff; justify-self: center; margin-top: -26px; display: grid; place-items: center; box-shadow: 0 8px 20px rgba(14, 122, 67, .4), 0 0 0 6px var(--card); padding: 0; }
  .bottom-nav .fab .ic { width: 28px; height: 28px; }

  .auth-wrap { grid-template-columns: 1fr; padding: 24px 16px; gap: 10px; }
  .auth-brand { display: none; }
  .auth-mobile-logo { display: flex; gap: 12px; align-items: center; }
  .auth-mobile-logo strong { display: block; font-size: 26px; font-weight: 800; color: var(--g-900); line-height: 1; }
  .auth-mobile-logo small { color: var(--text-2); }
  .auth-card { padding: 22px 18px; border-radius: 20px; }
  .checks { grid-template-columns: 1fr; }

  body.scan-mode .topbar { background: #0b1410; color: #fff; }
  body.scan-mode .topbar .icon-btn { color: #fff; }
  body.scan-mode .topbar .icon-btn:hover { background: rgba(255, 255, 255, .1); }
  body.scan-mode .bell-dot { border-color: #0b1410; }
  body.scan-mode .content { padding: 0; }
  body.scan-mode .scan-wrap { border-radius: 0; aspect-ratio: auto; height: calc(100vh - 230px); height: calc(100dvh - 230px); max-height: none; }
  body.scan-mode .scan-side { padding: 0 16px; }
  body.scan-mode .scan-side .card { background: #14211b; border-color: #22332a; color: #e6f2ec; }
  body.scan-mode .scan-side .muted, body.scan-mode .scan-side .hint { color: #9db3a7; }
  body.scan-mode .round-btn { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: none; }
  body.scan-mode .round-btn.on { background: #fde68a; color: #92400e; }
  body.scan-mode .shutter { border-color: #fff; background: transparent; box-shadow: inset 0 0 0 4px #0b1410, inset 0 0 0 40px #fff; }
  body.scan-mode .user-menu summary .avatar { border-color: #0b1410; }
}

@media (max-width: 380px) {
  .kpi strong { font-size: 10.5px; }
  .kpi .num { font-size: 20px; }
}

@media print {
  .sidebar, .topbar, .bottom-nav, .btn { display: none !important; }
  .main { margin: 0; }
}

/* ---------------- Sécurité / admin (compléments) ---------------- */
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.empty-ic { width: 64px; height: 64px; border-radius: 50%; background: var(--g-50); display: grid; place-items: center; color: var(--g-700); flex: none; }
.empty-ic .ic { width: 30px; height: 30px; }
.ic.inline { width: 17px; height: 17px; display: inline-block; vertical-align: -3px; margin-right: 2px; }
.code-input { font-size: 28px; font-weight: 700; letter-spacing: .35em; text-align: center; padding: 14px; font-variant-numeric: tabular-nums; }
.code-input.sm { font-size: 20px; letter-spacing: .25em; padding: 9px; max-width: 180px; flex: none !important; }
.totp-setup { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; margin-top: 6px; }
.totp-setup .qr { width: 176px; height: 176px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 6px; flex: none; }
.totp-setup .qr svg { width: 100%; height: 100%; }
.totp-setup > div:last-child { flex: 1; min-width: 220px; }
.steps-list { margin: 0 0 12px; padding-left: 20px; font-size: 14px; color: var(--text-2); display: flex; flex-direction: column; gap: 6px; }
.secret { font-size: 13px; letter-spacing: .06em; word-break: break-all; }
.row-menu { position: relative; display: inline-block; text-align: left; }
.row-menu summary { list-style: none; }
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu .menu-pop { z-index: 15; min-width: 250px; }
.row-menu form { margin: 0; }
.menu-pop button.danger { color: var(--danger-text); }
.menu-pop button.danger:hover { background: var(--danger-bg); color: var(--danger-text); }
.table-wrap { overflow: visible; }
@media (max-width: 860px) { .table-wrap { overflow-x: auto; } .users-table .row-menu .menu-pop { position: fixed; left: 12px; right: 12px; top: auto; bottom: calc(90px + var(--safe-b)); min-width: 0; } }
.cat-line { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.cat-line.new { border-bottom: 0; padding-top: 16px; }
.cat-form { display: flex; gap: 10px; align-items: center; flex: 1; flex-wrap: wrap; }
.cat-form > .input:first-of-type { flex: 1; min-width: 160px; }
.icon-pick span .ic { width: 18px; height: 18px; }
.icon-pick span i { display: block; }
.admin-tabs .badge { margin-left: 2px; }
.flash-info .ic { color: #2563eb; }
.side-nav a { white-space: nowrap; font-size: 14px; }
.qty-ctl output { white-space: nowrap; min-width: 92px; }
.stock-list .row { grid-template-columns: 64px minmax(0, 1.7fr) minmax(0, .8fr) 190px 150px 22px; }
@media (max-width: 1020px) { .stock-list .row { grid-template-columns: 56px minmax(0, 1fr) auto 22px; } }
@media (max-width: 860px) { .stock-list .row { grid-template-columns: 52px minmax(0, 1fr) auto 16px; } }
.form-card form.inline-form { flex-direction: row; gap: 12px; }
@media (max-width: 860px) {
  .mobile-title { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 62vw; }
  body.scan-mode .scan-wrap { height: calc(100vh - 310px); height: calc(100dvh - 310px); min-height: 300px; }
  body.scan-mode .scan-controls { padding: 16px 0 14px; }
}

/* ---------------- Visuels des boîtes ---------------- */
.thumb { width: 66px; height: 46px; background: none; border-radius: 10px; padding: 0; }
.thumb svg { width: 100%; height: 100%; overflow: visible; }
.thumb.sm { width: 54px; height: 38px; }
.thumb.sm svg { width: 100%; height: 100%; }
.thumb.lg { width: 150px; height: 105px; border-radius: 16px; }
.thumb.lg svg { width: 100%; height: 100%; }
.thumb.xl { width: 172px; height: 120px; border-radius: 16px; }
.thumb.photo { background: var(--card); border: 1px solid var(--line); overflow: hidden; box-shadow: 0 2px 6px rgba(10, 60, 35, .08); }
.thumb.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-pick { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; padding: 12px; border: 1.5px dashed var(--g-200); border-radius: 16px; background: var(--g-50); }
.photo-preview { display: grid; place-items: center; min-width: 172px; }
.photo-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; flex: 1; min-width: 200px; }
.photo-actions .btn { cursor: pointer; }
@media (max-width: 860px) {
  .thumb { width: 58px; height: 41px; }
  .thumb.lg { width: 120px; height: 84px; }
  .photo-preview { min-width: 0; }
  .photo-pick { flex-direction: column; align-items: stretch; }
  .photo-preview .thumb.xl { width: 100%; height: 190px; }
}

/* ---------------- Inventaires, espace, bibliothèque ---------------- */
.inv-bar { display: flex; gap: 8px; margin: 0 0 18px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.inv-bar::-webkit-scrollbar { display: none; }
.inv-bar a { --c: var(--g-700); display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); color: var(--text-2); font-size: 13.5px; font-weight: 600; white-space: nowrap; transition: border-color .15s, background .15s; }
.inv-bar a .ic { width: 17px; height: 17px; color: var(--c); }
.inv-bar a em { font-style: normal; font-size: 11.5px; background: var(--line-2); border-radius: 10px; padding: 1px 7px; color: var(--muted); }
.inv-bar a:hover { border-color: var(--c); }
.inv-bar a.active { background: var(--c); border-color: var(--c); color: #fff; }
.inv-bar a.active .ic { color: #fff; }
.inv-bar a.active em { background: rgba(255, 255, 255, .25); color: #fff; }
.inv-bar .inv-manage { padding: 8px 10px; }
.inv-badge { --c: var(--g-700); display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 10%, var(--card)); border-radius: 8px; padding: 2px 7px; margin-bottom: 3px; white-space: nowrap; }
.inv-badge .ic { width: 12px; height: 12px; }
.title .inv-badge { margin-left: 0; }
.stock-list .title strong + .inv-badge { margin-left: 6px; vertical-align: 2px; }
.inv-ic { --c: var(--g-700); width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 12%, var(--card)); color: var(--c); flex: none; }
.inv-row summary { list-style: none; cursor: pointer; }
.inv-row summary::-webkit-details-marker { display: none; }
.inv-row + .inv-row { border-top: 1px solid var(--line-2); }
.inv-row .rem + * { }
.inv-edit { padding: 4px 12px 16px 64px; }
.inv-form { display: flex; flex-direction: column; gap: 10px; }
.member-row + .member-row { border-top: 1px solid var(--line-2); }
.member-row .inline-form .select { padding: 7px 34px 7px 10px; font-size: 13.5px; }
.role-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.role-pick input { display: none; }
.role-pick span { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; height: 100%; }
.role-pick strong { font-size: 13.5px; }
.role-pick small { font-size: 12px; color: var(--muted); line-height: 1.35; }
.role-pick input:checked + span { border-color: var(--g-700); background: var(--g-50); }
.qty-ctl.readonly button { display: none; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; padding: 6px 22px 22px; }
.img-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card); }
.img-card summary { list-style: none; cursor: pointer; }
.img-card summary::-webkit-details-marker { display: none; }
.img-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--g-50); }
.img-label { display: flex; flex-direction: column; padding: 8px 10px 10px; }
.img-label strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.img-label small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.img-meta { display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.img-meta .input { padding: 7px 10px; font-size: 13px; }
.missing-row { margin: 0; }
@media (max-width: 860px) {
  .role-pick { grid-template-columns: 1fr; }
  .inv-edit { padding-left: 12px; }
  .img-grid { grid-template-columns: repeat(2, 1fr); padding: 6px 14px 16px; gap: 10px; }
  .inv-bar { margin-bottom: 14px; }
}
.custom-logo { object-fit: contain; }

/* ---------------- Statistiques ---------------- */
.stat-grid-6 { grid-template-columns: repeat(3, 1fr); }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.chart-title { font-size: 16px; font-weight: 700; }
.chart-sub { font-size: 13px; color: var(--muted); margin: 2px 0 12px; }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; font-family: var(--font); }
svg.chart .grid { stroke: var(--line-2); stroke-width: 1; }
svg.chart .axis { stroke: var(--line); stroke-width: 1; }
svg.chart .tick { fill: var(--muted); font-size: 11px; }
svg.chart .hit { fill: transparent; cursor: default; }
svg.chart .col:hover .hit { fill: rgba(18, 136, 75, .06); }
svg.chart .area { opacity: .12; }
svg.chart .pt circle, svg.chart .pt .cross { opacity: 0; transition: opacity .1s; }
svg.chart .pt .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
svg.chart .pt:hover circle, svg.chart .pt:hover .cross { opacity: 1; }
svg.chart .pt circle { stroke: var(--card); stroke-width: 2; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-legend small { color: var(--muted); }
.chart-data { margin-top: 8px; font-size: 12.5px; }
.chart-data summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.chart-data .table-wrap { max-height: 240px; overflow: auto; padding: 0; }
.hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.hbars li { display: grid; grid-template-columns: minmax(0, 170px) minmax(0, 1fr) 44px; gap: 10px; align-items: center; font-size: 13px; }
.hb-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.hb-label small { display: block; color: var(--muted); font-size: 11.5px; }
.hb-track { height: 10px; background: var(--line-2); border-radius: 5px; overflow: hidden; }
.hb-track i { display: block; height: 100%; background: #12884b; border-radius: 0 4px 4px 0; }
.hb-val { text-align: right; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.statusbar { display: flex; gap: 2px; height: 16px; border-radius: 6px; overflow: hidden; margin: 6px 0 14px; }
.statusbar i { display: block; min-width: 3px; }
.st-ok { background: var(--g-600); color: var(--g-700); }
.st-warn { background: var(--warn); color: var(--warn-text); }
.st-danger { background: var(--danger); color: var(--danger-text); }
.st-ic.st-ok, .st-ic.st-warn, .st-ic.st-danger { background: none; width: 15px; height: 15px; }
.statusbar + .chart-legend { flex-direction: column; gap: 8px; font-size: 13.5px; }
.brand-form { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }
.brand-preview { width: 240px; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px; border-radius: 16px; background: var(--g-50); border: 1px solid var(--g-100); text-align: center; }
.brand-preview-box { width: 96px; height: 96px; display: grid; place-items: center; }
.brand-preview-box .logo-xl { width: 88px; height: 88px; margin: 0; }
.brand-preview-name strong { display: block; font-size: 22px; font-weight: 800; color: var(--g-900); }
.brand-preview-name small { color: var(--text-2); }
.brand-icons { display: flex; align-items: center; gap: 10px; }
.brand-icons img { border-radius: 10px; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.brand-fields { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 1100px) { .stats-grid { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .stat-grid-6 { grid-template-columns: 1fr 1fr; }
  .hbars li { grid-template-columns: minmax(0, 110px) minmax(0, 1fr) 36px; }
  .brand-preview { width: 100%; }
}
.st-low { background: repeating-linear-gradient(135deg, var(--danger) 0 4px, #f59e9f 4px 7px); color: var(--danger-text); }
.st-ic.st-low { background: none; width: 15px; height: 15px; }

/* ---------------- Courses, rappels, profils ---------------- */
.shop-add { display: flex; gap: 8px; padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.shop-list { list-style: none; margin: 0; padding: 6px 12px 12px; }
.shop-list li { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-bottom: 1px solid var(--line-2); }
.shop-list li:last-child { border-bottom: 0; }
.shop-list .grow { flex: 1; min-width: 0; }
.shop-list small { display: block; }
.shop-list form { margin: 0; }
.shop-check { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--g-500); background: var(--card); color: transparent; display: grid; place-items: center; cursor: pointer; padding: 0; }
.shop-check .ic { width: 16px; height: 16px; stroke-width: 3; }
.shop-list li.done .shop-check { background: var(--g-600); border-color: var(--g-600); color: #fff; }
.shop-list li.done strong { text-decoration: line-through; color: var(--muted); }
.recall-banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: var(--danger-bg); border: 1px solid #f6c4c6; color: var(--danger-text); margin-bottom: 16px; }
.recall-banner .ic-wrap { width: 30px; height: 30px; border-radius: 50%; background: var(--danger); color: #fff; display: grid; place-items: center; flex: none; }
.recall-banner .ic-wrap .ic { width: 17px; }
.recall-banner p { font-size: 13.5px; color: #7f1d1d; margin-top: 2px; }
.recall-banner a { color: var(--danger-text); font-weight: 700; text-decoration: underline; }
.recall-banner.allergy { background: #fff4e5; border-color: #fbd38d; color: #9a3412; }
.recall-banner.allergy .ic-wrap { background: #ea580c; }
.recall-banner.allergy p { color: #7c2d12; }
.person-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--line-2); border-radius: 12px; padding: 2px 9px 2px 2px; }
.person-chip .avatar { width: 20px; height: 20px; font-size: 9px; border-width: 0; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.person-card { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.person-card header { display: flex; gap: 12px; align-items: center; }
.person-card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13.5px; }
.person-card dt { color: var(--muted); font-weight: 600; }
.person-card dd { margin: 0; }
.allergy-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.allergy-tags span { background: #fff4e5; color: #9a3412; border-radius: 8px; padding: 2px 8px; font-size: 12px; font-weight: 600; }
.official-links { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-card form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tool-card .input, .tool-card .select { width: auto; flex: 1; min-width: 110px; padding: 8px 11px; font-size: 14px; }
@media print {
  .no-print, .flash { display: none !important; }
  body, .card { background: #fff !important; box-shadow: none !important; }
  .content { padding: 0 !important; }
}


/* =========================================================
   Thème sombre (choix « Sombre », ou « Automatique » si le système est en sombre)
   ========================================================= */
:root[data-theme="dark"] {
  --g-50: #11281c; --g-100: #163524; --g-200: #1f4a33; --g-700: #2fb36a; --g-900: #7ee0a6; --g-950: #04140c; --g-600: #27a35e; --g-500: #3cc47a;
  --bg: #0d1511; --card: #15201a; --line: #253329; --line-2: #1c2921;
  --text: #e7f0ea; --text-2: #b9c8bf; --muted: #84968b;
  --warn-bg: #3a2a0c; --warn-text: #fbbf55; --danger-bg: #3d1517; --danger-text: #ff8a8e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 20px 50px rgba(0, 0, 0, .55);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --g-50: #11281c; --g-100: #163524; --g-200: #1f4a33; --g-700: #2fb36a; --g-900: #7ee0a6; --g-950: #04140c; --g-600: #27a35e; --g-500: #3cc47a;
    --bg: #0d1511; --card: #15201a; --line: #253329; --line-2: #1c2921;
    --text: #e7f0ea; --text-2: #b9c8bf; --muted: #84968b;
    --warn-bg: #3a2a0c; --warn-text: #fbbf55; --danger-bg: #3d1517; --danger-text: #ff8a8e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 20px 50px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
/* éléments à ajuster en sombre (couleurs fixes) */
:root[data-theme="dark"] .side-nav a.active, :root[data-theme="dark"] .btn-primary, :root[data-theme="dark"] .tabs a.active, :root[data-theme="dark"] .bottom-nav .fab { background: #12884b; color: #fff; }
:root[data-theme="dark"] .card { border-color: var(--line); }
:root[data-theme="dark"] .recall-banner { border-color: #5c2326; }
:root[data-theme="dark"] .recall-banner p, :root[data-theme="dark"] .recall-banner.allergy p { color: var(--text-2); }
:root[data-theme="dark"] .recall-banner.allergy { background: #33200b; border-color: #5a3a12; color: #fdba74; }
:root[data-theme="dark"] .allergy-tags span { background: #33200b; color: #fdba74; }
:root[data-theme="dark"] .thumb.photo, :root[data-theme="dark"] .img-card img { background: #fff; }
:root[data-theme="dark"] .select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2384968b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] .flash-info { background: #10243f; color: #93c5fd; }
:root[data-theme="dark"] body.auth { background: linear-gradient(160deg, #0d1511, #101c15 45%, #0d1511); }
:root[data-theme="dark"] .code-block { background: #04140c; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .side-nav a.active, :root[data-theme="auto"] .btn-primary, :root[data-theme="auto"] .tabs a.active, :root[data-theme="auto"] .bottom-nav .fab { background: #12884b; color: #fff; }
  :root[data-theme="auto"] .card { border-color: var(--line); }
  :root[data-theme="auto"] .recall-banner p, :root[data-theme="auto"] .recall-banner.allergy p { color: var(--text-2); }
  :root[data-theme="auto"] .recall-banner.allergy { background: #33200b; border-color: #5a3a12; color: #fdba74; }
  :root[data-theme="auto"] .allergy-tags span { background: #33200b; color: #fdba74; }
  :root[data-theme="auto"] .thumb.photo, :root[data-theme="auto"] .img-card img { background: #fff; }
  :root[data-theme="auto"] .flash-info { background: #10243f; color: #93c5fd; }
  :root[data-theme="auto"] body.auth { background: linear-gradient(160deg, #0d1511, #101c15 45%, #0d1511); }
}

/* ---------------- Affichage, hors ligne, sauvegardes ---------------- */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg input { display: none; }
.seg span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1.5px solid var(--line); border-radius: 11px; cursor: pointer; font-weight: 600; color: var(--text-2); background: var(--card); }
.seg span .ic { width: 16px; height: 16px; }
.seg input:checked + span { border-color: var(--g-700); background: var(--g-50); color: var(--g-900); }
.push-box { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.offline-bar { display: flex; align-items: center; gap: 10px; background: #1f2937; color: #f9fafb; border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-size: 13.5px; font-weight: 600; }
.offline-bar .ic { width: 18px; height: 18px; }

/* ---------------- Rafale, symptômes ---------------- */
.burst-bar { display: flex; justify-content: center; padding-top: 14px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text); }
.switch small { font-weight: 400; color: var(--muted); }
.switch input { display: none; }
.switch span { width: 42px; height: 24px; border-radius: 12px; background: var(--line); position: relative; transition: background .15s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--g-600); }
.switch input:checked + span::after { transform: translateX(18px); }
body.scan-mode .switch { color: #e6f2ec; }
.burst-panel { margin-top: 12px; padding: 12px 14px; }
.burst-head { display: flex; align-items: center; gap: 8px; }
.burst-head strong { flex: 1; }
.burst-panel ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }
.burst-panel li::before { content: "✓ "; color: var(--g-600); font-weight: 700; }
body.scan-mode .burst-panel { background: #14211b; border-color: #22332a; color: #e6f2ec; }
.batch-list { padding: 6px 14px; }
.batch-row { display: grid; grid-template-columns: 64px minmax(0, 1.6fr) 110px 150px minmax(0, 1fr) minmax(0, 1.3fr); gap: 12px; align-items: end; padding: 14px 4px; border-bottom: 1px solid var(--line-2); }
.batch-row:last-child { border-bottom: 0; }
.batch-row > .thumb { align-self: center; }
.batch-main { display: flex; flex-direction: column; gap: 4px; align-self: center; }
.batch-opts { display: flex; flex-direction: column; gap: 6px; }
.batch-row .input, .batch-row .select { padding: 8px 10px; font-size: 14px; }
.symptom-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.symptom { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line); color: var(--text); font-weight: 600; font-size: 14px; transition: border-color .15s, background .15s; }
.symptom .ic { color: var(--g-700); }
.symptom:hover { border-color: var(--g-500); }
.symptom.active { border-color: var(--g-700); background: var(--g-50); }
.rem.dim strong, .rem.dim .thumb { opacity: .55; }
.rem small.warn { color: var(--warn-text); font-weight: 600; }
@media (max-width: 1020px) { .batch-row { grid-template-columns: 56px 1fr 1fr; } .batch-main { grid-column: 2 / -1; } .batch-opts { grid-column: 1 / -1; } }
@media (max-width: 860px) { .symptom-grid { grid-template-columns: 1fr 1fr; } }
.suggest-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.suggest { border: 1.5px dashed var(--g-200); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--g-50); }
.suggest-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.suggest .input { padding: 8px 10px; font-size: 14px; }
.shortage-pill { padding: 2px 8px; font-size: 11px; vertical-align: 1px; }

/* ---------------- Partage, confidentialité ---------------- */
body.share-page { background: var(--bg); }
.share-wrap { max-width: 760px; margin: 0 auto; padding: 18px 16px 40px; display: flex; flex-direction: column; gap: 16px; }
.share-head { display: flex; align-items: center; gap: 10px; }
.share-head strong { display: block; font-size: 20px; font-weight: 800; color: var(--g-900); line-height: 1; }
.share-head small { color: var(--muted); }
.share-intro h1 { font-size: 22px; color: var(--g-900); }
.emergency { display: flex; gap: 10px; margin-top: 14px; }
.emergency a { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 10px; border-radius: 12px; background: var(--danger-bg); color: var(--danger-text); }
.emergency strong { font-size: 22px; }
.emergency span { font-size: 12px; font-weight: 600; }
.share-person { display: flex; gap: 10px; align-items: flex-start; }
.share-new { background: var(--g-50); border: 1px solid var(--g-200); border-radius: 12px; padding: 12px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.prose { max-width: 760px; line-height: 1.65; }
.prose h2 { font-size: 18px; color: var(--g-900); margin: 22px 0 8px; }
.prose p, .prose li { color: var(--text-2); font-size: 15px; }
.prose ul { padding-left: 20px; }
.danger-zone { border-color: #f4c3c5 !important; }
.auth-links { text-align: center; font-size: 13px; }
.auth-links a { color: var(--muted); }

/* ---------------- Journal des versions ---------------- */
.pill-info { background: #e8f1fd; color: #1d4ed8; }
:root[data-theme="dark"] .pill-info { background: #10243f; color: #93c5fd; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .pill-info { background: #10243f; color: #93c5fd; } }
.version-hero { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.version-hero h2 { font-size: 24px; font-weight: 800; color: var(--g-900); margin: 8px 0 4px; }
.version-legend { display: flex; gap: 6px; flex-wrap: wrap; }
.version-timeline { display: flex; flex-direction: column; gap: 12px; max-width: 980px; }
.version summary { list-style: none; display: flex; align-items: center; gap: 14px; padding: 16px 20px; cursor: pointer; }
.version summary::-webkit-details-marker { display: none; }
.version summary .grow { flex: 1; min-width: 0; }
.version summary strong { display: block; font-size: 15.5px; }
.version[open] summary .chev { transform: rotate(180deg); }
.version-num { font-weight: 800; font-size: 14px; padding: 6px 12px; border-radius: 10px; background: var(--line-2); color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.version-num.current { background: var(--g-700); color: #fff; }
.version-counts { display: flex; gap: 4px; }
.version-counts .pill { padding: 3px 8px; }
.version-items { list-style: none; margin: 0; padding: 0 20px 18px; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line-2); padding-top: 14px; }
.version-items li { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: start; font-size: 14px; color: var(--text-2); }
.version-items .pill { justify-self: start; }
@media (max-width: 860px) { .version-items li { grid-template-columns: 1fr; gap: 4px; } .version-counts { display: none; } }

/* =========================================================
   Page d'accueil publique
   ========================================================= */
body.lp { background: var(--card); }
.lp-wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.lp-top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line-2); }
.lp-top-in { display: flex; align-items: center; gap: 24px; height: 70px; }
.lp-nav { display: flex; gap: 26px; margin-left: auto; }
.lp-nav a { color: var(--text-2); font-weight: 500; font-size: 14.5px; }
.lp-nav a:hover { color: var(--g-700); }
.lp-top-cta { display: flex; gap: 8px; }
.lp-hero { background: radial-gradient(1100px 520px at 85% 10%, var(--g-100), transparent 60%), linear-gradient(180deg, var(--g-50), var(--card)); padding: 64px 0 40px; overflow: hidden; }
.lp-hero-in { display: grid; grid-template-columns: 1fr 1.08fr; gap: 48px; align-items: center; }
.lp-eyebrow, .lp-kicker { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: var(--g-700); letter-spacing: .01em; }
.lp-eyebrow { background: var(--card); border: 1px solid var(--g-200); padding: 6px 12px; border-radius: 99px; }
.lp-eyebrow .ic { width: 15px; height: 15px; }
.lp-kicker { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; }
.lp h1 { font-size: clamp(34px, 5vw, 54px); line-height: 1.07; letter-spacing: -.025em; margin: 18px 0 16px; color: var(--text); font-weight: 800; }
.lp h1 em { font-style: normal; color: var(--g-700); }
.lp-lead { font-size: 18px; color: var(--text-2); max-width: 540px; margin: 0 0 26px; line-height: 1.55; }
.lp-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.lp .btn-lg { padding: 14px 22px; font-size: 15.5px; }
.lp-note { color: var(--muted); font-size: 14px; margin: 14px 0 0; display: flex; gap: 6px; align-items: center; }
.lp-proof { list-style: none; padding: 0; margin: 26px 0 0; display: flex; flex-wrap: wrap; gap: 10px 20px; color: var(--text-2); font-size: 14px; font-weight: 500; }
.lp-proof li { display: flex; align-items: center; gap: 7px; }
.lp-proof .ic { width: 17px; height: 17px; color: var(--g-600); }
.lp-hero-visual { position: relative; padding: 0 0 40px 0; }
.lp-browser { border-radius: 14px; overflow: hidden; background: #fff; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.lp-browser-bar { height: 28px; background: #eef3f0; display: flex; align-items: center; gap: 6px; padding: 0 12px; }
.lp-browser-bar i { width: 10px; height: 10px; border-radius: 50%; background: #cfd9d3; }
.lp-browser img { display: block; width: 100%; height: auto; }
.lp-phone { border-radius: 34px; padding: 8px; background: #111a15; box-shadow: 0 24px 50px rgba(6, 40, 22, .28); }
.lp-phone img { display: block; width: 100%; height: auto; border-radius: 27px; }
.lp-phone-float { position: absolute; width: 34%; right: -12px; bottom: 0; }
.lp-band { background: #063d23; color: #fff; }
.lp-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; padding-top: 28px; padding-bottom: 28px; }
.lp-stats div { display: flex; flex-direction: column; gap: 2px; }
.lp-stats strong { font-size: 24px; font-weight: 800; color: #a7e8c0; }
.lp-stats span { color: #d5ebdd; font-size: 14.5px; }
.lp-section { padding: 84px 0; }
.lp-alt { background: var(--bg); }
.lp-head { text-align: center; max-width: 680px; margin: 0 auto 44px; }
.lp h2 { font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -.02em; line-height: 1.15; margin: 10px 0 12px; font-weight: 800; }
.lp-head p, .lp-split > div > p { color: var(--text-2); font-size: 16.5px; margin: 0; }
.lp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.lp-feat { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; background: var(--card); transition: box-shadow .2s, transform .2s; }
.lp-feat:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.lp-feat-ic { width: 44px; height: 44px; border-radius: 12px; background: var(--g-100); color: var(--g-700); display: grid; place-items: center; margin-bottom: 14px; }
.lp-feat-ic .ic { width: 22px; height: 22px; }
.lp-feat h3, .lp-steps h3 { font-size: 17px; margin: 0 0 6px; }
.lp-feat p, .lp-steps p { margin: 0; color: var(--text-2); font-size: 14.5px; line-height: 1.55; }
.lp-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; counter-reset: s; }
.lp-steps li { background: var(--card); border-radius: var(--radius); padding: 28px 24px; box-shadow: var(--shadow); }
.lp-steps span { width: 38px; height: 38px; border-radius: 50%; background: var(--g-700); color: #fff; font-weight: 800; display: grid; place-items: center; margin-bottom: 14px; }
.lp-gallery { display: grid; grid-template-columns: repeat(5, 1fr); gap: 22px; align-items: start; }
.lp-gallery figure { margin: 0; text-align: center; }
.lp-gallery figure:nth-child(even) { margin-top: 36px; }
.lp-gallery figcaption { margin-top: 14px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.lp-fine { color: var(--muted); font-size: 12.5px; text-align: center; margin-top: 28px; }
.lp-split { display: grid; grid-template-columns: .9fr 1.1fr; gap: 56px; align-items: center; }
.lp-split .btn { margin-top: 22px; }
.lp-checks { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.lp-checks li { display: flex; gap: 14px; background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.lp-checks .ic { width: 24px; height: 24px; color: var(--g-700); flex: none; margin-top: 2px; }
.lp-checks strong { display: block; margin-bottom: 4px; }
.lp-checks p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.lp-narrow { max-width: 820px; }
.lp-faq details { border-bottom: 1px solid var(--line); }
.lp-faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 4px; font-weight: 700; font-size: 16.5px; }
.lp-faq summary::-webkit-details-marker { display: none; }
.lp-faq summary .ic { width: 20px; height: 20px; color: var(--muted); transition: transform .2s; flex: none; }
.lp-faq details[open] summary .ic { transform: rotate(180deg); }
.lp-faq p { margin: 0 4px 20px; color: var(--text-2); line-height: 1.6; }
.lp-final { background: linear-gradient(135deg, #0a5c34, #0e7a43); color: #fff; padding: 72px 0; text-align: center; }
.lp-final-in { display: flex; flex-direction: column; align-items: center; }
.lp-final h2 { color: #fff; }
.lp-final p { color: #d5ebdd; font-size: 17px; margin: 0 0 26px; }
.lp-final-logo { width: 84px; height: 84px; border-radius: 24px; background: #fff; display: grid; place-items: center; margin-bottom: 12px; box-shadow: 0 10px 26px rgba(0, 0, 0, .18); }
.lp-final-logo .logo-xl { width: 54px; height: 54px; }
.btn-light { background: #fff; color: #0a5c34; box-shadow: 0 8px 22px rgba(0, 0, 0, .18); }
.btn-light:hover { background: #f2faf5; }
.lp-foot { padding: 40px 0 26px; border-top: 1px solid var(--line); }
.lp-foot-in { display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap; }
.lp-foot-in p { color: var(--muted); font-size: 13.5px; max-width: 420px; margin: 12px 0 0; }
.lp-foot nav { display: flex; gap: 22px; align-items: flex-start; }
.lp-foot nav a { color: var(--text-2); font-weight: 500; font-size: 14px; }
.lp-foot .lp-fine { text-align: left; }
@media (max-width: 1000px) {
  .lp-nav { display: none; }
  .lp-top-cta { margin-left: auto; }
  .lp-hero-in, .lp-split { grid-template-columns: 1fr; }
  .lp-hero { padding-top: 40px; }
  .lp-grid { grid-template-columns: 1fr 1fr; }
  .lp-gallery { grid-template-columns: repeat(5, 62%); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 12px; margin: 0 -24px; padding-left: 24px; padding-right: 24px; }
  .lp-gallery figure { scroll-snap-align: center; }
  .lp-gallery figure:nth-child(even) { margin-top: 0; }
}
@media (max-width: 640px) {
  .lp-wrap { padding: 0 16px; }
  .lp-top-in { height: 62px; }
  .lp-hide-sm { display: none; }
  .lp-top .brand-text small { display: none; }
  .lp-lead { font-size: 16.5px; }
  .lp-actions .btn { width: 100%; }
  .lp-hero-visual { padding: 0; }
  .lp-browser { display: none; }
  .lp-phone-float { position: static; width: 72%; margin: 6px auto 0; }
  .lp-stats { grid-template-columns: 1fr; gap: 14px; }
  .lp-section { padding: 60px 0; }
  .lp-grid, .lp-steps, .lp-checks { grid-template-columns: 1fr; }
  .lp-gallery { grid-template-columns: repeat(5, 70%); margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .lp-final { padding: 56px 0; }
}
:root[data-theme="dark"] body.lp, :root[data-theme="dark"] .lp-feat { background: var(--card); }
:root[data-theme="dark"] .lp-hero { background: linear-gradient(180deg, #0d1f16, var(--card)); }
:root[data-theme="dark"] .lp-eyebrow { border-color: var(--line); }
:root[data-theme="dark"] .lp-feat-ic { background: #14321f; color: #7fd7a3; }
:root[data-theme="dark"] .lp h1 em { color: #5ccf8b; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .lp-hero { background: linear-gradient(180deg, #0d1f16, var(--card)); }
  :root[data-theme="auto"] .lp-feat-ic { background: #14321f; color: #7fd7a3; }
  :root[data-theme="auto"] .lp h1 em { color: #5ccf8b; }
}

/* =========================================================
   Sortie de l'armoire (fenêtre) et mouvements
   ========================================================= */
.row-end { display: inline-flex; align-items: center; gap: 8px; justify-self: start; }
.out-btn { width: 34px; height: 34px; flex: none; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); color: var(--g-700); display: grid; place-items: center; cursor: pointer; transition: background .15s, border-color .15s; }
.out-btn:hover { background: var(--g-50); border-color: var(--g-200); }
.out-btn .ic { width: 18px; height: 18px; }
.qty-ctl button:disabled { opacity: .35; cursor: default; }
.row-gone { opacity: 0; transform: translateX(30px); transition: opacity .3s, transform .3s; }
body.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(6, 30, 18, .45); animation: fade .2s; }
.modal-card { position: relative; width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--card); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; animation: pop .2s ease-out; }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }
.modal-head { display: flex; gap: 12px; align-items: center; }
.modal-head h2 { font-size: 17px; margin: 0; }
.modal-head .out-name { margin: 2px 0 0; font-weight: 600; color: var(--text-2); font-size: 14.5px; }
.modal-head .out-stock { font-size: 12.5px; }
.modal-head .icon-btn { align-self: flex-start; margin: -6px -8px 0 0; }
.out-fields { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: end; }
.out-fields .field { margin: 0; }
.out-qty { display: flex; gap: 6px; align-items: center; }
.out-qty .stepper { width: 128px; }
.out-qty .chip { border: 1.5px solid var(--line); background: var(--card); border-radius: 99px; padding: 7px 12px; font-weight: 600; font-size: 13px; color: var(--text-2); cursor: pointer; }
.out-qty .chip:hover { border-color: var(--g-200); color: var(--g-700); }
.out-last { background: var(--warn-bg); color: var(--warn-text); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; display: flex; flex-direction: column; gap: 8px; }
.out-last[hidden] { display: none; }
.out-last p { margin: 0; }
.out-last .check { color: var(--text); font-size: 13.5px; }
.out-scan { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.out-scan[hidden] { display: none; }
.out-cam { position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 260px; border-radius: 14px; overflow: hidden; background: #0b1510; }
.out-cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.out-frame { position: absolute; inset: 18% 26%; border: 3px solid #4ade80; border-radius: 14px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .28); pointer-events: none; }
.out-cam-state { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; color: #d5ebdd; font-size: 13.5px; text-align: center; padding: 16px; background: #0b1510; }
.out-cam-state[hidden] { display: none; }
.out-cam-state .ic { width: 28px; height: 28px; }
.out-status { margin: 0; font-size: 13.5px; color: var(--text-2); text-align: center; }
.out-photo { cursor: pointer; }
.out-nocode[hidden], .out-manual[hidden], .out-manual-toggle[hidden] { display: none; }
.link-btn { background: none; border: 0; padding: 4px; color: var(--g-700); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; align-self: center; }
.out-manual { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--line-2); padding-top: 14px; }
.out-warn { display: flex; gap: 10px; background: var(--danger-bg); color: var(--danger-text); border-radius: 12px; padding: 12px; font-size: 13.5px; line-height: 1.45; }
.out-warn .ic { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.out-warn p { margin: 0; }
.out-manual .check { align-items: flex-start; }
.out-manual .check input { margin-top: 1px; flex: none; }
.out-msg { margin: 0; font-size: 14px; font-weight: 600; text-align: center; min-height: 1px; }
.out-msg:empty { display: none; }
.out-msg.err { color: var(--danger-text); }
.out-msg.ok { color: var(--g-700); }
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); z-index: 90; background: #13241b; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); transition: opacity .4s; animation: pop .2s; }
.toast.hide { opacity: 0; }
@media (min-width: 761px) { .toast { bottom: 28px; } }
@media (max-width: 640px) {
  .modal { place-items: end stretch; padding: 0; }
  .modal-card { max-width: none; border-radius: 22px 22px 0 0; max-height: 92vh; padding-bottom: calc(20px + var(--safe-b)); animation: up .22s ease-out; }
  .out-fields { grid-template-columns: 1fr; }
  .out-cam { max-height: 220px; }
}

/* Historique des mouvements */
.mv-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.mv-tile { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.mv-tile small { color: var(--muted); font-size: 12.5px; font-weight: 600; display: block; }
.mv-tile strong { font-size: 24px; font-weight: 800; display: block; margin-top: 4px; }
.mv-tile span { font-size: 12.5px; color: var(--text-2); }
.mv-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.mv-filters .select, .mv-filters .input { width: auto; min-width: 150px; }
.mv-list { list-style: none; margin: 0; padding: 0 8px 8px; }
.mv-list li { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 12px; border-radius: 12px; }
.mv-list li + li { border-top: 1px solid var(--line-2); }
.mv-ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--g-100); color: var(--g-700); }
.mv-ic .ic { width: 18px; height: 18px; }
.mv-ic.out { background: var(--danger-bg); color: var(--danger-text); }
.mv-ic.neutral { background: var(--line-2); color: var(--text-2); }
.mv-main strong a { color: var(--text); }
.mv-main small { color: var(--muted); font-size: 12.5px; }
.mv-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; align-items: center; }
.mv-tags .pill { padding: 1px 8px; font-size: 11.5px; }
.mv-qty { text-align: right; font-weight: 800; font-size: 15px; white-space: nowrap; }
.mv-qty.in { color: var(--g-700); }
.mv-qty.out { color: var(--danger-text); }
.mv-qty small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.mv-gone { font-size: 11.5px; color: var(--muted); font-style: italic; }
@media (max-width: 760px) {
  .mv-tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .mv-tile strong { font-size: 20px; }
  .mv-filters .select, .mv-filters .input { flex: 1; min-width: 130px; }
  .mv-list { padding: 0 2px 6px; }
  .mv-list li { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; padding: 10px 8px; }
  .mv-ic { width: 32px; height: 32px; }
}

/* Logo complet par défaut (MediPharm) */
.wordmark { display: block; height: auto; max-width: 100%; }
.brand-wm { flex-direction: column; align-items: flex-start; gap: 6px; }
.brand-wm .wordmark { width: 168px; }
.brand-wm small { font-size: 12px; color: var(--text-2); white-space: nowrap; padding-left: 2px; }
.wm-xl { width: 300px; margin-bottom: 10px; }
.wm-lg { width: 170px; margin-bottom: 4px; }
.auth-mobile-logo .wm-lg + small { display: block; color: var(--text-2); }
.share-head .wm-lg { width: 150px; }
.share-head .wm-lg + small { display: block; color: var(--muted); }
@media (max-width: 760px) { .mobile-brand .wordmark { width: 128px; } }
@media (max-width: 640px) { .lp-top .brand-wm .wordmark { width: 140px; } .lp-top .brand-wm small { display: none; } }
.mv-undo { display: flex; flex-direction: column; align-items: flex-end; gap: 0; margin-top: 4px; }
.mv-undo .btn { padding: 4px 8px; color: var(--g-700); font-weight: 600; }
.mv-undo small { font-size: 11px; color: var(--muted); font-weight: 500; }
.mv-undone .mv-main strong, .mv-undone .mv-qty { opacity: .55; }
.mv-undone .mv-qty { text-decoration: line-through; }
.mv-undone .mv-qty small { text-decoration: none; }
.mv-undone .mv-ic { filter: grayscale(1); opacity: .6; }

/* Bibliothèque d'images : édition */
.lib-card { display: flex; flex-direction: column; }
.lib-open { position: relative; padding: 0; border: 0; background: none; cursor: pointer; display: block; width: 100%; border-radius: 12px; overflow: hidden; }
.lib-open img { display: block; width: 100%; }
.lib-edit-chip { position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 5px; background: rgba(19, 36, 27, .78); color: #fff; font-size: 12px; font-weight: 600; padding: 5px 9px; border-radius: 99px; opacity: .92; transition: opacity .15s, transform .15s; }
.lib-edit-chip .ic { width: 13px; height: 13px; }
.lib-open:hover .lib-edit-chip, .lib-open:focus-visible .lib-edit-chip { opacity: 1; transform: translateY(-1px); }
.lib-card .img-label { padding: 8px 4px 2px; display: flex; flex-direction: column; }
.lib-card .img-label strong { font-size: 13.5px; }
.lib-card .img-label small { color: var(--muted); font-size: 12px; }
.img-dialog { border: 0; border-radius: 20px; padding: 0; width: min(720px, calc(100vw - 24px)); background: var(--card); color: var(--text); box-shadow: var(--shadow-lg); }
.img-dialog::backdrop { background: rgba(6, 30, 18, .45); }
.img-dialog form { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 16px; }
.img-dialog .modal-head h2 { font-size: 18px; }
.img-edit-body { display: grid; grid-template-columns: 240px 1fr; gap: 20px; }
.img-edit-preview { display: flex; flex-direction: column; gap: 10px; }
.img-edit-preview img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.img-edit-preview .rot-right .ic { transform: scaleX(-1); }
.img-edit-fields { display: flex; flex-direction: column; gap: 12px; }
.img-dialog .form-actions { margin: 0; padding: 0; border: 0; }
@media (max-width: 640px) { .img-edit-body { grid-template-columns: 1fr; } .img-edit-preview img { max-height: 220px; } }

/* Bandeau d'installation (smartphone) */
.install-banner { position: fixed; left: 12px; right: 12px; bottom: calc(86px + var(--safe-b)); z-index: 70; display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 14px 12px 14px 14px; animation: up .3s ease-out; max-width: 520px; margin: 0 auto; }
.install-banner[hidden] { display: none; }
.install-banner .ib-logo { width: 44px; height: 44px; flex: none; border-radius: 11px; }
.install-banner strong { font-size: 14.5px; }
.install-banner p { margin: 3px 0 0; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.install-banner p strong { font-size: inherit; color: var(--text); }
.install-banner .ib-ios, .install-banner .ib-other { background: var(--g-50); border-radius: 10px; padding: 7px 9px; margin-top: 8px; }
.install-banner .ib-ios .ic { width: 16px; height: 16px; vertical-align: -3px; color: #0a84ff; }
.ib-actions { display: flex; gap: 6px; margin-top: 10px; }
.ib-close { margin: -6px -4px 0 0; width: 32px; height: 32px; flex: none; }
body.lp .install-banner { bottom: calc(14px + var(--safe-b)); }
.og-setting { display: flex; gap: 16px; align-items: flex-start; margin: 4px 0 2px; flex-wrap: wrap; }
.og-setting img { width: 240px; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: #fff; flex: none; }
.og-setting .grow { flex: 1; min-width: 220px; }

/* Contact et assistance */
.contact-card { max-width: 620px; }
.contact-done { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 0; }
.contact-done h2 { font-size: 22px; }
.thread { display: flex; flex-direction: column; gap: 12px; }
.msg { border-radius: 14px; padding: 12px 14px; max-width: 88%; border: 1px solid var(--line); }
.msg-user { background: var(--bg); align-self: flex-start; }
.msg-staff { background: var(--g-50); border-color: var(--g-100); align-self: flex-end; }
.msg-note { background: var(--warn-bg); border-color: transparent; align-self: stretch; max-width: none; font-size: 13.5px; }
.msg-meta { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.msg-meta strong { color: var(--text); }
.msg-body { font-size: 14.5px; line-height: 1.55; color: var(--text-2); overflow-wrap: anywhere; }
.thread-event { text-align: center; font-size: 12.5px; color: var(--muted); margin: 0; }
.ticket-list .rem { align-items: flex-start; gap: 12px; }
.tk-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; flex: none; background: transparent; }
.tk-unread .tk-dot { background: var(--g-600); }
.tk-unread strong { font-weight: 800; }
.tk-excerpt { display: block; color: var(--text-2); font-size: 13px; margin-top: 3px; }
.tk-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; text-align: right; }
@media (max-width: 760px) { .msg { max-width: 100%; } .tk-side small:last-child { display: none; } }

/* Photos de profil et image d'espace */
.avatar.has-img { padding: 0; overflow: hidden; background: var(--line-2); }
.avatar.has-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.xl { width: 84px; height: 84px; font-size: 28px; border-width: 3px; }
.profile-photo { display: flex; gap: 16px; align-items: center; }
.space-img { width: 34px; height: 34px; border-radius: 10px; object-fit: cover; flex: none; display: block; }
.space-img.sm { width: 30px; height: 30px; border-radius: 9px; }
.space-img.lg { width: 96px; height: 96px; border-radius: 22px; }
.space-head { display: flex; gap: 18px; align-items: center; margin-bottom: 22px; }
.space-head h1 { font-size: 28px; font-weight: 800; color: var(--g-900); }
.space-cover { position: relative; flex: none; }
.space-placeholder { width: 96px; height: 96px; border-radius: 22px; background: var(--g-100); color: var(--g-700); display: grid; place-items: center; }
.space-placeholder .ic { width: 38px; height: 38px; }
.space-photo-form { position: absolute; right: -8px; bottom: -8px; display: flex; gap: 4px; }
.space-photo-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; color: var(--g-700); padding: 0; }
.space-photo-btn.del { color: var(--danger-text); }
.space-photo-btn .ic { width: 16px; height: 16px; }
@media (max-width: 640px) { .space-head h1 { font-size: 22px; } .space-img.lg, .space-placeholder { width: 72px; height: 72px; border-radius: 18px; } }

/* Page Aide */
.help-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; max-width: 1180px; }
.help-side { display: flex; flex-direction: column; gap: 20px; }
.faq-search { margin-bottom: 10px; }
.faq-list .faq-item { border-bottom: 1px solid var(--line-2); }
.faq-list .faq-item[hidden] { display: none; }
.faq-item summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 14px 2px; font-weight: 700; font-size: 15px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .ic { width: 18px; height: 18px; color: var(--muted); flex: none; transition: transform .2s; }
.faq-item[open] summary .ic { transform: rotate(180deg); }
.faq-answer { padding: 0 2px 14px; color: var(--text-2); font-size: 14.5px; line-height: 1.6; }
.faq-answer p + p { margin-top: 8px; }
.faq-empty { padding: 14px 2px; font-size: 14px; }
.faq-public { border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; }
.faq-public > summary { cursor: pointer; padding: 10px 0; font-weight: 600; font-size: 14px; color: var(--g-700); }
@media (max-width: 1000px) { .help-layout { grid-template-columns: 1fr; } }

/* =========================================================
   Menu latéral : cloche, Aide & Assistance, menu du compte
   ========================================================= */
:root { --help-blue: #0e3092; --help-blue-bg: #e8edf9; }
:root[data-theme="dark"] { --help-blue: #8fa8ff; --help-blue-bg: #18213d; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] { --help-blue: #8fa8ff; --help-blue-bg: #18213d; } }
@media (min-width: 861px) {
  .topbar { display: none; }
  .content { padding-top: 28px; }
}
.side-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.side-head .brand { min-width: 0; }
.side-bell { flex: none; margin-top: 2px; }
.side-bell:hover { background: var(--g-50); }
.bell-count { position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; font-style: normal; display: grid; place-items: center; border: 2px solid var(--card); line-height: 1; }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.help-link { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; color: var(--help-blue) !important; font-weight: 700; font-size: 14.5px; background: var(--help-blue-bg); }
.help-link .ic { color: var(--help-blue) !important; width: 21px; height: 21px; }
.help-link:hover { filter: brightness(.97); }
.help-link.active { background: var(--help-blue); color: #fff !important; }
.help-link.active .ic { color: #fff !important; }
.account-card { position: relative; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.account-card.is-active { border-color: var(--g-200); }
.account-card > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 9px 10px; cursor: pointer; border-radius: 14px; }
.account-card > summary::-webkit-details-marker { display: none; }
.account-card > summary:hover { background: var(--line-2); }
.account-card > summary > .ic { width: 16px; color: var(--muted); transition: transform .2s; flex: none; }
.account-card[open] > summary > .ic { transform: rotate(180deg); }
.acc-who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.acc-who strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-who small { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-pop { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 40; animation: pop .15s ease-out; }
.acc-section { display: flex; flex-direction: column; padding: 6px 0; }
.acc-section + .acc-section { border-top: 1px solid var(--line-2); }
.acc-section > small { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 4px 10px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-section a, .acc-section button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--text-2); font-size: 14px; font-weight: 500; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; font-family: inherit; }
.acc-section a:hover, .acc-section button:hover, .acc-section a.active { background: var(--g-50); color: var(--g-900); }
.acc-section .ic { width: 18px; height: 18px; color: var(--g-700); flex: none; }
.acc-section form { margin: 0; }
.acc-logout { color: var(--danger-text) !important; }
.acc-logout .ic { color: var(--danger-text) !important; }
.acc-family { display: flex; align-items: center; gap: 8px; padding: 0 10px 6px; font-size: 12.5px; color: var(--muted); }
/* feuille « Plus » (mobile) */
.sheet-links { display: flex; flex-direction: column; gap: 2px; padding-bottom: 6px; border-bottom: 1px solid var(--line-2); }
.sheet-panel .help-link { margin-top: 4px; }
.acc-sheet { padding-top: 6px; }
.acc-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 4px; }
.sheet-panel .acc-section a, .sheet-panel .acc-section button { padding: 10px; }
.sheet-panel { max-height: 88vh; overflow-y: auto; }
.acc-admin { font-weight: 700 !important; color: var(--g-900) !important; }
.acc-badge { display: inline-grid; place-items: center; width: 16px; height: 16px; vertical-align: -2px; color: var(--g-700); font-style: normal; }
.acc-badge .ic { width: 14px; height: 14px; }
.install-banner .ib-iosfix { background: var(--warn-bg); color: var(--warn-text); border-radius: 10px; padding: 8px 10px; margin-top: 8px; }
.install-banner .ib-iosfix strong { color: inherit; }
.cron-table tr.is-off td { opacity: .6; }
.cron-table td { vertical-align: top; }
.health-list .rem { align-items: flex-start; }
.health-list .dot { margin-top: 2px; }
.dot-warn { background: var(--warn-bg); color: var(--warn-text); }
.code-block { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Aperçu agrandi des miniatures */
.thumb[data-preview] { cursor: zoom-in; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.thumb[data-preview] img { -webkit-user-drag: none; }
.thumb-preview { position: fixed; z-index: 90; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 10px; pointer-events: none; opacity: 0; transform: scale(.96); transition: opacity .14s, transform .14s; }
.thumb-preview.on { opacity: 1; transform: none; }
.thumb-preview[hidden] { display: none; }
.thumb-preview img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 12px; }
.thumb-preview span { display: block; text-align: center; font-size: 13.5px; font-weight: 700; color: var(--text); padding: 8px 4px 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- Fiche d'information (bouton « i ») ---------------- */
.info-btn { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-left: 6px; border-radius: 50%; color: var(--help-blue); background: var(--help-blue-bg); cursor: pointer; vertical-align: -5px; flex: none; transition: transform .12s, background .12s; position: relative; }
.info-btn::after { content: ""; position: absolute; inset: -9px; } /* zone tactile agrandie */
.info-btn .ic { width: 15px; height: 15px; stroke-width: 2.4; }
.info-btn:hover { background: var(--help-blue); color: #fff; }
.info-btn:focus-visible { outline: 2px solid var(--help-blue); outline-offset: 2px; }
.info-btn:active { transform: scale(.92); }
.info-btn-lg { width: 26px; height: 26px; vertical-align: -3px; margin-left: 8px; }
.info-btn-lg .ic { width: 17px; height: 17px; }
.title .info-btn, .grow > .info-btn { margin-right: 4px; }

.info-card { max-width: 540px; gap: 0; padding: 0; }
.info-body { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px 0; }
.info-head .info-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--help-blue-bg); color: var(--help-blue); flex: none; }
.info-head .info-ic .ic { width: 21px; height: 21px; }
.info-head h2 { font-size: 20px; }
.info-sub { margin: -4px 0 0; color: var(--text-2); font-size: 14px; }
.info-guess, .info-flag { margin: 0; font-size: 13px; color: var(--warn-text); background: var(--warn-bg); border-radius: 10px; padding: 8px 11px; }
.info-facts { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; gap: 9px 14px; margin: 2px 0 0; font-size: 14px; }
.info-facts dt { color: var(--muted); }
.info-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.info-facts small { color: var(--muted); font-size: 12.5px; }
.info-facts .info-block { display: block; margin-top: 2px; }
.info-subst { display: block; }
.info-subst + .info-subst { margin-top: 4px; }
.info-h { font-size: 15px; margin: 6px 0 0; }
.info-boxes { display: flex; flex-direction: column; gap: 8px; }
.info-box-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 13px; border: 1px solid var(--line); border-radius: 12px; font-size: 14px; }
.info-box-row > div:first-child { min-width: 0; }
.info-box-row small { display: block; color: var(--muted); font-size: 12.5px; }
.info-box-row.current { border-color: var(--help-blue); background: var(--help-blue-bg); }
.info-box-row .pill { font-size: 11px; padding: 1px 8px; vertical-align: 1px; }
.info-price { text-align: right; font-size: 13px; color: var(--text-2); }
.info-ended { flex-basis: 100%; color: var(--warn-text) !important; }
.info-gen { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.info-gen .link-btn { color: var(--help-blue); text-decoration: none; padding: 3px 0; text-align: left; font-size: 14px; }
.info-gen .link-btn:hover { text-decoration: underline; }
.info-note { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.info-foot { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 2px -20px 0; padding: 12px 20px 16px; border-top: 1px solid var(--line); background: var(--card); }
.info-foot small { color: var(--muted); font-size: 12px; flex: 1 1 220px; }
.info-foot .btn { flex: none; margin-left: auto; }
.info-loading { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 6px 0 20px; }
.info-error { color: var(--danger-text); margin: 6px 0 20px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--help-blue); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 760px) {
  .info-body { padding: 16px 16px 0; }
  .info-foot { margin: 2px -16px 0; padding: 12px 16px calc(14px + var(--safe-b)); }
  .info-foot .btn { width: 100%; justify-content: center; }
  .info-facts { grid-template-columns: 1fr; gap: 2px; }
  .info-facts dd { margin-bottom: 8px; }
}
@media print { .info-btn { display: none; } }
.info-head .grow { flex: 1; min-width: 0; }
.info-head .icon-btn { margin-left: auto; }
strong > .info-btn { font-weight: 400; }

/* ---------------- « Mon stock » : boîtes identiques regroupées ---------------- */
.stock-list .row { grid-template-columns: 64px minmax(0, 1.7fr) minmax(0, .8fr) 82px 190px 160px 22px; }
.stock-list .list-head { padding-top: 4px; padding-bottom: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.stock-list .list-head + .row { border-top: 1px solid var(--line-2); }
.boxes-n { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.boxes-n strong { font-size: 15px; color: var(--text); }
.qty-total { font-size: 13px; font-weight: 600; padding-left: 10px; }
.row.grp { cursor: pointer; }
.row.grp:hover { background: var(--g-50); }
.grp-btn { all: unset; cursor: pointer; display: block; }
.grp-btn:focus-visible { outline: 2px solid var(--g-700); outline-offset: 3px; border-radius: 6px; }
.grp .boxes-n strong { color: var(--g-700); }
.grp-chev .chev { transition: transform .2s; }
.row.grp.open .grp-chev .chev { transform: rotate(180deg); }
.row.grp.open { background: var(--g-50); border-radius: 12px 12px 0 0; }
.grp-items { background: var(--g-50); border-radius: 0 0 12px 12px; margin-bottom: 4px; }
.grp-items .row.sub { border-top: 1px dashed var(--line); }
.row.sub .title strong { font-size: 13.5px; }
.sub-mark { justify-self: end; width: 18px; height: 22px; border-left: 2px solid var(--g-200); border-bottom: 2px solid var(--g-200); border-radius: 0 0 0 8px; margin: -14px 6px 10px 0; }
.row-end .pill + .pill { margin-left: -2px; }
@media (max-width: 1020px) {
  .stock-list .row { grid-template-columns: 56px minmax(0, 1fr) auto 22px; }
  .stock-list .list-head { display: none; }
}
@media (max-width: 860px) {
  .stock-list .row { grid-template-columns: 52px minmax(0, 1fr) auto 16px; }
}
.row.sub .title small { display: block; margin-top: 2px; }

/* Médicament sur ordonnance */
.rx-badge { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 1px 8px 1px 6px; border-radius: 999px; font-size: 11.5px; font-weight: 700; color: var(--help-blue); background: var(--help-blue-bg); vertical-align: 1px; white-space: nowrap; }
.rx-badge .ic { width: 12px; height: 12px; }
.rx-check { align-items: flex-start; }
.rx-check input { margin-top: 2px; flex: none; }

/* Ajout manuel : recherche dans la base officielle */
.pick-search { display: flex; width: 100%; }
.pick-search .input { font-size: 16px; padding-top: 13px; padding-bottom: 13px; }
.pick-results { display: flex; flex-direction: column; margin-top: 12px; transition: opacity .15s; }
.pick-results.loading { opacity: .55; }
.pick-item { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 12px; color: var(--text); }
.pick-item + .pick-item { border-top: 1px solid var(--line-2); }
.pick-item:hover, .pick-item:focus-visible { background: var(--g-50); outline: none; }
.pick-item .grow { min-width: 0; }
.pick-item strong { font-size: 15px; }
.pick-item small { display: block; font-size: 13px; color: var(--text-2); }
.pick-item small.muted { color: var(--muted); font-size: 12px; }
.pick-item .pill { font-size: 11px; padding: 1px 8px; }
.pick-empty { padding: 14px 4px; font-size: 14px; }
.pick-foot { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-2); display: flex; justify-content: center; }
.info-box.picked { align-items: center; }
.info-box.picked p { flex: 1; font-size: 14px; }
input[readonly].input, select[disabled].select { background: var(--g-50); color: var(--text-2); cursor: default; }

/* Fiche : délivrance et stock de la famille */
.info-deliv { display: flex; align-items: center; gap: 11px; margin: 0; padding: 10px 13px; border-radius: 12px; font-size: 14px; }
.info-deliv .ic { width: 20px; height: 20px; flex: none; }
.info-deliv small { display: block; font-size: 12.5px; opacity: .85; }
.info-deliv.rx { background: var(--help-blue-bg); color: var(--help-blue); }
.info-deliv.otc { background: var(--g-50); color: var(--g-700); }
.info-mine { display: flex; flex-direction: column; gap: 6px; }
.info-mine-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); font-size: 14px; }
.info-mine-row:hover { background: var(--g-50); }
.info-mine-row small { display: block; color: var(--muted); font-size: 12.5px; }
.info-mine-row .pill { font-size: 11px; padding: 2px 8px; }
.info-mine-none { margin: 0; font-size: 14px; }

/* Sortie de l'armoire : une boîte entière */
.out-box { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--g-50); }
.out-box > .ic { width: 24px; height: 24px; color: var(--g-700); flex: none; }
.out-box strong { display: block; font-size: 15px; }
.out-box small { display: block; color: var(--muted); font-size: 12.5px; }
.out-which { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.out-fields .hint { display: block; margin-top: 6px; }

/* Ajout : champs lus sur la boîte */
.locked-hint { margin: -4px 0 0; }
input.input[readonly] { background: var(--g-50); color: var(--text-2); }

/* Page « Boîte scannée » */
.scanned-head { display: flex; gap: 16px; align-items: center; }
.scanned-head h1 { font-size: 22px; margin: 2px 0 4px; }
.scanned-head .sub { color: var(--text-2); font-size: 14px; margin: 0; }
.scanned-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.scanned-chips .rx-badge { margin-left: 0; }
.scanned-h { font-size: 16px; margin: 0 0 10px; }
.scanned-rows .rem.here { background: var(--g-50); border-radius: 12px; }
.scanned-actions { display: flex; flex-direction: column; gap: 8px; }
.action { display: block; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); }
.action-form { border: 0; padding: 0; }
.action-row, .action summary { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; cursor: pointer; border-radius: 14px; }
.action-form .action-row { border: 1px solid var(--line); }
.action-row:hover, .action summary:hover { background: var(--g-50); }
.action-row:focus-visible, .action summary:focus-visible { outline: 2px solid var(--g-700); outline-offset: 2px; }
.action summary::-webkit-details-marker { display: none; }
.action[open] summary .chev { transform: rotate(180deg); }
.action strong { display: block; font-size: 15px; }
.action small { display: block; color: var(--muted); font-size: 13px; margin-top: 1px; }
.action-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--g-50); color: var(--g-700); flex: none; }
.action-ic .ic { width: 21px; height: 21px; }
.action-ic.out { background: var(--g-700); color: #fff; }
.action-ic.add { background: var(--g-100); }
.action-ic.info { background: var(--help-blue-bg); color: var(--help-blue); }
.action-body { display: flex; flex-direction: column; gap: 12px; padding: 4px 14px 14px; }
.action-body fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.action-body legend { font-weight: 600; font-size: 13.5px; margin-bottom: 4px; color: var(--text-2); }
@media (max-width: 760px) {
  .scanned-head { align-items: flex-start; }
  .scanned-head .thumb.lg { width: 84px; flex: none; }
  .scanned-head h1 { font-size: 19px; }
}
.out-fields { display: flex !important; flex-direction: column; gap: 12px; }
.out-fields > .field { width: 100%; align-self: stretch; margin-left: 0; }

/* Inventaires : import / export CSV */
.inv-io { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; }
.inv-io-btn { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--g-700); cursor: pointer; padding: 2px 0; }
.inv-io-btn .ic { width: 14px; height: 14px; }
.inv-io-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.action.disabled { opacity: .6; cursor: not-allowed; } .action.disabled:hover { background: none; }
.action.action-row { border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.action.action-row:hover { background: var(--g-50); }
.action.action-row.disabled:hover { background: var(--card); }

/* Saisie par étiquettes (allergies) */
.tags-input { position: relative; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 46px; padding: 6px 8px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--card); cursor: text; }
.tags-input:focus-within { border-color: var(--g-500); box-shadow: 0 0 0 3px var(--g-100); }
.tags-type { flex: 1 1 140px; min-width: 120px; border: 0; outline: 0; background: transparent; font: inherit; font-size: 15px; padding: 6px 4px; color: var(--text); }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 11px; border-radius: 999px; background: var(--danger-bg); color: var(--danger-text); font-size: 13.5px; font-weight: 600; }
.tag-chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; padding: 0 3px; opacity: .75; display: grid; place-items: center; }
.tag-chip button .ic { width: 13px; height: 13px; }
.tag-chip button:hover { opacity: 1; }
.tags-sugg { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 4px; max-height: 280px; overflow-y: auto; }
.tags-sugg button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit; color: var(--text); }
.tags-sugg button small { display: block; color: var(--muted); font-size: 12.5px; }
.tags-sugg button:hover, .tags-sugg button.on { background: var(--g-50); }
.health-form { display: flex; flex-direction: column; gap: 14px; }
.person-row summary { cursor: pointer; list-style: none; }
.person-row summary::-webkit-details-marker { display: none; }
.person-edit { padding: 6px 4px 16px; border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 12px; }
.person-link { flex-wrap: wrap; gap: 8px; padding-top: 12px; border-top: 1px dashed var(--line); }
.person-link .input { flex: 1 1 180px; }
.person-link .select { width: auto; }
.person-new { margin-top: 12px; }
.person-new > summary { list-style: none; display: inline-flex; cursor: pointer; }
.person-new > summary::-webkit-details-marker { display: none; }
.btn.danger { color: var(--danger-text); }
