/* ==========================================================================
   Kikout — Design system « Nuit & Cobalt »
   Palette cobalt · Space Grotesk + Inter
   Écrans : xs < 768 · md ≥ 768 · lg ≥ 992 · xl ≥ 1200 (paliers Bootstrap)
   ========================================================================== */

/* ===== VARIABLES — THÈME CLAIR ===== */
:root {
	--color-primary: #1F4D90;
	--color-primary-rgb: 31, 77, 144;
	--color-primary-dark: #163A70;
	--color-accent: #22D3EE;

	--color-bg: #F3F6FB;
	--color-surface: #FFFFFF;
	--color-ink-rgb: 11, 27, 51;
	--color-text: #0B1B33;
	--color-text-2: #34496B;
	--color-text-muted: #5C6F8F;
	--color-text-faint: #8A9AB5;
	--color-border: #DCE3EF;
	--color-border-strong: #B9C6DB;
	--color-divider: #E8EDF5;

	--color-positive: #0F766E;
	--color-negative: #BE123C;

	--pastel-run-bg: rgba(31, 77, 144, .10);   --pastel-run-fg: #163A70;
	--pastel-done-bg: #CCFBF1;                 --pastel-done-fg: #0F5F57;
	--pastel-fail-bg: #FFE4EA;                 --pastel-fail-fg: #BE123C;
	--pastel-warn-bg: #FEF0C7;                 --pastel-warn-fg: #8A4B08;
	--pastel-queue-bg: #E8EDF5;                --pastel-queue-fg: #34496B;

	--series-1: #1F4D90;
	--series-2: #0F766E;
	--series-3: #B45309;

	--radius: 6px;
	--shadow-drawer: -4px 0 24px rgba(11, 27, 51, .12);
	--shadow-float: 0 4px 16px rgba(11, 27, 51, .12);
	--transition: 150ms ease;

	--sidebar-w: 248px;
	--font-title: "Space Grotesk", system-ui, sans-serif;
	--font-body: "Inter", system-ui, sans-serif;
}

/* ===== VARIABLES — THÈME SOMBRE ===== */
:root[data-theme="dark"] {
	--color-primary: #5B8DDB;
	--color-primary-rgb: 91, 141, 219;
	--color-primary-dark: #9CBBEE;

	--color-bg: #0A1424;
	--color-surface: #101C30;
	--color-ink-rgb: 0, 0, 0;
	--color-text: #E8EEF9;
	--color-text-2: #B7C4DC;
	--color-text-muted: #8EA0C0;
	--color-text-faint: #647696;
	--color-border: #1F2E48;
	--color-border-strong: #2D4263;
	--color-divider: #16253D;

	--color-positive: #5EEAD4;
	--color-negative: #FB7185;

	--pastel-run-bg: rgba(91, 141, 219, .16);  --pastel-run-fg: #9CBBEE;
	--pastel-done-bg: rgba(45, 212, 191, .14); --pastel-done-fg: #5EEAD4;
	--pastel-fail-bg: rgba(251, 113, 133, .14);--pastel-fail-fg: #FDA4AF;
	--pastel-warn-bg: rgba(251, 191, 36, .14); --pastel-warn-fg: #FCD34D;
	--pastel-queue-bg: #16253D;                --pastel-queue-fg: #B7C4DC;

	--series-1: #7BA7EC;
	--series-2: #5EEAD4;
	--series-3: #FBBF24;

	--shadow-drawer: -4px 0 24px rgba(0, 0, 0, .5);
	--shadow-float: 0 4px 16px rgba(0, 0, 0, .5);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; }

html {
	-webkit-tap-highlight-color: transparent;
	-webkit-text-size-adjust: 100%;
}

html, body { max-width: 100%; overflow-x: hidden; }

body {
	margin: 0;
	background: var(--color-bg);
	color: var(--color-text-2);
	font-family: var(--font-body);
	font-size: 14px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

img, video, svg { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
a, button, [role="button"] { touch-action: manipulation; }
h1, h2, h3, h4 { font-family: var(--font-title); color: var(--color-text); margin: 0; }
p { margin: 0; }
.ic { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.text-truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flex-child { min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* L'attribut hidden doit toujours l'emporter sur les display: flex/grid */
[hidden] { display: none !important; }

/* ===== STRUCTURE (APP SHELL) ===== */
.shell { min-height: 100vh; min-height: 100dvh; }

.main {
	min-width: 0;
	padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

.page { padding: 20px 16px 8px; }

@media (min-width: 992px) {
	.main { margin-left: var(--sidebar-w); padding-bottom: 0; }
	.page { padding: 32px 40px 24px; }
}

@media (min-width: 1200px) {
	.page { max-width: 1320px; padding: 36px 48px 32px; }
}

/* ===== SIDEBAR (≥ lg) ===== */
.sidebar {
	display: none;
	position: fixed;
	inset: 0 auto 0 0;
	width: var(--sidebar-w);
	z-index: 60;
	flex-direction: column;
	background: var(--color-surface);
	border-right: 1px solid var(--color-border);
}

@media (min-width: 992px) { .sidebar { display: flex; } }

.sidebar__brand {
	display: flex;
	align-items: center;
	height: 68px;
	padding: 0 22px;
	flex-shrink: 0;
}

.sidebar__brand img { height: 42px; width: auto; display: block; }
.sidebar__brand .logo-dark { display: none; }
:root[data-theme="dark"] .sidebar__brand .logo-light { display: none; }
:root[data-theme="dark"] .sidebar__brand .logo-dark { display: block; }

.sidebar__scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 14px 16px; }

.nav__title {
	margin: 20px 10px 6px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--color-text-muted);
}

.nav__link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 9px 10px;
	margin-bottom: 2px;
	border-radius: var(--radius);
	font-weight: 500;
	color: var(--color-text-2);
	transition: background var(--transition), color var(--transition);
}

.nav__link:hover { background: var(--color-divider); color: var(--color-text); }
.nav__link:active { background: rgba(var(--color-primary-rgb), .10); }
.nav__link.is-active { background: rgba(var(--color-primary-rgb), .10); color: var(--color-primary-dark); font-weight: 600; }

.nav__count {
	margin-left: auto;
	min-width: 20px;
	padding: 0 6px;
	border-radius: 10px;
	background: var(--color-primary);
	color: #FFFFFF;
	font-size: 11px;
	font-weight: 600;
	text-align: center;
	line-height: 20px;
}

:root[data-theme="dark"] .nav__count { color: #0A1424; }

.sidebar__foot { padding: 12px 14px; border-top: 1px solid var(--color-border); }

/* ===== BARRE DU HAUT ===== */
.topbar {
	position: sticky;
	top: 0;
	z-index: 50;
	display: flex;
	align-items: center;
	gap: 12px;
	height: 56px;
	padding: 0 16px;
	background: var(--color-surface);
	border-bottom: 1px solid var(--color-border);
}

.topbar__brand img { height: 32px; display: block; }
.topbar__brand .logo-dark { display: none; }
:root[data-theme="dark"] .topbar__brand .logo-light { display: none; }
:root[data-theme="dark"] .topbar__brand .logo-dark { display: block; }
.topbar__title { font-family: var(--font-title); font-weight: 600; color: var(--color-text); font-size: 16px; }
.topbar__spacer { flex: 1; }
.topbar__actions { display: flex; align-items: center; gap: 8px; }

@media (min-width: 992px) {
	.topbar { height: 64px; padding: 0 40px; background: var(--color-bg); border-bottom: none; }
	.topbar__brand { display: none; }
	.topbar__title { display: none; }
}

.icon-btn {
	position: relative;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	color: var(--color-text-2);
	transition: background var(--transition);
}

.icon-btn:hover { background: var(--color-divider); }
.icon-btn:active { background: rgba(var(--color-primary-rgb), .10); transform: scale(.98); }
.icon-btn__dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--color-primary); border: 2px solid var(--color-surface); box-sizing: content-box; margin: -2px -2px 0 0; }

.avatar {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(var(--color-primary-rgb), .14);
	color: var(--color-primary-dark);
	font-family: var(--font-title);
	font-weight: 600;
	font-size: 14px;
	flex-shrink: 0;
}

/* ===== TITRE DE PAGE ===== */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.page-head p { margin-top: 4px; color: var(--color-text-muted); }

/* ===== CARTES (3 traitements, jamais uniformes) ===== */
.card { min-width: 0; background: var(--color-surface); border-radius: var(--radius); padding: 20px; }
.card--bordered { border: 1px solid var(--color-border); }
.card--surface { border: 1px solid transparent; }
.card--flat { background: transparent; padding: 0; }
.card + .card, .section + .section { margin-top: 20px; }
.kpis > .card { margin-top: 0; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--color-divider); }
.card__title { font-size: 17px; font-weight: 600; }
.card__sub { font-size: 13px; color: var(--color-text-muted); margin-top: 2px; }

@media (min-width: 992px) { .card { padding: 24px; } }

/* ===== KPI ===== */
.kpis { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }

@media (min-width: 768px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .kpis { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr); gap: 20px; } }

.kpi { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.kpi__label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-muted); }
.kpi__value { margin: 6px 0 8px; font-family: var(--font-title); font-size: 36px; font-weight: 700; line-height: 1.1; color: var(--color-text); }
.kpi__ctx { font-size: 12px; color: var(--color-text-muted); }
.kpi__ctx strong { font-weight: 600; color: var(--color-positive); }
.kpi__ctx strong.is-down { color: var(--color-negative); }
.kpi__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; }
.kpi__icon .ic { width: 20px; height: 20px; }
.kpi__icon--done { background: var(--pastel-done-bg); color: var(--pastel-done-fg); }
.kpi__icon--run { background: var(--pastel-run-bg); color: var(--pastel-run-fg); }
.kpi__icon--warn { background: var(--pastel-warn-bg); color: var(--pastel-warn-fg); }

/* Carrousel KPI sur mobile */
@media (max-width: 767.98px) {
	.kpis {
		display: flex;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		scroll-padding-left: 16px;
		-webkit-overflow-scrolling: touch;
		margin: 0 -16px;
		padding: 2px 16px 12px;
		scrollbar-width: none;
	}

	.kpis::-webkit-scrollbar { display: none; }
	.kpis .kpi { flex: 0 0 78%; scroll-snap-align: start; padding: 16px; }
	.kpi__value { font-size: 30px; }
}

/* ===== BOUTONS (une seule forme : var(--radius)) ===== */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 40px;
	padding: 8px 16px;
	border: 1.5px solid transparent;
	border-radius: var(--radius);
	background: transparent;
	font-weight: 500;
	font-size: 14px;
	white-space: nowrap;
	transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.btn:active { transform: scale(.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn--filled { background: var(--color-primary); border-color: var(--color-primary); color: #FFFFFF; }
.btn--filled:hover { background: color-mix(in srgb, var(--color-primary) 86%, #000); }
:root[data-theme="dark"] .btn--filled { color: #0A1424; }
.btn--outline { border-color: var(--color-primary); color: var(--color-primary-dark); }
.btn--outline:hover { background: rgba(var(--color-primary-rgb), .08); }
.btn--danger { border-color: var(--color-negative); color: var(--color-negative); }
.btn--danger:hover { background: var(--pastel-fail-bg); }
.btn--danger.is-armed { background: var(--color-negative); color: #FFFFFF; }
.btn--ghost { padding: 8px 10px; color: var(--color-primary-dark); }
.btn--ghost:hover { background: rgba(var(--color-primary-rgb), .08); }
.btn--sm { min-height: 34px; padding: 5px 12px; font-size: 13px; }
.btn.is-loading { pointer-events: none; opacity: .85; }
.btn__spinner { display: none; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.is-loading .btn__spinner { display: inline-block; }
.btn.is-loading .ic { display: none; }

.btn--block { width: 100%; }
@media (max-width: 767.98px) { .btn--block-xs { width: 100%; } }

/* ===== BADGES ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; line-height: 1.4; white-space: nowrap; }
.badge--run { background: var(--pastel-run-bg); color: var(--pastel-run-fg); }
.badge--done { background: var(--pastel-done-bg); color: var(--pastel-done-fg); }
.badge--fail { background: var(--pastel-fail-bg); color: var(--pastel-fail-fg); }
.badge--warn { background: var(--pastel-warn-bg); color: var(--pastel-warn-fg); }
.badge--queue { background: var(--pastel-queue-bg); color: var(--pastel-queue-fg); }

/* ===== LISTES (list-group) ===== */
.list-group { list-style: none; margin: 0; padding: 0; }
.list-day { display: flex; align-items: center; gap: 10px; padding: 18px 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-muted); }
.list-day:first-child { padding-top: 0; }
.list-day__count { padding: 1px 8px; border-radius: 10px; background: var(--color-divider); color: var(--color-text-2); letter-spacing: 0; }

.list-item { position: relative; display: flex; align-items: center; gap: 14px; min-width: 0; padding: 14px 0; border-bottom: 1px solid var(--color-divider); }
.list-item:last-child { border-bottom: none; }
.list-item__body { flex: 1; min-width: 0; }
.list-item__title { font-weight: 600; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item__sub { margin-top: 2px; font-size: 12.5px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item__sub.is-wrap { white-space: normal; overflow: visible; }
.list-item__meta { display: flex; align-items: center; gap: 12px; flex-shrink: 0; font-size: 12.5px; color: var(--color-text-muted); }
.list-item__time { font-variant-numeric: tabular-nums; }

.icon-bubble { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.icon-bubble--run { background: var(--pastel-run-bg); color: var(--pastel-run-fg); }
.icon-bubble--done { background: var(--pastel-done-bg); color: var(--pastel-done-fg); }
.icon-bubble--fail { background: var(--pastel-fail-bg); color: var(--pastel-fail-fg); }
.icon-bubble--warn { background: var(--pastel-warn-bg); color: var(--pastel-warn-fg); }

.ctx { position: relative; flex-shrink: 0; }
.ctx__trigger { display: grid; place-items: center; width: 44px; height: 44px; border: none; border-radius: var(--radius); background: transparent; color: var(--color-text-muted); }
.ctx__trigger:hover { background: var(--color-divider); }
.ctx__menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 70; min-width: 190px; padding: 4px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow-float); animation: fadeIn var(--transition); }
.ctx__menu--up { top: auto; bottom: calc(100% + 4px); }
.ctx__item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 10px 12px; border: none; border-radius: 4px; background: transparent; text-align: left; color: var(--color-text); }
.ctx__item:hover { background: var(--color-divider); }
.ctx__item--danger { color: var(--color-negative); }

@media (min-width: 992px) {
	.ctx__trigger { width: 36px; height: 36px; opacity: 0; transition: opacity var(--transition), background var(--transition); }
	.list-item:hover .ctx__trigger, .ctx__trigger:focus-visible, .ctx__trigger[aria-expanded="true"] { opacity: 1; }
}

/* Mobile : chaque ligne devient une carte compacte */
@media (max-width: 767.98px) {
	.list-item { padding: 12px 14px; margin-bottom: 8px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
	.list-item:last-child { border-bottom: 1px solid var(--color-border); }
	.list-item__meta { flex-direction: column; align-items: flex-end; gap: 4px; }
	.list-day { padding-top: 14px; }

	/* Nom lisible en entier : date, badge et origine passent sur une 2e ligne */
	.list-item--stack { flex-wrap: wrap; row-gap: 6px; }
	.list-item--stack .list-item__body { flex: 1 1 0; }
	.list-item--stack .list-item__title { white-space: normal; overflow-wrap: anywhere; }
	.list-item--stack .ctx { order: 2; }
	.list-item--stack .list-item__meta { order: 3; flex: 0 0 100%; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 8px; padding-left: 54px; }
	.card--list { padding: 0; background: transparent; border: none; }
}

/* ===== FORMULAIRES ===== */
.form-group { margin-bottom: 18px; }
.form-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--color-text); }
.form-hint { margin-top: 6px; font-size: 12px; color: var(--color-text-muted); }
.form-error { margin-top: 6px; font-size: 12.5px; color: var(--pastel-fail-fg); }

.form-input {
	width: 100%;
	min-height: 42px;
	padding: 9px 12px;
	background: var(--color-surface);
	border: 1px solid var(--color-border-strong);
	border-radius: var(--radius);
	color: var(--color-text);
	font-size: 14px;
	transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input::placeholder { color: var(--color-text-faint); }
.form-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), .16); }
.form-input[aria-invalid="true"] { border-color: var(--color-negative); }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }
input[type="number"] { -moz-appearance: textfield; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

@media (max-width: 767.98px) { .form-input { font-size: 16px; } }

.search { position: relative; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); pointer-events: none; }
.search .form-input { padding-left: 38px; }

.filters { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 768px) { .filters { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; } }

/* Sélecteur personnalisé (jamais de <select> natif) */
.select { position: relative; }
.select__btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 8px 12px; background: var(--color-surface); border: 1px solid var(--color-border-strong); border-radius: var(--radius); text-align: left; color: var(--color-text); }
.select__btn:focus-visible, .select__btn[aria-expanded="true"] { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), .16); }
.select__btn .select__chev { margin-left: auto; color: var(--color-text-muted); }
.select__list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 70; max-height: 260px; overflow-y: auto; margin: 0; padding: 4px; list-style: none; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow-float); }
.select__opt { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 10px; border-radius: 4px; color: var(--color-text); cursor: pointer; }
.select__opt:hover, .select__opt[aria-selected="true"] { background: var(--color-divider); }
.select__opt .ic--check { margin-left: auto; color: var(--color-primary); visibility: hidden; }
.select__opt[aria-selected="true"] .ic--check { visibility: visible; }

/* Cases à cocher / interrupteur personnalisés */
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; margin: 0; border: 1.5px solid var(--color-border-strong); border-radius: 5px; background: var(--color-surface); display: grid; place-items: center; }
.check input:checked { background: var(--color-primary); border-color: var(--color-primary); }
.check input:checked::after { content: ""; width: 10px; height: 5px; border-left: 2px solid #FFFFFF; border-bottom: 2px solid #FFFFFF; transform: rotate(-45deg) translate(1px, -1px); }
.switch { position: relative; width: 40px; height: 24px; flex-shrink: 0; }
.switch input { appearance: none; -webkit-appearance: none; width: 100%; height: 100%; margin: 0; border-radius: 12px; background: var(--color-border-strong); cursor: pointer; transition: background var(--transition); }
.switch input:checked { background: var(--color-primary); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #FFFFFF; transition: transform var(--transition); pointer-events: none; }
.switch:has(input:checked)::after { transform: translateX(16px); }

/* ===== ÉTAT VIDE (pleine largeur) ===== */
.empty { margin: 24px 0; padding: 44px 28px 36px; text-align: center; border: 1px dashed var(--color-border-strong); border-radius: 12px; background: var(--color-surface); }
.empty__icon { display: inline-grid; place-items: center; width: 64px; height: 64px; margin-bottom: 18px; box-sizing: content-box; border: 6px solid rgba(var(--color-primary-rgb), .06); border-radius: 50%; background: rgba(var(--color-primary-rgb), .12); color: var(--color-primary); }
.empty__icon .ic { width: 28px; height: 28px; }
.empty__title { font-family: var(--font-title); font-size: 19px; font-weight: 600; color: var(--color-text); }
.empty__text { max-width: 380px; margin: 8px auto 0; line-height: 1.5; color: var(--color-text-muted); }
.empty .btn { margin-top: 22px; }
.empty--inline { margin: 8px 0 0; padding: 28px 20px; }
.empty--inline .empty__icon { width: 48px; height: 48px; margin-bottom: 12px; }
@media (max-width: 767.98px) { .empty { padding: 32px 20px 28px; } }

/* ===== ALERTES & TOASTS ===== */
.alert { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; padding: 14px 16px; border-left: 4px solid; border-radius: var(--radius); animation: fadeIn var(--transition); }
.alert--done { background: var(--pastel-done-bg); border-color: var(--color-positive); color: var(--pastel-done-fg); }
.alert--fail { background: var(--pastel-fail-bg); border-color: var(--color-negative); color: var(--pastel-fail-fg); }
.alert--warn { background: var(--pastel-warn-bg); border-color: var(--pastel-warn-fg); color: var(--pastel-warn-fg); }
.alert--run { background: var(--pastel-run-bg); border-color: var(--color-primary); color: var(--pastel-run-fg); }

/* ===== PAGINATION ===== */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--color-divider); font-size: 13px; color: var(--color-text-muted); }
.pager__nav { display: flex; gap: 6px; }

/* ===== DRAWER (animé à l'ouverture ET à la fermeture) ===== */
.drawer { position: fixed; inset: 0; z-index: 1000; display: flex; justify-content: flex-end; visibility: hidden; pointer-events: none; transition: visibility 0s linear .28s; }
.drawer.is-open { visibility: visible; pointer-events: auto; transition-delay: 0s; }
.drawer__backdrop { position: absolute; inset: 0; background: rgba(var(--color-ink-rgb), .45); opacity: 0; transition: opacity .28s ease; }
.drawer.is-open .drawer__backdrop { opacity: 1; }
.drawer__panel { position: relative; display: flex; flex-direction: column; width: 460px; max-width: 100vw; height: 100vh; height: 100dvh; background: var(--color-surface); box-shadow: var(--shadow-drawer); transform: translateX(100%); transition: transform .28s cubic-bezier(.4, 0, 1, 1); }
.drawer.is-open .drawer__panel { transform: translateX(0); transition-timing-function: cubic-bezier(.2, .8, .2, 1); }
.drawer__header { display: flex; align-items: center; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--color-border); flex-shrink: 0; }
.drawer__title { font-size: 18px; font-weight: 600; flex: 1; }
.drawer__back { display: none; }
.drawer__body { flex: 1; min-height: 0; overflow-y: auto; padding: 24px; }
.drawer__footer { display: flex; justify-content: space-between; gap: 12px; padding: 16px 24px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--color-border); flex-shrink: 0; }

@media (max-width: 767.98px) {
	.drawer__panel { width: 100vw; }
	.drawer__close { display: none; }
	.drawer__back { display: grid; }
	.drawer__footer .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
	.drawer__panel { transform: none; opacity: 0; transition: opacity .15s linear; }
	.drawer.is-open .drawer__panel { opacity: 1; }
}

/* ===== NAVIGATION MOBILE (bottom nav) ===== */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; display: flex; align-items: flex-end; justify-content: space-around; height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--color-surface); border-top: 1px solid var(--color-border); }
@media (min-width: 992px) { .bottom-nav { display: none; } }
.bottom-nav__item { display: flex; flex: 1; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 10px; font-size: 11px; font-weight: 500; color: var(--color-text-muted); background: none; border: none; }
.bottom-nav__item:active { background: rgba(var(--color-primary-rgb), .08); }
.bottom-nav__item.is-active { color: var(--color-primary-dark); }
.bottom-nav__item--primary { position: relative; padding: 0 0 10px; }
.bottom-nav__item--primary .bottom-nav__icon { margin-top: -20px; }
.bottom-nav__item--primary .bottom-nav__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--radius); background: var(--color-primary); color: #FFFFFF; }
:root[data-theme="dark"] .bottom-nav__item--primary .bottom-nav__icon { color: #0A1424; }

/* ===== GRAPHIQUE ===== */
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 8px; font-size: 12.5px; color: var(--color-text-2); }
.legend i { display: inline-block; width: 18px; height: 4px; margin-right: 6px; border-radius: 2px; vertical-align: middle; }

/* ===== SÉRIES DE GRAPHIQUE (répartition D) ===== */
.s1 { --s: var(--series-1); }
.s2 { --s: var(--series-2); }
.s3 { --s: var(--series-3); }
.chart-line { fill: none; stroke: var(--s); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chart-grid { stroke: var(--color-border); stroke-dasharray: 3 4; }
.chart-label { fill: var(--color-text-muted); font-size: 11px; font-family: var(--font-body); }
.chart-peak { fill: var(--color-accent); stroke: var(--color-surface); stroke-width: 2.5; }
.legend .s1 i { background: var(--series-1); }
.legend .s2 i { background: var(--series-2); }
.legend .s3 i { background: var(--series-3); }

/* ===== SÉLECTEUR DE DATE ===== */
.datefield { position: relative; }
.datefield__btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 8px 12px; background: var(--color-surface); border: 1px solid var(--color-border-strong); border-radius: var(--radius); text-align: left; color: var(--color-text); }
.datefield__btn:focus-visible, .datefield__btn[aria-expanded="true"] { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), .16); }
.datefield__btn .is-placeholder { color: var(--color-text-faint); }
.datefield__cal { position: absolute; left: 0; top: calc(100% + 4px); z-index: 70; width: 288px; max-width: calc(100vw - 32px); padding: 12px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow-float); }
.datefield__nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-family: var(--font-title); color: var(--color-text); }
.datefield__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.datefield__dow { padding: 6px 0; text-align: center; font-size: 11px; font-weight: 600; color: var(--color-text-muted); }
.datefield__day { height: 36px; border: none; border-radius: 4px; background: transparent; color: var(--color-text); }
.datefield__day:hover { background: var(--color-divider); }
.datefield__day.is-today { box-shadow: inset 0 0 0 1px var(--color-border-strong); }
.datefield__day.is-selected { background: var(--color-primary); color: #FFFFFF; }
:root[data-theme="dark"] .datefield__day.is-selected { color: #0A1424; }
.datefield__foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--color-divider); }
@media (max-width: 767.98px) { .datefield__cal { position: fixed; left: 16px; right: 16px; top: auto; bottom: calc(80px + env(safe-area-inset-bottom)); width: auto; max-width: none; } }

/* ===== INFO-BULLE PERSONNALISÉE ===== */
[data-tip] { position: relative; }
[data-tip]::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 6px); z-index: 80; padding: 5px 9px; border-radius: 4px; background: var(--color-text); color: var(--color-bg); font-size: 12px; font-weight: 500; white-space: nowrap; transform: translateX(-50%); opacity: 0; pointer-events: none; transition: opacity var(--transition); }
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; }

.avatar.ctx__trigger { width: 40px; height: 40px; opacity: 1; background: rgba(var(--color-primary-rgb), .14); color: var(--color-primary-dark); }
.nav__link--btn { width: 100%; border: none; background: none; text-align: left; font-size: inherit; }

/* ===== OUTILS DE MISE EN PAGE ===== */
.stack > * + * { margin-top: 16px; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.grid-2 { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 992px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.grid-main { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
.grid-2 > *, .grid-main > *, .kpis > *, .filters-grid > * { min-width: 0; }
@media (min-width: 1200px) { .grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.muted { color: var(--color-text-muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.text-right { text-align: right; }
.is-hidden { display: none; }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; margin-top: 8px; }
.radio-group { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-pill { position: relative; }
.radio-pill input { position: absolute; opacity: 0; pointer-events: none; }
.radio-pill span { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 14px; border: 1px solid var(--color-border-strong); border-radius: var(--radius); color: var(--color-text-2); cursor: pointer; }
.radio-pill input:checked + span { background: rgba(var(--color-primary-rgb), .10); border-color: var(--color-primary); color: var(--color-primary-dark); font-weight: 600; }
.radio-pill input:focus-visible + span { box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), .16); }

/* ===== NAVIGATION MOBILE (tiroir « Plus ») ===== */
.drawer__panel--nav .nav__link { min-height: 46px; }

/* ===== AUTHENTIFICATION ===== */
.auth { display: grid; min-height: 100vh; min-height: 100dvh; padding: 24px 16px; place-items: center; background: var(--color-bg); }
.auth__card { width: 100%; max-width: 440px; padding: 32px 28px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; }
.auth__logo { display: block; height: 52px; width: auto; margin-bottom: 24px; }
.auth__logo--dark { display: none; }
:root[data-theme="dark"] .auth__logo--light { display: none; }
:root[data-theme="dark"] .auth__logo--dark { display: block; }
.auth__card h1 { font-size: 24px; }
.auth__lead { margin: 8px 0 24px; color: var(--color-text-muted); }
.auth__stores { display: flex; gap: 12px; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--color-divider); }
.auth__stores a { flex: 1; }
.auth__stores img { width: 100%; height: auto; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== BLOC REPLIABLE (toutes tailles d'écran) ===== */
.collapsible__toggle { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0; border: none; background: none; text-align: left; color: var(--color-text); }
.collapsible__toggle .ic--chev { margin-left: auto; color: var(--color-text-muted); transition: transform var(--transition); }
.collapsible__toggle[aria-expanded="true"] .ic--chev { transform: rotate(180deg); }
.collapsible__body { padding-top: 12px; }
.collapsible:not(.is-open) .collapsible__body { display: none; }

/* ===== FILTRES, SUGGESTIONS, DIVERS =====
.mb-section { margin-bottom: 20px; }
.ic--xs { width: 13px; height: 13px; }
.filters-grid { display: grid; gap: 4px 16px; grid-template-columns: minmax(0, 1fr); }
.filters-grid .form-group { margin-bottom: 12px; }
@media (min-width: 768px) { .filters-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .filters-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.filters-toggle { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0; border: none; background: none; font-weight: 600; color: var(--color-text); text-align: left; }
.filters-toggle .ic--chev { margin-left: auto; color: var(--color-text-muted); transition: transform var(--transition); }
.filters-toggle[aria-expanded="true"] .ic--chev { transform: rotate(180deg); }
.filters-toggle__count { padding: 0 8px; border-radius: 10px; background: var(--color-primary); color: #FFFFFF; font-size: 12px; line-height: 20px; }
:root[data-theme="dark"] .filters-toggle__count { color: #0A1424; }
.filters-body { padding-top: 16px; }
@media (max-width: 767.98px) { .filters-collapsible:not(.is-open) .filters-body { display: none; } }
@media (min-width: 768px) { .filters-toggle { display: none; } .filters-body { padding-top: 0; } }
.filters-grid__actions { display: flex; align-items: flex-end; gap: 8px; }
.filters-grid__actions .btn--filled { flex: 0 0 auto; }
.suggest { position: relative; }
.drawer__form { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.list-day .ic { width: 16px; height: 16px; }
.list-item__actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.list-item__title.is-unknown { color: var(--color-negative); }
.ctx__menu form { margin: 0; }
.ctx__menu form .btn { width: 100%; justify-content: flex-start; border: none; min-height: 44px; padding: 10px 12px; font-weight: 400; }
.ctx__menu form .btn:hover { background: var(--pastel-fail-bg); }
