/* OYA Consultants / Time — design system (aucune ressource externe, CSP stricte).
   Toutes les couleurs passent par les variables ci-dessous : thème clair par défaut, thème sombre via le système
   (prefers-color-scheme) ou la bascule mémorisée (html[data-theme]). */
@font-face { font-family: "DM Sans"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("/static/fonts/DMSans-Regular.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-weight: 500; font-style: normal; font-display: swap;
  src: url("/static/fonts/DMSans-Medium.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-weight: 700; font-style: normal; font-display: swap;
  src: url("/static/fonts/DMSans-Bold.woff2") format("woff2"); }

:root {
  --bg: #faf8f8;
  --surface: #fff;
  --surface-2: #f3f1ee;
  --border: #e6e2dc;
  --border-strong: #bdb6ab;
  --ink: #111;
  --text: #4b4848;
  --muted: #8a8a8a;
  --muted-text: #6b6868;
  --primary: #ebba29;
  --on-primary: #111;
  --primary-soft: #fdf3d0;
  --secondary: #ff8365;
  --secondary-soft: #ffe6de;
  --secondary-text: #7a1d05;
  --success: #1f8a3b;
  --success-soft: #dff3e4;
  --success-text: #166a2e;
  --danger: #c81e1e;
  --info-bg: #fcf8d8;
  --info-text: #5e5515;
  --shadow: 0 1px 2px rgba(17,17,17,.04), 0 8px 24px rgba(17,17,17,.05);
  --radius: 12px;
  --radius-sm: 8px;
}

html[data-theme="dark"] {
  --bg: #17171a;
  --surface: #212126;
  --surface-2: #2a2a31;
  --border: #36363e;
  --border-strong: #5a5a66;
  --ink: #f4f4f6;
  --text: #d3d3da;
  --muted: #9b9ba5;
  --muted-text: #a9a9b3;
  --primary: #ebba29;
  --on-primary: #111;
  --primary-soft: #3a3214;
  --secondary: #ff9a82;
  --secondary-soft: #4a2a22;
  --secondary-text: #ffc2b3;
  --success: #5ec47c;
  --success-soft: #1f3a28;
  --success-text: #8fe0a8;
  --danger: #ff7b7b;
  --info-bg: #3a3414;
  --info-text: #f1dd8a;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #17171a;
    --surface: #212126;
    --surface-2: #2a2a31;
    --border: #36363e;
    --border-strong: #5a5a66;
    --ink: #f4f4f6;
    --text: #d3d3da;
    --muted: #9b9ba5;
    --muted-text: #a9a9b3;
    --primary: #ebba29;
    --on-primary: #111;
    --primary-soft: #3a3214;
    --secondary: #ff9a82;
    --secondary-soft: #4a2a22;
    --secondary-text: #ffc2b3;
    --success: #5ec47c;
    --success-soft: #1f3a28;
    --success-text: #8fe0a8;
    --danger: #ff7b7b;
    --info-bg: #3a3414;
    --info-text: #f1dd8a;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: light dark; }
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "DM Sans", system-ui, sans-serif; font-size: 16px; line-height: 1.5;
  display: flex; flex-direction: column; min-height: 100vh;
}
h1, h2, h3 { color: var(--ink); line-height: 1.25; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: 1.75rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--ink); text-decoration-color: var(--primary); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { background: var(--info-bg); }
code { font-size: .9em; background: var(--surface-2); padding: 0 .3em; border-radius: 4px; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--surface); padding: .5em 1em; z-index: 20; }
.skip-link:focus { left: 0; }
.muted { color: var(--muted-text); }
.small { font-size: .875rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.icon { flex: none; }

/* Mouvement : transitions courtes, désactivées si l'utilisateur le demande */
button, .btn, .card, .kpi, input, select, textarea, .seg-label, .site-nav a, .subnav a, .month-btn, .theme-toggle,
.grid-table tbody tr {
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease, color .15s ease;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Barre supérieure */
.topbar { background: var(--surface); border-bottom: 3px solid var(--primary); }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center;
  gap: 1rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .75rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.brand:hover { background: none; }
.brand img { display: block; height: 80px; width: auto; }
.brand-name { white-space: nowrap; font-weight: 700; color: var(--ink); }
.brand-name em { font-style: italic; font-weight: 500; color: var(--text); }
.brand-sep { font-weight: 500; color: var(--muted-text); }
.site-nav { display: flex; align-items: center; gap: 1.1rem; margin-left: auto; flex-wrap: wrap; }
.site-nav a { white-space: nowrap; text-decoration: none; padding: .35rem .15rem; border-bottom: 3px solid transparent; color: var(--text); }
.site-nav a:hover { border-bottom-color: var(--border-strong); background: none; color: var(--ink); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--primary); color: var(--ink); font-weight: 500; }
.site-nav a, .btn-icon { display: inline-flex; align-items: center; gap: .4rem; }
.site-nav .user-name { font-weight: 500; color: var(--muted-text); }
.nav-toggle { display: none; margin-left: auto; }
.inline-form { display: inline; margin: 0; }
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; min-height: 40px;
  padding: 0; border-radius: 50%; background: var(--surface); color: var(--ink); border: 1px solid var(--border-strong); }
.theme-toggle:hover { background: var(--surface-2); box-shadow: none; transform: none; }
.theme-toggle .i-sun { display: none; }
html[data-theme="dark"] .theme-toggle .i-moon { display: none; }
html[data-theme="dark"] .theme-toggle .i-sun { display: inline; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
  html:not([data-theme="light"]) .theme-toggle .i-sun { display: inline; }
}
.subnav { background: var(--surface); border-bottom: 1px solid var(--border); }
.subnav-inner { max-width: 1100px; margin: 0 auto; padding: 0 1rem; display: flex; gap: .25rem; flex-wrap: wrap; }
.subnav a { padding: .6rem .8rem; text-decoration: none; border-bottom: 3px solid transparent; color: var(--text); }
.subnav a:hover { background: var(--surface-2); }
.subnav a[aria-current="page"] { border-bottom-color: var(--primary); color: var(--ink); font-weight: 500; }

/* Mise en page */
.container { max-width: 1100px; width: 100%; margin: 0 auto; padding: 1.5rem 1rem 3rem; flex: 1 0 auto; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1.25rem; }
.card > :last-child { margin-bottom: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-bottom: .75rem; }
.card-head h1, .card-head h2 { margin: 0; }
.card > h2, .card-head h1, .card-head h2 { display: flex; align-items: center; }
.card > h2::before, .card-head h1::before, .card-head h2::before { content: ""; flex: none; width: 4px; height: 1.1em;
  margin-right: .6rem; border-radius: 2px; background: var(--primary); }
.card > h2 { margin-bottom: .75rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.page-sub { margin: .15rem 0 0; color: var(--muted-text); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem 1.5rem; margin: 0 0 1rem; }
.facts dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-text); }
.facts dd { margin: 0; color: var(--ink); font-weight: 500; }
.stat { text-align: center; }
.stat strong { display: block; font-size: 1.8rem; color: var(--ink); line-height: 1.2; }

/* Pied de page */
.site-footer { padding: 1rem; text-align: center; font-size: .85rem; color: var(--muted-text); }
.site-footer em { font-style: italic; }

/* Boutons */
button, .btn {
  display: inline-block; font: inherit; font-weight: 500; cursor: pointer; text-align: center; text-decoration: none;
  background: var(--primary); color: var(--on-primary); border: 2px solid var(--primary); border-radius: 999px;
  padding: .5rem 1.2rem; min-height: 40px;
}
button:hover, .btn:hover { background: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); }
button:active, .btn:active { transform: none; box-shadow: none; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-danger { background: var(--secondary); border-color: var(--secondary); color: var(--on-primary); }
.btn-danger:hover { background: var(--secondary); }
.btn-small { padding: .2rem .8rem; min-height: 32px; font-size: .9rem; }
button[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.month-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; min-height: 40px;
  padding: 0; border-radius: 50%; font-size: 1.4rem; line-height: 1; }

/* Formulaires */
label { font-weight: 500; color: var(--ink); }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"],
input:not([type]), select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: .45rem .7rem; min-height: 40px; max-width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: 3px solid var(--primary); outline-offset: 0; }
::placeholder { color: var(--muted-text); opacity: 1; }
input[type="email"], input[type="password"], input[type="text"] { width: 100%; max-width: 420px; }
textarea { width: 100%; max-width: 640px; min-height: 90px; }
input[disabled], select[disabled], textarea[disabled] { background: var(--surface-2); color: var(--muted-text); }
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; vertical-align: -3px; margin-right: .4rem; accent-color: var(--primary); }
.field { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: .25rem; }
.field .help { display: block; font-size: .875rem; color: var(--muted-text); margin-top: .25rem; }
.field-check label { display: inline; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.form-row .field { margin-bottom: 0; }
.form-error { color: var(--secondary-text); background: var(--secondary-soft); border-left: 4px solid var(--danger);
  padding: .5rem .75rem; border-radius: var(--radius-sm); }
.errors { margin: 0 0 1rem; padding: .75rem 1rem .75rem 2rem; background: var(--secondary-soft); border-left: 4px solid var(--danger);
  color: var(--secondary-text); border-radius: var(--radius-sm); }
details.dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem .75rem; background: var(--surface-2); }
details.dialog summary { cursor: pointer; font-weight: 500; color: var(--ink); }
details.dialog[open] { padding-bottom: .75rem; }
details.dialog form { margin-top: .75rem; }

/* Formulaires admin (classe form-cols) : deux colonnes sur ordinateur, une sur mobile */
@media (min-width: 761px) {
  .form-cols { display: grid; grid-template-columns: 1fr 1fr; column-gap: 1.5rem; align-items: start; }
  .form-cols > :is(input[type="hidden"], .errors, .small, p, button, .field-wide, .actions, .form-row, details, table,
    .table-wrap, h2, h3, fieldset) { grid-column: 1 / -1; }
  .form-cols > button { justify-self: start; }
  .form-cols .field input[type="text"], .form-cols .field input[type="email"], .form-cols .field input[type="password"],
  .form-cols .field select, .form-cols .field textarea { max-width: none; width: 100%; }
}

/* Messages flash : icône (pastille) et bordure gauche colorée */
.flash { --flash-accent: var(--primary); --flash-glyph: var(--on-primary); position: relative; padding: .75rem 1rem .75rem 3rem;
  border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid var(--flash-accent); border-left-width: 5px;
  box-shadow: var(--shadow); }
.flash::before { content: "i"; position: absolute; left: .85rem; top: .75rem; width: 1.5rem; height: 1.5rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; line-height: 1;
  background: var(--flash-accent); color: var(--flash-glyph); }
.flash-success { --flash-accent: var(--success); --flash-glyph: var(--surface); background: var(--success-soft); color: var(--success-text); }
.flash-success::before { content: "\2713"; }
.flash-error { --flash-accent: var(--secondary); --flash-glyph: var(--on-primary); background: var(--secondary-soft); color: var(--secondary-text); }
.flash-error::before { content: "!"; }
.flash-warning, .flash-info { background: var(--info-bg); color: var(--info-text); }
.flash-warning::before { content: "!"; }
.banner { padding: .7rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; background: var(--info-bg);
  color: var(--info-text); border: 1px solid var(--primary); border-left-width: 5px; }
.banner-rejected { background: var(--secondary-soft); border-color: var(--secondary); color: var(--secondary-text); }
.banner-validated { background: var(--success-soft); border-color: var(--success); color: var(--success-text); }
.rejection { margin: .4rem 0 0; padding: .4rem .6rem; background: var(--secondary-soft); border-left: 4px solid var(--secondary);
  color: var(--secondary-text); font-weight: 500; border-radius: var(--radius-sm); }

/* Badges de statut : pastille ronde + texte */
.badge { --dot: var(--muted); display: inline-flex; align-items: center; gap: .45rem; padding: .1rem .7rem .1rem .6rem;
  border-radius: 999px; font-size: .85rem; font-weight: 500; border: 1px solid transparent; white-space: nowrap; }
.badge::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--dot); }
.badge-draft, .badge-inactive { --dot: var(--muted); background: var(--surface-2); color: var(--text); border-color: var(--border); }
.badge-submitted { --dot: var(--primary); background: var(--primary-soft); color: var(--info-text); }
.badge-validated, .badge-active { --dot: var(--success); background: var(--success-soft); color: var(--success-text); }
.badge-rejected { --dot: var(--secondary); background: var(--secondary-soft); color: var(--secondary-text); }

/* Tableaux */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem .7rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); color: var(--muted-text); font-weight: 500; font-size: .78rem; letter-spacing: .04em;
  text-transform: uppercase; white-space: nowrap; }
thead th:first-child { border-top-left-radius: var(--radius-sm); }
thead th:last-child { border-top-right-radius: var(--radius-sm); }
tbody tr:hover { background: var(--surface-2); }
tr.inactive td { color: var(--muted-text); }
.filters { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.filters .field { margin: 0; }

/* Grille de saisie */
.js .nojs-only { display: none; }
html:not(.js) [data-copy-week], html:not(.js) .qty-tool { display: none; }
.grid-options { margin-bottom: .75rem; }
.grid-status { margin: 0; color: var(--muted-text); }
.grid-status.has-error { color: var(--secondary-text); font-weight: 500; }
.grid-table td { vertical-align: middle; }
.grid-table tr[hidden] { display: none !important; }
.grid-table tr.row-off { background: var(--surface-2); color: var(--muted-text); }
.grid-table tr.row-outside { background: var(--surface-2); color: var(--muted-text); }
.grid-table tr.today { background: var(--primary-soft); }
.grid-table tr.today td:first-child { box-shadow: inset 4px 0 0 var(--primary); }
.grid-table tr.week-start td { border-top: 2px solid var(--border); }
.grid-table .cell-comment { white-space: pre-line; }  /* lecture seule : retours à la ligne du commentaire */
.grid-edit .cell-comment { white-space: normal; }     /* saisie : sinon les sauts de ligne du gabarit créent des lignes vides */
.grid-table .holiday { display: block; font-size: .8rem; color: var(--muted-text); }
.today-badge { display: inline-block; margin-left: .35rem; padding: 0 .5rem; border-radius: 999px; font-size: .75rem;
  font-weight: 700; background: var(--primary); color: var(--on-primary); vertical-align: 1px; }
.grid-table .copy-week { display: block; margin-top: .35rem; white-space: nowrap; font-size: .78rem; padding: .2rem .7rem; }

/* Colonnes (saisie) */
.grid-edit { table-layout: fixed; }
.grid-edit .col-date { width: 4.5rem; }
.grid-edit .col-day { width: 7.5rem; }
.grid-edit .col-qty { width: 14rem; }
.grid-edit .col-state { width: 9rem; }
.grid-edit thead th { position: sticky; top: 0; z-index: 2; box-shadow: 0 1px 0 var(--border); }
.grid-edit td { vertical-align: top; }
.grid-edit .cell-date { color: var(--ink); font-variant-numeric: tabular-nums; padding-top: .95rem; }
.grid-edit .cell-day { padding-top: .75rem; }
.grid-edit .day-name { color: var(--ink); font-weight: 500; white-space: nowrap; }
.grid-edit .cell-qty { padding-top: .6rem; }
.grid-edit .cell-state { padding-top: .95rem; }

/* Commentaire */
.grid-table textarea.comment {
  display: block; width: 100%; max-width: none; min-width: 0; min-height: 40px; resize: none; overflow-y: hidden;
  line-height: 1.4; padding: .45rem .7rem; border-radius: var(--radius-sm); border-color: var(--border-strong);
}
.grid-table [aria-invalid="true"] { border-color: var(--secondary); border-width: 2px; }

/* Quantité : segments en pilule continue */
.qty-seg { position: relative; display: inline-flex; margin: 0; padding: 0; min-width: 0; border: 1px solid var(--border-strong);
  border-radius: 999px; overflow: hidden; background: var(--surface); }
.seg-input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.seg-label { display: inline-flex; align-items: center; justify-content: center; min-width: 3rem; min-height: 38px;
  padding: 0 .75rem; cursor: pointer; font-weight: 500; color: var(--ink); background: var(--surface);
  border-right: 1px solid var(--border); user-select: none; }
.seg-label:hover { background: var(--surface-2); }
.seg-label:last-of-type { border-right: 0; }
.seg-input:checked + .seg-label { background: var(--primary); color: var(--on-primary); font-weight: 700; }
/* « — » (aucune quantité) sélectionné : neutre, le jaune est réservé aux vraies valeurs */
.seg-input[value=""]:checked + .seg-label { background: var(--surface-2); color: var(--muted-text); font-weight: 500; }
.seg-input:focus-visible + .seg-label { outline: 3px solid var(--ink); outline-offset: -3px; }
.seg-input:disabled + .seg-label { cursor: not-allowed; background: var(--surface-2); color: var(--muted-text); }
.seg-input:disabled:checked + .seg-label { background: var(--primary-soft); color: var(--ink); box-shadow: inset 0 0 0 2px var(--primary); }
.seg-input[value=""]:disabled:checked + .seg-label { background: var(--surface-2); color: var(--muted-text); box-shadow: none; }
.qty-seg[data-invalid="true"] { border-color: var(--secondary); border-width: 2px; }

/* Quantité : heures */
.qty-hours { display: flex; align-items: center; gap: .3rem; }
.qty-hours input[type="number"] { width: 5.2rem; text-align: center; }
.qty-hours .qty-tool { min-width: 2.2rem; min-height: 40px; padding: 0 .6rem; }

/* État de la ligne */
.grid-table .state { font-size: .85rem; color: var(--muted-text); white-space: nowrap; }
.grid-table tr.is-stored .state, .grid-table tr.is-saved .state { color: var(--success-text); font-weight: 500; }
.grid-table tr.is-stored .state::before, .grid-table tr.is-saved .state::before { content: "\2713\00a0"; }
.grid-table tr.is-saving .state { color: var(--muted-text); }
.grid-table tr.is-waiting .state { color: var(--muted-text); white-space: normal; }
.grid-table tr.has-error .state { color: var(--secondary-text); font-weight: 500; white-space: normal; }
.grid-table tr.has-error .state::before { content: none; }
.row-warning { margin: .3rem 0 0; padding: .2rem .5rem; font-size: .85rem; background: var(--info-bg);
  color: var(--info-text); border-radius: var(--radius-sm); }
.row-warning[hidden] { display: none; }
.row-error { margin: .3rem 0 0; padding: .2rem .5rem; font-size: .85rem; font-weight: 500; background: var(--secondary-soft);
  color: var(--secondary-text); border-left: 4px solid var(--secondary); border-radius: var(--radius-sm); white-space: normal; }
.row-error[hidden] { display: none; }
.grid-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.toolbar { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-start; margin-bottom: 1rem; }
.toolbar form { margin: 0; }

@media (min-width: 701px) { .table-wrap[data-grid] { overflow: visible; } }

/* Historique */
.history { list-style: none; margin: 0; padding: 0; }
.history li { padding: .5rem 0; border-bottom: 1px solid var(--border); }
.history li:last-child { border-bottom: 0; }

/* Tableau de bord consultant */
.month-nav { display: flex; align-items: center; gap: .75rem; }
.month-label { min-width: 9rem; text-align: center; font-weight: 700; color: var(--ink); font-size: 1.05rem; }
.mission-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-bottom: .75rem; }
.mission-client { margin: 0; font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-text); font-weight: 500; }
.mission-title { margin: 0; font-size: 1.35rem; }
.mission-meta { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; color: var(--muted-text); font-size: .9rem; }
.pill { display: inline-block; padding: .1rem .7rem; border-radius: 999px; background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--border); font-size: .85rem; font-weight: 500; white-space: nowrap; }
.month-lines { list-style: none; margin: 0; padding: 0; }
.month-line { display: grid; grid-template-columns: minmax(8rem, 1.2fr) 9rem minmax(8rem, 1.5fr) auto; gap: .5rem 1rem;
  align-items: center; padding: .75rem .25rem; border-top: 1px solid var(--border); }
.month-line:first-child { border-top: 0; }
.month-line-main { font-weight: 700; color: var(--ink); }
.month-line-total { color: var(--text); }
.month-line-action { text-align: right; }
.month-line .rejection { grid-column: 1 / -1; margin: 0; }
.empty-state { text-align: center; padding: 2.5rem 1rem; }
.empty-state svg { display: block; margin: 0 auto 1rem; color: var(--muted); }
.empty-state p { margin: 0 auto; max-width: 28rem; color: var(--text); }

/* Tableau de bord admin : tuiles */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.15rem; background: var(--surface);
  border: 1px solid var(--border); border-top: 4px solid var(--primary); border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--text); text-decoration: none; }
a.kpi:hover { background: var(--surface-2); transform: translateY(-1px); }
.kpi-icon { flex: none; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--primary-soft); color: var(--ink); }
.kpi-value { display: block; font-size: 2rem; font-weight: 700; color: var(--ink); line-height: 1.1; }
.kpi-label { display: block; color: var(--muted-text); font-size: .9rem; }

/* Pages d'authentification : deux volets */
.auth-layout { flex: 1 0 auto; display: grid; grid-template-columns: minmax(320px, 5fr) 6fr; min-height: 100vh; }
.auth-brand { background: var(--primary); color: var(--on-primary); padding: 3rem; display: flex; flex-direction: column;
  justify-content: center; gap: 1.5rem; }
.auth-brand img { display: block; width: min(300px, 100%); height: auto; }
.auth-tagline { margin: 0; font-size: 2.2rem; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; color: var(--on-primary); }
.auth-name { margin: 0; font-weight: 700; color: var(--on-primary); }
.auth-name em { font-style: italic; font-weight: 500; }
.auth-main { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.25rem; padding: 4rem 1.5rem 2rem; }
.auth-tools { position: absolute; top: 1rem; right: 1rem; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 2rem; }
.auth-card h1 { font-size: 1.5rem; }
.auth-card .field input[type="email"], .auth-card .field input[type="password"], .auth-card .field input[type="text"] { max-width: none; }
.auth-card button[type="submit"] { width: 100%; }
.auth-links { margin: 1rem 0 0; text-align: center; font-size: .9rem; }

/* Mobile */
@media (max-width: 760px) {
  .auth-layout { grid-template-columns: 1fr; min-height: 0; }
  .auth-brand { flex-direction: row; align-items: center; padding: .9rem 1.25rem; gap: 1rem; flex-wrap: wrap; }
  .auth-brand img { width: 110px; }
  .auth-tagline { font-size: 1.15rem; }
  .auth-name { display: none; }
  .auth-main { padding: 1.5rem 1rem 2rem; justify-content: flex-start; }
  .auth-tools { top: .5rem; }
  .auth-card { padding: 1.5rem; }
}
@media (max-width: 700px) {
  .brand img { height: 56px; }
  .site-nav .user-name { display: none; }
  .container { padding: 1rem .75rem 2.5rem; }
  h1 { font-size: 1.45rem; }
  .nav-toggle { display: inline-block; }
  .js .site-nav { display: none; width: 100%; flex-direction: column; align-items: flex-start; margin-left: 0;
    padding-top: .5rem; border-top: 1px solid var(--border); }
  .js .site-nav.open { display: flex; }
  .month-line { grid-template-columns: 1fr auto; }
  .month-line-main { grid-column: 1; grid-row: 1; }
  .month-line-action { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .month-line-status { grid-column: 1; grid-row: 2; }
  .month-line-total { grid-column: 1; grid-row: 3; }
  .month-label { min-width: 0; }
  .grid-table thead { display: none; }
  .grid-table, .grid-table tbody { display: block; }
  .grid-table tr { display: block; margin-bottom: .75rem; padding: .5rem .75rem; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); }
  .grid-table tr.row-off, .grid-table tr.row-outside { background: var(--surface-2); }
  .grid-table tr.today { background: var(--primary-soft); box-shadow: inset 4px 0 0 var(--primary); }
  .grid-table tr.today td:first-child { box-shadow: none; }
  .grid-table tr.week-start { border-top: 3px solid var(--border-strong); }
  .grid-table td { display: flex; justify-content: space-between; align-items: center; gap: .75rem;
    padding: .3rem 0; border-bottom: 0; }
  .grid-table tr.week-start td { border-top: 0; }
  .grid-table td::before { content: attr(data-label); font-weight: 500; color: var(--ink); flex: 0 0 5.5rem; }
  .grid-table td.cell-day { font-weight: 700; color: var(--ink); }
  .grid-table td.cell-comment { display: block; }
  .grid-table td.cell-comment::before { display: block; margin-bottom: .2rem; }
  /* Cartes par jour (saisie) : date et jour en titre, segments sur une ligne, commentaire pleine largeur. */
  .grid-edit { table-layout: auto; }
  .grid-edit tr { display: grid; grid-template-columns: auto 1fr; column-gap: .5rem; }
  .grid-edit td { display: block; padding: .25rem 0; }
  .grid-edit td::before { display: none; }
  .grid-edit .cell-date { grid-column: 1; grid-row: 1; padding-top: .25rem; font-weight: 700; }
  .grid-edit .cell-day { grid-column: 2; grid-row: 1; padding-top: .25rem; }
  .grid-edit .cell-qty { grid-column: 1 / -1; grid-row: 2; padding-top: .25rem; }
  .grid-edit .cell-comment { grid-column: 1 / -1; grid-row: 3; }
  .grid-edit .cell-state { grid-column: 1 / -1; grid-row: 4; padding-top: .15rem; }
  .grid-edit .qty-seg { display: flex; width: 100%; }
  .grid-edit .seg-label { flex: 1; }
  .grid-edit .qty-hours { flex-wrap: wrap; }
  .grid-edit .qty-hours input[type="number"] { flex: 1; min-width: 4rem; }
  .grid-edit .copy-week { display: inline-block; margin: .3rem 0 0; }
}

@media (max-width: 420px) {
  .brand-name { display: none; }
}
