/* CuisineHub — CRM theme
   Tokens follow the validated data-viz palette (warm neutrals, blue accent, reserved status colors).
   Light values live on :root; dark values are redefined for the OS setting and the manual toggle. */

:root {
  color-scheme: light;
  --bg: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #898781;
  --line: #e1e0d9;
  --line-strong: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);

  --accent: #2a78d6;
  --accent-text: #1c5cab;
  --accent-soft: rgba(42, 120, 214, 0.10);
  --btn: #256abf;
  --btn-hover: #1c5cab;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1a9e5c;

  --good: #0ca30c;
  --good-text: #006300;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --bad-text: #d03b3b;

  --shadow-sm: 0 1px 2px rgba(11, 11, 11, 0.05);
  --shadow-md: 0 12px 32px rgba(11, 11, 11, 0.12);
  --radius: 14px;
  --sidebar-w: 264px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232322;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --line: #2c2c2a;
    --line-strong: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --accent-text: #86b6ef;
    --accent-soft: rgba(57, 135, 229, 0.16);
    --series-1: #3987e5;
    --series-2: #d95926;
  --series-3: #2fb36f;
    --series-3: #2fb36f;
    --good-text: #0ca30c;
    --bad-text: #e66767;
    --shadow-sm: none;
    --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232322;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --line: #2c2c2a;
  --line-strong: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #3987e5;
  --accent-text: #86b6ef;
  --accent-soft: rgba(57, 135, 229, 0.16);
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #2fb36f;
  --good-text: #0ca30c;
  --bad-text: #e66767;
  --shadow-sm: none;
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.55);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.25; letter-spacing: -0.02em; font-weight: 650; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--ink-2); }
.period-note { font-size: 13px; margin-bottom: 18px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.main { min-width: 0; display: flex; flex-direction: column; }
.content { width: 100%; max-width: 1360px; margin-inline: auto; padding: 28px 32px 56px; }

/* Sidebar */
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 8px;
  padding: 20px 14px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 18px; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #184f95, #3987e5); color: #fff;
  box-shadow: 0 4px 12px rgba(42, 120, 214, 0.35);
}
.brand-mark .icon { width: 20px; height: 20px; }
.brand-text { display: grid; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 15px; letter-spacing: -0.01em; }
.brand-text small { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-title {
  margin: 16px 10px 6px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3);
}
.nav-title:first-child { margin-top: 0; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px;
  color: var(--ink-2); font-weight: 500; transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; margin-top: 8px;
  border-top: 1px solid var(--border);
}
.sidebar-user-text { display: grid; min-width: 0; flex: 1; line-height: 1.3; }
.sidebar-user-text strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-text small { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user form { margin: 0; }
.avatar {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
}
.avatar-lg { width: 72px; height: 72px; font-size: 22px; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.search-wrap { position: relative; flex: 1; max-width: 520px; }
.search {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--ink-3);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--ink); }
.search input::placeholder { color: var(--ink-3); }
.search kbd {
  padding: 2px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2);
  font: 600 11px var(--font); color: var(--ink-2);
}

/* Global search results */
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-md); max-height: 70vh; overflow-y: auto; padding: 8px;
}
.search-section + .search-section { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.search-section-label {
  padding: 6px 10px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-3);
}
.search-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  color: var(--ink); cursor: pointer;
}
.search-item:hover, .search-item.is-active { background: var(--surface-2); }
.search-item .icon { flex: none; width: 16px; height: 16px; color: var(--ink-3); }
.search-item-text { display: grid; min-width: 0; line-height: 1.3; }
.search-item-title { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-item-sub { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-status { padding: 16px 12px; text-align: center; font-size: 13px; color: var(--ink-2); }
.topbar-actions { display: flex; gap: 6px; margin-left: auto; }

/* Notification bell — reuses .search-results/.search-item, anchored to the right instead */
.notif-wrap { position: relative; }
.notif-panel { top: calc(100% + 8px); left: auto; right: 0; width: 340px; }
.notif-badge {
  position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px;
  display: grid; place-items: center; border-radius: 999px; background: var(--critical);
  color: #fff; font-size: 10px; font-weight: 700; line-height: 1; border: 2px solid var(--surface);
}
.search-item .dot { margin-right: 2px; }
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 10px;
  background: transparent; color: var(--ink-2); transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.nav-toggle { display: none; }
.theme-toggle .when-dark, :root[data-theme="dark"] .theme-toggle .when-light { display: none; }
:root[data-theme="dark"] .theme-toggle .when-dark { display: contents; }

/* ---------- Page header ---------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-subtitle { margin-top: 4px; color: var(--ink-2); }
.page-actions form { margin: 0; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Components ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 22px; position: relative;
}
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card-head .muted { font-size: 13px; margin-top: 2px; }
.link { font-size: 13px; font-weight: 600; color: var(--accent-text); }
.link:hover { text-decoration: underline; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px;
  border: 1px solid transparent; border-radius: 10px; font-weight: 600; transition: background 0.15s, opacity 0.15s;
}
.btn-primary { background: var(--btn); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--btn-hover); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-danger { background: var(--critical); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--critical) 85%, #000); }
.btn-danger-ghost { background: transparent; color: var(--bad-text); border-color: color-mix(in srgb, var(--critical) 35%, transparent); }
.btn-danger-ghost:hover { background: color-mix(in srgb, var(--critical) 8%, transparent); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; height: 42px; }

.badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 8px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
}
.badge .icon { width: 14px; height: 14px; }
.badge-demo { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot-good { background: var(--good); }
.dot-warning { background: var(--warning); }
.dot-serious { background: var(--serious); }
.dot-critical { background: var(--critical); }

.alert {
  margin: 20px 0 4px; padding: 10px 12px; border-radius: 10px; font-size: 13px;
  background: color-mix(in srgb, var(--critical) 10%, transparent); color: var(--bad-text);
  border: 1px solid color-mix(in srgb, var(--critical) 30%, transparent);
}

/* Grids */
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid > * { min-width: 0; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-charts, .grid-lists { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dash-pair { margin-bottom: 0; }
.dash-block { margin-bottom: 18px; }
.grid-profile { grid-template-columns: 320px minmax(0, 1fr); align-items: start; }

/* KPI tiles */
.kpi-head { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { color: var(--ink-2); font-weight: 500; }
.kpi-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); }
.kpi-value { margin: 14px 0 12px; font-size: 30px; line-height: 1.1; font-weight: 650; letter-spacing: -0.03em; }
.kpi-unit { font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--ink-2); }
.kpi-foot { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.delta .icon { width: 15px; height: 15px; }
.delta-good { color: var(--good-text); }
.delta-bad { color: var(--bad-text); }
.delta-neutral { color: var(--ink-2); }

/* Tables */
.table-wrap { overflow-x: auto; margin-inline: -22px; }
.card-flush .table-wrap { margin-inline: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  padding: 10px 14px; text-align: left; white-space: nowrap; font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3);
  background: var(--surface-2); border-block: 1px solid var(--line);
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table th:first-child, .table td:first-child { padding-left: 22px; }
.table th:last-child, .table td:last-child { padding-right: 22px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-sub { display: block; font-size: 12px; color: var(--ink-3); }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:first-child { padding-top: 0; }
.list li:last-child { border-bottom: 0; padding-bottom: 0; }
.list-end { display: flex; align-items: center; gap: 12px; }
.list-value { min-width: 56px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Details (profile) */
.details { margin: 0; display: grid; }
.details > div { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.details > div:last-child { border-bottom: 0; padding-bottom: 0; }
.details dt { color: var(--ink-2); }
.details dd { margin: 0; font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.profile-card { display: grid; justify-items: center; gap: 6px; text-align: center; padding-block: 32px; }
.profile-card h2 { margin-top: 10px; font-size: 18px; }
.profile-card .badge { margin-top: 10px; }

/* Empty state */
.empty { display: grid; justify-items: center; gap: 6px; padding: 56px 24px 64px; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 8px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-text); }
.empty-icon .icon { width: 26px; height: 26px; }
.empty h2 { font-size: 16px; }
.empty p { max-width: 420px; color: var(--ink-2); }

/* ---------- Charts ---------- */
.chart { display: grid; grid-template-columns: 52px minmax(0, 1fr); column-gap: 12px; }
.chart-y, .chart-plot { position: relative; height: 240px; }
.chart-y span {
  position: absolute; right: 0; bottom: var(--p); transform: translateY(50%);
  font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.gridline { position: absolute; left: 0; right: 0; bottom: var(--p); height: 1px; background: var(--line); }
.gridline.is-baseline { background: var(--line-strong); }
.chart-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart-line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart-line-2 { stroke: var(--series-2); stroke-dasharray: 5 4; }
.chart-line-3 { stroke: var(--series-3); stroke-width: 2.5; }
.chart-area { fill: var(--series-1); opacity: 0.1; }
.chart-x { grid-column: 2; display: grid; grid-template-columns: repeat(var(--n), 1fr); margin-top: 10px; }
.chart-x span { text-align: center; font-size: 12px; color: var(--ink-3); text-transform: capitalize; }

/* Legend — shown whenever a chart draws more than one series (see chart-line-2) */
.chart-legend { display: flex; gap: 18px; margin-bottom: 14px; font-size: 12.5px; color: var(--ink-2); }
.chart-legend-item { display: inline-flex; align-items: center; gap: 6px; }

/* Hover layer: one full-height column per point (large hit target) */
.hit { position: absolute; top: 0; bottom: 0; left: calc(var(--i) / var(--n) * 100%); width: calc(100% / var(--n)); }
.hit::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: var(--line-strong); opacity: 0; }
.hit:hover::before { opacity: 1; }
.hit .dot {
  position: absolute; left: 50%; top: var(--y); width: 12px; height: 12px; margin: -6px 0 0 -6px;
  background: var(--series-1); box-shadow: 0 0 0 2px var(--surface); opacity: 0;
}
.hit .dot-2 { top: var(--y2); background: var(--series-2); }
.hit .dot-3 { top: var(--y3); background: var(--series-3); }
.hit.is-last .dot, .hit:hover .dot { opacity: 1; }

/* Tooltip */
.tip {
  position: absolute; z-index: 10; display: none; padding: 8px 12px; border-radius: 10px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md);
  font-size: 13px; pointer-events: none;
}
.tip-title { display: block; font-size: 12px; color: var(--ink-2); text-transform: capitalize; }
.tip-row { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.tip-row .dot { position: static; width: 7px; height: 7px; margin: 0; opacity: 1; box-shadow: none; }
.tip-row strong { margin-left: auto; padding-left: 14px; font-variant-numeric: tabular-nums; }
.tip-row-sub { margin-top: 2px; padding-left: 13px; font-size: 12px; color: var(--ink-2); }
.tip-row-result { padding-top: 7px; margin-top: 7px; border-top: 1px solid var(--line); color: var(--ink-2); }
.hit .tip { bottom: calc(100% - var(--y) + 14px); left: 50%; transform: translateX(-50%); }
.hit.is-first .tip { left: 0; transform: none; }
.hit.is-last .tip { left: auto; right: 0; transform: none; }
.hit:hover .tip, .hbar:hover .tip { display: block; }

/* Horizontal bars */
.hbars { display: grid; gap: 16px; }
.hbar { position: relative; display: grid; grid-template-columns: minmax(96px, 34%) minmax(0, 1fr); align-items: center; gap: 12px; }
.hbar-label { color: var(--ink-2); font-size: 13px; }
.hbar-track { display: flex; align-items: center; height: 24px; }
.hbar-fill { flex: none; height: 16px; width: var(--w); min-width: 2px; border-radius: 0 4px 4px 0; background: var(--series-1); }
.hbar-value { margin-left: 8px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tip-bar { top: -8px; right: 0; transform: translateY(-100%); }

/* ---------- Auth ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-aside {
  display: flex; flex-direction: column; justify-content: space-between; gap: 48px; padding: 40px 56px;
  color: #fff; background:
    radial-gradient(900px 500px at 0% 0%, rgba(134, 182, 239, 0.28), transparent 60%),
    linear-gradient(160deg, #0d366b 0%, #184f95 55%, #2a78d6 100%);
}
.brand-light { padding: 0; }
.brand-light .brand-mark { background: rgba(255, 255, 255, 0.16); box-shadow: none; }
.brand-light small { color: rgba(255, 255, 255, 0.72); }
.auth-pitch h2 { max-width: 460px; font-size: 32px; line-height: 1.2; letter-spacing: -0.03em; font-weight: 650; }
.auth-pitch ul { list-style: none; margin: 32px 0 0; padding: 0; display: grid; gap: 16px; }
.auth-pitch li { display: flex; align-items: center; gap: 12px; color: rgba(255, 255, 255, 0.86); }
.auth-pitch li .icon { width: 36px; height: 36px; padding: 9px; border-radius: 10px; background: rgba(255, 255, 255, 0.14); }
.auth-main { display: grid; place-items: center; padding: 32px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 26px; }
.auth-card .btn-block { margin-top: 24px; }

/* ---------- Responsive ---------- */
.scrim { display: none; }

@media (max-width: 1100px) {
  .grid-charts, .grid-lists, .grid-profile, .grid-two { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40; width: 280px; transform: translateX(-100%);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
  }
  .nav-open .sidebar { transform: none; box-shadow: var(--shadow-md); }
  .nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, 0.4); }
  .nav-toggle { display: grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px 48px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
}

@media (max-width: 520px) {
  .search kbd { display: none; }
  .chart { grid-template-columns: 44px minmax(0, 1fr); column-gap: 8px; }
  .hbar { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .details > div { flex-direction: column; gap: 2px; }
  .details dd { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Lists, forms, details (CRUD pages) ---------- */
[hidden] { display: none !important; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-content: start; }
.stack-sm { display: grid; gap: 10px; }
.stack-sm form { margin: 0; }

.messages { display: grid; gap: 8px; margin-bottom: 18px; }
.message {
  padding: 11px 14px; border-radius: 10px; font-weight: 500; border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.message-success { border-color: color-mix(in srgb, var(--good) 40%, transparent); background: color-mix(in srgb, var(--good) 8%, var(--surface)); }
.message-error { border-color: color-mix(in srgb, var(--critical) 40%, transparent); background: color-mix(in srgb, var(--critical) 8%, var(--surface)); color: var(--bad-text); }

.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--line); }
.search-inline { flex: 1 1 260px; max-width: 420px; height: 38px; background: var(--bg); }
.toolbar-count { margin-left: auto; font-size: 13px; color: var(--ink-3); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); font-size: 13px; font-weight: 500;
  color: var(--ink-2); background: var(--surface); transition: background 0.15s, color 0.15s;
}
.chip:hover { background: var(--surface-2); color: var(--ink); }
.chip.is-active { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); font-weight: 600; }
.select-filter {
  height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); font-size: 13px;
  color: var(--ink-2); background: var(--surface);
}
.select-filter:hover { color: var(--ink); }

.table th.actions, .table td.actions { width: 1%; text-align: right; white-space: nowrap; }
.table td.actions { padding-block: 6px; }
.table td.actions .icon-btn { display: inline-grid; width: 34px; height: 34px; }
.table td.actions .inline-form { display: inline-block; margin: 0; vertical-align: middle; }
.table tfoot td { padding: 14px; border-top: 1px solid var(--line-strong); }
.table tfoot td:last-child { padding-right: 22px; }
.cell-link:hover strong { color: var(--accent-text); }
.cell-sub-bad { color: var(--bad-text); }
.cell-user { display: flex; align-items: center; gap: 12px; }
.cell-user > span:last-child { display: grid; }
.icon-btn-danger:hover { background: color-mix(in srgb, var(--critical) 10%, transparent); color: var(--bad-text); }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--line); }
.pagination-links { display: flex; gap: 8px; }

/* Forms */
.form-card { max-width: 920px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 20px; }
.field { display: grid; gap: 6px; margin-top: 18px; align-content: start; }
.field label { font-size: 13px; font-weight: 600; }
.field .req { color: var(--bad-text); }
.field input:not([type="checkbox"]), .field select, .field textarea, .lines input:not([type="checkbox"]), .lines select {
  width: 100%; min-height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { padding: 10px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .lines input:focus, .lines select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--critical); }
.field input.is-readonly, .field input:disabled { background: var(--surface-2); color: var(--ink-3); }
.field-wide { grid-column: 1 / -1; }
.field-check { align-content: end; }
.check { display: flex; align-items: center; gap: 10px; min-height: 42px; font-weight: 500 !important; }
.check input { width: 18px; height: 18px; accent-color: var(--btn); }
.field-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
button.link { background: none; border: 0; padding: 0; cursor: pointer; }
.field-head button.link {
  padding: 3px 9px; border-radius: 999px; font-size: 12px; color: var(--ink-3);
  transition: background 0.15s, color 0.15s;
}
.field-head button.link:hover { background: var(--accent-soft); color: var(--accent-text); text-decoration: none; }
/* Multi-choice pills: the native checkbox stays in the label (clickable, keyboard-focusable) but is
   visually replaced by a drawn box so every pill looks the same across browsers and themes. */
.checkbox-list { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-pill {
  position: relative; display: inline-flex; align-items: center; gap: 9px; min-height: 38px; padding: 0 14px 0 11px;
  border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  font-size: 13.5px; font-weight: 500; cursor: pointer; user-select: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.checkbox-pill:hover { border-color: var(--accent); color: var(--ink); }
.checkbox-pill input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.checkbox-pill::before {
  content: ""; flex: none; width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--line-strong);
  background: var(--surface) no-repeat center / 11px 11px; transition: background-color 0.15s, border-color 0.15s;
}
.checkbox-pill:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.checkbox-pill:has(input:checked)::before {
  background-color: var(--btn); border-color: var(--btn);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 6.2 5 8.6 9.5 3.6'/%3E%3C/svg%3E");
}
.checkbox-pill:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }
.checkbox-pill:has(input:disabled) { opacity: 0.55; cursor: not-allowed; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; max-width: 640px; }
.icon-tile {
  position: relative; display: grid; place-items: center; height: 46px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); font-size: 22px; line-height: 1;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.icon-tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.icon-tile input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.icon-tile-none { grid-column: span 2; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.icon-tile:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.icon-tile:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }
.cat-icon { margin-right: 6px; }
.company-logo { width: 96px; height: 96px; object-fit: contain; border-radius: 16px; background: var(--surface-2); }
.company-links { justify-content: center; margin-top: 8px; }
.vault-filters { flex-wrap: wrap; }
.vault-filters .inline-field { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.vault-filters input[type="date"] { padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
.vault-actions { white-space: nowrap; text-align: left; }
.timeline li { align-items: center; }
.planning-print-form { align-items: end; }
.planning-print-table td, .planning-print-table th { white-space: nowrap; }
.planning-print-table .pp-group th { background: var(--surface-2); font-weight: 600; }
.calendar-card { margin-top: 16px; }
.calendar-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.vault-company-docs { margin-top: 16px; }
.brand-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 10px; background: var(--surface); flex: none; }
.client-logo-sm { width: 24px; height: 24px; object-fit: contain; border-radius: 6px; vertical-align: middle; margin-right: 8px; }
.platform-banner { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 12px 10px; padding: 8px 10px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); font-size: 12.5px; font-weight: 600; }
.establishment-switch { margin: 0 12px 12px; }
.establishment-switch select { width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 600; }
.brand-logo-pilotelio { background: transparent; }
.powered-by { display: flex; align-items: center; gap: 8px; margin: auto 16px 8px; padding-top: 10px; font-size: 11.5px; color: var(--ink-3); text-decoration: none; }
.powered-by img { width: 20px; height: 20px; object-fit: contain; }
.powered-by strong { color: var(--ink-2); }
.auth-logo { display: inline-block; align-self: flex-start; padding: 14px 18px; border-radius: 16px; background: #fff; box-shadow: 0 4px 18px rgb(0 0 0 / 0.12); }
.auth-logo img { display: block; width: 220px; height: auto; }
.auth-card-logo { display: none; width: 180px; height: auto; margin: 0 auto 18px; padding: 8px 12px; border-radius: 12px; background: #fff; }
@media (max-width: 960px) { .auth-card-logo { display: block; } }
.record-nav { margin-bottom: 16px; }
.record-title { font-size: 15px; margin: 24px 0 12px; color: var(--ink-2); scroll-margin-top: 80px; }
.record-title:first-of-type { margin-top: 4px; }
.card-head-links { font-size: 13px; }
.list li.is-history { opacity: 0.7; }
.timeline-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); flex: none; }
.help { font-size: 12.5px; color: var(--ink-3); }
.field-error { font-size: 12.5px; color: var(--bad-text); margin-top: 4px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; }
.stack > .form-actions { margin-top: 0; }
.confirm { display: grid; justify-items: center; gap: 8px; text-align: center; padding-block: 40px; }
.confirm .form-actions { justify-content: center; }
.empty-icon-danger { background: color-mix(in srgb, var(--critical) 12%, transparent); color: var(--bad-text); }

/* Order / stocktaking / recipe lines */
.lines-table td { vertical-align: top; padding-block: 10px; }
.lines-table td:first-child { min-width: 240px; }
/* Narrow columns are capped by the width of their own input, not by position — a formset may have
   3 columns (product, quantity, a computed hint) or more (a unit price, a unit picker), the rule
   still applies regardless of how many or which order. */
.lines-table input[name$="-quantity"],
.lines-table input[name$="-counted_quantity"],
.lines-table input[name$="-counted_cases"],
.lines-table input[name$="-unit_price"],
.lines-table select[name$="-unit"] { max-width: 160px; }
.lines-table input.is-readonly { background: var(--surface-2); color: var(--ink-3); }
.lines-table td[data-line-total], .lines-table td[data-current-stock], .lines-table td[data-line-cost] { padding-top: 21px; font-weight: 600; }
.lines-table .actions .icon-btn { margin-top: 2px; }
/* an input has no intrinsic width the way the <select> it replaces had (its longest option) */
.lines-table .product-search { min-width: 220px; }
.product-search-list {
  position: fixed; z-index: 60; margin: 0; padding: 4px; list-style: none; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow-md);
}
.product-search-list li { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.product-search-list li[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-text); }
.product-search-list li.is-current { font-weight: 600; }
.product-search-list li.is-note { color: var(--ink-3); font-size: 13px; cursor: default; }
.product-search-list .product-search-code { color: var(--ink-3); font-size: 12px; font-family: var(--font-mono, ui-monospace, monospace); }
.lines-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 16px; }
.lines-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.lines-status { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; font-size: 13px; color: var(--ink); background: var(--accent-soft); }
.lines-total { font-size: 15px; color: var(--ink-2); }
.lines-total strong { margin-left: 8px; font-size: 20px; color: var(--ink); letter-spacing: -0.02em; }

/* Detail pages */
.grid-detail { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.note { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); white-space: pre-line; }
.chart-note { margin-top: 14px; font-size: 13px; }

@media (max-width: 1100px) { .grid-detail { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .toolbar, .pagination { padding-inline: 16px; }
  .toolbar-count { margin-left: 0; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
}

/* Settings tabs */
.tabs { display: flex; gap: 4px; margin: -8px 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  padding: 10px 16px; margin-bottom: -1px; border-bottom: 2px solid transparent; white-space: nowrap;
  font-weight: 500; color: var(--ink-2); transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--accent-text); border-bottom-color: var(--accent); font-weight: 600; }
.help ul { margin: 6px 0 0; padding-left: 18px; }

.tabs .tab-end { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.tabs .tab-end .icon { width: 16px; height: 16px; }
.subtabs { margin-top: -14px; border-bottom: none; gap: 6px; }
.subtabs .tab { border-radius: 999px; padding: 6px 14px; background: var(--surface); border: 1px solid var(--line); }
.subtabs .tab.is-active { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
/* In-page form tabs (see provider/form.html) — same look as .tabs/.tab (page-navigation tabs)
   but plain buttons switching sections of one form instead of links between pages. */
.form-tabs { display: flex; gap: 4px; margin-bottom: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.form-tab {
  padding: 12px 18px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none;
  white-space: nowrap; font: inherit; font-weight: 500; color: var(--ink-2); cursor: pointer; transition: color 0.15s, border-color 0.15s;
}
.form-tab:hover { color: var(--ink); }
.form-tab.is-active { color: var(--accent-text); border-bottom-color: var(--accent); font-weight: 600; }
.tab-panel { padding: 22px; }
.tab-intro { margin-bottom: 16px; }
.tab-count { display: inline-block; min-width: 20px; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 11.5px; font-weight: 600; line-height: 18px; text-align: center; color: var(--ink-2); }
.tab-panel h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin: 28px 0 4px; }
.tab-panel h3:first-child { margin-top: 0; }

/* Documents (provider) */
.doc-list { display: grid; gap: 10px; }
.doc-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; }
.doc-row > .icon { color: var(--ink-3); flex: none; }
.doc-text { flex: 1; min-width: 0; }
.doc-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { font-size: 12.5px; color: var(--ink-3); }
.doc-row .inline-form { margin: 0; }
/* Adding a document: type, file and button on one line, the three controls the same height and
   resting on the same baseline. */
.doc-upload { margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--line); }
.doc-upload h3 { margin: 0 0 12px; }
.doc-upload-row { display: grid; grid-template-columns: 220px minmax(0, 1fr) auto; align-items: end; gap: 12px; }
.doc-upload .field { margin-top: 0; }
.doc-upload .btn { height: 42px; padding: 0 18px; }
.field input[type="file"] { padding: 0 12px 0 0; line-height: 40px; overflow: hidden; cursor: pointer; }
.field input[type="file"]::file-selector-button {
  height: 40px; margin: 0 12px 0 0; padding: 0 14px; border: 0; border-right: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
}
.field input[type="file"]:hover::file-selector-button { background: var(--line); }
@media (max-width: 720px) {
  .doc-upload-row { grid-template-columns: minmax(0, 1fr); }
  .doc-upload .btn { width: 100%; }
}
/* Preview window */
dialog.modal.modal-wide { width: min(1040px, calc(100vw - 32px)); max-width: none; }
.modal .doc-preview-head { align-items: center; margin: 0; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.doc-preview-head > div:first-child { min-width: 0; }
.doc-preview-head h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-preview-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.doc-preview-body { display: grid; place-items: center; height: min(78vh, 900px); background: var(--surface-2); overflow: auto; }
.doc-preview-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.doc-preview-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
.doc-preview-none { max-width: 420px; padding: 24px; text-align: center; color: var(--ink-2); }
.product-create-body { height: min(80vh, 900px); background: var(--bg); }
.product-create-body iframe { display: block; width: 100%; height: 100%; border: 0; }
.content-popup { padding: 20px 22px 32px; }
.product-search-list li.is-create { margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 6px 6px; color: var(--accent-text); font-weight: 600; }
@media (max-width: 720px) { .doc-preview-actions .btn { display: none; } }
.help li { margin-bottom: 2px; }

/* ---------- Gestion salariale (workforce) ---------- */
/* Position colours: one hue per .tone-*, used as an accent bar over a faint wash of itself so the
   text keeps the theme's own ink colour (readable in light and dark alike). */
.tone-blue { --tone: #2a78d6; }
.tone-orange { --tone: #eb6834; }
.tone-green { --tone: #2f9e44; }
.tone-purple { --tone: #7c5cd6; }
.tone-pink { --tone: #d6478f; }
.tone-teal { --tone: #129c94; }
.tone-yellow { --tone: #d99a00; }
.tone-gray { --tone: #898781; }
.swatch { display: inline-block; width: 10px; height: 10px; margin-right: 10px; border-radius: 3px; background: var(--tone); }

.todo { display: flex; align-items: center; gap: 12px; min-width: 0; }
a.todo:hover strong { color: var(--accent-text); }
.alert-warning {
  margin: 0 0 18px; background: color-mix(in srgb, var(--warning) 14%, transparent); color: var(--ink);
  border-color: color-mix(in srgb, var(--warning) 45%, transparent);
}
.kpi-sm { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 18px; }
.kpi-sm strong { font-size: 20px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-sm small { font-size: 13px; font-weight: 500; color: var(--ink-3); }
.kpi-sm.has-alerts strong { color: var(--bad-text); }

/* Planning grid — built to be read at a glance: who works when (the day bar), who is off
   ("Repos"), who is away (a coloured band across the days), who is over their hours (the gauge). */
.planning-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.planning-bar form { margin: 0; }
.planning-bar-start { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.planning-bar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.view-switch { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); }
.view-switch a { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 8px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.view-switch a .icon { width: 16px; height: 16px; }
.view-switch a:hover { color: var(--ink); }
.view-switch a.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }

.planning-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.pl-kpi { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.pl-kpi > div { display: grid; min-width: 0; line-height: 1.25; }
.pl-kpi-icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); }
.pl-kpi-icon-leave { background: color-mix(in srgb, #2f9e44 16%, transparent); color: var(--good-text); }
.pl-kpi-label { font-size: 12.5px; color: var(--ink-2); }
.pl-kpi strong { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.pl-kpi-of { font-size: 14px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.pl-kpi small { font-size: 12px; color: var(--ink-3); }
.pl-kpi.is-bad .pl-kpi-icon { background: color-mix(in srgb, var(--critical) 12%, transparent); color: var(--bad-text); }
.pl-kpi.is-bad strong { color: var(--bad-text); }
.pl-kpi.is-good .pl-kpi-icon { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good-text); }

.planning-card { margin-bottom: 24px; }
.planning-side { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; gap: 18px; }

.pl-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; padding: 12px 22px; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.pl-legend-item { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.pl-legend-note { margin-left: auto; color: var(--ink-3); }
.pl-legend-shift { width: 14px; height: 14px; border-radius: 4px; border-left: 3px solid var(--tone); background: color-mix(in srgb, var(--tone) 22%, var(--surface)); }
.pl-legend-absence { width: 22px; height: 12px; border-radius: 4px; background: color-mix(in srgb, var(--tone) 26%, var(--surface)); border: 1px solid color-mix(in srgb, var(--tone) 55%, transparent); }
.pl-legend-flag { position: relative; width: 14px; height: 14px; border-radius: 4px; background: var(--critical); }
.pl-legend-flag::after { content: "!"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 700; line-height: 1; }
.pl-legend-track { position: relative; width: 34px; height: 5px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.pl-legend-track::after { content: ""; position: absolute; top: 0; bottom: 0; left: 15%; width: 45%; border-radius: 999px; background: var(--accent); }

.planning { width: 100%; min-width: 1100px; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.planning th, .planning td { border-bottom: 1px solid var(--line); vertical-align: top; }
.planning td { border-left: 1px solid var(--line); }
.planning thead th, .cov thead th {
  padding: 10px 8px 9px; background: var(--surface); text-align: center; font-weight: 600; color: var(--ink-3);
  border-bottom: 1px solid var(--line-strong);
}
.planning thead .planning-who, .planning thead .planning-total, .cov thead .planning-who {
  vertical-align: bottom; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em;
}
.pl-day { border-left: 1px solid var(--line); }
.pl-dow { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.pl-daynum {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px; margin-top: 3px; padding: 0 6px; border-radius: 999px;
  font-size: 16px; font-weight: 650; color: var(--ink); letter-spacing: -0.01em;
}
.pl-day.is-weekend .pl-dow { color: var(--ink-2); }
.pl-day.is-today .pl-dow { color: var(--accent-text); }
.pl-day.is-today .pl-daynum { background: var(--btn); color: #fff; }

.planning .planning-who, .cov .planning-who { width: 214px; padding: 10px 12px 10px 22px; text-align: left; font-weight: 400; }
/* The name column stays in view while the days scroll sideways on a narrow screen. */
.planning tbody .planning-who, .cov tbody .planning-who { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.planning .planning-total { width: 124px; padding: 10px 18px 10px 12px; text-align: right; font-variant-numeric: tabular-nums; }
.pl-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pl-avatar { width: 32px; height: 32px; font-size: 11.5px; background: color-mix(in srgb, var(--tone) 18%, var(--surface)); color: var(--ink); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--tone) 55%, transparent); }
.pl-person-text { display: grid; min-width: 0; line-height: 1.3; }
.planning-name { display: flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-person-text .cell-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--critical); }

.planning-group th, .planning-group td {
  padding: 7px 8px; font-size: 11.5px; color: var(--ink-3); text-align: center; white-space: nowrap;
  background: var(--surface-2); border-left: 0; border-bottom: 1px solid var(--line);
}
.planning-group .planning-who, .planning tbody .planning-group .planning-who {
  padding: 7px 12px 7px 22px; text-align: left; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink); background: var(--surface-2);
}
.pl-group-count { margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; letter-spacing: 0; color: var(--ink-2); }

.planning-cell { position: relative; height: 56px; padding: 8px 7px 7px; }
.planning-cell.is-weekend { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.planning-cell.is-today { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.planning-cell.has-alert { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--critical) 55%, transparent); }
.pl-flag {
  position: absolute; top: -1px; right: -1px; width: 16px; height: 16px; border-radius: 0 0 0 8px;
  background: var(--critical); cursor: help;
}
.pl-flag::after { content: "!"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 10.5px; font-weight: 700; line-height: 1; }

/* Day bar: the shifts placed between the first and last hour of the week (see services._day_window) */
.pl-dayline { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.planning-cell.has-alert .pl-dayline { padding-right: 13px; }
.pl-dayhours { flex: none; font-size: 11px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; line-height: 1; }
.pl-track { position: relative; flex: 1; height: 5px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.pl-track i { position: absolute; top: 0; bottom: 0; min-width: 3px; border-radius: 999px; background: var(--tone); }

.shift {
  display: block; margin-bottom: 3px; padding: 3px 7px 3px 6px; border-radius: 6px; border-left: 3px solid var(--tone);
  background: color-mix(in srgb, var(--tone) 13%, var(--surface)); line-height: 1.35; transition: background 0.15s;
}
.shift:last-of-type { margin-bottom: 0; }
.shift:hover { background: color-mix(in srgb, var(--tone) 24%, var(--surface)); }
.shift-time { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.shift-meta { display: block; font-size: 11px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Absence: one band across its days — the label on the first day, no gap between two days */
.pl-absence {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0 6px; min-height: 30px; margin-bottom: 4px; padding: 4px 8px; border-radius: 6px;
  background: color-mix(in srgb, var(--tone) 22%, var(--surface)); border: 1px solid color-mix(in srgb, var(--tone) 50%, transparent);
  font-size: 12px; line-height: 1.3;
}
.pl-absence:hover { background: color-mix(in srgb, var(--tone) 32%, var(--surface)); }
.pl-absence.is-continued { margin-left: -8px; border-left: 0; border-radius: 0 6px 6px 0; }
.pl-absence.continues { margin-right: -7px; border-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.pl-absence.is-continued.continues { border-radius: 0; }
.pl-absence.is-pending { border-style: dashed; background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--tone) 10%, var(--surface)) 0 6px, color-mix(in srgb, var(--tone) 22%, var(--surface)) 6px 12px); }
.pl-absence-label { font-weight: 650; white-space: nowrap; }
.pl-absence-status { font-size: 11px; color: var(--ink-2); white-space: nowrap; }

/* Adding: an empty day is one big target (reading "Repos" once the week is planned); a filled
   day gets a small "+" in its corner on hover. */
.shift-add { color: var(--ink-3); transition: background 0.15s, color 0.15s, opacity 0.15s; }
.shift-add.is-empty {
  position: absolute; inset: 5px; display: grid; place-items: center; border-radius: 7px; border: 1px dashed transparent;
}
.pl-rest-static { display: block; padding-top: 12px; text-align: center; }
.pl-rest { font-size: 11.5px; font-weight: 500; letter-spacing: 0.02em; color: var(--ink-3); }
.shift-add.is-empty .pl-plus { display: none; font-size: 17px; line-height: 1; }
.shift-add.is-empty:hover, .shift-add.is-empty:focus-visible { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.shift-add.is-empty:hover .pl-rest, .shift-add.is-empty:focus-visible .pl-rest { display: none; }
.shift-add.is-empty:hover .pl-plus, .shift-add.is-empty:focus-visible .pl-plus { display: block; }
.shift-add:not(.is-empty) {
  position: absolute; right: 4px; bottom: 4px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--line-strong); font-size: 14px; line-height: 1; opacity: 0;
}
.planning-cell:hover .shift-add:not(.is-empty), .shift-add:not(.is-empty):focus-visible { opacity: 1; }
.shift-add:not(.is-empty):hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
@media (hover: none) {
  .shift-add:not(.is-empty) { opacity: 1; }
  .shift-add.is-empty:not(:has(.pl-rest)) .pl-plus { display: block; }
}

/* Hours of the week against the contract */
.pl-hours { white-space: nowrap; }
.planning-total strong { font-size: 14px; }
.pl-contract { font-size: 12px; color: var(--ink-3); }
.pl-gauge { display: block; height: 5px; margin: 6px 0 4px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.pl-gauge i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.pl-gauge.is-over i { background: var(--serious); }
.pl-gauge.is-exact i { background: var(--good); }
.pl-delta { display: block; font-size: 11.5px; color: var(--ink-3); }
.pl-delta.is-over { color: var(--ink); font-weight: 600; }
.pl-delta.is-exact { color: var(--good-text); }

.planning tfoot th, .planning tfoot td { padding: 10px 8px; text-align: center; background: var(--surface-2); border-bottom: 0; border-top: 1px solid var(--line-strong); font-variant-numeric: tabular-nums; }
.planning tfoot td.is-today strong { color: var(--accent-text); }
.planning tfoot .planning-who { padding-left: 22px; text-align: left; font-weight: 600; }
.planning tfoot .planning-total { text-align: right; padding-right: 18px; }

.pl-allgood { display: flex; align-items: center; gap: 10px; color: var(--ink-2); }
.pl-allgood-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good-text); }
.planning-side .list li .badge { flex: none; }

@media (max-width: 1100px) { .planning-side { grid-template-columns: minmax(0, 1fr); } }

/* Coverage view (workforce/_coverage.html): who is on site from 0 h to 24 h, per department and
   position. Headcount reads as the depth of one hue (1 → 4+); a hatched stretch is a hole —
   nobody between the first arrival and the last departure. */
.cov-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; padding: 18px 22px 14px; border-bottom: 1px solid var(--line); }
.cov-head .muted { font-size: 13px; margin-top: 2px; max-width: 620px; }
.cov-legend { padding: 0; border: 0; }
.cov-key { width: 18px; height: 12px; border-radius: 3px; }
.l1 { background: color-mix(in srgb, var(--tone, var(--accent)) 30%, var(--surface)); }
.l2 { background: color-mix(in srgb, var(--tone, var(--accent)) 52%, var(--surface)); }
.l3 { background: color-mix(in srgb, var(--tone, var(--accent)) 76%, var(--surface)); }
.l4 { background: var(--tone, var(--accent)); }
.is-hole { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--critical) 10%, var(--surface)) 0 3px, color-mix(in srgb, var(--critical) 60%, var(--surface)) 3px 5px); }

.cov { width: 100%; min-width: 1040px; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.cov th, .cov td { border-bottom: 1px solid var(--line); }
.cov td { padding: 9px 8px 7px; border-left: 1px solid var(--line); vertical-align: top; }
.cov thead .pl-day a { display: block; border-radius: 10px; padding-bottom: 2px; }
.cov thead .pl-day a:hover .pl-daynum { background: var(--accent-soft); color: var(--accent-text); }
.cov thead .pl-day.is-today a:hover .pl-daynum { background: var(--btn-hover); color: #fff; }
.cov thead .pl-day.is-selected, .cov td.is-selected { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.cov thead .pl-day.is-selected { box-shadow: inset 0 -2px 0 var(--accent); }
.cov-scale { display: flex; justify-content: space-between; margin-top: 6px; font-size: 10px; font-weight: 500; color: var(--ink-3); }
.cov-scale i { font-style: normal; }
.cov .cov-dept th, .cov .cov-dept td { background: var(--surface-2); }
.cov tbody .cov-dept .planning-who { background: var(--surface-2); font-weight: 650; text-transform: uppercase; font-size: 11.5px; letter-spacing: 0.06em; }
.cov .cov-position .planning-who { padding-left: 34px; color: var(--ink-2); }
.cov-strip { position: relative; display: block; height: 14px; border-radius: 4px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.cov-dept .cov-strip { height: 18px; --tone: var(--accent); }
.cov-strip i { position: absolute; top: 0; bottom: 0; }
/* Noon, to place a strip's morning and evening at a glance */
.cov-strip::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: var(--line-strong); opacity: 0.7; }
.cov-range { display: block; margin-top: 4px; font-size: 11px; color: var(--ink-2); text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cov-none { color: var(--ink-3); }

.gantt { --who: 214px; min-width: 1040px; }
.gantt-row { display: grid; grid-template-columns: var(--who) minmax(0, 1fr); align-items: stretch; border-bottom: 1px solid var(--line); }
.gantt-body { position: relative; }
.gantt-body .gantt-row:last-child { border-bottom: 0; }
.gantt-who { display: grid; align-content: center; min-width: 0; padding: 6px 12px 6px 22px; line-height: 1.3; border-right: 1px solid var(--line); }
.gantt-who small { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-lane {
  position: relative; min-height: 38px;
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px); background-size: calc(100% / 24) 100%; background-position: -1px 0;
}
.gantt-axis { border-bottom: 1px solid var(--line-strong); }
.gantt-axis .gantt-lane { min-height: 28px; background: none; margin: 0 14px 0 0; }
.gantt-axis .gantt-lane span { position: absolute; top: 7px; transform: translateX(-50%); font-size: 11px; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.gantt-axis .gantt-lane span:first-child { transform: none; }
.gantt-body .gantt-lane { margin-right: 14px; }
.gantt-dept { background: var(--surface-2); }
.gantt-dept .gantt-who strong { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.gantt-dept .gantt-lane { min-height: 34px; }
.gantt-cov {
  position: absolute; top: 7px; bottom: 7px; display: grid; place-items: center; overflow: hidden;
  font-size: 11.5px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums;
}
.gantt-cov.l3, .gantt-cov.l4 { color: #fff; }
.gantt-cov:first-child { border-radius: 5px 0 0 5px; }
.gantt-cov:last-child { border-radius: 0 5px 5px 0; }
.gantt-cov:only-child { border-radius: 5px; }
.gantt-bar {
  position: absolute; top: 6px; bottom: 6px; display: flex; align-items: center; padding: 0 7px; overflow: hidden; white-space: nowrap;
  border-radius: 6px; border-left: 3px solid var(--tone); background: color-mix(in srgb, var(--tone) 22%, var(--surface));
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; transition: background 0.15s;
}
.gantt-bar:hover { background: color-mix(in srgb, var(--tone) 36%, var(--surface)); }
.gantt-now { position: absolute; top: 0; bottom: 0; z-index: 2; left: calc(var(--who) + (100% - var(--who) - 14px) * var(--now) / 100); width: 2px; background: var(--critical); pointer-events: none; }
.gantt-now::before { content: ""; position: absolute; top: -4px; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--critical); }
/* Services: required staff, day by day, and their bands on the day timeline */
.pl-hint { font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.svc td { text-align: center; vertical-align: middle; }
.svc thead .svc-day { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; border-left: 1px solid var(--line); }
.svc thead .svc-day.is-today { color: var(--accent-text); }
.svc thead .svc-day.is-selected { background: color-mix(in srgb, var(--accent) 6%, transparent); box-shadow: inset 0 -2px 0 var(--accent); }
.svc-off { color: var(--ink-3); }
.svc-ok { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--good-text); }
.svc-ok .icon { width: 15px; height: 15px; }
.svc-short {
  display: grid; gap: 1px; padding: 5px 8px; border-radius: 8px; font-size: 12px; font-weight: 600; line-height: 1.35; color: var(--bad-text);
  background: color-mix(in srgb, var(--critical) 9%, transparent); border: 1px solid color-mix(in srgb, var(--critical) 30%, transparent);
}
.svc-short:hover { background: color-mix(in srgb, var(--critical) 16%, transparent); }
.svc-hint { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; padding: 12px 16px; border-radius: 12px; border: 1px dashed var(--line-strong); color: var(--ink-2); }
.svc-hint > span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-text); }
.gantt-services { border-bottom: 1px solid var(--line); }
.gantt-services .gantt-lane { min-height: 30px; margin-right: 14px; background: none; }
.gantt-services .gantt-lane span {
  position: absolute; top: 5px; bottom: 5px; display: grid; place-items: center; padding: 0 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); font-size: 11.5px; font-weight: 600;
}
.gantt-band {
  position: absolute; top: 0; bottom: 0; z-index: 0; pointer-events: none;
  left: calc(var(--who) + (100% - var(--who) - 14px) * var(--l) / 100); width: calc((100% - var(--who) - 14px) * var(--w) / 100);
  background: color-mix(in srgb, var(--accent) 8%, transparent); box-shadow: inset 1px 0 0 color-mix(in srgb, var(--accent) 35%, transparent), inset -1px 0 0 color-mix(in srgb, var(--accent) 35%, transparent);
}
.gantt-body .gantt-row { position: relative; z-index: 1; }
.gantt-dept { background: color-mix(in srgb, var(--surface-2) 82%, transparent); }

/* Employee record: the private planning link */
.copy-field { display: flex; gap: 8px; }
.copy-field input { flex: 1; min-width: 0; height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; }
.access-actions { margin-top: 10px; }

/* "Mon planning": the page an employee opens with their private link (public_planning.html) */
.mp { padding: 0 16px 40px; }
.mp-wrap { max-width: 860px; margin: 0 auto; }
.mp-head { display: flex; align-items: center; gap: 16px; padding: 28px 0 22px; }
.mp-avatar { width: 56px; height: 56px; font-size: 18px; }
.mp-kicker { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-text); }
.mp-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.mp-bar .view-switch a { padding: 0 18px; }
.mp-nav { display: flex; gap: 8px; }
.mp-nav .btn { width: 42px; padding: 0; }
.mp-period { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 12px; }
.mp-period h2 { font-size: 17px; }
.mp-days { list-style: none; margin: 0; padding: 0; }
.mp-day { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 18px 12px 14px; border-bottom: 1px solid var(--line); }
.mp-day:last-child { border-bottom: 0; }
.mp-day.is-today { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.mp-date { display: grid; justify-items: center; line-height: 1.15; color: var(--ink-2); }
.mp-date span, .mp-date small { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.mp-date strong { font-size: 22px; font-weight: 650; color: var(--ink); letter-spacing: -0.02em; }
.mp-day.is-today .mp-date strong { color: var(--accent-text); }
.mp-day.is-off .mp-date strong { color: var(--ink-3); }
.mp-content { display: grid; gap: 6px; min-width: 0; }
.mp-shift { display: grid; padding: 7px 10px; border-radius: 8px; border-left: 4px solid var(--tone); background: color-mix(in srgb, var(--tone) 13%, var(--surface)); line-height: 1.35; }
.mp-shift strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.mp-shift span { font-size: 12.5px; color: var(--ink-2); }
.mp-absence { display: block; padding: 6px 10px; border-radius: 8px; font-weight: 600; background: color-mix(in srgb, var(--tone) 22%, var(--surface)); border: 1px solid color-mix(in srgb, var(--tone) 50%, transparent); }
.mp-absence small { font-weight: 500; color: var(--ink-2); }
.mp-rest { color: var(--ink-3); }
.mp-total { font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.mp-weekdays, .mp-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.mp-weekdays span { padding: 9px 6px; text-align: center; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.mp-cell { min-height: 84px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.mp-cell:last-child { border-right: 0; }
.mp-week:last-child .mp-cell { border-bottom: 0; }
.mp-cell.is-out { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.mp-cell.is-out > * { opacity: 0.45; }
.mp-cell-date { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.mp-cell-dow { display: none; }
.mp-cell.is-today .mp-cell-date { background: var(--btn); color: #fff; }
.mp-cell-body { display: grid; gap: 3px; margin-top: 4px; }
.mp-chip { display: block; padding: 2px 5px; border-radius: 5px; border-left: 3px solid var(--tone); background: color-mix(in srgb, var(--tone) 14%, var(--surface)); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; }
.mp-cell .mp-absence { padding: 2px 5px; border-radius: 5px; font-size: 11.5px; }
.mp-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.mp-foot { margin-top: 14px; font-size: 12.5px; color: var(--ink-3); }
/* On a phone the month reads as a list of its days: seven columns would be unreadable. */
@media (max-width: 640px) {
  .mp-head { padding-top: 20px; }
  .mp-weekdays { display: none; }
  .mp-week { display: block; }
  .mp-cell { display: grid; grid-template-columns: 74px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 0; padding: 9px 14px; border-right: 0; }
  .mp-week:last-child .mp-cell { border-bottom: 1px solid var(--line); }
  .mp-cell.is-out { display: none; }
  .mp-cell-date { display: inline-flex; align-items: center; justify-self: start; gap: 4px; height: 26px; padding: 0 9px; font-size: 13px; white-space: nowrap; }
  .mp-cell-dow { display: inline; }
  .mp-cell-body { margin-top: 0; }
  .mp-cell.is-off .mp-cell-body::after { content: "Repos"; color: var(--ink-3); font-size: 12.5px; }
  .mp-chip, .mp-cell .mp-absence { padding: 5px 9px; font-size: 13.5px; }
  .mp-actions .btn { flex: 1 1 100%; }
}

.cov-foot { padding: 12px 22px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }

/* Dialog (planning: add / edit a shift) */
dialog.modal {
  width: min(560px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-md);
}
dialog.modal::backdrop { background: rgba(0, 0, 0, 0.4); }
.modal-form { padding: 22px; margin: 0; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-head .muted { font-size: 13px; margin-top: 2px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 16px; border-radius: 10px; background: var(--surface-2); }
.segmented button { height: 34px; border: 0; border-radius: 7px; background: transparent; font-weight: 600; color: var(--ink-2); }
.segmented button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.modal form { margin: 0; }
.modal .chip { cursor: pointer; }
.modal .chip small { color: var(--ink-3); font-weight: 500; }
.modal .help { margin-top: 14px; min-height: 19px; }
.modal-actions { margin-top: 14px; }
.modal-actions .btn-danger-ghost { margin-right: auto; }

/* Contract document: a sheet of paper, always black on white whatever the theme */
.textarea-doc { min-height: 480px; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.variables dt code, .details dt code { font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--ink); white-space: nowrap; }
.variables > div { flex-direction: column; gap: 2px; padding: 9px 0; }
.variables dd { text-align: left; font-weight: 400; font-size: 12.5px; color: var(--ink-2); }
.paper {
  max-width: 800px; margin-inline: auto; padding: 56px 64px; border: 1px solid #e1e0d9; border-radius: 4px;
  background: #fff; color: #111; font: 14px/1.65 Georgia, "Times New Roman", serif; overflow-wrap: anywhere;
}
.paper h1 { margin-bottom: 28px; text-align: center; font-size: 19px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; }
.paper h2 { margin: 24px 0 8px; font-size: 14.5px; font-weight: 700; letter-spacing: 0; }
.paper p { margin: 0 0 10px; text-align: justify; }
.paper ul { margin: 0 0 10px; padding-left: 22px; }
.paper mark { padding: 0 3px; border-radius: 3px; background: #ffe58a; color: inherit; }
.paper .muted { color: #666; }
.paper-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 40px; break-inside: avoid; }
.paper-signatures > div { display: grid; gap: 2px; align-content: start; min-height: 130px; }
.paper-signatures em { font-size: 12px; color: #666; }
.paper-page { background: var(--bg); padding: 0 16px 48px; }
.paper-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 800px; margin: 0 auto; padding: 16px 0; }
.paper-toolbar .muted { font-size: 13px; flex: 1 1 240px; }
.print-only { display: none; }

@media (max-width: 720px) {
  .planning .planning-who, .planning tbody .planning-group .planning-who, .cov .planning-who { width: 150px; padding-left: 14px; }
  .cov .cov-position .planning-who { padding-left: 14px; }
  .gantt { --who: 150px; }
  .gantt-who { padding-left: 14px; }
  .pl-avatar { display: none; }
  .pl-legend, .cov-head { padding-inline: 16px; }
  .pl-legend-note { margin-left: 0; }
  .paper { padding: 28px 22px; }
  .paper-signatures { grid-template-columns: 1fr; gap: 20px; }
}

/* Printing: the planning (posted in the kitchen) and the contract. Page chrome is dropped and the
   theme forced back to light — a dark-mode screen must not print white text on white paper. */
@page planning { size: A4 landscape; margin: 10mm; }
/* ---- Allergen table (technical_sheet:allergens) and analysis pages ---- */
.toolbar-plain { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.allergen-table th.allergen-col { padding: 10px 4px; text-align: center; vertical-align: bottom; font-size: 12px; white-space: nowrap; }
.allergen-table th.allergen-col span { writing-mode: vertical-rl; transform: rotate(180deg); }
.allergen-table tbody th[scope="row"] { font-weight: 400; text-align: left; }
.allergen-group th { background: var(--surface-2); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-2); text-align: left; }
.allergen-cell { text-align: center; color: var(--ink-3); }
.allergen-cell.is-present { color: var(--bad-text); font-weight: 700; }
.allergen-print-title { margin: 0 0 8px; font-size: 16px; }
details.card summary { cursor: pointer; }
.cell-good { color: var(--good-text); }
.alert p { margin: 0 0 6px; }
.alert p:last-child { margin-bottom: 0; }
.alert ul { margin: 0 0 6px; padding-left: 20px; }
.table tr.is-selected td { background: var(--accent-soft); }
.match-box { padding: 18px 22px; border-top: 1px solid var(--line); }
.match-box h3 { margin: 0 0 4px; font-size: 15px; }
.match-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.match-row:first-of-type { border-top: 0; }
.match-label { flex: 1 1 200px; }
.match-row .select-filter { max-width: 280px; }
.lines-table input[name^="quantity_"], .lines-table input[name^="price_"], .lines-table input[name^="qty_"] { max-width: 130px; margin-left: auto; }
.suggestion-provider { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

@media print {
  html:root:root {
    color-scheme: light; --bg: #fff; --surface: #fff; --surface-2: #f3f2ee; --ink: #0b0b0b; --ink-2: #52514e;
    --ink-3: #898781; --line: #d5d4cc; --line-strong: #c3c2b7; --border: rgba(11, 11, 11, 0.10); --shadow-sm: none;
  }
  body { background: #fff; }
  .sidebar, .topbar, .tabs, .page-header, .messages, .scrim, .planning-bar, .planning-kpis, .no-print, dialog { display: none !important; }
  .app { display: block; }
  .content { max-width: none; padding: 0; }
  .card { border: 0; box-shadow: none; }
  .print-only { display: block; }
  .planning-card { page: planning; overflow: visible; border-radius: 0; margin: 0 0 12px; }
  .planning-print-title { margin-bottom: 8px; font-size: 16px; }
  .pl-legend { padding: 0 0 8px; border: 0; font-size: 10.5px; }
  .planning, .cov { min-width: 0; font-size: 10.5px; }
  .gantt { min-width: 0; --who: 150px; }
  .planning tr, .cov tr, .gantt-row { break-inside: avoid; }
  .planning-group { break-after: avoid; }
  .planning th, .planning td { border: 1px solid var(--line); }
  .planning .planning-who, .cov .planning-who { width: 150px; padding-left: 8px; }
  .planning .planning-total { width: 104px; padding: 6px 8px; }
  .planning tbody .planning-who, .cov tbody .planning-who { position: static; }
  .planning-total strong { font-size: 11.5px; }
  .planning-cell { height: auto; padding: 5px; }
  .pl-gauge { margin: 3px 0 2px; }
  .pl-avatar, .pl-flag, .pl-dot, .gantt-now, .cov-head .chips { display: none; }
  .planning-cell.has-alert { box-shadow: none; }
  .planning-cell .pl-rest.print-only { display: block; padding: 6px 0; text-align: center; }
  .shift-time { font-size: 10.5px; }
  .planning-card, .planning-card * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .mp { padding: 0; }
  .mp-head { padding-top: 0; }
  .mp .card { border: 1px solid var(--line); }
  .mp-day, .mp-cell, .mp-shift, .mp-chip, .mp-absence { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .paper-page { padding: 0; }
  .paper { max-width: none; padding: 0; border: 0; font-size: 12pt; }
  .card-paper > :not(.paper) { display: none; }
}

/* ---------- Profils de droits (account/role_form.html) ---------- */
.cell-wrap { white-space: normal !important; line-height: 2; }
.rights-head { padding: 22px 22px 0; }
.rights-head .muted { max-width: 760px; }
.rights-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px 24px;
  margin: 0; padding: 14px 22px; border: 0; border-top: 1px solid var(--line);
}
.rights-row legend { float: left; padding: 0; line-height: 1.35; }
.rights-levels { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); }
.rights-level { position: relative; cursor: pointer; }
.rights-level input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rights-level span { display: block; padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; transition: background 0.15s, color 0.15s; }
.rights-level:hover span { color: var(--ink); }
.rights-level input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.rights-level.level-1 input:checked + span { color: var(--accent-text); }
.rights-level.level-2 input:checked + span { background: var(--btn); color: #fff; box-shadow: none; }
.rights-level input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 720px) {
  .rights-row { grid-template-columns: minmax(0, 1fr); padding-inline: 16px; }
  .rights-row legend { float: none; }
  .rights-levels { justify-self: start; }
}

/* ---------- Heures réalisées (workforce/actual_hours.html) ----------
   One day at a time: a week strip picks the day, rows are compact and recompute live (workforce.js),
   a sticky bar carries the save button. Without JS every day stays stacked. */
.ah-weeknav { display: inline-flex; align-items: center; gap: 2px; height: 40px; padding: 3px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
.ah-weeknav .icon-btn { width: 32px; height: 32px; }
.ah-weeknav-label { display: inline-flex; align-items: center; gap: 8px; padding: 0 10px; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.ah-weeknav-label .icon { width: 15px; height: 15px; color: var(--ink-3); }

.ah-summary { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); padding: 0; margin-bottom: 18px; }
.ah-stat { display: grid; gap: 4px; align-content: start; padding: 18px 22px; border-left: 1px solid var(--line); }
.ah-stat:first-child { border-left: 0; }
.ah-stat-label { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
.ah-stat-value { font-size: 26px; line-height: 1.15; font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ah-stat-value small { font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--ink-3); }
.ah-stat-value.is-over { color: var(--bad-text); }
.ah-stat-value.is-under { color: var(--accent-text); }
.ah-stat-foot { font-size: 12.5px; color: var(--ink-2); }
.ah-progress { height: 6px; margin: 4px 0 2px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.ah-progress span { display: block; height: 100%; border-radius: inherit; background: var(--good); transition: width 0.3s; }

.ah-card { margin-bottom: 0; }
.ah-days { display: grid; grid-template-columns: repeat(8, minmax(76px, 1fr)); gap: 6px; padding: 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); overflow-x: auto; }
.ah-day {
  position: relative; display: grid; justify-items: center; gap: 1px; padding: 8px 6px 9px; border-radius: 10px;
  border: 1px solid transparent; color: var(--ink-2); text-decoration: none; transition: background 0.15s, border-color 0.15s, color 0.15s;
}
a.ah-day:hover { background: var(--surface); color: var(--ink); text-decoration: none; }
.ah-day.is-active { background: var(--surface); border-color: var(--border); color: var(--ink); box-shadow: var(--shadow-sm), inset 0 -2px 0 var(--accent); }
.ah-day.is-future, .ah-day.is-empty { opacity: 0.45; }
.ah-day-name { font-size: 11.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.ah-day-num { display: grid; place-items: center; min-height: 28px; font-size: 20px; font-weight: 650; letter-spacing: -0.02em; color: var(--ink); }
.ah-day-num .icon { width: 18px; height: 18px; color: var(--ink-2); }
.ah-day-meta { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; white-space: nowrap; }
.ah-day.has-changes::after { content: ""; position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.ah-day-all { border-left: 1px dashed var(--line-strong); border-radius: 0 10px 10px 0; }

.ah-dot { display: inline-block; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.ah-dot.is-done, .is-done .ah-dot { background: var(--good); }
.ah-dot.is-todo, .is-todo .ah-dot { background: var(--warning); }
.is-error .ah-dot { background: var(--critical); }
.ah-dot.is-changed { background: var(--accent); }
.is-error .ah-day-meta { color: var(--bad-text); font-weight: 600; }

.ah-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; padding: 12px 22px; border-bottom: 1px solid var(--line); }
.ah-toolbar .chip { cursor: pointer; }
.ah-legend { display: inline-flex; flex-wrap: wrap; gap: 14px; margin-left: auto; font-size: 12.5px; color: var(--ink-3); }
.ah-legend > span { display: inline-flex; align-items: center; gap: 6px; }

.ah-panel + .ah-panel { border-top: 1px solid var(--line); }
.ah-panel-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; padding: 16px 22px 6px; }
.ah-panel-head h2 { margin: 0; font-size: 16px; }
.ah-panel-meta { font-size: 13px; color: var(--ink-2); }
.ah-panel-meta strong { color: var(--ink); }
.ah-empty { margin: 0; padding: 18px 22px 24px; }
.is-enhanced:not(.is-week) .ah-panel-head { padding-top: 14px; }

.ah-table { font-size: 14px; }
.ah-table th { font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; }
.ah-table td { padding-block: 9px; vertical-align: middle; }
.ah-row { transition: background 0.15s; }
.ah-row td:first-child { box-shadow: inset 3px 0 0 var(--ah-mark, transparent); }
.ah-row.is-confirmed { --ah-mark: var(--good); }
.ah-row:not(.is-confirmed) { --ah-mark: var(--warning); }
.ah-row.is-changed { --ah-mark: var(--accent); }
.ah-row.is-changed td { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.ah-row.has-error { --ah-mark: var(--critical); }
.ah-row.has-error td { background: color-mix(in srgb, var(--critical) 5%, transparent); }

.ah-who { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.ah-who .avatar { display: grid; width: 32px; height: 32px; font-size: 11.5px; }
.ah-who-text { display: grid; min-width: 0; line-height: 1.3; }
.ah-who-text strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ah-who-text small, .ah-planned small { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.ah-planned { white-space: nowrap; }
.ah-time { display: block; font-weight: 600; font-variant-numeric: tabular-nums; }

.ah-table .ah-field input:not([type="checkbox"]) {
  width: 100%; min-height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-variant-numeric: tabular-nums; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.ah-table .ah-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ah-table .ah-field input[type="time"] { width: 112px; }
.ah-row.has-error .ah-field input:not([type="checkbox"]) { border-color: var(--critical); }
.ah-suffix { position: relative; display: inline-flex; align-items: center; }
.ah-suffix input { width: 86px !important; padding-right: 36px !important; }
.ah-suffix > span { position: absolute; right: 10px; font-size: 12px; color: var(--ink-3); pointer-events: none; }
.ah-row.is-absent .ah-field:not(:has(.ah-switch)) input { opacity: 0.35; }
.ah-row.is-absent .ah-planned, .ah-row.is-absent .ah-who-text { opacity: 0.6; }
.ah-table .field-error { margin: 4px 0 0; white-space: normal; max-width: 180px; }

.ah-switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.ah-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ah-switch-track { position: relative; width: 36px; height: 20px; border-radius: 999px; background: var(--line-strong); transition: background 0.15s; }
.ah-switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.15s; }
.ah-switch input:checked + .ah-switch-track { background: var(--critical); }
.ah-switch input:checked + .ah-switch-track::after { transform: translateX(16px); }
.ah-switch input:focus-visible + .ah-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.ah-result { white-space: nowrap; }
.ah-actual { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.ah-actual.is-pending { color: var(--ink-2); }
.ah-diff { display: inline-block; min-width: 0; margin-left: 6px; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ah-diff:empty { display: none; }
.ah-diff.is-over { color: var(--bad-text); }
.ah-diff.is-under { color: var(--accent-text); }
.ah-status { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.ah-row.is-confirmed .ah-status { color: var(--good-text); }
.ah-row:not(.is-confirmed) .ah-status { color: color-mix(in srgb, var(--warning) 70%, var(--ink)); }
.ah-row.is-changed .ah-status { color: var(--accent-text); }
.ah-row.has-error .ah-status { color: var(--bad-text); }

.ah-savebar {
  position: sticky; bottom: 16px; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 16px; padding: 12px 12px 12px 20px; border-radius: var(--radius); border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px); box-shadow: var(--shadow-md);
}
.ah-savebar-text { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 14px; color: var(--ink-2); }
.ah-savebar-text .icon { width: 18px; height: 18px; color: var(--ink-3); }
.ah-savebar-text strong { color: var(--ink); }

@media (max-width: 1100px) {
  .ah-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ah-stat:nth-child(3) { border-left: 0; }
  .ah-stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .ah-days { grid-template-columns: repeat(8, 72px); padding: 10px; }
  .ah-legend { display: none; }
  .ah-table thead { display: none; }
  .ah-table, .ah-table tbody { display: block; }
  .ah-table tr.ah-row {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 10px; padding: 14px 16px;
    border-top: 1px solid var(--line); box-shadow: inset 3px 0 0 var(--ah-mark, transparent);
  }
  .ah-table tr.ah-row[hidden] { display: none; }
  .ah-table tr.ah-row td { display: block; padding: 0; border: 0; background: none !important; box-shadow: none !important; }
  .ah-table .ah-who-cell { grid-column: 1 / 4; }
  .ah-who { min-width: 0; }
  .ah-table .ah-result { grid-column: 4; grid-row: 1; text-align: right; }
  .ah-table .ah-diff { display: block; margin: 0; }
  .ah-table .ah-diff:empty { display: none; }
  .ah-table .ah-planned { grid-column: 1 / -1; padding-left: 42px; }
  .ah-table .ah-planned .ah-time { display: inline; margin-right: 8px; }
  .ah-table .ah-field::before { content: attr(data-label); display: block; margin-bottom: 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
  .ah-table .ah-field input[type="time"], .ah-suffix, .ah-suffix input { width: 100% !important; }
  .ah-table.is-readonly tr.ah-row td:nth-child(3) { grid-column: 1 / -1; padding-left: 42px; }
  .ah-savebar { bottom: 10px; flex-direction: column; align-items: stretch; gap: 10px; padding: 12px; }
  .ah-savebar .btn { width: 100%; justify-content: center; }
}
@media (max-width: 520px) {
  .ah-summary { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ah-stat { padding: 14px 16px; }
  .ah-stat-value { font-size: 22px; }
  .ah-table tr.ah-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .ah-table .ah-who-cell { grid-area: 1 / 1 / 2 / 3; }
  .ah-table .ah-result { grid-area: 1 / 3; }
  .ah-table .ah-planned { grid-area: 2 / 1 / 3 / 3; padding-left: 0; align-self: center; }
  .ah-table tr.ah-row .ah-absent { grid-area: 2 / 3; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
  .ah-table .ah-absent::before { margin: 0; }
  .ah-table .ah-field input[type="time"] { padding: 0 6px; }
  .ah-suffix input { padding-left: 8px !important; padding-right: 30px !important; }
  .ah-suffix > span { right: 8px; }
}
@media print {
  .ah-savebar, .ah-days, .ah-toolbar { display: none !important; }
  .ah-panel[hidden] { display: block !important; }
}

/* ---------- Export des inventaires (stocktaking/export.html, count_sheet.html) ---------- */
.card-head-pad { padding: 20px 22px 0; }
.export-kinds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.export-kind {
  position: relative; display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.export-kind:hover { border-color: var(--accent); }
.export-kind input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.export-kind:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.export-kind:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent); }
.export-kind-icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); }
.export-kind:has(input:checked) .export-kind-icon { background: var(--btn); color: #fff; }
.export-kind-text { display: grid; gap: 4px; }
.export-kind-text small { font-size: 13px; line-height: 1.45; color: var(--ink-2); }
@media (max-width: 720px) { .export-kinds { grid-template-columns: minmax(0, 1fr); } }

/* The blank count sheet: always black on white, one zone per printed page. */
.count-toolbar { max-width: 1000px; }
.count-sheet {
  max-width: 1000px; margin: 0 auto 24px; padding: 36px 40px; border: 1px solid #e1e0d9; border-radius: 4px;
  background: #fff; color: #111; font: 12.5px/1.4 var(--font);
}
.count-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 2px solid #111; }
.count-kicker { margin: 0 0 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #666; }
.count-head h1 { margin: 0; font-size: 24px; letter-spacing: -0.02em; }
.count-sub { margin: 4px 0 0; color: #555; }
.count-meta { display: grid; gap: 8px; min-width: 330px; margin: 0; }
.count-meta > div { display: grid; grid-template-columns: 82px 1fr; align-items: end; gap: 8px; }
.count-meta dt { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #555; }
.count-meta dd { margin: 0; min-height: 22px; border-bottom: 1px solid #999; }
.count-meta .count-boxes { display: flex; gap: 16px; border: 0; }
.count-boxes span { display: inline-flex; align-items: center; gap: 6px; }
.count-boxes i { display: inline-block; width: 12px; height: 12px; border: 1.5px solid #333; border-radius: 2px; }
.count-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.count-table .c-unit { width: 52px; } .count-table .c-pack { width: 60px; } .count-table .c-entry { width: 84px; } .count-table .c-note { width: 22%; }
.count-table thead th { padding: 7px 8px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; text-align: left; color: #fff; background: #222; }
.count-table thead th:nth-child(n+4):nth-child(-n+6) { text-align: center; }
.count-table td { height: 30px; padding: 3px 8px; border: 1px solid #c9c8c0; vertical-align: middle; }
.count-table td strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.count-table td small { display: block; font-size: 10px; color: #777; }
.count-table .count-cell { background: #fff; }
.count-table .count-cell.is-off { background: repeating-linear-gradient(135deg, #f1f0eb 0 4px, #e4e3dc 4px 5px); }
.count-group th { padding: 10px 8px 5px; text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #111; border-bottom: 1.5px solid #111; }
.count-group th span { margin-left: 6px; font-weight: 500; color: #777; }
.count-table tbody tr:not(.count-group):nth-child(odd) td:not(.count-cell) { background: #faf9f6; }
.count-blank td { height: 32px; }
.count-empty { color: #777; text-align: center; }
.count-table tbody { break-inside: auto; }
.count-table tr { break-inside: avoid; }
.count-group { break-after: avoid; }
.count-foot { margin-top: 18px; color: #555; font-size: 11px; break-inside: avoid; }
.count-foot p { margin: 0 0 18px; }
.count-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.count-sign div { min-height: 54px; border-bottom: 1px solid #999; }
.count-sign span { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #555; }
@media (max-width: 720px) {
  .count-sheet { padding: 20px 16px; overflow-x: auto; }
  .count-head { flex-direction: column; }
  .count-meta { min-width: 0; width: 100%; }
  .count-table { min-width: 680px; }
}
@page count { size: A4 portrait; margin: 10mm; }
@media print {
  .count-sheet { page: count; max-width: none; margin: 0; padding: 0; border: 0; border-radius: 0; break-after: page; }
  .count-sheet:last-of-type { break-after: auto; }
  .count-table thead { display: table-header-group; }
  .count-table thead th, .count-cell.is-off, .count-table td { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* ---------- Variations de prix (product/price_changes.html) ---------- */
.kpi-value.pc-up { color: var(--bad-text); }
.kpi-value.pc-down { color: var(--good-text); }
.kpi-icon.pc-icon-up { background: color-mix(in srgb, var(--critical) 12%, transparent); color: var(--bad-text); }
.kpi-icon.pc-icon-down { background: color-mix(in srgb, var(--good) 12%, transparent); color: var(--good-text); }
.pc-tabs { padding-block: 10px; background: var(--surface-2); }
.pc-count { display: inline-grid; place-items: center; min-width: 20px; height: 18px; margin-left: 4px; padding: 0 5px; border-radius: 999px; background: var(--surface-2); font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.chip.is-active .pc-count { background: var(--surface); color: var(--accent-text); }
.pc-table td { vertical-align: middle; }
.pc-spark { display: block; overflow: visible; }
.pc-spark polyline { fill: none; stroke: var(--ink-3); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.pc-spark.is-up polyline { stroke: var(--critical); }
.pc-spark.is-down polyline { stroke: var(--good); }
.pc-pill {
  display: inline-flex; align-items: center; gap: 3px; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; background: var(--surface-2); color: var(--ink-2);
}
.pc-pill .icon { width: 13px; height: 13px; }
.pc-pill.is-up { background: color-mix(in srgb, var(--critical) 11%, transparent); color: var(--bad-text); }
.pc-pill.is-down { background: color-mix(in srgb, var(--good) 11%, transparent); color: var(--good-text); }
.pc-prices { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pc-prices small { margin-left: 1px; font-size: 11.5px; color: var(--ink-3); }

/* Stocktaking count: provider / category filters over the lines (stocktaking/count.html) */
.lines-filters { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 12px; }
.lines-filter { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.lines-filter .select-filter { min-width: 200px; }

/* Stocktaking count / detail: a zone's locations (« Étagère 1 »…), one block each */
.count-location + .count-location { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.count-location-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.count-location-title::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--accent-text); }
.zone-locations { display: flex; flex-wrap: wrap; gap: 4px 10px; }

/* ---------- Paramètres → Caisse Lightspeed (lightspeed/settings.html) ---------- */
.ls-status { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 18px; }
.ls-status-main { display: flex; align-items: center; gap: 14px; }
.ls-status-main h2 { margin: 0 0 2px; font-size: 16px; }
.ls-status-main .muted { margin: 0; font-size: 13.5px; }
.ls-logo { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); color: var(--ink-3); }
.ls-logo.is-on { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good-text); }
.ls-status-actions { display: flex; align-items: center; gap: 10px; }
.ls-status-actions form { margin: 0; }
.ls-alert { flex-basis: 100%; margin: 0; }
.ls-locations { margin-bottom: 18px; }
.ls-locations .card-head { align-items: center; }
.ls-select { min-width: 260px; }
.ls-foot { display: flex; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--line); }
.ls-text { margin: 0 0 16px; max-width: 820px; color: var(--ink-2); line-height: 1.55; }
.ls-sync-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.ls-sync-actions form { margin: 0; }
.ls-steps { display: grid; gap: 14px; margin: 0; padding-left: 20px; line-height: 1.55; }
.ls-code {
  display: block; margin-top: 8px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2);
  font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere;
}

/* ---------- Factures et bons de livraison (invoice/*.html) ---------- */
.count-pill { display: inline-grid; place-items: center; min-width: 20px; height: 18px; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--btn); color: #fff; font-size: 11.5px; font-weight: 700; }
.date-filter { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); }
.date-filter .select-filter { width: 142px; }
.doc-kinds { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }
.doc-kind {
  position: relative; display: inline-flex; align-items: center; gap: 10px; padding: 10px 18px 10px 10px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.doc-kind:hover { border-color: var(--accent); }
.doc-kind input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.doc-kind:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); box-shadow: 0 0 0 1px var(--accent); }
.doc-kind:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent); }
.doc-kind-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--surface-2); color: var(--ink-2); }
.doc-kind:has(input:checked) .doc-kind-icon { background: var(--btn); color: #fff; }
.doc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.doc-grid > [data-invoice-only] > .field { margin-top: 18px; }
.doc-bottom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: 28px; align-items: start; }
.doc-attachment .field:first-child { margin-top: 0; }
.doc-totals { display: grid; margin: 0; padding: 14px 18px; border-radius: 12px; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.doc-totals > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; }
.doc-totals dt { color: var(--ink-2); }
.doc-totals dd { margin: 0; font-weight: 600; }
.doc-totals-ttc { margin-top: 4px; padding-top: 11px !important; border-top: 1px solid var(--line-strong); font-size: 17px; }
.doc-totals-ttc dt { color: var(--ink); font-weight: 650; }
.doc-totals-ttc dd { font-weight: 750; }
.doc-totals-gap dt, .doc-totals-gap dd { color: var(--bad-text); font-size: 13px; }
.line.has-price-gap input[name$="-unit_price"] { border-color: var(--warning); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning) 22%, transparent); }
.doc-check { margin-bottom: 18px; }
.doc-badges { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.doc-thumb { display: block; width: 100%; max-height: 320px; object-fit: contain; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); }
.doc-file { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 0; }
.doc-file .link { display: inline-flex; align-items: center; gap: 6px; }
.doc-file .icon { width: 15px; height: 15px; }
.doc-price-list { display: grid; gap: 10px; margin: 0 0 14px; padding: 0; list-style: none; }
.doc-price-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.doc-price-list li > span:first-child { display: grid; }
.pc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.check-col { width: 1%; }
.check-col input { width: 17px; height: 17px; accent-color: var(--btn); }
.pc-history { margin-top: 18px; }
/* Searchable <select> (static/js/select-search.js) */
.select-search { position: relative; }
.select-search-input {
  width: 100%; min-height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.select-search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.has-error .select-search-input { border-color: var(--critical); }
.select-search-list {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; max-height: 280px; overflow-y: auto; margin: 0; padding: 4px;
  list-style: none; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-md);
}
.select-search-list li { padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.select-search-list li[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-text); }
.select-search-list li.is-current { font-weight: 600; }
.select-search-list li.is-note { color: var(--ink-3); cursor: default; }
@media (max-width: 960px) {
  .doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-bottom { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) { .doc-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Analyse des écarts (dashboard/variance.html) ---------- */
.va-filters { display: grid; gap: 12px; margin-bottom: 18px; padding: 16px 18px; }
.va-period, .va-criteria { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.va-period .chips { margin-right: 6px; }
.va-search { flex: 1 1 200px; max-width: 300px; height: 34px; }
.va-only { min-height: 34px; font-size: 13px; }
.va-criteria .btn { margin-left: auto; height: 34px; }
.va-alert { margin-bottom: 18px; }
.va-alert-info { border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.kpi-value.va-bad, .va-bad { color: var(--bad-text); }
.kpi-value.va-under, .va-under { color: var(--accent-text); }
.va-legend { font-size: 12.5px; color: var(--ink-3); }
.va-wrap { max-height: 70vh; }
.va-table { font-size: 13px; }
.va-table thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); }
.va-table thead tr + tr th { top: 33px; }
.va-table thead small { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink-3); }
.va-groups th { text-align: center; border-bottom: 1px solid var(--line); }
.va-table .va-sticky { position: sticky; left: 0; z-index: 1; min-width: 210px; max-width: 260px; text-align: left; font-weight: 400; background: var(--surface); box-shadow: inset -1px 0 0 var(--line); }
.va-table thead .va-sticky { z-index: 3; background: var(--surface-2); }
.va-table tfoot .va-sticky, .va-table tfoot td { background: var(--surface-2); font-weight: 600; }
.va-table .va-sticky strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.va-sep { border-left: 1px solid var(--line); }
.va-cell { line-height: 1.3; white-space: nowrap; }
.va-value { display: block; font-variant-numeric: tabular-nums; }
.va-qty { display: block; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.va-cell.va-bad .va-qty, .va-cell.va-under .va-qty { color: inherit; opacity: 0.8; }
.va-zero { color: var(--ink-3); }
.va-zones { margin-top: 18px; }
.va-zones summary { padding: 2px 0; }
.va-zones .table-wrap { margin-top: 12px; }
@media (max-width: 720px) {
  .va-criteria .btn { margin-left: 0; width: 100%; }
  .va-table .va-sticky { min-width: 150px; }
}
.va-table tbody th, .va-table tfoot th { font-size: 13px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink); white-space: normal; }
.va-table tbody th strong { font-weight: 600; }
.va-table tfoot th { font-weight: 650; }

/* ---------- Planning: period label, filter, counters, day / month / calendar views ---------- */
.pl-period { display: grid; min-width: 210px; padding: 6px 14px 6px 12px; border-left: 3px solid var(--btn); line-height: 1.25; }
.pl-period strong { font-size: 17px; letter-spacing: -0.01em; }
.pl-period span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.planning-bar-form { display: flex; gap: 8px; flex-wrap: wrap; }
.select-filter.is-filtered { border-color: var(--accent); color: var(--accent-text); font-weight: 600; background: var(--accent-soft); }
.pl-scope { margin: -6px 0 16px; font-size: 13px; color: var(--ink-2); }
.pl-daylink { display: block; color: inherit; text-decoration: none; border-radius: 8px; }
.pl-daylink:hover .pl-daynum { background: var(--surface-2); }
.pl-day.is-today .pl-daylink:hover .pl-daynum { background: var(--btn-hover); }

.pl-counter { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; margin-top: 4px; font-size: 11.5px; line-height: 1.3; }
.pl-counter-contract { color: var(--ink-3); flex-basis: 100%; }
.pl-counter-hours {
  display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px; font-weight: 700;
  font-variant-numeric: tabular-nums; white-space: nowrap; background: var(--surface-2); color: var(--ink-2);
}
.pl-counter-hours.is-ok { background: color-mix(in srgb, var(--good) 13%, transparent); color: var(--good-text); }
.pl-counter-hours.is-over { background: color-mix(in srgb, var(--critical) 13%, transparent); color: var(--bad-text); }
.pl-counter-validated { color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.pl-counter-validated::before { content: "✓ "; color: var(--good-text); }
.planning .planning-who { width: 230px; }

/* Day: a timeline of the day's hours, one lane per person */
.pd { --who: 250px; min-width: 980px; }
.pd-row { display: grid; grid-template-columns: var(--who) minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.pd-who { display: grid; align-content: center; min-width: 0; padding: 9px 12px 9px 22px; border-right: 1px solid var(--line); }
.pd-who small { font-size: 12px; color: var(--ink-3); }
.pd-lane { position: relative; min-height: 58px; margin-right: 18px; }
.pd-axis .pd-lane { min-height: 30px; }
.pd-axis .pd-lane span { position: absolute; top: 8px; transform: translateX(-50%); font-size: 11px; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pd-axis { position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom-color: var(--line-strong); }
.pd-group { background: var(--surface-2); }
.pd-group .pd-who strong { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.pd-group .pd-lane { min-height: 0; }
.pd-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.pd-bar {
  position: absolute; top: 9px; bottom: 9px; z-index: 1; display: grid; align-content: center; min-width: 4px; padding: 0 9px; overflow: hidden;
  border-radius: 8px; color: var(--ink); text-decoration: none; white-space: nowrap;
  background: color-mix(in srgb, var(--tone) 22%, var(--surface)); box-shadow: inset 3px 0 0 var(--tone);
}
.pd-bar:hover { background: color-mix(in srgb, var(--tone) 34%, var(--surface)); }
.pd-bar strong { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pd-bar small { font-size: 11px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; }
.pd-row.is-off .pd-who { opacity: 0.75; }
.pd-rest, .pd-absence { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); font-size: 12.5px; color: var(--ink-3); }
.pd-absence { padding: 4px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; background: color-mix(in srgb, var(--tone) 18%, var(--surface)); }
.pd-add {
  position: absolute; top: 50%; right: -12px; z-index: 2; display: grid; place-items: center; width: 24px; height: 24px; transform: translateY(-50%);
  border-radius: 50%; border: 1px dashed var(--line-strong); background: var(--surface); color: var(--ink-3); font-weight: 700; text-decoration: none; opacity: 0;
  transition: opacity 0.15s;
}
.pd-row:hover .pd-add, .pd-add:focus-visible { opacity: 1; }
.pd-add:hover { border-color: var(--accent); color: var(--accent-text); }

/* Month: one narrow column per day */
.pm { min-width: 0; table-layout: fixed; }
.pm .planning-who { width: 230px; }
.pm-day { width: 40px; padding: 8px 2px !important; }
.pm-day a { display: block; color: inherit; text-decoration: none; }
.pm-day .pl-daynum { min-width: 26px; height: 26px; font-size: 13px; }
.pm-day.is-today .pl-daynum { background: var(--btn); color: #fff; }
.pm-day.is-weekend, .pm-cell.is-weekend { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.pm-cell { padding: 4px 2px; text-align: center; vertical-align: middle !important; }
.pm-cell.is-today { box-shadow: inset 0 0 0 1px var(--accent); }
.pm-hours, .pm-absence {
  display: block; padding: 4px 0; border-radius: 6px; font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
  background: color-mix(in srgb, var(--tone) 22%, var(--surface)); color: var(--ink);
}
.pm-absence { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--tone) 22%, var(--surface)) 0 4px, color-mix(in srgb, var(--tone) 10%, var(--surface)) 4px 8px); color: var(--ink-2); }
.pm-total { padding: 6px 2px; text-align: center; font-size: 10.5px; }
.pm-total .cell-sub { font-size: 10px; }

/* Calendar: the month as a wall calendar */
.cal { width: 100%; min-width: 900px; border-collapse: collapse; table-layout: fixed; }
.cal thead th { padding: 10px 8px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); border-bottom: 1px solid var(--line-strong); }
.cal .cal-week { width: 54px; text-align: center; }
.cal tbody .cal-week { vertical-align: top; padding-top: 12px; border-right: 1px solid var(--line); background: var(--surface-2); }
.cal tbody .cal-week a { font-size: 12px; font-weight: 700; color: var(--accent-text); text-decoration: none; }
.cal-day { height: 132px; padding: 6px 8px 8px; vertical-align: top; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal-day.is-weekend { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.cal-day.is-outside { background: var(--surface-2); }
.cal-day.is-outside .cal-num { color: var(--ink-3); font-weight: 500; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 4px; color: inherit; text-decoration: none; }
.cal-num { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 999px; font-weight: 700; }
.cal-head:hover .cal-num { background: var(--surface-2); }
.cal-day.is-today .cal-num { background: var(--btn); color: #fff; }
.cal-total { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cal-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; font-size: 11.5px; }
.cal-list li { overflow: hidden; padding: 1px 6px; border-radius: 5px; white-space: nowrap; text-overflow: ellipsis; background: color-mix(in srgb, var(--tone) 16%, var(--surface)); box-shadow: inset 2px 0 0 var(--tone); }
.cal-list li span { margin-right: 4px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-list .cal-absence { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--tone) 16%, var(--surface)) 0 4px, var(--surface) 4px 8px); color: var(--ink-2); }
.cal-list .cal-more { background: none; box-shadow: none; padding: 0 6px; }
.cal-more a { font-weight: 600; color: var(--accent-text); text-decoration: none; }
@media (max-width: 720px) {
  .pl-period { min-width: 0; }
  .pd { --who: 190px; }
}
@media print {
  .pd-add, .pl-daylink:hover .pl-daynum { display: none; }
  .cal-day { height: auto; }
}

/* ---------- Tableau de bord RH (workforce/hr_dashboard.html) ---------- */
.hrd-section { margin-bottom: 22px; }
.hrd-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 10px; font-size: 13px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-2); }
.hrd-title span { font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink-3); }
.hrd-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.hrd-tile {
  --hrd: var(--accent); display: grid; grid-template-columns: auto 1fr; grid-template-areas: "icon count" "label label" "note note" "more more";
  align-items: center; gap: 2px 12px; padding: 16px 18px; color: var(--ink); text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.hrd-tile:hover { border-color: color-mix(in srgb, var(--hrd) 45%, transparent); transform: translateY(-1px); text-decoration: none; }
.hrd-tile.is-active { border-color: var(--hrd); box-shadow: 0 0 0 1px var(--hrd), var(--shadow-sm); }
.hrd-tile.tone-critical { --hrd: var(--critical); }
.hrd-tile.tone-serious { --hrd: var(--serious); }
.hrd-tile.tone-warning { --hrd: var(--warning); }
.hrd-tile-icon { grid-area: icon; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: color-mix(in srgb, var(--hrd) 14%, transparent); color: var(--hrd); }
.hrd-tile.tone-warning .hrd-tile-icon { color: color-mix(in srgb, var(--warning) 70%, var(--ink)); }
.hrd-tile-count { grid-area: count; justify-self: end; font-size: 34px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.hrd-tile.tone-critical .hrd-tile-count { color: var(--bad-text); }
.hrd-tile.is-zero .hrd-tile-count { color: var(--ink-3); }
.hrd-tile.is-zero { --hrd: var(--good); }
.hrd-tile-label { grid-area: label; margin-top: 10px; font-weight: 650; }
.hrd-tile-note { grid-area: note; font-size: 12.5px; color: var(--ink-3); }
.hrd-tile-more { grid-area: more; margin-top: 8px; font-size: 12.5px; font-weight: 600; color: var(--accent-text); }
.hrd-panel { margin-bottom: 18px; scroll-margin-top: 80px; }
.hrd-empty { margin: 0; padding: 4px 22px 22px; color: var(--ink-3); }
.hrd-note { margin: 0; padding: 12px 22px 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.hrd-groups { display: grid; }
.hrd-group { border-top: 1px solid var(--line); }
.hrd-group h3 { display: flex; align-items: center; gap: 8px; margin: 0; padding: 14px 22px 10px; font-size: 14px; }
.hrd-group.is-empty h3 { color: var(--ink-3); font-weight: 600; }
.hrd-group.is-empty .hrd-empty { padding-bottom: 14px; }
.hrd-count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); font-size: 12px; font-weight: 700; color: var(--ink-2); }
.hrd-past td { color: var(--ink-3); }
.hrd-past td strong { font-weight: 500; }
.emp-docs { margin-bottom: 8px; }
.emp-docs h3 { margin: 0 0 4px; font-size: 15px; }
.emp-docs .muted { margin: 0 0 12px; font-size: 13px; }

/* Till (pos) pages */
.pairing-code { margin: 10px 0; font: 600 30px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.18em; text-align: center; padding: 14px; border-radius: 10px; background: var(--surface-2); user-select: all; }
.subhead { margin: 22px 0 6px; font-size: 14px; }
.seal code { font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.color-dot { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 3px; vertical-align: baseline; background: var(--tone, var(--ink-3)); }

/* Employee space (portal) */
.mp-embedded { max-width: none; margin: 0; }
.mp-embedded .mp-actions form { margin: 0; }
.portal-docs { align-items: start; }
.portal-docs .subhead { margin: 22px 0 10px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.portal-docs .card-head + .subhead { margin-top: 0; }

/* Facturation (billing): padded blocks inside a flush card. */
.card-flush > .card-pad, .card-flush > details.card-pad, .card-flush > .form-actions.card-pad { padding: 14px 22px 20px; margin: 0; }
details.card-pad summary { cursor: pointer; }
/* A dense table (Facturation): one line per row, details beside rather than below. */
.table-compact td { padding-block: 6px; }
.table-compact th { padding-block: 7px; }
.table-compact .cell-sub { display: inline; margin-left: 6px; }
.table-compact td.actions { padding-block: 3px; }
.btn-sm { height: 28px; padding: 0 10px; gap: 6px; font-size: 12.5px; border-radius: 8px; }
.btn-sm .icon { width: 14px; height: 14px; }
/* Payments month by month: a grid of small badges. */
.pay-grid td, .pay-grid th { text-align: center; }
.pay-grid td:first-child, .pay-grid th:first-child { text-align: left; }
.pay-cell { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; padding: 3px 6px; border-radius: 7px; font-size: 12px; line-height: 1.2; text-decoration: none; color: var(--ink); }
.pay-cell small { font-size: 10.5px; color: var(--ink-3); }
.pay-cell.is-paid { background: color-mix(in srgb, var(--good-text, #1a7f37) 12%, transparent); }
.pay-cell.is-late { background: color-mix(in srgb, var(--bad-text, #c62828) 14%, transparent); }
.pay-cell.is-due { background: color-mix(in srgb, var(--warning) 22%, transparent); }
.pay-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pay-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-top: 8px; }
.pay-form label { display: grid; gap: 3px; font-size: 12px; color: var(--ink-3); }
.pay-form input, .pay-form select { height: 30px; font-size: 13px; }
.table-compact td.actions form { display: inline-block; margin: 0; vertical-align: middle; }
.table-compact td.actions .icon-btn { width: 28px; height: 28px; }
.table-compact td.actions .icon-btn .icon { width: 16px; height: 16px; }
/* An on/off switch (Charges Pilotelio: a recurring charge active or not). */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.switch input { appearance: none; width: 32px; height: 18px; margin: 0; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; transition: background 0.15s; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform 0.15s; }
.switch input:checked { background: var(--good-text); }
.switch input:checked::after { transform: translateX(14px); }
/* A month's bill, part by part (each establishment, each fee), each paid on its own. */
.bill-table tbody + tbody { border-top: 2px solid var(--line-strong); }
.bill-part th, .bill-part td { background: var(--surface-2); text-transform: none; letter-spacing: 0; font-size: 13.5px; color: var(--ink); }
.bill-pay td { border-bottom: 0; }
.pay-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pay-details { display: inline-block; }
.pay-details summary { list-style: none; cursor: pointer; }
.pay-details summary::-webkit-details-marker { display: none; }
.pay-details[open] { display: block; flex-basis: 100%; }
.pay-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.input-qty { width: 84px; text-align: right; }
.table-compact td input[type="number"] { width: 110px; height: 30px; text-align: right; }
.pay-details-block { margin-top: 10px; }
.pay-details-block summary { cursor: pointer; font-size: 13px; }
.pay-form textarea { font: inherit; font-size: 13px; min-width: 220px; }

/* ---- Indicator details (dashboard/drilldown.py, static/js/drill.js) ---- */
[data-drill] { cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
[data-drill]:hover { transform: translateY(-2px); box-shadow: var(--shadow-md, 0 6px 18px rgba(0,0,0,.08)); border-color: var(--accent, #2a78d6); }
[data-drill]:focus-visible { outline: 2px solid var(--accent, #2a78d6); outline-offset: 2px; }
.kpi[data-drill] .kpi-label::after { content: ' ›'; color: var(--ink-3); }
.drill-drawer { position: fixed; inset: 0; z-index: 80; }
.drill-scrim { position: absolute; inset: 0; background: rgba(15, 20, 30, .32); opacity: 0; transition: opacity .2s ease; }
.drill-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(760px, 100%); background: var(--surface); box-shadow: -12px 0 32px rgba(0,0,0,.16);
  transform: translateX(100%); transition: transform .22s ease; display: flex; flex-direction: column; }
.drill-drawer.is-open .drill-scrim { opacity: 1; }
.drill-drawer.is-open .drill-panel { transform: none; }
.drill-body { overflow-y: auto; padding: 18px 22px 28px; flex: 1; }
.drill-body.is-loading { opacity: .55; pointer-events: none; }
.drill-loading { color: var(--ink-3); padding: 40px 0; text-align: center; }
body.drill-open { overflow: hidden; }
.drill-head { display: flex; align-items: flex-start; gap: 10px; }
.drill-title { flex: 1; min-width: 0; }
.drill-title h2 { margin: 0; font-size: 18px; }
.drill-title h2:focus { outline: none; }
.drill-value { font-size: 30px; font-weight: 700; margin: 10px 0 2px; font-variant-numeric: tabular-nums; }
.drill-value-bad { color: var(--bad-text); }
.drill-scope { color: var(--ink-3); font-size: 13px; margin: 0 0 12px; }
.drill-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.drill-dates { display: inline-flex; gap: 6px; }
.drill-dates input { height: 32px; }
.drill-section { margin-top: 18px; }
.drill-section h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin: 0 0 8px; }
.drill-table tr.is-drill { cursor: pointer; }
.drill-table tr.is-drill:hover td { background: var(--surface-2); }
.drill-table td.drill-go, .drill-table th.drill-go { width: 1%; text-align: right; color: var(--ink-3); white-space: nowrap; }
.drill-table .drill-bad td { color: var(--bad-text); }
.drill-table .drill-good td { color: var(--accent-text, #1c5cab); }
.drill-table .drill-muted td { color: var(--ink-3); }
.drill-note { font-size: 12.5px; color: var(--ink-3); margin: 8px 0 0; }
.drill-pages { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 8px; }
.drill-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
.drill-page .drill-close { display: none; }
@media (max-width: 720px) { .drill-body { padding: 14px 14px 24px; } .drill-value { font-size: 24px; } }

/* Internal transfers (product/transfers/*.html): clickable indicators, filters, timeline, delivery note */
.transfer-kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
a.transfer-kpi { color: inherit; text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s; }
a.transfer-kpi:hover { border-color: var(--accent); }
a.transfer-kpi.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
a.transfer-kpi .kpi-value { margin: 10px 0 4px; font-size: 26px; }
a.transfer-kpi.has-alerts .kpi-value { color: var(--bad-text); }
.transfer-filters { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.transfer-filters .inline-field { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.transfer-filters select, .transfer-filters input { max-width: 170px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
.transfer-timeline li { align-items: flex-start; justify-content: flex-start; }
.transfer-timeline li > span:last-child { flex: 1; min-width: 0; }
.transfer-alert { margin-bottom: 18px; }
.transfer-details { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
.transfer-details li { display: list-item; padding: 1px 0; border: 0; }
.transfer-resolution-help { margin: 14px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.delivery-note-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 18px; }
.delivery-note-head h2 { font-size: 22px; margin: 2px 0 6px; }
.delivery-signatures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.delivery-sign { height: 70px; border: 1px solid var(--line-strong); border-radius: 10px; }
.delivery-blank { display: inline-block; width: 70px; border-bottom: 1px solid var(--line-strong); }
@media (max-width: 720px) { .delivery-signatures { grid-template-columns: 1fr; } }
@media print { .delivery-note { padding: 0; } }

/* Where products are kept (product/stock_by_point.html, product/place_stock.html) */
.stock-points { margin-bottom: 18px; }
.place-all { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.place-all select, .place-table select { min-width: 240px; padding: 9px 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink); }
.stock-breakdown { display: block; font-size: 12px; color: var(--ink-3); font-weight: 400; }

/* Inventory valuation (stocktaking/valuation.html) and count (stocktaking/count.html) */
.valuation-filters { margin-bottom: 18px; }
.valuation-filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.valuation-filter-grid input, .valuation-filter-grid select { width: 100%; }
.valuation-filter-grid input { padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
.valuation-filter-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 14px; }
.valuation-kpis { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.valuation-category th { background: var(--surface-2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; font-size: 12px; }
.valuation-subtotal td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
tr.has-anomaly td:first-child { box-shadow: inset 3px 0 0 var(--critical); }
.count-toolbar { display: grid; gap: 12px; }
.count-summary { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--ink-2); }
.count-summary strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.count-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; align-items: end; }
.count-filters .lines-filter { display: grid; gap: 4px; }
.count-filters .lines-filter select { width: 100%; }
.count-filters input[type="search"] { width: 100%; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
.count-filters .check { align-self: end; }
.is-filtered { display: none !important; }
.count-value, .count-total, .count-price { white-space: nowrap; font-variant-numeric: tabular-nums; }
.count-total .muted { font-style: italic; }
.count-flags { display: block; font-size: 12px; color: var(--bad-text); white-space: normal; text-align: left; }
.count-draft { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.valuation-field { display: grid; gap: 4px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.valuation-field select { padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
.valuation-table td:nth-child(-n+3) { white-space: normal; min-width: 120px; }
.valuation-table td:first-child { min-width: 160px; }
.count-zone .lines-table th, .count-zone .lines-table td { padding-left: 8px; padding-right: 8px; }
.count-zone .lines-table td:first-child { min-width: 170px; }
.count-zone .lines-table input[type="number"] { min-width: 64px; }
.count-zone .lines-table .product-search { width: 180px; max-width: 100%; }
.count-zone .lines-table td:first-child { min-width: 0; }
.count-zone .lines-table input[name$="-counted_cases"] { width: 60px; min-width: 0; }
.count-zone .lines-table input[name$="-counted_quantity"] { width: 84px; min-width: 0; }
.count-zone .count-price .cell-sub { white-space: normal; max-width: 110px; margin-left: auto; }
.count-zone .lines-table th { white-space: normal; vertical-align: bottom; }
.count-zone .lines-table th:nth-child(n+2) { max-width: 96px; }

.count-zone-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
tr.has-conflict td { background: color-mix(in srgb, var(--warning) 10%, transparent); }
.count-conflict { display: grid; gap: 6px; margin-top: 8px; font-size: 13px; color: var(--ink); white-space: normal; }
.count-conflict p { margin: 0; font-weight: 600; }

/* Bulk change of products (product/list.html) */
.bulk-bar { position: sticky; top: 8px; z-index: 6; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; padding: 12px 16px; box-shadow: 0 6px 20px rgb(0 0 0 / 0.08); }
.bulk-bar[hidden] { display: none; }
.bulk-count { font-size: 13px; color: var(--ink-2); }
.bulk-cell { width: 36px; }
.bulk-list { margin: 0; padding-left: 18px; columns: 2; column-gap: 32px; }
.bulk-list li { padding: 2px 0; break-inside: avoid; }
@media (max-width: 720px) { .bulk-list { columns: 1; } }

/* Technical sheets (technical_sheet/detail.html) */
.recipe-photo img { display: block; width: 100%; height: auto; max-height: 320px; object-fit: cover; }
.recipe-steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; line-height: 1.5; }

/* Duplicate products (product/duplicates.html, product/merge_confirm.html) */
.duplicate-pair { margin-bottom: 18px; }
.duplicate-sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.duplicate-side h3 { margin: 0 0 10px; font-size: 16px; }
.duplicate-side .btn { margin-top: 12px; }
.merge-help { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 13.5px; color: var(--ink-2); }
@media (max-width: 720px) { .duplicate-sides { grid-template-columns: 1fr; } }

/* One month at a time (partials/month_nav.html) */
.month-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.month-nav-picker select { font-weight: 600; min-width: 180px; }
.month-nav .is-disabled { opacity: 0.4; pointer-events: none; }
.product-periods { margin-bottom: 18px; }
.export-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 16px; margin-bottom: 16px; }
.export-bar input, .export-bar select { padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
/* Loss lines (product/movement_form.html): the reason and the note stay readable. */
.lines-table select[name$="-reason"] { min-width: 190px; }
.lines-table input[name$="-note"] { min-width: 160px; }
.expiry-actions { white-space: nowrap; }
.expiry-actions form { display: inline; }
.expiry-actions .btn + .btn, .expiry-actions form + .btn { margin-left: 6px; }
/* « Pertes » (product/losses.html). */
.losses-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; margin-top: 16px; }
.losses-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.losses-amount { font-size: 28px; font-weight: 700; margin: 6px 0; }
.losses-title { font-size: 15px; margin: 0 0 10px; }
.losses-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.losses-list li { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.losses-grid + .card { margin-bottom: 16px; }
@media (max-width: 900px) { .losses-grid { grid-template-columns: 1fr; } }
.move-quantity { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.move-quantity input { width: 110px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; text-align: right; }
.has-error .move-quantity input { border-color: var(--critical, #c0392b); }
/* Phone widths (iPhone, 375 px): nothing may widen the page sideways. */
.table-wrap { position: relative; } /* its absolutely placed bits (the « Actions » header label) stay inside its scroll */
.field { min-width: 0; }
.icon-grid { max-width: min(640px, 100%); }
.view-switch { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.view-switch::-webkit-scrollbar { display: none; }
/* Editable lines on a phone: each line a small card, its fields labelled, side by side two by two
   — instead of a table to swipe sideways (not the stocktaking count, which has its own layout). */
@media (max-width: 600px) {
  .lines[data-formset]:not(.count-zone .lines) .lines-table thead { display: none; }
  .lines[data-formset]:not(.count-zone .lines) .lines-table,
  .lines[data-formset]:not(.count-zone .lines) .lines-table tbody { display: block; }
  .lines[data-formset]:not(.count-zone .lines) .lines-table tr.line {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; position: relative;
    padding: 14px 40px 14px 0; border-bottom: 1px solid var(--line);
  }
  .lines[data-formset]:not(.count-zone .lines) .lines-table tr.line > td { display: block; padding: 0; border: 0; min-width: 0; text-align: left; }
  .lines[data-formset]:not(.count-zone .lines) .lines-table tr.line > td:first-of-type { grid-column: 1 / -1; }
  .lines[data-formset]:not(.count-zone .lines) .lines-table tr.line > td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 4px; font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--ink-3);
  }
  .lines[data-formset]:not(.count-zone .lines) .lines-table tr.line > td:first-of-type::before { content: none; }
  .lines[data-formset]:not(.count-zone .lines) .lines-table tr.line input,
  .lines[data-formset]:not(.count-zone .lines) .lines-table tr.line select,
  .lines[data-formset]:not(.count-zone .lines) .lines-table tr.line .product-search { width: 100%; min-width: 0; max-width: none; }
  .lines[data-formset]:not(.count-zone .lines) .lines-table tr.line > td:first-child { min-width: 0; }
  .lines[data-formset]:not(.count-zone .lines) .lines-table tr.line > td.actions { position: absolute; top: 14px; right: 0; }
  .lines[data-formset]:not(.count-zone .lines) .lines-table td[data-current-stock],
  .lines[data-formset]:not(.count-zone .lines) .lines-table td[data-line-total],
  .lines[data-formset]:not(.count-zone .lines) .lines-table td[data-line-cost] { padding-top: 0; }
  .lines[data-formset]:not(.count-zone .lines) .table-wrap { overflow: visible; margin-inline: 0; }
}
/* « Bien démarrer » (dashboard/onboarding.html, the dashboard's banner). */
.onboarding-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; margin-bottom: 18px; border-left: 4px solid var(--accent); }
.onboarding-banner-text { flex: 1 1 320px; display: grid; gap: 8px; }
.onboarding-banner-text p { margin: 0; }
.onboarding-banner-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.onboarding-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.onboarding-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .3s; }
.onboarding-bar-lg { height: 12px; }
.onboarding-summary { display: grid; gap: 12px; margin-bottom: 18px; }
.onboarding-summary p { margin: 0; }
.onboarding-count { font-size: 15px; }
.onboarding-count strong { font-size: 26px; }
.onboarding-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.onboarding-step { display: flex; align-items: center; gap: 16px; }
.onboarding-step h2 { font-size: 16px; margin: 0 0 4px; }
.onboarding-step p { margin: 0; font-size: 14px; }
.onboarding-step-text { flex: 1; min-width: 0; }
.onboarding-check { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line-strong); font-weight: 700; color: var(--ink-2); }
.onboarding-step.is-done .onboarding-check { border-color: var(--good, #1a7f4b); background: var(--good, #1a7f4b); color: #fff; }
.onboarding-step.is-done h2 { color: var(--ink-2); }
.onboarding-step.is-next { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.onboarding-help { margin-top: 16px; }
@media (max-width: 600px) { .onboarding-step { flex-wrap: wrap; } .onboarding-step .btn { margin-left: 52px; } }
/* Support tickets (support/_thread.html). */
.support-thread { list-style: none; margin: 16px 0; padding: 0; display: grid; gap: 12px; }
.support-message { max-width: 760px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.support-message.is-staff { margin-left: auto; border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.support-meta { margin: 0 0 6px; font-size: 13px; color: var(--ink-3); }
.support-body p { margin: 0 0 8px; }
.support-image { max-width: 320px; max-height: 240px; border-radius: 10px; border: 1px solid var(--line); margin-top: 6px; }
.support-filters { padding: 14px 16px 0; }
tr.support-unread td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.support-facts { margin-bottom: 8px; }
.field-stack { display: grid; gap: 4px; }
/* Journal d'activité (audit/list.html). */
.audit-date { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.audit-date input { padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
.audit-changes { min-width: 260px; font-size: 13px; }
.audit-changes ul { margin: 6px 0 0; padding-left: 16px; display: grid; gap: 3px; }
.audit-changes summary { cursor: pointer; color: var(--ink-2); }
.audit-before { color: var(--ink-3); text-decoration: line-through; }
.audit-after { font-weight: 600; }
.audit-retention { margin-top: 12px; font-size: 13px; }
