/* ══════════════════════════════════════════════
   FONTS — official Mieux-Être 2026 brand kit
══════════════════════════════════════════════ */
@font-face {
  font-family: "Helvetica Now Display";
  src: url("/fonts/HelveticaNowDisplay-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Helvetica Now Display";
  src: url("/fonts/HelveticaNowDisplay-Medium.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Helvetica Now Display";
  src: url("/fonts/HelveticaNowDisplay-Bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Helvetica Now Display";
  src: url("/fonts/HelveticaNowDisplay-Italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Waldenburg Fett Schmal";
  src: url("/fonts/WaldenburgFettSchmal.woff2") format("woff2");
  font-weight: 800; font-style: normal; font-display: swap;
}

/* ══════════════════════════════════════════════
   TOKENS
══════════════════════════════════════════════ */
:root {
  --blue: #243ebc;
  --blue-dark: #1a2f8f;
  --blue-tint: #eaedfa;
  --midnight: #002360;
  --midnight-2: #002d78;
  --cornflower: #599bfc;
  --sky: #c5dfff;
  --ivory: #f7f6f0;
  --charcoal: #1e1d1d;
  --akaroa: #d8c5ab;
  --oak: #a0794a;
  --sienna: #ff5629;
  --sienna-tint: #ffe9e2;
  --amber: #c9871f;
  --amber-tint: #faedd6;
  --white: #ffffff;

  --bg: var(--ivory);
  --surface: #ffffff;
  --surface-2: #f0ede3;
  --text: var(--charcoal);
  --text-muted: #726f68;
  --text-faint: #9d998f;
  --border: #e6e1d3;
  --border-strong: #d8d2c0;

  --accent: var(--blue);
  --accent-contrast: #ffffff;
  --focus-ring: var(--blue);

  --ok-bg: var(--blue-tint);
  --ok-text: var(--blue-dark);
  --warn-bg: var(--amber-tint);
  --warn-text: var(--amber);
  --danger-bg: var(--sienna-tint);
  --danger-text: #c73f1b;

  --sidebar-bg: var(--midnight);
  --sidebar-bg-2: var(--midnight-2);
  --sidebar-text: var(--sky);
  --sidebar-text-dim: rgba(197, 223, 255, 0.58);
  --sidebar-active-bg: var(--blue);
  --sidebar-active-text: #ffffff;
  --sidebar-border: rgba(197, 223, 255, 0.14);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0, 20, 70, 0.07);
  --shadow: 0 6px 20px rgba(0, 20, 70, 0.09);
  --shadow-lg: 0 20px 48px rgba(0, 20, 70, 0.18);

  --font-body: "Helvetica Now Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-display: "Waldenburg Fett Schmal", var(--font-body);

  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 1.875rem;
  --fs-3xl: 2.5rem;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 180ms;

  --sidebar-w: 240px;
  --bottom-nav-h: 64px;
  --topbar-h: 64px;
}

/* ══════════════════════════════════════════════
   RESET & BASE
══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }
html, body, div, span, h1, h2, h3, h4, h5, h6, p, ul, li, form, button, input, select, textarea, table, th, td {
  margin: 0; padding: 0; border: 0; font: inherit; color: inherit;
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
ul { list-style: none; }
button { cursor: pointer; background: none; font-family: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
input, select, textarea { font-family: inherit; }
table { border-collapse: collapse; width: 100%; }

::selection { background: var(--blue); color: #fff; }

:focus-visible {
  outline: 2.5px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.tabular { font-variant-numeric: tabular-nums; }

/* ══════════════════════════════════════════════
   TYPOGRAPHY
══════════════════════════════════════════════ */
h1, h2, h3, h4 { font-weight: 500; letter-spacing: -0.01em; }
.display-num {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.page-title {
  font-size: var(--fs-xl);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.section-title {
  font-size: var(--fs-md);
  font-weight: 500;
}
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }

/* ══════════════════════════════════════════════
   ICONS
══════════════════════════════════════════════ */
.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* ══════════════════════════════════════════════
   CLINIC GATE (select-a-clinic screen)
══════════════════════════════════════════════ */
.gate {
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--midnight);
  background-image: radial-gradient(circle at 15% 8%, var(--midnight-2), var(--midnight) 55%);
  padding: 48px 20px;
}
.gate__mark { width: 56px; height: 56px; margin-bottom: 22px; }
.gate__tagline {
  color: var(--sky); font-size: var(--fs-sm); font-style: italic;
  font-weight: 400; margin-bottom: 6px; opacity: 0.85;
}
.gate__title {
  color: #fff; font-size: var(--fs-2xl); font-weight: 500; text-align: center;
  margin-bottom: 36px; letter-spacing: -0.01em;
}
.gate__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; width: 100%; max-width: 780px;
}
.gate__clinic {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(197,223,255,0.16);
  border-radius: var(--radius);
  padding: 20px 18px;
  color: #fff;
  text-align: left;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.gate__clinic:hover, .gate__clinic:focus-visible {
  background: var(--blue); border-color: var(--blue); transform: translateY(-2px);
}
.gate__clinic-name { font-size: var(--fs-md); font-weight: 500; }
.gate__clinic .icon { color: var(--sky); opacity: 0.7; }
.gate__footer { margin-top: 40px; }
.gate__settings-link {
  color: var(--sidebar-text-dim); font-size: var(--fs-sm);
  display: inline-flex; align-items: center; gap: 6px;
}
.gate__settings-link:hover { color: #fff; }

.gate__login-content { width: 100%; max-width: 340px; }
.gate__login-content .field label { color: var(--sidebar-text-dim); }
.gate__login-divider {
  display: flex; align-items: center; gap: 12px; margin: 22px 0;
  color: var(--sidebar-text-dim); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.04em;
}
.gate__login-divider::before, .gate__login-divider::after { content: ""; flex: 1; height: 1px; background: rgba(255,255,255,0.14); }
.gate__login-error { color: #ffb4a3; font-size: var(--fs-sm); margin-top: 12px; text-align: center; }
.gate__login-error--info { color: #c5dfff; }
#google-btn-container { display: flex; justify-content: center; min-height: 40px; }

/* ══════════════════════════════════════════════
   APP SHELL
══════════════════════════════════════════════ */
.shell { display: flex; min-height: 100dvh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0;
  padding: 20px 14px;
}
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 22px; }
.sidebar__mark { width: 30px; height: 30px; flex-shrink: 0; }
.sidebar__wordmark { color: #fff; font-size: var(--fs-md); font-weight: 500; line-height: 1.15; }
.sidebar__wordmark small { display: block; color: var(--sidebar-text-dim); font-size: var(--fs-xs); font-weight: 400; }

.clinic-switch {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: rgba(255,255,255,0.06); border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 18px;
  color: var(--sidebar-text); transition: background var(--dur) var(--ease);
}
.clinic-switch:hover { background: rgba(255,255,255,0.11); }
.clinic-switch__icon { color: var(--cornflower); }
.clinic-switch__label { flex: 1; text-align: left; overflow: hidden; }
.clinic-switch__name { font-size: var(--fs-sm); font-weight: 500; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clinic-switch__hint { font-size: 0.6875rem; color: var(--sidebar-text-dim); }

.nav-list { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--sidebar-text-dim); font-size: var(--fs-base); font-weight: 500;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  width: 100%; text-align: left;
}
.nav-item .icon { color: currentColor; opacity: 0.85; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.is-active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); }
.nav-item.is-active .icon { opacity: 1; }
.nav-list__spacer { flex: 1; }
.nav-list__divider { height: 1px; background: var(--sidebar-border); margin: 10px 4px; }

.sidebar__footer { display: flex; flex-direction: column; gap: 2px; }

.lang-toggle {
  display: inline-flex; background: rgba(255,255,255,0.08); border-radius: var(--radius-pill);
  padding: 3px; gap: 2px;
}
.lang-toggle__opt {
  padding: 5px 12px; border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 500;
  color: var(--sidebar-text-dim); transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.lang-toggle__opt.is-active { background: var(--blue); color: #fff; }
.lang-toggle--light { background: var(--surface-2); }
.lang-toggle--light .lang-toggle__opt { color: var(--text-muted); }
.lang-toggle--light .lang-toggle__opt.is-active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }

.sidebar__lang-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 2px; }
.sidebar__lang-row .muted { color: var(--sidebar-text-dim); font-size: var(--fs-xs); }

.sidebar__user-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; margin-top: 6px; border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar__user-name {
  color: #fff; font-size: var(--fs-sm); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar__user-email { color: var(--sidebar-text-dim); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main {
  flex: 1; min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
}

.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; background: var(--bg);
  position: sticky; top: 0; z-index: 20;
}
.topbar__title { display: flex; align-items: center; gap: 10px; }
.topbar__back { color: var(--text-muted); }
.topbar__mobile-clinic { display: none; }
.topbar__mobile-clinic.clinic-switch {
  background: var(--blue-tint); border-color: transparent; padding: 8px 12px;
}
.topbar__mobile-clinic .clinic-switch__icon { color: var(--blue); }
.topbar__mobile-clinic .clinic-switch__name { color: var(--blue-dark); font-size: var(--fs-sm); }
.topbar__mobile-clinic:hover { background: var(--sky); }

.content { flex: 1; padding: 8px 28px 48px; max-width: 1100px; width: 100%; }

.bottom-nav { display: none; }

/* ══════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: var(--radius-sm);
  font-size: var(--fs-base); font-weight: 500; white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
  border: 1px solid transparent;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover:not(:disabled) { background: var(--blue-dark); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }

.btn-danger { background: transparent; color: var(--danger-text); border-color: var(--sienna-tint); }
.btn-danger:hover:not(:disabled) { background: var(--sienna-tint); }

.btn-lg { height: 52px; font-size: var(--fs-md); padding: 0 24px; border-radius: var(--radius-sm); }
.btn-sm { height: 32px; padding: 0 12px; font-size: var(--fs-sm); }
.btn-block { width: 100%; }
.btn-icon { width: 42px; height: 42px; padding: 0; border-radius: var(--radius-sm); }
.btn-icon.btn-sm { width: 32px; height: 32px; }

.btn-scan {
  background: var(--blue); color: #fff; border-radius: var(--radius);
  height: 56px; font-size: var(--fs-md); font-weight: 500;
  box-shadow: var(--shadow);
}
.btn-scan:hover:not(:disabled) { background: var(--blue-dark); }
.btn-scan .icon { color: #fff; }

/* ══════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label { font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted); }
.field-hint { font-size: var(--fs-xs); color: var(--text-faint); }

.input, .select, textarea.input {
  height: 44px; padding: 0 14px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1.5px solid var(--border-strong);
  font-size: var(--fs-base); color: var(--text); width: 100%;
  transition: border-color var(--dur) var(--ease);
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--blue-tint); }
.input::placeholder { color: var(--text-faint); }
textarea.input { height: auto; padding: 12px 14px; resize: vertical; min-height: 80px; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23726f68' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.input-row { display: flex; gap: 10px; }
.input-row .field { flex: 1; }

.input-lg { height: 52px; font-size: var(--fs-md); text-align: center; letter-spacing: 0.02em; }

.segmented {
  display: flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: 4px; gap: 4px;
}
.segmented__opt {
  flex: 1; height: 38px; border-radius: 6px; font-size: var(--fs-base); font-weight: 500;
  color: var(--text-muted); transition: background var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.segmented__opt.is-active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }

.qty-stepper { display: flex; align-items: center; gap: 10px; }
.qty-stepper .input { text-align: center; }
.qty-stepper .btn-icon { flex-shrink: 0; }

/* ══════════════════════════════════════════════
   CARDS / STAT TILES
══════════════════════════════════════════════ */
.card {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  padding: 20px;
}
.card + .card { margin-top: 14px; }
.card-pad-lg { padding: 28px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 6px;
}
.stat-tile__label { font-size: var(--fs-sm); color: var(--text-muted); font-weight: 500; display: flex; align-items: center; justify-content: space-between; }
.stat-tile__value { font-size: var(--fs-3xl); }
.stat-tile--warn { border-color: #f3d9b8; background: var(--amber-tint); }
.stat-tile--warn .stat-tile__label { color: var(--amber); }
.stat-tile--warn .stat-tile__value { color: var(--danger-text); }
.stat-tile--clickable { cursor: pointer; transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.stat-tile--clickable:hover { border-color: var(--accent); transform: translateY(-2px); }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 30px 0 12px;
  scroll-margin-top: calc(var(--topbar-h) + 12px);
}
.section-head:first-child { margin-top: 4px; }

.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 8px; }
.quick-action {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.quick-action:hover { border-color: var(--accent); transform: translateY(-2px); }
.quick-action__icon {
  width: 38px; height: 38px; border-radius: 10px; background: var(--blue-tint); color: var(--blue);
  display: flex; align-items: center; justify-content: center;
}
.quick-action__label { font-weight: 500; }

/* ══════════════════════════════════════════════
   BADGES
══════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: var(--fs-xs); font-weight: 500; white-space: nowrap;
}
.badge-ok { background: var(--ok-bg); color: var(--ok-text); }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); }
.badge-danger { background: var(--danger-bg); color: var(--danger-text); }
.badge-neutral { background: var(--surface-2); color: var(--text-muted); }

/* ══════════════════════════════════════════════
   TABLES
══════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table { min-width: 100%; }
.table th {
  text-align: left; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-faint); font-weight: 500; padding: 12px 16px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: var(--fs-base); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.item-cell { display: flex; align-items: center; gap: 10px; }
.item-thumb {
  width: 36px; height: 36px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
  background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--text-faint);
}
.item-cell__name { font-weight: 500; }
.item-cell__sku { font-size: var(--fs-xs); color: var(--text-faint); }

/* ══════════════════════════════════════════════
   ACTIVITY FEED
══════════════════════════════════════════════ */
.feed { display: flex; flex-direction: column; }
.feed-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.feed-row:last-child { border-bottom: none; padding-bottom: 0; }
.feed-row:first-child { padding-top: 0; }
.feed-icon {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.feed-icon--receive { background: var(--ok-bg); color: var(--ok-text); }
.feed-icon--scan_out { background: var(--surface-2); color: var(--text-muted); }
.feed-icon--count_adjust { background: var(--amber-tint); color: var(--amber); }
.feed-body { flex: 1; min-width: 0; }
.feed-title { font-size: var(--fs-base); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-meta { font-size: var(--fs-xs); color: var(--text-faint); }
.feed-delta { font-size: var(--fs-sm); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.feed-delta--pos { color: var(--ok-text); }
.feed-delta--neg { color: var(--danger-text); }

/* ══════════════════════════════════════════════
   EMPTY STATES / SKELETONS
══════════════════════════════════════════════ */
.empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 44px 24px; color: var(--text-muted);
}
.empty-state__icon {
  width: 52px; height: 52px; border-radius: var(--radius); background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; color: var(--text-faint); margin-bottom: 16px;
}
.empty-state__title { font-size: var(--fs-md); font-weight: 500; color: var(--text); margin-bottom: 4px; }
.empty-state__desc { font-size: var(--fs-sm); max-width: 320px; margin-bottom: 18px; }

@keyframes shimmer { 0% { background-position: -300px 0; } 100% { background-position: 300px 0; } }
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, #e8e4d8 37%, var(--surface-2) 63%);
  background-size: 600px 100%; animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-tile { height: 84px; border-radius: var(--radius); }

/* ══════════════════════════════════════════════
   STEP WIZARD
══════════════════════════════════════════════ */
.wizard { max-width: 520px; }
.step-dots { display: flex; gap: 6px; margin-bottom: 22px; }
.step-dot { height: 4px; flex: 1; border-radius: 2px; background: var(--border-strong); transition: background var(--dur) var(--ease); }
.step-dot.is-done, .step-dot.is-active { background: var(--accent); }

.step-card { animation: step-in var(--dur) var(--ease); }
@keyframes step-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.result-banner {
  display: flex; align-items: center; gap: 14px; padding: 18px 20px;
  border-radius: var(--radius); background: var(--ok-bg); color: var(--ok-text); margin-bottom: 18px;
}
.result-banner--danger { background: var(--danger-bg); color: var(--danger-text); }
.result-banner--warn { background: var(--warn-bg); color: var(--warn-text); }
.result-banner__icon { flex-shrink: 0; }
.result-banner__text { flex: 1; font-weight: 500; }

.summary-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.summary-row:last-child { border-bottom: none; }
.summary-row__label { color: var(--text-muted); font-size: var(--fs-sm); }
.summary-row__value { font-weight: 500; }

/* ══════════════════════════════════════════════
   PHOTO PICKER
══════════════════════════════════════════════ */
.photo-picker { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.photo-preview {
  width: 88px; height: 88px; border-radius: var(--radius); background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; color: var(--text-faint);
  overflow: hidden; flex-shrink: 0; border: 1.5px dashed var(--border-strong);
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-actions { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 180px; }
.photo-suggestion { display: flex; align-items: center; gap: 10px; background: var(--blue-tint); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 10px; }
.photo-suggestion img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.photo-suggestion__text { flex: 1; font-size: var(--fs-xs); color: var(--blue-dark); }

/* ══════════════════════════════════════════════
   TOASTS
══════════════════════════════════════════════ */
.toast-stack {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 200; width: min(420px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  background: var(--charcoal); color: #fff; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm); animation: toast-in var(--dur) var(--ease);
}
.toast--success .toast__icon { color: #8fd6a8; }
.toast--error { background: #4a1a10; }
.toast--error .toast__icon { color: var(--sienna); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ══════════════════════════════════════════════
   BOTTOM SHEET (mobile "more" + pickers)
══════════════════════════════════════════════ */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0, 10, 40, 0.42); z-index: 150;
  animation: fade-in var(--dur) var(--ease);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 151;
  background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg);
  max-height: 80dvh; overflow-y: auto; padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  animation: sheet-in var(--dur) var(--ease);
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0.4; } to { transform: translateY(0); opacity: 1; } }
.sheet__handle { width: 36px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 6px auto 16px; }
.sheet__title { font-size: var(--fs-md); font-weight: 500; margin-bottom: 12px; }
.sheet-list { display: flex; flex-direction: column; gap: 2px; }
.sheet-item {
  display: flex; align-items: center; gap: 14px; padding: 13px 8px; border-radius: var(--radius-sm);
  width: 100%; text-align: left; font-size: var(--fs-base); font-weight: 500;
}
.sheet-item:hover { background: var(--surface-2); }
.sheet-item .icon { color: var(--text-muted); }
.sheet-item__meta { margin-left: auto; }

/* ══════════════════════════════════════════════
   BIN / CANDIDATE PICKER LIST (e.g. choosing which bin to pull from)
══════════════════════════════════════════════ */
.pick-list { display: flex; flex-direction: column; gap: 8px; }
.pick-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 14px 16px; border-radius: var(--radius); border: 1.5px solid var(--border);
  background: var(--surface); transition: border-color var(--dur) var(--ease);
}
.pick-row:hover, .pick-row.is-selected { border-color: var(--accent); }
.pick-row.is-selected { background: var(--blue-tint); }
.pick-row__main { flex: 1; }
.pick-row__title { font-weight: 500; }
.pick-row__sub { font-size: var(--fs-xs); color: var(--text-faint); }

.bin-card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px;
}
.bin-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  padding: 14px; border-radius: var(--radius); border: 1.5px solid var(--border);
  background: var(--surface); transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.bin-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.bin-card__code { font-weight: 500; font-variant-numeric: tabular-nums; }
.bin-card__meta { font-size: var(--fs-xs); color: var(--text-faint); }

/* ══════════════════════════════════════════════
   COUNT SESSION LINES (inventory/cycle count)
══════════════════════════════════════════════ */
.count-line {
  display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border);
}
.count-line:last-child { border-bottom: none; }
.count-line__inputs { display: flex; gap: 8px; flex-shrink: 0; }
.count-line__inputs .field { margin-bottom: 0; width: 84px; }
.count-line__inputs label { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.03em; }
.count-line--unexpected { background: var(--warn-bg); margin: 0 -20px; padding: 14px 20px; border-bottom-color: transparent; border-radius: var(--radius-sm); }

.report-line__delta { font-weight: 500; }
.report-line__delta--zero { color: var(--text-faint); }
.report-line__delta--pos { color: var(--ok-text); }
.report-line__delta--neg { color: var(--danger-text); }

/* ══════════════════════════════════════════════
   SCAN OVERLAY (signature interaction)
══════════════════════════════════════════════ */
.scan-overlay {
  position: fixed; inset: 0; z-index: 300; background: #05060a;
  display: flex; flex-direction: column; color: #fff;
}
.scan-overlay__top {
  display: flex; align-items: center; gap: 14px; padding: max(16px, env(safe-area-inset-top)) 18px 14px;
}
.scan-overlay__close {
  width: 38px; height: 38px; border-radius: 999px; background: rgba(255,255,255,0.1); color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.scan-overlay__title { font-size: var(--fs-md); font-weight: 500; }
.scan-overlay__subtitle { font-size: var(--fs-xs); color: rgba(255,255,255,0.6); }

.scan-overlay__stage { position: relative; flex: 1; overflow: hidden; background: #000; }
.scan-overlay__reader { position: absolute; inset: 0; }
.scan-overlay__reader video { width: 100% !important; height: 100% !important; object-fit: cover; }

.scan-reticle {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(68vw, 280px); height: min(68vw, 280px); pointer-events: none;
}
.scan-reticle__corner { position: absolute; width: 30px; height: 30px; border-color: var(--cornflower); border-style: solid; border-width: 0; opacity: 0.95; }
.scan-reticle__corner--tl { top: 0; left: 0; border-top-width: 3px; border-left-width: 3px; border-radius: 8px 0 0 0; }
.scan-reticle__corner--tr { top: 0; right: 0; border-top-width: 3px; border-right-width: 3px; border-radius: 0 8px 0 0; }
.scan-reticle__corner--bl { bottom: 0; left: 0; border-bottom-width: 3px; border-left-width: 3px; border-radius: 0 0 0 8px; }
.scan-reticle__corner--br { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px; border-radius: 0 0 8px 0; }

.scan-overlay__flash {
  position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none;
  transition: opacity 150ms ease-out;
}
.scan-overlay__flash--active { opacity: 0.85; }

.scan-overlay__status {
  position: absolute; left: 0; right: 0; bottom: 18px; text-align: center;
  font-size: var(--fs-sm); color: rgba(255,255,255,0.75); padding: 0 24px;
}
.scan-overlay__status--error { color: var(--sienna); }

.scan-overlay__manual { padding: 16px 20px max(16px, env(safe-area-inset-bottom)); background: #05060a; }
.scan-overlay__manual-toggle { color: rgba(255,255,255,0.6); font-size: var(--fs-sm); text-decoration: underline; text-underline-offset: 3px; }
.scan-overlay__manual-row { display: flex; gap: 8px; margin-top: 10px; }
.scan-overlay__manual-row .input { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.18); color: #fff; }
.scan-overlay__manual-row .input::placeholder { color: rgba(255,255,255,0.4); }

/* ══════════════════════════════════════════════
   SETTINGS / ADMIN GATE
══════════════════════════════════════════════ */
.admin-gate { max-width: 380px; margin: 60px auto; text-align: center; }
.admin-gate__icon {
  width: 52px; height: 52px; border-radius: var(--radius); background: var(--blue-tint); color: var(--blue);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 18px;
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row__name { font-weight: 500; }
.settings-row__meta { font-size: var(--fs-xs); color: var(--text-faint); }

/* ══════════════════════════════════════════════
   RESPONSIVE — collapse sidebar into bottom nav
══════════════════════════════════════════════ */
@media (max-width: 899px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .content { padding: 4px 16px calc(var(--bottom-nav-h) + 28px); }
  .topbar { padding: 0 16px; }
  .topbar__mobile-clinic { display: flex; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-tile { padding: 12px 14px; gap: 3px; }
  .stat-tile__value { font-size: var(--fs-2xl); }

  .quick-actions { grid-template-columns: 1fr 1fr; gap: 8px; }
  .quick-actions .quick-action:nth-child(1) { grid-column: 1 / -1; }
  .quick-action {
    flex-direction: row; align-items: center; gap: 10px;
    padding: 12px 14px;
  }
  .quick-action__icon { width: 32px; height: 32px; flex-shrink: 0; }
  .quick-action__label { font-size: var(--fs-sm); line-height: 1.2; }

  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .bottom-nav__item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--text-faint); font-size: 0.6875rem; font-weight: 500;
  }
  .bottom-nav__item.is-active { color: var(--accent); }
}

@media (min-width: 900px) {
  .sheet[data-sheet="more"] { display: none; }
}

@media (max-width: 560px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .gate__title { font-size: var(--fs-xl); }
  .input-row { flex-direction: column; }
}

/* ══════════════════════════════════════════════
   PRINT — count reports exported via window.print()
══════════════════════════════════════════════ */
.print-report-header { display: none; }
@media print {
  .sidebar, .topbar, .bottom-nav, .no-print { display: none !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0 !important; }
  .print-report-header { display: block !important; font-size: var(--fs-lg); font-weight: 500; margin-bottom: 16px; }
  body { background: #fff !important; }
  .table-wrap { overflow: visible !important; }
}


/* ══════════════════════════════════════════════
   GENERIC ID, MODAL, WRAPPING TABS
══════════════════════════════════════════════ */
.gcode { font-weight: 700; color: var(--blue-dark); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.item-title { min-width: 0; }

.segmented--wrap { flex-wrap: wrap; }
.segmented--wrap .segmented__opt { flex: 1 1 auto; padding: 0 14px; min-width: 96px; }

.modal {
  position: fixed; z-index: 151; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow-y: auto;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 22px 24px 24px; animation: modal-in var(--dur) var(--ease);
}
.modal--wide { width: min(780px, calc(100vw - 32px)); }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal__title { font-size: var(--fs-lg); font-weight: 500; line-height: 1.25; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
@keyframes modal-in { from { opacity: 0; transform: translate(-50%, calc(-50% + 12px)); } to { opacity: 1; transform: translate(-50%, -50%); } }
@media (max-width: 599px) {
  .modal {
    top: auto; bottom: 0; left: 0; right: 0; transform: none; width: auto; max-height: 92dvh;
    border-radius: 20px 20px 0 0; padding: 18px 18px calc(20px + env(safe-area-inset-bottom));
    animation: sheet-in var(--dur) var(--ease);
  }
}

.quick-action--primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.quick-action--primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.quick-action--primary .quick-action__icon { background: rgba(255, 255, 255, 0.16); color: #fff; }

/* ══════════════════════════════════════════════
   COUNT ROWS — units, boxes x units per box, live minimum check
══════════════════════════════════════════════ */
.count-row { display: flex; flex-direction: column; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.count-row:last-child { border-bottom: none; }
.count-row--unexpected { background: var(--warn-bg); margin: 0 -20px; padding: 16px 20px; border-bottom-color: transparent; border-radius: var(--radius-sm); }
.count-row__head { display: flex; align-items: flex-start; gap: 12px; }
.count-row__title { flex: 1; min-width: 0; }
.count-row__request { flex-shrink: 0; }
.count-row__fields { display: flex; flex-direction: column; gap: 10px; }
.count-row__units { max-width: 240px; margin-bottom: 0; }
.count-row__boxes { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.count-row__boxes .field { margin-bottom: 0; width: 120px; }
.count-row__times { padding-bottom: 12px; color: var(--text-faint); font-weight: 500; font-size: var(--fs-md); }
.count-row .field label, .count-row__fields .field label { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.03em; }
.count-row__status { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); min-height: 22px; }
.count-row__statusline { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; }
.count-row__min, .count-row__total { color: var(--text-muted); }
.count-row__min strong, .count-row__total strong { color: var(--text); font-weight: 500; }
.count-row__order { color: var(--danger-text); font-weight: 500; }
.table .cat-row td { background: var(--surface-2); font-size: var(--fs-xs); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); padding: 9px 16px; }
.table .cat-row:hover td { background: var(--surface-2); }
@media (max-width: 560px) {
  .count-row__head { flex-wrap: wrap; }
  .count-row__request { margin-left: 52px; }
}

.table td.review-item { min-width: 240px; }
.table td.review-status { min-width: 170px; }
.review-request { margin: 4px 0 0 -12px; }

/* keep "700 unités" on one line in numeric columns; sub-lines (order format) may still wrap */
.table td.num { white-space: nowrap; }
.table td.num .item-cell__sku { white-space: normal; }

/* section headings with actions: the title never gets squeezed, the actions wrap below it on a phone */
.section-head { flex-wrap: wrap; gap: 8px 12px; }
.section-head .section-title { white-space: nowrap; }
