/* GMAO KOKI — back-office d'administration (PC) */
:root {
  --bg: #F2F4F8;
  --surface: #FFFFFF;
  --surface-2: #F6F8FB;
  --text: #0F172A;
  --text-2: #334155;
  --muted: #64748B;
  --line: #E3E8EF;
  --navy: #0B1B3F;
  --primary: #1F4FD8;
  --primary-d: #173DB0;
  --primary-soft: #E6EDFD;
  --accent: #F26B1D;
  --accent-soft: #FDEBDD;
  --green: #0E9F6E;
  --green-soft: #DDF5EB;
  --amber: #D98B06;
  --amber-soft: #FCF0D5;
  --violet: #7048E8;
  --violet-soft: #ECE6FD;
  --red: #DC2F2F;
  --red-soft: #FCE4E4;
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; flex: none; }
.link { color: var(--primary); font-weight: 700; }
.link:hover { text-decoration: underline; }
.hint { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }

/* ---------- Structure ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--navy); color: #C9D3EA; display: flex; flex-direction: column; padding: 18px 14px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; color: #fff; }
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1.2; }
.brand strong { font-size: 16px; }
.brand small { color: #8C9BC0; font-size: 12px; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 800; font-size: 21px; display: grid; place-items: center; flex: none; }
.brand-mark.xl { width: 72px; height: 72px; border-radius: 20px; font-size: 40px; margin: 0 auto 14px; box-shadow: 0 12px 30px rgba(242, 107, 29, .35); }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; overscroll-behavior: contain;
  /* Barre de défilement fine et transparente, plus visible au survol ; la molette fait défiler le menu */
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .12) transparent; transition: scrollbar-color .2s; }
.side-nav:hover { scrollbar-color: rgba(255, 255, 255, .32) transparent; }
.side-nav::-webkit-scrollbar { width: 6px; height: 6px; }
.side-nav::-webkit-scrollbar-track { background: transparent; }
.side-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 6px; }
.side-nav:hover::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .32); }
.side-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6F7FA6; font-weight: 700; padding: 16px 10px 6px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; font-weight: 600; font-size: 11.5px; }
/* Tiroirs du menu : le titre du thème ouvre ou ferme ses liens */
.side-tiroir button.side-label { display: flex; align-items: center; justify-content: space-between; width: 100%; font: inherit; font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: #6F7FA6; background: none; border: 0; border-radius: 7px; padding: 14px 10px 6px; cursor: pointer; text-align: left; }
.side-tiroir button.side-label:hover { color: #C9D3EA; }
.side-tiroir button.side-label .ic { width: 12px; height: 12px; transform: rotate(180deg); transition: transform .15s; }
.side-tiroir.ouvert button.side-label .ic { transform: rotate(-90deg); }
.side-tiroir-liens { display: none; flex-direction: column; gap: 2px; }
.side-tiroir.ouvert .side-tiroir-liens { display: flex; }
.side-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-nav a.on { background: var(--primary); color: #fff; }
.side-foot { border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.side-app { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; font-weight: 600; font-size: 13px; background: rgba(255, 255, 255, .05); }
.side-app:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.me { display: flex; align-items: center; gap: 10px; padding: 2px 4px; }
.me > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.me strong { color: #fff; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { color: #8C9BC0; font-size: 12px; }
.me .icon-btn { color: #C9D3EA; }
.me .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.main { padding: 28px 32px 48px; min-width: 0; max-width: 1440px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 24px; letter-spacing: -.3px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.crumbs a:hover { color: var(--primary); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid transparent; font-weight: 700; cursor: pointer; background: var(--surface); white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-ghost { border-color: var(--line); color: var(--text-2); }
.btn-ghost:hover { border-color: #C8D1DF; background: var(--surface-2); }
.btn-danger { border-color: #F3C4C4; background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; display: inline-grid; place-items: center; cursor: pointer; color: var(--muted); vertical-align: middle; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }

.flash { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; }
.flash-ok { background: var(--green-soft); color: #08744F; }
.flash-err { background: var(--red-soft); color: var(--red); }

/* ---------- Cartes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card-head h2 .ic { color: var(--primary); }
.card-flush { padding: 0; overflow: hidden; }
.card-flush > .card-head { padding: 16px 18px 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2 > .card { margin-bottom: 16px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 16px 16px 20px; display: flex; flex-direction: column; gap: 2px; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--k); }
.kpi-l { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi-v { font-size: 28px; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.kpi small { color: var(--muted); font-size: 12.5px; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.card-flush > .table-wrap:not(:first-child) { margin-top: 14px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FAFBFD; }
.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { display: inline; }
/* En-tête de colonne triable : la flèche reste discrète tant que la colonne n'est pas active */
.th-tri { padding: 0 !important; }
.th-tri > a { display: flex; align-items: center; gap: 4px; padding: 10px 14px; color: inherit; text-decoration: none; }
.th-tri > a:hover { color: var(--primary); background: var(--surface); }
.th-tri .ic { width: 14px; height: 14px; opacity: .3; flex: none; }
.th-tri > a:hover .ic { opacity: .7; }
.th-tri-on { color: var(--primary); }
.th-tri-on .ic { opacity: 1; }

.muted-row td { color: var(--muted); }
.row-link { font-weight: 700; }
.row-link:hover { color: var(--primary); }
.row-clic { cursor: pointer; }
.row-clic:hover { background: var(--surface-2); }
.sub { display: block; color: var(--muted); font-size: 12.5px; }
.relay { color: #B84A0C; font-weight: 700; }
/* Photos prises dans l'intervention : trombone et nombre, à droite du titre */
.trombone { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; color: var(--muted); font-size: 12.5px; font-weight: 600; vertical-align: -2px; }
.trombone .ic { width: 15px; height: 15px; }
.empty-row { text-align: center; color: var(--muted); padding: 32px 14px !important; }
.user-cell { display: flex; align-items: center; gap: 10px; }
/* Le libellé seul passe en colonne : la pastille d'initiales garde sa grille centrée */
.user-cell > span:not(.av) { display: flex; flex-direction: column; font-weight: 600; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.badge .ic { width: 13px; height: 13px; }
.badge + .badge { margin-left: 4px; }
/* Terminée et Validée se lisent l'une sous l'autre, sans se chevaucher */
.col-statut { text-align: center; }
.statuts { display: inline-flex; flex-direction: column; align-items: center; gap: 5px; }
.statuts .badge + .badge { margin-left: 0; }
.st-en_cours, .st-en_pause, .st-en_attente, .st-terminee, .pr-haute, .pr-urgente, .badge-green, .badge-accent, .badge-violet { border-color: transparent; }
.st-en_cours { background: var(--primary-soft); color: var(--primary); }
.st-en_pause { background: var(--amber-soft); color: #8A5A00; }
.st-en_attente { background: var(--violet-soft); color: var(--violet); }
.st-terminee { background: var(--green-soft); color: #08744F; }
.pr-haute { background: var(--amber-soft); color: #8A5A00; }
.pr-urgente { background: var(--red-soft); color: var(--red); }
.badge-green { background: var(--green-soft); color: #08744F; }
.badge-tn { background: var(--violet-soft); color: var(--violet); }
.badge-accent { background: var(--accent-soft); color: #B84A0C; }
.badge-violet { background: var(--violet-soft); color: var(--violet); }

.av { --h: 220; width: 32px; height: 32px; border-radius: 50%; background: hsl(var(--h) 70% 92%); color: hsl(var(--h) 55% 30%); display: inline-grid; place-items: center; font-size: 12px; line-height: 1; font-weight: 700; flex: none; }
.av-stack { display: inline-flex; }
.av-stack .av { width: 28px; height: 28px; font-size: 10.5px; margin-right: -6px; box-shadow: 0 0 0 2px var(--surface); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-top: 1px solid var(--line); }
.pager-info { color: var(--muted); font-size: 13px; }
.pager-links { display: flex; gap: 4px; flex-wrap: wrap; }
.pg { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px; display: inline-grid; place-items: center; font-weight: 600; border: 1px solid var(--line); background: var(--surface); }
a.pg:hover { border-color: var(--primary); color: var(--primary); }
.pg.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.pg.disabled { opacity: .4; }
.pg.dots { border: 0; background: none; }

/* ---------- Formulaires ---------- */
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.field-btn { justify-content: flex-end; flex-direction: row; gap: 8px; }
.input { width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; background: var(--surface); outline: 0; transition: border-color .15s, box-shadow .15s; }
select.input {
  appearance: none; padding-right: 34px; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 16px;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input.is-err { border-color: var(--red); }
.err { color: var(--red); font-size: 12.5px; font-weight: 600; }
.form-card { max-width: 720px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.check { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
.cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.cases .check { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.cases .check:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.cases .sub { display: inline; margin-left: 4px; }

/* ---------- Graphiques ---------- */
.vchart { display: grid; grid-template-columns: 38px 1fr; grid-template-rows: 170px auto; column-gap: 8px; row-gap: 6px; }
.vaxis { position: relative; }
.vaxis span { position: absolute; right: 0; transform: translateY(50%); font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.vplot { position: relative; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.vgrid, .vref { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--line); pointer-events: none; }
.vref { border-top: 2px dashed var(--amber); z-index: 1; pointer-events: auto; }
.vlabels { grid-column: 2; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 6px; text-align: center; }
.vlabels .we { opacity: .55; }
.vbar-fill.manque { background: var(--amber); opacity: .75; }
.vref-legende, .manque-legende { display: inline-block; width: 14px; vertical-align: middle; }
.vref-legende { border-top: 2px dashed var(--amber); }
.manque-legende { height: 8px; border-radius: 2px; background: var(--amber); opacity: .75; }
.vbars { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 6px; align-items: end; height: 100%; position: relative; }
.vbar { display: flex; flex-direction: column; align-items: center; height: 100%; gap: 6px; min-width: 0; }
.vbar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.vbar-fill { width: 100%; max-width: 30px; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 2px; }
.vbar:hover .vbar-fill { background: var(--primary-d); }
.vbar-l { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.chart-foot { font-size: 12px; color: var(--muted); margin-top: 8px; text-align: right; }
.hbar + .hbar { margin-top: 14px; }
.hbar-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.hbar-top span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.hbar-top strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar-track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 4px; background: var(--primary); }

/* ---------- Fiche intervention ---------- */
.relay-card { display: flex; flex-direction: column; gap: 8px; background: var(--accent-soft); border-color: #F8CDB0; }
.relay-card a { display: flex; align-items: center; gap: 8px; color: #B84A0C; font-weight: 600; }
.relay-card a:hover { text-decoration: underline; }
.desc { margin: 0 0 14px; white-space: pre-wrap; background: var(--surface-2); border-radius: 10px; padding: 12px 14px; color: var(--text-2); }
.timeline { display: flex; flex-direction: column; gap: 12px; }
.tl-item { display: flex; gap: 10px; }
.tl-body { flex: 1; min-width: 0; background: var(--surface-2); border-radius: 4px 12px 12px 12px; padding: 8px 12px; }
.tl-meta { font-size: 12.5px; color: var(--muted); }
.tl-meta strong { color: var(--text-2); }
.tl-body p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.ph { display: block; aspect-ratio: 4 / 3; max-width: 100%; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.ph:hover img { transform: scale(1.04); }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 600; text-align: right; }
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.totals div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.totals span { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.totals strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.people { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Connexion ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 520px at 50% -10%, #1C3A86 0%, var(--navy) 62%); }
.login-box { width: 100%; max-width: 400px; }
.login-hero { text-align: center; color: #fff; margin-bottom: 22px; }
.login-hero h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.login-hero h1 span { color: var(--accent); }
.login-hero p { margin: 4px 0 0; color: #A9B6D3; }
.login-card { display: flex; flex-direction: column; gap: 14px; padding: 24px; border-radius: 18px; }
.login-card h2 { margin: 0; font-size: 19px; }
.login-card .flash { margin: 0; }
.login-card .btn { height: 46px; }
.login-foot { text-align: center; margin-top: 18px; }
.login-foot a { color: #A9B6D3; font-size: 13px; }
.login-foot a:hover { color: #fff; }

/* ---------- Explorateur de documents ---------- */
.search-inline { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; height: 40px; color: var(--muted); }
.search-inline .input { border: 0; height: 38px; padding: 0; background: transparent; min-width: 200px; }
.search-inline:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.explorer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.inline-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-filters .input { height: 38px; min-width: 180px; }
.vue-toggle { display: flex; gap: 2px; background: #E4E8F0; border-radius: 10px; padding: 3px; }
.vue-toggle button { border: 0; background: transparent; width: 36px; height: 32px; border-radius: 8px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.vue-toggle button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(15, 23, 42, .1); }

.explorer-titre { font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 22px 2px 10px; display: flex; align-items: center; gap: 8px; }
.explorer-titre .count { background: var(--line); color: var(--text-2); border-radius: 999px; padding: 1px 8px; font-size: 12px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px; }
.tile { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.tile:hover { border-color: #C3D0E6; box-shadow: 0 6px 18px rgba(15, 23, 42, .07); }
.tile-thumb { height: 128px; display: grid; place-items: center; background: var(--surface-2); border: 0; width: 100%; cursor: pointer; padding: 0; }
.tile-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tile-thumb .ic { width: 42px; height: 42px; color: var(--primary); }
.tile-thumb.folder { background: linear-gradient(160deg, #EAF0FE, #F7F9FE); }
.tile-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile-body strong { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-body small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-count { position: absolute; top: 10px; right: 10px; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px; background: var(--primary); color: #fff; font-size: 12.5px; font-weight: 700; display: grid; place-items: center; }
.tile-folder:hover .tile-thumb .ic { transform: scale(1.06); }
.ext { font-size: 15px; font-weight: 800; letter-spacing: .04em; padding: 12px 16px; border-radius: 12px; background: var(--surface); color: var(--text-2); border: 1px solid var(--line); }
.ext.f-pdf { background: var(--red-soft); color: var(--red); border-color: transparent; }
.ext.f-video { background: var(--accent-soft); color: #B84A0C; border-color: transparent; }
.ext.f-bureautique { background: var(--green-soft); color: #08744F; border-color: transparent; }
.ext.f-plan { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.ext.f-archive { background: var(--violet-soft); color: var(--violet); border-color: transparent; }
.tile-visi { position: absolute; top: 10px; left: 10px; }
.tile-visi .badge { cursor: pointer; border: 0; }
.tile-actions { display: flex; gap: 2px; padding: 0 8px 8px; opacity: 0; transition: opacity .15s; }
.tile-actions form { display: inline; }
.tile:hover .tile-actions, .tile:focus-within .tile-actions { opacity: 1; }

/* Vue liste */
.tiles.en-liste { grid-template-columns: 1fr; gap: 6px; }
.tiles.en-liste .tile { flex-direction: row; align-items: center; gap: 12px; border-radius: 10px; }
.tiles.en-liste .tile-thumb { width: 64px; height: 56px; flex: none; }
.tiles.en-liste .tile-thumb .ic { width: 24px; height: 24px; }
.tiles.en-liste .ext { font-size: 11px; padding: 6px 8px; }
.tiles.en-liste .tile-body { flex: 1; padding: 8px 0; }
.tiles.en-liste .tile-count { position: static; margin-right: 12px; }
.tiles.en-liste .tile-visi { position: static; margin-left: auto; }
.tiles.en-liste .tile-actions { padding: 0 8px; opacity: 1; }

.dropzone-vide { border: 2px dashed #C8D4E8; border-radius: 14px; padding: 40px 20px; text-align: center; color: var(--muted); background: var(--surface); }
.dropzone-vide .ic { width: 36px; height: 36px; color: #B8C3D6; }
.dropzone-vide strong { display: block; color: var(--text-2); margin: 8px 0 4px; }
.dropzone-vide p { margin: 0; font-size: 13.5px; }

.drop-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(31, 79, 216, .12); backdrop-filter: blur(2px); display: grid; place-items: center; pointer-events: none; }
.drop-overlay > div { background: var(--surface); border: 2px dashed var(--primary); border-radius: 18px; padding: 28px 40px; text-align: center; color: var(--primary); box-shadow: 0 20px 50px rgba(15, 23, 42, .18); }
.drop-overlay .ic { width: 34px; height: 34px; }
.drop-overlay strong { display: block; font-size: 17px; margin-top: 6px; }
.drop-overlay span { color: var(--muted); font-size: 13.5px; }

/* ---------- Fenêtre modale ---------- */
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(11, 27, 63, .45); }
.modal-box { position: relative; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; background: var(--surface); border-radius: 16px; padding: 20px; box-shadow: 0 24px 60px rgba(15, 23, 42, .25); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.upload-liste { list-style: none; margin: 10px 0 0; padding: 0; max-height: 160px; overflow: auto; font-size: 13px; }
.upload-liste li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px solid var(--line); }
.upload-liste span { color: var(--muted); white-space: nowrap; }
.upload-progress { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 14px; }
.upload-progress div { height: 100%; width: 0; background: var(--primary); transition: width .2s; }

.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .9); display: grid; place-items: center; padding: 24px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; }
.lightbox .icon-btn { position: absolute; top: 16px; right: 16px; color: #fff; background: rgba(255, 255, 255, .15); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; }
  .brand { padding: 0; }
  .side-nav { order: 3; width: 100%; flex-direction: row; overflow-x: auto; }
  .side-nav a { white-space: nowrap; }
  .side-label, .side-app, .me > span:nth-child(2) { display: none; }
  .side-tiroir, .side-tiroir-liens, .side-tiroir.ouvert .side-tiroir-liens { display: contents; }
  .side-tiroir button.side-label { display: none; }
  .side-foot { border: 0; padding: 0; margin-left: auto; }
  .main { padding: 20px 16px 40px; }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
}

/* Accès par rôle : une case par fonction et par rôle */
.table-acces .col-acces { text-align: center; width: 1%; white-space: nowrap; }
.table-acces td.col-acces .check { justify-content: center; }

/* Espace responsable : journée de l'équipe */
.badge-red { background: var(--red-soft); color: var(--red); border-color: transparent; }
.journee-bilan { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.journee-bilan h2 { margin: 0; font-size: 16px; }
.journee-personne .card-head { padding-bottom: 14px; margin-bottom: 0; border-bottom: 1px solid var(--line); }
.journee-total { display: flex; align-items: center; gap: 10px; }
.journee-total strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.journee-vide { margin: 0; padding: 14px 18px; color: var(--muted); }
.ic-suivant { transform: scaleX(-1); }

/* Arborescence active : arbre dépliable site › bâtiment › section › ligne › équipements */
.arbre-bilan { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.arbre-bilan > span { color: var(--muted); }
.arbre-bilan > span strong { color: var(--text); font-size: 16px; }
.arbre-recherche { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 260px; }
.arbre-recherche .input { flex: 1; }
.arbre { padding: 10px 14px; }
.noeud > summary { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; cursor: pointer; list-style: none; }
.noeud > summary::-webkit-details-marker { display: none; }
.noeud > summary::before { content: '▸'; color: var(--muted); width: 12px; flex: none; transition: transform .15s; }
.noeud[open] > summary::before { transform: rotate(90deg); }
.noeud > summary:hover { background: var(--surface-2); }
.noeud > summary .ic { color: var(--primary); flex: none; }
.noeud > summary small { color: var(--muted); }
.noeud > summary .noeud-lien { margin-left: auto; color: var(--muted); display: inline-flex; }
.noeud > summary .noeud-lien:hover { color: var(--primary); }
.noeud .noeud { margin-left: 22px; border-left: 1px dashed var(--line); padding-left: 6px; }
.noeud-section > summary .ic { color: var(--accent); }
.equipements { list-style: none; margin: 0 0 6px 44px; padding: 0; }
.equipement { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 6px; }
.equipement:hover { background: var(--surface-2); }
.equipement a { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.equipement a:hover { color: var(--primary); }
.equipement .ic { width: 14px; height: 14px; color: var(--muted); }
.arbre .masque { display: none; }
.arbre .trouve > strong, .arbre .equipement.trouve a { background: var(--accent-soft); border-radius: 4px; }

/* Exports d'une branche : visibles au survol de l'élément */
.noeud-exports { display: inline-flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.noeud > summary:hover .noeud-exports, .equipement:hover .noeud-exports, .noeud-exports:focus-within { opacity: 1; }
.noeud > summary .noeud-exports { margin-left: auto; }
.noeud > summary .noeud-exports + .noeud-lien { margin-left: 6px; }
.noeud-exports a { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-2); background: var(--surface); }
.noeud-exports a:hover { border-color: var(--primary); color: var(--primary); }
.equipement .noeud-exports { margin-left: 4px; }

/* Outils SI : sauvegardes */
.kpis-sauvegardes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sauvegarde-corps { padding: 0 18px; }
.sauvegarde-corps > .hint { margin: 0 0 12px; }
.planning { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 18px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.planning .jours { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.planning .field { width: 150px; }
.planning .field:last-of-type { width: 210px; }
.card-head form { display: flex; align-items: center; gap: 8px; }
@media (max-width: 880px) { .kpis-sauvegardes { grid-template-columns: 1fr; } }

/* Arborescence d'origine : « CODE : Libellé », regroupements disparus en gris */
.arbre-origine .noeud > .equipement { margin-left: 22px; }
.origine-code { font-variant-numeric: tabular-nums; }
.origine-gris > summary, .equipement.origine-gris, span.origine-gris { color: var(--muted); }

/* Contrôleur de gestion : période et un filtre par colonne en tête de page */
.filtres-cg { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.filtres-cg .filtre-actif .input { border-color: var(--primary); background: var(--primary-soft); }
.table-cg td { white-space: nowrap; }

/* Champ de filtre placé au-dessus d'une longue liste de choix (select[data-recherche]) */
.recherche-liste { margin-bottom: 6px; }

/* Journée de l'équipe : blocs des personnes repliables */
.journee-personne > summary { cursor: pointer; list-style: none; }
.journee-personne > summary::-webkit-details-marker { display: none; }
.journee-personne > summary .user-cell::before { content: '▸'; color: var(--muted); width: 12px; flex: none; transition: transform .15s; }
.journee-personne[open] > summary .user-cell::before { transform: rotate(90deg); }
.journee-personne:not([open]) > summary { padding-bottom: 16px; border-bottom: 0; }
.journee-bilan > div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Tri des documents : emplacements cochables et fenêtre de choix */
.emplacements { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.emp-chip { display: inline-flex; align-items: flex-start; gap: 6px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 12.5px; cursor: pointer; max-width: 340px; }
.emp-chip:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.emp-chip small { display: block; color: var(--muted); font-size: 11px; }
.emp-ajouter { padding: 5px 9px; font-size: 12.5px; }
.emp-dialog { width: min(640px, calc(100vw - 32px)); border: 0; padding: 20px; }
.emp-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.emp-dialog h2 { margin: 0 0 12px; font-size: 16px; }
.emp-dialog select[size] { height: auto; min-height: 260px; }
.tri-table td { vertical-align: top; }
.tri-table select.input { min-width: 170px; }
.tri-apercu { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--surface-2, #eef1f6); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.tri-depot { display: block; margin-top: 16px; border: 2px dashed var(--line); border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; }
.tri-depot .sub { margin-top: 4px; }
.tri-depot.survol { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.tri-resultat { color: var(--muted); font-weight: 600; }
.tri-resultat:not(.attente):not(.erreur) { color: var(--green, #1f8a4c); }
.tri-resultat.erreur { color: var(--red, #c0392b); }
.tri-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
/* Paramètres › Versions : changements de chaque mise à jour */
.notes-version { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; line-height: 1.5; }

/* Choix en arbre (<select data-arbre>) : la liste d'origine reste dans le formulaire, cachée sous le bouton */
.arbre-choix { position: relative; }
.arbre-choix > select { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.arbre-bouton { display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer; font: inherit; color: var(--text); }
.arbre-bouton > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arbre-bouton > span.vide { color: var(--muted); }
.arbre-bouton::after { content: '▾'; color: var(--muted); }
.arbre-panneau { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 23, 42, .14); padding: 8px; }
.arbre-panneau > .input { margin-bottom: 6px; }
.arbre-noeuds { max-height: 360px; overflow-y: auto; }
.arbre-noeuds button { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: none; font: inherit; text-align: left; padding: 6px 8px; border-radius: 7px; cursor: pointer; color: var(--text); }
.arbre-noeuds button:hover, .arbre-noeuds button:focus-visible { background: var(--primary-soft); outline: 0; }
.arbre-noeuds .arbre-titre { font-weight: 600; }
.arbre-titre::before { content: '▸'; color: var(--muted); width: 12px; flex: none; transition: transform .15s; }
.arbre-dossier.ouvert > .arbre-titre::before { transform: rotate(90deg); }
.arbre-titre small { margin-left: auto; color: var(--muted); font-weight: 400; }
.arbre-enfants { margin-left: 13px; padding-left: 6px; border-left: 1px solid var(--line); }
.arbre-dossier:not(.ouvert) > .arbre-enfants { display: none; }
.arbre-noeuds .arbre-feuille.choisi { background: var(--primary-soft); color: var(--primary-d); font-weight: 600; }
.arbre-vide { padding: 8px; color: var(--muted); }
