/* =====================================================================
   BTP SNAGGING — Design system
   Fichier : public/assets/css/app.css
   Source de vérité : charte de btpservices.pro (style.css v2026.09.27a)
   Les tokens ci-dessous reprennent À L'IDENTIQUE les variables du site
   vitrine. Ne pas modifier une valeur sans la modifier aussi sur le site.
   ===================================================================== */

/* ---------- Polices (auto-hébergées, identiques au site) ---------- */
@font-face { font-family: "Poppins"; src: url("../fonts/poppins-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../fonts/poppins-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

/* ---------- Tokens : thème sombre par défaut (comme le site) ---------- */
:root {
    /* Marque */
    --orange: #FEA104;          /* accent chantier principal */
    --orange-hover: #E59100;
    --black: #231F20;           /* noir du logo */
    --black-deep: #1A1718;
    --on-orange: #231F20;       /* texte posé sur l'orange */

    /* Surfaces & texte (sombre) */
    --bg: #231F20;
    --bg-alt: #2A2526;
    --surface: #302B2C;
    --text: #F2F2F2;
    --muted: #ABABAB;
    --border: #3B3536;
    --accent-text: #FEA104;     /* orange lisible sur le fond courant */

    /* Géométrie (site) */
    --radius: 12px;             /* cartes */
    --radius-btn: 8px;          /* boutons, champs */
    --radius-pill: 999px;       /* filtres, badges */
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
    --wrap: 1180px;
    --gutter: 20px;
    --header-h: 68px;
    --bottom-nav-h: 64px;

    /* Motif zellige (site) */
    --zellige: .30;
    --zellige-size: 180px;

    /* Métier : sévérités des réserves (high & medium = valeurs du site) */
    --sev-low: #8A9AA6;
    --sev-medium: #E08E00;
    --sev-high: #D64533;
    --sev-critical: #8E1F14;

    /* Métier : statuts des réserves */
    --st-open: #D64533;
    --st-progress: #E08E00;
    --st-resolved: #2E9D5B;
    --st-closed: #7A7A7A;

    color-scheme: dark;
}

/* ---------- Thème clair (valeurs du site) — utile en plein soleil sur chantier ---------- */
[data-theme="light"] {
    --bg: #FFFFFF;
    --bg-alt: #F4F4F4;
    --surface: #FFFFFF;
    --text: #161616;
    --muted: #5C5C5C;
    --border: #E2E2E2;
    --shadow: 0 10px 30px rgba(0, 0, 0, .08);
    --accent-text: #9A5B00;
    --st-resolved: #1F7A44;
    color-scheme: light;
}
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --bg: #FFFFFF;
        --bg-alt: #F4F4F4;
        --surface: #FFFFFF;
        --text: #161616;
        --muted: #5C5C5C;
        --border: #E2E2E2;
        --shadow: 0 10px 30px rgba(0, 0, 0, .08);
        --accent-text: #9A5B00;
        --st-resolved: #1F7A44;
        color-scheme: light;
    }
}

/* ---------- Base ---------- */
/* Préflight minimal (preflight Tailwind désactivé) : les utilitaires `border` fonctionnent */
*, *::before, *::after { box-sizing: border-box; border-width: 0; border-style: solid; border-color: var(--border); }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
    margin: 0;
    font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 1rem; line-height: 1.6;
    background: var(--bg); color: var(--text);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .h1, .h2, .h3 { line-height: 1.15; letter-spacing: -.015em; margin: 0 0 .6rem; font-weight: 700; }
/* Dans l'application, titres plus compacts que sur le site vitrine */
h1, .h1 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); }
h2, .h2 { font-size: clamp(1.2rem, 2.4vw, 1.5rem); }
h3, .h3 { font-size: 1.08rem; }
p { margin: 0 0 1rem; }
a { color: var(--accent-text); }
img, svg { max-width: 100%; }
.accent { color: var(--accent-text); }
.eyebrow { display: block; margin: 0 0 .5rem; color: var(--accent-text); font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 760px; }
.note, .meta { color: var(--muted); font-size: .85rem; }
/* Les enfants de grilles/flex ne doivent jamais élargir la page (tableaux, onglets) */
.grid > *, .flex > * { min-width: 0; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 200; padding: 10px 16px; border-radius: 8px; background: var(--orange); color: var(--on-orange); font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---------- Boutons (copie conforme du site) ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    min-height: 48px; padding: 12px 22px; border-radius: var(--radius-btn);
    border: 2px solid transparent; font: inherit; font-weight: 700; font-size: .95rem;
    text-decoration: none; cursor: pointer; transition: background .2s, color .2s, border-color .2s, transform .2s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--orange); color: var(--on-orange); }
.btn--primary:hover { background: var(--orange-hover); color: var(--on-orange); }
.btn--ghost { border-color: var(--accent-text); color: var(--accent-text); background: transparent; }
.btn--ghost:hover { background: var(--orange); border-color: var(--orange); color: var(--on-orange); }
.btn--ghost-light { border-color: #FFFFFF; color: #FFFFFF; background: transparent; }
.btn--ghost-light:hover { background: #FFFFFF; color: var(--black); }
/* Ajouts application */
.btn--quiet { background: var(--bg-alt); color: var(--text); border-color: var(--border); }
.btn--quiet:hover { border-color: var(--accent-text); }
.btn--danger { background: var(--sev-high); color: #FFFFFF; }
.btn--danger:hover { background: #B8392A; }
.btn--sm { min-height: 40px; padding: 8px 16px; font-size: .88rem; }
.btn--icon { min-height: 44px; min-width: 44px; padding: 0; }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; cursor: progress; }

/* ---------- En-tête (toujours noir : fond du logo, comme le site) ---------- */
.app-header { position: sticky; top: 0; z-index: 100; background: var(--black); border-bottom: 1px solid #3B3536; color: #F2F2F2; }
.app-header__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: var(--header-h); }
.app-header__logo { display: flex; align-items: center; gap: 10px; color: #F2F2F2; text-decoration: none; font-weight: 700; }
.app-header__logo img { width: auto; height: 44px; border-radius: 4px; }
.app-header__product { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--orange); }
.app-nav { display: none; }
.app-nav ul { display: flex; gap: 2px; margin: 0; padding: 0; list-style: none; }
.app-nav a { display: block; padding: 8px 12px; border-radius: 6px; color: #BDBDBD; text-decoration: none; font-weight: 500; font-size: .93rem; }
.app-nav a:hover { color: #FFFFFF; background: rgba(255,255,255,.06); }
.app-nav a[aria-current="page"] { color: var(--orange); }
@media (min-width: 1024px) { .app-nav { display: block; } }

/* Barre de navigation basse (smartphone / tablette sur chantier) */
.bottom-nav { position: fixed; inset-inline: 0; bottom: 0; z-index: 100; height: var(--bottom-nav-h); padding-bottom: env(safe-area-inset-bottom); background: var(--black); border-top: 1px solid #3B3536; }
.bottom-nav ul { display: grid; grid-template-columns: repeat(5, 1fr); height: 100%; margin: 0; padding: 0; list-style: none; }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 100%; color: #BDBDBD; text-decoration: none; font-size: .7rem; font-weight: 500; }
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a[aria-current="page"] { color: var(--orange); }
.has-bottom-nav { padding-bottom: calc(var(--bottom-nav-h) + 16px); }
@media (min-width: 1024px) { .bottom-nav { display: none; } .has-bottom-nav { padding-bottom: 0; } }

/* Bandeau de page avec motif zellige (repris du site) */
.page-hero { position: relative; isolation: isolate; overflow: hidden; background: var(--black); color: #F2F2F2; padding: 28px 0 24px; border-bottom: 2px solid var(--orange); }
.page-hero::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: url("../img/zellige.svg") center / var(--zellige-size) repeat;
    opacity: var(--zellige);
    -webkit-mask-image: radial-gradient(ellipse 60% 75% at 72% 50%, #000 0%, rgba(0,0,0,.55) 45%, transparent 78%);
            mask-image: radial-gradient(ellipse 60% 75% at 72% 50%, #000 0%, rgba(0,0,0,.55) 45%, transparent 78%);
}
.page-hero .meta { color: #BDBDBD; }
/* Zones toujours noires : l'orange vif reste lisible quel que soit le thème */
.app-header, .page-hero, .bottom-nav, .toast { --accent-text: var(--orange); }

/* ---------- Cartes (copie conforme du site : filet orange en tête) ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--orange); border-radius: var(--radius); padding: 22px; }
.card p { color: var(--muted); font-size: .93rem; margin: 0; }
.card--flat { border-top-width: 1px; border-top-color: var(--border); }
.card--media { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.card--media img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.card__body { padding: 18px 20px 22px; }
.link-arrow { color: var(--accent-text); font-weight: 700; text-decoration: none; }
.link-arrow::after { content: " →"; }
[dir="rtl"] .link-arrow::after { content: " ←"; }

/* KPI du tableau de bord */
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi__label { color: var(--muted); font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.kpi__value { font-size: 2.1rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi__trend { font-size: .82rem; color: var(--muted); }
.kpi--alert { border-inline-start: 4px solid var(--sev-high); }
.kpi--warn  { border-inline-start: 4px solid var(--orange); }

/* ---------- Badges : sévérité & statut ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--radius-pill); font-size: .74rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; line-height: 1.5; white-space: nowrap; }
.sev--low      { background: var(--sev-low); color: #161616; }
.sev--medium   { background: var(--sev-medium); color: #231F20; }
.sev--high     { background: #C73A29; color: #FFFFFF; }
.sev--critical { background: var(--sev-critical); color: #FFFFFF; }

.status { background: transparent; border: 1px solid var(--border); color: var(--text); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status--open        { color: var(--st-open); }
.status--in_progress { color: var(--st-progress); }
.status--resolved    { color: var(--st-resolved); }
.status--closed      { color: var(--st-closed); }
.status--draft, .status--paused, .status--archived { color: var(--muted); }
.status--active    { color: var(--st-resolved); }
.status--completed { color: var(--accent-text); }

/* Pastille corps d'état (couleur injectée en style="--trade:#xxxxxx") */
.trade { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; }
.trade::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--trade, var(--muted)); }

/* ---------- Filtres en pilule (repris du rapport snagging du site) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-size: .88rem; font-weight: 700; min-height: 40px; padding: 8px 14px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.chip[aria-pressed="true"], .chip.is-active { background: var(--orange); border-color: var(--orange); color: var(--on-orange); }

/* ---------- Formulaires ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.label { font-size: .88rem; font-weight: 600; }
.label .req { color: var(--accent-text); }
.input, .select, .textarea {
    width: 100%; min-height: 48px; padding: 10px 14px; font: inherit; font-size: 1rem;
    color: var(--text); background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius-btn);
    transition: border-color .2s, box-shadow .2s;
}
.textarea { min-height: 110px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(254,161,4,.25); }
.input[aria-invalid="true"] { border-color: var(--sev-high); }
.help { font-size: .8rem; color: var(--muted); }
.error { font-size: .82rem; color: var(--sev-high); font-weight: 600; }

/* ---------- Onglets (vue projet) ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; padding: 12px 16px; min-height: 48px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted); font: inherit; font-weight: 600; font-size: .93rem; cursor: pointer; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--accent-text); border-bottom-color: var(--orange); }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: start; padding: 12px 14px; font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--bg-alt); border-bottom: 1px solid var(--border); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--bg-alt); }

/* ---------- Plan d'étage + épingles de réserves ----------
   Les coordonnées sont stockées en % (0–100) : la position reste juste
   quelle que soit la taille d'écran. */
.plan { position: relative; width: 100%; background: #FFFFFF; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; touch-action: manipulation; cursor: crosshair; }
.plan img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.plan-pin {
    position: absolute; transform: translate(-50%, -100%);
    width: 30px; height: 30px; border-radius: 50% 50% 50% 0; rotate: -45deg;
    background: var(--pin, var(--sev-high)); border: 2px solid #FFFFFF; box-shadow: 0 2px 6px rgba(0,0,0,.4);
    display: grid; place-items: center; cursor: pointer; padding: 0;
}
.plan-pin > span { rotate: 45deg; color: #FFFFFF; font-size: .68rem; font-weight: 700; }
.plan-pin--low      { --pin: var(--sev-low); }
.plan-pin--medium   { --pin: var(--sev-medium); }
.plan-pin--high     { --pin: var(--sev-high); }
.plan-pin--critical { --pin: var(--sev-critical); }
.plan-pin.is-resolved { opacity: .55; }
.plan-pin.is-active, .plan-pin:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; z-index: 2; }
.plan-pin--draft { --pin: var(--orange); animation: pin-pulse 1.2s ease-in-out infinite; }
@keyframes pin-pulse { 50% { box-shadow: 0 0 0 8px rgba(254,161,4,.25); } }
@media (prefers-reduced-motion: reduce) { .plan-pin--draft { animation: none; } }

/* ---------- Panneau latéral (formulaire réserve) ---------- */
.drawer { position: fixed; inset-block: 0; inset-inline-end: 0; z-index: 150; width: min(440px, 100%); background: var(--surface); border-inline-start: 1px solid var(--border); box-shadow: var(--shadow); overflow-y: auto; }
.drawer__head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; background: var(--surface); border-bottom: 1px solid var(--border); border-top: 3px solid var(--orange); }
.drawer__body { padding: 20px; }
.backdrop { position: fixed; inset: 0; z-index: 140; background: rgba(0,0,0,.55); }

/* ---------- Messagerie client ---------- */
.thread { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 14px; background: var(--bg-alt); border: 1px solid var(--border); font-size: .93rem; }
.msg--mine { align-self: flex-end; background: var(--orange); border-color: var(--orange); color: var(--on-orange); border-end-end-radius: 4px; }
.msg--theirs { align-self: flex-start; border-end-start-radius: 4px; }
.msg__meta { display: block; margin-top: 4px; font-size: .72rem; opacity: .75; }

/* ---------- Divers ---------- */
.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--orange); color: var(--on-orange); font-weight: 700; font-size: .85rem; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.progress { height: 8px; border-radius: 999px; background: var(--bg-alt); border: 1px solid var(--border); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--orange); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); }
.toast { position: fixed; inset-inline: 16px; bottom: calc(var(--bottom-nav-h) + 16px); z-index: 300; max-width: 420px; margin-inline: auto; padding: 12px 16px; border-radius: var(--radius-btn); background: var(--black); color: #F2F2F2; border-inline-start: 4px solid var(--orange); box-shadow: var(--shadow); }
.toast--error { border-inline-start-color: var(--sev-high); }
.divider { height: 1px; background: var(--border); border: 0; margin: 20px 0; }
[x-cloak] { display: none !important; }

@media print {
    .app-header, .bottom-nav, .tabs, .btn, .chips { display: none !important; }
    body { background: #FFFFFF; color: #161616; }
    .card { break-inside: avoid; border-color: #CCCCCC; }
}

/* =====================================================================
   Compléments L3 — menus, Gantt (Frappe Gantt 0.6.1 aux couleurs BTP)
   ===================================================================== */
summary.avatar::-webkit-details-marker { display: none; }
summary.avatar { list-style: none; }
details[open] > summary.avatar { box-shadow: 0 0 0 3px rgba(254,161,4,.35); }
.drawer { color: var(--text); }
button.card { font: inherit; display: block; }

.gantt-host { overflow-x: auto; background: var(--surface); }
.gantt-host svg { max-width: none; }            /* le SVG du Gantt dépasse volontairement : défilement horizontal */
.gantt-host .gantt-container { background: var(--surface); }
.gantt-host .gantt .grid-background { fill: none; }
.gantt-host .gantt .grid-header { fill: var(--bg-alt); stroke: var(--border); }
.gantt-host .gantt .grid-row { fill: var(--surface); }
.gantt-host .gantt .grid-row:nth-child(even) { fill: var(--bg-alt); }
.gantt-host .gantt .row-line, .gantt-host .gantt .tick { stroke: var(--border); }
.gantt-host .gantt .today-highlight { fill: rgba(254,161,4,.14); }
.gantt-host .gantt .lower-text, .gantt-host .gantt .upper-text { fill: var(--muted); font-family: "Poppins", system-ui, sans-serif; font-size: 12px; }
.gantt-host .gantt .upper-text { fill: var(--text); font-weight: 600; }
.gantt-host .gantt .bar { fill: #6B6264; stroke: none; }
.gantt-host .gantt .bar-progress { fill: var(--orange); }
.gantt-host .gantt .bar-label { fill: #FFFFFF; font-family: "Poppins", system-ui, sans-serif; font-size: 12px; font-weight: 600; }
.gantt-host .gantt .bar-label.big { fill: var(--text); }
.gantt-host .gantt .bar-wrapper:hover .bar { fill: #7C7274; }
.gantt-host .gantt .bar-wrapper.active .bar { fill: #7C7274; }
.gantt-host .gantt .is-phase .bar { fill: #3B3536; }
.gantt-host .gantt .is-phase .bar-progress { fill: #C98200; }
.gantt-host .gantt .is-late .bar { stroke: var(--sev-high); stroke-width: 2px; }
.gantt-host .gantt .is-milestone .bar { fill: var(--sev-high); rx: 12; }
.gantt-host .gantt .is-milestone .bar-progress { fill: var(--sev-high); }
.gantt-host .gantt .arrow { stroke: var(--muted); stroke-width: 1.4; }
.gantt-host .gantt .handle { fill: var(--orange); opacity: 0; }
.gantt-host .gantt .bar-wrapper:hover .handle { opacity: .9; }
.gantt-host.is-readonly .handle, .gantt-host.is-readonly .bar-progress + .handle { display: none; }
.gantt-host.is-readonly .bar-wrapper { pointer-events: none; }
.gantt-host .gantt-container .popup-wrapper { background: var(--black); color: #F2F2F2; border-radius: 8px; box-shadow: var(--shadow); }
.gantt-pop { display: grid; gap: 2px; padding: 10px 12px; font-size: .82rem; min-width: 200px; }
.gantt-pop strong { color: var(--orange); }
.gantt-host .gantt .bar-wrapper:hover .bar-progress, .gantt-host .gantt .bar-wrapper.active .bar-progress { fill: var(--orange-hover); }
.gantt-host .gantt .is-phase:hover .bar, .gantt-host .gantt .is-phase.active .bar { fill: #4A4344; }

/* ---------------- Planning à 5 niveaux (v1.1.6) ---------------- */
.select--auto { width: auto; min-width: 12rem; }
.gantt-host .gantt .lvl-1 .bar { fill: #1F1B1C; }
.gantt-host .gantt .lvl-1 .bar-progress { fill: #C98200; }
.gantt-host .gantt .lvl-2 .bar { fill: #3B3536; }
.gantt-host .gantt .lvl-2 .bar-progress { fill: #C98200; }
.gantt-host .gantt .lvl-3 .bar { fill: #5A5254; }
.gantt-host .gantt .lvl-4 .bar { fill: #6B6264; }
.gantt-host .gantt .is-gate .bar { fill: #B4232A; }
.gantt-host .gantt .is-gate .bar-progress { fill: #7F1D1D; }
.tree-row--1 td { background: var(--bg-alt); }
.tree-row--2 td:first-child { box-shadow: inset 3px 0 0 var(--orange); }
.tree-caret { display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; margin-right: .25rem; border: 0; background: transparent; color: var(--text); cursor: pointer; border-radius: 6px; }
.tree-caret:hover, .tree-caret:focus-visible { background: var(--bg-alt); outline: 2px solid var(--orange); outline-offset: 1px; }
.fiche-section { padding: .35rem .6rem; background: var(--bg-alt); border-inline-start: 4px solid var(--orange); border-radius: 6px; }

.seg { display: inline-flex; border: 1px solid var(--border, #cbd5e1); border-radius: 8px; overflow: hidden; }
.seg__b { padding: .3rem .6rem; font-size: .75rem; border: 0; background: transparent; color: var(--text); cursor: pointer; min-height: 32px; }
.seg__b + .seg__b { border-left: 1px solid var(--border, #cbd5e1); }
.seg__b[aria-pressed="true"] { background: var(--orange); color: #111; font-weight: 600; }
.seg__b:focus-visible { outline: 2px solid var(--orange); outline-offset: -2px; }

/* ---- capture.js : caméra et signature (v1.1.15) ---- */
body.cap--open { overflow: hidden; }
.cap__back { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.75); display: flex; align-items: center; justify-content: center; padding: 8px; }
.cap { background: var(--surface, #fff); color: inherit; width: min(720px, 100%); max-height: 100%; overflow: auto; border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.cap__video { width: 100%; max-height: 60vh; background: #000; border-radius: 8px; object-fit: contain; }
.cap__video[hidden], .cap [hidden] { display: none !important; }
.cap__sig { width: 100%; height: auto; aspect-ratio: 3 / 1; border: 2px dashed #888; border-radius: 8px; background: #fff; touch-action: none; cursor: crosshair; }
.cap__bar { display: flex; flex-wrap: wrap; gap: 8px; }
.cap__strip { display: flex; gap: 6px; overflow-x: auto; }
.cap__strip img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid #bbb; }
.cap__msg { margin: 0; color: #B00020; font-size: 13px; min-height: 1px; }
.sigimg { height: 56px; width: auto; background: #fff; border: 1px solid #ccc; border-radius: 6px; padding: 2px; }

/* ---- menu du compte (v1.1.17) ---- */
.acct__btn { border: 0; cursor: pointer; }
.acct { position: absolute; right: 0; margin-top: 8px; width: min(320px, calc(100vw - 24px)); background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.35); padding: 6px; z-index: 120; }
.acct__head { display: flex; align-items: center; gap: 10px; padding: 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.acct__item { color: var(--text); display: flex; align-items: center; gap: 8px; width: 100%; padding: 11px 12px; min-height: 44px; border: 0; background: none; border-radius: 8px; font: inherit; font-weight: 600; text-decoration: none; text-align: left; cursor: pointer; }
.acct__item:hover, .acct__item:focus-visible { background: var(--bg-alt); }
.acct__row { justify-content: space-between; }
.acct__sep { height: 1px; background: var(--border); margin: 4px 0; }
.acct__sub { display: grid; gap: 8px; padding: 4px 12px 10px; }
.acct__ver { margin: 0; padding: 8px 12px; font-size: .8rem; color: var(--muted); }
.acct__out { color: var(--orange-text, var(--orange)); }
.acct__switch { width: 38px; height: 22px; border-radius: 11px; background: var(--border); position: relative; transition: background .15s; flex: none; }
.acct__switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.acct__switch.is-on { background: var(--orange); } .acct__switch.is-on::after { transform: translateX(16px); }
.stat { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface); }
.stat b { display: block; font-size: 1.4rem; }
.badge-st { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--bg-alt); border: 1px solid var(--border); }
.badge-st--paid { background: #1B6E2F; color: #fff; border-color: #1B6E2F; } .badge-st--late { background: #B00020; color: #fff; border-color: #B00020; } .badge-st--sent { background: var(--orange); color: var(--on-orange); border-color: var(--orange); }

/* ---------- v1.1.18 : langues (FR / EN / ES / AR) ---------- */
.langsw { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-alt); }
.langsw a { min-width: 34px; padding: 5px 8px; border-radius: 999px; font-size: .74rem; font-weight: 700; text-align: center; text-decoration: none; color: var(--text); }
.langsw a:hover { background: var(--surface); }
.langsw a.is-on { background: var(--orange); color: var(--on-orange, #231F20); }
.langsw--auth .langsw { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); }
.langsw--auth .langsw a { color: #fff; }
.langsw--auth .langsw a.is-on { color: #231F20; }
.acct__lang { justify-content: space-between; cursor: default; }
.acct__lang:hover { background: none; }

[dir="rtl"] body { font-family: 'Poppins', 'Segoe UI', Tahoma, 'Noto Sans Arabic', Arial, sans-serif; }
[dir="rtl"] .acct { right: auto; left: 0; }
[dir="rtl"] .acct__item { text-align: right; }
[dir="rtl"] .app-header .absolute.right-0 { right: auto; left: 0; }
[dir="rtl"] .app-header .-right-1 { right: auto; left: -4px; }
[dir="rtl"] .seg__b + .seg__b { border-left: 0; border-right: 1px solid var(--border, #cbd5e1); }
[dir="rtl"] .tree-caret { margin-right: 0; margin-left: .25rem; transform: scaleX(-1); }
[dir="rtl"] .input, [dir="rtl"] .select, [dir="rtl"] textarea { text-align: right; }
[dir="rtl"] input[type="email"], [dir="rtl"] input[type="password"], [dir="rtl"] input[type="tel"], [dir="rtl"] input[type="number"], [dir="rtl"] input[type="date"] { direction: ltr; text-align: right; }
[dir="rtl"] .gantt-host, [dir="rtl"] .gantt, [dir="rtl"] .gantt-wrap, [dir="rtl"] .plan-canvas, [dir="rtl"] .planbox { direction: ltr; }
[dir="rtl"] .acct__switch::after { left: auto; right: 3px; }
[dir="rtl"] .acct__switch.is-on::after { transform: translateX(-16px); }
[dir="rtl"] a[href^="tel:"], [dir="rtl"] .ltr-iso { direction: ltr; unicode-bidi: isolate; }

/* v1.1.19 : lignes de facture */
.invline { display: grid; grid-template-columns: minmax(0, 1fr) 80px 120px 44px; gap: 8px; align-items: center; margin-bottom: 8px; }
@media (max-width: 640px) { .invline { grid-template-columns: 1fr 1fr 44px; } .invline > :first-child { grid-column: 1 / -1; } }

/* v1.1.24 — Client du chantier, bien visible dans le bandeau */
.client-tag { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 0; padding: 6px 14px; border: 1px solid #FEA104; border-radius: 999px; background: rgba(254, 161, 4, .14); color: #FFFFFF; font-size: 1rem; line-height: 1.3; }
.client-tag span { color: #FEA104; font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.client-tag strong { font-weight: 700; }
.client-tag em { font-style: normal; color: #E6E6E6; }
.client-tag svg { color: #FEA104; }

/* ---------- CRM (v1.2.0) ---------- */
.crm-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.crm-col { background: var(--surface-2, var(--surface)); border: 1px solid var(--border); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 160px; }
.crm-col__h { display: flex; flex-direction: column; gap: 2px; }
.crm-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px; cursor: grab; }
.crm-card:active { cursor: grabbing; }
.crm-bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; }
.crm-bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.crm-bar__v { display: block; width: 100%; background: var(--orange); border-radius: 4px 4px 0 0; min-height: 2px; }
.crm-bar__l { font-size: .72rem; color: var(--muted, #6b6b6b); margin-top: 4px; }

/* ---------- Personnel & pointage (v1.3.0) ---------- */
.staff-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; border: 1px solid var(--border); background: var(--surface); }
.staff-avatar--ph { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; background: var(--bg-alt); color: var(--text); }
.staff-avatar--lg { width: 72px; height: 72px; }
.ts-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.ts-table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: .85rem; }
.ts-table th, .ts-table td { border-bottom: 1px solid var(--border); padding: 4px 3px; text-align: center; vertical-align: middle; }
.ts-table thead th { background: var(--bg-alt); font-size: .75rem; position: sticky; top: 0; }
.ts-table .ts-name { position: sticky; left: 0; z-index: 2; background: var(--surface); text-align: start; min-width: 190px; padding: 6px 10px; border-inline-end: 1px solid var(--border); }
.ts-table thead .ts-name { background: var(--bg-alt); }
.ts-day { width: 34px; min-width: 34px; } .ts-day small { display: block; font-weight: 400; opacity: .7; }
.ts-sun { background: color-mix(in srgb, var(--border) 45%, transparent); }
.ts-num { min-width: 64px; padding: 4px 6px !important; } .ts-remark { min-width: 170px; }
.ts-in { min-height: 34px; padding: 2px 6px; width: 64px; text-align: center; } .ts-in--w { width: 88px; } .ts-in--r { width: 100%; text-align: start; }
.ts-cell { width: 30px; height: 30px; border-radius: 6px; border: 1.5px solid var(--border); background: transparent; color: var(--text); font: inherit; font-weight: 800; cursor: pointer; padding: 0; }
.ts-cell.is-full { background: var(--orange); border-color: var(--orange); color: var(--on-orange); }
.ts-cell.is-half { background: color-mix(in srgb, var(--orange) 35%, transparent); border-color: var(--orange); }
.ts-cell:disabled { cursor: default; opacity: .75; }
.ts-table tfoot th, .ts-table tfoot td { background: var(--bg-alt); border-bottom: 0; }

/* ---- Appel du jour (pointage, v1.3.0.1) ---- */
.ap { border: 1.5px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface); display: grid; gap: 10px; }
.ap-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ap-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; text-align: center; font-size: 1.05rem; }
.ap-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ap-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ap-row { display: grid; gap: 6px; }
.ap-tap { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--border); background: transparent; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.ap-tap.is-full { border-color: #2e9d57; background: color-mix(in srgb, #2e9d57 18%, transparent); }
.ap-tap.is-half { border-color: var(--orange); background: color-mix(in srgb, var(--orange) 22%, transparent); }
.ap-tap.is-abs { border-color: #d64545; background: color-mix(in srgb, #d64545 16%, transparent); }
.ap-who { display: grid; flex: 1; min-width: 0; } .ap-who small { opacity: .7; }
.ap-state { font-weight: 800; white-space: nowrap; }
.ap-ot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.ap-ot .btn { min-width: 48px; min-height: 40px; }
.ap-ot-val { min-width: 90px; text-align: center; }
.ap-validate { min-height: 52px; font-size: 1.05rem; }
@media (min-width: 900px) { .ap-list { grid-template-columns: repeat(2, 1fr); } }

/* ===== v1.3.1 — Budgets ===== */
.bd-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
@media (min-width: 900px) { .bd-kpis { grid-template-columns: repeat(4, 1fr); } }
.bd-kpi { display: flex; flex-direction: column; gap: .25rem; }
.bd-kpi small { opacity: .75; }
.bd-kpi strong { font-size: 1.15rem; word-break: break-word; }
.bd-neg { color: #dc2626; }
.bd-bar { display: block; height: .55rem; border-radius: 999px; background: rgba(127,127,127,.25); overflow: hidden; }
.bd-bar > i { display: block; height: 100%; border-radius: 999px; background: #16a34a; transition: width .3s; }
.bd-bar.bd-warn > i { background: #eab308; }
.bd-bar.bd-crit > i { background: #f97316; }
.bd-bar.bd-over > i { background: #dc2626; }
.bd-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.bd-line { display: grid; gap: .5rem; padding: .75rem; border: 1px solid rgba(127,127,127,.25); border-radius: .5rem; }
.bd-line-head { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between; align-items: center; }
.bd-line-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; align-items: end; }
@media (min-width: 900px) { .bd-line-grid { grid-template-columns: 1.4fr 1fr 1fr .6fr auto; } }
.bd-field { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.bd-field small { opacity: .75; }
.bd-b-warn { background: #fef3c7; color: #92400e; }
.bd-b-crit { background: #ffedd5; color: #9a3412; }
.bd-b-over { background: #fee2e2; color: #991b1b; }
.bd-row { display: grid; grid-template-columns: 1fr auto; gap: .15rem .75rem; align-items: center; }
.bd-row .bd-bar { grid-column: 1 / -1; height: .4rem; }
