/* ZotRH — palette : bordeaux, marron, blanc, vert forêt, noir */
:root {
  --bordeaux: #6e1b2c; --bordeaux-dark: #4f1220; --bordeaux-soft: #f3e3e5;
  --marron: #6b4a32; --marron-soft: #f1e7dc;
  --foret: #1f4d3a; --foret-soft: #e2eee7;
  --noir: #161212; --blanc: #fbf8f4;
  --bg: var(--blanc); --surface: #ffffff; --text: var(--noir); --muted: #6a5f58; --line: #e7ddd3;
  --accent: var(--bordeaux); --accent-ink: #ffffff; --ok: var(--foret); --warn: var(--marron); --danger: #9b1c2e;
  --high: var(--bordeaux-soft); --medium: var(--marron-soft); --low: #f4f1ec; --info: var(--foret-soft);
  --radius: 12px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151111; --surface: #1f1918; --text: #f3ece6; --muted: #b3a69c; --line: #3a2f2c;
    --accent: #c75a6e; --accent-ink: #160c0e; --ok: #6fb592; --warn: #c89b72; --danger: #e47a8b;
    --high: #3b1a20; --medium: #33261b; --low: #262020; --info: #1a2e25;
    --bordeaux-soft: #3b1a20; --foret-soft: #1a2e25; --marron-soft: #33261b; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.45rem; margin: 8px 0 16px; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 20px 0 10px; color: var(--accent); }
.card h2:first-child { margin-top: 0; }
a { color: var(--accent); }

/* Barre supérieure noire */
.topbar { display: flex; align-items: center; gap: 14px; padding: 10px 16px; background: var(--noir); color: #fff; position: sticky; top: 0; z-index: 5; flex-wrap: wrap; border-bottom: 3px solid var(--bordeaux); }
.brand { font-weight: 800; font-size: 1.25rem; letter-spacing: .3px; display: flex; align-items: center; gap: 8px; }
.brand .logo { width: 30px; height: 30px; flex: none; }
.brand b { background: var(--bordeaux); color: #fff; padding: 0 6px; border-radius: 6px; margin-left: 1px; }
.tagline { font-size: .78rem; color: #cbb8aa; font-style: italic; margin-left: 2px; white-space: nowrap; }
nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
nav a { padding: 6px 11px; border-radius: 8px; text-decoration: none; color: #d9cfc7; white-space: nowrap; }
nav a:hover { background: #2a2220; }
nav a.active { background: var(--bordeaux); color: #fff; }
.topbar .ghost { color: #fff; border-color: #6b5a52; }

.cyclone { background: var(--danger); color: #fff; padding: 10px 16px; text-align: center; font-weight: 600; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(22,18,18,.04); }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
input, select, textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; margin-top: 4px; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
button { font: inherit; padding: 9px 15px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; font-weight: 600; }
button:hover { filter: brightness(1.08); }
button.ghost { background: transparent; color: var(--accent); }
button.secondary { background: var(--foret); border-color: var(--foret); color: #fff; }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--marron); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .8rem; background: var(--low); }
.pill.ok { color: var(--ok); background: var(--foret-soft); } .pill.warn { color: var(--warn); background: var(--marron-soft); } .pill.bad { color: var(--danger); background: var(--bordeaux-soft); }
.alert { padding: 10px 12px; border-radius: 8px; margin-bottom: 8px; border-left: 4px solid; }
.alert.high { background: var(--high); border-color: var(--danger); }
.alert.medium { background: var(--medium); border-color: var(--warn); }
.alert.low { background: var(--low); border-color: var(--muted); }
.alert.info { background: var(--info); border-color: var(--ok); }
.alert small { display: block; color: var(--muted); }
.kpi { font-size: 2rem; font-weight: 800; line-height: 1.1; }

/* Badgeuse : arrivée vert forêt, départ bordeaux */
.punch { text-align: center; padding: 24px 16px; }
.punch-btn { width: 200px; height: 200px; border-radius: 50%; font-size: 1.45rem; font-weight: 800; margin: 16px auto; display: block; background: var(--foret); border: 6px solid var(--foret-soft); color: #fff; box-shadow: 0 8px 24px rgba(31,77,58,.25); }
.punch-btn.out { background: var(--bordeaux); border-color: var(--bordeaux-soft); box-shadow: 0 8px 24px rgba(110,27,44,.25); }
.muted { color: var(--muted); } .small { font-size: .85rem; }

/* Planning */
table.plan th, table.plan td { vertical-align: top; }
table.plan th.hol { color: var(--danger); }
table.plan td.who { min-width: 170px; }
table.plan td.who small, .shift small, .real { display: block; font-size: .75rem; color: var(--muted); }
table.plan td.who small.warn-t { color: var(--warn); font-weight: 600; }
table.plan td.cell { min-width: 118px; white-space: normal; }
.shift { display: block; width: 100%; text-align: left; margin: 0 0 4px; padding: 4px 7px; font-size: .82rem; font-weight: 600; color: var(--text); background: var(--foret-soft); border: 0; border-left: 4px solid var(--foret); border-radius: 6px; }
.shift.draft { background: var(--marron-soft); border-left: 4px dashed var(--marron); }
.shift:disabled { opacity: 1; cursor: default; }
.real { color: var(--ok) !important; font-weight: 600; margin-bottom: 4px; }
.add { padding: 0 8px; font-size: 1rem; line-height: 1.6; background: transparent; color: var(--muted); border: 1px dashed var(--line); width: 100%; }
.add:hover { color: var(--accent); border-color: var(--accent); }

.dayline { display: grid; grid-template-columns: 84px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.dayline:last-of-type { border-bottom: 0; }
.dayline.today .dl-date strong { color: var(--accent); }
.dl-date { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }

.doc { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.doc:last-child { border-bottom: 0; }
.doc small { display: block; } .doc .pill { margin-left: 6px; }

.overlay { position: fixed; inset: 0; background: rgba(22,18,18,.55); display: grid; place-items: center; z-index: 20; padding: 16px; }
.dialog th, .dialog td { white-space: normal; vertical-align: top; }
.dialog th { hyphens: auto; width: 38%; }
.dialog td { overflow-wrap: anywhere; }
.dialog { max-width: 560px; width: 100%; margin: 0; max-height: 90vh; overflow: auto; }
.post.pinned { border-left: 4px solid var(--bordeaux); }
.pill.kind-info { background: var(--foret-soft); color: var(--ok); }
.pill.kind-reunion { background: var(--marron-soft); color: var(--warn); }
.pill.kind-evenement { background: var(--bordeaux-soft); color: var(--accent); }
.pill.kind-resultats { background: var(--noir); color: #fff; }
.comment { padding: 8px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.comments .cform { margin-top: 8px; } .comments .cform input { margin-top: 0; }
button.tiny { padding: 0 6px; font-size: .75rem; }

.btnlike { display: inline-block; padding: 9px 15px; border-radius: 8px; border: 1px solid var(--accent); color: var(--accent); font-weight: 600; cursor: pointer; }
.btnlike:hover { background: var(--bordeaux-soft); }
.ghost-file { margin: 0; }

/* Connexion */
.auth-wrap { min-height: 560px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; max-width: 1000px; margin: 16px auto; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.auth-hero { background: linear-gradient(160deg, var(--noir) 0%, var(--bordeaux-dark) 60%, var(--marron) 100%); color: #fff; padding: 40px 32px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-hero .brand { font-size: 2rem; }
.auth-hero .brand .logo { width: 44px; height: 44px; }
.auth-hero .slogan { font-size: 1.7rem; font-weight: 800; line-height: 1.2; margin: 28px 0 12px; }
.auth-hero ul { padding: 0; list-style: none; margin: 0; color: #eadbd0; }
.auth-hero li { padding: 6px 0 6px 26px; position: relative; }
.auth-hero li::before { content: ""; position: absolute; left: 0; top: 12px; width: 12px; height: 12px; border-radius: 50%; background: #6fb592; }
.auth-hero .foot { font-size: .8rem; color: #cbb8aa; margin-top: 24px; }
.auth-form { padding: 40px 32px; align-self: center; }
.auth-form h1 { margin-top: 0; }

.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--noir); color: #fff; padding: 10px 16px; border-radius: 8px; max-width: calc(100% - 32px); z-index: 10; border-left: 4px solid var(--bordeaux); }
.notice { font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line); margin-top: 16px; padding-top: 8px; }

@media (max-width: 1450px) { .topbar .tagline { display: none; } }
@media (max-width: 800px) {
  .auth-wrap { grid-template-columns: 1fr; margin: 0; border-radius: 0; border: 0; min-height: 100vh; }
  .auth-hero { padding: 28px 20px; } .auth-hero .slogan { font-size: 1.35rem; margin: 16px 0 8px; }
  .auth-form { padding: 24px 20px; }
}
@media (max-width: 700px) {
  .punch-btn { width: 170px; height: 170px; }
  .topbar { gap: 8px; justify-content: space-between; }
  .tagline { display: none; }
  nav { order: 3; flex-basis: 100%; }
}

/* Badgeuse : planning du jour, demandes, justifications */
.plan-today { margin: 4px 0 10px; }
.card-inner { text-align: left; border-top: 1px solid var(--line); margin-top: 14px; padding-top: 6px; }
.justify .row { margin-top: 6px; flex-wrap: nowrap; } .justify input { flex: 1; min-width: 0; }
.nbadge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 5px; border-radius: 999px; background: #d4a373; color: var(--noir); font-size: .72rem; font-weight: 700; text-align: center; }
.warn-t { color: var(--warn); font-weight: 600; } .bad-t { color: var(--danger); font-weight: 600; }

/* Rappel de fin de journée */
.rest-dialog { text-align: center; max-width: 420px; border-top: 6px solid var(--foret); }
.rest-dialog .moon { font-size: 3rem; line-height: 1; animation: sway 2.4s ease-in-out infinite; }
@keyframes sway { 50% { transform: rotate(-12deg) scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .rest-dialog .moon { animation: none; } }

/* Prévu / réalisé */
table.att tr.today td { background: var(--info); }
table.att-grid td { vertical-align: top; min-width: 92px; }
table.att-grid td.who { min-width: 150px; } table.att-grid td.who a { text-decoration: none; color: inherit; }
.attc small { display: block; font-size: .72rem; color: var(--muted); line-height: 1.35; }
.attc b { display: block; font-size: .85rem; margin-top: 2px; }
.attc.ok b, .attc.valide b { color: var(--ok); } .attc.ecart { background: var(--medium); } .attc.ecart b { color: var(--warn); }
.attc.a_justifier { background: var(--high); } .attc.a_justifier b { color: var(--danger); } .attc.absence { background: var(--low); }

/* Qui est absent ? */
.absent { display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }

/* Organigramme (arbre) */
.org-wrap { overflow-x: auto; }
.org, .org ul { list-style: none; margin: 0; padding: 0; }
.org ul { margin-left: 22px; padding-left: 16px; border-left: 2px solid var(--line); }
.org li { position: relative; padding: 6px 0; }
.org ul > li::before { content: ""; position: absolute; left: -16px; top: 28px; width: 14px; border-top: 2px solid var(--line); }
.org-card { display: inline-flex; flex-direction: column; gap: 1px; min-width: 220px; max-width: 100%; padding: 10px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--marron); }
.org-card.me { border-left-color: var(--bordeaux); background: var(--bordeaux-soft); }
.org-card span { color: var(--marron); font-size: .9rem; } .org-card small { color: var(--muted); }
.org-card a { font-size: .85rem; overflow-wrap: anywhere; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .org-card span { color: var(--warn); } }
table.att-grid td.attc { min-width: 84px; padding: 6px; } table.att-grid button.small { padding: 4px 8px; font-size: .8rem; white-space: nowrap; }

/* Lieu hors site, guidage */
.place-f { border: 1px dashed var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 10px 0; }
.place-f legend { font-size: .85rem; color: var(--marron); padding: 0 6px; }
.geo-res { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.go { display: block; font-size: .8rem; margin-top: 2px; } .go a { font-weight: 600; }
.alert.place { text-align: left; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .place-f legend { color: var(--warn); } }

/* Suivi RH */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.grid2 > .card { margin: 0 0 16px; }
.bar { width: 90px; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 6px; }
.bar span { display: block; height: 100%; background: var(--ok); }
.tools { display: flex; flex-wrap: wrap; gap: 8px; }
.tool { display: inline-flex; flex-direction: column; align-items: flex-start; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: .88rem; cursor: pointer; }
.tool small { font-size: .72rem; color: var(--muted); }
.tool.ouvert { border-color: var(--ok); background: var(--foret-soft); } .tool.ouvert small { color: var(--ok); font-weight: 600; }
.tool.a_fermer { border-color: var(--danger); background: var(--bordeaux-soft); } .tool.a_fermer small { color: var(--danger); font-weight: 600; }
.tool.ferme { opacity: .7; }
.recf { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
textarea { width: 100%; font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
/* Sélecteur de société */
.cosel { width: auto; max-width: 240px; padding: 6px 10px; background: #2a2220; color: #fff; border: 1px solid #6b5a52; border-radius: 8px; }
@media print { .topbar, .tabs, button, .recf { display: none !important; } }
.cosel { max-width: 190px; }

/* Menu en rubriques */
.menubtn { display: none; }
nav.grouped { overflow: visible; gap: 2px; }
.nav-sec { position: relative; }
.nav-btn { background: transparent; color: #d9cfc7; border: 0; padding: 6px 11px; border-radius: 8px; font: inherit; cursor: pointer; white-space: nowrap; margin: 0; }
.nav-btn::after { content: " ▾"; font-size: .75em; opacity: .8; }
.nav-btn:hover, .nav-sec.open > .nav-btn { background: #2a2220; color: #fff; }
.nav-sec.active > .nav-btn { background: var(--bordeaux); color: #fff; }
.nav-menu { display: none; position: absolute; top: 100%; left: 0; min-width: 230px; padding: 6px; margin-top: 2px; background: var(--noir); border: 1px solid #3a2f2c; border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.35); z-index: 10; }
.nav-sec.open .nav-menu, .nav-sec:hover .nav-menu, .nav-sec:focus-within .nav-menu { display: flex; flex-direction: column; gap: 2px; }
.nav-menu a { display: block; }
@media (max-width: 900px) {
  body.nav-grouped .menubtn { display: inline-flex; }
  body.nav-grouped nav.grouped { display: none; order: 3; flex-basis: 100%; flex-direction: column; gap: 0; padding-bottom: 6px; }
  body.nav-grouped.menu-open nav.grouped { display: flex; }
  nav.grouped .nav-sec { position: static; }
  nav.grouped .nav-btn { pointer-events: none; color: #a8968b; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; padding: 12px 8px 2px; background: none !important; }
  nav.grouped .nav-btn::after { content: ""; }
  nav.grouped .nav-menu { display: flex !important; flex-direction: column; position: static; border: 0; box-shadow: none; background: transparent; padding: 0; margin: 0; min-width: 0; }
  nav.grouped .nav-menu a, nav.grouped .nav-top { padding: 9px 10px; }
  .cosel { order: 2; max-width: 150px; }
}
nav.grouped { align-items: center; }
nav.grouped .nav-sec.single { display: flex; align-items: center; }
nav.grouped .nav-top { padding: 6px 11px; line-height: inherit; }
@media (max-width: 900px) {
  nav.grouped .nav-sec.single { border-top: 1px solid #3a2f2c; margin-top: 6px; }
  nav.grouped .nav-sec.single + .nav-sec.single { margin-top: 0; border-top: 0; }
}
.calurl { display: flex; gap: 8px; margin: 10px 0; } .calurl input { flex: 1; min-width: 0; font-family: ui-monospace, monospace; font-size: .8rem; }
.linkbtn { background: none; border: 0; padding: 0; margin-top: 2px; color: var(--muted); font-size: .72rem; text-decoration: underline; cursor: pointer; display: block; }
.steps { margin: 0 0 12px; padding-left: 20px; } .steps li { margin-bottom: 4px; }
.dsnrep { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 6px; }
.btnlike.small { font-size: .8rem; padding: 4px 8px; }
details { margin: 4px 0; } details summary { cursor: pointer; font-size: .9rem; }

/* Assistant RH */
.chatbtn { position: fixed; right: 18px; bottom: 18px; width: 56px; height: 56px; border-radius: 50%; font-size: 1.5rem; padding: 0;
  background: var(--accent); color: var(--accent-ink); border: 0; box-shadow: 0 6px 18px rgba(0,0,0,.25); z-index: 40; cursor: pointer; }
.chatbox { position: fixed; right: 18px; bottom: 86px; width: min(380px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 120px));
  display: flex; flex-direction: column; gap: 8px; z-index: 41; box-shadow: 0 10px 30px rgba(0,0,0,.25); margin: 0; }
.chatbox[hidden] { display: none; }
.chatbox header { display: flex; justify-content: space-between; align-items: center; }
.chatlog { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 6px; min-height: 120px; }
.chatlog p { margin: 0; padding: 8px 10px; border-radius: 10px; max-width: 88%; white-space: pre-wrap; line-height: 1.4; }
.chatlog .bot { background: var(--foret-soft); color: var(--text); align-self: flex-start; }
.chatlog .me { background: var(--bordeaux-soft); align-self: flex-end; }
.chatlog .err { background: var(--marron-soft); }
.chatlog .wait { opacity: .6; }
.chatlog .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chatlog .chips .pill { cursor: pointer; border: 1px solid var(--line); background: var(--surface); }
.chatbox form { display: flex; gap: 6px; }
.chatbox form input { flex: 1; min-width: 0; }
.chatbox .small { font-size: .75rem; margin: 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chatlog .me, :root:not([data-theme="light"]) .chatlog .bot { color: var(--noir); } }
/* Menu simple (salarié) sur téléphone : bouton ☰ et liste verticale */
@media (max-width: 900px) {
  body.nav-flat .menubtn { display: inline-flex; }
  body.nav-flat #nav { display: none; order: 3; flex-basis: 100%; flex-direction: column; gap: 0; padding-bottom: 6px; overflow: visible; }
  body.nav-flat.menu-open #nav { display: flex; }
  body.nav-flat #nav a { padding: 10px; }
}
/* Cellule de boutons : garder une vraie cellule de tableau */
td.row { display: table-cell; white-space: nowrap; }
td.row > * + * { margin-left: 6px; }
.slipbtns { display: flex; gap: 6px; margin-top: 4px; } .slipbtns button { margin: 0; padding: 2px 8px; }
/* Mutuelle */
.prewrap { white-space: pre-wrap; }
.mut-kpi { margin: 8px 0 4px; }
.mcases { border: 0; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.mcases legend { font-weight: 600; margin-bottom: 4px; }
.mcase { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.mcase input { width: auto; margin-top: 3px; }
.mcase small { display: block; }
.mcase.off { opacity: .55; cursor: not-allowed; }
.mcase:has(input:checked) { border-color: var(--accent); background: var(--high); }
/* Communauté › Affichage */
.tabs a.btnlike { text-decoration: none; }
.affset { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 4px; margin: 0 0 10px; }
.affset legend { font-weight: 600; padding: 0 4px; }
.affinfo { padding: 8px 0; border-bottom: 1px solid var(--line); }
.affinfo:last-child { border-bottom: 0; }
.affdoc { padding: 10px 0; border-bottom: 1px solid var(--line); }
.affdoc:last-child { border-bottom: 0; }
.tabs a.btnlike:not(.ghost) { background: var(--accent); color: var(--accent-ink); }
