/*
 * OMA NOVA SARL – Plateforme multi-maisons
 * Feuille de style unique. Identité AB GREEL : bleu nuit, indigo et vert secondaire.
 * Les statuts s'affichent comme les voyants d'un tableau électrique.
 */

@font-face { font-family: "Poppins"; font-weight: 500; font-display: swap; src: url("../fonts/poppins-500.woff") format("woff"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-display: swap; src: url("../fonts/poppins-700.woff") format("woff"); }

:root {
  color-scheme: light;
  /* Palette de marque */
  --navy: #17233B;
  --indigo: #4F46E5;
  --indigo-hover: #4338CA;
  --indigo-tint: #EEF2FF;
  --violet: #7C3AED;
  --violet-tint: #F5F3FF;
  --turquoise: #0F9F9A;
  --turquoise-tint: #E6FFFB;
  --success: #2E7D32;
  --success-soft: #EAF5EB;
  --success-border: #B8DFBA;
  --warning: #A86A00;
  --warning-soft: #FFF6E0;
  --warning-border: #F3DDA5;
  --danger: #B42318;
  --danger-soft: #FDECEC;
  --danger-border: #F2C6C4;
  --info: #1D63A6;
  --info-soft: #E8F1FB;
  --info-border: #C3DAF3;
  --row-hover: #F8FAFC;

  /* Espacements et densité */
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --control-height: 42px;
  --control-height-sm: 36px;

  /* Compatibilité : variables historiques conservées pour les vues métier. */
  --brand: #4CB050;
  --brand-strong: #2E7D32;
  --brand-deep: #1F5E25;
  --brand-tint: #EAF5EB;
  --ink: #182230;
  --ink-2: #334155;
  --muted: #526178;
  --faint: #5F6E83;
  --paper: #F5F7FB;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --line: #E2E8F0;
  --line-strong: #CBD5E1;
  --amber: #A86A00;
  --amber-lamp: #F2B01E;
  --amber-tint: #FFF6E0;
  --red: #B42318;
  --red-lamp: #E5484D;
  --red-tint: #FDECEC;
  --blue: #1D63A6;
  --blue-lamp: #3B8BEB;
  --blue-tint: #E8F1FB;
  --gray-lamp: #A3ADB6;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-1: 0 1px 3px rgba(23, 35, 59, .06), 0 1px 2px rgba(23, 35, 59, .04);
  --shadow-2: 0 8px 24px rgba(23, 35, 59, .12);
  --shadow-3: 0 18px 48px rgba(23, 35, 59, .16);
  --sidebar-w: 256px;
  --topbar-h: 60px;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --font-head: "Poppins", var(--font-body);
  --focus: 0 0 0 3px rgba(79, 70, 229, .25);
  --motion-fast: 140ms;
  --motion-ui: 190ms;
  --ease-ui: cubic-bezier(.2, .75, .25, 1);
  --ease-enter: cubic-bezier(.16, 1, .3, 1);
  --primary: var(--navy);
  --action: var(--indigo);
  --action-hover: var(--indigo-hover);
  --link: var(--indigo);
  --link-hover: var(--indigo-hover);
  /* Teinte des textes accentués (onglets, entêtes) : contraste garanti dans les deux thèmes. */
  --accent-ink: var(--indigo);
}

/* Le thème est prêt pour data-theme="dark" ; son activation viendra dans un lot dédié. */
[data-theme="dark"] {
  color-scheme: dark;
  --ink: #E6ECF5;
  --ink-2: #CBD5E1;
  --muted: #A8B4C6;
  --faint: #94A3B8;
  --paper: #0F1728;
  --surface: #172338;
  --surface-2: #1D2B43;
  --line: #2C3B55;
  --line-strong: #40516D;
  --indigo-tint: #1C2340;
  --violet: #B4A0F5;
  --violet-tint: #2A2140;
  --turquoise: #4FD6CF;
  --turquoise-tint: #122F2E;
  --link: #A5B4FC;
  --link-hover: #C7D2FE;
  --accent-ink: #A5B4FC;
  --brand-strong: #75D17B;
  --brand-deep: #A4E5A8;
  --brand-tint: #1B3828;
  --success-soft: #1B3828;
  --amber: #F5C66B;
  --amber-tint: #3A2D18;
  --warning-soft: #3A2D18;
  --red: #FF8D86;
  --red-tint: #3A2026;
  --danger-soft: #3A2026;
  --blue: #86BFFF;
  --blue-tint: #1C304A;
  --info-soft: #1C304A;
  --success-border: #31553A;
  --warning-border: #5B4828;
  --danger-border: #63363A;
  --info-border: #314D6F;
  --row-hover: #1D2B43;
  --gray-lamp: #718096;
  --focus: 0 0 0 3px rgba(129, 140, 248, .38);
  --shadow-1: 0 1px 3px rgba(0, 0, 0, .24), 0 1px 2px rgba(0, 0, 0, .18);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, .3);
  --shadow-3: 0 18px 48px rgba(0, 0, 0, .38);
}
[data-theme="dark"] .btn-success { color: #0F1728; }
[data-theme="dark"] .btn-warning { color: var(--amber); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
}
img { max-width: 100%; height: auto; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; line-height: 1.25; margin: 0 0 .5rem; color: var(--ink); }
h1 { font-size: 1.5rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }
.text-red { color: var(--red); }
.text-green { color: var(--brand-strong); }
.text-amber { color: var(--amber); }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.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; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
.icon { width: 20px; height: 20px; flex: none; vertical-align: -4px; }

/* ---------- Coquille de l'application ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; background: linear-gradient(to right, var(--primary) var(--sidebar-w), transparent var(--sidebar-w)); }
.sidebar {
  background: var(--primary);
  color: #D7DDE2;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
  scrollbar-width: thin; scrollbar-color: #3A4350 transparent;
}
.brand { display: flex; align-items: center; gap: .65rem; padding: 1rem 1rem .9rem; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand:hover { text-decoration: none; }
.brand img { width: 38px; height: 38px; }
.brand img.brand-emblem { object-fit: contain; }
.brand img.brand-emblem-oma { width: 58px; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 1.02rem; letter-spacing: .01em; line-height: 1.1; }
.brand-name small { display: block; font-family: var(--font-body); font-weight: 400; font-size: .74rem; color: var(--brand); letter-spacing: 0; margin-top: 2px; }
.nav { padding: .6rem .55rem 1.5rem; flex: 1; }
.nav-group { margin-top: .35rem; }
.nav-group > button {
  width: 100%; display: flex; align-items: center; gap: .6rem; background: none; border: 0; color: #C6CDD3;
  padding: .55rem .65rem; border-radius: 6px; font: inherit; font-size: .93rem; cursor: pointer; text-align: left;
  transition: background-color var(--motion-fast) ease, color var(--motion-fast) ease;
}
.nav-group > button:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-group > button .chev { margin-left: auto; transition: transform .15s; opacity: .6; width: 16px; height: 16px; }
.nav-group.open > button .chev { transform: rotate(90deg); }
.nav-group ul { list-style: none; margin: 0; padding: 0 0 0 2.05rem; display: block; max-height: 0; opacity: 0; overflow: hidden; visibility: hidden; transition: max-height var(--motion-ui) var(--ease-ui), opacity var(--motion-fast) ease, margin var(--motion-ui) ease, visibility 0s linear var(--motion-ui); }
.nav-group.open ul { max-height: 900px; opacity: 1; margin: 0 0 .25rem; visibility: visible; transition-delay: 0s; }
.nav a.nav-link {
  display: flex; align-items: center; gap: .6rem; color: #AEB7BF; padding: .42rem .65rem; border-radius: 6px;
  font-size: .9rem; text-decoration: none; position: relative; transition: color var(--motion-fast) ease, background-color var(--motion-fast) ease;
}
.nav a.nav-link:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav .nav-link.disabled { display:flex; align-items:center; gap:.6rem; color:#78838e; padding:.42rem .65rem; border-radius:6px; font-size:.9rem; cursor:not-allowed; }
.nav .nav-link.disabled .nav-label { flex:1; }
.nav a.nav-link.active { color: #fff; background: rgba(79,70,229,.28); }
.nav a.nav-link.active::before { content: ""; position: absolute; left: -.55rem; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: #818CF8; }
.nav > a.nav-link { font-size: .93rem; color: #C6CDD3; }
.nav .count { margin-left: auto; background: var(--amber-lamp); color: var(--navy); font-size: .72rem; font-weight: 700; border-radius: 999px; padding: 0 .45rem; line-height: 1.35rem; }
.sidebar-foot { padding: .8rem 1rem 1rem; border-top: 1px solid rgba(255,255,255,.07); font-size: .78rem; color: #8994A0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem; position: sticky; top: 0; z-index: 30;
}
.topbar .menu-toggle { display: none; }
.house-plate {
  display: flex; align-items: center; gap: .55rem; background: var(--primary); color: #fff; border-radius: 6px;
  padding: .28rem .35rem .28rem .65rem; font-size: .88rem; max-width: 420px;
}
.house-plate .plate-code { font-family: var(--font-head); font-weight: 700; font-size: .8rem; background: var(--brand); color: var(--navy); border-radius: 4px; padding: 0 .4rem; line-height: 1.4rem; }
.house-plate select { background: transparent; color: #fff; border: 0; font: inherit; font-weight: 600; padding: .15rem 1.4rem .15rem .15rem; max-width: 300px; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 2px center; background-size: 14px; }
.house-plate select option { color: var(--ink); }
.house-plate form { display: flex; align-items: center; gap: .55rem; }
.house-plate select { width: auto; min-width: 0; }
.house-plate .plate-name { font-weight: 600; padding-right: .3rem; }
.topbar-search { flex: 1; max-width: 420px; position: relative; }
.topbar-search input[type=search] { width: 100%; padding-left: 2.4rem; background: var(--surface-2); }
.topbar-search .icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--faint); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .4rem; }
.rate-chip { display: inline-flex; align-items: center; min-height: 32px; font-size: .8rem; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: .15rem .65rem; white-space: nowrap; }
.rate-chip strong { color: var(--ink); }
.icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 8px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; transition: background-color var(--motion-fast) ease, color var(--motion-fast) ease, transform var(--motion-fast) ease; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--red-lamp); color: #fff; font-size: .68rem; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; border: 2px solid var(--surface); }
.user-btn { display: flex; align-items: center; gap: .5rem; background: none; border: 0; cursor: pointer; padding: .25rem .4rem; border-radius: 8px; font: inherit; color: var(--ink); transition: background-color var(--motion-fast) ease; }
.user-btn:hover { background: var(--surface-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-tint); color: var(--brand-deep); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .82rem; font-family: var(--font-head); flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 88px; height: 88px; font-size: 1.6rem; border-radius: 12px; }
.user-meta { text-align: left; line-height: 1.15; }
.user-meta small { display: block; color: var(--muted); font-size: .75rem; }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow-2); padding: .35rem; display: block; z-index: 50;
  opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(-5px) scale(.99); transform-origin: top right;
  transition: opacity var(--motion-fast) ease, transform var(--motion-ui) var(--ease-ui), visibility 0s linear var(--motion-ui);
}
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0) scale(1); transition-delay: 0s; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: .55rem; width: 100%; padding: .5rem .65rem; border-radius: 6px; color: var(--ink); background: none; border: 0; font: inherit; font-size: .9rem; cursor: pointer; text-align: left; text-decoration: none; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-message { padding: .55rem .65rem; color: var(--muted); font-size: .88rem; }
.dropdown-menu hr { border: 0; border-top: 1px solid var(--line); margin: .3rem 0; }
.notif-menu { width: 360px; max-width: calc(100vw - 24px); }
.notif-item { display: block !important; border-bottom: 1px solid var(--line); border-radius: 0 !important; }
.notif-item:last-of-type { border-bottom: 0; }
.notif-item.unread { background: var(--brand-tint); }
.notif-item strong { display: block; font-size: .87rem; }
.notif-item span { display: block; font-size: .8rem; color: var(--muted); }

.content { padding: 1.4rem 1.5rem 3rem; max-width: 1480px; width: 100%; animation: abg-content-enter 220ms var(--ease-ui) backwards; }
@keyframes abg-content-enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.demo-band { background: repeating-linear-gradient(-45deg, #F2B01E 0 14px, #212832 14px 28px); color: #fff; font-size: .8rem; text-align: center; padding: 2px; }
.demo-band span { background: var(--primary); padding: .1rem .7rem; border-radius: 4px; }
@media (max-width: 760px) { .demo-band { font-size: .72rem; } .demo-band span { display: inline-block; padding: .05rem .5rem; } }

/* ---------- En-têtes de page ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin: .2rem 0 0; font-size: .92rem; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: .82rem; color: var(--muted); margin-bottom: .35rem; display: flex; gap: .35rem; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs span::after { content: "/"; margin-left: .35rem; color: var(--line-strong); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .55rem 1rem; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: .9rem;
  cursor: pointer; text-decoration: none; white-space: nowrap; min-height: 40px;
  transition: background-color var(--motion-fast) ease, border-color var(--motion-fast) ease, color var(--motion-fast) ease, transform var(--motion-fast) ease;
}
.btn:active:not([disabled]) { transform: translateY(1px); }
.btn:hover { text-decoration: none; background: var(--surface-2); border-color: var(--faint); }
.btn-primary { background: var(--action); border-color: var(--action); color: #fff; }
.btn-primary:hover { background: var(--action-hover); border-color: var(--action-hover); }
.btn-dark { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-dark:hover { background: #243554; border-color: #243554; }
.btn-danger { background: var(--surface); border-color: #E7B4B0; color: var(--red); }
.btn-danger:hover { background: var(--red-tint); border-color: var(--red); }
.btn-success { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; }
.btn-success:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
.btn-warning { background: var(--amber-tint); border-color: var(--warning-border); color: #895600; }
.btn-warning:hover { filter: brightness(.97); }
.btn-info { background: var(--blue-tint); border-color: var(--info-border); color: var(--blue); }
.btn-info:hover { filter: brightness(.97); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(33,40,50,.06); border-color: transparent; }
.btn-sm { padding: .3rem .65rem; min-height: 32px; font-size: .84rem; }
.btn-lg { padding: .75rem 1.3rem; font-size: 1rem; min-height: 48px; }
.btn-block { width: 100%; }
.btn:focus-visible, .icon-btn:focus-visible, .user-btn:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; box-shadow: var(--focus); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .58; cursor: not-allowed; }
.btn.is-busy { cursor: progress; }
.btn.is-busy::after { content: ""; width: .85em; height: .85em; flex: none; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: abg-button-spin 700ms linear infinite; }
@keyframes abg-button-spin { to { transform: rotate(360deg); } }
.inline-form { display: inline; margin: 0; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- Panneaux ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); margin-bottom: 1.1rem; transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 1rem; }
.panel-body { padding: 1.1rem; }
.panel-body.tight { padding: 0; }
details.panel > summary { cursor: pointer; list-style: none; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: ""; flex: none; width: .5rem; height: .5rem; margin: -.25rem .25rem 0 auto; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s ease; }
details.panel[open] > summary::after { transform: rotate(-135deg); margin-top: .25rem; }
details.panel:not([open]) > summary { border-bottom: 0; }
details.panel > summary:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-lg); }
.panel-foot { padding: .75rem 1.1rem; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 1.1rem; }

/* Indicateurs : modules alignés comme sur un rail DIN */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; margin-bottom: 1.1rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .95rem .85rem; position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand); }
.kpi.kpi-amber::before { background: var(--amber-lamp); }
.kpi.kpi-red::before { background: var(--red-lamp); }
.kpi.kpi-blue::before { background: var(--blue-lamp); }
.kpi.kpi-ink::before { background: var(--primary); }
.kpi-label { font-size: .8rem; color: var(--muted); }
.kpi-value { font-family: var(--font-head); font-weight: 700; font-size: 1.45rem; line-height: 1.25; margin-top: .15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value small { font-size: .8rem; font-weight: 500; color: var(--muted); }
.kpi-foot { font-size: .78rem; color: var(--muted); margin-top: .15rem; }
a.kpi { color: inherit; text-decoration: none; display: block; }
a.kpi { transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease, transform var(--motion-fast) ease; }
a.kpi:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); transform: translateY(-1px); }

/* ---------- Voyants d'état ---------- */
.lamp { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 600; padding: .12rem .55rem .12rem .45rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; color: var(--ink-2); }
.lamp i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--gray-lamp); }
.lamp-green i { background: radial-gradient(circle at 35% 35%, #9BE39E, var(--brand) 60%); box-shadow: 0 0 0 2px rgba(76,176,80,.18), 0 0 6px rgba(76,176,80,.55); }
.lamp-amber i { background: radial-gradient(circle at 35% 35%, #FFE29A, var(--amber-lamp) 60%); box-shadow: 0 0 0 2px rgba(242,176,30,.2), 0 0 6px rgba(242,176,30,.6); }
.lamp-red i { background: radial-gradient(circle at 35% 35%, #FFB3B5, var(--red-lamp) 60%); box-shadow: 0 0 0 2px rgba(229,72,77,.18), 0 0 6px rgba(229,72,77,.55); }
.lamp-blue i { background: radial-gradient(circle at 35% 35%, #B7D6FA, var(--blue-lamp) 60%); box-shadow: 0 0 0 2px rgba(59,139,235,.18), 0 0 6px rgba(59,139,235,.5); }
.lamp-gray i { background: var(--gray-lamp); }
.lamp-red { color: var(--red); border-color: var(--danger-border); background: var(--red-tint); }
.lamp-amber { color: var(--amber); border-color: var(--warning-border); background: var(--amber-tint); }
.tag { display: inline-block; font-size: .76rem; padding: .05rem .45rem; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.tag-code { font-family: var(--font-head); font-weight: 700; background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Messages ---------- */
.alert { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem .95rem; border-radius: var(--radius); border: 1px solid; margin-bottom: 1rem; font-size: .92rem; animation: abg-content-enter 180ms var(--ease-ui) backwards; }
.alert .icon { margin-top: 1px; }
.alert-success { background: var(--brand-tint); border-color: var(--success-border); color: var(--brand-deep); }
.alert-error { background: var(--red-tint); border-color: var(--danger-border); color: var(--red); }
.alert-warning { background: var(--amber-tint); border-color: var(--warning-border); color: var(--amber); }
.alert-info { background: var(--blue-tint); border-color: var(--info-border); color: var(--blue); }
.alert p:last-child { margin-bottom: 0; }
.alert .close { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; min-width: 40px; height: 40px; margin: -.45rem -.65rem -.45rem auto; border-radius: var(--radius-sm); background: transparent; border: 0; color: inherit; cursor: pointer; }
.alert .close:hover { background: rgba(15, 23, 42, .06); }
.alert .close:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
.netbar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: var(--primary); color: #fff; border-radius: 999px; padding: .5rem 1rem; font-size: .88rem; display: none; align-items: center; gap: .5rem; box-shadow: var(--shadow-2); z-index: 100; }
.netbar.show { display: flex; }
.draft-bar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }

/* ---------- Formulaires ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .9rem 1rem; }
.form-grid > * { grid-column: span 12; }
.col-2 { grid-column: span 2 !important; } .col-3 { grid-column: span 3 !important; } .col-4 { grid-column: span 4 !important; }
.col-5 { grid-column: span 5 !important; } .col-6 { grid-column: span 6 !important; } .col-7 { grid-column: span 7 !important; }
.col-8 { grid-column: span 8 !important; } .col-9 { grid-column: span 9 !important; } .col-12 { grid-column: span 12 !important; }
.form-section { grid-column: span 12; margin: .6rem 0 0; padding-top: .9rem; border-top: 1px solid var(--line); font-family: var(--font-head); font-size: .98rem; font-weight: 600; }
.form-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field label, fieldset.field legend { font-size: .86rem; font-weight: 600; color: var(--ink-2); }
fieldset.field { border: 0; padding: 0; margin: 0; }
.req { color: var(--red); }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=time], input[type=month], input[type=search], input[type=url], select, textarea {
  width: 100%; font: inherit; font-size: .95rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: .55rem .75rem; min-height: var(--control-height); transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease, background-color var(--motion-fast) ease;
}
input[type=text]:hover:not(:disabled):not([readonly]), input[type=email]:hover:not(:disabled):not([readonly]), input[type=tel]:hover:not(:disabled):not([readonly]), input[type=password]:hover:not(:disabled):not([readonly]), input[type=number]:hover:not(:disabled):not([readonly]), input[type=date]:hover:not(:disabled):not([readonly]), input[type=time]:hover:not(:disabled):not([readonly]), input[type=month]:hover:not(:disabled):not([readonly]), input[type=search]:hover:not(:disabled):not([readonly]), input[type=url]:hover:not(:disabled):not([readonly]), select:hover:not(:disabled), textarea:hover:not(:disabled):not([readonly]) { border-color: var(--action); }
textarea { resize: vertical; min-height: 84px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--action); box-shadow: var(--focus); }
input[type=text]:focus-visible, input[type=email]:focus-visible, input[type=tel]:focus-visible, input[type=password]:focus-visible, input[type=number]:focus-visible, input[type=date]:focus-visible, input[type=time]:focus-visible, input[type=month]:focus-visible, input[type=search]:focus-visible, input[type=url]:focus-visible, input[type=file]:focus-visible, input[type=checkbox]:focus-visible, input[type=radio]:focus-visible, input[type=color]:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; box-shadow: none; }
input:disabled, select:disabled, textarea:disabled { color: var(--muted); background: var(--surface-2); border-color: var(--line); cursor: not-allowed; opacity: 1; }
input[readonly], textarea[readonly] { color: var(--ink-2); background: var(--surface-2); border-style: dashed; cursor: default; }
input[type=file] { width: 100%; min-height: var(--control-height); padding: .35rem .45rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); font: inherit; font-size: .88rem; }
input[type=file]::file-selector-button { margin-right: .7rem; padding: .38rem .7rem; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font: inherit; cursor: pointer; }
input[type=file]::file-selector-button:hover { background: var(--line); }
select[multiple] { min-height: 120px; }
.has-error input:not([type=checkbox]):not([type=radio]), .has-error select, .has-error textarea { border-color: var(--red); box-shadow: 0 0 0 2px var(--red-tint); }
.has-error input:focus-visible, .has-error select:focus-visible, .has-error textarea:focus-visible { outline-color: var(--red); box-shadow: none; }
.has-error input[type=checkbox], .has-error input[type=radio] { accent-color: var(--red); }
.has-error .check input[type=checkbox], .has-error .radio input[type=radio] { outline: 2px solid var(--red); outline-offset: 2px; }
.field-error { color: var(--red); font-size: .84rem; line-height: 1.4; margin: .05rem 0 0; }
.help { color: var(--muted); font-size: .82rem; line-height: 1.45; margin: .05rem 0 0; }
.input-affix { display: flex; align-items: stretch; }
.input-affix input { border-radius: var(--radius) 0 0 var(--radius); }
.input-affix .affix { display: flex; align-items: center; padding: 0 .7rem; border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 var(--radius) var(--radius) 0; background: var(--surface-2); color: var(--muted); font-size: .85rem; font-weight: 600; }
.check, .radio { display: inline-flex; align-items: center; gap: .45rem; font-size: .92rem; cursor: pointer; font-weight: 400 !important; }
.check input, .radio input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--action); cursor: pointer; }
.check input:disabled, .radio input:disabled { opacity: .8; cursor: not-allowed; }
.check:has(input:disabled), .radio:has(input:disabled), fieldset.field:disabled > .check-grid, fieldset.field:disabled > .radio-row { color: var(--muted); cursor: not-allowed; }
.field-check .field-error, fieldset.field .field-error { margin-top: .4rem; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .4rem .9rem; margin-top: .3rem; }
.radio-row { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; margin-top: .25rem; }
.field-check { justify-content: flex-end; }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem; }
.choice-card { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: .7rem .8rem; cursor: pointer; display: flex; gap: .55rem; align-items: flex-start; background: var(--surface); }
.choice-card:has(input:checked) { border-color: var(--brand-strong); background: var(--brand-tint); box-shadow: inset 0 0 0 1px var(--brand-strong); }
.choice-card input { margin-top: 3px; accent-color: var(--brand-strong); }
.choice-card strong { display: block; font-size: .92rem; }
.choice-card span { font-size: .8rem; color: var(--muted); }

/* ---------- Filtres ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.filters .field { min-width: 150px; flex: 1 1 160px; max-width: 260px; }
.filters .field.grow { max-width: 360px; flex: 2 1 240px; }
.filters .field label { font-size: .78rem; }
.filters input, .filters select { min-height: 36px; padding: .35rem .6rem; font-size: .9rem; }
.filters .btn { min-height: 36px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .6rem 1.1rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.export-links { display: flex; gap: .3rem; flex-wrap: wrap; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; background: var(--surface); }
.table th { text-align: left; font-weight: 600; font-size: .78rem; letter-spacing: .015em; color: var(--muted); background: var(--surface-2); padding: .7rem .85rem; border-bottom: 1px solid var(--line-strong); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table td { padding: .68rem .85rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody td { transition: background-color var(--motion-fast) ease; }
.table tbody tr:hover td { background: var(--row-hover); }
.table tr.row-link { cursor: pointer; }
.table tr.is-muted td { color: var(--muted); }
.table tr.is-alert td { background: var(--danger-soft); }
.table tfoot td, .table tfoot th { font-weight: 700; color: var(--ink-2); background: var(--surface-2); border-top: 2px solid var(--line-strong); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.actions { white-space: nowrap; text-align: right; vertical-align: middle; }
.table td.actions .btn { min-height: 34px; }
.table .cell-title { font-weight: 600; color: var(--ink); }
/* Zone de clic élargie sans décaler la densité du tableau (cible ≥ 24 px). */
.table a.cell-title { display: inline-block; padding-block: 4px; margin-block: -4px; }
.panel-head > a.small { display: inline-flex; align-items: center; min-height: 32px; }
.table .cell-sub { display: block; font-size: .8rem; color: var(--muted); }
.table input, .table select { min-height: 34px; padding: .3rem .5rem; font-size: .9rem; }
.table-compact td, .table-compact th { padding: .35rem .5rem; }
.empty { text-align: center; padding: 2.2rem 1rem; color: var(--muted); }
.empty .icon { width: 36px; height: 36px; color: var(--line-strong); margin-bottom: .4rem; }
.empty h3 { color: var(--ink); margin-bottom: .3rem; }
.empty > p { max-width: 58ch; margin-inline: auto; }
.empty > p:last-child { margin-bottom: 0; }
.empty .btn { margin-top: .35rem; }
.row-link-accessible:focus { position: static; display: inline-block; width: auto; height: auto; padding: .1rem .25rem; margin: .15rem 0 0; overflow: visible; clip: auto; white-space: normal; border-radius: 3px; outline: 2px solid var(--action); outline-offset: 2px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem 1.1rem; flex-wrap: wrap; font-size: .86rem; }
.pager-info { color: var(--muted); margin: 0; padding: .7rem 1.1rem; font-size: .86rem; }
.pager .pager-info { padding: 0; }
.pager-links { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; }
.pager-num, .pager-current { min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); color: var(--ink); }
.pager-links > .btn { min-height: 40px; }
.pager-num:hover { background: var(--surface-2); text-decoration: none; }
.pager-current { background: var(--primary); color: #fff; font-weight: 700; }

/* Liste de définitions (fiches) */
.dl { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; gap: .45rem 1rem; margin: 0; font-size: .92rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.profile { display: flex; gap: 1rem; align-items: center; }
.profile h1 { margin-bottom: .15rem; }
.meta-line { display: flex; flex-wrap: wrap; gap: .4rem .9rem; color: var(--muted); font-size: .88rem; }

/* Onglets */
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: .6rem .9rem; color: var(--muted); border: 0; background: none; font: inherit; font-weight: 600; font-size: .9rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; cursor: pointer; text-decoration: none; }
.tabs a:hover, .tabs button:hover { color: var(--ink); text-decoration: none; }
.tabs a.active, .tabs button.active { color: var(--accent-ink); border-bottom-color: var(--action); }
.tab-panel:not(.active), [data-tab-panel]:not(.active) { display: none; }
.tab-panel.active, [data-tab-panel].active { animation: abg-content-enter 180ms var(--ease-ui) backwards; }
/* Tableaux de saisie (barèmes, échéanciers, lignes d'achat…) */
.table-inputs td { padding: .35rem .45rem; vertical-align: middle; }
.table-inputs input, .table-inputs select { min-height: 36px; padding: .35rem .5rem; font-size: .9rem; }
.table-inputs select { min-width: 9.5rem; }
.table-inputs .num input { text-align: right; min-width: 5rem; }

/* Chronologie (historique, audit) */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 .9rem 1.4rem; font-size: .88rem; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 16px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline time { display: block; color: var(--muted); font-size: .78rem; }

/* Barre de progression (soldes, présence) */
.meter { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; min-width: 80px; }
.meter > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.meter.amber > span { background: var(--amber-lamp); }
.meter.red > span { background: var(--red-lamp); }

/* ---------- Planning (semaine) ---------- */
.week { display: grid; grid-template-columns: 56px repeat(var(--days, 6), minmax(140px, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; min-width: 820px; }
.week-head { background: var(--surface-2); border-bottom: 1px solid var(--line); padding: .5rem .6rem; font-size: .82rem; font-weight: 600; text-align: center; }
.week-head.today { background: var(--brand-tint); color: var(--brand-deep); }
.week-head.holiday { background: var(--amber-tint); color: #7A4D00; }
.week-add { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; margin-left: .3rem; border: 1px solid transparent; border-radius: 8px; color: var(--muted); vertical-align: middle; }
.week-add:hover, .week-add:focus-visible { color: var(--accent-ink); background: var(--surface); border-color: var(--line); text-decoration: none; }
.week-add .icon { width: 16px; height: 16px; vertical-align: 0; }
.week-hours { border-right: 1px solid var(--line); position: relative; }
.week-hours span { position: absolute; right: 6px; font-size: .72rem; color: var(--faint); transform: translateY(-50%); }
.week-day { position: relative; border-right: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour-h, 52px) - 1px), var(--line) calc(var(--hour-h, 52px) - 1px), var(--line) var(--hour-h, 52px)); }
.week-day:last-child { border-right: 0; }
.week-day.holiday { background-color: #FFFCF3; }
.slot { position: absolute; left: 4px; right: 4px; border-radius: 6px; padding: .3rem .45rem; font-size: .76rem; line-height: 1.25; overflow: hidden; border: 1px solid; border-left-width: 4px; background: var(--brand-tint); border-color: var(--success-border); border-left-color: var(--brand); color: var(--ink); text-decoration: none; }
.slot:hover { text-decoration: none; box-shadow: var(--shadow-2); z-index: 2; }
.slot strong { display: block; font-size: .78rem; }
.slot.realisee { background: #EAF4FD; border-color: #C3DAF3; border-left-color: var(--blue-lamp); }
.slot.annulee { background: #F4F5F6; border-color: var(--line); border-left-color: var(--gray-lamp); color: var(--faint); text-decoration: line-through; }
.slot.forcee { border-left-color: var(--red-lamp); }
.week-scroll { overflow-x: auto; }
.conflict-list { list-style: none; padding: 0; margin: .4rem 0 0; }
.conflict-list li { padding: .45rem .6rem; border-radius: 6px; margin-bottom: .35rem; font-size: .88rem; display: flex; gap: .5rem; }
.conflict-list li.block { background: var(--red-tint); color: var(--red); }
.conflict-list li.warn { background: var(--amber-tint); color: #7A4D00; }
.conflict-list li.info { background: var(--blue-tint); color: var(--blue); }

/* Pointage */
.att-grid td { vertical-align: middle; }
.att-choices { display: flex; gap: .3rem; flex-wrap: wrap; }
.att-choices label { position: relative; }
.att-choices input { position: absolute; opacity: 0; pointer-events: none; }
.att-choices span { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 36px; padding: 0 .55rem; border-radius: 6px; border: 1px solid var(--line-strong); font-weight: 700; font-size: .85rem; cursor: pointer; background: var(--surface); }
.att-choices input:checked + span.p { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; }
.att-choices input:checked + span.a { background: var(--red); border-color: var(--red); color: #fff; }
.att-choices input:checked + span.r { background: var(--amber-lamp); border-color: var(--amber-lamp); color: var(--navy); }
.att-choices input:checked + span.aj { background: var(--blue); border-color: var(--blue); color: #fff; }
.att-choices input:focus-visible + span { box-shadow: var(--focus); }

/* Grille de notes */
.grade-input { width: 82px !important; text-align: right; }
.locked-banner { display: flex; gap: .5rem; align-items: center; }

/* ---------- Pages d'authentification ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); background: var(--surface); }
.auth-visual { background: var(--primary); color: #fff; padding: clamp(2.25rem, 5vw, 4.5rem); display: flex; flex-direction: column; justify-content: space-between; gap: 2.5rem; position: relative; isolation: isolate; overflow: hidden; }
.auth-visual::before { content: ""; position: absolute; z-index: -1; width: min(42vw, 560px); aspect-ratio: 1; right: -15%; top: 12%; border-radius: 50%; background: radial-gradient(circle, rgba(76,176,80,.18), rgba(76,176,80,0) 68%); animation: auth-glow-drift 12s ease-in-out infinite alternate; }
.auth-visual .wires { position: absolute; inset: 0; z-index: -1; opacity: .42; pointer-events: none; animation: auth-wires-drift 22s ease-in-out infinite alternate; }
.auth-story { position: relative; width: 100%; max-width: 700px; margin: auto 0; }
.auth-brand-mark { display: inline-flex; align-items: center; justify-content: center; min-width: 190px; min-height: 100px; padding: .55rem 1rem; margin-bottom: 1.8rem; border: 1px solid rgba(255,255,255,.22); border-radius: 18px; background: rgba(255,255,255,.08); box-shadow: 0 18px 50px rgba(0,0,0,.16); backdrop-filter: blur(8px); animation: auth-mark-enter .8s cubic-bezier(.2,.75,.25,1) both; }
.auth-brand-mark img { display: block; width: min(220px, 32vw); height: auto; max-height: 110px; object-fit: contain; border-radius: 7px; }
.auth-brand-copy { animation: auth-copy-enter .7s .12s cubic-bezier(.2,.75,.25,1) both; }
.auth-kicker { display: inline-flex; align-items: center; gap: .55rem; margin: 0 0 .7rem; color: #A9DCA9; font-size: .76rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.auth-kicker::before { content: ""; width: 24px; height: 2px; border-radius: 2px; background: #4CB050; }
.auth-visual h1 { color: #fff; font-size: clamp(2.1rem, 4vw, 3.45rem); letter-spacing: -.035em; line-height: 1.03; margin: 0 0 .85rem; }
.auth-visual .auth-intro { max-width: 570px; margin: 0; color: #D1D9E1; font-size: clamp(1rem, 1.3vw, 1.15rem); line-height: 1.65; }
.auth-highlights { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin-top: 2rem; }
.auth-highlight { display: flex; gap: .7rem; align-items: flex-start; min-width: 0; padding: .9rem .8rem; border: 1px solid rgba(255,255,255,.13); border-radius: 12px; background: rgba(255,255,255,.055); backdrop-filter: blur(5px); animation: auth-highlight-enter .6s cubic-bezier(.2,.75,.25,1) both; }
.auth-highlight:nth-child(2) { animation-delay: .12s; }
.auth-highlight:nth-child(3) { animation-delay: .22s; }
.auth-highlight-number { flex: none; color: #75C879; font: 800 .78rem/1.4 var(--font-head); }
.auth-highlight strong { display: block; color: #fff; font-size: .84rem; }
.auth-highlight p { margin: .25rem 0 0; color: #B9C4CE; font-size: .76rem; line-height: 1.45; }
.auth-visual .domains { position: relative; display: flex; flex-wrap: wrap; gap: .5rem; }
.auth-visual .domains span { border: 1px solid rgba(255,255,255,.18); border-radius: 999px; padding: .3rem .8rem; font-size: .78rem; color: #D9E2E9; background: rgba(255,255,255,.035); }
.auth-form { display: flex; align-items: center; justify-content: center; padding: clamp(1.5rem, 4vw, 3.5rem); background: radial-gradient(ellipse at 85% 15%, rgba(76,176,80,.075), transparent 42%), var(--surface); }
.auth-box { width: 100%; max-width: 440px; padding: clamp(1.5rem, 3.5vw, 2.6rem); border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: 0 22px 70px rgba(20,32,48,.12); animation: auth-form-enter .75s .08s cubic-bezier(.2,.75,.25,1) both; }
.auth-box h2 { font-size: 1.35rem; }
.auth-box .form-grid { gap: .8rem; }
@keyframes auth-mark-enter { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes auth-copy-enter { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes auth-highlight-enter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes auth-form-enter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes auth-glow-drift { from { transform: translate3d(-12px, -8px, 0) scale(.96); opacity: .65; } to { transform: translate3d(18px, 14px, 0) scale(1.04); opacity: 1; } }
@keyframes auth-wires-drift { from { transform: translate3d(-5px, 0, 0); } to { transform: translate3d(8px, -5px, 0); } }
.code-input { font-family: var(--font-head); font-size: 1.6rem !important; letter-spacing: .4em; text-align: center; }
.qr-box { display: inline-block; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.qr-box svg { display: block; width: 200px; height: 200px; }
.secret { font-family: ui-monospace, Consolas, monospace; background: var(--surface-2); border: 1px dashed var(--line-strong); padding: .4rem .6rem; border-radius: 6px; word-break: break-all; font-size: .92rem; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; font-family: ui-monospace, Consolas, monospace; font-size: 1rem; }
.codes span { background: var(--surface-2); border: 1px solid var(--line); padding: .35rem .5rem; border-radius: 6px; text-align: center; }

/* ---------- Divers ---------- */
.steps { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.steps span { font-size: .8rem; padding: .2rem .65rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.steps span.done { background: var(--brand-tint); border-color: #B8DFBA; color: var(--brand-deep); }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: .7rem; align-items: flex-start; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist .state { flex: none; margin-top: 2px; }
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font-body); font-size: 11px; fill: var(--muted); }
.legend { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: .4rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .3rem; vertical-align: -1px; }
.photo-frame { width: 132px; height: 160px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; }
.camera-box video, .camera-box canvas { width: 100%; max-width: 360px; border-radius: 8px; background: #000; }
dialog { color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); padding: 0; max-height: min(90dvh, 760px); overflow: auto; max-width: min(560px, calc(100vw - 24px)); width: 100%; }
dialog[open] { animation: abg-dialog-enter 180ms var(--ease-ui) backwards; }
@keyframes abg-dialog-enter { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
dialog::backdrop { background: rgba(33, 40, 50, .45); animation: abg-backdrop-enter 160ms ease backwards; }
@keyframes abg-backdrop-enter { from { background: rgba(33,40,50,0); } to { background: rgba(33,40,50,.45); } }
dialog .panel-head { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
dialog :focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }
.money-big { font-family: var(--font-head); font-weight: 700; font-size: 1.6rem; }
.line-items td { vertical-align: middle; }
.sum-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.sum-box .row { display: flex; justify-content: space-between; gap: 1rem; padding: .2rem 0; font-size: .92rem; }
.sum-box .row.total { border-top: 1px solid var(--line-strong); margin-top: .3rem; padding-top: .5rem; font-weight: 700; font-size: 1rem; }
.help-doc { max-width: 820px; }
.help-doc h1 { font-size: 1.6rem; }
.help-doc h2 { margin-top: 1.6rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.help-doc img { border: 1px solid var(--line); border-radius: 8px; margin: .5rem 0; }
.help-doc table { border-collapse: collapse; width: 100%; font-size: .9rem; margin: .6rem 0 1rem; }
.help-doc th, .help-doc td { border: 1px solid var(--line); padding: .4rem .6rem; text-align: left; }
.help-doc code { background: var(--surface-2); padding: .05rem .3rem; border-radius: 4px; font-size: .88em; }
.help-doc pre { background: var(--primary); color: #E3E8EC; padding: .8rem 1rem; border-radius: 8px; overflow-x: auto; }
.help-doc pre code { background: none; color: inherit; }
.help-doc blockquote { margin: .8rem 0; padding: .6rem .9rem; border-left: 4px solid var(--brand); background: var(--brand-tint); border-radius: 0 8px 8px 0; }
.error-page { max-width: 560px; margin: 8vh auto; text-align: center; padding: 1.5rem; }
.error-page .code { font-family: var(--font-head); font-weight: 700; font-size: 4rem; color: var(--line-strong); line-height: 1; }
.scan-hint { display: flex; gap: .75rem; align-items: center; }

/* États sombres : variables de surface et couleurs sémantiques restent distinctes. */
[data-theme="dark"] .table tr.is-alert td { background: var(--red-tint); }
[data-theme="dark"] .slot.realisee { background: #1C304A; border-color: #314D6F; }
[data-theme="dark"] .slot.annulee { background: #202B3D; }
[data-theme="dark"] .week-day.holiday { background-color: #302A1D; }
[data-theme="dark"] .week-head.holiday,
[data-theme="dark"] .conflict-list li.warn { color: var(--amber); }
[data-theme="dark"] .auth-visual { background: var(--primary); }
[data-theme="dark"] .auth-visual p { color: #CBD5E1; }
[data-theme="dark"] .auth-visual .domains span { color: #E2E8F0; }
[data-theme="dark"] .demo-band { background: repeating-linear-gradient(-45deg, #8A5A0A 0 14px, var(--primary) 14px 28px); }
[data-theme="dark"] .demo-band span { background: var(--primary); }
[data-theme="dark"] .btn-dark:hover { background: #2B3D5D; border-color: #2B3D5D; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; background: none; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); z-index: 80; transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow-2); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(33,40,50,.45); z-index: 70; }
  .topbar .menu-toggle { display: inline-flex; }
  .topbar-search { display: none; }
  .rate-chip { display: none; }
  .content { padding: 1rem 1rem 3rem; }
  .auth-visual { padding: 2rem; }
  .auth-highlights { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .auth-highlight:last-child { grid-column: 1 / -1; }
  .auth-highlight { padding: .75rem .6rem; gap: .45rem; }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  .form-actions .btn, .page-actions .btn { white-space: normal; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid > [class*="col-"] { grid-column: span 12 !important; }
  .user-meta { display: none; }
  .house-plate .plate-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .house-plate select { max-width: 160px; }
  .page-head { flex-direction: column; }
  .page-actions { width: 100%; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 1.2rem; }
  .auth-page { min-height: 100vh; display: flex; flex-direction: column; }
  .auth-visual { display: block; padding: 1rem 1rem .75rem; }
  .auth-visual .wires, .auth-visual .auth-highlights, .auth-visual .domains, .auth-kicker, .auth-intro { display: none; }
  .auth-story { display: flex; align-items: center; gap: .9rem; max-width: none; margin: 0; }
  .auth-brand-mark { flex: none; min-width: 0; min-height: 0; padding: .22rem .35rem; margin: 0; border-radius: 9px; box-shadow: none; backdrop-filter: none; }
  .auth-brand-mark img { width: 78px; max-height: 40px; border-radius: 4px; }
  .auth-brand-copy { animation-delay: .04s; }
  .auth-visual h1 { margin: 0; font-size: 1.28rem; letter-spacing: -.02em; }
  .auth-form { flex: 1; align-items: flex-start; padding: .6rem 1rem 2rem; }
  .auth-box { max-width: 520px; padding: 1.4rem; border-radius: 18px; box-shadow: 0 12px 40px rgba(20,32,48,.1); }
  .dl { grid-template-columns: 1fr; gap: .1rem; }
  .dl dd { margin-bottom: .5rem; }
  /* Les tableaux simples deviennent des fiches. Les structures complexes restent tabulaires et défilantes. */
  .table-stack thead { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
  .table-stack tr { display: block; border-bottom: 1px solid var(--line); padding: .55rem .25rem; }
  .table-stack td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .2rem .6rem; text-align: right; min-width: 0; overflow-wrap: anywhere; }
  .table-stack td.nowrap { white-space: normal; }
  .table-stack td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; text-align: left; font-weight: 600; flex: none; max-width: 42%; }
  .table-stack td:not([data-label])::before, .table-stack td[data-label=""]::before { content: none; }
  .table-stack td > * { min-width: 0; }
  .table-stack td:has(> .cell-title) { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: initial; text-align: left; }
  .table-stack td:has(> .cell-title)::before { max-width: none; }
  .table-stack .lamp { white-space: normal; text-align: left; }
  .table-stack td.actions { justify-content: flex-end; }
  .table-stack td.actions::before { content: none; }
  .table-stack:is(:has(tfoot), :has(td[colspan]), :has(th[colspan]), :has(tr.strong), .table-inputs, .notes-grid, .att-grid) { width: max-content; min-width: 100%; }
  .table-stack:is(:has(tfoot), :has(td[colspan]), :has(th[colspan]), :has(tr.strong), .table-inputs, .notes-grid, .att-grid) thead { position: static; width: auto; height: auto; margin: 0; padding: 0; overflow: visible; clip: auto; clip-path: none; white-space: normal; border: 0; }
  .table-stack:is(:has(tfoot), :has(td[colspan]), :has(th[colspan]), :has(tr.strong), .table-inputs, .notes-grid, .att-grid) tr { display: table-row; padding: 0; border: 0; }
  .table-stack:is(:has(tfoot), :has(td[colspan]), :has(th[colspan]), :has(tr.strong), .table-inputs, .notes-grid, .att-grid) td, .table-stack:is(:has(tfoot), :has(td[colspan]), :has(th[colspan]), :has(tr.strong), .table-inputs, .notes-grid, .att-grid) th { display: table-cell; text-align: initial; border-bottom: 1px solid var(--line); padding: .5rem .65rem; }
  .table-stack:is(:has(tfoot), :has(td[colspan]), :has(th[colspan]), :has(tr.strong), .table-inputs, .notes-grid, .att-grid) td::before, .table-stack:is(:has(tfoot), :has(td[colspan]), :has(th[colspan]), :has(tr.strong), .table-inputs, .notes-grid, .att-grid) th::before { content: none; }
  .table-stack:is(:has(tfoot), :has(td[colspan]), :has(th[colspan]), :has(tr.strong), .table-inputs, .notes-grid, .att-grid) td.actions { white-space: nowrap; text-align: right; }
  .filters .field { max-width: none; }
  .codes { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Impression ---------- */
@media print {
  :root, [data-theme="dark"] {
    color-scheme: light;
    --ink: #182230;
    --ink-2: #334155;
    --muted: #526178;
    --faint: #5F6E83;
    --paper: #FFFFFF;
    --surface: #FFFFFF;
    --surface-2: #F8FAFC;
    --line: #E2E8F0;
    --line-strong: #CBD5E1;
    --brand-strong: #2E7D32;
    --brand-deep: #1F5E25;
    --brand-tint: #EAF5EB;
    --amber: #A86A00;
    --amber-tint: #FFF6E0;
    --red: #B42318;
    --red-tint: #FDECEC;
    --blue: #1D63A6;
    --blue-tint: #E8F1FB;
    --success-soft: #EAF5EB;
    --warning-soft: #FFF6E0;
    --danger-soft: #FDECEC;
    --info-soft: #E8F1FB;
    --success-border: #B8DFBA;
    --warning-border: #F3DDA5;
    --danger-border: #F2C6C4;
    --info-border: #C3DAF3;
    --row-hover: #F8FAFC;
    --shadow-1: 0 1px 3px rgba(23, 35, 59, .06), 0 1px 2px rgba(23, 35, 59, .04);
    --shadow-2: 0 8px 24px rgba(23, 35, 59, .12);
    --shadow-3: 0 18px 48px rgba(23, 35, 59, .16);
  }
  .sidebar, .topbar, .page-actions, .filters, .toolbar, .pager, .no-print, .netbar, .demo-band, form.inline-form { display: none !important; }
  .app { display: block; }
  body { background: #fff; font-size: 11pt; }
  .content { padding: 0; max-width: none; }
  .panel { border: 0; box-shadow: none; }
  .table th { position: static; }
  a { color: inherit; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
.account-switch-banner{position:sticky;top:0;z-index:1000;display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.65rem 1rem;background:#8a4b08;color:#fff;box-shadow:0 2px 8px #0002}
.account-switch-banner>div{display:flex;align-items:baseline;gap:.75rem;flex-wrap:wrap}
.account-switch-banner .btn{background:#fff;color:#713c06;border-color:#fff;white-space:nowrap}
@media(max-width:600px){.account-switch-banner{align-items:flex-start;flex-direction:column}.account-switch-banner>div{display:block}.account-switch-banner span{display:block;font-size:.82rem}}

/* ---------- UI-02 : navigation et barre supérieure ---------- */
.app { transition: grid-template-columns var(--motion-ui) var(--ease-ui); }
.sidebar { width: 100%; transition: width var(--motion-ui) var(--ease-ui), transform var(--motion-ui) var(--ease-ui), box-shadow var(--motion-ui) ease; }
.sidebar-head { display: flex; align-items: center; min-height: 72px; padding: .45rem .6rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-head .brand { flex: 1; min-width: 0; padding: .4rem .35rem; border: 0; }
.sidebar-collapse { flex: none; color: #C6CDD3; }
.sidebar-collapse:hover, .sidebar-mobile-close:hover { color: #fff; background: rgba(255,255,255,.09); }
.sidebar-collapse .expand-icon { display: none; }
.sidebar-collapse.is-collapsed .collapse-icon { display: none; }
.sidebar-collapse.is-collapsed .expand-icon { display: block; }
.sidebar-mobile-close { display: none; flex: none; color: #D7DDE2; }
.nav-group > button .nav-label { min-width: 0; }
.nav-group > button:focus-visible, .nav a.nav-link:focus-visible { outline: 2px solid #A5B4FC; outline-offset: 2px; }
.sidebar-foot span { display: inline-block; }
.topbar { min-width: 0; gap: .7rem; }
.topbar-context { flex: 1 1 150px; min-width: 0; }
.topbar-title { display: block; overflow: hidden; color: var(--ink); font-family: var(--font-head); font-size: .98rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { flex: none; }
.house-plate { flex: none; border-radius: var(--radius); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.house-plate select { min-height: 34px; }
.house-plate select:focus-visible { outline: 2px solid #A5B4FC; outline-offset: 2px; box-shadow: none; }
.dropdown-menu { z-index: 100; }
.dropdown-menu a:focus-visible, .dropdown-menu button:focus-visible { outline: 2px solid var(--indigo); outline-offset: -2px; }
.notif-menu { max-height: min(70vh, 560px); overflow-y: auto; overscroll-behavior: contain; }
.user-btn[aria-expanded="true"], .icon-btn[aria-expanded="true"] { background: var(--surface-2); color: var(--accent-ink); }
.sidebar-collapse:focus-visible, .sidebar-mobile-close:focus-visible, .menu-toggle:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; box-shadow: none; }

/* Réduction desktop : les libellés restent dans l'arbre d'accessibilité et sont annoncés par le title natif. */
@media (min-width: 1025px) {
  body.sidebar-collapsed { --sidebar-w: 76px; }
  body.sidebar-collapsed .sidebar-head { justify-content: center; padding-inline: .45rem; }
  body.sidebar-collapsed .sidebar-head .brand { flex: 0 0 auto; padding: .4rem 0; }
  body.sidebar-collapsed .sidebar-head .brand-name,
  body.sidebar-collapsed .sidebar:not(.is-preview-expanded) .nav-label,
  body.sidebar-collapsed .sidebar:not(.is-preview-expanded) .nav-group .chev,
  body.sidebar-collapsed .sidebar:not(.is-preview-expanded) .sidebar-foot span { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
  body.sidebar-collapsed .sidebar:not(.is-preview-expanded) .nav-group > button,
  body.sidebar-collapsed .sidebar:not(.is-preview-expanded) .nav > .nav-link { justify-content: center; gap: 0; padding-inline: .35rem; }
  body.sidebar-collapsed .sidebar:not(.is-preview-expanded) .nav-group ul { display: none; }
  body.sidebar-collapsed .sidebar:not(.is-preview-expanded) .nav .count { display: none; }
  body.sidebar-collapsed .sidebar:not(.is-preview-expanded) .nav a.nav-link.active::before { left: 0; }
  body.sidebar-collapsed .sidebar.is-preview-expanded { position: fixed; inset: 0 auto 0 0; z-index: 85; width: 256px; box-shadow: var(--shadow-3); }
  body.sidebar-collapsed .sidebar.is-preview-expanded .brand-name,
  body.sidebar-collapsed .sidebar.is-preview-expanded .nav-label,
  body.sidebar-collapsed .sidebar.is-preview-expanded .nav-group .chev,
  body.sidebar-collapsed .sidebar.is-preview-expanded .sidebar-foot span { position: static; width: auto; height: auto; padding: initial; margin: initial; overflow: visible; clip: auto; white-space: normal; border: 0; }
  body.sidebar-collapsed .sidebar.is-preview-expanded .nav-group > button,
  body.sidebar-collapsed .sidebar.is-preview-expanded .nav > .nav-link { justify-content: flex-start; gap: .6rem; padding: .55rem .65rem; }
  body.sidebar-collapsed .sidebar.is-preview-expanded .nav-group ul { display: block; }
}

/* Mobile drawer: a real button backdrop, focus containment, Escape and body scroll lock are coordinated in app.js. */
.nav-backdrop { display: none; }
@media (max-width: 1024px) {
  .app { transition: none; }
  .sidebar { width: min(320px, 88vw); max-width: 360px; padding-bottom: env(safe-area-inset-bottom); }
  .sidebar-head { min-height: 68px; }
  .sidebar-collapse { display: none; }
  .sidebar-mobile-close { display: inline-flex; }
  .nav-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 70; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0; background: rgba(9, 17, 32, .58); cursor: default; animation: abg-backdrop-enter 160ms ease both; }
  .sidebar { z-index: 80; }
  body.nav-open { position: fixed; top: 0; left: 0; width: 100%; overflow: hidden; overscroll-behavior: none; }
  body.nav-open::after { display: none; }
  body.nav-open .sidebar { transform: translateX(0); }
  .topbar { gap: .4rem; padding-inline: .65rem; }
  .topbar-context { flex: 1 1 auto; }
  .topbar-title { font-size: .88rem; }
  .topbar-right { gap: .1rem; }
  .house-plate { max-width: 34vw; padding-left: .4rem; }
  .house-plate select { max-width: 24vw; }
  .dropdown-menu { right: -.2rem; }
  .notif-menu { width: min(360px, calc(100vw - 16px)); }
}
@media (max-width: 600px) {
  .topbar-title { max-width: 27vw; }
  .house-plate { max-width: 38vw; font-size: .78rem; }
  .house-plate select { max-width: 27vw; font-size: .78rem; }
  .user-btn { padding-inline: .15rem; }
}
@media (prefers-reduced-motion: reduce) {
  .app, .sidebar, .nav-backdrop { transition: none !important; animation: none !important; }
}
@media print {
  .nav-backdrop, .sidebar-collapse, .sidebar-mobile-close { display: none !important; }
  .app { transition: none; }
}

/* ---------- UI-03 : espaces Formateur et Technicien ---------- */
.dashboard-role {
  --dashboard-accent: var(--indigo);
  --dashboard-accent-soft: var(--indigo-tint);
  min-width: 0;
}
[data-theme="dark"] .dashboard-role {
  --dashboard-accent-soft: #202A42;
}
.dashboard-role .dashboard-hero {
  align-items: center;
  padding: 1.15rem 1.3rem;
  margin-bottom: 1.25rem;
  background: linear-gradient(115deg, var(--surface), var(--dashboard-accent-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.dashboard-role .dashboard-hero h1 {
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  letter-spacing: -.025em;
}
.dashboard-role .dashboard-hero .sub {
  color: var(--muted);
}
.dashboard-role .dashboard-panel {
  overflow: hidden;
  border-color: var(--line);
  box-shadow: var(--shadow-1);
}
.dashboard-role .dashboard-panel .panel-head {
  min-height: 56px;
  background: linear-gradient(90deg, var(--surface), var(--surface-2));
}
.dashboard-role .dashboard-panel .panel-head h2 {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .98rem;
  letter-spacing: -.01em;
}
.dashboard-role .dashboard-panel .table-wrap {
  scrollbar-color: var(--line-strong) transparent;
}
.dashboard-role .dashboard-panel .table tbody tr:last-child td {
  border-bottom: 0;
}
.dashboard-role .dashboard-panel .empty {
  padding: 2rem 1rem;
}
.dashboard-role .dashboard-grid {
  align-items: stretch;
  gap: 1rem;
}
.dashboard-role .dashboard-grid .panel-head {
  align-items: flex-start;
}
.dashboard-role .dashboard-panel--sessions .panel-head,
.dashboard-role .dashboard-panel--upcoming .panel-head {
  border-top: 2px solid var(--dashboard-accent);
}
@media (max-width: 760px) {
  .dashboard-role .dashboard-hero {
    align-items: stretch;
    padding: 1rem;
  }
  .dashboard-role .dashboard-hero .page-actions {
    width: 100%;
  }
  .dashboard-role .dashboard-hero .page-actions .btn {
    flex: 1 1 auto;
  }
  .dashboard-role .dashboard-panel .panel-head {
    padding-inline: .85rem;
  }
}

/* ---------- UI-03.3 : tableau de bord général ---------- */
.dashboard-general {
  --dashboard-accent: var(--indigo);
  --dashboard-accent-soft: var(--indigo-tint);
  min-width: 0;
}
[data-theme="dark"] .dashboard-general {
  --dashboard-accent-soft: #202A42;
}
.dashboard-general-hero {
  align-items: center;
  padding: clamp(1rem, 2vw, 1.6rem);
  margin-bottom: 1.25rem;
  background: linear-gradient(112deg, var(--surface) 25%, var(--dashboard-accent-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.dashboard-general-hero h1 {
  margin: .25rem 0 .2rem;
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  letter-spacing: -.035em;
}
.dashboard-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: var(--accent-ink);
  font-size: .68rem;
  font-weight: 750;
  letter-spacing: .1em;
  line-height: 1.4;
  text-transform: uppercase;
}
.dashboard-general-hero .sub {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin: 0;
  color: var(--muted);
}
.dashboard-general-hero .page-actions {
  gap: .55rem;
}
.dashboard-general-hero .page-actions .btn-primary {
  box-shadow: 0 5px 14px rgba(79, 70, 229, .2);
}
.dashboard-general .dashboard-pending {
  align-items: flex-start;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.dashboard-kpi-section {
  margin-bottom: 1.35rem;
}
.dashboard-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 .7rem;
}
.dashboard-section-heading h2 {
  margin: .15rem 0 0;
  color: var(--primary);
  font-family: var(--font-head);
  font-size: 1.05rem;
  letter-spacing: -.02em;
}
[data-theme="dark"] .dashboard-general .dashboard-section-heading h2 {
  color: var(--ink);
}
.dashboard-scope-label {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: .25rem .65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
}
.dashboard-kpis {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 205px), 1fr));
  gap: .85rem;
}
.dashboard-kpis .kpi {
  min-height: 105px;
  padding: .9rem 1rem .9rem 1.1rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  transition: transform var(--motion-ui) var(--ease-ui), border-color var(--motion-ui) ease, box-shadow var(--motion-ui) ease;
}
.dashboard-kpis .kpi::before {
  width: 3px;
  opacity: .9;
}
.dashboard-kpis .kpi-label {
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .01em;
}
.dashboard-kpis .kpi-value {
  margin-top: .28rem;
  font-size: clamp(1.15rem, 1.55vw, 1.55rem);
  letter-spacing: -.025em;
}
.dashboard-kpis .kpi-foot {
  margin-top: .3rem;
  line-height: 1.45;
}
.dashboard-kpis a.kpi:hover,
.dashboard-kpis a.kpi:focus-visible {
  border-color: var(--line-strong);
  border-color: color-mix(in srgb, var(--dashboard-accent) 35%, var(--line));
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}
.dashboard-kpis a.kpi:focus-visible {
  outline: none;
  box-shadow: var(--focus), var(--shadow-2);
}
.dashboard-general > .grid-main {
  align-items: start;
  gap: 1rem;
}
.dashboard-general .dashboard-panel {
  overflow: hidden;
  border-color: var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.dashboard-general .dashboard-panel .panel-head {
  min-height: 58px;
  padding-inline: 1.1rem;
  background: linear-gradient(90deg, var(--surface), var(--surface-2));
  border-top: 2px solid var(--dashboard-accent);
}
.dashboard-general .dashboard-panel .panel-head h2,
.dashboard-general .dashboard-panel .panel-head h3 {
  font-size: .96rem;
  letter-spacing: -.015em;
}
.dashboard-general .dashboard-panel .panel-body {
  min-width: 0;
}
.dashboard-general .dashboard-panel .empty {
  padding: 2rem 1rem;
}
.dashboard-general .dashboard-panel .table-wrap {
  scrollbar-color: var(--line-strong) transparent;
}
.dashboard-general .dashboard-panel .table tbody tr:last-child td {
  border-bottom: 0;
}
.dashboard-general .dashboard-panel--comparison .table-wrap {
  max-width: 100%;
  overflow-x: auto;
}
.dashboard-general .chart {
  max-width: 100%;
  min-height: 190px;
}
.dashboard-general .timeline li {
  padding-block: .65rem;
}
.row-link[tabindex="0"]:focus-visible { outline: 2px solid var(--action); outline-offset: -2px; background: var(--row-hover); }
@media (max-width: 760px) {
  .dashboard-general-hero {
    align-items: stretch;
    padding: 1rem;
  }
  .dashboard-general-hero .page-actions .btn {
    flex: 1 1 auto;
  }
  .dashboard-section-heading {
    align-items: flex-start;
  }
  .dashboard-scope-label {
    max-width: 48%;
    text-align: right;
  }
  .dashboard-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .6rem;
  }
  .dashboard-kpis .kpi {
    min-height: 100px;
    padding: .75rem .75rem .75rem .9rem;
  }
  .dashboard-kpis .kpi-value {
    font-size: clamp(1rem, 4vw, 1.25rem);
  }
  .dashboard-general > .grid-main {
    grid-template-columns: minmax(0, 1fr);
  }
  .dashboard-general .dashboard-panel .panel-head {
    padding-inline: .85rem;
  }
}
@media (max-width: 380px) {
  .dashboard-kpis {
    grid-template-columns: minmax(0, 1fr);
  }
  .dashboard-section-heading {
    flex-direction: column;
    align-items: flex-start;
  }
  .dashboard-scope-label {
    max-width: 100%;
    text-align: left;
  }
}
@media (max-width: 600px) {
  .alert { gap: .5rem; padding: .7rem .75rem; font-size: .88rem; }
  .alert .close { margin-right: -.45rem; }
  .table td.actions .btn { min-height: 40px; }
  .netbar { left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); max-width: 440px; width: max-content; min-width: min(220px, calc(100vw - 24px)); margin-inline: auto; transform: none; justify-content: center; border-radius: 12px; text-align: center; }
  dialog { max-height: calc(100dvh - 24px); }
  dialog .panel-body { padding: .9rem; }
  dialog .btn-row .btn { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .dashboard-kpis .kpi,
  .dashboard-kpis a.kpi:hover,
  .dashboard-kpis a.kpi:focus-visible {
    transition: none;
    transform: none;
  }
}
