/* =========================================================================
   Assistant RH « La Tradition » — design system
   Parchemin, espresso et or. Titres Fraunces, texte Inter.
   ========================================================================= */

@font-face { font-family: "Fraunces"; font-weight: 400; font-display: swap; src: url("../fonts/fraunces-400.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-weight: 600; font-display: swap; src: url("../fonts/fraunces-600.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("../fonts/inter-400.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("../fonts/inter-500.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("../fonts/inter-600.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("../fonts/inter-700.woff2") format("woff2"); }

:root {
  /* Couleurs */
  --bg: #F6F1E7;
  --bg-2: #EFE7D7;
  --surface: #FFFDF8;
  --surface-2: #FBF7EF;
  --line: #E8DEC9;
  --line-strong: #D8C9AA;
  --ink: #2B2117;
  --ink-2: #5C4E3C;
  --muted: #8A7A62;
  --espresso: #24170E;
  --espresso-2: #352419;
  --cream: #F3E7CF;
  --gold: #B8843A;
  --gold-2: #9C6D2A;
  --gold-soft: #F4E6CC;
  --success: #3F7D52;   --success-soft: #E4F0E6;
  --warning: #B7791F;   --warning-soft: #FBEFD9;
  --danger: #B4413A;    --danger-soft: #F8E3E0;
  --info: #3A6A8C;      --info-soft: #E2EDF4;
  /* Typo */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Formes */
  --r-sm: 8px; --r: 12px; --r-lg: 18px; --r-xl: 24px;
  --shadow-sm: 0 1px 2px rgba(43,33,23,.06);
  --shadow: 0 1px 2px rgba(43,33,23,.05), 0 6px 20px -8px rgba(43,33,23,.14);
  --shadow-lg: 0 24px 60px -20px rgba(36,23,14,.35);
  --sidebar-w: 248px;
  --ease: cubic-bezier(.2,.7,.2,1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--gold-2); text-decoration: none; }
a:hover { color: var(--espresso); }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; color: var(--espresso); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; } h4 { font-size: 1rem; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
code { font-size: .88em; background: var(--bg-2); padding: 1px 6px; border-radius: 6px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.icon { width: 18px; height: 18px; flex: none; }
[x-cloak] { display: none !important; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Coquille : barre latérale + contenu ---------- */
.nav-toggle { display: none; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  display: flex; flex-direction: column; gap: 8px; padding: 20px 14px;
  background: radial-gradient(120% 60% at 0% 0%, #3a271a 0%, var(--espresso) 55%) ; color: var(--cream);
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 18px; color: var(--cream); border-bottom: 1px solid rgba(243,231,207,.1); margin-bottom: 8px; }
.sidebar-logo { width: 40px; height: 40px; object-fit: contain; }
.brand-name { display: block; font-family: var(--font-display); font-size: 1.15rem; letter-spacing: .01em; }
.brand-sub { display: block; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(243,231,207,.55); }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 10px;
  color: rgba(243,231,207,.78); font-size: .93rem; font-weight: 500; transition: background .15s, color .15s;
  background: none; border: 0; font-family: inherit; cursor: pointer; text-align: left;
}
.nav-link:hover { background: rgba(243,231,207,.07); color: var(--cream); }
.nav-link.is-active { background: linear-gradient(90deg, rgba(184,132,58,.28), rgba(184,132,58,.08)); color: #fff; box-shadow: inset 2px 0 0 var(--gold); }
.nav-link .icon { opacity: .9; }
.nav-count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--danger); color: #fff; font-size: .75rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.sidebar-foot { border-top: 1px solid rgba(243,231,207,.1); padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-foot form { margin: 0; }
.nav-backdrop { display: none; }

.shell { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px;
  padding: 12px 32px; min-height: 60px; background: rgba(246,241,231,.86); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .topbar-menu { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--muted); min-width: 0; flex: 1; }
.crumbs a { color: var(--ink-2); }
.crumbs a:hover { color: var(--gold-2); }
.crumbs [aria-current] { color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb-sep .icon { width: 14px; height: 14px; opacity: .5; }
.bakery-switch { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-sm); }
.bakery-switch .icon { color: var(--gold); width: 16px; height: 16px; }
.bakery-switch select { border: 0; background: transparent; font: inherit; font-size: .88rem; font-weight: 500; color: var(--ink); padding: 4px 22px 4px 0; 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='%238A7A62' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 2px center; background-size: 14px; }
.main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 32px 64px; }
.main-wide { max-width: none; }

/* ---------- En-tête de page ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin: 0; }
.page-head .eyebrow { display: block; font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-2); font-weight: 600; margin-bottom: 6px; font-family: var(--font); }
.page-head .lead { margin: 6px 0 0; color: var(--ink-2); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Cartes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-body { padding: 22px 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; font-size: 1.08rem; }
.card-head .sub { color: var(--muted); font-size: .85rem; }
.card-foot { padding: 14px 24px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card + .card, .stack > * + * { margin-top: 20px; }
.grid > .card + .card { margin-top: 0; }
.grid { display: grid; gap: 20px; }
.grid > * { min-width: 0; }
.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-aside { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }

/* Tuiles de chiffres */
.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.stat-label { font-size: .8rem; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.stat-label .icon { width: 16px; height: 16px; color: var(--gold); }
.stat-value { font-family: var(--font-display); font-size: 2rem; color: var(--espresso); line-height: 1.1; }
.stat-foot { font-size: .82rem; color: var(--ink-2); }
.stat-critical { border-color: #EBC4BF; background: linear-gradient(180deg, #FFF7F5, var(--surface)); }
.stat-critical .stat-value { color: var(--danger); }

/* ---------- Boutons ---------- */
.btn {
  --b: var(--surface); --c: var(--ink); --bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; min-height: 40px;
  font: 500 .92rem/1.2 var(--font); color: var(--c); background: var(--b); border: 1px solid var(--bd); border-radius: 10px;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .12s var(--ease), box-shadow .15s, background .15s, border-color .15s;
}
.btn:hover { border-color: var(--gold); color: var(--c); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn .icon { width: 17px; height: 17px; }
.btn-primary { --b: var(--espresso); --c: #FFF8EA; --bd: var(--espresso); }
.btn-primary:hover { --b: var(--espresso-2); color: #fff; border-color: var(--espresso-2); box-shadow: 0 6px 16px -8px rgba(36,23,14,.6); }
.btn-gold { --b: var(--gold); --c: #fff; --bd: var(--gold-2); }
.btn-gold:hover { --b: var(--gold-2); color: #fff; }
.btn-ghost { --b: transparent; --bd: transparent; --c: var(--ink-2); }
.btn-ghost:hover { --b: var(--bg-2); border-color: transparent; box-shadow: none; }
.btn-danger { --c: var(--danger); --bd: #E9C2BD; }
.btn-danger:hover { --b: var(--danger); --c: #fff; border-color: var(--danger); }
.btn-sm { min-height: 32px; padding: 5px 11px; font-size: .84rem; border-radius: 8px; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-lg { min-height: 48px; padding: 12px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--bg-2); color: var(--ink); }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
form.inline { display: inline; margin: 0; }

/* ---------- Pastilles ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; line-height: 1.6; white-space: nowrap; border: 1px solid transparent; }
.badge-neutral { background: var(--bg-2); color: var(--ink-2); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-gold { background: var(--gold-soft); color: var(--gold-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot-success { background: var(--success); } .dot-warning { background: var(--warning); } .dot-danger { background: var(--danger); } .dot-muted { background: var(--line-strong); }

/* ---------- Tableaux ---------- */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; }
.table th { text-align: left; font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #FCF8F0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table-tight td, .table-tight th { padding: 9px 12px; }
.row-link { cursor: pointer; }
.row-muted td { color: var(--muted); }

/* Personne (avatar + nom) */
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar { width: 38px; height: 38px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .85rem; color: var(--espresso); background: linear-gradient(135deg, var(--gold-soft), #E9D4AE); border: 1px solid #E3CFA7; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; font-family: var(--font-display); }
.person-name { font-weight: 600; color: var(--ink); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-name:hover { color: var(--gold-2); }
.person-sub { font-size: .82rem; color: var(--muted); display: block; }

/* ---------- Formulaires ---------- */
.form { display: flex; flex-direction: column; gap: 18px; }
.form-section { border-top: 1px solid var(--line); padding-top: 20px; }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-section > h3 { font-size: 1rem; margin-bottom: 14px; }
.fields { display: grid; gap: 14px 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.fields-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-full { grid-column: 1 / -1; }
.label { font-size: .84rem; font-weight: 600; color: var(--ink-2); }
.label .req { color: var(--danger); }
.hint { font-size: .8rem; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; font: inherit; font-size: .94rem; color: var(--ink); background: #fff; border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 9px 12px; min-height: 40px; transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 88px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,132,58,.18); }
.input[readonly] { background: var(--surface-2); }
.input[type=file] { padding: 6px 8px; color: var(--ink-2); font-size: .88rem; cursor: pointer; }
.input[type=file]::file-selector-button { margin-right: 10px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.input[type=file]::file-selector-button:hover { border-color: var(--gold); }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238A7A62' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.input-otp { font-size: 1.6rem; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; font-family: var(--font); }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .92rem; }
.check input { width: 18px; height: 18px; accent-color: var(--gold-2); }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-top: 6px; }
.field-error { color: var(--danger); font-size: .82rem; }
.input.is-invalid { border-color: var(--danger); }
.search { position: relative; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search .input { padding-left: 36px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Onglets ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tab { padding: 10px 14px; font-weight: 500; font-size: .92rem; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--espresso); border-bottom-color: var(--gold); }
.tab .count { font-size: .75rem; background: var(--bg-2); color: var(--ink-2); padding: 0 7px; border-radius: 999px; }
.seg { display: inline-flex; background: var(--bg-2); padding: 3px; border-radius: 10px; gap: 2px; }
.seg a, .seg button { padding: 6px 12px; border-radius: 8px; font-size: .86rem; color: var(--ink-2); font-weight: 500; border: 0; background: none; cursor: pointer; font-family: inherit; }
.seg .is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- États vides & zones de dépôt ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--ink-2); }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: var(--gold-soft); color: var(--gold-2); }
.empty-icon .icon { width: 26px; height: 26px; }
.empty h3 { margin-bottom: 4px; }
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  padding: 22px 16px; border: 1.5px dashed var(--line-strong); border-radius: var(--r); background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 10px, #FAF4E8 10px, #FAF4E8 20px);
  color: var(--ink-2); cursor: pointer; transition: border-color .15s, background .15s, transform .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--gold); background: var(--gold-soft); }
.dropzone.is-over { transform: scale(1.01); }
.dropzone .icon { width: 24px; height: 24px; color: var(--gold); }
.dropzone strong { color: var(--ink); font-weight: 600; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone.is-busy { pointer-events: none; opacity: .7; }
.dropzone-compact { flex-direction: row; padding: 10px 14px; gap: 10px; font-size: .88rem; }

/* ---------- Dossier salarié ---------- */
.profile-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; padding: 24px; }
.profile-head h1 { margin: 0; font-size: 1.7rem; }
.profile-meta { display: flex; gap: 8px 16px; flex-wrap: wrap; color: var(--ink-2); font-size: .9rem; margin-top: 6px; align-items: center; }
.profile-meta span { display: inline-flex; gap: 6px; align-items: center; }
.profile-meta .icon { width: 15px; height: 15px; color: var(--muted); }
.doc-sections { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.doc-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.doc-section.is-missing { border-color: #EBCFA4; }
.doc-section-full { grid-column: 1 / -1; }
.doc-section-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.doc-section-head .sec-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--gold-soft); color: var(--gold-2); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.doc-section-head h3 { margin: 0; font-size: 1rem; flex: 1; }
.doc-section-body { padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.doc-list { display: flex; flex-direction: column; gap: 6px; }
.doc-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; border: 1px solid transparent; transition: background .12s, border-color .12s; }
.doc-item:hover { background: var(--surface-2); border-color: var(--line); }
.doc-item .doc-ico { width: 32px; height: 32px; border-radius: 8px; background: var(--bg-2); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.doc-item .doc-main { flex: 1; min-width: 0; }
.doc-item .doc-title { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.doc-item .doc-sub { font-size: .78rem; color: var(--muted); }
.doc-item .doc-actions { display: flex; gap: 2px; opacity: .55; transition: opacity .12s; }
.doc-item:hover .doc-actions, .doc-item:focus-within .doc-actions { opacity: 1; }

/* Grille des fiches de paie (année × mois) */
.months { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; }
.month { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px 2px; min-height: 58px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-size: .74rem; color: var(--muted); text-align: center; }
.month b { font-size: .78rem; color: var(--ink-2); font-weight: 600; }
.month.is-ok { background: var(--success-soft); border-color: #C7E0CD; color: var(--success); }
.month.is-ok:hover { border-color: var(--success); }
.month.is-warn { background: var(--warning-soft); border-color: #EED5A8; color: var(--warning); }
.month.is-missing { background: #fff; border-style: dashed; border-color: #E5B9B3; color: var(--danger); }
.month.is-off { opacity: .4; }

/* Checklist / progression */
.progress { height: 8px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #D4A35A); border-radius: 999px; transition: width .4s var(--ease); }
.progress-success > span { background: linear-gradient(90deg, #4F9363, var(--success)); }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 7px 4px; font-size: .9rem; }
.checklist .tick { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.checklist .tick .icon { width: 13px; height: 13px; stroke-width: 2.5; }
.checklist .ok .tick { background: var(--success); color: #fff; }
.checklist .ko .tick { background: #fff; border: 1.5px dashed var(--line-strong); color: transparent; }
.checklist .ko { color: var(--ink-2); }
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--gold) calc(var(--p) * 1%), var(--bg-2) 0); }
.ring > span { width: 50px; height: 50px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 700; font-size: .9rem; color: var(--espresso); }

/* ---------- Alertes (cockpit) ---------- */
.alerts { display: flex; flex-direction: column; }
.alert-row { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.alert-row:last-child { border-bottom: 0; }
.alert-ico { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.alert-critical .alert-ico { background: var(--danger-soft); color: var(--danger); }
.alert-soon .alert-ico { background: var(--warning-soft); color: var(--warning); }
.alert-info .alert-ico { background: var(--info-soft); color: var(--info); }
.alert-main { flex: 1; min-width: 0; }
.alert-title { font-weight: 600; color: var(--ink); }
.alert-detail { font-size: .85rem; color: var(--ink-2); }
.alert-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r); border: 1px solid; font-size: .92rem; align-items: flex-start; }
.callout .icon { margin-top: 2px; }
.callout-info { background: var(--info-soft); border-color: #C8DBE8; color: #22465f; }
.callout-warning { background: var(--warning-soft); border-color: #EED5A8; color: #7a4f12; }
.callout-danger { background: var(--danger-soft); border-color: #EBC4BF; color: #7d2a24; }
.callout-success { background: var(--success-soft); border-color: #C7E0CD; color: #2b5a3a; }

/* Frise (contrats) */
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 16px; }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: -25px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--gold); }
.timeline li.is-current::before { background: var(--gold); }

/* Liste de définitions */
.dl { display: grid; grid-template-columns: minmax(140px, 38%) 1fr; gap: 10px 16px; margin: 0; font-size: .92rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; color: var(--ink); font-weight: 500; word-break: break-word; }

/* ---------- Fenêtre modale (dialog natif) ---------- */
dialog.modal { border: 0; padding: 0; border-radius: var(--r-xl); box-shadow: var(--shadow-lg); width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); }
dialog.modal::backdrop { background: rgba(36,23,14,.45); backdrop-filter: blur(3px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); }
details.disclosure > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; color: var(--gold-2); font-weight: 500; }
details.disclosure > summary::-webkit-details-marker { display: none; }

/* ---------- Notifications ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 12px; background: var(--espresso); color: var(--cream); box-shadow: var(--shadow-lg); font-size: .92rem; animation: toast-in .35s var(--ease); }
.toast .icon { color: #9fd3ac; margin-top: 1px; }
.toast-error .icon { color: #f2a59d; }
.toast-warning .icon { color: #f0c27a; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: all .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Authentification ---------- */
.no-shell { background: radial-gradient(90% 70% at 15% 0%, #FBF4E6 0%, var(--bg) 50%, var(--bg-2) 100%); }
.auth-main { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 36px 34px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; text-align: center; }
.auth-brand .mark { width: 64px; height: 64px; border-radius: 18px; background: var(--espresso); display: grid; place-items: center; box-shadow: var(--shadow); }
.auth-brand .mark img { width: 40px; height: 40px; object-fit: contain; }
.auth-title { font-size: 1.5rem; text-align: center; margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--muted); margin-bottom: 22px; font-size: .92rem; }
.qr-box { display: grid; place-items: center; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); margin: 0 auto 12px; width: fit-content; }
.qr-box img, .qr-box svg { width: 200px; height: 200px; image-rendering: pixelated; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-family: ui-monospace, Consolas, monospace; font-size: .95rem; }
.codes span { background: var(--surface-2); border: 1px solid var(--line); padding: 8px; border-radius: 8px; text-align: center; letter-spacing: .05em; }

/* ---------- Utilitaires ---------- */
.muted { color: var(--muted); } .ink-2 { color: var(--ink-2); }
.small { font-size: .85rem; } .xsmall { font-size: .78rem; }
.strong { font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.text-right { text-align: right; } .center { text-align: center; }
.text-danger { color: var(--danger); } .text-success { color: var(--success); } .text-warning { color: var(--warning); }
.flex { display: flex; gap: 10px; align-items: center; } .flex-wrap { flex-wrap: wrap; } .between { justify-content: space-between; } .grow { flex: 1; min-width: 0; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 16px; }
.nowrap { white-space: nowrap; }
.d-block { display: block; }
.toast-info .icon { color: #a9cbe3; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.divider-v { width: 1px; align-self: stretch; background: var(--line); }
.htmx-request .htmx-hide-on-request { display: none; }
.htmx-indicator { display: none; } .htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-aside { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: var(--shadow-lg); }
  .nav-toggle:checked ~ .sidebar { transform: none; }
  .nav-toggle:checked ~ .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(36,23,14,.4); }
  .shell { margin-left: 0; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .topbar .topbar-menu { display: inline-flex; }
  .main { padding: 20px 16px 48px; }
  .doc-sections, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .months { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .bakery-switch select { max-width: 150px; }
  .crumbs { display: none; }
}
@media (max-width: 560px) {
  h1 { font-size: 1.55rem; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .fields-2, .fields-3 { grid-template-columns: 1fr; }
  .card-body { padding: 18px; } .card-head { padding: 14px 18px; }
  .alert-row { flex-wrap: wrap; }
  .alert-actions { width: 100%; justify-content: flex-start; padding-left: 50px; }
  .months { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dl { grid-template-columns: 1fr; gap: 2px 0; } .dl dd { margin-bottom: 8px; }
  .auth-card { padding: 28px 22px; }
}

/* ---------- Impression (registre, reçus, éléments variables) ---------- */
@media print {
  .sidebar, .topbar, .toasts, .page-actions, .no-print, .nav-backdrop { display: none !important; }
  .shell { margin: 0; } .main { padding: 0; max-width: none; }
  body { background: #fff; font-size: 11pt; }
  .card { box-shadow: none; border-color: #ccc; }
  .table th { background: #f3f3f3; }
}
