/* ============================================================
   MIDI PIÈCES AUTO RH — feuille de style
   Charte MIDILITY / Midi Pièces Auto (relevé fourniols.midipiecesauto.fr, 29/10/2026)
   Orange #ED781E (accent) · bleu nuit #323856 · texte #494949 · Poppins
   Règle de contraste : l'orange est une surface, jamais du petit texte sur blanc.
   ============================================================ */

:root {
  color-scheme: light;

  /* Marque */
  --brand: #ED781E;
  --brand-hover: #D96A13;
  --brand-text: #A95312;      /* orange assombri, lisible sur blanc */
  --brand-soft: #FDF1E7;
  --navy: #323856;
  --navy-2: #262B45;
  --navy-soft: #EDEEF3;

  /* Neutres */
  --ink: #494949;
  --ink-strong: #333333;
  --muted: #767676;
  --line: #E9E9E9;
  --line-strong: #D9DCE2;
  --paper: #FFFFFF;
  --bg: #F9F9F9;
  --surface-alt: #F5F6F7;

  /* États */
  --green: #1E7A46;
  --green-soft: #EAF4EE;
  --red: #B3261E;
  --red-soft: #FBEDEC;
  --amber: #8A5A00;
  --amber-soft: #FDF4E3;
  --blue: #2A5E96;
  --blue-soft: #EDF3F9;

  /* Formes */
  --radius: 4px;
  --radius-lg: 6px;
  --shadow: 0 4px 12px rgba(12, 12, 12, .08);
  --shadow-soft: 0 1px 2px rgba(12, 12, 12, .05);

  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-weight: 400;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: var(--navy); }

h1, h2, h3, p { margin-top: 0; }
h1 { color: var(--navy); font-size: 28px; font-weight: 600; line-height: 1.3; margin-bottom: 8px; }
h1 span { color: var(--brand-text); }
h2 { color: var(--navy); font-size: 21px; font-weight: 600; line-height: 1.35; margin: 0; }
h3 { color: var(--navy); font-size: 16px; font-weight: 600; margin: 0; }
.muted { color: var(--muted); }

/* ---------- Connexion ---------- */
.login-screen {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
  background: var(--bg);
}
.login-card {
  width: min(100%, 410px);
  padding: 34px 36px 28px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 3px solid var(--brand);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.brand-lockup { display: flex; align-items: center; gap: 11px; }
.brand-lockup-login { justify-content: center; margin: 0 auto 26px; }
.brand-logo { display: block; object-fit: cover; flex: 0 0 auto; }
.brand-logo-login { width: 104px; height: 104px; border-radius: var(--radius-lg); }
.brand-logo-top { width: 38px; height: 38px; border-radius: var(--radius); }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: var(--radius); background: var(--brand);
  color: var(--navy); font-weight: 600; font-size: 20px;
}
.brand-caption { font-size: 10px; letter-spacing: .1em; color: var(--navy); font-weight: 600; }
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: .01em; color: #fff; white-space: nowrap; }
.brand-name b { color: #F5B47C; font-weight: 600; }
.eyebrow {
  font-size: 10px; font-weight: 600; letter-spacing: .14em;
  color: var(--muted); text-transform: uppercase; margin: 0 0 8px;
}
.login-intro { font-size: 14px; margin-bottom: 24px; }
.stack-form { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 12px; font-weight: 500; color: var(--ink-strong); margin-top: 8px; }
input, select, textarea {
  width: 100%; color: var(--ink); background: #fff;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 10px 12px; outline: none; min-height: 42px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(50, 56, 86, .12);
}
input::placeholder, textarea::placeholder { color: #A6A6A6; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius);
  padding: 10px 16px; font-weight: 500; font-size: 13px;
  transition: background .15s, border-color .15s, color .15s;
}
.button-primary { background: var(--navy); color: #fff; }
.button-primary:hover { background: var(--navy-2); }
.button-primary:disabled { opacity: .55; cursor: wait; }
.button-full { width: 100%; margin-top: 12px; min-height: 44px; }
.button-secondary { background: #fff; border-color: var(--line-strong); color: var(--ink-strong); }
.button-secondary:hover { background: var(--surface-alt); }
.button-quiet { color: rgba(255, 255, 255, .82); background: transparent; padding: 8px 10px; }
.button-quiet:hover { color: #fff; background: rgba(255, 255, 255, .10); }
.button-danger { background: var(--red-soft); color: var(--red); }
.button-danger:hover { background: #F7DFDD; }
.button-small { padding: 6px 10px; font-size: 11px; }
.icon-button {
  border: 0; background: transparent; color: var(--muted);
  width: 34px; height: 34px; display: inline-grid; place-items: center;
  border-radius: var(--radius); font-size: 18px;
}
.icon-button:hover { color: var(--navy); background: var(--surface-alt); }
.secure-note { margin: 22px 0 0; color: var(--muted); font-size: 11px; text-align: center; }
.secure-note span { color: var(--green); font-size: 8px; vertical-align: 2px; margin-right: 4px; }
.brand-slogan { margin: 18px 0 0; text-align: center; font-size: 12px; color: var(--navy); font-weight: 500; }
.form-error { color: var(--red); font-size: 12px; margin: 0; min-height: 0; }
.form-error:empty { display: none; }
.forgot-line { margin: 12px 0 0; text-align: center; }
.link-button {
  border: 0; background: none; padding: 4px; color: var(--navy);
  font-size: 12px; text-decoration: underline; text-underline-offset: 3px;
}
.link-button:hover { color: var(--brand-text); }

/* ---------- Ossature ---------- */
.topbar {
  height: 64px; display: flex; align-items: center; gap: 16px;
  padding: 0 24px; position: sticky; top: 0; z-index: 4;
  background: var(--navy); color: #fff;
}
.topbar-spacer { flex: 1; }
.topbar-date {
  flex: 0 0 auto; color: #fff; font-size: 12px; font-weight: 500; white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, .22); border-radius: var(--radius); padding: 5px 10px;
}
.role-pill {
  border: 1px solid rgba(255, 255, 255, .22); border-radius: var(--radius);
  padding: 4px 9px; color: #E8EAF0; font-size: 10px; letter-spacing: .06em; font-weight: 500;
}
.user-chip { display: flex; gap: 8px; align-items: center; color: #E8EAF0; font-size: 12px; }
.avatar {
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%;
  background: var(--brand); color: var(--navy); font-size: 11px; font-weight: 600;
}
.mobile-menu { display: none; color: white; }

.layout { display: flex; min-height: calc(100vh - 100px); }
.sidebar {
  width: 228px; flex: 0 0 228px; display: flex; flex-direction: column;
  background: #fff; border-right: 1px solid var(--line); padding: 24px 14px 18px;
}
.sidebar-label {
  color: var(--muted); letter-spacing: .14em; font-size: 9px;
  font-weight: 600; text-transform: uppercase; margin: 0 0 12px 12px;
}
.navigation { display: grid; gap: 2px; }
.nav-item {
  border: 0; background: transparent; color: var(--ink);
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border-radius: var(--radius); padding: 9px 12px; font-size: 12.5px; font-weight: 400;
}
.nav-item .nav-icon { width: 16px; text-align: center; font-size: 14px; color: var(--muted); }
.nav-item:hover { background: var(--surface-alt); color: var(--navy); }
.nav-item.active {
  background: var(--navy-soft); color: var(--navy); font-weight: 500;
  box-shadow: inset 3px 0 var(--brand);
}
.nav-item.active .nav-icon { color: var(--navy); }
.sidebar-foot {
  margin-top: auto; color: var(--muted); font-size: 10px;
  display: flex; align-items: center; gap: 7px; padding: 12px;
}
.status-dot { width: 7px; height: 7px; background: var(--green); border-radius: 50%; }
.main-content { width: 100%; min-width: 0; padding: 30px clamp(18px, 4vw, 52px) 52px; }
.app-footer {
  text-align: center; color: var(--muted); font-size: 10px;
  padding: 12px; background: #fff; border-top: 1px solid var(--line);
}
.app-footer span { color: var(--brand); margin: 0 5px; }

/* ---------- Pages ---------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 24px;
  padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.page-head h1 { font-size: 25px; margin-bottom: 2px; }
.page-head p { margin: 0; color: var(--muted); font-size: 12px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.two-col { grid-template-columns: minmax(0, 1.45fr) minmax(260px, .9fr); }
.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-soft);
  padding: 18px; min-width: 0;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 14px;
}
.card-head h2, .card-head h3 { margin: 0; }
.card-subtitle { margin: 3px 0 0; font-size: 11px; color: var(--muted); }

.stat-card {
  position: relative; min-height: 118px;
  border-top: 3px solid var(--brand);
  text-align: left;
}
.stat-label {
  font-size: 11px; color: var(--muted); font-weight: 500;
  letter-spacing: .04em; text-transform: uppercase; margin-bottom: 10px;
}
.stat-value { font-size: 30px; font-weight: 600; color: var(--navy); line-height: 1.2; }
.stat-unit { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 3px; }
.stat-note { font-size: 11px; color: var(--muted); margin-top: 4px; }
.stat-card-clickable { display: flex; width: 100%; flex-direction: column; align-items: flex-start; color: inherit; }
.stat-card-clickable:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.stat-open { position: absolute; right: 16px; bottom: 14px; color: var(--brand-text); font-size: 16px; font-weight: 500; }
.stat-card-clickable:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

.welcome-banner {
  color: #fff; border-radius: var(--radius-lg); padding: 22px 24px;
  margin-bottom: 18px; background: var(--navy);
}
.welcome-banner h2 { color: #fff; font-size: 21px; margin-bottom: 3px; }
.welcome-banner p { margin: 0; color: #D7DAE4; font-size: 12.5px; }
.welcome-banner .welcome-actions { margin-top: 16px; }
.welcome-banner .button { background: #fff; color: var(--navy); }
.welcome-banner .button:hover { background: #E8EAF0; }
.welcome-banner-home { display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.welcome-copy { min-width: 0; }
.home-date-card {
  appearance: none; font: inherit; text-align: left; cursor: pointer;
  flex: 0 0 auto; min-width: 235px; padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, .22); border-radius: var(--radius);
  background: transparent; color: #fff;
  transition: background .15s, border-color .15s;
}
.home-date-card:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .4); }
.home-date-card span {
  display: block; margin-bottom: 3px; color: #F5B47C;
  font-size: 9px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase;
}
.home-date-card time { display: block; color: #fff; font-size: 16px; font-weight: 500; line-height: 1.35; }
.home-date-card b { display: block; margin-top: 5px; color: #F5B47C; font-size: 10px; font-weight: 400; }
.employee-welcome { background: var(--navy); }
.employee-welcome .welcome-copy { max-width: 780px; }
.welcome-kicker {
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: 8px;
  color: #F5B47C; font-size: 9px; font-weight: 500; letter-spacing: .15em; text-transform: uppercase;
}
.welcome-kicker i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.employee-welcome h2 { font-size: 26px; margin-bottom: 5px; }
.welcome-wave { color: var(--brand); font-size: 20px; }
.employee-welcome p { font-size: 13px; }
.employee-home-identity {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 12px; color: #D7DAE4; font-size: 10px;
}
.employee-home-identity > span:not(.company-badge)::before { content: '·'; color: var(--brand); margin-right: 8px; }
.employee-welcome .welcome-actions { margin-top: 14px; }
.employee-primary-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.employee-primary-stats .stat-card { min-height: 132px; padding: 20px; }
.employee-primary-stats .stat-value { font-size: 32px; }
.employee-primary-stats .stat-label { font-size: 12px; color: var(--ink); text-transform: none; letter-spacing: 0; }
.employee-primary-stats .stat-note { font-size: 11px; }
.employee-home-grid { grid-template-columns: minmax(0, 1.25fr) minmax(270px, .75fr); }
.employee-shortcuts { align-self: stretch; }
.employee-shortcut {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; color: var(--ink); text-align: left;
}
.employee-shortcut:last-of-type { border-bottom: 0; }
.employee-shortcut:hover strong { color: var(--brand-text); }
.employee-shortcut > span:nth-child(2) { display: grid; gap: 2px; flex: 1; }
.employee-shortcut strong { color: var(--navy); font-size: 12.5px; font-weight: 500; }
.employee-shortcut small { color: var(--muted); font-size: 10.5px; }
.employee-shortcut > b { color: var(--brand-text); font-size: 16px; }
.shortcut-icon {
  width: 36px; height: 36px; display: grid; place-items: center;
  flex: 0 0 36px; border-radius: var(--radius); font-size: 16px;
}
.shortcut-icon.orange { background: var(--brand-soft); color: var(--brand-text); }
.shortcut-icon.blue { background: var(--blue-soft); color: var(--blue); }

/* ---------- Listes, tableaux, étiquettes ---------- */
.list { display: grid; }
.list-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; border-bottom: 1px solid var(--line); padding: 11px 0;
}
.list-row:last-child { border-bottom: 0; padding-bottom: 0; }
.list-row:first-child { padding-top: 0; }
.row-main { min-width: 0; }
.row-title { color: var(--navy); font-size: 12.5px; font-weight: 500; margin-bottom: 2px; }
.row-meta { color: var(--muted); font-size: 10.5px; }
.row-right { text-align: right; flex: 0 0 auto; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: var(--radius);
  background: var(--surface-alt); color: var(--ink);
  font-size: 9.5px; font-weight: 500; white-space: nowrap;
}
.tag.orange { background: var(--brand-soft); color: var(--brand-text); }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.blue { background: var(--blue-soft); color: var(--blue); }

.alert-banner {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--amber-soft); border: 1px solid #EFDDBB; color: #5A420F;
  border-radius: var(--radius); padding: 11px 13px; font-size: 11.5px; margin-bottom: 14px;
}
.alert-banner strong { display: block; color: var(--amber); margin-bottom: 2px; font-weight: 500; }
.empty-state { text-align: center; padding: 32px 18px; color: var(--muted); font-size: 12px; }
.empty-icon { display: block; font-size: 22px; color: #C2C2C2; margin-bottom: 8px; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th {
  text-align: left; color: var(--muted); text-transform: uppercase;
  letter-spacing: .06em; font-size: 9px; font-weight: 500;
  padding: 9px 8px; border-bottom: 1px solid var(--line);
}
td { color: var(--ink); font-size: 11.5px; padding: 11px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.table-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.employee-table th:nth-child(6), .employee-table td:nth-child(6) { text-align: right; white-space: nowrap; }
.employee-table td:nth-child(6) { font-variant-numeric: tabular-nums; color: var(--ink-strong); }
.filter-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-row select, .filter-row input { width: auto; min-width: 125px; min-height: 36px; padding: 6px 10px; font-size: 11.5px; }
.request-alerts { display: flex; gap: 5px; flex-wrap: wrap; }
.balance-large { font-size: 36px; font-weight: 600; color: var(--navy); }
.balance-large small { font-size: 13px; color: var(--muted); font-weight: 400; }
.movement-qty { font-weight: 500; }
.movement-qty.positive { color: var(--green); }
.movement-qty.negative { color: var(--red); }
.history-quantity { color: var(--muted); font-size: 10px; white-space: nowrap; }

.info-row {
  display: flex; justify-content: space-between; gap: 10px;
  border-bottom: 1px solid var(--line); padding: 9px 0; font-size: 11.5px;
}
.info-row:last-child { border: 0; }
.info-label { color: var(--muted); }
.info-value { text-align: right; color: var(--ink-strong); font-weight: 500; }

/* ---------- Formulaires ---------- */
.checkbox-row { display: flex; align-items: flex-start; gap: 8px; color: var(--ink); font-size: 11.5px; margin: 14px 0 0; }
.checkbox-row input { margin: 3px 0 0; width: 15px; min-height: 15px; height: 15px; accent-color: var(--navy); }
.form-hint { color: var(--muted); font-size: 10.5px; margin: 8px 0; }
.field { margin-top: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; }
.span-two { grid-column: span 2; }
.duration-input { display: flex; align-items: center; gap: 7px; }
.duration-input input { width: 90px; }
.duration-input span { font-size: 11px; color: var(--muted); }
.preview-box {
  margin-top: 14px; border-radius: var(--radius); padding: 12px;
  background: var(--surface-alt); border-left: 3px solid var(--brand);
  color: var(--ink); font-size: 11.5px;
}
.preview-box .preview-highlight { color: var(--navy); font-weight: 500; }
.preview-line { display: flex; justify-content: space-between; gap: 12px; margin: 3px 0; }
.preview-warnings {
  margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line-strong);
  display: grid; gap: 5px; color: var(--amber);
}
.legal-label {
  color: var(--muted); font-size: 9px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .08em;
}

/* ---------- Modales ---------- */
.modal {
  border: 0; border-radius: var(--radius-lg); padding: 0;
  width: min(96vw, 760px); max-height: calc(100dvh - 24px);
  box-shadow: 0 18px 48px rgba(12, 12, 12, .22);
}
.modal::backdrop { background: rgba(12, 12, 12, .45); }
.modal-card { padding: 22px; max-height: calc(100dvh - 24px); overflow-y: auto; }
.modal-wide { width: min(1060px, 96vw); }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 12px; }
.modal-heading h2 { font-size: 19px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.employee-form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px 15px; }
.employee-form-grid label { display: block; margin: 4px 0; }
.employee-form-grid input, .employee-form-grid select { min-height: 39px; padding-top: 8px; padding-bottom: 8px; }
.employee-form-grid + .form-hint { margin: 7px 0; }
.toast {
  position: fixed; z-index: 10; bottom: 22px; left: 50%; transform: translate(-50%, 14px);
  background: var(--navy); color: #fff; border-radius: var(--radius);
  padding: 11px 16px; box-shadow: var(--shadow); font-size: 12px;
  opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100vw - 30px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Calendrier ---------- */
.calendar-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.calendar-title { color: var(--navy); font-weight: 500; font-size: 16px; }
.calendar-toolbar input[type="month"] { width: 158px; min-height: 36px; padding: 6px 9px; font-size: 12px; }
.calendar-toolbar .calendar-title { margin: 0 auto; }
.calendar-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff;
}
.calendar-dow {
  padding: 8px 4px; text-align: center; color: var(--muted);
  font-size: 9px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em;
  background: var(--surface-alt); border-bottom: 1px solid var(--line);
}
.calendar-day { min-height: 105px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow: hidden; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.other-month { background: #FBFBFB; color: #C2C2C2; }
.calendar-day.weekend { background: #FBFBFB; }
.calendar-day.holiday-day { background: var(--amber-soft); }
.day-number { font-size: 10px; font-weight: 500; color: var(--ink); }
.other-month .day-number { color: #C2C2C2; }
.calendar-holiday { display: block; margin-top: 3px; color: var(--amber); font-size: 8px; font-weight: 500; line-height: 1.2; }
.calendar-event {
  display: block; margin-top: 4px; border-radius: 2px; padding: 3px 5px;
  font-size: 8.5px; font-weight: 500; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--absence-color, var(--blue));
  color: #fff;
  border-left: 3px solid rgba(0, 0, 0, .22);
}
.calendar-event small { display: block; font-size: 7px; opacity: .8; }
.calendar-event.pending { border-left-style: dashed; }
.calendar-event.absence-1, .absence-swatch.absence-1 { --absence-color: #B3261E; }
.calendar-event.absence-2, .absence-swatch.absence-2 { --absence-color: #2A5E96; }
.calendar-event.absence-3, .absence-swatch.absence-3 { --absence-color: #1E7A46; }
.calendar-event.absence-4, .absence-swatch.absence-4 { --absence-color: #5B3E8E; }
.calendar-event.absence-5, .absence-swatch.absence-5 { --absence-color: #9A5511; }
.calendar-event.absence-6, .absence-swatch.absence-6 { --absence-color: #10656E; }
.calendar-event.absence-7, .absence-swatch.absence-7 { --absence-color: #6B7A16; }
.calendar-event.absence-8, .absence-swatch.absence-8 { --absence-color: #9C2A58; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 16px; }
.calendar-legend-item {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 9px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--ink); font-size: 10px; font-weight: 500;
}
.absence-swatch { width: 12px; height: 12px; flex: 0 0 12px; border-radius: 2px; background: var(--absence-color, #C2D9EA); }

/* ---------- Fiche salarié, sociétés ---------- */
.profile-header h2 { margin: 2px 0 5px; font-size: 20px; }
.profile-header .eyebrow { margin-bottom: 5px; }
.profile-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-top: 16px; }
.profile-fact {
  min-width: 0; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface-alt);
}
.profile-fact span { display: block; color: var(--muted); font-size: 9px; margin-bottom: 3px; }
.profile-fact strong { display: block; color: var(--ink-strong); font-size: 11px; font-weight: 500; overflow-wrap: anywhere; }
.profile-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.profile-metric {
  min-height: 100px; display: flex; flex-direction: column; justify-content: center; gap: 4px;
  padding: 14px; border: 1px solid var(--line); border-top: 3px solid var(--brand);
  border-radius: var(--radius); background: #fff;
}
.profile-metric strong { color: var(--navy); font-size: 22px; font-weight: 600; }
.profile-metric small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.profile-metric.metric-blue, .profile-metric.metric-purple, .profile-metric.metric-teal { border-top-color: var(--line-strong); }
.profile-metric.metric-orange { border-top-color: var(--brand); }

.company-badge {
  display: inline-flex; max-width: 205px; border-radius: var(--radius);
  padding: 4px 8px; font-size: 9px; line-height: 1.3; font-weight: 500;
  border: 1px solid var(--line);
}
.company-badge.company-apt { background: var(--brand-soft); color: var(--brand-text); border-color: #F3D3B7; }
.company-badge.company-napac { background: #F1EEF8; color: #4B3A78; border-color: #DCD4EC; }
.company-badge.company-fourniols { background: #E9F4F2; color: #155E58; border-color: #CFE5E1; }
.company-badge.company-mpac { background: var(--blue-soft); color: var(--blue); border-color: #D3E1EF; }
.company-badge.company-midility { background: var(--green-soft); color: var(--green); border-color: #CFE4D7; }
.company-badge.company-none { background: var(--surface-alt); color: var(--muted); border-color: var(--line); }

.employee-table { min-width: 1180px; }
.employee-table tbody tr { transition: background .14s; }
.employee-table tbody tr:hover { background: #FBFBFB; }
.employee-table td:first-child { border-left: 3px solid transparent; }
.employee-table tr.company-apt td:first-child { border-left-color: var(--brand); }
.employee-table tr.company-napac td:first-child { border-left-color: #6B5A9E; }
.employee-table tr.company-fourniols td:first-child { border-left-color: #2A7D75; }
.employee-table tr.company-mpac td:first-child { border-left-color: var(--blue); }
.employee-table tr.company-midility td:first-child { border-left-color: var(--green); }

.employee-filters { margin: 0 0 14px; padding: 10px; background: var(--surface-alt); border: 1px solid var(--line); border-radius: var(--radius); }
.employee-filters select { min-width: 142px; flex: 1 1 145px; }

/* ---------- Profil salarié, pièces jointes, divers ---------- */
.personal-profile-heading { display: flex; align-items: center; gap: 15px; margin-bottom: 18px; }
.personal-profile-heading h2 { margin-bottom: 3px; }
.personal-profile-heading p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 12px; }
.personal-avatar {
  width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%;
  background: var(--brand); color: var(--navy); font-size: 18px; font-weight: 600;
}
.personal-profile-heading > .tag { margin-left: auto; }
.personal-profile-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.personal-fact { display: grid; gap: 3px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-alt); }
.personal-fact span { color: var(--muted); font-size: 10px; }
.personal-fact strong { color: var(--ink-strong); font-size: 12px; font-weight: 500; }
.profile-help-card { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.profile-help-card h2 { font-size: 18px; }
.profile-help-card p { margin: 9px 0 18px; color: var(--muted); font-size: 12px; }
.profile-help-icon {
  display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 12px;
  border-radius: var(--radius); background: var(--brand-soft); color: var(--brand-text); font-size: 17px;
}

.rule-card { border-left: 3px solid var(--line-strong); }
.rule-card.enabled { border-left-color: var(--brand); }
.rule-summary { color: var(--muted); font-size: 11px; margin: 7px 0 0; }
.subheading { color: var(--navy); margin: 20px 0 10px; font-size: 14px; font-weight: 600; }
.section-gap { margin-top: 20px; }

.attachment-field { margin-top: 9px; padding: 11px 12px 7px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; }
.attachment-field.attachment-required { border-color: #E2B49B; background: var(--brand-soft); }
.attachment-label-row { display: flex; align-items: center; justify-content: space-between; }
.attachment-label-row label { margin-top: 0; }
.attachment-status {
  margin-left: 6px; padding: 2px 7px; border-radius: var(--radius);
  background: var(--surface-alt); color: var(--ink); font-size: 9px; font-weight: 500; white-space: nowrap;
}
.attachment-required .attachment-status { background: #F6DDCB; color: var(--brand-text); }
.attachment-field input[type=file] { min-height: 39px; padding: 7px 9px; font-size: 11px; background: #fff; }
.attachment-field .form-hint { margin: 6px 0 2px; color: var(--muted); }
.privacy-hint { margin: 9px 0 0; color: var(--muted); font-size: 10px; }
.sync-card { padding: 22px; }

.button-switch {
  background: #fff; color: var(--navy); padding: 7px 12px;
  font-size: 11px; white-space: nowrap; border-radius: var(--radius);
}
.button-switch:hover { background: var(--navy-soft); }
.button-switch-sidebar {
  width: calc(100% - 10px); justify-content: flex-start; margin: 0 5px 14px;
  background: var(--surface-alt); color: var(--navy);
  border-color: var(--line); font-size: 11px; text-align: left;
}
.button-switch-sidebar:hover { background: var(--navy-soft); }
.button-account-password { margin-top: 10px; color: var(--ink); }
.button-account-password:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
#notification-count { margin-left: auto; border-radius: var(--radius); background: var(--brand); color: var(--navy); font-weight: 600; padding: 1px 7px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
  .three-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .employee-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .topbar { height: 56px; padding: 0 13px; gap: 8px; }
  .mobile-menu { display: inline-grid; }
  .brand-logo-top { width: 30px; height: 30px; }
  .brand-name { font-size: 10px; letter-spacing: 0; }
  .role-pill { display: none; }
  .topbar-date, .topbar > #switch-role-button { display: none; }
  .user-chip { margin-left: auto; }
  .user-chip #user-name { display: none; }
  .button-quiet { font-size: 11px; padding: 7px; }
  .layout { min-height: calc(100vh - 88px); }
  .sidebar {
    position: fixed; z-index: 5; left: 0; top: 56px; bottom: 32px; width: 245px;
    transform: translateX(-105%); transition: transform .2s; box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { padding: 22px 15px 40px; }
  .page-head { align-items: flex-start; flex-direction: column; margin-bottom: 18px; }
  .page-head h1 { font-size: 21px; }
  .page-actions { width: 100%; flex-wrap: wrap; }
  .stats-grid { gap: 10px; }
  .stat-card { min-height: 104px; padding: 14px; }
  .stat-value { font-size: 24px; }
  .card { padding: 14px; }
  .three-col { grid-template-columns: 1fr; }
  .login-card { padding: 28px 22px 24px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-two { grid-column: auto; }
  .calendar-day, .calendar-grid .calendar-day { min-height: 64px; padding: 4px; }
  .calendar-event { font-size: 7px; padding: 2px; }
  .calendar-dow { font-size: 8px; }
  .calendar-title { font-size: 14px; }
  .calendar-holiday, .calendar-event small { display: none; }
  .calendar-toolbar { flex-wrap: wrap; }
  .calendar-toolbar .calendar-title { order: -1; width: 100%; text-align: center; }
  .calendar-legend { gap: 6px; }
  .calendar-legend-item { padding: 5px 7px; font-size: 9px; }
  .employee-form-grid { grid-template-columns: 1fr; }
  .profile-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .profile-metric { min-height: 90px; padding: 11px; }
  .profile-metric strong { font-size: 19px; }
  .button-switch { max-width: 116px; white-space: normal; line-height: 1.15; padding: 7px 8px; font-size: 9px; }
  .welcome-banner-home { align-items: stretch; flex-direction: column; gap: 13px; }
  .home-date-card { min-width: 0; width: 100%; }
  .home-date-card time { font-size: 15px; }
  .home-date-card b { margin-top: 7px; }
  .employee-primary-stats { grid-template-columns: 1fr; }
  .employee-welcome h2 { font-size: 22px; }
  .employee-home-identity { gap: 6px; }
  .personal-profile-heading { align-items: flex-start; flex-wrap: wrap; }
  .personal-profile-heading > .tag { margin-left: 69px; }
  .personal-profile-facts { grid-template-columns: 1fr; }
  input, select, textarea { font-size: 16px; }
  .button, .nav-item, .icon-button { min-height: 44px; }
  .list-row { align-items: flex-start; flex-wrap: wrap; }
  .row-right { width: 100%; text-align: left; }
  .row-right .table-actions { margin-top: 8px; }
  .row-right .button { margin-top: 5px; }
  .modal { max-width: calc(100vw - 16px); }
  .modal-card { padding: 18px; }
  .main-content { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}
