/* ==========================================================================
   JM Menétrey · application de gestion
   Charte du client (docs/LOGO.pdf, papier à en-tête) : rouge du monogramme, anthracite du bandeau, blanc.
   Le rouge marque « où l'on est » (rubrique, onglet, étape, lien) ; l'anthracite porte les titres et les boutons.
   ========================================================================== */
:root {
    --rouge: #ed1c2a; --rouge-fonce: #c4131f; --rouge-pale: #fde8ea;
    --anthracite: #322f30; --anthracite-2: #4b4748; --noir: #1d1b1c;
    --gris: #8a8485; --gris-pale: #e8e5e4; --gris-ghost: #f5f3f2;
    /* Couleurs de fonction (états, étapes), hors charte */
    --vert: #2f855a; --vert-fonce: #246747; --vert-pale: #e2f5ea;
    --ambre: #8a5a00; --ambre-vif: #d98a0b; --ambre-pale: #fff3d6;
    --azur: #1d5f8a; --azur-pale: #e1eef6;
    --eau: #1aa6b7; --eau-fonce: #12727e; --eau-pale: #ddf4f6;
    --encre: #242122; --encre-2: #55504f; --encre-3: #767071; --ligne: #e1dedd; --papier: #f4f3f2; --blanc: #fff;
    /* Source Sans 3 : la police libre la plus proche du Myriad du logo */
    --font-display: 'Source Sans 3', 'Myriad Pro', 'Segoe UI', Helvetica, Arial, sans-serif; --font-body: 'Source Sans 3', 'Myriad Pro', 'Segoe UI', Helvetica, Arial, sans-serif;
    --radius: 16px; --shadow: 0 12px 30px -20px rgba(50, 47, 48, .5);
    --bs-body-font-family: var(--font-body); --bs-body-color: var(--encre); --bs-body-bg: var(--papier);
    --bs-link-color: var(--anthracite); --bs-link-color-rgb: 50, 47, 48; --bs-link-hover-color: var(--rouge-fonce); --bs-link-hover-color-rgb: 196, 19, 31;
    --bs-border-color: var(--ligne); --bs-primary: var(--anthracite); --bs-primary-rgb: 50, 47, 48;
    /* Palette des avatars et des profils (classes avatar-N / swatch-N) */
    --c1: #322f30; --c2: #1aa6b7; --c3: #ee8a2a; --c4: #2f855a; --c5: #6f5bb5; --c6: #c4131f; --c7: #b7791f; --c8: #4c6a83;
}
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-body); background: var(--papier); color: var(--encre); font-size: 1.0625rem; line-height: 1.55; -webkit-font-smoothing: antialiased; min-height: 100vh; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; color: var(--anthracite); line-height: 1.12; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 3.2vw, 2.55rem); font-style: italic; margin: .1rem 0 .4rem; }
h2 { font-size: 1.25rem; margin: 0; }
h3 { font-size: 1.05rem; }
/* Liens : texte anthracite souligné de rouge, comme le nom au-dessus du trait du papier à en-tête */
a { color: var(--anthracite); text-decoration: underline; text-decoration-color: var(--rouge); text-decoration-thickness: 2px; text-underline-offset: .22em; }
a:hover { color: var(--rouge-fonce); text-decoration-color: currentColor; }
.person-name, .entry-name, .photo-card a, .btn-icon, .hour-edit, .hour-add, .contact-cell a, .step-body a, .dropdown-item { text-decoration: none; }
:focus-visible { outline: 3px solid var(--rouge); outline-offset: 2px; }
.icon { width: 22px; height: 22px; flex: 0 0 auto; vertical-align: -5px; }
.icon-xs { width: 16px; height: 16px; vertical-align: -3px; }
.small { font-size: .875rem; }
.text-muted { color: var(--encre-3) !important; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 100; }

/* ---- Bandeau d'environnement et impersonation ---- */
.stage-ribbon { background: repeating-linear-gradient(135deg, #e39a1e 0 14px, #cc8410 14px 28px); color: #fff; text-align: center; font-weight: 800; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; padding: .25rem; }
.impersonation { background: var(--ambre-pale); color: var(--ambre); text-align: center; padding: .45rem 1rem; font-size: .92rem; }
.impersonation a { color: var(--ambre); font-weight: 700; text-decoration: underline; }

/* ---- Barre du haut ---- */
/* Le bandeau anthracite et le trait rouge du logo */
.topbar { background: var(--anthracite); color: #fff; position: sticky; top: 0; z-index: 20; border-bottom: 4px solid var(--rouge); box-shadow: 0 8px 20px -14px rgba(0, 0, 0, .55); }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: .55rem 1.25rem; display: flex; align-items: center; gap: 1.25rem; }
.brand { display: flex; align-items: center; gap: .65rem; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; color: #fff; }
.brand-mark { width: auto; height: 38px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-family: var(--font-display); font-weight: 600; font-style: italic; font-size: 1.2rem; white-space: nowrap; }
.brand-text small { font-size: .72rem; color: rgba(255, 255, 255, .72); letter-spacing: .06em; text-transform: uppercase; }
.topnav { display: flex; gap: .15rem; flex-wrap: wrap; }
.topnav a { color: rgba(255, 255, 255, .85); text-decoration: none; font-weight: 700; padding: .5rem .9rem; border-radius: 999px; font-size: .95rem; display: inline-flex; align-items: center; gap: .45rem; transition: background .15s ease; }
.topnav a:hover { color: #fff; background: rgba(255, 255, 255, .12); text-decoration: none; }
.topnav a.active { background: #fff; color: var(--anthracite); }
.topnav a.active .icon { color: var(--rouge); }
.topnav .icon { width: 20px; height: 20px; }
.topbar-user { margin-left: auto; }
.user-button { display: inline-flex; align-items: center; gap: .5rem; background: rgba(255, 255, 255, .1); border: 0; color: #fff; border-radius: 999px; padding: .3rem .8rem .3rem .3rem; font-weight: 700; font-family: inherit; }
.user-button:hover { background: rgba(255, 255, 255, .18); }
.dropdown-menu { border: 1px solid var(--ligne); border-radius: 14px; box-shadow: var(--shadow); padding: .4rem; min-width: 220px; }
.dropdown-item { border-radius: 9px; padding: .5rem .8rem; font-weight: 600; }
.dropdown-item:hover { background: var(--gris-ghost); color: var(--anthracite); }
.dropdown-header { color: var(--anthracite); font-weight: 700; padding: .5rem .8rem .3rem; }
.dropdown-header small { color: var(--encre-3); font-weight: 500; }

/* ---- Page ---- */
.main { max-width: 1280px; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head-person { align-items: center; }
.kicker { font-family: var(--font-display); color: var(--rouge-fonce); font-weight: 600; margin: 0; font-size: .95rem; letter-spacing: .02em; }
.eyebrow { font-family: var(--font-display); color: var(--rouge-fonce); font-weight: 600; margin: 0 0 .3rem; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; }
.lead-text { color: var(--encre-2); margin: 0; max-width: 60rem; font-size: 1.05rem; }
.breadcrumb-link { margin: 0 0 .6rem; }
.breadcrumb-link a { font-weight: 700; display: inline-flex; align-items: center; gap: .3rem; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.actions-wrap { margin-top: 1rem; }
.inline-form { display: inline; }
.stack { display: flex; flex-direction: column; gap: 1.1rem; }
.btn { border-radius: 999px; font-weight: 700; padding: .6rem 1.25rem; display: inline-flex; align-items: center; gap: .45rem; justify-content: center; font-family: inherit; }
.btn .icon { width: 18px; height: 18px; }
.btn-sm { padding: .35rem .85rem; font-size: .85rem; }
.btn-lg { padding: .85rem 1.6rem; font-size: 1.05rem; }
/* Les variables Bootstrap suivent, pour que l'état enfoncé ou désactivé ne retombe pas sur le bleu d'origine */
.btn-primary { --bs-btn-active-bg: var(--noir); --bs-btn-active-border-color: var(--noir); --bs-btn-disabled-bg: var(--gris); --bs-btn-disabled-border-color: var(--gris); --bs-btn-focus-shadow-rgb: 50, 47, 48; background: var(--anthracite); border-color: var(--anthracite); color: #fff; }
.btn-primary:hover, .btn-primary:focus-visible { background: var(--noir); border-color: var(--noir); color: #fff; }
.btn-secondary { --bs-btn-active-bg: var(--anthracite); --bs-btn-active-border-color: var(--anthracite); --bs-btn-active-color: #fff; --bs-btn-disabled-bg: #fff; --bs-btn-disabled-color: var(--gris); --bs-btn-disabled-border-color: var(--gris-pale); --bs-btn-focus-shadow-rgb: 50, 47, 48; background: #fff; border: 1px solid var(--anthracite); color: var(--anthracite); }
.btn-secondary:hover { background: var(--anthracite); border-color: var(--anthracite); color: #fff; }
.btn-success { background: var(--vert); border-color: var(--vert); color: #fff; }
.btn-success:hover { background: var(--vert-fonce); border-color: var(--vert-fonce); }
.btn-outline-danger { --bs-btn-active-bg: var(--rouge-fonce); --bs-btn-active-border-color: var(--rouge-fonce); --bs-btn-focus-shadow-rgb: 196, 19, 31; border-color: var(--rouge-fonce); color: var(--rouge-fonce); background: #fff; }
.btn-outline-danger:hover { background: var(--rouge-fonce); color: #fff; border-color: var(--rouge-fonce); }
.btn-link { color: var(--encre-2); font-weight: 600; }
.alert { border-radius: 12px; border: 0; font-weight: 600; }
.alert-success { background: var(--vert-pale); color: var(--vert-fonce); }
.alert-info { background: var(--gris-pale); color: var(--anthracite); }
.alert-warning { background: var(--ambre-pale); color: var(--ambre); }
.alert-danger { background: var(--rouge-pale); color: var(--rouge-fonce); }
.empty { color: var(--encre-3); margin: 0; }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--encre-2); }
.empty-state .empty-icon { width: 56px; height: 56px; color: var(--gris); opacity: .6; margin-bottom: .6rem; }
.empty-state p { max-width: 34rem; margin: 0 auto .9rem; font-size: 1.05rem; }
.badge-soon { display: inline-block; background: var(--ambre-pale); color: var(--ambre); font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; border-radius: 999px; padding: .1rem .5rem; vertical-align: middle; font-style: normal; }

/* ---- Cartes et tuiles ---- */
.card { background: var(--blanc); border: 1px solid var(--ligne); border-radius: var(--radius); padding: 1.35rem 1.5rem; margin-bottom: 1.5rem; }
.card-table { padding: 0; overflow: hidden; }
.card-table .table { margin: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.card-head a { font-weight: 700; }
.card-tip { background: var(--gris-ghost); border-color: var(--gris-pale); }
.card-welcome { text-align: center; }
.card-welcome .welcome-icon { width: 56px; height: 56px; color: var(--rouge); margin-bottom: .5rem; }
.card-welcome h2 { margin-bottom: .4rem; }
.card-welcome p { color: var(--encre-2); max-width: 26rem; margin: 0 auto 1rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.tile { position: relative; display: block; background: var(--blanc); border: 1px solid var(--ligne); border-radius: var(--radius); padding: 1.2rem 1.3rem 1.1rem; color: var(--encre); text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
a.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; color: var(--encre); }
/* Icônes neutres : dans le contenu, le rouge reste réservé à ce qui demande l'attention */
.tile-icon { position: absolute; top: 1rem; right: 1rem; width: 30px; height: 30px; color: var(--gris); }
.tile strong { display: block; font-family: var(--font-display); font-size: 2.1rem; color: var(--anthracite); line-height: 1.1; }
.tile span { display: block; color: var(--encre-2); margin-top: .2rem; font-weight: 600; }
.tile small { display: block; color: var(--encre-3); margin-top: .35rem; }

/* ---- Étapes de démarrage ---- */
.card-steps { background: linear-gradient(120deg, var(--gris-ghost), #fff 70%); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.steps li { display: flex; gap: .9rem; align-items: flex-start; }
.step-mark { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--gris); color: var(--anthracite); font-family: var(--font-display); font-weight: 700; }
.steps li.is-done .step-mark { background: var(--vert); border-color: var(--vert); color: #fff; }
.steps li.is-done .step-body a { color: var(--encre-3); text-decoration: line-through; }
.step-body { display: flex; flex-direction: column; }
.step-body a { font-weight: 800; font-size: 1.02rem; }
.step-body small { color: var(--encre-2); }

/* ---- Post-its ---- */
.postits { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 320px)); gap: 1.1rem; margin: 0 0 1.75rem; padding: 0; list-style: none; }
.postit { position: relative; display: block; text-decoration: none; color: var(--encre); border-radius: 4px; padding: 1.1rem 1.2rem 1rem; box-shadow: 0 10px 22px -14px rgba(50, 47, 48, .55); transform: rotate(-1.2deg); transition: transform .2s ease, box-shadow .2s ease; min-height: 120px; background: var(--ambre-pale); }
.postit:hover { transform: rotate(0) translateY(-3px); box-shadow: 0 18px 30px -16px rgba(50, 47, 48, .6); color: var(--encre); text-decoration: none; }
.postit::before { content: ''; position: absolute; top: -9px; left: 50%; width: 54px; height: 16px; margin-left: -27px; background: rgba(255, 255, 255, .6); border: 1px solid rgba(50, 47, 48, .12); transform: rotate(-2deg); }
.postit--invited { background: var(--azur-pale); }
.postit-count { display: block; font-family: var(--font-display); font-size: 2.3rem; line-height: 1; color: var(--anthracite); }
.postit-label { display: block; font-weight: 800; margin-top: .25rem; }
.postit-hint { display: block; font-size: .85rem; color: var(--encre-2); margin-top: .35rem; line-height: 1.4; }

/* ---- Personnes, avatars, statuts ---- */
.avatar { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: #fff; font-family: var(--font-display); font-weight: 700; font-size: .95rem; letter-spacing: .02em; flex: 0 0 auto; }
.avatar-sm { width: 32px; height: 32px; font-size: .78rem; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.6rem; }
.avatar-1, .swatch-1 { background: var(--c1); } .avatar-2, .swatch-2 { background: var(--c2); } .avatar-3, .swatch-3 { background: var(--c3); } .avatar-4, .swatch-4 { background: var(--c4); }
.avatar-5, .swatch-5 { background: var(--c5); } .avatar-6, .swatch-6 { background: var(--c6); } .avatar-7, .swatch-7 { background: var(--c7); } .avatar-8, .swatch-8 { background: var(--c8); }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; flex: 0 0 auto; }
.swatch-lg { width: 22px; height: 22px; }
.swatch-border-1 { border-top-color: var(--c1); } .swatch-border-2 { border-top-color: var(--c2); } .swatch-border-3 { border-top-color: var(--c3); } .swatch-border-4 { border-top-color: var(--c4); }
.swatch-border-5 { border-top-color: var(--c5); } .swatch-border-6 { border-top-color: var(--c6); } .swatch-border-7 { border-top-color: var(--c7); } .swatch-border-8 { border-top-color: var(--c8); }
.with-avatar { display: flex; gap: .75rem; align-items: center; }
.with-avatar-lg { gap: 1.1rem; }
.person-name { display: block; font-weight: 800; font-size: 1.05rem; color: var(--anthracite); }
.person-sub { display: block; font-size: .85rem; color: var(--encre-3); }
.people { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .5rem; }
.person { display: flex; gap: .7rem; align-items: center; padding: .5rem .6rem; border-radius: 12px; color: var(--encre); text-decoration: none; }
a.person:hover { background: var(--gris-ghost); text-decoration: none; color: var(--encre); }
.person-body { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.person-body strong { font-weight: 800; }
.person-body small { color: var(--encre-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { display: inline-flex; align-items: center; gap: .4rem; background: var(--gris-ghost); border: 1px solid var(--gris-pale); color: var(--anthracite); border-radius: 999px; padding: .15rem .7rem .15rem .5rem; font-weight: 700; font-size: .85rem; white-space: nowrap; }
.chip-muted { color: var(--encre-3); }
.status { display: inline-block; padding: .16rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 800; white-space: nowrap; vertical-align: middle; }
.status-active { background: var(--vert-pale); color: var(--vert-fonce); }
.status-invited { background: var(--ambre-pale); color: var(--ambre); }
.status-inactive, .status-left { background: var(--rouge-pale); color: var(--rouge-fonce); }

/* ---- Tableaux, filtres ---- */
.team-table { --bs-table-bg: transparent; margin-bottom: 0; }
.team-table th { font-size: .78rem; color: var(--encre-3); font-weight: 800; border-bottom: 1px solid var(--ligne); padding: .7rem 1rem; letter-spacing: .03em; text-transform: uppercase; }
.team-table td { padding: .8rem 1rem; vertical-align: middle; border-bottom: 1px solid var(--gris-ghost); }
.team-table tr:last-child td { border-bottom: 0; }
.team-table tr.is-link { cursor: pointer; }
.team-table tr.is-link:hover td { background: var(--gris-ghost); }
.contact-cell a { display: flex; align-items: center; gap: .35rem; color: var(--encre-2); font-size: .92rem; white-space: nowrap; }
.filters { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; }
.tabs a { text-decoration: none; font-weight: 700; color: var(--encre-2); padding: .45rem .95rem; border-radius: 999px; border: 1px solid transparent; }
.tabs a span { color: var(--encre-3); font-weight: 600; font-size: .85rem; margin-left: .2rem; }
.tabs a:hover { background: #fff; border-color: var(--ligne); }
.tabs a.active { background: var(--anthracite); color: #fff; }
.tabs a.active span { color: rgba(255, 255, 255, .75); }
.search { display: flex; gap: .5rem; }
.search .form-control { min-width: 240px; border-radius: 999px; padding-left: 1rem; }
.facts { margin: 0; }
.facts div { display: grid; grid-template-columns: 150px 1fr; gap: .5rem; padding: .5rem 0; border-bottom: 1px dashed var(--ligne); }
.facts div:last-child { border-bottom: 0; }
.facts dt { color: var(--encre-3); font-weight: 600; }
.facts dd { margin: 0; }
.facts .quote { background: var(--gris-ghost); border-radius: 8px; padding: .6rem .8rem; }
.rights { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.rights li { display: grid; grid-template-columns: 20px 110px 1fr auto; align-items: center; gap: .5rem; padding: .3rem .5rem; border-radius: 8px; background: var(--gris-ghost); }
.rights li.is-none { background: transparent; color: var(--encre-3); }
.rights li.is-none strong { color: var(--encre-3); font-weight: 600; }
.rights li strong { color: var(--anthracite); }
.rights li span { color: var(--encre-2); font-size: .92rem; }
.rights-compact li { grid-template-columns: 18px 95px 1fr; padding: .2rem .4rem; font-size: .9rem; background: transparent; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: .45rem 0 .45rem 1.5rem; border-bottom: 1px dashed var(--ligne); }
.timeline li:last-child { border-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: .1rem; top: 1rem; width: 10px; height: 10px; border-radius: 50%; background: var(--gris); }
.timeline li.kind-security::before { background: var(--eau); }
.timeline li.kind-user::before { background: var(--c3); }
.timeline li.kind-profile::before, .timeline li.kind-settings::before { background: var(--c5); }
.timeline span { display: block; font-size: .78rem; color: var(--encre-3); }

/* ---- Modules ---- */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; }
.module-grid-lg { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.module-card { display: flex; flex-direction: column; gap: .3rem; padding: 1rem 1.1rem; border-radius: 14px; border: 1px solid var(--ligne); background: var(--gris-ghost); color: var(--encre); text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
a.module-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; color: var(--encre); background: #fff; }
.module-card .icon { width: 28px; height: 28px; color: var(--anthracite-2); }
.module-card strong { font-family: var(--font-display); font-weight: 600; color: var(--anthracite); font-size: 1.05rem; }
.module-card small { color: var(--encre-2); line-height: 1.35; }
.module-card.is-upcoming { background: #fff; border-style: dashed; color: var(--encre-3); }
.module-card.is-upcoming .icon, .module-card.is-upcoming strong { color: var(--encre-3); }

/* ---- Options radio (profil, couleur) ---- */
.profile-options { display: grid; gap: .5rem; }
.profile-option { display: flex; align-items: center; gap: .8rem; padding: .7rem .9rem; border: 2px solid var(--ligne); border-radius: 12px; cursor: pointer; background: #fff; transition: border-color .15s ease, background .15s ease; }
.profile-option:hover { border-color: var(--gris); }
.profile-option.is-checked { border-color: var(--anthracite-2); background: var(--gris-ghost); }
.profile-option.is-disabled { opacity: .7; cursor: not-allowed; }
.profile-option-input { margin: 0; flex: 0 0 auto; width: 1.15rem; height: 1.15rem; accent-color: var(--anthracite); }
.profile-option-body { display: flex; flex-direction: column; line-height: 1.25; }
.profile-option-body strong { color: var(--anthracite); }
.profile-option-body small { color: var(--encre-2); }
.swatch-options { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.swatch-option { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.swatch-option.is-checked { border-color: var(--anthracite); }
.swatch-option-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch-option .swatch-lg { width: 26px; height: 26px; }

/* ---- Profils (cartes) ---- */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.1rem; }
.profile-card { display: flex; flex-direction: column; gap: .7rem; background: #fff; border: 1px solid var(--ligne); border-top: 5px solid var(--anthracite); border-radius: var(--radius); padding: 1.2rem 1.3rem; color: var(--encre); text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
.profile-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; color: var(--encre); }
.profile-card-head { display: flex; align-items: center; gap: .7rem; }
.profile-card-head strong { display: block; font-family: var(--font-display); font-size: 1.15rem; color: var(--anthracite); line-height: 1.1; }
.profile-card-head small { color: var(--encre-3); }
.profile-card p { margin: 0; color: var(--encre-2); font-size: .95rem; }
.profile-card-cta { margin-top: auto; font-weight: 800; color: var(--anthracite-2); display: inline-flex; align-items: center; gap: .2rem; }

/* ---- Matrice des droits ---- */
.matrix-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .5rem 1.25rem; padding: 1rem 1.25rem; background: var(--gris-ghost); border-bottom: 1px solid var(--ligne); font-size: .88rem; color: var(--encre-2); }
.matrix-legend strong { color: var(--anthracite); }
.matrix { --bs-table-bg: transparent; margin: 0; }
.matrix th, .matrix td { vertical-align: middle; padding: .75rem .9rem; border-bottom: 1px solid var(--gris-ghost); }
.matrix thead th { font-size: .8rem; color: var(--encre-3); text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--ligne); }
.matrix-col-head, .matrix td[data-label] { text-align: center; }
.matrix-col-toggle { background: none; border: 0; padding: .2rem .5rem; border-radius: 8px; font: inherit; color: var(--anthracite-2); font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.matrix-col-toggle:hover { background: var(--gris-pale); }
.matrix-module { display: flex; align-items: center; gap: .7rem; }
.matrix-module .icon { color: var(--anthracite-2); }
.matrix-module strong { display: block; color: var(--anthracite); font-size: 1rem; }
.matrix-module small { display: block; color: var(--encre-3); font-weight: 400; line-height: 1.3; }
.matrix tr.is-upcoming .matrix-module .icon, .matrix tr.is-upcoming .matrix-module strong { color: var(--encre-3); }
.matrix tr.has-access .matrix-module .icon { color: var(--vert-fonce); }
.matrix-summary { white-space: nowrap; font-size: .9rem; color: var(--encre-2); }
.matrix-summary .btn-link { padding: 0 .4rem; }
.switch { position: relative; display: inline-block; width: 48px; height: 28px; margin: 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track { position: absolute; inset: 0; background: var(--ligne); border-radius: 999px; transition: background .15s ease; }
.switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s ease; }
.switch input:checked + .switch-track { background: var(--vert); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--rouge); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .55; cursor: not-allowed; }
.danger-zone { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: .5rem; }

/* ---- Formulaires ---- */
.form-label { font-weight: 700; color: var(--encre); margin-bottom: .3rem; }
/* Champs composés (durée en heures et minutes) : même libellé que les autres champs */
legend.col-form-label { font-size: inherit; font-weight: 700; color: var(--encre); padding: 0; margin-bottom: .3rem; }
.form-control, .form-select { border-radius: 10px; border-color: var(--ligne); padding: .6rem .85rem; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--anthracite-2); box-shadow: 0 0 0 .25rem rgba(50, 47, 48, .14); }
.form-text { color: var(--encre-3); }
.form-check-input:checked { background-color: var(--anthracite); border-color: var(--anthracite); }
.invalid-feedback { font-weight: 600; }
.pw-meter { margin-top: .5rem; }
.pw-bar { height: 6px; border-radius: 999px; background: var(--ligne); overflow: hidden; }
.pw-bar span { display: block; height: 100%; width: 0; border-radius: 999px; transition: width .2s ease, background .2s ease; background: var(--rouge-fonce); }
.pw-bar span.level-1 { width: 30%; background: var(--rouge-fonce); }
.pw-bar span.level-2 { width: 60%; background: var(--ambre-vif); }
.pw-bar span.level-3 { width: 85%; background: var(--vert); }
.pw-bar span.level-4 { width: 100%; background: var(--vert-fonce); }
.pw-checks { list-style: none; margin: .4rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .82rem; color: var(--encre-3); }
.pw-checks li::before { content: '○ '; }
.pw-checks li.is-ok { color: var(--vert-fonce); font-weight: 700; }
.pw-checks li.is-ok::before { content: '✓ '; }

/* ---- Liste déroulante avec recherche (select[data-search], assets/js/picker.js) ---- */
.picker { position: relative; }
.picker-button { display: block; width: 100%; text-align: left; white-space: normal; overflow-wrap: anywhere; color: var(--encre); cursor: pointer; }
.picker-button.is-placeholder { color: var(--encre-3); }
.picker-button[aria-expanded="true"] { border-color: var(--anthracite-2); box-shadow: 0 0 0 .25rem rgba(50, 47, 48, .14); }
.picker-panel { position: absolute; z-index: 15; inset: calc(100% + 6px) 0 auto 0; width: auto; max-width: none; margin: 0; padding: 0; border: 1px solid var(--ligne); border-radius: 14px; background: var(--blanc); color: var(--encre); box-shadow: 0 18px 40px -18px rgba(50, 47, 48, .55); overflow: hidden; scroll-margin: 5rem 0 1rem; }
.picker-panel[open] { display: flex; flex-direction: column; }
.picker-panel.opens-up { inset: auto 0 calc(100% + 6px) 0; min-height: var(--picker-opened, 0px); }
.picker-head { display: none; }
.picker-search { flex: none; width: auto; margin: .55rem; padding-left: 2.5rem; background: var(--blanc) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23767071' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat .8rem center / 1.15rem; }
.picker-list { list-style: none; margin: 0; padding: 0 .35rem .35rem; max-height: 19.5rem; overflow-y: auto; overscroll-behavior: contain; }
.picker-option { position: relative; padding: .7rem 2.3rem .7rem .7rem; border-radius: 9px; line-height: 1.3; cursor: pointer; }
.picker-option.is-none { color: var(--encre-2); }
.picker-option.is-active { background: var(--gris-ghost); }
.picker-option[aria-selected="true"] { font-weight: 700; color: var(--anthracite); }
.picker-option[aria-selected="true"]::after { content: '✓'; position: absolute; right: .85rem; top: 50%; transform: translateY(-50%); color: var(--rouge); font-weight: 800; }
.picker-option mark { padding: 0; background: none; color: inherit; font-weight: 800; text-decoration: underline; text-decoration-color: var(--rouge); text-decoration-thickness: 2px; text-underline-offset: .2em; }
.picker-empty { margin: 0; padding: .3rem 1.05rem 1rem; color: var(--encre-2); }
/* Téléphone et tablette : la liste prend l'écran (hauteur réglée par picker.js quand le clavier s'ouvre) */
.picker-panel.is-sheet { position: fixed; inset: var(--picker-top, 0px) 0 auto 0; width: 100%; max-width: 34rem; height: var(--picker-height, 100dvh); max-height: none; margin: 0 auto; border: 0; border-radius: 0; box-shadow: none; }
.picker-panel.is-sheet::backdrop { background: rgba(29, 27, 28, .55); }
.is-sheet .picker-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: calc(.8rem + env(safe-area-inset-top)) .9rem .25rem 1rem; }
.is-sheet .picker-head strong { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; color: var(--anthracite); }
.is-sheet .picker-search { margin: .55rem .9rem .65rem; }
.is-sheet .picker-list { flex: 1 1 auto; min-height: 0; max-height: none; padding: 0 .55rem calc(.6rem + env(safe-area-inset-bottom)); }
.is-sheet .picker-option { padding-block: .9rem; }
html.picker-open { overflow: hidden; }
@media (min-width: 576px) {
    .picker-panel.is-sheet { top: calc(var(--picker-top, 0px) + 1.5rem); height: auto; max-height: calc(var(--picker-height, 100dvh) - 3rem); border-radius: var(--radius); }
}

/* ---- Pages sans navigation (connexion, mots de passe, erreurs) ---- */
body.bare { background: var(--papier); }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.auth-side { background: var(--anthracite); color: #fff; display: flex; align-items: center; padding: 3rem; position: relative; overflow: hidden; }
.auth-side-inner { position: relative; max-width: 26rem; }
.auth-logo { position: relative; display: block; container-type: inline-size; color: #fff; text-decoration: none; }
.auth-logo:hover { color: #fff; }
.brand-line { display: block; width: 100%; height: auto; overflow: visible; }
.auth-logo-name { position: absolute; left: 20.5%; bottom: 21%; font-style: italic; font-weight: 400; font-size: 1.5rem; font-size: 6.4cqw; line-height: 1; white-space: nowrap; }
.auth-trades { margin: .9rem 0 0; padding-left: 20.5%; font-style: italic; font-size: 1.05rem; line-height: 1.35; color: rgba(255, 255, 255, .85); }
.auth-tagline { font-family: var(--font-display); font-size: clamp(1.5rem, 2.6vw, 2.1rem); line-height: 1.2; margin: 2.6rem 0 1.2rem; font-weight: 600; }
.auth-points { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; color: rgba(255, 255, 255, .82); }
.auth-points li::before { content: '✓  '; color: var(--rouge); font-weight: 800; }
.auth-card { display: flex; flex-direction: column; justify-content: center; padding: 3rem clamp(1.5rem, 6vw, 5rem); max-width: 40rem; }
.auth-card h1 { font-size: clamp(1.9rem, 3.5vw, 2.6rem); }
.auth-card .lead-text { margin-bottom: 1.5rem; }
.auth-foot { margin: 1.5rem 0 0; }
.auth-foot a { font-weight: 700; }
@media (max-width: 991.98px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-side { padding: 2rem 1.5rem; }
    .auth-tagline { margin: 1rem 0 .8rem; font-size: 1.3rem; }
    .auth-points { display: none; }
    .auth-card { padding: 2rem 1.5rem 3rem; max-width: none; }
}

/* ---- Mobile : navigation en bas, tableaux en cartes ---- */
@media (max-width: 767.98px) {
    .topbar-inner { padding: .5rem 1rem; gap: .75rem; }
    .brand-text small { display: none; }
    .user-name { display: none; }
    .topnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--ligne); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; padding: .3rem .3rem calc(.3rem + env(safe-area-inset-bottom)); box-shadow: 0 -8px 20px -16px rgba(50, 47, 48, .6); }
    .topnav { overflow-x: auto; scrollbar-width: none; }
    .topnav::-webkit-scrollbar { display: none; }
    .topnav a { flex-direction: column; gap: .15rem; color: var(--encre-3); font-size: .7rem; padding: .35rem .08rem; border-radius: 10px; white-space: nowrap; }
    .topnav a .icon { width: 22px; height: 22px; }
    .topnav a.active { background: var(--gris-ghost); color: var(--anthracite); }
    .topnav a:hover { background: var(--gris-ghost); color: var(--anthracite); }
    .main { padding: 1.25rem 1rem 6rem; }
    .page-head { margin-bottom: 1.1rem; }
    .team-table thead { display: none; }
    .team-table tr { display: block; padding: .6rem .9rem; border-bottom: 1px solid var(--ligne); }
    .team-table td { display: block; padding: .2rem 0; border: 0; }
    .team-table td[data-label="Dernière connexion"]::before { content: 'Dernière connexion : '; }
    .contact-cell a { display: inline-flex; margin-right: .8rem; }
    .facts div { grid-template-columns: 1fr; gap: 0; }
    .rights li { grid-template-columns: 20px 1fr auto; }
    .rights li span { grid-column: 2 / -1; }
    .matrix thead .matrix-col-head, .matrix-summary-head { display: none; }
    .matrix tr { display: block; padding: .6rem .9rem; border-bottom: 1px solid var(--ligne); }
    .matrix th[scope="row"], .matrix td { display: block; padding: .3rem 0; border: 0; text-align: left; }
    .matrix td[data-label] { display: flex; justify-content: space-between; align-items: center; }
    .matrix td[data-label]::before { content: attr(data-label); font-weight: 700; color: var(--encre-2); }
    .matrix-legend { grid-template-columns: 1fr; }
    .filters { flex-direction: column; align-items: stretch; }
    .search .form-control { min-width: 0; flex: 1; }
}

/* ---- Documents, photos et messages ---- */
.doc-sites { list-style: none; margin: 0; padding: 0; }
.doc-site { display: flex; align-items: center; gap: .9rem; padding: .7rem 0; border-bottom: 1px dashed var(--ligne); text-decoration: none; color: var(--encre); }
.doc-sites li:last-child .doc-site { border-bottom: 0; }
.doc-site:hover strong { text-decoration: underline; }
.doc-site-icon { width: 28px; height: 28px; color: var(--rouge); flex: none; }
.doc-site-icon.is-missing { color: var(--encre-3); }
.doc-site-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.doc-site-body small { color: var(--encre-3); }
.doc-site-meta { display: flex; align-items: center; gap: .5rem; flex: none; }
.upload-form { margin-bottom: 1rem; }
.upload-box { display: flex; align-items: center; gap: .8rem; padding: .9rem 1rem; border: 2px dashed var(--gris-pale); border-radius: 12px; background: var(--gris-ghost); cursor: pointer; color: var(--anthracite); }
.upload-box:hover { border-color: var(--gris); background: #fff; }
.upload-box .icon { width: 28px; height: 28px; flex: none; }
.upload-box span { display: flex; flex-direction: column; }
.upload-box small { color: var(--encre-3); font-weight: 400; }
.upload-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.upload-submit { margin-top: .5rem; }
.photo-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.photo-card a { display: block; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--papier); border: 1px solid var(--ligne); }
.photo-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-placeholder { display: grid; place-items: center; width: 100%; height: 100%; color: var(--encre-3); }
.photo-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0 .4rem; font-size: .8rem; margin-top: .3rem; }
.photo-meta > span { width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.photo-meta small { color: var(--encre-3); }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { display: flex; align-items: center; gap: .7rem; padding: .55rem 0; border-bottom: 1px dashed var(--ligne); }
.file-list li:last-child { border-bottom: 0; }
.file-icon { width: 24px; height: 24px; color: var(--gris); flex: none; }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.file-meta { color: var(--encre-3); font-size: .82rem; white-space: nowrap; }
.messages { list-style: none; margin: 0; padding: 0; }
.message { padding: .7rem 0; border-bottom: 1px dashed var(--ligne); }
.message:last-child { border-bottom: 0; }
.message-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .25rem; }
.message-head span { color: var(--encre-3); font-size: .8rem; margin-left: auto; }
.message-head a { font-size: .85rem; }
.message p { margin: 0; white-space: pre-line; }
.message.is-mine { background: var(--gris-ghost); border-radius: 10px; padding: .7rem .8rem; border-bottom: 0; margin-bottom: .3rem; }
.message-delete { margin-top: .2rem; }
.messages-compact .message p { color: var(--encre-2); font-size: .92rem; }
@media (max-width: 575px) { .file-meta { display: none; } }

/* Explorateur du dossier d'un chantier : chemin, dossiers, fichiers, photos (même rangement que sur kDrive) */
.explorer { container-type: inline-size; scroll-margin-top: 9rem; }
.explorer-note { display: flex; align-items: center; gap: .4rem; margin: -.8rem .25rem 1.5rem; color: var(--encre-3); font-size: .88rem; }
.explorer-note .icon { flex: none; }
.path-bar ol { list-style: none; margin: 0 0 1rem; padding: .5rem .7rem; display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .15rem; background: var(--gris-ghost); border: 1px solid var(--gris-pale); border-radius: 12px; font-family: var(--font-display); font-weight: 600; }
.path-bar li { display: inline-flex; align-items: center; gap: .15rem; min-width: 0; }
.path-bar li > .icon-xs { color: var(--encre-3); }
.path-bar .path-icon { color: var(--rouge); margin-right: .2rem; }
.path-bar a, .path-bar [aria-current] { padding: .2rem .35rem; border-radius: 6px; overflow-wrap: anywhere; }
.path-bar [aria-current] { color: var(--anthracite); }
.upload-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.upload-row .upload-form { margin: 0; }
.entry-list { list-style: none; margin: 0; padding: 0; }
.entry-list + .photo-grid { margin-top: 1.25rem; }
.entry { position: relative; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; grid-template-areas: "icon name actions" "icon meta actions"; align-items: center; column-gap: .75rem; min-height: 56px; padding: .45rem .5rem; border-bottom: 1px solid var(--ligne); }
.entry:last-child { border-bottom: 0; }
.entry-head { display: none; }
.entry-icon { grid-area: icon; width: 26px; height: 26px; color: var(--gris); }
.entry-folder .entry-icon { color: var(--rouge); }
.entry-up .entry-icon { color: var(--encre-3); }
.entry-name { grid-area: name; min-width: 0; overflow-wrap: anywhere; font-weight: 700; color: var(--encre); line-height: 1.3; }
.entry-up { grid-template-areas: "icon name name"; }
.entry-up .entry-name { color: var(--encre-2); font-weight: 600; }
.entry-folder:hover, .entry-up:hover { background: var(--gris-ghost); }
.entry-meta { grid-area: meta; display: flex; gap: .6rem; min-width: 0; color: var(--encre-3); font-size: .82rem; white-space: nowrap; }
.entry-meta span:empty { display: none; }
.entry-actions { grid-area: actions; position: relative; z-index: 2; display: flex; align-items: center; justify-content: flex-end; }
.entry-chevron { width: 18px; height: 18px; color: var(--encre-3); }
.btn-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--encre-2); }
.btn-icon:hover { background: var(--gris-pale); color: var(--anthracite); }
.btn-icon.is-danger:hover { background: var(--rouge-pale); color: var(--rouge-fonce); }
.btn-icon .icon { width: 18px; height: 18px; }
.explorer-empty { padding: .9rem .5rem 0; }
@container (min-width: 620px) {
    .entry { grid-template-columns: 26px minmax(0, 1fr) 8rem 4.5rem 6rem 5rem; grid-template-areas: none; column-gap: 1rem; }
    .entry-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .entry-up .entry-name { grid-column: 2 / -1; }
    .entry > *, .entry-meta > * { grid-area: auto; }
    .entry-meta { display: contents; }
    .entry-meta span, .entry-meta span:empty { display: block; color: var(--encre-3); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .entry-size { text-align: right; }
    .entry-head { display: grid; min-height: 0; padding-top: 0; padding-bottom: .4rem; color: var(--encre-3); font-size: .8rem; font-weight: 700; }
}

/* Visionneuse des photos et des PDF */
.viewer { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #1b1919; color: #fff; }
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: #1b1919; }
.viewer-bar { display: flex; align-items: center; gap: .5rem; padding: .6rem .8rem; }
.viewer-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.viewer-count { color: rgba(255, 255, 255, .7); font-size: .9rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.viewer-btn { display: inline-flex; align-items: center; gap: .4rem; min-height: 40px; padding: .4rem .85rem; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; background: none; color: #fff; font-weight: 700; font-size: .9rem; white-space: nowrap; }
.viewer-btn:hover { background: #fff; color: var(--anthracite); text-decoration: none; }
.viewer-btn .icon { width: 18px; height: 18px; }
.viewer-stage { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr); align-items: center; gap: .5rem; padding: 0 .5rem .8rem; }
.viewer-content { height: 100%; min-height: 0; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; overflow: hidden; }
.viewer-content img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.viewer-content iframe { width: min(1100px, 100%); height: 100%; border: 0; border-radius: 8px; background: #fff; }
.viewer-message { max-width: 26rem; margin: 0; padding: 0 1rem; text-align: center; color: rgba(255, 255, 255, .85); }
.viewer-nav { display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; }
.viewer-nav:hover { background: #fff; color: var(--anthracite); }
.viewer-nav.is-hidden { visibility: hidden; }
html.viewer-open { overflow: hidden; }
@media (max-width: 575px) {
    .viewer-btn { padding: 0; width: 40px; justify-content: center; }
    .viewer-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .viewer-stage { grid-template-columns: minmax(0, 1fr); padding: 0 0 4.4rem; }
    .viewer-nav { position: absolute; bottom: .8rem; }
    .viewer-prev { left: .8rem; }
    .viewer-next { right: .8rem; }
}

/* ---- Heures ---- */
.week-nav { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.week-title { display: flex; flex-direction: column; line-height: 1.2; min-width: 12rem; }
.week-title strong { font-family: var(--font-display); font-size: 1.05rem; color: var(--anthracite); }
.week-title span { color: var(--encre-3); font-size: .85rem; }
.person-picker .form-select { min-width: 14rem; }
.hours-table td { vertical-align: top; }
.hours-table tr.is-weekend td { background: var(--papier); color: var(--encre-3); }
.hours-table tr.is-today td:first-child strong { color: var(--rouge-fonce); }
.hours-table tfoot th { padding: .8rem 1rem; border-top: 2px solid var(--ligne); font-size: .95rem; }
.hour-items { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.hour-items li { display: flex; align-items: center; gap: .5rem; }
.hour-items li > span { flex: 1; min-width: 0; }
.hour-items li em { font-style: normal; font-weight: 700; color: var(--anthracite-2); white-space: nowrap; }
.hour-items li.is-report .icon { color: var(--vert); }
.hour-items li.is-entry .icon { color: var(--eau-fonce); }
.hour-items li.is-compensation .icon { color: var(--ambre-vif); }
.hour-items li.is-compensation em { color: var(--ambre); }
.hour-edit { color: var(--encre-3); display: inline-flex; padding: .15rem; border-radius: 6px; }
.hour-edit:hover { color: var(--anthracite-2); background: var(--gris-ghost); }
.hour-add { display: inline-flex; align-items: center; gap: .2rem; margin-top: .35rem; font-size: .85rem; font-weight: 700; text-decoration: none; }
.tile-delta.is-positive strong, .delta.is-positive { color: var(--vert-fonce); }
.tile-delta.is-negative strong, .delta.is-negative { color: var(--rouge-fonce); }
.tile-delta.is-negative .tile-icon { color: var(--rouge-fonce); }
.tile-delta.is-positive .tile-icon { color: var(--vert); }
.delta { font-weight: 800; }
.card-head-inset { padding: 1.1rem 1rem .4rem; }
.hours-team-table th.text-end, .hours-team-table td.text-end { white-space: nowrap; }

/* ---- Rapports d'intervention ---- */
.status-draft { background: var(--ambre-pale); color: var(--ambre); }
.status-signed { background: var(--vert-pale); color: var(--vert-fonce); }
.status-sent { background: var(--azur-pale); color: var(--azur); }
.duration-field { display: flex; align-items: center; gap: .4rem; }
.duration-field .duration-hours { width: 5rem; }
.duration-field .duration-minutes { width: 5.5rem; }
.duration-field span { color: var(--encre-2); font-weight: 600; }
.report-text { white-space: pre-line; font-size: 1.05rem; margin-bottom: 0; }
.report-subhead { font-size: .95rem; font-weight: 800; color: var(--encre-2); margin: 1rem 0 .4rem; }
.supplies { margin: 0; padding-left: 1.2rem; }
.supplies li { padding: .15rem 0; }
.people-inline { display: flex; flex-wrap: wrap; gap: .4rem 1rem; list-style: none; margin: 0; padding: 0; }
.people-inline .person { display: inline-flex; align-items: center; gap: .4rem; }
.signature-pad { border: 2px dashed var(--gris-pale); border-radius: 12px; background: var(--blanc); padding: .35rem; margin-bottom: .5rem; }
.signature-pad.has-signature { border-color: var(--vert); border-style: solid; }
.signature-pad canvas { display: block; width: 100%; touch-action: none; cursor: crosshair; border-radius: 8px; }
.signature-tools { display: flex; justify-content: space-between; align-items: center; padding: .2rem .4rem 0; }
.signature-view { margin: 0; }
.signature-view img { display: block; max-height: 120px; max-width: 100%; background: var(--blanc); border: 1px solid var(--ligne); border-radius: 8px; padding: .4rem; }
.signature-view figcaption { color: var(--encre-2); font-size: .9rem; margin-top: .4rem; }
.report-list { list-style: none; margin: 0; padding: 0; }
.report-list li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .5rem 0; border-bottom: 1px dashed var(--ligne); }
.report-list li:last-child { border-bottom: 0; }
.report-list a { text-decoration: none; color: var(--encre); }
.report-list a:hover strong { text-decoration: underline; }
.timeline li.kind-report::before { background: var(--vert); }
.postit--drafts { background: var(--ambre-pale); }

/* ---- Clients et chantiers ---- */
.status-archived { background: var(--papier); color: var(--encre-3); border: 1px solid var(--ligne); }
.status-offer { background: var(--ambre-pale); color: var(--ambre); }
.status-awarded { background: var(--azur-pale); color: var(--azur); }
.status-in_progress { background: var(--eau-pale); color: var(--eau-fonce); }
.status-done { background: var(--vert-pale); color: var(--vert-fonce); }
.site-number { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--anthracite-2); letter-spacing: .02em; }
.site-table td .status + .person-sub { display: block; margin-top: .25rem; }
.stepper { list-style: none; margin: .25rem 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.stepper li { position: relative; display: flex; flex-direction: column; align-items: center; gap: .4rem; text-align: center; font-size: .85rem; font-weight: 700; color: var(--encre-3); }
.stepper li::before { content: ''; position: absolute; top: 15px; right: 50%; left: -50%; height: 3px; background: var(--ligne); }
.stepper li:first-child::before { display: none; }
.stepper li.is-done::before, .stepper li.is-current::before { background: var(--vert); }
.stepper .step-mark { position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--blanc); border: 2px solid var(--ligne); font-family: var(--font-display); font-weight: 700; }
.stepper .step-mark .icon { width: 16px; height: 16px; }
.stepper li.is-done { color: var(--vert-fonce); }
.stepper li.is-done .step-mark { background: var(--vert); border-color: var(--vert); color: #fff; }
.stepper li.is-current { color: var(--encre); }
.stepper li.is-current .step-mark { border-color: var(--rouge); color: var(--rouge-fonce); box-shadow: 0 0 0 4px var(--rouge-pale); }
.stepper.is-archived li { opacity: .55; }
.stage-hint { color: var(--encre-2); margin-bottom: 1rem; }
.timeline li.kind-customer::before { background: var(--c7); }
.timeline li.kind-site::before { background: var(--eau-fonce); }
.postit--offers { background: var(--ambre-pale); }
.postit--sites { background: var(--eau-pale); }

/* ---- Fiche chantier : les étapes puis les onglets, communs à toutes ses rubriques ---- */
.site-head { margin-bottom: 1rem; }
.site-nav { padding: 0; overflow: hidden; }
.site-nav .stepper { margin: 0; padding: 1.1rem 1.5rem 1rem; }
.step-short { display: none; }
.site-tabs { position: relative; display: flex; gap: .25rem; padding: 0 .75rem; border-top: 1px solid var(--ligne); overflow-x: auto; scrollbar-width: none; }
.site-tabs::-webkit-scrollbar { display: none; }
.site-tabs a { position: relative; flex: none; display: inline-flex; align-items: center; gap: .5rem; min-height: 54px; padding: .5rem 1.1rem; font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; color: var(--encre-2); text-decoration: none; white-space: nowrap; }
.site-tabs a .icon { width: 20px; height: 20px; }
.site-tabs a:hover { color: var(--anthracite); background: var(--gris-ghost); }
.site-tabs a:focus-visible { outline: 3px solid var(--rouge); outline-offset: -3px; }
.site-tabs a.active { color: var(--anthracite); }
.site-tabs a.active::after { content: ''; position: absolute; left: .6rem; right: .6rem; bottom: 0; height: 4px; border-radius: 4px 4px 0 0; background: var(--rouge); }
.site-tabs a.active .icon { color: var(--rouge-fonce); }
.tab-count { min-width: 1.5rem; padding: 0 .4rem; border-radius: 999px; background: var(--gris-pale); color: var(--anthracite-2); font-family: var(--font-body); font-size: .78rem; font-weight: 800; line-height: 1.5rem; text-align: center; }
.tab-bar { display: flex; justify-content: space-between; align-items: center; gap: .8rem 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tab-bar p { margin: 0; color: var(--encre-2); }
@media (max-width: 575px) {
    .site-nav .stepper { padding: .85rem .4rem .7rem; gap: .2rem; font-size: .76rem; }
    .site-nav .stepper .step-mark { width: 28px; height: 28px; }
    .site-nav .stepper li::before { top: 13px; }
    .step-long { display: none; }
    .step-short { display: inline; }
    .site-tabs { gap: 0; padding: 0 .25rem; }
    .site-tabs a { flex: 1 0 auto; flex-direction: column; justify-content: center; gap: .1rem; min-height: 60px; padding: .45rem .6rem; font-size: .84rem; }
    .site-tabs a .icon { width: 22px; height: 22px; }
    .tab-count { position: absolute; top: .3rem; left: calc(50% + .4rem); min-width: 1.15rem; padding: 0 .25rem; font-size: .68rem; line-height: 1.15rem; }
}

/* ---- Frais : repas, notes de frais, contrôle du bureau ---- */
.status-pending { background: var(--ambre-pale); color: var(--ambre); }
.status-approved { background: var(--vert-pale); color: var(--vert-fonce); }
.status-refused { background: var(--rouge-pale); color: var(--rouge-fonce); }
.tile-money strong { font-size: 1.85rem; line-height: 2.31rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile-delta.is-waiting strong { color: var(--ambre); }
.tile-delta.is-waiting .tile-icon { color: var(--ambre-vif); }
.expense-table td { vertical-align: top; }
.expense-day { white-space: nowrap; }
.expense-title { display: flex; align-items: center; gap: .45rem; }
.expense-title .icon { color: var(--gris); }
.expense-title strong { min-width: 0; overflow-wrap: anywhere; color: var(--anthracite); }
.expense-what .person-sub { padding-left: calc(16px + .45rem); }
.expense-reason { display: block; margin: .35rem 0 0 calc(16px + .45rem); padding: .3rem .6rem; border-radius: 8px; background: var(--rouge-pale); color: var(--rouge-fonce); font-size: .88rem; font-weight: 600; }
.expense-amount { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; color: var(--anthracite); }
.expense-table tr.is-refused .expense-amount { color: var(--encre-3); font-weight: 400; text-decoration: line-through; }
.expense-receipt { white-space: nowrap; }
.receipt-link { display: inline-flex; align-items: center; gap: .3rem; font-weight: 700; }
.expense-actions { white-space: nowrap; }
.expense-actions > * { vertical-align: middle; }
.expense-actions .btn-sm { margin-left: .25rem; }
.expense-team-table th.text-end, .expense-team-table td.text-end { white-space: nowrap; font-variant-numeric: tabular-nums; }
.expense-team-table tfoot th { padding: .8rem 1rem; border-top: 2px solid var(--ligne); font-size: 1rem; color: var(--anthracite); letter-spacing: 0; text-transform: none; }
.amount-input { font-variant-numeric: tabular-nums; font-weight: 700; }
.timeline li.kind-expense::before { background: var(--ambre-vif); }
.postit--expenses { background: var(--ambre-pale); }
@media (max-width: 767.98px) {
    .tiles-pair { grid-template-columns: 1fr 1fr; gap: .6rem; }
    .tiles-pair .tile { padding: .8rem .9rem .75rem; }
    .tiles-pair .tile strong { font-size: 1.4rem; line-height: 1.75rem; }
    .tiles-pair .tile small { font-size: .8rem; line-height: 1.35; }
    .tiles-pair .tile-icon { display: none; }
    /* Une carte par frais : ce qui a été payé et son montant en tête, le jour et l'état dessous */
    .expense-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "what amount" "day state" "person person" "receipt actions" "controls controls"; align-items: center; gap: .3rem .75rem; }
    .expense-table tbody td { padding: 0; }
    .expense-what { grid-area: what; }
    .expense-amount { grid-area: amount; align-self: start; font-size: 1.05rem; }
    .expense-day { grid-area: day; color: var(--encre-2); }
    .expense-day strong { font-weight: 600; }
    .expense-day .person-sub { display: inline; }
    .expense-state { grid-area: state; justify-self: end; }
    .expense-person { grid-area: person; }
    .expense-receipt { grid-area: receipt; }
    .expense-actions { grid-area: actions; justify-self: end; }
    .expense-actions.has-controls { grid-area: controls; justify-self: stretch; display: flex; justify-content: flex-end; align-items: center; gap: .4rem; }
    .expense-actions.has-controls .btn-sm { margin: 0; padding: .5rem 1.1rem; font-size: .92rem; }
    .expense-team-table td[data-label]:not([data-label="Collaborateur"]) { display: flex; justify-content: space-between; gap: 1rem; text-align: left; }
    .expense-team-table td[data-label]:not([data-label="Collaborateur"])::before { content: attr(data-label); color: var(--encre-2); font-weight: 600; }
    .expense-team-table tr.is-empty td[data-label]:not([data-label="Collaborateur"]):not([data-label="Contrôle"]) { display: none; }
    .expense-team-table tfoot { display: none; }
}

/* ---- Facturation : prêt à facturer, facturé, décompte du chantier (onglet Facturation) ---- */
.status-ready { background: var(--ambre-pale); color: var(--ambre); }
.status-billed { background: var(--azur-pale); color: var(--azur); }
.site-table td .status + .status { margin-top: .2rem; }
.postit--billing { background: var(--vert-pale); }
.billing-line { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; margin: -.35rem 0 1rem; color: var(--encre-2); }
.billing-line .icon { color: var(--gris); }
.billing-line a { font-weight: 700; }
.checks { list-style: none; margin: 0 0 1.1rem; padding: 0; display: grid; gap: .45rem; }
.checks li { display: flex; gap: .6rem; align-items: flex-start; }
.checks .icon { width: 20px; height: 20px; margin-top: .18rem; }
.checks li.is-ok .icon { color: var(--vert); }
.checks li.is-warn { color: var(--ambre); font-weight: 600; }
.checks li.is-warn .icon { color: var(--ambre-vif); }
.billing-form { margin-top: 1.1rem; }
.billing-done { padding-top: 1.1rem; border-top: 1px dashed var(--ligne); }
.billing-done .report-subhead { margin-top: 0; font-size: 1.05rem; color: var(--anthracite); }
.billing-undo { margin-top: .5rem; }
.billing-undo .btn-link { padding-left: 0; }
.billing-note { margin: 0 0 .4rem; padding: .6rem .8rem; background: var(--gris-ghost); border-radius: 8px; }
.billing-table th.text-end, .billing-table td.text-end { white-space: nowrap; font-variant-numeric: tabular-nums; }
.billing-table tfoot th { padding: .8rem 1rem; border-top: 2px solid var(--ligne); border-bottom: 0; font-size: 1rem; color: var(--anthracite); letter-spacing: 0; text-transform: none; }
.billing-table + .report-subhead { margin-top: 1.5rem; }
.billing-lines li { align-items: flex-start; }
.billing-lines a { text-decoration: underline; text-decoration-color: var(--rouge); text-decoration-thickness: 2px; text-underline-offset: .22em; }
.billing-lines .status { margin-left: .3rem; }
.billing-amount { flex: none; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; color: var(--anthracite); }
.billing-sum { margin: .9rem 0 0; color: var(--encre-2); }
.print-only { display: none; }
@media (max-width: 767.98px) {
    .billing-table tr { padding-inline: 0; }
    .billing-table td[data-label]:not([data-label="Collaborateur"]), .billing-table tfoot th[data-label] { display: flex; justify-content: space-between; gap: 1rem; text-align: left; }
    .billing-table td[data-label]:not([data-label="Collaborateur"])::before, .billing-table tfoot th[data-label]::before { content: attr(data-label); color: var(--encre-2); font-weight: 600; }
    .billing-table tfoot tr { border-bottom: 0; border-top: 2px solid var(--ligne); }
    .billing-table tfoot th { display: block; padding: .2rem 0; border: 0; }
}

/* ---- Protocoles : contrôles à faire, saisie des points, résultats, réglage des modèles ---- */
.postit--controls { background: var(--rouge-pale); }
.postit--protocols { background: var(--ambre-pale); }
.timeline li.kind-protocol::before { background: var(--c5); }
.issue-flag, .ok-flag { display: inline-flex; align-items: center; gap: .3rem; font-weight: 700; white-space: nowrap; }
.issue-flag { color: var(--rouge-fonce); }
.ok-flag { color: var(--vert-fonce); }
.lead-text .issue-flag, .lead-text .ok-flag { margin: 0 .35rem; }
.head-count { display: inline-block; min-width: 1.5rem; margin-left: .35rem; padding: 0 .4rem; border-radius: 999px; background: var(--gris-pale); color: var(--anthracite-2); font-family: var(--font-body); font-size: .78rem; font-weight: 800; line-height: 1.5rem; letter-spacing: 0; text-align: center; vertical-align: .12em; }
/* Un contrôle prévu : sa date en feuillet de calendrier, colorée selon l'urgence */
.controls { list-style: none; margin: 0; padding: 0; }
.control { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .6rem 1rem; padding: .8rem 0; border-bottom: 1px dashed var(--ligne); }
.control:first-child { padding-top: 0; }
.control:last-child { border-bottom: 0; padding-bottom: 0; }
.control-date { display: grid; justify-items: center; width: 4rem; padding: .35rem 0 .4rem; border-radius: 10px; background: var(--gris-ghost); border: 1px solid var(--gris-pale); line-height: 1.1; }
.control-date strong { font-family: var(--font-display); font-size: 1.55rem; color: var(--anthracite); font-variant-numeric: tabular-nums; }
.control-date span { font-size: .82rem; font-weight: 700; color: var(--encre-2); }
.control-date small { font-size: .7rem; color: var(--encre-3); }
.control.is-overdue .control-date { background: var(--rouge-pale); border-color: transparent; }
.control.is-overdue .control-date strong, .control.is-overdue .control-date span, .control.is-overdue .control-due { color: var(--rouge-fonce); }
.control.is-soon .control-date { background: var(--ambre-pale); border-color: transparent; }
.control.is-soon .control-date strong, .control.is-soon .control-date span, .control.is-soon .control-due { color: var(--ambre); }
.control-body { display: flex; flex-direction: column; min-width: 0; }
.control-title { font-size: 1.05rem; color: var(--anthracite); }
.control-site { overflow-wrap: anywhere; }
.control-meta { font-size: .9rem; color: var(--encre-2); }
.control-due { font-weight: 700; }
.control-note { margin-top: .25rem; padding: .3rem .6rem; border-radius: 8px; background: var(--gris-ghost); font-size: .9rem; color: var(--encre-2); }
.control-actions { display: flex; align-items: center; gap: .15rem; }
.control-actions .btn { margin-right: .35rem; }
.next-control { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .5rem; margin-bottom: .4rem; }
.next-control span { color: var(--encre-2); }
.next-control.is-overdue strong, .next-control.is-overdue span { color: var(--rouge-fonce); }
/* Choix du protocole à remplir */
.template-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.template-choice { display: flex; flex-direction: column; gap: .35rem; padding: 1.2rem 1.3rem; background: var(--blanc); border: 1px solid var(--ligne); border-radius: var(--radius); color: var(--encre); text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
.template-choice:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: var(--encre); }
.template-choice .icon { width: 30px; height: 30px; color: var(--rouge); }
.template-choice strong { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; color: var(--anthracite); }
.template-choice span { color: var(--encre-2); line-height: 1.4; }
.template-choice small { margin-top: auto; padding-top: .4rem; color: var(--encre-3); }
/* Saisie : un point à contrôler se répond d'un geste, sur trois boutons larges */
.points { list-style: none; margin: 0; padding: 0; }
.point { padding: .9rem 0; border-bottom: 1px dashed var(--ligne); }
.point:first-child { padding-top: 0; }
.point:last-child { border-bottom: 0; padding-bottom: 0; }
.point fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.point-label { display: block; float: none; width: auto; margin: 0 0 .5rem; padding: 0; font-size: 1.05rem; font-weight: 700; color: var(--encre); line-height: 1.35; }
.answers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; max-width: 34rem; }
.answer { position: relative; margin: 0; cursor: pointer; }
.answer input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.answer span { display: flex; align-items: center; justify-content: center; gap: .35rem; min-height: 48px; padding: .4rem .5rem; border: 2px solid var(--ligne); border-radius: 12px; background: var(--blanc); font-weight: 700; color: var(--encre-2); text-align: center; line-height: 1.15; transition: border-color .12s ease, background .12s ease; }
.answer:hover span { border-color: var(--gris); }
.answer input:focus-visible + span { outline: 3px solid var(--rouge); outline-offset: 2px; }
.answer-ok input:checked + span { border-color: var(--vert); background: var(--vert-pale); color: var(--vert-fonce); }
.answer-ko input:checked + span { border-color: var(--rouge-fonce); background: var(--rouge-pale); color: var(--rouge-fonce); }
.answer-na input:checked + span { border-color: var(--anthracite-2); background: var(--gris-pale); color: var(--anthracite); }
.point-note { margin-top: .5rem; max-width: 34rem; }
/* La remarque d'un point ne s'ouvre que s'il est « à reprendre », ou si elle est déjà remplie */
@supports selector(:has(*)) {
    .point-note { display: none; }
    .point-check.has-note .point-note, .point-check:has(.answer-ko input:checked) .point-note { display: block; }
}
.measure-field { display: flex; align-items: center; gap: .5rem; }
.measure-field .form-control { max-width: 11rem; font-variant-numeric: tabular-nums; font-weight: 700; }
.measure-field span { color: var(--encre-2); font-weight: 600; }
.point-text .form-control { max-width: 44rem; }
.protocol-actions { flex-direction: column; align-items: stretch; }
/* Fiche d'un protocole : une ligne par réponse */
.results { list-style: none; margin: 0; padding: 0; }
.result { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: start; gap: .2rem .7rem; padding: .55rem 0; border-bottom: 1px dashed var(--ligne); }
.result:first-child { padding-top: 0; }
.result:last-child { border-bottom: 0; padding-bottom: 0; }
.result-icon { width: 20px; height: 20px; margin-top: .15rem; color: var(--gris); }
.result-label small { display: block; color: var(--encre-2); font-size: .9rem; }
.result-value { font-weight: 700; white-space: nowrap; color: var(--encre-2); font-variant-numeric: tabular-nums; }
.result-ok .result-icon, .result-ok .result-value { color: var(--vert-fonce); }
.result-ko .result-icon, .result-ko .result-value { color: var(--rouge-fonce); }
.result-ko .result-label { font-weight: 700; }
.result-ko .result-label small { font-weight: 400; color: var(--rouge-fonce); }
.result-measure .result-value strong { color: var(--anthracite); font-size: 1.05rem; }
.result-open .result-value, .result-open .result-label small { color: var(--encre-3); font-weight: 400; }
.result-text { grid-template-columns: 22px minmax(0, 1fr); }
.result-text-value { display: block; margin-top: .3rem; padding: .5rem .7rem; border-radius: 8px; background: var(--gris-ghost); }
/* Réglages : cartes des modèles et lignes d'un modèle. Sur téléphone, le bouton Enregistrer vient après les lignes */
.template-layout { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "model" "lines" "actions"; gap: 0 1.5rem; align-items: start; }
@media (min-width: 992px) { .template-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); grid-template-areas: "model lines" "actions lines"; grid-template-rows: auto 1fr; } }
.template-layout > .template-model { grid-area: model; }
.template-layout > .template-lines { grid-area: lines; min-width: 0; }
.template-layout > .template-save { grid-area: actions; margin-bottom: 1.5rem; }
.template-card .profile-card-head .icon { width: 26px; height: 26px; color: var(--rouge); }
.template-card.is-archived { background: var(--gris-ghost); border-top-color: var(--gris); }
.template-card.is-archived .profile-card-head .icon { color: var(--gris); }
.template-facts li { grid-template-columns: 18px 80px 1fr; }
.template-rows { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .45rem; }
.template-row { display: grid; grid-template-columns: 11.5rem minmax(0, 1fr) 6rem auto; align-items: center; gap: .45rem; }
/* Sans unité à saisir (tout sauf une mesure), le libellé prend aussi la place du champ « Unité » */
@media (min-width: 768px) {
    .template-row:not(.is-measure) .template-unit { display: none; }
    .template-row:not(.is-measure) [data-row-label] { grid-column: 2 / 4; }
}
.template-row.is-section { margin-top: .7rem; }
.template-row.is-section:first-child { margin-top: 0; }
.template-row.is-section [data-row-label] { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; background: var(--gris-ghost); }
.template-row-tools { display: flex; }
.template-row-tools .btn-icon { width: 36px; height: 36px; }
.template-empty { display: none; margin-bottom: 1rem; }
.is-empty .template-empty { display: block; }
.template-add { margin-bottom: 1.2rem; }
.template-legend { list-style: none; margin: 0; padding: .8rem 1rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .35rem 1.25rem; border-radius: 12px; background: var(--gris-ghost); font-size: .88rem; color: var(--encre-2); }
.template-legend strong { color: var(--anthracite); }
@media (max-width: 767.98px) {
    .control { grid-template-columns: auto minmax(0, 1fr); }
    .control-actions { grid-column: 1 / -1; justify-content: flex-end; }
    .control-actions .btn { margin-right: auto; padding: .5rem 1.1rem; font-size: .92rem; }
    .answers { max-width: none; gap: .35rem; }
    .answer span { flex-direction: column; gap: .1rem; min-height: 56px; font-size: .9rem; }
    .point-note { max-width: none; }
    .protocol-table td[data-label="Résultat"], .protocol-table td[data-label="État"] { display: inline-block; margin-right: .6rem; }
    .result { grid-template-columns: 22px minmax(0, 1fr); }
    .result-value { grid-column: 2; }
    .template-row { grid-template-columns: minmax(0, 1fr) auto; padding: .6rem; border: 1px solid var(--ligne); border-radius: 12px; }
    .template-row [data-row-label] { grid-column: 1 / -1; grid-row: 2; }
    .template-row .template-unit { grid-column: 1; grid-row: 3; }
    .template-row:not(.is-measure) .template-unit { display: none; }
    .template-row-tools { grid-column: 2; grid-row: 1; }
    .template-add .btn { flex: 1 1 45%; padding-inline: .5rem; font-size: .92rem; white-space: nowrap; }
}

/* ---- Impression : le décompte d'un chantier se lit sur papier, sans le menu ni les boutons ---- */
@media print {
    @page { margin: 14mm; }
    body { background: #fff; font-size: 11pt; }
    .stage-ribbon, .topbar, .impersonation, .breadcrumb-link, .alert, .site-nav, .btn, .billing-form, .billing-undo, .billing-help, #confetti { display: none !important; }
    .main { max-width: none; padding: 0; }
    .card { border: 0; border-radius: 0; padding: 0; margin-bottom: 1.4rem; }
    a, .billing-lines a { color: inherit; text-decoration: none; }
    .billing-side { order: -1; }
    .print-only { display: block; }
    h2, h3 { break-after: avoid; }
    .billing-lines li, .billing-table tr, .supplies li, .checks li, .facts div { break-inside: avoid; }
}
