/**
 * Nafix — Design system v3
 * Référence : https://aedify-solutions.com (site vitrine Aedify)
 * Angles droits, grille, labels orange, cartes « lot », phases chantier.
 */

:root {
    --ae-radius: 0;
    --ae-grid: 32px;
    /* Bleu unique — aligné sur le bandeau haut (#0f2439) */
    --navy: #0f2439;
    --navy-dark: #0f2439;
    --navy-2: #0f2439;
    --dark: #0f2439;
    --dark-2: #0f2439;
    --bg-ice: #f0f4f8;
    --ae-border-dark: #0f2439;
    --ae-page-gap: 12px;
    --ae-shadow-offset: 6px;
    --ae-pill-radius: 999px;
    --ae-cell-qte: #1a8f4a;
    --ae-cell-prix: #2e8fff;
    --ae-grid-h: linear-gradient(rgba(15, 36, 57, 0.12) 1px, transparent 1px);
    --ae-grid-v: linear-gradient(90deg, rgba(15, 36, 57, 0.12) 1px, transparent 1px);
    /* Compat : les deux axes (éviter var() multi-couches dans background-image) */
    --ae-grid-light: var(--ae-grid-h), var(--ae-grid-v);
    /* Titre : fondu gauche → droite (blanc dès le bord gauche, très progressif) */
    --ae-grid-fade-h: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.02) 6%,
        rgba(255, 255, 255, 0.06) 12%,
        rgba(255, 255, 255, 0.12) 20%,
        rgba(255, 255, 255, 0.2) 28%,
        rgba(255, 255, 255, 0.3) 36%,
        rgba(255, 255, 255, 0.42) 44%,
        rgba(255, 255, 255, 0.54) 52%,
        rgba(255, 255, 255, 0.66) 62%,
        rgba(255, 255, 255, 0.78) 72%,
        rgba(255, 255, 255, 0.88) 82%,
        rgba(255, 255, 255, 0.95) 92%,
        #ffffff 100%
    );
    /* Corps : fondu haut → bas — blanc en haut, grille visible en bas (essai inversé) */
    --ae-grid-fade-v: linear-gradient(
        180deg,
        #ffffff 0%,
        rgba(255, 255, 255, 0.95) 10%,
        rgba(255, 255, 255, 0.88) 20%,
        rgba(255, 255, 255, 0.78) 30%,
        rgba(255, 255, 255, 0.66) 40%,
        rgba(255, 255, 255, 0.54) 50%,
        rgba(255, 255, 255, 0.42) 58%,
        rgba(255, 255, 255, 0.3) 66%,
        rgba(255, 255, 255, 0.2) 74%,
        rgba(255, 255, 255, 0.12) 82%,
        rgba(255, 255, 255, 0.06) 90%,
        rgba(255, 255, 255, 0.02) 95%,
        rgba(255, 255, 255, 0) 100%
    );
    --ae-grid-fade-head: var(--ae-grid-fade-h);
    --ae-grid-fade-title-h: var(--ae-grid-fade-h);
    --ae-grid-dark:
        linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
}

/* ─── Fond page uni (grille réservée aux en-têtes) ─── */
body.app-shell:not(.auth-page):not(.export-layout) {
    background-color: var(--bg);
    background-image: none;
}

/* En-têtes de section : quadrillage H+V → fondu blanc horizontal */
.panel-header,
.ae-card-head,
.detail-section > summary {
    background-color: #fff;
    background-image: var(--ae-grid-fade-h), var(--ae-grid-h), var(--ae-grid-v);
    background-size: 100% 100%, var(--ae-grid) var(--ae-grid), var(--ae-grid) var(--ae-grid);
}

/* ─── Typographie site ─── */
.ae-kicker {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--orange);
}

.upload-screen-head .ae-kicker {
    font-size: 16px;
}

.ae-title {
    margin: 0;
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    font-weight: 600;
    color: var(--navy);
    line-height: 1.15;
}

.ae-kicker::before {
    content: '— ';
    color: var(--orange);
}

.ae-lead {
    margin: 12px 0 0;
    font-size: 15px;
    line-height: 1.6;
    color: var(--muted);
    max-width: 54ch;
}

.ae-sec-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.ae-sec-bar {
    flex-shrink: 0;
    width: 28px;
    height: 2px;
    background: var(--orange);
}

.ae-sec-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--orange);
}

.ae-dash-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--ink);
}

.ae-dash-list li {
    padding: 5px 0 5px 16px;
    position: relative;
    border-bottom: 1px solid var(--line);
}

.ae-dash-list li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--orange);
    font-weight: 600;
}

/* ─── Bandeau haut sombre ─── */
.topbar {
    height: 56px;
    padding: 0 28px;
    background: var(--navy-dark);
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: none;
}

.topbar::after {
    display: none;
}

.brand-logo {
    height: 28px;
    filter: brightness(0) invert(1);
}

.topbar .brand {
    align-items: center;
    gap: 12px;
}

.topbar .brand-txt {
    display: flex;
    align-items: center;
}

.brand h1 {
    color: #fff;
    font-size: 18px;
    letter-spacing: 0.08em;
    line-height: 1;
    margin: 0;
}

.brand-kicker,
.topbar .brand p {
    color: var(--orange-soft);
    font-family: var(--font-display);
    font-size: 9px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.topbar-title {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.65);
}

.topbar #run-title {
    color: rgba(255, 255, 255, 0.92);
}

.topbar-back,
.topbar-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
    border-radius: var(--ae-pill-radius);
    color: #fff;
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.topbar-back:hover,
.topbar-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
    color: #fff;
}

.topbar .btn-light {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #fff;
    border-radius: var(--ae-radius);
}

.topbar .btn-light:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.45);
}

/* Actions topbar — fond sombre */
.topbar-actions {
    flex-shrink: 0;
}

.topbar-user-menu {
    border-left-color: rgba(255, 255, 255, 0.2);
}

.topbar-user-trigger {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--ae-radius);
}

.topbar-user-trigger:hover,
.topbar-user-menu.is-open .topbar-user-trigger {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

.topbar-user-icon {
    color: #fff;
}

.topbar-credits {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--ae-radius);
}

.topbar-credits.is-open,
.topbar-credits:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

.topbar-credits--low {
    background: rgba(234, 100, 13, 0.22);
    border-color: rgba(255, 200, 150, 0.45);
    color: #fff;
    animation: credits-pulse 2s ease-in-out infinite;
}

.topbar-credits--admin {
    opacity: 1;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.28);
}

.topbar .quota-banner {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.22);
    padding: 4px 10px;
    border-radius: var(--ae-radius);
    font-size: 11px;
}

/* ─── Boutons pilule (CTA) + chrome carré ─── */
.btn-primary,
.topbar-back,
.topbar-btn,
#export-chiffrage,
#edit-chiffrage,
#launch-btn,
#tb-export-link,
#var-add-btn,
.btn-pill,
.btn-pill-light,
.upload-screen .btn-outline {
    border-radius: var(--ae-pill-radius) !important;
}

/* Pilules pleines — pas de bordure 1px (facet visible à la tangente arc / plat) */
.btn-primary,
#tb-export-link,
#var-add-btn,
#export-chiffrage,
#edit-chiffrage,
#launch-btn {
    border: none !important;
    overflow: hidden;
    background-clip: padding-box;
}

.topbar-back,
.topbar-btn {
    overflow: hidden;
}

.btn:not(.btn-primary):not(.btn-pill):not(.btn-pill-light),
.btn-light,
.btn-outline,
.panel,
.run-item,
.detail-section,
.upload-screen-grid,
.auth-card,
.assistant-float-panel {
    border-radius: 0 !important;
}

.btn-primary {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: var(--navy);
    box-shadow: none;
}

.btn-primary:hover {
    background: var(--navy-dark);
    box-shadow: none;
}

.btn-light {
    border-radius: var(--ae-radius);
    border-color: var(--line);
}

.btn-outline {
    border-radius: var(--ae-radius);
    font-family: var(--font-display);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 11px;
    border: 2px solid var(--navy);
    color: var(--navy);
    background: #fff;
}

.btn-outline:hover {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}

/* ─── Panneaux (grands cadres — bordure sombre + ombre Aedify) ─── */
.panel,
.upload-screen-grid,
.auth-card {
    border: 1px solid var(--ae-border-dark);
    box-shadow: var(--ae-shadow-offset) var(--ae-shadow-offset) 0 0 var(--navy);
    background: #fff;
}

.panel-header h3:not(#detail-title) {
    font-family: var(--font-display);
    font-size: 20px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--navy);
}

#index-runs-panel .panel-header h3 {
    font-size: 28px;
    letter-spacing: 0.12em;
}

.panel-header {
    padding: 12px 16px;
    min-height: 44px;
    border-bottom: 1px solid var(--ae-border-dark);
}

.panel-header .btn-light {
    background: #fff;
    border-color: var(--line);
    color: var(--navy);
}

/* ─── Onglets ─── */
.panel-tabs {
    background: var(--bg-ice);
    border-bottom: 1px solid var(--line);
    padding: 0;
}

.tab-btn {
    height: 36px;
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    border-radius: 0;
}

.tab-btn.active {
    color: var(--navy);
    border-bottom-color: var(--orange);
    background: #fff;
}

/* ─── Liste chiffrages ─── */
.runs-list {
    padding: 12px;
    background: var(--bg-ice);
}

.run-item {
    margin-bottom: 8px;
    padding: 12px 14px;
    background: #fff;
    border: 2px solid var(--line);
    box-shadow: none;
}

.run-item:hover {
    border-color: var(--navy);
}

.run-item.active {
    border: 2px solid var(--navy);
    box-shadow: inset 4px 0 0 0 var(--orange);
    background: #fff;
}

.run-item.nouveau-chiffrage {
    border: 2px dashed var(--orange);
    color: var(--navy);
    transition: background 0.15s, color 0.15s, border-color 0.15s, border-style 0.15s;
}

.run-item.nouveau-chiffrage p,
.run-item.nouveau-chiffrage strong {
    color: inherit;
    transition: color 0.15s;
}

.run-item.nouveau-chiffrage:hover,
.run-item.nouveau-chiffrage.active {
    border-style: solid;
    border-color: var(--navy);
    background: var(--navy);
    color: #fff;
    box-shadow: none;
}

.run-item.nouveau-chiffrage:hover p,
.run-item.nouveau-chiffrage:hover strong,
.run-item.nouveau-chiffrage.active p,
.run-item.nouveau-chiffrage.active strong {
    color: #fff;
}

.run-item-header strong,
.run-item.nouveau-chiffrage strong {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none;
    color: var(--ink);
    line-height: 1.4;
}

/* Titres de contenu (noms d'affaire, titres upload…) — Oswald, casse mixte */
#detail-title,
#run-title,
#export-run-title,
.ae-title,
.detail-titre,
.run-item-header strong,
.run-item.nouveau-chiffrage strong {
    font-family: var(--font-display) !important;
    text-transform: none !important;
    letter-spacing: 0.02em;
    font-weight: 600;
}

.detail-titre {
    font-size: 15px;
    line-height: 1.35;
    color: var(--ink);
    margin-bottom: 10px;
}

#detail-panel .panel-header #detail-title {
    font-size: 20px !important;
    color: var(--ink) !important;
    line-height: 1.35;
}

.topbar-title#run-title,
.topbar #run-title {
    font-size: 15px !important;
    font-weight: 500 !important;
    letter-spacing: 0.02em !important;
    text-transform: none !important;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.92);
}

.export-layout .topbar #export-run-title {
    font-size: 15px !important;
    font-weight: 500 !important;
    letter-spacing: 0.02em !important;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.92);
}

/* Labels de section panneau (Chiffrages, Plan…) — Oswald caps, taille ×2 */
/* (défini plus haut avec .panel-header h3:not(#detail-title)) */

/* Boutons panneau détail — même hauteur */
#detail-panel .panel-header .actions,
#detail-panel .panel-header .run-title-actions {
    align-items: center;
    gap: 8px;
}

#detail-panel .panel-header .actions .btn,
#detail-panel .panel-header .run-title-actions .btn {
    height: 32px;
    min-height: 32px;
    box-sizing: border-box;
    padding: 0 12px;
    font-size: 12px;
}

#detail-panel .panel-header .actions .btn-icon,
#detail-panel .panel-header .run-title-actions .btn-icon {
    width: 32px;
    padding: 0;
}

#export-chiffrage,
#edit-chiffrage {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0 14px;
}

/* ─── Upload ─── */
.upload-screen {
    position: relative;
    padding: 28px 32px 32px;
    background: transparent;
}

/* Quadrillage + fondu hérités du panneau parent (#detail-panel::before) */
.upload-zone-wrap {
    position: relative;
    flex: 1;
    width: 100%;
    min-height: 100%;
    background: transparent;
}

.upload-screen-head {
    padding: 16px 16px 20px;
    margin: 0 0 20px;
    border-bottom: 1px solid var(--ae-border-dark);
    background: transparent;
}

.upload-screen-aside .ae-card-head,
#upload-bases-block .ae-card-head {
    background: #fff;
    background-image: none;
}

#view-upload {
    background: transparent;
    align-items: stretch;
}

body.app-shell.index-shell #detail-panel {
    position: relative;
    isolation: isolate;
    background: #fff;
}

/* Grille continue (alignée en-tête + contenu) */
body.app-shell.index-shell #detail-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--ae-grid-h), var(--ae-grid-v);
    background-size: var(--ae-grid) var(--ae-grid), var(--ae-grid) var(--ae-grid);
    background-position: 0 0, 0 0;
    pointer-events: none;
    z-index: 0;
}

/* Bandeau haut : même fondu horizontal que « Chiffrages » */
body.app-shell.index-shell #detail-panel > .panel-header {
    position: relative;
    z-index: 1;
    background: transparent;
    background-image: none;
}

body.app-shell.index-shell #detail-panel > .panel-header::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--ae-grid-fade-h);
    background-size: 100% 100%;
    pointer-events: none;
}

body.app-shell.index-shell #detail-panel > .panel-header > * {
    position: relative;
    z-index: 1;
}

/* Corps : fondu vertical très progressif sur toute la hauteur */
body.app-shell.index-shell #detail-panel > #view-upload {
    position: relative;
    z-index: 1;
    background-color: transparent;
    background-image: var(--ae-grid-fade-v);
    background-size: 100% 100%;
    background-attachment: local;
}

body.app-shell.index-shell #detail-panel > #view-upload > * {
    position: relative;
    z-index: 1;
}

body.app-shell.index-shell #detail-panel > #view-table,
body.app-shell.index-shell #detail-panel > #view-loading,
body.app-shell.index-shell #detail-panel > #view-files,
body.app-shell.index-shell #detail-panel > #view-error {
    position: relative;
    z-index: 1;
    background: #fff;
}

.upload-alt-actions,
.upload-secondary-actions,
.bases-help-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 12px 0 0;
}

.upload-secondary-actions {
    margin-top: 16px;
}

.bases-help-row {
    margin-top: 16px;
}

.bases-actives-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bases-toggle-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 22px;
    column-gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border: 2px solid var(--line);
    background: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    box-sizing: border-box;
}

.bases-toggle-label {
    min-width: 0;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.bases-toggle-row:has(input:checked) {
    border-color: var(--navy);
    background: var(--bg-ice);
}

.bases-toggle-row input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    margin: 0;
    justify-self: end;
    border: 2px solid var(--navy);
    background: #fff;
    cursor: pointer;
    position: relative;
    box-sizing: border-box;
    transition: background 0.15s, border-color 0.15s;
}

.bases-toggle-row input[type="checkbox"]:checked {
    background: var(--navy);
    border-color: var(--navy);
}

.bases-toggle-row input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 11px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.bases-toggle-row input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

.upload-screen-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(240px, 0.75fr);
    gap: 0;
    max-width: 980px;
    margin: 0 auto;
    border: 1px solid var(--ae-border-dark);
    background: #fff;
}

.upload-screen-main {
    padding: 24px;
    border-right: 1px solid var(--line);
}

.upload-screen-aside {
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.ae-card-head {
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
    font-family: var(--font-display);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}

.ae-card-body {
    padding: 16px;
}

#drop-zone {
    border: 1px dashed var(--line);
    border-top: 1px dashed var(--line);
    border-radius: var(--ae-radius);
    background: var(--bg-ice);
    box-shadow: none;
    padding: 48px 24px;
}

#drop-zone::before {
    display: none;
}

#drop-zone:hover,
#drop-zone.drag-over {
    border-color: var(--orange);
    border-top-color: var(--orange);
    background: #fff;
    box-shadow: none;
}

.drop-label {
    font-family: var(--font-display);
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.drop-icon {
    display: flex;
    justify-content: center;
    margin: 0 auto 14px;
    color: var(--navy);
}

.drop-icon svg {
    display: block;
    width: 52px;
    height: 52px;
    stroke: var(--navy);
}

#file-selected-panel {
    border: 1px solid var(--ae-border-dark);
    border-radius: 0;
    padding: 20px 22px;
    background: #fff;
    box-sizing: border-box;
}

#file-selected-panel .file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 0 16px;
    margin: 0 0 16px;
    border-bottom: 1px solid var(--line);
}

#file-selected-panel .file-info-icon {
    flex-shrink: 0;
    font-size: 18px;
    line-height: 1;
}

#file-selected-panel .file-info-desc {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    color: var(--ink);
    line-height: 1.4;
}

#file-selected-panel #change-file-btn {
    flex-shrink: 0;
}

#file-selected-panel .launch-row {
    margin-top: 0;
    align-items: stretch;
    gap: 12px;
}

#file-selected-panel #nom-affaire {
    border-radius: 0;
    border-color: var(--line);
    height: 42px;
    font-size: 14px;
}

#file-selected-panel .compression-status-row {
    margin: 0 0 14px;
    padding: 10px 12px;
    background: var(--bg-ice);
    border: 1px solid var(--line);
}

/* ─── Réutiliser un dossier existant ─── */
.reutiliser-card {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 28px 28px;
    background: #fff;
    border: 1px solid var(--ae-border-dark);
    box-shadow: var(--ae-shadow-offset) var(--ae-shadow-offset) 0 0 var(--navy);
    border-radius: 0 !important;
    box-sizing: border-box;
    overflow: hidden;
}

.reutiliser-head {
    padding: 0 0 18px;
    margin: 0 0 18px;
    border-bottom: 1px solid var(--ae-border-dark);
}

.reutiliser-head .ae-kicker {
    margin: 0 0 6px;
}

.reutiliser-head .ae-title--sm {
    margin: 0;
    font-size: 22px;
}

.reutiliser-file-list {
    max-height: 300px;
    overflow: auto;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: 0 !important;
}

.reutiliser-card .run-select,
#reutiliser-run-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border-radius: 0 !important;
    border-color: var(--line);
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%230f2439' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
}

.reutiliser-card .btn-light {
    border-radius: 0 !important;
}

.reutiliser-retour-row {
    text-align: center;
    margin: 12px 0 0;
}

.btn-square {
    border-radius: 0 !important;
}

.btn-pill-light,
#reutiliser-retour {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 18px;
    border: none !important;
    box-shadow: inset 0 0 0 1px rgba(15, 36, 57, 0.28);
    background: #fff;
    border-radius: var(--ae-pill-radius) !important;
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--navy);
    cursor: pointer;
    overflow: hidden;
    transition: background 0.15s, box-shadow 0.15s;
}

.btn-pill-light:hover,
#reutiliser-retour:hover {
    background: var(--bg-ice);
    box-shadow: inset 0 0 0 1px rgba(15, 36, 57, 0.45);
}

#choisir-dossier-reutiliser-btn {
    min-width: 220px;
    border-radius: 0 !important;
}

/* ─── Pipeline metro (phases chantier) — style arrêt de métro (ronds) ─── */
.metro-wrap {
    max-width: 680px;
    margin: 0 auto;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 24px 32px 28px;
}

/* Tiret orange décoratif (héritage styles.css) — inutile ici */
.metro-wrap::before {
    display: none !important;
}

.metro-node {
    border-radius: 50%;
}

.metro-label {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.loading-phase-hint {
    margin: 20px 0 0;
    padding: 16px 18px;
    border-radius: 0;
    border: 1px solid var(--ae-border-dark);
    border-left: 3px solid var(--orange);
    background: var(--bg-ice);
    color: var(--ink);
    font-size: 13px;
    line-height: 1.55;
}

.loading-phase-hint strong {
    color: var(--navy);
    font-weight: 600;
}

.step-progress {
    margin-top: 8px;
}

.step-progress-bar-wrap {
    border-radius: 0;
}

.step-progress-bar-fill {
    border-radius: 0;
}

/* ─── Cartes tarifs (lots) ─── */
.ae-lot-card,
.tarifs-card {
    border-radius: var(--ae-radius);
    border: 1px solid var(--line);
    box-shadow: none;
    border-top: 3px solid var(--navy);
    padding-top: 20px;
}

.tarifs-card--popular {
    border-top-color: var(--orange);
    border-color: var(--navy);
    transform: none;
    box-shadow: none;
}

.tarifs-card-title {
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tarifs-card-audience {
    font-family: var(--font-display);
    font-size: 9px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

.tarifs-features li::before {
    content: '—';
    color: var(--orange);
    font-weight: 600;
}

.tarifs-billing-toggle-wrap {
    border-radius: var(--ae-radius);
    border: 1px solid var(--line);
    border-left: 3px solid var(--orange);
    background: #fff;
}

.tarifs-sur-mesure {
    border: 1px solid var(--line);
    border-radius: var(--ae-radius);
}

.tsm-body {
    background: #fff;
    border-left: 3px solid var(--orange);
}

.tarifs-pack-card {
    border-top: 3px solid var(--navy);
}

.ae-page-hero {
    border-bottom: 1px solid var(--line);
}

/* ─── Auth (split vitrine + formulaire) ─── */
body.app-shell.auth-page {
    padding: 0;
    overflow: auto;
    max-height: none;
    min-height: 100dvh;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    background: var(--bg);
}

.auth-shell {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) minmax(340px, 1fr);
    width: 100%;
    flex: 1;
    min-height: min(560px, calc(100dvh - 80px));
}

.auth-showcase {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    background: var(--navy-dark);
    color: #fff;
    position: relative;
    overflow: hidden;
}

.auth-showcase::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.1;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.15) 1px, transparent 1px);
    background-size: var(--ae-grid) var(--ae-grid);
    pointer-events: none;
}

.auth-showcase-inner {
    position: relative;
    z-index: 1;
    max-width: 400px;
    width: 100%;
}

.auth-showcase .brand-logo {
    height: 48px;
    width: auto;
    filter: brightness(0) invert(1);
    margin-bottom: 24px;
    display: block;
}

.auth-showcase h1 {
    margin: 0 0 10px;
    font-family: var(--font-display);
    font-size: clamp(4rem, 8vw, 5.5rem);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    line-height: 1.05;
}

.auth-showcase-tag {
    margin: 0 0 28px;
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--orange-soft);
}

.auth-feature-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.auth-feature-list li {
    position: relative;
    padding: 12px 0 12px 18px;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.auth-feature-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 18px;
    width: 6px;
    height: 2px;
    background: var(--orange);
}

.auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    background-color: var(--bg);
    background-image: none;
}

.auth-main .auth-card {
    margin: 0;
    width: 100%;
    max-width: 400px;
}

.auth-card {
    border-radius: 0;
    border: 1px solid var(--ae-border-dark);
    box-shadow: var(--ae-shadow-offset) var(--ae-shadow-offset) 0 0 var(--navy);
}

.auth-tab {
    border-radius: 0;
    font-family: var(--font-display);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 10px;
}

.auth-tab.active {
    background: var(--navy);
    color: #fff;
}

body.app-shell.auth-page > .aedify-footer {
    flex-shrink: 0;
    margin-top: 0;
}

/* ─── Éditeur ─── */
body.edit-mode .edit-toolbar-bar {
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 8px 12px;
}

body.edit-mode .edit-toolbar-bar .btn-light {
    background: #fff;
    border-color: var(--line);
    color: var(--navy);
    border-radius: var(--ae-radius);
}

body.edit-mode .edit-toolbar-bar .btn-light:hover:not(:disabled) {
    background: var(--bg-ice);
    border-color: var(--navy);
}

body.edit-mode .toolbar-sep {
    background: var(--line);
}

body.edit-mode .plan-total-row {
    background: var(--navy);
    color: #fff;
    font-family: var(--font-display);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 11px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

/* ─── Assistant — halo IA toujours visible ─── */
.assistant-fab-wrap:not([hidden])::before,
.assistant-fab-wrap:not([hidden])::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid rgba(234, 100, 13, 0.5);
    pointer-events: none;
    animation: assistant-fab-ripple 2.4s ease-out infinite;
}

.assistant-fab-wrap:not([hidden])::after {
    animation-delay: 1.2s;
}

.assistant-fab {
    position: relative;
    z-index: 1;
    animation: assistant-fab-pulse 2.4s ease-in-out infinite;
}

.assistant-float-panel {
    border-radius: 0 !important;
    border: 1px solid var(--ae-border-dark);
    box-shadow: var(--ae-shadow-offset) var(--ae-shadow-offset) 0 0 var(--navy);
    isolation: isolate;
}

.assistant-float-panel.open::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: conic-gradient(
        from var(--assistant-ai-angle),
        #f0c9a8,
        #ffffff,
        #EA640D,
        #d97757,
        #fdf3ec,
        #f0c9a8
    );
    animation: assistant-ai-border-spin 2.8s linear infinite;
    z-index: -1;
}

.assistant-float-panel.open::after {
    content: '';
    position: absolute;
    inset: 2px;
    background: #fff;
    z-index: -1;
}

.assistant-float-header {
    background: var(--navy);
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

/* ─── Footer (bandeau contact site) ─── */
.aedify-footer {
    background: var(--navy-dark);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.72);
    padding: 12px 20px;
}

.aedify-footer-brand {
    color: #fff;
}

.aedify-footer-brand:hover {
    color: var(--orange);
}

.aedify-footer-logo {
    flex-shrink: 0;
    display: block;
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.aedify-footer-tagline,
.aedify-footer-legal {
    color: rgba(255, 255, 255, 0.62);
    margin: 0;
}

.aedify-footer-links a {
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
}

.aedify-footer-links a:hover {
    color: var(--orange);
    text-decoration: underline;
}

/* ─── Éléments masqués (display:flex des bannières écrase [hidden]) ─── */
.credits-upgrade-strip[hidden],
.credits-upgrade-banner[hidden],
.credits-nudge-runs[hidden],
#credits-upgrade-banner[hidden],
#credits-upgrade-banner-table[hidden] {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    min-height: 0 !important;
}

/* ─── Bannières crédits (charte, pas pêche legacy) ─── */
.credits-upgrade-strip,
.credits-upgrade-banner {
    border-radius: var(--ae-radius);
    border: 1px solid var(--line);
    border-left: 3px solid var(--orange);
    background: #fff;
    color: var(--ink);
    box-shadow: none;
}

.credits-upgrade-strip--urgent,
.credits-upgrade-banner--urgent {
    border-left-color: var(--orange);
    background: var(--bg-ice);
}

.credits-nudge-runs {
    border-radius: var(--ae-radius);
    border: 1px dashed var(--line);
    border-left: 3px solid var(--orange);
    background: #fff;
}

/* ─── Totaux & plan (navy — pas de bordure orange) ─── */
.plan-total-row,
.total-bar {
    background: var(--navy);
    color: #fff;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: none;
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.plan-total-val,
.total-montant {
    color: #fff;
    font-size: 14px;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.plan-total-row > span:first-child,
.total-bar .total-label {
    color: #fff;
    font-weight: 600;
}

/* ─── AG Grid : en-têtes lisibles sur fond navy, angles droits ─── */
#edit-grid,
#estimation-grid,
#edit-grid .ag-root-wrapper,
#estimation-grid .ag-root-wrapper {
    --ag-header-background-color: var(--navy);
    --ag-header-foreground-color: #fff;
    --ag-header-text-color: #fff;
    --ag-border-radius: 0;
    --ag-wrapper-border-radius: 0;
    border-radius: 0 !important;
}

#edit-grid .ag-root-wrapper-body,
#estimation-grid .ag-root-wrapper-body,
#edit-grid .ag-header,
#estimation-grid .ag-header,
#edit-grid .ag-header-viewport,
#estimation-grid .ag-header-viewport,
#edit-grid .ag-header-container,
#estimation-grid .ag-header-container {
    border-radius: 0 !important;
}

#edit-grid .ag-header-cell,
#estimation-grid .ag-header-cell,
#edit-grid .ag-header-group-cell,
#estimation-grid .ag-header-group-cell {
    background-color: var(--navy);
    border-radius: 0 !important;
}

#edit-grid .ag-header-cell-text,
#edit-grid .ag-header-cell-label,
#edit-grid .ag-header-group-cell-label,
#estimation-grid .ag-header-cell-text,
#estimation-grid .ag-header-cell-label,
#estimation-grid .ag-header-group-cell-label {
    color: #fff !important;
}

#edit-grid .ag-header-icon,
#estimation-grid .ag-header-icon {
    color: rgba(255, 255, 255, 0.85);
}

/* Lots AG Grid — même bleu, sélection légèrement plus sombre */
.ag-row.is-lot.ag-row-selected .ag-cell {
    background-color: #0c1e30 !important;
}

.edit-center .panel,
#detail-panel.panel {
    border-radius: 0;
}

.edit-grid-wrap,
#edit-grid,
#estimation-grid {
    border-radius: 0;
}

.plan-lot-item:hover {
    background: var(--bg-ice);
}

.plan-lot-item.active {
    background: #fff;
    border-left: 3px solid var(--orange);
    color: var(--navy);
}

.plan-lot-total {
    color: var(--navy);
}

.plan-lot-item.active .plan-lot-total {
    color: var(--orange);
}

/* ─── Panneau détail / décomposition ─── */
.detail-section {
    border-radius: var(--ae-radius);
    border-color: var(--ae-border-dark);
}

.detail-section > summary {
    font-family: var(--font-display);
    font-size: 20px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--navy);
    border-bottom: 1px solid var(--ae-border-dark);
}

.uo-table-label {
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 0.12em;
    color: var(--orange);
}

.btn-edit-uo {
    border-radius: var(--ae-radius);
    border: 1px solid var(--navy);
    background: #fff;
    color: var(--navy);
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.btn-edit-uo:hover {
    background: var(--bg-ice);
    border-color: var(--navy);
}

.uo-compact-table thead tr {
    background: var(--bg-ice);
}

.uo-compact-table th {
    color: var(--navy);
    border-bottom: 1px solid var(--line);
    font-family: var(--font-display);
    font-size: 9px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.uo-compact-table td {
    border-bottom: 1px solid var(--line);
    color: var(--ink);
}

.uo-compact-table td:last-child,
.uo-compact-table th:last-child {
    white-space: nowrap;
}

.uo-compact-total {
    background: var(--bg-ice);
}

.uo-compact-total td {
    color: var(--navy);
    border-top: 1px solid var(--ae-border-dark);
    font-weight: 700;
}

.uo-editor-header {
    background: #fff;
    background-image: var(--ae-grid-fade-h), var(--ae-grid-h), var(--ae-grid-v);
    background-size: 100% 100%, var(--ae-grid) var(--ae-grid), var(--ae-grid) var(--ae-grid);
    border-bottom: 1px solid var(--ae-border-dark);
}

.uo-editor-label {
    font-family: var(--font-display);
    color: var(--navy);
    letter-spacing: 0.12em;
}

/* ─── Toolbar éditeur : icônes lisibles ─── */
body.edit-mode .edit-toolbar-bar .btn-light {
    color: var(--navy);
    border: 1px solid var(--line);
    background: #fff;
}

body.edit-mode .edit-toolbar-bar .btn-light svg {
    stroke: var(--navy);
    stroke-width: 2.25;
}

body.edit-mode .edit-toolbar-bar .btn-icon {
    color: var(--navy);
    border: 1px solid var(--line);
    background: #fff;
}

body.edit-mode .edit-toolbar-bar .btn-icon svg {
    stroke: var(--navy);
    stroke-width: 2.25;
}

body.edit-mode .edit-toolbar-bar .btn-icon:hover:not(:disabled),
body.edit-mode .edit-toolbar-bar .btn-light:hover:not(:disabled) {
    background: var(--bg-ice);
    border-color: var(--navy);
}

body.edit-mode .edit-toolbar-bar .btn-icon:disabled,
body.edit-mode .edit-toolbar-bar .btn-light:disabled {
    opacity: 0.4;
}

body.edit-mode .edit-toolbar-bar .toolbar-btn-group--split {
    border-radius: var(--ae-radius);
    border-color: var(--line);
    background: #fff;
}

body.edit-mode .edit-toolbar-bar .toolbar-btn-group--split > .btn {
    color: var(--navy);
    border: none;
    background: transparent;
}

body.edit-mode .edit-toolbar-bar .toolbar-btn-group--split > .btn svg {
    stroke: var(--navy);
    stroke-width: 2.25;
}

body.edit-mode .edit-toolbar-bar .toolbar-btn-group--split > .btn:hover:not(:disabled) {
    background: var(--bg-ice);
}

/* ─── Topbar : alignement boutons ─── */
.topbar .actions {
    flex-shrink: 0;
    align-items: center;
    gap: 8px;
}

.topbar-back,
.topbar-user-trigger {
    height: 32px;
    min-height: 32px;
    box-sizing: border-box;
    align-items: center;
}

.topbar-credits--admin {
    flex-direction: row;
    gap: 6px;
    height: 32px;
    min-height: 32px;
    align-items: center;
    padding: 0 12px;
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ─── Liste chiffrages : badges statut ─── */
.run-item .statut-done,
.run-item .statut-failed,
.run-item .statut-processing,
.run-item .statut-cancelled {
    display: inline-block;
    margin: 6px 0 0;
    padding: 2px 8px;
    font-family: var(--font-display);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: 1px solid;
    border-radius: var(--ae-radius);
}

.run-item .statut-done {
    color: #1a6b3a;
    background: #eef8f1;
    border-color: #a8d5b8;
}

.run-item .statut-failed {
    color: #b71c1c;
    background: #fdecea;
    border-color: #f5c0c0;
}

.run-item .statut-processing {
    color: #b45309;
    background: #fff8ee;
    border-color: #f0d4b8;
}

.run-item .statut-cancelled {
    color: var(--muted);
    background: var(--bg-ice);
    border-color: var(--line);
}

/* ─── Index : volet contexte ─── */
.projet-context-aside .detail-section > summary,
.projet-context-panel summary {
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--navy);
}

.projet-context-body h4,
.detail-section-title {
    font-family: var(--font-display);
    font-size: 20px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--orange);
}

.index-plan-total {
    margin: 0;
    border-radius: 0;
}

/* ─── Shell index + éditeur : marges détachées ─── */
body.app-shell.index-shell > main.page {
    padding: var(--ae-page-gap) 16px 16px;
    box-sizing: border-box;
}

body.app-shell.index-shell .content-grid {
    gap: var(--ae-page-gap);
    align-items: stretch;
    padding-right: var(--ae-shadow-offset);
    padding-bottom: var(--ae-shadow-offset);
    box-sizing: border-box;
}

body.edit-mode .edit-page {
    padding: var(--ae-page-gap) 16px 16px;
    box-sizing: border-box;
    overflow: visible;
    min-height: 0;
}

body.edit-mode .edit-layout {
    gap: var(--ae-page-gap);
    padding-right: var(--ae-shadow-offset);
    padding-bottom: var(--ae-shadow-offset);
    box-sizing: border-box;
    overflow: visible;
}

/* Ombre sur le conteneur grille — pas sur .panel interne (overflow:hidden du parent la coupait) */
body.edit-mode .plan-panel.panel,
body.edit-mode .edit-center,
body.edit-mode .edit-right-panel {
    position: relative;
    box-shadow: var(--ae-shadow-offset) var(--ae-shadow-offset) 0 0 var(--navy);
    border: 1px solid var(--ae-border-dark);
    background: #fff;
}

/* Inset panneaux éditeur (plan + barres totaux) */
body.edit-mode {
    --ae-panel-inset: 2px;
}

body.edit-mode .plan-panel-content {
    padding-left: var(--ae-panel-inset);
    padding-right: var(--ae-panel-inset);
}

/* Bas de grille seulement — pas de padding horizontal (coupait les fonds lot/titre) */
body.edit-mode .edit-grid-wrap {
    padding: 0 0 var(--ae-panel-inset);
    box-sizing: border-box;
}

body.edit-mode .plan-total-row,
body.edit-mode .total-bar {
    margin: 0 var(--ae-panel-inset) var(--ae-panel-inset);
}

body.edit-mode .edit-center {
    min-height: 0;
    overflow: hidden;
}

body.edit-mode .edit-center > .panel {
    box-shadow: none;
    border: none;
    background: transparent;
}

.ae-sec-title {
    font-size: 20px;
}

.detail-section > summary {
    font-size: 20px;
}

.projet-context-body h4,
.detail-section-title {
    font-size: 20px;
}

/* Angles droits — sauf pilules CTA et FAB assistant */
.handle-arrow,
.drawer-close-btn,
#drop-zone,
#file-selected-panel,
.tarifs-card,
.ae-lot-card,
.credits-upgrade-strip,
.credits-nudge-runs,
.modal-content,
.search-popup,
.col-vis-menu,
.topbar-user-dropdown {
    border-radius: 0 !important;
}

/* Halo IA sur bulle d'accroche assistant */
.assistant-fab-hint::before {
    border-radius: 0;
}

.assistant-fab-hint::after {
    border-radius: 0;
}

.assistant-fab-hint {
    border-radius: 0;
}

.content-grid {
    filter: none;
}

/* ─── Variables projet (éditeur) — charte ─── */
.var-coef-table-title,
.var-scope-vars-title {
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--orange);
}

.var-coef-table {
    border: 1px solid var(--ae-border-dark);
}

.var-coef-table th,
.var-coef-table td {
    border-color: var(--line);
}

.var-coef-table thead th {
    background-color: #fff;
    background-image: var(--ae-grid-fade-h), var(--ae-grid-h), var(--ae-grid-v);
    background-size: 100% 100%, var(--ae-grid) var(--ae-grid), var(--ae-grid) var(--ae-grid);
    color: var(--navy);
    font-family: var(--font-display);
    letter-spacing: 0.1em;
}

.var-coef-row--global .var-coef-kind,
.var-coef-row--lot .var-coef-kind,
.var-coef-row--titre .var-coef-kind {
    color: var(--navy);
}

.var-coef-row--lot .var-coef-kind {
    color: var(--orange);
}

.var-coef-row:hover {
    background: var(--bg-ice);
}

.var-coef-row--active {
    background: var(--bg-ice);
    box-shadow: inset 3px 0 0 var(--orange);
}

.var-coef-cell-input,
.detail-body .var-input,
#var-new-key,
#var-new-val {
    height: 32px;
    border: 2px solid var(--line);
    border-radius: 0;
    background: #fff;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    box-sizing: border-box;
}

.var-coef-cell-input {
    width: 56px;
    padding: 0 6px;
    text-align: center;
}

.var-coef-cell-input:focus,
.detail-body .var-input:focus,
#var-new-key:focus,
#var-new-val:focus {
    border-color: var(--navy);
    outline: none;
}

.var-coef-foot-total td {
    background: var(--bg-ice);
    border-top: 2px solid var(--ae-border-dark);
}

.var-coef-foot-calc td {
    background: #fff;
}

.var-coef-reset {
    border-radius: 0;
    border: 2px solid var(--line);
    color: var(--navy);
}

.var-coef-reset:hover {
    border-color: var(--navy);
    background: var(--bg-ice);
}

#var-add-btn {
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0 16px;
    height: 32px;
}

/* Boutons CTA éditeur — même gabarit pilule (Export ≈ Retour ≈ Ajouter) */
body.edit-mode .topbar-back,
body.edit-mode #tb-export-link,
body.edit-mode #var-add-btn {
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 16px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    /* Rayon = demi-hauteur → arc parfait, moins de facet qu'avec 999px + bordure */
    border-radius: 16px !important;
    text-decoration: none;
}

body.edit-mode #tb-export-link {
    line-height: 1;
}

.edit-toolbar-bar .btn-primary {
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0 16px;
}

.detail-calcul-bloc {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 4px;
}

.detail-eq--qte,
.detail-eq--prix,
.detail-ligne--prix {
    margin: 0;
    padding: 8px 10px;
    border: 2px solid;
    font-size: 12px;
    line-height: 1.45;
    word-break: break-word;
}

.detail-eq--qte {
    border-color: var(--ae-cell-qte);
    color: var(--ae-cell-qte);
}

.detail-eq--qte .detail-formule,
.detail-eq--qte .detail-valeur {
    color: var(--ae-cell-qte);
}

.detail-eq--qte .detail-formule {
    font-family: monospace;
    background: rgba(26, 143, 74, 0.08);
    padding: 1px 5px;
    border-radius: 0;
}

.detail-eq--prix,
.detail-ligne--prix {
    border-color: var(--ae-cell-prix);
    color: var(--ae-cell-prix);
}

.detail-eq--prix .detail-formule,
.detail-eq--prix .detail-valeur,
.detail-ligne--prix .detail-valeur {
    color: var(--ae-cell-prix);
}

.detail-eq--prix .detail-formule {
    font-family: monospace;
    background: rgba(46, 143, 255, 0.08);
    padding: 1px 5px;
    border-radius: 0;
}

.detail-eq--prix-coef {
    margin: 0;
    padding: 6px 10px;
    border: 1px dashed var(--ae-cell-prix);
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.detail-eq--prix-coef .detail-valeur {
    color: var(--ae-cell-prix);
    font-weight: 600;
}

.detail-eq--total {
    margin: 0;
    padding: 8px 10px;
    border: 2px solid var(--navy);
    color: var(--navy);
    font-weight: 600;
    font-size: 13px;
}

.detail-eq--total .detail-valeur {
    color: var(--navy);
}

.detail-eq--total .detail-valeur--qte {
    color: var(--ae-cell-qte);
    font-weight: 600;
}

.detail-eq--total .detail-valeur--prix {
    color: var(--ae-cell-prix);
    font-weight: 600;
}

.detail-eq--total .detail-valeur--montant {
    color: var(--navy);
    font-weight: 700;
}

.detail-decomposition-jump {
    margin: 4px 0 0;
    text-align: right;
}

#detail-decomposition.detail-decomposition--flash {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

/* Cellules P.U. Batiprix verrouillées */
#edit-grid .ag-cell.cell-prix-batiprix-locked {
    cursor: default;
}

.cell-prix-batiprix {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

.cell-prix-batiprix-lock {
    display: inline-flex;
    align-items: center;
    color: #2e8fff;
    opacity: 0.9;
    flex-shrink: 0;
    line-height: 0;
}

.cell-prix-batiprix-lock svg {
    width: 11px;
    height: 11px;
}

.cell-prix-batiprix-val {
    font-weight: 600;
}

.prix-batiprix-modal-inner {
    max-width: 520px;
    width: min(520px, calc(100vw - 32px));
}

.prix-batiprix-modal-body {
    padding: 0 20px 8px;
    max-height: min(60vh, 480px);
    overflow-y: auto;
}

.prix-batiprix-modal-lead {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--ink);
}

.prix-batiprix-modal-pu {
    margin: 0 0 16px;
    font-size: 14px;
    color: var(--navy);
}

.prix-batiprix-modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px 20px;
    border-top: 1px solid var(--line);
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
    .auth-shell {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .auth-showcase {
        display: none;
    }

    .auth-main {
        padding: 24px 16px 32px;
        min-height: calc(100dvh - 80px);
    }

    .upload-screen-grid {
        grid-template-columns: 1fr;
    }

    .upload-screen-main {
        border-right: none;
        border-bottom: 1px solid var(--line);
    }
}
