/* ui/pro/pro.css — Appli pro : lisible au bureau, utilisable sur téléphone. Jetons : chat.css */

body.pro {
    overflow: auto;
    min-height: 100%;
    font-size: 15px;
    line-height: 1.55;
    --text-dim: #c3d0df;
    --muted: #8a9bb0;
    --line: rgba(140, 190, 255, .12);
    --line-2: rgba(140, 200, 255, .2);
    --card: rgba(13, 21, 36, .88);
}

.pro .adm-card {
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
    min-width: 0;
}

.pro .adm-card-title,
.pro .adm-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.pro .adm-card-title {
    font-weight: 600;
    font-size: 16px;
}

.pro .adm-label,
.pro-meta {
    font-size: 13px;
    color: var(--muted);
}

.pro .adm-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 34px;
    padding: 4px 10px;
    border: 1px solid var(--line-2);
    border-radius: 6px;
    background: var(--card);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.pro .adm-btn.primary {
    color: var(--accent);
    border-color: var(--accent);
}

.pro .adm-btn:disabled {
    opacity: .5;
    cursor: default;
}

.pro .adm-input {
    min-width: 0;
    height: 34px;
    padding: 4px 8px;
    border: 1px solid var(--line-2);
    border-radius: 6px;
    background: var(--surface-solid);
    color: var(--text);
    font: inherit;
    font-size: 13px;
}

.pro-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.pro-kpi {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--card);
}

.pro-kpi-label {
    display: block;
    font-size: 12px;
    color: var(--muted);
}

.pro-kpi-value {
    display: block;
    font-size: 24px;
    font-weight: 600;
    color: var(--text);
}

.pro-kpi-value.small {
    font-size: 14px;
}

.pro-auto-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 350px), 1fr));
    gap: 14px;
}

.pro-auto {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--card);
}

.pro-auto-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.pro-auto-title {
    font-size: 14px;
    font-weight: 600;
}

.pro-auto-desc {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-dim);
}

.pro-auto-meta {
    margin-top: 3px;
    font-size: 12px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.pro-auto-missing,
.pro-meta.err {
    color: #ff9aa5;
}

.pro .status-pill {
    padding: 2px 6px;
    border: 1px solid currentColor;
    border-radius: 6px;
    font-size: 11px;
}

.pro .status-pill.ok,
.pro-chip.ok,
.pro-meta.ok {
    color: var(--ok);
}

.pro .status-pill.warn,
.pro-chip.warn {
    color: var(--warn);
}

.pro .status-pill.err,
.pro-chip.err {
    color: #ff9aa5;
}

.pro .status-pill.neutral,
.pro-chip.dim {
    color: var(--muted);
}

.pro .toggle-switch {
    position: relative;
    flex-shrink: 0;
    cursor: pointer;
}

.pro .toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
}

.pro .toggle-slider {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 20px;
    background: var(--line-2);
    border: 1px solid var(--line-2);
}

.pro .toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-dim);
}

.pro .toggle-switch input:checked+.toggle-slider {
    background: rgba(var(--accent-rgb), .3);
    border-color: var(--accent);
}

.pro .toggle-switch input:checked+.toggle-slider::after {
    left: 23px;
    background: var(--accent);
}

.pro .toggle-switch input:focus-visible+.toggle-slider {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.pro-history {
    display: flex;
    gap: 5px;
    margin-top: 10px;
}

.pro-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--muted);
}

.pro-dot.ok {
    background: var(--ok);
}

.pro-dot.warn {
    background: var(--warn);
}

.pro-dot.error {
    background: var(--err);
}

.pro-dot.running {
    background: var(--accent);
    animation: pro-pulse 1s ease-in-out infinite alternate;
}

.pro-dot.skipped,
.pro-dot.none {
    background: transparent;
    border: 1px solid var(--line-2);
}

@keyframes pro-pulse {
    to {
        opacity: .35;
    }
}

.pro-auto-group+.pro-auto-group {
    margin-top: 18px;
}

.pro-auto-group-title {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
}

.pro-sched {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 10px 0 6px;
}

.pro-sched-text {
    font-size: 13px;
    font-weight: 600;
}

.pro-sched-edit {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 8px;
    padding: 8px;
    border: 1px dashed var(--line-2);
    border-radius: 6px;
    font-size: 13px;
}

.pro-sched-edit .adm-input {
    width: auto;
}

.pro-sched-edit .pro-f-seconds {
    max-width: 80px;
}

.pro-sched-edit .pro-f {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.pro-sched-edit[data-mode="seconds"] .pro-f[data-for="seconds"],
.pro-sched-edit[data-mode="hours"] .pro-f[data-for="hours"],
.pro-sched-edit[data-mode="daily"] .pro-f[data-for="daily"],
.pro-sched-edit[data-mode="cron"] .pro-f[data-for="cron"] {
    display: inline-flex;
}

.pro-steps {
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.pro-step {
    display: grid;
    grid-template-columns: 10px minmax(0, 11em) minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-top: 1px solid var(--line);
    font-size: 12px;
}

.pro-step-label {
    font-weight: 600;
}

.pro-step-detail {
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pro-step-run {
    padding: 0 6px;
    border: 1px solid var(--line-2);
    border-radius: 4px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
}

.pro-step-run:disabled {
    opacity: .4;
    cursor: default;
}

.pro-chip.info {
    color: var(--accent);
}

.pro-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.pro-table th,
.pro-table td {
    padding: 9px 10px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.pro-table th {
    color: var(--muted);
}

.pro-chip {
    display: inline-block;
    padding: 1px 6px;
    margin: 2px;
    border: 1px solid var(--line-2);
    border-radius: 6px;
    font-size: 12px;
}

.pro-link {
    color: var(--accent);
    text-decoration: none;
}

.pro-pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.pro-alert {
    margin-bottom: 12px;
    color: var(--warn);
}

.pro-log-result {
    min-width: 200px;
    max-width: 480px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

#pro-interventions,
#pro-audit,
#pro-gmail-rules {
    overflow-x: auto;
}

.pro .tabs {
    max-width: 100%;
    overflow-x: auto;
}

@media (max-width: 600px) {
    .pro .adm-input {
        flex: 1 1 140px;
        max-width: 100% !important;
    }

    .pro-top {
        flex-wrap: wrap;
    }

    .pro-top-actions {
        flex-wrap: wrap;
    }
}

.pro-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

/* ── En-tête ── */
.pro-top {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 8px 16px;
    padding-top: calc(8px + env(safe-area-inset-top));
    background: rgba(4, 7, 13, .9);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-bottom: 1px solid var(--line);
}

.pro-top h1 {
    margin: 0;
    font: 600 19px var(--font-body);
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pro-top .spacer {
    flex: 1;
}

.pro-top-actions {
    display: flex;
    gap: 8px;
}

/* Centre de notifications : tiroir bureau, plein ecran tactile sur mobile. */
.notifications-bell {
    position: relative;
    flex: 0 0 44px;
    width: 44px;
    min-height: 44px;
}

.notifications-count,
.notifications-unavailable {
    position: absolute;
    top: 0;
    right: -3px;
    min-width: 20px;
    padding: 0 4px;
    border: 2px solid var(--bg-2);
    border-radius: 12px;
    background: var(--accent);
    color: #05080f;
    font: 700 11px/18px var(--font-body);
    text-align: center;
}

.notifications-unavailable {
    background: #ff9aa5;
    right: auto;
    left: -3px;
}

.notifications-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(0, 0, 0, .65);
}

.notifications-overlay[hidden],
.notifications-panel [hidden],
.notifications-bell [hidden] {
    display: none;
}

.notifications-panel {
    position: absolute;
    inset: 0 0 0 auto;
    display: flex;
    flex-direction: column;
    width: min(480px, 100%);
    height: 100%;
    height: 100dvh;
    background: var(--bg-2);
    border-left: 1px solid var(--line-2);
    box-shadow: var(--shadow);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: env(safe-area-inset-bottom);
}

.notifications-head {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(16px + env(safe-area-inset-top)) 16px 12px;
    border-bottom: 1px solid var(--line);
    background: var(--bg-2);
    flex-shrink: 0;
}

.notifications-head h2 { margin: 0; font-size: 21px; }
.notifications-head p { margin: 4px 0 0; font-size: 13px; }
.notifications-head .icon-btn { min-width: 44px; min-height: 44px; }
.notifications-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; }
.notifications-tools select {
    max-width: 100%;
    min-height: 44px;
    background: var(--card);
    border: 1px solid var(--line-2);
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    padding: 4px 8px;
}
.notifications-filter { display: flex; align-items: center; gap: 6px; min-height: 44px; }
.notifications-filter input { width: 20px; height: 20px; accent-color: var(--accent); }
.notifications-tools .btn { min-height: 44px; }
.notifications-refresh, .notifications-more { margin: 8px 16px; min-height: 44px; flex-shrink: 0; }
.notifications-list { padding: 0 12px; }
.notification-item { display: flex; gap: 12px; margin-bottom: 8px; padding: 14px 12px; border: 1px solid var(--line); border-radius: 12px; }
.notification-item.is-unread { border-color: var(--line-2); background: rgba(var(--accent-rgb), .07); }
.notification-icon { flex: 0 0 28px; color: var(--accent); }
.notification-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.notification-content { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.notification-content h3 { margin: 4px 0; font-size: 15px; }
.notification-content p { margin: 4px 0; white-space: pre-line; color: var(--text-dim); font-size: 13px; }
.notification-meta { color: var(--muted); font-size: 12px; }
.notification-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.notification-actions a, .notification-actions button {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 4px 8px;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    background: transparent;
    color: var(--accent);
    text-decoration: none;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}
.notifications-empty { padding: 24px 12px; text-align: center; }
.notifications-status { margin-top: auto; padding: 16px; font-size: 12px; overflow-wrap: anywhere; }
.notifications-panel :focus-visible, .notifications-bell:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pro .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 600px) {
    .pro-top h1 { flex: 1; min-width: 0; }
    .pro-top .spacer { display: none; }
    .notifications-bell { order: 1; margin-left: auto; }
    .pro-top-actions { order: 2; width: 100%; }
    .pro-top-actions:empty { display: none; }
    .notifications-panel { width: 100%; border-left: 0; }
}

/* ── Navigation : barre basse (mobile), latérale (bureau) ── */
.pro-nav {
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: rgba(4, 7, 13, .96);
    border-top: 1px solid var(--line-2);
}

.pro-nav .brand {
    display: none;
}

.pro-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 2px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font: 500 11px var(--font-body);
    text-decoration: none;
}

.pro-nav a svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pro-nav a.active {
    color: var(--accent);
    background: rgba(var(--accent-rgb), .1);
}

.pro-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px;
}

@media (min-width: 960px) {
    .pro-shell {
        padding-bottom: 0;
        padding-left: 220px;
    }

    .pro-nav {
        top: 0;
        right: auto;
        width: 220px;
        flex-direction: column;
        gap: 2px;
        padding: 14px 12px;
        border-top: none;
        border-right: 1px solid var(--line-2);
    }

    .pro-nav .brand {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 6px 10px 18px;
        color: #fff;
        font: 700 16px var(--font-display);
        letter-spacing: .08em;
        text-decoration: none;
    }

    .pro-nav a:not(.brand) {
        flex: none;
        flex-direction: row;
        gap: 12px;
        padding: 10px 12px;
        font-size: 15px;
    }

    .pro-main {
        padding: 24px 28px;
    }
}

/* ── Cartes ── */
.card {
    margin-bottom: 16px;
    padding: 18px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--card);
}

.card h2 {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
    font: 600 16px var(--font-body);
    color: #fff;
}

.card h2 .actions {
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.grid-2 {
    display: grid;
    gap: 16px;
}

@media (min-width: 1100px) {
    .grid-2 {
        grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
        align-items: start;
    }
}

.muted {
    color: var(--muted);
    font-size: 14px;
}

.err-text {
    color: #ff9aa5;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.toolbar .grow {
    flex: 1;
    min-width: 200px;
}

.chantier-map-layout {
    display: grid;
    grid-template-columns: minmax(250px, 340px) minmax(0, 1fr);
    height: calc(100dvh - 150px);
    min-height: 420px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
}

.chantier-map-sidebar {
    min-width: 0;
    overflow-y: auto;
    border-right: 1px solid var(--line);
}

.chantier-map-tools {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 12px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-solid);
}

.chantier-map-list {
    padding: 4px 12px;
}

.chantier-map-item-wrap {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.chantier-map-item {
    display: block;
    width: 100%;
    padding: 12px 4px;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.chantier-map-item:disabled {
    opacity: .55;
    cursor: default;
}

.chantier-map-item strong,
.chantier-map-item span {
    display: block;
}

.chantier-map-item span {
    color: var(--text-dim);
    font-size: 13px;
}

.chantier-map-directions {
    display: inline-block;
    margin: 0 4px 4px;
    color: var(--accent);
    font-size: 12px;
}

.chantier-map-canvas {
    min-width: 0;
    min-height: 0;
    background: #dbe5e8;
}

.chantier-map-pin {
    display: block;
    width: 18px;
    height: 18px;
    border: 3px solid #fff;
    border-radius: 50% 50% 50% 0;
    background: var(--pin-color);
    box-shadow: 0 1px 5px #0008;
    transform: rotate(-45deg);
}

.leaflet-popup-content {
    min-width: 170px;
}

.leaflet-popup-content a {
    display: inline-block;
    margin: 6px 8px 0 0;
}

@media (max-width: 700px) {
    .chantier-map-layout {
        display: flex;
        flex-direction: column;
        height: calc(100dvh - 170px);
        min-height: 360px;
    }

    .chantier-map-sidebar {
        flex: 0 0 36%;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .chantier-map-canvas {
        flex: 1;
    }
}

/* ── Indicateurs ── */
.kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

@media (min-width: 760px) {
    .kpis {
        grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    }
}

.kpi {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--card);
}

a.kpi {
    display: block;
    color: inherit;
    text-decoration: none;
}

button.kpi {
    width: 100%;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}

a.kpi:hover,
button.kpi:hover,
button.kpi.active {
    border-color: var(--accent);
}

a.kpi:focus-visible,
button.kpi:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.kpi span {
    display: block;
    font-size: 13px;
    color: var(--muted);
}

.kpi b {
    display: block;
    margin-top: 2px;
    font: 600 22px var(--font-body);
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.kpi b.small {
    font-size: 15px;
    font-weight: 500;
}

.kpi.good b {
    color: var(--ok);
}

.kpi.bad b {
    color: #ff9aa5;
}

.profit-statement {
    margin: 8px 0 20px;
}

.profit-heading {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.profit-heading h2 {
    margin: 0;
    font: 600 16px var(--font-body);
    color: #fff;
}

.profit-heading .actions,
.profit-heading>.muted {
    margin-left: auto;
}

.profit-ledger {
    margin: 0;
    border-top: 1px solid var(--line);
}

.profit-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    min-height: 54px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.profit-row dt {
    min-width: 0;
    color: var(--text);
    overflow-wrap: anywhere;
}

.profit-row dt small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--muted);
}

.profit-row dd {
    margin: 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.profit-row--revenue {
    background: rgba(255, 255, 255, .035);
}

.profit-row--revenue dd,
.profit-row--net dd {
    font-size: 24px;
}

.profit-row--deduction dd {
    color: var(--muted);
}

.profit-row--total {
    border-top: 1px solid var(--line);
    font-weight: 600;
}

.profit-row--net {
    margin-top: 12px;
    border-top: 2px solid var(--line);
    background: rgba(255, 255, 255, .035);
}

.profit-row--net dt {
    font-weight: 600;
}

.profit-row--net.pos dd {
    color: var(--ok);
}

.profit-row--net.neg dd {
    color: #ff9aa5;
}

.profit-row--daily {
    border-bottom: 0;
}

.profit-proof {
    margin: 0 0 24px;
    color: var(--muted);
}

.profit-proof summary {
    cursor: pointer;
    font-size: 13px;
}

.profit-proof .facts {
    margin: 16px 0;
}

.profit-details {
    display: grid;
    gap: 24px;
}

.profit-section {
    min-width: 0;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.liste-module {
    padding: 20px 0;
    margin-top: 20px;
    border-top: 1px solid var(--line-2);
    min-width: 0;
}

.liste-module h2 {
    margin: 0 0 14px;
    font-size: 17px;
    font-weight: 600;
}

.liste-search-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-dim);
}

.liste-search-results {
    max-height: 260px;
    overflow-y: auto;
    margin: 8px 0;
}

.liste-search-result {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    overflow-wrap: anywhere;
}

.liste-search-result span {
    font-size: 13px;
    color: var(--muted);
}

.liste-search-result:hover,
.liste-search-result:focus-visible {
    background: rgba(var(--accent-rgb), .1);
}

.liste-entry-fields {
    margin-top: 12px;
    max-width: 600px;
}

.liste-items-table {
    min-width: 660px;
}

.liste-items-table td:first-child {
    min-width: 260px;
}

.liste-items-table td:nth-child(2) {
    width: 110px;
}

.liste-items-table td:nth-child(3) {
    width: 120px;
}

.liste-items-table td .muted {
    margin-top: 4px;
    font-size: 12px;
}

.liste-row-actions {
    display: flex;
    gap: 6px;
}

.liste-module [hidden] {
    display: none;
}

@media (max-width: 700px) {
    .liste-items-table {
        min-width: 0;
    }

    .liste-items-table thead {
        display: none;
    }

    .liste-items-table tbody {
        display: block;
    }

    .liste-items-table tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        padding: 12px 0;
        border-bottom: 1px solid var(--line);
    }

    .liste-items-table td {
        padding: 6px 4px;
        border: 0;
        min-width: 0;
    }

    .liste-items-table td:first-child,
    .liste-items-table td:last-child {
        grid-column: 1 / -1;
        min-width: 0;
    }

    .liste-items-table td:nth-child(2),
    .liste-items-table td:nth-child(3) {
        width: auto;
    }

    .liste-items-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 4px;
        font-size: 12px;
        color: var(--muted);
    }

    .liste-items-table td .muted {
        overflow-wrap: anywhere;
    }
}

@media (min-width: 1100px) {
    .profit-details {
        grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
        align-items: start;
    }
}

/* ── Champs ── */
.input,
select.input,
textarea.input {
    width: 100%;
    min-height: 42px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-2);
    background: rgba(0, 0, 0, .3);
    color: #fff;
    font: 400 15px var(--font-body);
}

.input:focus {
    outline: none;
    border-color: rgba(var(--accent-rgb), .6);
    box-shadow: var(--ring);
}

.input[readonly] {
    border-style: dashed;
    color: var(--text-dim);
}

select.input option {
    background: var(--surface-solid);
}

#photo-appareils[hidden] {
    display: none;
}

.form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px 14px;
}

@media (min-width: 640px) {
    .form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form .full {
        grid-column: 1 / -1;
    }
}

@media (min-width: 1100px) {
    .form.cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .form.cols-4 .span-2 {
        grid-column: span 2;
    }
}

.form label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
}

.chantier-notes [hidden] {
    display: none !important;
}

.chantier-notes section+section {
    margin-top: 24px;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.btn {
    height: 40px;
    font-size: .92rem;
    text-decoration: none;
}

.btn-danger {
    border-color: rgba(255, 93, 108, .5);
    color: #ffb3bb;
}

.btn-sm {
    height: 34px;
    padding: 0 12px;
    font-size: .85rem;
}

/* ── Fiche client (lecture seule) ── */
.facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 16px;
    margin: 0;
}

.facts dt {
    color: var(--muted);
    font-size: 14px;
}

.facts dd {
    margin: 0;
    color: #fff;
    word-break: break-word;
}

.facts a {
    color: var(--accent);
    text-decoration: none;
}

.facts+.muted {
    margin: 14px 0 0;
}

/* ── Listes et tableaux ── */
.month {
    margin: 18px 4px 8px;
    font: 700 13px var(--font-hud);
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent);
}

.item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--card);
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.item:hover {
    border-color: rgba(var(--accent-rgb), .45);
}

.entreprise-vehicules .item {
    margin: 0;
    padding: 12px 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: none;
}

.entreprise-vehicules .item:last-child {
    border-bottom: 0;
}

.item .date {
    min-width: 54px;
    text-align: center;
    font: 700 13px var(--font-hud);
    line-height: 1.15;
    color: var(--text-dim);
}

.item .date b {
    display: block;
    font: 700 22px var(--font-display);
    color: #fff;
}

.item .body {
    flex: 1;
    min-width: 0;
}

.item .title {
    font-weight: 600;
    font-size: 16px;
    color: #fff;
}

.item .sub {
    margin-top: 2px;
    font-size: 14px;
    color: var(--text-dim);
}

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.table th {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line-2);
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-align: left;
    white-space: nowrap;
}

.table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.table tbody tr.link {
    cursor: pointer;
}

.table tbody tr.link:hover td {
    background: rgba(var(--accent-rgb), .06);
}

.table tr.group td {
    padding-top: 18px;
    font-weight: 600;
    color: var(--accent);
    text-transform: capitalize;
    border-bottom-color: var(--line-2);
}

.table td.num,
.table th.num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.table tr.total td {
    font-weight: 700;
    border-top: 1px solid var(--line-2);
}

.only-desktop {
    display: none;
}

@media (min-width: 960px) {
    .only-desktop {
        display: block;
    }

    .only-mobile {
        display: none;
    }
}

.chip {
    display: inline-block;
    padding: 2px 10px;
    margin: 2px 4px 2px 0;
    border-radius: 999px;
    border: 1px solid var(--line-2);
    font-size: 13px;
    white-space: nowrap;
    color: var(--text);
    text-decoration: none;
}

.chip.ok {
    border-color: rgba(62, 224, 143, .5);
    color: var(--ok);
}

.chip.warn {
    border-color: rgba(255, 181, 71, .5);
    color: var(--warn);
}

.chip.err {
    border-color: rgba(255, 93, 108, .5);
    color: #ffb3bb;
}

.chip.info {
    border-color: rgba(var(--accent-rgb), .5);
    color: var(--accent);
}

.chip.dim {
    opacity: .6;
}

.schmidt-contact-status {
    display: inline-flex;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-size: 12px;
    line-height: 1;
}

.schmidt-contact-status.linked {
    color: var(--ok);
}

.schmidt-contact-status.name-match {
    color: var(--warn);
}

.schmidt-contact-status.missing,
.schmidt-contact-status.pending {
    color: var(--muted);
}

.schmidt-contact-status.ambiguous,
.schmidt-contact-status.unavailable {
    color: var(--warn);
}

.schmidt-contact-status a {
    display: flex;
    color: inherit;
}

.schmidt-contact-status svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

button.chip {
    background: transparent;
    cursor: pointer;
    font-family: inherit;
}

button.chip.active {
    background: rgba(var(--accent-rgb), .18);
    border-color: rgba(var(--accent-rgb), .6);
    color: #fff;
}

.pos {
    color: var(--ok);
}

.neg {
    color: #ff9aa5;
}

/* ── Page chantier : en-tête + onglets ── */
.ch-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-bottom: 14px;
}

.ch-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
}

/* Vue 3D de la cuisine (plans Drive) en bannière. */
.ch-head.has-banner {
    position: relative;
    align-items: flex-end;
    min-height: 240px;
    padding: 18px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(4, 7, 13, 0) 35%, rgba(4, 7, 13, .9) 100%),
        var(--banner) center 55% / cover no-repeat;
    animation: ch-banner-in .4s ease-out;
}

.ch-head.has-banner .meta {
    color: rgba(255, 255, 255, .85);
}

.ch-head.has-banner h2 {
    text-shadow: 0 2px 12px rgba(0, 0, 0, .6);
}

.ch-head.has-banner .quick .btn {
    background: rgba(4, 7, 13, .7);
    backdrop-filter: blur(6px);
}

@media (min-width: 960px) {
    .ch-head.has-banner {
        min-height: 300px;
    }
}

@keyframes ch-banner-in {
    from {
        opacity: .4;
    }
}

.ch-billing {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.ch-billing h3 {
    margin: 0 0 8px;
    font: 600 14px var(--font-body);
    color: var(--text-dim);
}

.ch-billing .form-actions {
    margin-top: 12px;
}

.btn-xs {
    height: 26px;
    margin-left: 8px;
    padding: 0 8px;
    font-size: .78rem;
}

.pre {
    white-space: pre-wrap;
}

.ch-head h2 {
    margin: 0;
    font: 600 24px var(--font-body);
    color: #fff;
}

.ch-head .meta {
    color: var(--text-dim);
}

.ch-head .quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-left: auto;
}

.tabs {
    position: sticky;
    top: 58px;
    z-index: 10;
    display: flex;
    gap: 4px;
    margin: 0 -16px 16px;
    padding: 8px 16px;
    overflow-x: auto;
    background: rgba(4, 7, 13, .92);
    border-bottom: 1px solid var(--line);
}

@media (min-width: 960px) {
    .tabs {
        margin: 0 -28px 20px;
        padding: 8px 28px;
    }
}

.tabs a {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.tabs a:hover {
    color: #fff;
    background: var(--surface-2);
}

.tabs a.active {
    color: #fff;
    background: rgba(var(--accent-rgb), .18);
    box-shadow: inset 0 -2px 0 var(--accent);
}

.tabs a .count {
    margin-left: 6px;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 959px) {
    .pro .chantier-tabs {
        position: static;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        margin: 0 0 16px;
        padding: 0;
        overflow: visible;
        background: transparent;
        border: 0;
    }

    .chantier-tabs a {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
        min-height: 44px;
        padding: 6px 3px;
        border: 1px solid var(--line);
        background: var(--card);
        font-size: 12px;
        text-align: center;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

@media (max-width: 700px) {
    .ch-title,
    .ch-head .quick,
    #ch-tab,
    #ch-tab .grid-2 > *,
    #ch-tab .form label {
        min-width: 0;
    }

    .ch-title h2,
    .ch-title .meta,
    #ch-tab .pre {
        overflow-wrap: anywhere;
    }

    #ch-tab .facts {
        grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    }

    #ch-tab .facts dt,
    #ch-tab .facts dd {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .interventions-table thead {
        display: none;
    }

    .interventions-table,
    .interventions-table tbody,
    .interventions-table tr,
    .interventions-table td {
        display: block;
        width: 100%;
    }

    .interventions-table tr:not(.group) {
        padding: 10px 0;
        border-bottom: 1px solid var(--line);
    }

    .interventions-table td {
        padding: 4px 0;
        border: 0;
        overflow-wrap: anywhere;
    }

    .interventions-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        color: var(--muted);
        font-size: 12px;
    }

    .interventions-table td.intervention-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding-top: 10px;
        text-align: left;
        white-space: normal;
    }
}

/* ── Documents ── */
.doc-folder {
    margin: 18px 0 10px;
    font-weight: 600;
    color: var(--text-dim);
}

.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.doc {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--card);
    color: inherit;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.doc:hover {
    border-color: rgba(var(--accent-rgb), .45);
}

.doc-preview {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 8px;
    background: var(--surface-3);
}

.doc-preview img {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}

.doc.has-preview .doc-preview img {
    display: block;
}

.doc.has-preview .doc-preview .ico {
    display: none;
}

.doc .ico {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--surface-3);
}

.doc .ico.pdf {
    background: #b4232a;
}

.doc .ico.img {
    background: #2d7d46;
}

.doc .ico.gdoc {
    background: #1f5fbf;
}

.doc .name {
    font-size: 14px;
    color: #fff;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.doc .when {
    font-size: 12px;
    color: var(--muted);
}

@media (max-width: 600px) {
    .doc-grid {
        grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    }

    .doc {
        padding: 10px;
    }
}

/* ── Photos ── */
.photo-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
}

.photo {
    aspect-ratio: 1;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    overflow: hidden;
    cursor: pointer;
}

.photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Visionneuse ── */
.viewer {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
    flex-direction: column;
    background: rgba(2, 4, 8, .96);
}

.viewer.open {
    display: flex;
}

.viewer-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top));
    border-bottom: 1px solid var(--line-2);
}

.viewer-bar .name {
    flex: 1;
    min-width: 0;
    color: #fff;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.viewer-body {
    flex: 1;
    display: grid;
    place-items: center;
    min-height: 0;
    padding: 10px;
}

.viewer-body iframe {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 6px;
    background: #fff;
}

.viewer-body img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.viewer-body .pdf-pages {
    width: 100%;
    height: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.viewer-body .pdf-pages canvas {
    width: 100%;
    max-width: 1400px;
    height: auto;
    background: #fff;
    border-radius: 4px;
}

.viewer-body {
    position: relative;
}

.viewer-body .pdf-download {
    position: absolute;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
}

/* ── Fiche latérale (formulaires véhicule / fournisseur) ── */
.sheet {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    background: rgba(0, 0, 0, .6);
}

.sheet.open {
    display: block;
}

.sheet-panel {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    padding: 0 16px calc(24px + env(safe-area-inset-bottom));
    background: var(--bg-2);
}

@media (min-width: 960px) {
    .sheet-panel {
        left: auto;
        width: min(720px, 100%);
        border-left: 1px solid var(--line-2);
        box-shadow: var(--shadow);
    }
}

.sheet-head {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 -16px 16px;
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top));
    background: rgba(8, 16, 28, .97);
    border-bottom: 1px solid var(--line);
}

.sheet-head h2 {
    flex: 1;
    margin: 0;
    font: 600 18px var(--font-body);
    color: #fff;
}

.split {
    display: grid;
    gap: 16px;
}

@media (min-width: 960px) {
    .split {
        grid-template-columns: 300px minmax(0, 1fr);
        align-items: start;
    }
}

.list-select .item.active {
    border-color: rgba(var(--accent-rgb), .6);
    background: rgba(var(--accent-rgb), .1);
}

details.purchase summary {
    cursor: pointer;
    list-style: none;
}

details.purchase summary::-webkit-details-marker {
    display: none;
}

#toast {
    position: fixed;
    z-index: 100;
    left: 50%;
    bottom: calc(90px + env(safe-area-inset-bottom));
    transform: translateX(-50%) translateY(20px);
    max-width: 90vw;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(var(--accent-rgb), .45);
    background: var(--surface-solid);
    color: #fff;
    font-size: 15px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
}

#toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

#toast.err {
    border-color: rgba(255, 93, 108, .6);
    color: #ffc2c8;
}

@media (min-width: 960px) {
    #toast {
        bottom: 24px;
    }
}
/* Contrôle du bon de commande poseur */
.bdc-line {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.bdc-line:first-child {
    border-top: 0;
}

.bdc-line.done .bdc-label b {
    color: var(--ok);
}

.bdc-line.diff {
    background: rgba(255, 181, 71, .05);
}

.bdc-check input {
    width: 22px;
    height: 22px;
}

.bdc-label .muted {
    font-size: 13px;
}

.bdc-qty {
    display: flex;
    gap: 4px;
    align-items: center;
}

.bdc-qty .input {
    width: 72px;
    text-align: center;
}

@media (max-width: 560px) {
    .bdc-line {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .bdc-qty {
        grid-column: 2;
    }
}
