/* =====================================================================
 * Cockpit Speakeasy — design tokens v2 (dark sobre, Linear-style)
 * ===================================================================== */
:root {
  color-scheme: dark;

  /* Surfaces */
  --bg: #09090b;
  --bg-2: #0c0c0e;
  --surface: #141417;
  --surface-2: #1a1a1e;
  --surface-3: #222227;
  --border: #27272a;
  --border-soft: #1c1c1f;

  /* Ink */
  --ink: #fafafa;
  --ink-2: #e4e4e7;
  --ink-muted: #a1a1aa;
  --ink-soft: #71717a;
  --ink-faint: #52525b;

  /* Accent (indigo) */
  --accent: #7c70ff;
  --accent-2: #9b91ff;
  --accent-soft: rgba(124, 112, 255, 0.12);
  --accent-ring: rgba(124, 112, 255, 0.4);

  /* Status */
  --success: #3dc77a;
  --success-soft: rgba(61, 199, 122, 0.12);
  --warning: #d4a45c;
  --warning-soft: rgba(212, 164, 92, 0.14);
  --danger: #e26b6b;
  --danger-soft: rgba(226, 107, 107, 0.14);

  /* Radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-xl: 14px;
  --r-2xl: 18px;
  --r-3xl: 24px;
  --r-full: 9999px;

  /* Spacing scale (4px) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;

  /* Typography */
  --font-sans:
    'Geist', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  --font-mono:
    'Geist Mono', 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;

  /* Layout */
  --sidebar-w: 232px;
  --drawer-w: 360px;
  --topbar-h: 56px;
  --bottom-nav-h: 60px;
}

/* =====================================================================
 * Reset & base
 * ===================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11' 1, 'ss01' 1;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.num {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum' 1, 'cv01' 1;
}

.muted {
  color: var(--ink-muted);
}
.muted-text {
  color: var(--ink-muted);
}
.small {
  font-size: 12px;
}
.xsmall {
  font-size: 11.5px;
  line-height: 1.45;
}
.compact {
  font-size: 12px;
  line-height: 1.4;
}

.hidden,
[hidden] {
  display: none !important;
}

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

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* =====================================================================
 * App shell
 * ===================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

.app-sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-soft);
  background: var(--bg-2);
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: var(--s-5) var(--s-5) var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  background: url("/app/icons/logo-cs.png?v=20260628") center / cover no-repeat;
  color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0;
  font-weight: 600;
  overflow: hidden;
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.28),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand-text strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.brand-text span {
  font-size: 11px;
  color: var(--ink-soft);
}

.sidebar-month {
  padding: 0 var(--s-5) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.sidebar-month .field-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}
.sidebar-month input[type='month'] {
  width: 100%;
  height: 36px;
  padding: 0 var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--ink);
  color-scheme: dark;
  font-family: var(--font-mono);
  font-size: 13px;
}
.sidebar-month input[type='month']:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.sidebar-month-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s-2);
}

.sidebar-kpi {
  margin: 0 var(--s-5) var(--s-4);
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.kpi-eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}
.kpi-value {
  display: block;
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 2px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.kpi-bar {
  margin-top: var(--s-3);
  height: 4px;
  background: var(--surface-3);
  border-radius: var(--r-full);
  overflow: hidden;
}
.kpi-bar-fill {
  height: 100%;
  background: var(--success);
  border-radius: inherit;
  transition: width 200ms ease-out;
}
.kpi-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--s-3);
  font-size: 11px;
  color: var(--ink-muted);
}
.kpi-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.dot-success { background: var(--success); }
.dot-warning { background: var(--warning); }
.dot-danger { background: var(--danger); }

.sidebar-nav {
  padding: var(--s-2) var(--s-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 8px 10px;
  border-radius: var(--r-md);
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease;
  text-align: left;
  width: 100%;
}
.nav-item:hover {
  background: var(--surface);
  color: var(--ink);
}
.nav-item.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--accent-ring);
}
.nav-item svg {
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-footer {
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  font-size: 11px;
}
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}
.status-dot-pair {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.status-mini-label {
  color: var(--ink-soft);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.status-mini {
  color: var(--ink);
  font-size: 11px;
  font-weight: 500;
}

/* =====================================================================
 * Main column + topbar
 * ===================================================================== */
.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  height: var(--topbar-h);
  padding: 0 var(--s-6);
  background: var(--bg);
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: blur(8px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  min-width: 0;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  white-space: nowrap;
}
.topbar-month {
  color: var(--ink-muted);
  font-weight: 400;
  font-size: 14px;
  text-transform: capitalize;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.section-nav {
  position: sticky;
  top: var(--topbar-h);
  z-index: 19;
  padding: 0 var(--s-6);
  background: var(--bg);
}

.section-nav-group {
  display: flex;
  gap: var(--s-2);
  min-width: 0;
}

.section-nav-group[hidden] {
  display: none;
}

.section-tab {
  flex: 0 0 auto;
}

/* Les statuts (Brouillon/Aucune modification) et les actions (Importer XLSM,
   Excel, Générer, Valider) concernent uniquement l'onglet Planning.
   Sur les autres onglets, on les masque pour ne pas surcharger la topbar. */
/* Ces deux règles ciblent UNIQUEMENT la topbar globale (<header class="topbar">),
   pas les topbars internes aux views (ex: <div class="topbar"> du Registre).
   Sans ce scope, la topbar du Registre perd son bouton "Nouvelle", son search
   et son select type sur tous les onglets sauf Planning. */
body:not([data-active-view="planning"]) header.topbar .topbar-status,
body:not([data-active-view="planning"]) header.topbar .topbar-actions {
  display: none;
}

.content {
  flex: 1;
  padding: var(--s-6);
  min-width: 0;
}

.view {
  display: none;
}
.view.is-active {
  display: block;
}

/* =====================================================================
 * Buttons
 * ===================================================================== */
.btn,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
  border: 1px solid transparent;
}
.btn:focus-visible,
.button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.btn:disabled,
.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary,
.button.primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled),
.button.primary:hover:not(:disabled) {
  background: var(--accent-2);
}

.btn-secondary,
.button.secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled),
.button.secondary:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--surface-3);
}

.btn-ghost,
.button.ghost {
  background: transparent;
  color: var(--ink-muted);
}
.btn-ghost:hover:not(:disabled),
.button.ghost:hover:not(:disabled) {
  background: var(--surface);
  color: var(--ink);
}

.btn-danger,
.button.danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled),
.button.danger:hover:not(:disabled) {
  filter: brightness(1.05);
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.btn-label-desktop {
  display: inline;
}

.link-button {
  background: none;
  border: 0;
  padding: 0;
  font-size: 12px;
  color: var(--accent-2);
  cursor: pointer;
}
.link-button:hover {
  color: var(--accent);
  text-decoration: underline;
}
.link-button.danger {
  color: var(--danger);
}

/* =====================================================================
 * Form fields
 * ===================================================================== */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field-hint {
  display: block;
  font-size: 11px;
  opacity: 0.7;
  margin-top: 4px;
  min-height: 14px;
}
.field-hint--ok {
  color: var(--accent, #7c70ff);
  opacity: 1;
}

.field input[type='text'],
.field input[type='number'],
.field input[type='date'],
.field input[type='month'],
.field input[type='time'],
.field input[type='search'],
.field select,
.field textarea {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--ink);
  font-size: 13px;
  font-family: var(--font-sans);
  color-scheme: dark;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.field textarea {
  height: auto;
  min-height: 64px;
  padding: 8px 12px;
  resize: vertical;
  line-height: 1.5;
}
.field select {
  cursor: pointer;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%),
    linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) center,
    calc(100% - 11px) center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input::placeholder,
.field textarea::placeholder {
  color: var(--ink-faint);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
}

.field-grid {
  display: grid;
  gap: var(--s-3);
}
.field-grid.two-columns {
  grid-template-columns: 1fr 1fr;
}

.checkbox-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 13px;
  color: var(--ink-2);
  height: 36px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.checkbox-row input[type='checkbox'] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.form-stack,
.form-panel {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
}
.form-actions-stack {
  flex-direction: column;
  align-items: stretch;
}

/* =====================================================================
 * Cards / panels
 * ===================================================================== */
.card,
.panel {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-xl);
  padding: var(--s-5);
}

.card-head,
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
}
.card-head > div,
.section-head > div {
  min-width: 0;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.section-title.small {
  font-size: 13px;
}

.section-kicker {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

/* =====================================================================
 * Pills, badges, status
 * ===================================================================== */
.pill,
.status-pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 10px;
  border-radius: var(--r-full);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--ink-muted);
  border: 1px solid var(--border);
}
.pill::before,
.status-pill::before,
.status-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-soft);
  flex-shrink: 0;
}
.pill.pill-success,
.status-pill.success,
.status-badge.success {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(61, 199, 122, 0.3);
}
.pill.pill-success::before,
.status-pill.success::before,
.status-badge.success::before {
  background: var(--success);
}
.pill.pill-warning,
.status-pill.warning,
.status-badge.warning {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: rgba(212, 164, 92, 0.3);
}
.pill.pill-warning::before,
.status-pill.warning::before,
.status-badge.warning::before {
  background: var(--warning);
}
.pill.pill-danger,
.status-pill.danger,
.status-badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(226, 107, 107, 0.3);
}
.pill.pill-danger::before,
.status-pill.danger::before,
.status-badge.danger::before {
  background: var(--danger);
}
.pill.pill-accent,
.status-pill.accent {
  background: var(--accent-soft);
  color: var(--accent-2);
  border-color: var(--accent-ring);
}
.pill.pill-accent::before,
.status-pill.accent::before {
  background: var(--accent);
}
.pill.no-dot::before,
.status-pill.no-dot::before {
  display: none;
}

/* =====================================================================
 * Empty states + flash
 * ===================================================================== */
.empty-state {
  padding: var(--s-5) var(--s-4);
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
  background: var(--surface-2);
  border-radius: var(--r-lg);
  border: 1px dashed var(--border);
}
.empty-state.small {
  padding: var(--s-3);
  font-size: 12px;
}

.flash-stack {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-6) 0;
}
.flash-stack:empty {
  padding: 0;
}
.flash {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.flash.success {
  background: var(--success-soft);
  border-color: rgba(61, 199, 122, 0.3);
  color: var(--ink);
}
.flash.warning {
  background: var(--warning-soft);
  border-color: rgba(212, 164, 92, 0.3);
  color: var(--ink);
}
.flash.error,
.flash.danger {
  background: var(--danger-soft);
  border-color: rgba(226, 107, 107, 0.3);
  color: var(--ink);
}

/* =====================================================================
 * Planning view
 * ===================================================================== */
.planning-grid {
  display: grid;
  grid-template-columns: 1fr var(--drawer-w);
  gap: var(--s-6);
  align-items: start;
}

.planning-main {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  min-width: 0;
}

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

.generation-summary {
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--surface);
}

/* =====================================================================
 * Calendar
 * ===================================================================== */
.planning-calendar-shell {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-xl);
  padding: var(--s-5);
}
.planning-calendar-shell-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
  flex-wrap: wrap;
}
.planning-calendar-shell-controls {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  flex-wrap: wrap;
}

.planning-calendar-legend {
  display: flex;
  gap: var(--s-4);
  font-size: 11px;
  color: var(--ink-muted);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.legend-dot.ok { background: var(--success); }
.legend-dot.warning { background: var(--warning); }
.legend-dot.weekend { background: var(--ink-faint); }
.legend-dot.error { background: var(--danger); }

.segmented-control {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 2px;
  gap: 2px;
}
.segmented-button {
  height: 26px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--ink-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.segmented-button:hover {
  color: var(--ink);
}
.segmented-button.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--border);
}

/* Calendar — must mirror what frontend/js/app.js generates :
 * .planning-calendar
 *   .planning-calendar-weekdays    (7-col grid, day-of-week labels)
 *   .planning-calendar-grid        (7-col grid, the actual day cells)
 *     .planning-calendar-day
 *       .planning-calendar-day-top
 *         .planning-calendar-day-number
 *         .planning-calendar-day-ratio (.ok|.warning|.error)
 *       .planning-calendar-shifts
 *         .planning-calendar-shift-row
 *           .planning-calendar-shift-meta
 *             .planning-calendar-shift-label
 *             .planning-calendar-shift-count (.ok|.warning|.error)
 *           .planning-calendar-shift-preview (.is-empty)
 */
.planning-calendar {
  display: flex;
  flex-direction: column;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background-color: var(--border-soft);
  min-height: 200px;
}
.planning-calendar .empty-state {
  border: 0;
  background: var(--surface);
  margin: 0;
  border-radius: 0;
}

.planning-calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background-color: var(--border-soft);
}
.planning-calendar-weekday {
  background: var(--bg-2);
  text-align: center;
  padding: 8px 4px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.planning-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background-color: var(--border-soft);
}

.planning-calendar-day,
.calendar-day {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  min-height: 110px;
  cursor: pointer;
  transition: background 120ms;
  position: relative;
  background-color: var(--surface);
}
.planning-calendar-day:hover,
.calendar-day:hover {
  background: var(--surface-2);
}
.planning-calendar-day.is-selected,
.calendar-day.is-selected {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.planning-calendar-day.is-outside-month,
.planning-calendar-day.is-outside,
.calendar-day.is-outside {
  color: var(--ink-faint);
  background: var(--bg-2);
  cursor: default;
}
.planning-calendar-day.is-weekend,
.calendar-day.is-weekend {
  background: var(--bg-2);
}
.planning-calendar-day.is-weekend:hover,
.calendar-day.is-weekend:hover {
  background: var(--surface-2);
}
.planning-calendar-day.has-error,
.calendar-day.has-error {
  box-shadow: inset 0 0 0 1px var(--danger);
}

.planning-calendar-day-top,
.planning-calendar-day-head,
.calendar-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}
.planning-calendar-day-number,
.planning-calendar-day-num,
.calendar-day-num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
}
.planning-calendar-day.is-outside-month .planning-calendar-day-number,
.planning-calendar-day.is-outside .planning-calendar-day-number,
.planning-calendar-day.is-outside .planning-calendar-day-num,
.calendar-day.is-outside .calendar-day-num {
  color: var(--ink-faint);
}

/* Out-of-month / weekend tag (« Hors mois », « Pas de service ») */
.planning-calendar-day-flag,
.planning-calendar-day-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  padding: 2px 6px;
  background: var(--surface-3);
  border-radius: 4px;
  white-space: nowrap;
}

.planning-calendar-day-ratio,
.calendar-day-ratio {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--ink-muted);
  white-space: nowrap;
}
.planning-calendar-day-ratio.ok,
.calendar-day-ratio.ok {
  background: var(--success-soft);
  color: var(--success);
}
.planning-calendar-day-ratio.warning,
.calendar-day-ratio.warning {
  background: var(--warning-soft);
  color: var(--warning);
}
.planning-calendar-day-ratio.error,
.calendar-day-ratio.error {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Shift list inside each day */
.planning-calendar-shifts,
.planning-calendar-day-shifts,
.calendar-day-shifts {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  line-height: 1.35;
  flex: 1;
  min-height: 0;
}

/* Per-shift row : label + count on top, preview underneath */
.planning-calendar-shift-row {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.planning-calendar-shift-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}
.planning-calendar-shift-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  font-weight: 500;
}
.planning-calendar-shift-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-muted);
  font-weight: 500;
}
.planning-calendar-shift-count.ok {
  color: var(--success);
}
.planning-calendar-shift-count.warning {
  color: var(--warning);
}
.planning-calendar-shift-count.error {
  color: var(--danger);
}
.planning-calendar-shift-preview {
  font-size: 10.5px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.planning-calendar-shift-preview.is-empty {
  color: var(--ink-faint);
  font-style: italic;
}

/* Older fallback class names (single-line shift) */
.planning-calendar-day-shift,
.calendar-day-shift {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.planning-calendar-day-shift .shift-tag,
.calendar-day-shift .shift-tag {
  color: var(--ink-faint);
  font-weight: 500;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}
.planning-calendar-day-shift.warning,
.calendar-day-shift.warning {
  color: var(--warning);
}
.planning-calendar-day-shift.error,
.calendar-day-shift.error {
  color: var(--danger);
}
.planning-calendar-day-shift.empty,
.calendar-day-shift.empty {
  color: var(--ink-faint);
  font-style: italic;
}

/* Compact density */
.planning-calendar-shell.is-compact .planning-calendar-day,
.planning-calendar-shell.is-compact .calendar-day {
  min-height: 64px;
  padding: 8px 10px;
}
.planning-calendar-shell.is-compact .planning-calendar-shifts,
.planning-calendar-shell.is-compact .planning-calendar-day-shifts,
.planning-calendar-shell.is-compact .calendar-day-shifts {
  display: none;
}

/* =====================================================================
 * Mobile day list
 * ===================================================================== */
.planning-mobile-section {
  display: none;
}
.planning-mobile-list {
  display: flex;
  flex-direction: column;
}
.planning-mobile-list .empty-state {
  margin: var(--s-3) 0;
}

#planning-mobile-list > * {
  border-bottom: 1px solid var(--border-soft);
}
#planning-mobile-list > *:last-child {
  border-bottom: 0;
}

.mobile-day-row,
.planning-mobile-day {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  cursor: pointer;
  transition: background 120ms;
}
.mobile-day-row:hover,
.planning-mobile-day:hover {
  background: var(--surface-2);
}
.mobile-day-row.is-selected,
.planning-mobile-day.is-selected {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}

/* =====================================================================
 * Drawer
 * ===================================================================== */
.planning-drawer {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  position: sticky;
  top: calc(var(--topbar-h) + var(--s-6));
  max-height: calc(100vh - var(--topbar-h) - var(--s-6) * 2);
  overflow-y: auto;
}

.drawer-section {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-xl);
  padding: var(--s-4);
}
.drawer-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-3);
}
.drawer-section-body {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.drawer-actions {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.drawer-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-2);
}

.drawer-day {
  padding: var(--s-4);
}

.drawer-history-summary:empty {
  display: none;
}

.drawer-settings {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-xl);
}
.drawer-settings-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3) var(--s-4);
  cursor: pointer;
  list-style: none;
}
.drawer-settings-summary::-webkit-details-marker {
  display: none;
}
.drawer-chevron {
  transition: transform 200ms;
  color: var(--ink-soft);
}
.drawer-settings[open] .drawer-chevron {
  transform: rotate(180deg);
}
.drawer-settings-body {
  padding: 0 var(--s-4) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.drawer-settings-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
}

/* Alertes planning (toggle caché, en dessous du calendrier) */
.planning-alerts-details {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-xl);
  margin-top: var(--s-3);
}
.planning-alerts-summary {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  cursor: pointer;
  list-style: none;
}
.planning-alerts-summary::-webkit-details-marker {
  display: none;
}
.planning-alerts-summary .section-title {
  flex: 1;
}
.planning-alerts-details[open] .drawer-chevron {
  transform: rotate(180deg);
}
.planning-alerts-body {
  padding: 0 var(--s-4) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  max-height: 480px;
  overflow-y: auto;
}

/* Shifts catalog (read-only, in the drawer settings <details>) */
.shifts-catalog {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.shifts-catalog-group {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.shifts-catalog-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
}
.shifts-catalog-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.shifts-catalog-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
  padding: 4px 8px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  font-size: 11.5px;
}
.shifts-catalog-list .shift-code {
  color: var(--ink);
}
.shifts-catalog-list .shift-duration {
  color: var(--ink-soft);
}

/* =====================================================================
 * Day detail / slot editor (rendered by JS into #planning-day-detail)
 * ===================================================================== */
.planning-day-detail .empty-state {
  border: 0;
  background: transparent;
  padding: var(--s-4) var(--s-2);
}

.planning-day-detail-head,
.planning-day-detail-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.planning-day-detail-title {
  font-size: 14px;
  font-weight: 600;
}
.planning-day-detail-shifts,
.planning-day-shifts {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.planning-day-shift,
.shift-block {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.planning-day-shift-title,
.shift-block-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  text-transform: capitalize;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.slot-editor {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  transition: background 120ms, box-shadow 120ms;
}
.slot-editor:hover {
  background: var(--surface-3);
}
.slot-editor.is-targeted {
  box-shadow: 0 0 0 2px var(--accent);
  background: var(--accent-soft);
}
.slot-editor select {
  flex: 1;
  height: 32px;
  padding: 0 var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: 12.5px;
}
.slot-editor select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.slot-editor.is-empty {
  border-color: rgba(212, 164, 92, 0.4);
}
.slot-editor.is-dirty {
  box-shadow: 0 0 0 1px var(--accent-ring);
}

/* =====================================================================
 * Tables
 * ===================================================================== */
.table-shell {
  border: 1px solid var(--border-soft);
  border-radius: var(--r-xl);
  background: var(--surface);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  font-weight: 500;
  text-align: left;
  padding: var(--s-3) var(--s-4);
  color: var(--ink-soft);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  white-space: nowrap;
}
.data-table tbody td {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-soft);
  color: var(--ink-2);
  vertical-align: middle;
}
.data-table tbody tr:last-child td {
  border-bottom: 0;
}
.data-table tbody tr:hover td {
  background: var(--surface-2);
}
.table-placeholder {
  text-align: center;
  color: var(--ink-soft);
  padding: var(--s-6) !important;
}

.employees-table th:last-child,
.employees-table td:last-child {
  text-align: right;
}

/* =====================================================================
 * Stack list (used by unavailability list, history, errors)
 * ===================================================================== */
.stack-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.stack-list-item,
.list-row {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
}
.stack-list-item .row-actions,
.list-row .row-actions {
  margin-left: auto;
  display: flex;
  gap: var(--s-2);
}

#planning-history-panel,
#planning-errors-panel {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.planning-history-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
}
.drawer-history-summary {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  margin-bottom: var(--s-2);
  font-size: 11.5px;
  color: var(--ink-muted);
}

.planning-history-toggle {
  margin-top: var(--s-2);
}

.planning-error-action {
  margin-top: 4px;
}

.issues-panel {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.employee-rules-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-top: var(--s-3);
}
.employee-rules-status {
  padding: var(--s-3);
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
}

/* =====================================================================
 * Indispos / Équipe layouts
 * ===================================================================== */
.split-layout,
.team-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-5);
  align-items: start;
}

.team-layout {
  grid-template-columns: 1.4fr 1fr;
}

.team-side-stack {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

/* =====================================================================
 * Bottom nav (mobile only)
 * ===================================================================== */
.bottom-nav {
  display: none;
}

/* =====================================================================
 * Responsive
 * ===================================================================== */
@media (max-width: 1100px) {
  .planning-grid {
    grid-template-columns: 1fr;
  }
  .planning-drawer {
    position: static;
    max-height: none;
  }
}

@media (max-width: 768px) {
  :root {
    --topbar-h: 52px;
  }

  .app {
    grid-template-columns: 1fr;
  }
  .app-sidebar {
    display: none;
  }

  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-h);
    padding: 4px env(safe-area-inset-right) calc(8px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
    background: var(--bg);
    border-top: 1px solid var(--border-soft);
    z-index: 30;
  }
  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--ink-soft);
    font-size: 10.5px;
    background: transparent;
    border: 0;
  }
  .bottom-nav-item span {
    font-size: 10px;
  }
  .bottom-nav-item.is-active {
    color: var(--accent-2);
  }
  .bottom-nav-item svg {
    width: 18px;
    height: 18px;
  }

  .app-main {
    padding-bottom: var(--bottom-nav-h);
  }

  .topbar {
    padding: 0 var(--s-4);
  }
  .section-nav {
    display: flex;
    align-items: center;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 0 var(--s-4);
    border-bottom: 1px solid var(--border-soft);
    scrollbar-width: none;
  }
  .section-nav::-webkit-scrollbar {
    display: none;
  }
  .section-nav-group {
    align-items: center;
    flex-wrap: nowrap;
    gap: var(--s-2);
    min-height: 44px;
  }
  .section-tab {
    min-height: 36px;
    padding: 0 10px;
    white-space: nowrap;
  }
  .topbar-status {
    display: none;
  }
  .btn-label-desktop {
    display: none;
  }
  .topbar-actions .btn {
    padding: 0 8px;
  }

  .content {
    padding: var(--s-4);
  }

  .planning-calendar-shell {
    display: none;
  }
  .planning-mobile-section {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-xl);
    overflow: hidden;
  }

  .planning-grid {
    gap: var(--s-4);
  }

  .field-row,
  .field-grid.two-columns {
    grid-template-columns: 1fr;
  }

  .table-shell {
    overflow-x: auto;
  }
  .data-table {
    min-width: 720px;
  }

  .split-layout,
  .team-layout {
    grid-template-columns: 1fr;
  }

  /* Spec B — audit mobile : formulaires en 1 colonne sur mobile (au lieu
     du 1fr 1fr par défaut). Impact uniforme sur tous les forms du site. */
  .field-row {
    grid-template-columns: 1fr;
  }

  /* Spec B — audit mobile : tap targets >= 44px (Apple HIG). Préserve
     .btn-sm qui reste volontairement compact (chips, filtres). */
  .btn:not(.btn-sm) {
    min-height: 44px;
  }

  /* Spec B — audit mobile : Indispos garde "Nouvelle" accessible quand
     l'utilisateur scroll dans la liste, via la card-head en sticky.
     top: var(--topbar-h) car la topbar globale (z-index 20) est déjà
     sticky à top:0 — on cale dessous pour ne pas être recouvert. */
  #view-unavailabilities .card-head {
    position: sticky;
    top: var(--topbar-h);
    z-index: 5;
    background: var(--surface);
    padding-top: var(--s-3);
    margin-top: calc(var(--s-3) * -1);
  }

  .card,
  .panel {
    padding: var(--s-4);
  }

  /* Spec B — audit mobile : FAB "+ Action" indigo, bottom-right, juste
     au-dessus de la bottom-nav. Scope au body active-view="registry"
     pour ne pas apparaître sur les autres onglets. */
  body[data-active-view="registry"] .registry-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: calc(var(--bottom-nav-h) + 16px);
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--ink);
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    z-index: 25;
  }

  body[data-active-view="registry"] .registry-fab:active {
    transform: scale(0.95);
  }
}

/* =====================================================================
 * Registre — FAB "+ Action" (mobile only)
 * Visible uniquement quand l'onglet Registre est actif sur viewport mobile.
 * ===================================================================== */
.registry-fab {
  display: none;
}

/* =====================================================================
 * JS-injected blocks (rendered by frontend/js/app.js innerHTML)
 * ===================================================================== */

/* --- Day detail panel rendered into #planning-day-detail --- */
.planning-day-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.planning-day-detail-head h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.planning-day-detail-head p {
  font-size: 11.5px;
  color: var(--ink-soft);
}
.planning-day-detail-shifts {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.planning-day-shift-card {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-3);
}
.planning-day-shift-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
}
.planning-day-shift-title h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0;
}
.planning-day-shift-title p {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 2px;
}

/* --- Slot editor (used in day detail) --- */
.slot-stack {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.slot-editor {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--s-2);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 120ms, box-shadow 120ms, border-color 120ms;
}
.slot-editor:hover {
  background: var(--surface-3);
}
.slot-editor.is-targeted {
  box-shadow: 0 0 0 2px var(--accent);
  background: var(--accent-soft);
}
.slot-editor.is-empty {
  border-color: rgba(212, 164, 92, 0.4);
}
.slot-editor.is-dirty {
  box-shadow: 0 0 0 1px var(--accent-ring);
}
.slot-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}
.slot-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-muted);
}
.slot-editor select {
  height: 32px;
  padding: 0 var(--s-3);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: 12.5px;
  width: 100%;
}
.slot-editor select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.slot-interim-name {
  font-weight: 500;
  color: var(--ink-2, var(--ink));
  text-transform: none;
  letter-spacing: 0;
}
.slot-editor-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-2);
  margin-top: var(--s-1);
}
.slot-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.slot-field-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
}
@media (max-width: 540px) {
  .slot-editor-fields {
    grid-template-columns: 1fr;
  }
}

/* --- Issue cards (errors panel) --- */
.issue-card {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-3);
  transition: background 120ms, border-color 120ms;
}
.issue-card.is-actionable {
  cursor: pointer;
}
.issue-card.is-actionable:hover {
  background: var(--surface-3);
  border-color: var(--border);
}
.issue-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
}
.issue-card-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.issue-message {
  font-size: 12.5px;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.4;
}
.issue-meta {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 4px;
}

.card-muted {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-3);
  font-size: 12px;
  color: var(--ink-muted);
}

/* --- Planning history --- */
.planning-history-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--s-2);
  margin-bottom: var(--s-2);
}
.planning-history-summary-card {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-3);
}
.planning-history-summary-card.is-success {
  border-color: rgba(61, 199, 122, 0.3);
}
.planning-history-summary-card.is-warning {
  border-color: rgba(212, 164, 92, 0.3);
}
.planning-history-summary-card.is-danger {
  border-color: rgba(226, 107, 107, 0.3);
}
.planning-history-summary-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.planning-history-summary-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}
.planning-history-summary-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  display: block;
  font-family: var(--font-mono);
  font-feature-settings: 'tnum' 1;
}
.planning-history-summary-detail {
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 2px;
}

.planning-history-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.planning-history-item {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-3);
}
.planning-history-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-2);
  margin-bottom: 4px;
}
.planning-history-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.planning-history-item-date {
  font-size: 11px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.planning-history-item-summary {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.4;
}
.planning-history-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--s-2);
}
.planning-history-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--s-2);
}

/* --- Mobile planning day card --- */
.planning-day-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-3);
  margin-bottom: var(--s-2);
}
.planning-day-card.is-weekend {
  background: var(--bg-2);
}
.planning-day-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
}
.planning-day-card-head h3 {
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
}
.planning-day-kicker {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}
.planning-day-shifts {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.planning-shift-card {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  padding: var(--s-2);
}
.planning-shift-card.is-empty {
  opacity: 0.6;
}
.planning-shift-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
}
.planning-shift-card-head strong {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
  font-weight: 600;
}
.empty-shift {
  font-size: 11px;
  color: var(--ink-faint);
  font-style: italic;
  text-align: center;
  padding: var(--s-2) 0;
}
.mobile-slot-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* --- Unavailability cards --- */
.unavailability-card {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.unavailability-card .card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-2);
  margin: 0;
}
.unavailability-card .card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.unavailability-card .card-meta {
  font-size: 11.5px;
  color: var(--ink-muted);
  margin-top: 2px;
}
.unavailability-card .card-notes {
  font-size: 12px;
  color: var(--ink-2);
  background: var(--bg-2);
  padding: var(--s-2);
  border-radius: var(--r-sm);
}
.unavailability-card .card-footer {
  font-size: 11px;
  color: var(--ink-soft);
}
.unavailability-card .card-actions {
  display: flex;
  gap: var(--s-3);
  justify-content: flex-end;
}

/* --- Quick unavailability intake --- */
.quick-unavailability {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-4);
  margin-bottom: var(--s-4);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
}
.quick-unavailability-head {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
}
.quick-unavailability textarea {
  min-height: 96px;
  resize: vertical;
}
.quick-unavailability-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: center;
}
.quick-unavailability-results {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.quick-unavailability-proposal {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--s-3);
  align-items: start;
  padding: var(--s-3);
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
}
.quick-unavailability-proposal.is-invalid {
  border-color: rgba(226, 107, 107, 0.35);
}
.quick-unavailability-proposal.is-duplicate {
  opacity: 0.72;
}
.quick-unavailability-check {
  margin-top: 3px;
}
.quick-unavailability-main {
  min-width: 0;
}
.quick-unavailability-title {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: baseline;
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
}
.quick-unavailability-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-1);
  color: var(--ink-muted);
  font-size: 11.5px;
}
.quick-unavailability-source {
  margin: var(--s-2) 0 0;
  color: var(--ink-soft);
  font-size: 11.5px;
}
.quick-unavailability-warnings {
  margin: var(--s-2) 0 0;
  padding-left: var(--s-4);
  color: var(--warning);
  font-size: 11.5px;
}
.quick-unavailability-result-actions {
  display: flex;
  justify-content: flex-end;
}
@media (max-width: 768px) {
  .quick-unavailability {
    padding: var(--s-3);
  }
  .quick-unavailability-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .quick-unavailability-actions .btn {
    width: 100%;
  }
  .quick-unavailability-actions #unavailability-quick-create {
    grid-column: 1 / -1;
  }
  .quick-unavailability-proposal {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .quick-unavailability-result-actions {
    grid-column: 1 / -1;
  }
  .quick-unavailability-result-actions .btn {
    width: 100%;
  }
}

/* --- Grouped unavailability list (par employé) --- */
.unavailability-group {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.unavailability-group-head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  cursor: pointer;
  list-style: none;
}
.unavailability-group-head::-webkit-details-marker {
  display: none;
}
.unavailability-group-head .unavailability-group-name {
  flex: 1;
}
.unavailability-group[open] .drawer-chevron {
  transform: rotate(180deg);
}
.unavailability-group-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}
.unavailability-group-count {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}
.unavailability-group-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.unavailability-row {
  background: var(--bg-2);
  border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}
.unavailability-row-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}
.unavailability-row-range {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.unavailability-row-period {
  font-size: 11.5px;
  color: var(--ink-muted);
}
.unavailability-row-notes {
  font-size: 12px;
  color: var(--ink-2);
  padding-left: var(--s-2);
  border-left: 2px solid var(--border-soft);
}
.unavailability-row-actions {
  display: flex;
  gap: var(--s-3);
  justify-content: flex-end;
}
.unavailability-hidden-notice {
  font-size: 11.5px;
  color: var(--ink-muted);
  background: var(--bg-2);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  margin: 0 0 var(--s-3) 0;
}

/* --- Employees table cell content --- */
.cell-title {
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
}
.cell-subtitle {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 2px;
}

/* =====================================================================
 * Dashboard view
 * ===================================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-areas:
    "kpis kpis"
    "days imports"
    "days products";
  gap: var(--s-4);
  align-items: start;
}
.dashboard-kpis {
  grid-area: kpis;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-3);
}
.dashboard-kpi {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-xl);
  padding: var(--s-4) var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.dashboard-kpi .kpi-eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}
.dashboard-kpi .kpi-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.dashboard-kpi .kpi-delta {
  color: var(--ink-soft);
}
.dashboard-kpi .kpi-delta.is-positive {
  color: var(--success);
}
.dashboard-kpi .kpi-delta.is-negative {
  color: var(--danger);
}

.dashboard-imports {
  grid-area: imports;
}
.dashboard-import-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.dashboard-import-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: var(--s-3);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 120ms;
}
.dashboard-import-row:hover {
  background: var(--surface-3);
}
.dashboard-import-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.dashboard-import-row input[type="file"] {
  font-size: 11px;
  color: var(--ink-soft);
  cursor: pointer;
  margin-top: 4px;
  border: 0;
  padding: 0;
  background: transparent;
}
.dashboard-import-row input[type="file"]::file-selector-button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 4px 10px;
  margin-right: var(--s-2);
  color: var(--ink-2);
  font-size: 11px;
  cursor: pointer;
}
.dashboard-import-row input[type="file"]::file-selector-button:hover {
  background: var(--surface-2);
}
.dashboard-import-row .muted.is-ready {
  color: var(--success);
}
.dashboard-import-row .muted.is-error {
  color: var(--danger);
}

.dashboard-days {
  grid-area: days;
}
.dashboard-days-table .num-col {
  text-align: right;
  white-space: nowrap;
}
.dashboard-days-table tr.is-weekend td {
  background: var(--bg-2);
}

.dashboard-products {
  grid-area: products;
}
.dashboard-top-products {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.dashboard-top-product {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--s-3);
  align-items: center;
  padding: var(--s-2) var(--s-3);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
}
.dashboard-top-product-rank {
  font-size: 11px;
  color: var(--ink-soft);
  font-weight: 500;
  width: 18px;
  text-align: center;
}
.dashboard-top-product-name {
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
}
.dashboard-top-product-meta {
  margin-top: 2px;
}
.dashboard-top-product-stats {
  text-align: right;
  font-size: 12px;
  color: var(--ink);
}

/* Dashboard responsive — collapse the grid on tablet/mobile */
@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "kpis"
      "imports"
      "days"
      "products";
  }
  .dashboard-kpis {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 540px) {
  .dashboard-kpis {
    grid-template-columns: 1fr;
  }
}

/* =====================================================================
 * A11y / focus polish
 * ===================================================================== */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ============= Registre ============= */
.registry-home {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 16px;
}

.registry-section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.registry-section-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.registry-count {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-muted);
  margin-left: 6px;
}

.registry-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background-color: var(--border-soft);
  border-radius: var(--r-md);
  overflow: hidden;
}

.registry-item {
  background-color: var(--surface);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.registry-item-title {
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
}

.registry-item-meta {
  font-size: 11.5px;
  color: var(--ink-muted);
  display: flex;
  gap: 8px;
}

.registry-item-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.registry-item-actions button {
  flex: 1;
  font-size: 12px;
  height: 30px;
}

.registry-late-soft { color: var(--warning); font-weight: 500; }
.registry-late-hard { color: var(--danger); font-weight: 600; }

/* Toast undo */
.registry-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--surface-3);
  color: var(--ink);
  padding: 12px 20px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  font-size: 13px;
}

.registry-toast button {
  background: none;
  border: none;
  color: var(--accent-2);
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}

/* Dialogs */
.registry-dialog {
  border: 1px solid var(--border);
  background-color: var(--surface);
  color: var(--ink);
  border-radius: var(--r-lg);
  padding: 20px;
  max-width: 420px;
  width: 90%;
}

.registry-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.5);
}

.registry-dialog h3 {
  margin-top: 0;
  margin-bottom: 16px;
}

.registry-dialog fieldset {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px;
  margin: 12px 0;
}

.registry-dialog menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.registry-dialog fieldset legend {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 4px;
}

.registry-dialog .radio-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}

.registry-dialog .radio-row input[type='radio'] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Mobile: ordre Brouillons en bas (déjà dans le HTML) ; desktop: bascule via media query */
@media (min-width: 1100px) {
  .registry-home {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 24px;
  }
  /* Sur desktop, on remonte les brouillons en tête de la colonne gauche */
  .registry-drafts { order: -1; }
}

.registry-detail {
  background-color: var(--surface);
  border-radius: var(--r-md);
  padding: 16px;
  margin: 16px;
}

.registry-detail header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.registry-detail-meta {
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 12px;
}

.registry-detail-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.registry-detail-notes {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.registry-detail-note {
  background-color: var(--surface-2);
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
}

.registry-detail-note time {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  display: block;
}

/* Steps section in detail aside (Task 15) */
.steps-section { margin-top: 18px; }
.steps-section .section-title { font-size: 12px; opacity: .65; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.steps-section .steps-list { list-style: none; padding: 0; margin: 0 0 6px; }

.step-card {
    background: rgba(99,102,241,.04);
    border: 1px solid rgba(99,102,241,.15);
    border-radius: 8px; padding: 10px 12px; margin-bottom: 6px;
    position: relative;
    display: flex; gap: 8px; align-items: flex-start;
}
.step-card.inactive { opacity: .55; }
.step-card .step-handle {
    cursor: grab; opacity: .35; font-size: 14px; padding-top: 2px;
}
.step-card .step-num {
    display: inline-block; background: var(--accent, #7c70ff);
    color: white; min-width: 22px; height: 22px; border-radius: 11px;
    line-height: 22px; text-align: center; font-size: 11px;
    font-weight: 600;
}
.step-card .step-body { flex: 1; min-width: 0; }
.step-card .step-titre { font-size: 13px; font-weight: 500; }
.step-card .step-desc { font-size: 12px; opacity: .75; margin-top: 4px; }
.step-card .step-meta { font-size: 10px; opacity: .55; margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.step-card .step-actions {
    display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px;
}
.step-card .step-actions button {
    padding: 3px 8px; border-radius: 4px; font-size: 10px; cursor: pointer;
    background: transparent; border: 1px solid rgba(255,255,255,.15);
    color: inherit;
}
.step-card .step-actions button.danger {
    color: #ef4444; border-color: rgba(239,68,68,.3);
}
.step-card .badge-inactive {
    display: inline-block; padding: 1px 6px; border-radius: 8px;
    background: rgba(239,68,68,.15); color: #ef4444; font-size: 9px; margin-left: 6px;
}

.add-step-btn {
    width: 100%; padding: 10px; border: 1px dashed rgba(255,255,255,.18);
    border-radius: 8px; text-align: center; cursor: pointer; opacity: .8;
    font-size: 13px; background: transparent; color: inherit; margin-top: 4px;
}
.add-step-btn:hover { opacity: 1; border-color: var(--accent, #7c70ff); color: var(--accent, #7c70ff); }

.chip {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  cursor: pointer;
}
.chip.on {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.registry-filters-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }

/* Recurrence switcher (Registre — éditeur Action) */
.recurrence-switcher { display: flex; gap: 6px; flex-wrap: wrap; }
.recurrence-switcher .pill {
    padding: 4px 10px; border-radius: 14px; font-size: 11px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    cursor: pointer;
    color: inherit;
    /* Override global .pill: no dot, auto height */
    height: auto;
    font-weight: 500;
}
.recurrence-switcher .pill::before {
    display: none;
}
.recurrence-switcher .pill.active {
    background: var(--accent-indigo, #6366f1); color: white;
    border-color: var(--accent-indigo, #6366f1);
}
.recurrence-extra { margin-top: 6px; font-size: 12px; opacity: .9; }
.recurrence-extra label { margin-right: 8px; }

/* ===================================================================
 * Tasks 16-19 — Home procedure rows + drilldown + drag-drop + filter
 * =================================================================== */

/* Home procedure cards: indigo accent border, badges, recurrence label */
.registry-item.is-procedure {
    border-left: 3px solid var(--accent, #7c70ff);
    padding-left: 9px;
}
.registry-item.is-procedure .badge-pill {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 6px;
    vertical-align: middle;
}
.registry-item.is-procedure .badge-pill.due {
    background: var(--accent, #7c70ff);
    color: white;
}
.registry-item.is-procedure .badge-pill.warn {
    background: rgba(245, 158, 11, .2);
    color: #f59e0b;
}
.registry-item-recurrence {
    font-size: 11px;
    color: var(--accent-2, #9b91ff);
    font-style: italic;
}
.registry-item.is-procedure .btn-primary-mini {
    background: var(--accent, #7c70ff);
    color: white;
    border: none;
    flex: 1;
    height: 30px;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--r-sm);
    cursor: pointer;
}
.registry-item.is-procedure .btn-primary-mini:hover {
    background: var(--accent-2, #9b91ff);
}

/* Drag-drop visual */
.step-card.dragging { opacity: .4; }

/* Type filter (small select in topbar) */
.registry-type-filter {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    font-size: 12px;
}
.registry-type-filter select {
    background: var(--surface-2, #1a1a1e);
    border: 1px solid var(--border, #27272a);
    color: var(--ink, #fafafa);
    border-radius: var(--r-sm, 6px);
    padding: 6px 8px;
    font-size: 12px;
    cursor: pointer;
}

/* Drill-down panel — fixed sidebar on desktop, fullscreen on mobile */
.drilldown-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(440px, 100vw);
    background: var(--surface, #141417);
    border-left: 1px solid var(--border, rgba(255, 255, 255, .08));
    display: flex;
    flex-direction: column;
    z-index: 60;
    transform: translateX(100%);
    transition: transform .2s ease;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.3);
}
.drilldown-panel.open {
    transform: translateX(0);
}
.drilldown-panel:not(.open) {
    pointer-events: none;
}
.drilldown-header {
    padding: 14px;
    border-bottom: 1px solid var(--border-soft, rgba(255, 255, 255, .06));
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.drilldown-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}
.drilldown-header button#registry-drilldown-close {
    align-self: flex-start;
    background: none;
    border: none;
    color: var(--ink, #fafafa);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    margin-bottom: 4px;
}
.drilldown-meta {
    font-size: 12px;
    color: var(--ink-muted, #a1a1aa);
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.drilldown-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
}
.drilldown-footer {
    padding: 14px;
    border-top: 1px solid var(--border-soft, rgba(255, 255, 255, .06));
}
.drilldown-footer .btn-block {
    width: 100%;
}
.drilldown-footer .empty-state {
    text-align: center;
    font-size: 12px;
    opacity: .6;
}

/* Step lines in drilldown (distinct from .step-card in detail aside) */
.step-line {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, .02);
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 13px;
}
.step-line.due {
    background: rgba(124, 112, 255, .06);
    border: 1px solid rgba(124, 112, 255, .2);
}
.step-line.locked { opacity: .45; }
.step-line.inactive { opacity: .3; }
.step-line .step-titre {
    flex: 1;
    min-width: 0;
}
.step-line .step-meta {
    font-size: 10px;
    opacity: .6;
    margin-top: 2px;
}
.step-line .step-eval-buttons {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.step-line .step-eval-buttons button {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .15);
    color: inherit;
}
.step-line .step-eval-buttons button.tient {
    color: #10b981;
    border-color: rgba(16, 185, 129, .3);
}
.step-line .step-eval-buttons button.glisse {
    color: #f59e0b;
    border-color: rgba(245, 158, 11, .3);
}
.step-line .step-eval-buttons button.recadrer {
    color: #ef4444;
    border-color: rgba(239, 68, 68, .3);
}
.step-line .badge-pill {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 4px;
    vertical-align: middle;
}
.step-line .badge-pill.warn {
    background: rgba(239, 68, 68, .15);
    color: #ef4444;
}

@media (max-width: 768px) {
    .drilldown-panel { width: 100vw; }
}

/* =====================================================================
 * Cockpit Jour (mobile-first day view)
 * ===================================================================== */
.cockpit-jour-tab {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}
.cockpit-jour-tab .cj-header {
  display: flex; justify-content: space-between; align-items: center;
}
.cockpit-jour-tab .cj-date {
  font-size: 18px; font-weight: 600; margin: 0;
  text-transform: capitalize;
}
.cockpit-jour-tab .cj-refresh-btn {
  display: inline-flex; gap: 6px; align-items: center;
  padding: 6px 12px; border-radius: var(--r-md, 6px);
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border, rgba(255,255,255,.1));
  color: inherit; cursor: pointer; font-size: 12px;
}
.cockpit-jour-tab .cj-refresh-btn:hover { background: rgba(255,255,255,.08); }

.cockpit-jour-tab .cj-section {
  background: var(--surface, rgba(255,255,255,.02));
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: var(--r-md, 8px);
  padding: 14px;
}
.cockpit-jour-tab .cj-section-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px; opacity: .65; margin: 0 0 10px 0;
}
.cockpit-jour-tab .cj-empty {
  font-size: 13px; opacity: .55; margin: 0;
}
.cockpit-jour-tab .cj-empty-success {
  font-size: 14px; color: #10b981; margin: 0;
  font-weight: 500;
}

/* Recap hier */
.cockpit-jour-tab .cj-recap-counts {
  display: flex; gap: 12px; align-items: baseline; font-size: 13px;
  margin-bottom: 8px;
}
.cockpit-jour-tab .cj-recap-total { font-weight: 600; }
.cockpit-jour-tab .cj-eval-tient { color: #10b981; }
.cockpit-jour-tab .cj-eval-glisse { color: #f59e0b; }
.cockpit-jour-tab .cj-eval-a_recadrer { color: #ef4444; }
.cockpit-jour-tab .cj-recap-actions {
  list-style: none; padding: 0; margin: 0;
  font-size: 12px; line-height: 1.7;
}
.cockpit-jour-tab .cj-recap-actions li { opacity: .85; }
.cockpit-jour-tab .cj-recap-more {
  margin: 6px 0 0; font-size: 11px; opacity: .55;
}

/* Équipe */
.cockpit-jour-tab .cj-team-item {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 6px 0; font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.cockpit-jour-tab .cj-team-item:last-child { border-bottom: 0; }
.cockpit-jour-tab .cj-team-name { font-weight: 500; }
.cockpit-jour-tab .cj-team-shift { font-size: 11px; opacity: .6; }
.cockpit-jour-tab .cj-team-interim-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border-radius: 4px;
  vertical-align: middle;
}
.cockpit-jour-tab .cj-planning-warning {
  background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.3);
  color: #f59e0b; padding: 8px 10px; border-radius: 6px; font-size: 12px;
  margin: 0 0 10px 0;
}
.cockpit-jour-tab .cj-planning-info {
  background: rgba(255,255,255,.04); padding: 8px 10px; border-radius: 6px;
  font-size: 12px; opacity: .7; margin: 0 0 10px 0;
}

/* À vérifier */
.cockpit-jour-tab .cj-due-item {
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 8px;
}
.cockpit-jour-tab .cj-due-item:last-child { margin-bottom: 0; }
.cockpit-jour-tab .cj-due-item.is-procedure {
  border-left: 3px solid var(--accent, #7c70ff);
}
.cockpit-jour-tab .cj-due-item.is-note {
  border-left: 3px solid #f59e0b;
}
.cockpit-jour-tab .cj-due-head {
  display: flex; gap: 8px; align-items: center; font-size: 13px;
  flex-wrap: wrap;
}
.cockpit-jour-tab .cj-due-icon { font-size: 14px; }
.cockpit-jour-tab .cj-due-titre { font-weight: 500; flex: 1; min-width: 0; }
.cockpit-jour-tab .cj-due-badge {
  background: var(--accent, #7c70ff); color: white;
  padding: 2px 6px; border-radius: 8px; font-size: 9px;
  font-weight: 600; text-transform: uppercase;
}
.cockpit-jour-tab .cj-badge-warn {
  background: rgba(245,158,11,.2); color: #f59e0b;
  padding: 2px 6px; border-radius: 8px; font-size: 9px;
  font-weight: 600; text-transform: uppercase;
}
.cockpit-jour-tab .cj-due-meta {
  font-size: 10px; opacity: .55; margin-top: 4px;
}
.cockpit-jour-tab .cj-due-actions {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px;
}
.cockpit-jour-tab .cj-btn-primary {
  background: var(--accent, #7c70ff); color: white;
  border: 1px solid var(--accent, #7c70ff);
  padding: 6px 12px; border-radius: 6px; font-size: 12px;
  cursor: pointer; font-weight: 500;
}
.cockpit-jour-tab .cj-btn-secondary {
  background: transparent;
  border: 1px solid var(--border, rgba(255,255,255,.15));
  color: inherit;
  padding: 6px 12px; border-radius: 6px; font-size: 12px;
  cursor: pointer;
}
.cockpit-jour-tab .cj-btn-eval {
  background: transparent; padding: 5px 10px; border-radius: 6px;
  font-size: 11px; cursor: pointer;
}
.cockpit-jour-tab .cj-btn-tient {
  color: #10b981; border: 1px solid rgba(16,185,129,.3);
}
.cockpit-jour-tab .cj-btn-glisse {
  color: #f59e0b; border: 1px solid rgba(245,158,11,.3);
}
.cockpit-jour-tab .cj-btn-recadrer {
  color: #ef4444; border: 1px solid rgba(239,68,68,.3);
}

/* En cours */
.cockpit-jour-tab .cj-in-progress-count {
  font-size: 14px; font-weight: 500; margin: 0 0 8px 0;
}

/* Toast undo (positioned outside the cockpit-jour-tab scope) */
.cj-toast {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(150%);
  background: var(--surface-elevated, #1a1d24);
  color: var(--text, white);
  padding: 10px 16px; border-radius: 8px;
  display: flex; gap: 12px; align-items: center;
  border: 1px solid rgba(255,255,255,.1);
  font-size: 13px; z-index: 100;
  transition: transform .2s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.cj-toast--show { transform: translateX(-50%) translateY(0); }
.cj-toast-undo {
  background: transparent; border: 1px solid rgba(255,255,255,.2);
  color: inherit; padding: 4px 10px; border-radius: 4px;
  cursor: pointer; font-size: 11px;
}

@media (max-width: 768px) {
  .cockpit-jour-tab { padding: 12px; max-width: 100%; gap: 12px; }
}

/* Bottom-nav 8 items — labels masqués sur écrans très étroits */
@media (max-width: 360px) {
  .bottom-nav-item span { display: none; }
}

/* === Vols (flights) === */
.flights-tab {
  display: flex; flex-direction: column; gap: 16px;
  max-width: 960px; margin: 0 auto; padding: 16px;
}
.flights-tab .flights-upload-btn {
  background: var(--accent, #7c70ff); color: white;
  border: 1px solid var(--accent, #7c70ff);
  padding: 6px 14px; border-radius: 6px; cursor: pointer;
  font-size: 13px; font-weight: 500;
}

.flights-tab .flights-section {
  background: var(--surface, rgba(255,255,255,.02));
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: var(--r-md, 8px);
  padding: 14px;
}
.flights-tab .flights-section-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px; opacity: .65; margin: 0 0 12px 0;
}

/* Toast (fixed-positioned, outside .flights-tab) */
.flights-toast {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(150%);
  background: var(--surface-elevated, #1a1d24);
  color: var(--text, white);
  padding: 10px 16px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.1);
  font-size: 13px; z-index: 100;
  transition: transform .2s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.flights-toast--show { transform: translateX(-50%) translateY(0); }
.flights-toast--error {
  background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.4);
  color: #fca5a5;
}

@media (max-width: 768px) {
  .flights-tab { padding: 12px; }
}

/* --- Vols : vue mensuelle (refonte 2026-05-16) --- */
.flights-tab .flights-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.flights-tab .flights-title {
  font-size: 18px;
  margin: 0;
}

.flights-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--s-2);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-3);
  margin-bottom: var(--s-4);
  overflow-x: auto;
}
.flights-day-content,
.flights-day-empty {
  background: var(--bg-2);
  border-radius: var(--r-sm);
  padding: var(--s-2);
  cursor: pointer;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.flights-day-content:hover,
.flights-day-empty:hover {
  background: var(--surface-3);
}
.flights-day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-1);
}
.flights-day-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.flights-day-count {
  font-size: 11px;
  color: var(--ink-muted);
}
.flights-day-hours {
  font-size: 11px;
  color: var(--ink-soft);
  margin: var(--s-1) 0;
}
.flights-day-placeholder {
  font-size: 11px;
  color: var(--ink-soft);
  font-style: italic;
}
.flights-sparkline {
  display: grid;
  grid-template-columns: repeat(19, 1fr);
  gap: 1px;
  height: 24px;
  align-items: end;
}
.flights-sparkline-bar {
  background: rgba(99, 102, 241, 0.6);
  border-radius: 1px 1px 0 0;
  min-height: 1px;
}

.flights-day-detail {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-4);
  margin-bottom: var(--s-4);
}
.flights-detail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
  flex-wrap: wrap;
}
.flights-detail-head h3 {
  margin: 0;
  font-size: 15px;
}
.flights-detail-chips {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}
.flights-chip {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--bg-2);
  border-radius: var(--r-sm);
  color: var(--ink-muted);
}
.flights-detail-bars {
  display: grid;
  grid-template-columns: repeat(19, 1fr);
  gap: 2px;
  height: 140px;
  align-items: end;
  margin-bottom: var(--s-3);
  overflow-x: auto;
}
.flights-detail-col {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 1px;
  height: 100%;
}
.flights-detail-bar {
  flex: 1;
  border-radius: 2px 2px 0 0;
  min-height: 1px;
}
.flights-detail-bar.pax { background: rgba(99,102,241,0.7); }
.flights-detail-bar.eff { background: rgba(34,197,94,0.7); }
.flights-detail-label {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--ink-soft);
}
.flights-detail-legend {
  display: flex;
  gap: var(--s-3);
  margin-top: var(--s-3);
  font-size: 11px;
  color: var(--ink-muted);
}
.flights-detail-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.flights-detail-legend .legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}
.flights-detail-legend .legend-dot.pax { background: rgba(99,102,241,0.7); }
.flights-detail-legend .legend-dot.eff { background: rgba(34,197,94,0.7); }

.flights-weekday-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  overflow: hidden;
  font-size: 12.5px;
}
.flights-weekday-table thead th {
  text-align: left;
  padding: var(--s-2) var(--s-3);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--border-soft);
}
.flights-weekday-table tbody td {
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.flights-weekday-table tbody tr.is-selected-weekday {
  background: rgba(99,102,241,0.08);
}

/* Histogramme horizontal pax par tranche d'heure (Vols, jour sélectionné) */
.flights-pax-histogram { display: flex; flex-direction: column; gap: 4px; }
.flights-pax-head { padding-bottom: var(--s-3); }
.flights-pax-row {
  display: grid;
  grid-template-columns: 48px 1fr 64px;
  gap: var(--s-3);
  align-items: center;
  font-size: 12px;
}
.flights-pax-hour {
  color: var(--ink-muted);
  font-family: var(--font-mono, monospace);
  font-feature-settings: "tnum" 1;
}
.flights-pax-track {
  display: block;
  position: relative;
  height: 14px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.flights-pax-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-sm);
  transition: width 200ms ease-out;
}
.flights-pax-value {
  text-align: right;
  font-family: var(--font-mono, monospace);
  font-feature-settings: "tnum" 1;
}

/* Heures réelles mois — badges Δ + label mois */
.hours-delta { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: 11px; font-weight: 600; }
.hours-delta--ok { background: rgba(16,185,129,.15); color: #10b981; }
.hours-delta--warn { background: rgba(245,158,11,.15); color: #f59e0b; }
.hours-delta--bad { background: rgba(239,68,68,.15); color: #ef4444; }
.hours-delta--neutral { opacity: .5; }
.employees-month-context { font-size: 11px; opacity: .65; margin-bottom: 6px; text-transform: capitalize; }

/* === Intérim === */
.interim-tab {
  display: flex; flex-direction: column; gap: 16px;
  max-width: 960px; margin: 0 auto; padding: 16px;
}
.interim-tab .interim-header {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  justify-content: space-between;
}
.interim-tab .interim-title { font-size: 18px; font-weight: 600; margin: 0; }
.interim-tab .interim-month-label { font-size: 13px; opacity: 0.7; text-transform: capitalize; }
.interim-tab .interim-upload-btn {
  background: var(--accent, #7c70ff); color: white;
  border: 1px solid var(--accent, #7c70ff);
  padding: 6px 14px; border-radius: 6px; cursor: pointer;
  font-size: 13px; font-weight: 500;
}
.interim-tab .interim-section {
  background: var(--surface, rgba(255,255,255,.02));
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 8px; padding: 14px;
}
.interim-tab .interim-section-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; opacity: 0.65; margin: 0 0 12px 0;
}
.interim-tab .interim-empty { font-size: 13px; opacity: 0.55; margin: 0; }
.interim-tab .interim-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.interim-tab .interim-table th, .interim-tab .interim-table td {
  padding: 6px 8px; text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.interim-tab .interim-table th {
  font-size: 11px; opacity: 0.65; text-transform: uppercase; letter-spacing: 0.5px;
}
.interim-tab .interim-total {
  font-size: 12px; opacity: 0.65; margin: 10px 0 0; font-style: italic;
}

/* Badges intérim dans grille Planning et tab Équipe */
.slot-interim {
  border-left: 3px solid #f59e0b;
}
.interim-badge {
  display: inline-block; padding: 1px 6px; border-radius: 8px;
  font-size: 9px; font-weight: 600; text-transform: uppercase;
  background: rgba(245,158,11,0.15); color: #f59e0b;
  margin-left: 6px;
}

/* --- Charge tab : heatmap + détail jour --- */
.charge-tab .view-head h1 {
  font-size: 18px;
  margin: 0 0 4px;
}
.charge-tab .view-head .muted {
  margin: 0 0 var(--s-4);
}
.charge-table-wrapper {
  overflow-x: auto;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-3);
  margin-bottom: var(--s-4);
}
.charge-heatmap {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.charge-heatmap th {
  padding: var(--s-1) var(--s-2);
  text-align: center;
  font-weight: 500;
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-soft);
}
.charge-heatmap th.charge-day-header { text-align: left; padding-left: var(--s-2); }
.charge-heatmap td {
  padding: var(--s-1) var(--s-2);
  text-align: center;
  border: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
}
.charge-heatmap tr:hover td { background: rgba(255,255,255,0.02); }
.charge-day-cell {
  text-align: left !important;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}
.charge-cell { font-variant-numeric: tabular-nums; }
.charge-cell.tone-muted { background: rgba(255,255,255,0.03); color: var(--ink-soft); }
.charge-cell.tone-ok { background: rgba(34,197,94,0.18); color: #4ade80; }
.charge-cell.tone-balanced { background: rgba(234,179,8,0.18); color: #facc15; }
.charge-cell.tone-warning { background: rgba(245,158,11,0.22); color: #fb923c; }
.charge-cell.tone-error { background: rgba(239,68,68,0.28); color: #f87171; font-weight: 600; }

/* Détail jour : graphique en barres + totaux */
.charge-day-detail {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-4);
}
.charge-detail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.charge-detail-head h3 { margin: 0; font-size: 15px; }
.charge-totals { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.charge-total-chip {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--bg-2);
  border-radius: var(--r-sm);
  color: var(--ink-muted);
}
.charge-bars {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 2px;
  height: 120px;
  align-items: end;
  margin-bottom: var(--s-2);
}
.charge-bar-col {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 1px;
  height: 100%;
}
.charge-bar {
  flex: 1;
  border-radius: 2px 2px 0 0;
  min-height: 1px;
}
.charge-bar.pax { background: rgba(99,102,241,0.6); }
.charge-bar.eff { background: rgba(34,197,94,0.7); }
.charge-bar-label {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--ink-soft);
}
.charge-bars-legend {
  display: flex;
  gap: var(--s-3);
  margin-top: var(--s-3);
  font-size: 11px;
  color: var(--ink-muted);
}
.charge-bars-legend .legend-item { display: flex; align-items: center; gap: 4px; }
.charge-bars-legend .legend-dot {
  width: 10px; height: 10px; border-radius: 2px;
}
.charge-bars-legend .legend-dot.pax { background: rgba(99,102,241,0.7); }
.charge-bars-legend .legend-dot.eff { background: rgba(34,197,94,0.7); }

/* === Dashboard Vision instant T === */
.dashboard-vision {
  padding: var(--s-4);
}
.dashboard-vision-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
}
.dashboard-vision-grid.single {
  grid-template-columns: 1fr;
}
.dashboard-vision-col {
  background: var(--bg-2);
  border-radius: var(--r-sm);
  padding: var(--s-3);
}
.vision-col-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin: 0 0 var(--s-3) 0;
}
.vision-rows {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.vision-row {
  display: grid;
  grid-template-columns: 90px 1fr 80px;
  align-items: baseline;
  gap: var(--s-2);
  font-size: 13px;
}
.vision-label {
  color: var(--ink-muted);
  font-size: 11px;
  text-transform: uppercase;
}
.vision-values {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.vision-delta {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.delta-ok { color: #4ade80; }
.delta-warning { color: #f87171; }
.delta-muted { color: var(--ink-soft); }

/* === Dashboard Cumul charts === */
.dashboard-cumul-charts {
  padding: var(--s-4);
}
.dashboard-cumul-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
}
.cumul-chart {
  background: var(--bg-2);
  border-radius: var(--r-sm);
  padding: var(--s-3);
}
.cumul-chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
}
.cumul-chart-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin: 0;
}
.cumul-chart-totals {
  display: flex;
  gap: var(--s-2);
  align-items: center;
}
.cumul-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.cumul-chip.muted {
  color: var(--ink-soft);
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}
.legend-dot.actual { background: rgba(99, 102, 241, 0.9); }
.legend-dot.target { background: rgba(234, 179, 8, 0.8); }

.cumul-chart-svg {
  width: 100%;
  height: 110px;
  display: block;
}
.cumul-line {
  fill: none;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
.cumul-line.actual {
  stroke: rgba(99, 102, 241, 0.95);
}
.cumul-line.target {
  stroke: rgba(234, 179, 8, 0.85);
  stroke-dasharray: 3 2;
}

@media (max-width: 768px) {
  .dashboard-cumul-grid {
    grid-template-columns: 1fr;
  }
}

/* === Dashboard CA chart === */
.dashboard-ca-chart {
  padding: var(--s-4);
}
.ca-chart-body {
  padding-top: var(--s-2);
}
.ca-chart-cols {
  display: grid;
  grid-template-columns: repeat(31, 1fr);
  gap: 2px;
  height: 140px;
  align-items: end;
  position: relative;
}
.ca-chart-col {
  position: relative;
  height: 100%;
}
.ca-chart-bar {
  background: rgba(99, 102, 241, 0.7);
  border-radius: 2px 2px 0 0;
  min-height: 1px;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}
.ca-chart-target {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(234, 179, 8, 0.8);
}
.ca-chart-label {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--ink-soft);
}

/* === Dashboard weekday table === */
.dashboard-weekday {
  padding: var(--s-4);
}
.dashboard-weekday-table {
  width: 100%;
  font-size: 12.5px;
}
.dashboard-weekday-table tr.is-selected-weekday {
  background: rgba(99, 102, 241, 0.08);
}

/* =====================================================================
 * Products view
 * ===================================================================== */
.products-root { display: flex; flex-direction: column; gap: var(--s-4); }

.products-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-3);
}
.products-kpi {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-xl);
  padding: var(--s-4) var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.products-kpi .kpi-eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}
.products-kpi .kpi-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.products-kpi .kpi-delta { color: var(--ink-soft); }
.products-kpi .kpi-delta.is-positive { color: var(--success); }
.products-kpi .kpi-delta.is-negative { color: var(--danger); }

.products-categories-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s-4);
  align-items: start;
}
.products-donut svg { display: block; }
.products-categories-table { width: 100%; font-size: 13px; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }

.products-heatmap-table th, .products-heatmap-table td { padding: 4px 6px; font-size: 12px; }
.products-heatmap-table .heatmap-cat {
  text-align: left;
  font-weight: 500;
  color: var(--ink);
  background: var(--bg-2);
}
.products-heatmap-table .heatmap-cell { color: #fff; text-align: right; }

.products-rank-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
}
@media (max-width: 1100px) {
  .products-rank-row { grid-template-columns: 1fr; }
}
.products-rank-table { width: 100%; font-size: 13px; }
.products-rank-table th, .products-rank-table td { padding: 4px 8px; }

.waste-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.waste-badge.ok    { background: rgba(34,197,94,0.15);  color: #4ade80; }
.waste-badge.warn  { background: rgba(234,179,8,0.15);  color: #facc15; }
.waste-badge.alert { background: rgba(239,68,68,0.15);  color: #f87171; }

.margin-group-header td { background: var(--bg-2); padding-top: 8px; font-size: 12px; }

.products-subtabs {
  display: flex;
  gap: var(--s-2);
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: var(--s-2);
  margin-bottom: var(--s-4);
}
.products-subtab {
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--ink-soft);
  font-family: inherit;
}
.products-subtab:hover { color: var(--ink); }
.products-subtab.is-active {
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 500;
}

.products-by-category {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
}
.by-category-card {
  background: var(--bg-2);
  border-radius: var(--r-md);
  padding: var(--s-3);
}
.by-category-card h4 {
  margin: 0 0 var(--s-2) 0;
  font-size: 13px;
  color: var(--ink);
}
.by-category-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
}
.by-category-tables h5 {
  margin: 0 0 4px 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.by-category-tables table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}
.by-category-tables td {
  padding: 2px 4px;
}

@media (max-width: 1100px) {
  .products-kpis { grid-template-columns: repeat(2, 1fr); }
  .products-categories-grid { grid-template-columns: 1fr; }
  .products-by-category { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .by-category-tables { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .products-kpis { grid-template-columns: 1fr; }
}

/* =====================================================================
 * Suivi pro
 * ===================================================================== */
.suivi-pro-subtabs {
  display: flex;
  gap: var(--s-2);
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: var(--s-2);
  margin-bottom: var(--s-4);
}
.suivi-pro-subtab {
  background: transparent; border: 0; cursor: pointer;
  padding: 6px 14px; border-radius: var(--r-md);
  font-size: 13px; color: var(--ink-soft); font-family: inherit;
}
.suivi-pro-subtab:hover { color: var(--ink); }
.suivi-pro-subtab.is-active {
  background: var(--surface-2); color: var(--ink); font-weight: 500;
}

.suivi-pro-late {
  background: rgba(239,68,68,0.10);
  border: 1px solid rgba(239,68,68,0.30);
  border-radius: var(--r-md);
  padding: var(--s-3);
  margin-bottom: var(--s-4);
  color: #f87171;
}
.suivi-pro-late strong { font-size: 13px; }
.suivi-pro-late-list { list-style: none; padding: 0; margin: var(--s-2) 0 0; }
.suivi-pro-late-item {
  display: flex; align-items: center; gap: var(--s-2);
  padding: 4px 0; color: var(--ink);
}
.suivi-pro-late-label { font-weight: 500; }

.suivi-pro-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-3); margin-bottom: var(--s-3);
}
.suivi-pro-card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: var(--s-2);
}
.suivi-pro-progress {
  color: var(--ink-soft); font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.suivi-pro-items { list-style: none; padding: 0; margin: 0; }
.suivi-pro-item {
  display: flex; align-items: center; gap: var(--s-2);
  padding: 6px 0; border-bottom: 1px solid var(--border-soft);
}
.suivi-pro-item:last-child { border-bottom: 0; }
.suivi-pro-check {
  width: 22px; height: 22px; border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-2); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--ink);
}
.suivi-pro-check.is-done {
  background: rgba(34,197,94,0.15);
  border-color: rgba(34,197,94,0.5);
  color: #4ade80;
}
.suivi-pro-label.is-done { text-decoration: line-through; color: var(--ink-soft); }
.suivi-pro-skip {
  background: transparent; border: 0; cursor: pointer;
  color: var(--ink-soft); padding: 0 6px; font-size: 14px;
}
.suivi-pro-skip:hover { color: var(--danger); }

.suivi-pro-templates-head { margin-bottom: var(--s-3); }
.suivi-pro-add-btn {
  background: var(--accent); color: white; border: 0;
  padding: 8px 16px; border-radius: var(--r-md); cursor: pointer;
  font-family: inherit; font-size: 13px;
}
.suivi-pro-template-list { display: flex; flex-direction: column; gap: var(--s-3); }
.suivi-pro-template-card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-md); padding: var(--s-3);
}
.suivi-pro-template-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: var(--s-2); margin-bottom: var(--s-2);
}
.suivi-pro-template-actions button {
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 4px 10px; cursor: pointer;
  font-family: inherit; font-size: 12px; color: var(--ink);
}
.suivi-pro-template-delete { color: var(--danger); }
.suivi-pro-template-items {
  list-style: disc; padding-left: var(--s-4); margin: 0;
  font-size: 13px; color: var(--ink);
}

.suivi-pro-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.suivi-pro-modal-body {
  background: var(--surface); border-radius: var(--r-md);
  padding: var(--s-4); max-width: 480px; width: 90%;
  display: flex; flex-direction: column; gap: var(--s-3);
}
.suivi-pro-modal-body h3 { margin: 0; }
.suivi-pro-modal-body label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: var(--ink-soft);
}
.suivi-pro-modal-body input,
.suivi-pro-modal-body select,
.suivi-pro-modal-body textarea {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 6px 10px;
  font-family: inherit; color: var(--ink);
}
.suivi-pro-modal-actions {
  display: flex; justify-content: flex-end; gap: var(--s-2);
}
.suivi-pro-modal-actions button {
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 6px 14px; cursor: pointer;
  font-family: inherit; color: var(--ink);
}
.suivi-pro-modal-actions .primary {
  background: var(--accent); color: white; border-color: var(--accent);
}

/* Champ jour contextuel + items builder dans la modale */
.sp-day-label {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.sp-day-chips {
  display: flex; gap: 6px;
  margin-top: 4px;
}
.sp-day-chip {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--ink-soft);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}
.sp-day-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.sp-day-hint {
  display: block;
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 4px;
}

.sp-items-label {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.sp-items-builder {
  display: flex; flex-direction: column; gap: var(--s-2);
}
.sp-item-add-row {
  display: flex; gap: var(--s-2);
}
.sp-item-add-row input {
  flex: 1;
}
.sp-item-add-btn {
  background: var(--accent); color: white;
  border: 0; border-radius: var(--r-sm);
  padding: 6px 14px; cursor: pointer;
  font-family: inherit; font-weight: 500;
}
.sp-items-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 4px;
  max-height: 240px; overflow-y: auto;
}
.sp-item-row {
  display: flex; align-items: center; gap: var(--s-2);
  padding: 6px 10px;
  background: var(--bg-2);
  border-radius: var(--r-sm);
  font-size: 13px;
}
.sp-item-label { flex: 1; color: var(--ink); }
.sp-item-remove {
  background: transparent; border: 0;
  color: var(--ink-soft); cursor: pointer;
  padding: 0 4px; font-size: 14px;
}
.sp-item-remove:hover { color: var(--danger); }
.sp-items-empty {
  color: var(--ink-soft);
  font-size: 12px;
  padding: var(--s-2);
}

/* =====================================================================
 * Suivi P&L (Spec 2026-05-21)
 * ===================================================================== */

.pnl-subtabs {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-6) 0;
  border-bottom: 1px solid var(--border-soft);
}

.pnl-subtab {
  background: transparent;
  border: none;
  padding: var(--s-3) var(--s-4);
  color: var(--ink-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  font-weight: 500;
}

.pnl-subtab.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.pnl-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-7);
  text-align: center;
  cursor: pointer;
  transition: border-color 120ms, background 120ms;
  margin-bottom: var(--s-5);
}

.pnl-dropzone:hover,
.pnl-dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--surface-2);
}

.pnl-snapshot-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pnl-snapshot-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-4);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  margin-bottom: var(--s-3);
}

.pnl-snapshot-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pnl-snapshot-actions {
  display: flex;
  gap: var(--s-2);
}

.pnl-month-head {
  padding: var(--s-5) var(--s-6) var(--s-4);
}

.pnl-section {
  padding: 0 var(--s-6) var(--s-4);
}

.pnl-section > summary {
  cursor: pointer;
  padding: var(--s-3) 0;
  font-weight: 600;
}

.pnl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pnl-table th,
.pnl-table td {
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--border-soft);
}

.pnl-table th {
  font-weight: 500;
  color: var(--ink-muted);
  text-align: left;
}

.pnl-table .num {
  text-align: right;
  font-family: var(--font-mono, monospace);
  font-feature-settings: "tnum" 1;
}

.pnl-kpi-row {
  font-weight: 600;
  background: var(--surface-2);
}

.pnl-var-up {
  color: var(--success);
}

.pnl-var-down {
  color: var(--danger);
}

.pnl-budget-shift-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-md);
  background: var(--danger);
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
}

/* =====================================================================
 * Design system mobile (Spec 2026-05-29, Phase 0)
 * Socle commun de la refonte mobile : patterns réutilisés par tous les
 * onglets. Voir DESIGN.md section "Patterns mobiles".
 * ===================================================================== */

/* --- Sous-onglets unifiés (base, valable desktop + mobile) --- */
.subtabs {
  display: flex;
  gap: var(--s-3);
  border-bottom: 1px solid var(--border-soft);
  overflow-x: auto;
  scrollbar-width: none;
}
.subtabs::-webkit-scrollbar { display: none; }

.subtab {
  background: transparent;
  border: none;
  padding: var(--s-3) var(--s-4);
  color: var(--ink-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  min-height: 44px;
}
.subtab.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* --- KPI strip (base) --- */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--s-3);
}

/* --- Utilitaires visibilité --- */
@media (min-width: 769px) {
  .mobile-only { display: none !important; }
}

@media (max-width: 768px) {
  .desktop-only { display: none !important; }

  /* --- responsive-table : <table> → cards empilées --- */
  .responsive-table thead {
    display: none;
  }
  .responsive-table tbody tr {
    display: block;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    padding: var(--s-3);
    margin-bottom: var(--s-3);
  }
  .responsive-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--s-4);
    padding: 4px 0;
    border: none;
    text-align: right;
  }
  .responsive-table tbody td::before {
    content: attr(data-label);
    color: var(--ink-muted);
    font-weight: 500;
    text-align: left;
    flex-shrink: 0;
  }
  .responsive-table tbody td:not([data-label])::before {
    content: none;
  }

  /* --- mobile-card-list : listes non-tabulaires en cards --- */
  .mobile-card-list {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
  }
  .mobile-card-list > .mobile-card {
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    padding: var(--s-4);
  }

  /* --- sticky-section-head : header de section collé sous la topbar --- */
  .sticky-section-head {
    position: sticky;
    top: var(--topbar-h);
    z-index: 5;
    background: var(--surface);
    padding-top: var(--s-3);
    margin-top: calc(var(--s-3) * -1);
  }

  /* --- kpi-strip : scroll horizontal sur mobile --- */
  .kpi-strip {
    grid-auto-flow: column;
    grid-auto-columns: minmax(130px, 1fr);
    grid-template-columns: none;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .kpi-strip::-webkit-scrollbar { display: none; }
}

/* =====================================================================
 * Dashboard mobile (Spec 2026-05-31, Phase 1)
 * CA chart compressé + table détail en cards sur mobile (≤768px).
 * ===================================================================== */

@media (max-width: 768px) {
  /* --- CA chart : barres compressées (31 barres dans la largeur mobile) --- */
  .ca-chart-body {
    padding-bottom: 18px; /* espace pour les labels positionnés à -16px */
  }
  .ca-chart-cols {
    gap: 1px;
    height: 70px;
  }
  .ca-chart-label {
    display: none;
  }
  .ca-chart-col:nth-child(1) .ca-chart-label,
  .ca-chart-col:nth-child(8) .ca-chart-label,
  .ca-chart-col:nth-child(15) .ca-chart-label,
  .ca-chart-col:nth-child(22) .ca-chart-label,
  .ca-chart-col:nth-child(29) .ca-chart-label {
    display: block;
  }
}

/* =====================================================================
 * Vols mobile (Spec 2026-06-01, Phase 2)
 * Calendrier compact + détail barres + table tendance sur mobile (≤768px).
 * ===================================================================== */

@media (max-width: 768px) {
  /* --- Vols header --- */
  .flights-tab .flights-header {
    flex-wrap: wrap;
  }
  /* --- Vols calendrier : cellules compactes sur mobile --- */
  .flights-day-content,
  .flights-day-empty {
    min-height: 54px;
  }
  .flights-sparkline {
    display: none;
  }
  .flights-day-hours {
    display: none;
  }
  /* --- Vols day detail : barres compressées sur mobile --- */
  .flights-detail-bars {
    gap: 1px;
    height: 70px;
    margin-bottom: 22px; /* espace pour les labels positionnés à -16px */
  }
  .flights-detail-label {
    display: none;
  }
  .flights-detail-col:nth-child(1) .flights-detail-label,
  .flights-detail-col:nth-child(4) .flights-detail-label,
  .flights-detail-col:nth-child(7) .flights-detail-label,
  .flights-detail-col:nth-child(10) .flights-detail-label,
  .flights-detail-col:nth-child(13) .flights-detail-label,
  .flights-detail-col:nth-child(16) .flights-detail-label,
  .flights-detail-col:nth-child(19) .flights-detail-label {
    display: block;
  }
}

/* =====================================================================
 * Phase 3 — Planning mobile (≤768px)
 * Drawer day-detail redondant masqué + boutons d'action en barre
 * collante au-dessus de la bottom-nav. Le HTML reste inchangé : c'est
 * le CSS qui repositionne .drawer-actions en barre fixe sur mobile.
 * ===================================================================== */
@media (max-width: 768px) {
  /* Détail-jour du drawer redondant avec l'édition inline des cartes-jour. */
  .drawer-day {
    display: none;
  }

  /* Boutons d'action en barre fine collée juste au-dessus de la bottom-nav.
     La bottom-nav est fixed; bottom:0; z-index:30 — donc cette barre s'ancre
     à bottom: var(--bottom-nav-h) et reste sous elle en z-index:29. */
  .planning-drawer .drawer-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--bottom-nav-h);
    z-index: 29;
    flex-direction: row;
    align-items: center;
    gap: var(--s-2);
    padding: 8px var(--s-4) calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--bg);
    border-top: 1px solid var(--border-soft);
  }
  /* Aplatit la rangée imbriquée : Contrôler + Rafraîchir deviennent frères
     directs d'Enregistrer dans la même rangée flex. */
  .planning-drawer .drawer-actions-row {
    display: contents;
  }
  /* Enregistrer (action principale) occupe la largeur restante. */
  .planning-drawer .drawer-actions > #planning-save-button {
    flex: 1;
  }

  /* La barre fixe recouvre le bas : on décale le scroll du Planning pour que
     la dernière carte reste atteignable (hauteur barre ~ 44px + 2×8px). */
  body[data-active-view="planning"] .app-main {
    padding-bottom: calc(var(--bottom-nav-h) + 64px);
  }

  /* Finition : le pill « X/Y slot(s) » revient sous la date plutôt que
     d'écraser le titre sur écran étroit. */
  .planning-day-card-head {
    flex-wrap: wrap;
  }

  /* Finition : catalogue des shifts plus lisible en 1 colonne. */
  .shifts-catalog-list {
    grid-template-columns: 1fr;
  }
}

/* ===== Phase 4 — Équipe mobile (barre Enregistrer/Annuler collante) ===== */
@media (max-width: 768px) {
  #employee-form .form-actions {
    position: sticky;
    bottom: var(--bottom-nav-h);
    z-index: 5;
    margin: var(--s-4) calc(var(--s-4) * -1) calc(var(--s-4) * -1);
    padding: var(--s-3) var(--s-4) calc(var(--s-3) + env(safe-area-inset-bottom, 0px));
    background: var(--surface);
    border-top: 1px solid var(--border-soft);
  }
  #employee-form .form-actions #employee-submit-button {
    flex: 1;
  }
}

/* ===== Phase 5 — Intérim mobile (cartes responsive : override base table) ===== */
@media (max-width: 768px) {
  .interim-tab .interim-table.responsive-table tbody td {
    border-bottom: none;
    text-align: right;
  }
}

/* ===== Phase 6 — Charge mobile (heatmap → cartes-jour + barre de chaleur) ===== */
@media (max-width: 768px) {
  .charge-tab .charge-table-wrapper { overflow-x: visible; }
  .charge-tab .charge-heatmap,
  .charge-tab .charge-heatmap tbody { display: block; }
  .charge-tab .charge-heatmap thead { display: none; }

  .charge-tab .charge-heatmap tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    padding: var(--s-3);
    margin-bottom: var(--s-3);
  }

  .charge-tab .charge-day-cell {
    flex-basis: 100%;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0 0 var(--s-1);
    border: none;
    font-weight: 600;
  }
  .charge-tab .charge-peak {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--ink-soft);
  }

  .charge-tab .charge-cell {
    flex: 1 1 0;
    min-width: 0;
    height: 24px;
    padding: 0;
    border: none;
    font-size: 0;
  }
  .charge-tab .charge-cell:nth-child(2) {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
  }
  .charge-tab .charge-cell:nth-last-child(2) {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
  }

  .charge-tab .charge-ticks {
    flex-basis: 100%;
    display: flex;
    justify-content: space-between;
    padding: var(--s-1) 0 0;
    border: none;
    font-size: 0.62rem;
    color: var(--ink-soft);
  }

  .charge-tab #charge-day-detail { scroll-margin-top: var(--s-3); }
}
