:root {
    --awg-bg: #eaf0f4;
    --awg-surface: #f9fbfc;
    --awg-surface-soft: #edf2f5;
    --awg-navy: #101a23;
    --awg-navy-light: #004b7c;
    --awg-blue: #006fb9;
    --awg-blue-dark: #004b7c;
    --awg-blue-soft: #e4eff6;
    --awg-blue-muted: #bdd7e8;
    --awg-yellow: #f0a126;
    --awg-yellow-soft: #fff1d6;
    --awg-cyan: #1d94a6;
    --awg-text: #15222d;
    --awg-muted: #61717e;
    --awg-border: #b8c5ce;
    --awg-success: #14805e;
    --awg-danger: #c93434;
    --awg-radius: 4px;
    --awg-radius-sm: 2px;
    --awg-shadow: 0 8px 22px rgba(31, 53, 69, 0.11);
    --awg-shadow-sm: 0 4px 12px rgba(31, 53, 69, 0.08);
    --awg-font-technical: "SFMono-Regular", Consolas, monospace;

    --bs-body-color: var(--awg-text);
    --bs-body-bg: var(--awg-bg);
    --bs-primary: var(--awg-blue);
    --bs-primary-rgb: 0, 111, 185;
    --bs-success: var(--awg-success);
    --bs-success-rgb: 20, 128, 94;
    --bs-danger: var(--awg-danger);
    --bs-danger-rgb: 201, 52, 52;
    --bs-dark-rgb: 16, 26, 35;
    --bs-secondary-rgb: 0, 75, 124;
    --bs-warning-rgb: 240, 161, 38;
    --bs-warning: var(--awg-yellow);
    --bs-orange: var(--awg-yellow);
    --bs-dark: var(--awg-navy);
    --bs-primary-bg-subtle: var(--awg-blue-soft);
    --bs-secondary-bg-subtle: var(--awg-blue-muted);
    --bs-primary-border-subtle: var(--awg-border);
    --bs-primary-text-emphasis: var(--awg-blue-dark);
    --bs-warning-bg-subtle: var(--awg-yellow-soft);
    --bs-link-color: var(--awg-blue);
    --bs-link-color-rgb: 0, 111, 185;
    --bs-link-hover-color: var(--awg-blue-dark);
    --bs-link-hover-color-rgb: 0, 75, 124;
    --bs-secondary-color: var(--awg-muted);
    --bs-secondary-bg: var(--awg-surface-soft);
    --bs-tertiary-bg: var(--awg-surface-soft);
    --bs-border-color: var(--awg-border);
    --bs-border-radius: var(--awg-radius);
    --bs-border-radius-sm: var(--awg-radius-sm);
    --bs-border-radius-lg: var(--awg-radius);
    --bs-border-radius-xl: var(--awg-radius);
    --bs-border-radius-xxl: var(--awg-radius);
    --bs-border-radius-pill: var(--awg-radius-sm);
    --bs-box-shadow: var(--awg-shadow);
    --bs-box-shadow-sm: var(--awg-shadow-sm);

    --app-border-strong: #8c9fab;
    --app-focus-ring: 0 0 0 0.25rem rgba(0, 111, 185, 0.16);
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background-color: var(--awg-bg);
    background-image:
        linear-gradient(rgba(33, 82, 114, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(33, 82, 114, 0.045) 1px, transparent 1px);
    background-size: 24px 24px;
    font-size: 0.875rem;
}

body.bg-body-tertiary {
    background-color: var(--awg-bg) !important;
}

button,
input,
select,
textarea {
    font: inherit;
}

input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    margin: 0;
    appearance: none;
}

a {
    text-underline-offset: 0.18em;
}

.btn {
    --bs-btn-border-radius: var(--awg-radius-sm);
    --bs-btn-font-weight: 700;
    --bs-btn-font-size: 0.75rem;
    min-height: 35px;
    font-family: var(--awg-font-technical);
    text-transform: uppercase;
}

.btn-sm {
    --bs-btn-font-size: 0.6875rem;
    --bs-btn-border-radius: var(--awg-radius-sm);
    min-height: 29px;
}

.btn-lg {
    --bs-btn-font-size: 1.25rem;
    --bs-btn-border-radius: var(--awg-radius-sm);
}

.btn-outline-primary {
    --bs-btn-color: var(--awg-blue);
    --bs-btn-border-color: var(--awg-blue);
    --bs-btn-hover-bg: var(--awg-blue);
    --bs-btn-hover-border-color: var(--awg-blue);
    --bs-btn-active-bg: var(--awg-blue-dark);
    --bs-btn-active-border-color: var(--awg-blue-dark);
    --bs-btn-disabled-color: var(--awg-blue);
    --bs-btn-disabled-border-color: var(--awg-blue);
    --bs-btn-focus-shadow-rgb: 0, 111, 185;
}

.badge {
    --bs-badge-border-radius: 1px;
    color: var(--awg-blue-dark);
    background: var(--awg-yellow-soft);
    border: 1px solid var(--awg-yellow);
    font-family: var(--awg-font-technical);
    text-transform: uppercase;
}

.badge.bg-primary,
.badge.bg-secondary,
.badge.bg-success,
.badge.bg-danger,
.badge.bg-dark {
    color: #fff;
}

.badge.bg-warning,
.badge.bg-info,
.badge.bg-light {
    color: var(--awg-navy);
}

/* Taille de texte compacte réutilisable sur les badges Bootstrap. */
.badge.small {
    font-size: 0.875em;
}

.btn-primary {
    --bs-btn-bg: var(--awg-blue);
    --bs-btn-border-color: var(--awg-blue);
    --bs-btn-hover-bg: var(--awg-blue-dark);
    --bs-btn-hover-border-color: var(--awg-blue-dark);
    --bs-btn-active-bg: var(--awg-blue-dark);
    --bs-btn-active-border-color: var(--awg-blue-dark);
    --bs-btn-disabled-bg: var(--awg-blue);
    --bs-btn-disabled-border-color: var(--awg-blue);
    --bs-btn-focus-shadow-rgb: 0, 111, 185;
}

.btn-dark {
    --bs-btn-bg: var(--awg-navy);
    --bs-btn-border-color: var(--awg-navy);
    --bs-btn-hover-bg: var(--awg-blue-dark);
    --bs-btn-hover-border-color: var(--awg-blue-dark);
    --bs-btn-active-bg: var(--awg-blue-dark);
    --bs-btn-active-border-color: var(--awg-blue-dark);
    --bs-btn-disabled-bg: var(--awg-navy);
    --bs-btn-disabled-border-color: var(--awg-navy);
}

.btn-success {
    --bs-btn-bg: var(--awg-success);
    --bs-btn-border-color: var(--awg-success);
    --bs-btn-hover-bg: #10664b;
    --bs-btn-hover-border-color: #10664b;
    --bs-btn-active-bg: #10664b;
    --bs-btn-active-border-color: #10664b;
    --bs-btn-disabled-bg: var(--awg-success);
    --bs-btn-disabled-border-color: var(--awg-success);
    --bs-btn-focus-shadow-rgb: 20, 128, 94;
}

.btn-outline-success {
    --bs-btn-color: var(--awg-success);
    --bs-btn-border-color: var(--awg-success);
    --bs-btn-hover-bg: var(--awg-success);
    --bs-btn-hover-border-color: var(--awg-success);
    --bs-btn-active-bg: var(--awg-success);
    --bs-btn-active-border-color: var(--awg-success);
    --bs-btn-disabled-color: var(--awg-success);
    --bs-btn-disabled-border-color: var(--awg-success);
}

.btn-danger {
    --bs-btn-bg: var(--awg-danger);
    --bs-btn-border-color: var(--awg-danger);
    --bs-btn-hover-bg: #a32929;
    --bs-btn-hover-border-color: #a32929;
    --bs-btn-active-bg: #a32929;
    --bs-btn-active-border-color: #a32929;
    --bs-btn-disabled-bg: var(--awg-danger);
    --bs-btn-disabled-border-color: var(--awg-danger);
    --bs-btn-focus-shadow-rgb: 201, 52, 52;
}

.btn-outline-danger {
    --bs-btn-color: var(--awg-danger);
    --bs-btn-border-color: var(--awg-danger);
    --bs-btn-hover-bg: var(--awg-danger);
    --bs-btn-hover-border-color: var(--awg-danger);
    --bs-btn-active-bg: var(--awg-danger);
    --bs-btn-active-border-color: var(--awg-danger);
    --bs-btn-disabled-color: var(--awg-danger);
    --bs-btn-disabled-border-color: var(--awg-danger);
}

.btn-warning {
    --bs-btn-bg: var(--awg-yellow);
    --bs-btn-border-color: var(--awg-yellow);
    --bs-btn-hover-bg: #f3b452;
    --bs-btn-hover-border-color: #f3b452;
    --bs-btn-active-bg: #f3b452;
    --bs-btn-active-border-color: #f3b452;
    --bs-btn-disabled-bg: var(--awg-yellow);
    --bs-btn-disabled-border-color: var(--awg-yellow);
}

.form-control,
.form-select {
    min-height: 2.5rem;
    border-color: var(--awg-border);
    border-radius: 1px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--awg-blue);
    box-shadow: var(--app-focus-ring);
}

/* Limite commune aux pages Bootstrap, y compris celles sans app-page. */
@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
    }
}

/* Structure générale */
.app-page {
    width: min(100%, 1200px);
    max-width: 1200px;
}

.app-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
}

.app-eyebrow {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.4rem;
    color: var(--awg-blue);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-family: var(--awg-font-technical);
}

.app-eyebrow::before {
    width: 1.7rem;
    height: 3px;
    content: "";
    background: var(--awg-yellow);
    border-radius: 0;
}

.app-page-title {
    margin: 0;
    font-size: clamp(1.6875rem, 3.5vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.05em;
    font-family: var(--awg-font-technical);
    text-transform: uppercase;
}

.app-page-description {
    max-width: 46rem;
    margin: 0.45rem 0 0;
    color: var(--awg-muted);
}

.app-card,
.cadre,
.entetes-sections,
.tableaux,
.index-application,
.resume-projet {
    overflow: hidden;
    background: var(--awg-surface);
    border: 1px solid var(--awg-border);
    border-radius: var(--awg-radius);
    box-shadow: var(--awg-shadow);
}

.app-card,
.cadre {
    position: relative;
}

.catalog-index .app-card,
.app-card.index-application {
    border-left: 4px solid var(--awg-blue);
}

.catalog-index .app-card::after,
.app-card.index-application::after,
.entete-code.position-relative::after {
    position: absolute;
    top: 0;
    right: 0;
    width: 18px;
    height: 18px;
    content: "";
    pointer-events: none;
    background: var(--awg-yellow);
    clip-path: polygon(100% 0, 100% 100%, 0 0);
}

.app-card-link {
    display: block;
    height: 100%;
    color: inherit;
    text-decoration: none;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.app-card-link:hover,
.app-card-link:focus-visible {
    color: inherit;
    transform: translateY(-2px);
}

.app-card-link:hover .app-card,
.app-card-link:focus-visible .app-card {
    border-color: var(--awg-blue);
    box-shadow: 0 0 0 3px rgba(0, 111, 185, 0.12), var(--awg-shadow);
}

.app-card-horizontal,
.cadre-avec-image {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr);
    min-height: 7.5rem;
}

.app-card-media,
.cadre-image {
    position: relative;
    min-height: 7.5rem;
    overflow: hidden;
    background:
        linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
        linear-gradient(145deg, var(--awg-blue-dark), var(--awg-navy));
    background-size: 16px 16px, 16px 16px, auto;
}

.app-card-media img,
.cadre-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-card-body,
.cadre-content {
    min-width: 0;
    padding: 1.15rem;
}

.app-card-title,
.cadre-content h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 750;
}

/* Mini-vignettes partagées */
.mini-vignette {
    display: grid;
    width: 100%;
    height: 3rem;
    min-width: 0;
    grid-template-columns: 3rem minmax(0, 1fr);
    overflow: hidden;
    color: var(--awg-text);
    text-align: left;
    text-decoration: none;
    background: var(--awg-surface);
    border: 1px solid var(--awg-border);
    border-left: 4px solid var(--awg-blue);
    border-radius: var(--awg-radius);
    box-shadow: var(--awg-shadow-sm);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

button.mini-vignette {
    padding: 0;
}

.mini-vignette:hover,
.mini-vignette:focus-visible {
    color: var(--awg-text);
    border-color: var(--awg-blue);
    box-shadow: 0 0 0 3px rgba(0, 111, 185, 0.1), var(--awg-shadow-sm);
    transform: translateY(-1px);
}

.mini-vignette.is-active,
.mini-vignette[aria-pressed="true"] {
    color: var(--awg-blue-dark);
    background: var(--awg-blue-soft);
    border-color: var(--awg-blue);
    box-shadow: 0 0 0 1px var(--awg-blue);
}

.mini-vignette-media {
    display: grid;
    width: 3rem;
    height: 3rem;
    overflow: hidden;
    place-items: center;
    color: rgba(255, 255, 255, 0.9);
    background: linear-gradient(145deg, var(--awg-blue), var(--awg-navy));
    font-size: 1.1rem;
    font-weight: 800;
}

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

.mini-vignette-title {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.35rem 0.5rem;
    overflow: hidden;
    font-size: 0.8rem;
    font-weight: 750;
    line-height: 1.15;
}

.mini-vignette-title > span {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.app-empty-state {
    padding: 2.5rem 1.5rem;
    color: var(--awg-muted);
    text-align: center;
    background: var(--awg-surface);
    border: 1px dashed var(--app-border-strong);
    border-radius: var(--awg-radius);
}

.app-section-header,
.popup-header {
    display: flex;
    min-height: 3.25rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 1rem;
    color: #fff;
    background: var(--awg-navy);
    border-bottom: 3px solid var(--awg-yellow);
}

.app-section-header h2,
.app-section-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.035em;
    text-transform: uppercase;
    font-family: var(--awg-font-technical);
}

/* Formulaire partagé */
.app-form-card,
.formulaires-popup {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 17rem;
    overflow: hidden;
    background: var(--awg-surface);
    border: 1px solid var(--awg-border);
    border-radius: var(--awg-radius);
    box-shadow: var(--awg-shadow);
    border-top: 4px solid var(--awg-yellow);
}

/* Menus des formulaires partagés : au-dessus de la navigation et des modales. */
.app-form-card .dropdown-menu,
.formulaires-popup .dropdown-menu {
    --bs-dropdown-zindex: 1080;
}

.app-form-main {
    min-width: 0;
}

.app-form-header,
.index-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--awg-border);
    color: #fff;
    background: var(--awg-blue-dark);
    border-bottom: 3px solid var(--awg-yellow);
}

.app-form-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    font-family: var(--awg-font-technical);
    text-transform: uppercase;
}

.app-form-body {
    padding: 1.5rem;
}

.app-form-actions,
.popup-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    background: var(--awg-surface-soft);
    border-top: 1px solid var(--awg-border);
}

.app-form-media,
.popup-visual {
    position: relative;
    min-height: 100%;
    overflow: hidden;
    background:
        linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
        var(--awg-blue-dark);
    background-size: 18px 18px;
}

.app-form-media img,
.popup-visual img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-form-media-label {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-align: center;
    text-transform: uppercase;
}

.app-danger-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: #fff;
    border: 1px solid rgba(201, 52, 52, 0.32);
    border-radius: var(--awg-radius-sm);
}

/* Barre de navigation */
.app-navbar-wrap {
    position: sticky;
    top: 0;
    z-index: 1030;
    width: 100%;
    margin: 0 auto 1.5rem;
    pointer-events: none;
}

.app-navbar {
    pointer-events: auto;
    min-height: 62px;
    padding: 0.45rem 0;
    background: var(--awg-navy);
    border: 0;
    border-radius: 0;
    box-shadow: var(--awg-shadow);
    border-bottom: 3px solid var(--awg-yellow);
}

.app-navbar.fade:not(.show) {
    pointer-events: none;
}

.app-navbar .navbar-brand {
    margin-right: 1.5rem;
}

.app-navbar .nav-link {
    position: relative;
    padding: 0.75rem 0.65rem !important;
    color: #cbd6e1;
    font-size: 0.8rem;
    font-weight: 650;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus,
.app-navbar .nav-link.active,
.app-navbar .show > .nav-link {
    color: var(--awg-yellow);
}

.app-navbar .nav-link.active::after {
    position: absolute;
    right: 0.65rem;
    bottom: 0.28rem;
    left: 0.65rem;
    height: 3px;
    content: "";
    background: var(--awg-yellow);
    border-radius: var(--awg-radius-sm);
}

.app-navbar .dropdown-menu {
    padding: 0.45rem;
    border-color: var(--awg-border);
    border-radius: var(--awg-radius-sm);
    box-shadow: var(--awg-shadow);
}

.app-navbar .dropdown-item {
    padding: 0.55rem 0.7rem;
    border-radius: var(--awg-radius-sm);
    font-size: 0.82rem;
}

.app-navbar .dropdown-item:active,
.app-navbar .dropdown-item.active {
    color: #fff;
    background: var(--awg-blue);
}

.app-user-chip {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
    padding: 0.3rem 0.65rem 0.3rem 0.3rem;
    color: #dce4eb;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--awg-radius-sm);
}

.app-user-chip:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.13);
}

.app-user-avatar {
    display: grid;
    flex: 0 0 1.9rem;
    width: 1.9rem;
    height: 1.9rem;
    place-items: center;
    color: #fff;
    background: var(--awg-blue);
    border-radius: 50%;
    font-size: 0.72rem;
    font-weight: 800;
}

.app-user-name {
    max-width: 10rem;
    overflow: hidden;
    font-size: 0.75rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Utilitaires absents de Bootstrap */
.min-w-0 {
    min-width: 0;
}

.min-w-220 {
    min-width: 220px;
}

.cursor-pointer {
    cursor: pointer;
}

.resize-none {
    resize: none;
}

.search-control {
    width: min(100%, 320px);
}

.icon-14 {
    width: auto;
    height: 14px;
}

.icon-18 {
    width: auto;
    height: 18px;
}

.icon-20 {
    width: auto;
    height: 20px;
}

.table-col-thumb {
    width: 44px;
}

.table-col-actions {
    width: 120px;
}

.input-70 {
    width: 70px;
}

.input-90 {
    width: 90px;
}

.opacity-65 {
    opacity: 0.65;
}

/* Navigation */
.app-brand-logo {
    width: auto;
    height: 27px;
}

.app-workspace-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

/* États des projets */
.etat-badge,
.etat-option {
    cursor: pointer;
}

.etat-popover {
    position: absolute;
    top: 120%;
    left: 0;
    z-index: 1080;
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    min-width: 180px;
    padding: 0.5rem;
    background: var(--bs-body-bg);
    border: var(--bs-border-width) solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    box-shadow: var(--bs-box-shadow);
}

.badge-orange {
    color: var(--awg-navy);
    background: var(--awg-yellow);
}

/* Index de catalogue */
.catalog-category-thumb,
.catalog-item-thumb {
    display: block;
    flex: 0 0 auto;
    object-fit: cover;
    background: var(--bs-secondary-bg);
}

.catalog-category-thumb {
    width: 64px;
    height: 64px;
}

.catalog-item-thumb {
    width: 38px;
    height: 38px;
    border-radius: var(--bs-border-radius-sm);
}

.catalog-item-thumb-mobile {
    width: 48px;
    height: 48px;
}

.catalog-group-title {
    min-width: 0;
    padding: 0.75rem 1rem;
}

.catalog-list-link:hover .catalog-list-card {
    background: var(--bs-tertiary-bg);
    border-color: var(--app-border-strong) !important;
}

.category-block.hidden,
#fournisseurs.hide-prix .col-prix,
#fournisseurs.hide-mo .col-mo,
#fournisseurs.hide-images .col-image {
    display: none;
}

@media (min-width: 992px) {
    .catalog-index .col-ref {
        width: 140px;
        max-width: 140px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Images et aperçus */
.media-card-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.image-preview {
    display: inline-block;
    overflow: hidden;
    background: var(--bs-secondary-bg);
    border: var(--bs-border-width) solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}

.image-preview img {
    display: block;
    max-width: 220px;
    height: auto;
}

.image-preview:empty {
    display: none;
}

.media-65 {
    display: block;
    width: 65px;
    height: 65px;
    object-fit: cover;
    background: var(--bs-secondary-bg);
    border-radius: var(--bs-border-radius-sm);
}

.media-placeholder {
    background: var(--bs-tertiary-bg);
}

/* Sélecteur commun de produits et d’assemblages */
.catalog-picker-grid,
.listes-selection {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.75rem;
}

.catalog-picker-card,
.selection-item {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    width: 100%;
    height: 88px;
    padding: 0;
    overflow: hidden;
    color: inherit;
    text-align: left;
    background: var(--bs-body-bg);
    border: var(--bs-border-width) solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    position: relative;
    border-left: 3px solid transparent;
}

.catalog-picker-card:hover,
.selection-item:hover {
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-primary);
}

.catalog-picker-card:focus-visible,
.catalog-picker-card.is-selected,
.selection-item.selected,
.selection-item.is-selected,
.selection-item:has(input:checked) {
    outline: 0;
    border-color: var(--bs-primary);
    box-shadow: var(--app-focus-ring);
}

.catalog-picker-card.is-selected,
.selection-item.selected,
.selection-item.is-selected,
.selection-item:has(input:checked) {
    border-left-color: var(--awg-yellow);
    box-shadow: var(--awg-shadow-sm);
}

.catalog-picker-card.is-selected::after,
.selection-item.selected::after,
.selection-item.is-selected::after,
.selection-item:has(input:checked)::after {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 7px;
    height: 7px;
    content: "";
    pointer-events: none;
    background: var(--awg-blue);
}

.catalog-picker-media,
.selection-image {
    height: 88px;
    overflow: hidden;
    background: var(--bs-secondary-bg);
}

.catalog-picker-content,
.selection-content {
    min-width: 0;
    height: 88px;
    overflow: hidden;
}

.catalog-picker-name,
.selection-name {
    display: -webkit-box;
    overflow: hidden;
    font-size: 0.9rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.catalog-picker-reference,
.selection-ref {
    overflow: hidden;
    color: var(--bs-secondary-color);
    font-size: 0.75rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.catalog-picker-type,
.catalog-selection-summary-label {
    color: var(--bs-secondary-color);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.catalog-selection-summary {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    min-height: 112px;
    overflow: hidden;
}

.catalog-selection-summary-media {
    min-height: 112px;
    background: var(--bs-secondary-bg);
}

.catalog-selection-summary-image {
    width: 100%;
    height: 100%;
    min-height: 112px;
    object-fit: cover;
}

/* Systèmes et palette de couleurs */
.system-color-swatch {
    display: inline-block;
    flex: 0 0 25px;
    width: 25px;
    height: 14px;
    background-color: var(--system-color, #fff);
    border: 1px solid var(--system-border, transparent);
    border-radius: 3px;
    vertical-align: middle;
}

.system-color-swatch-lg {
    flex-basis: 32px;
    width: 32px;
    height: 18px;
}

.system-color-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(2.75rem, 1fr));
    gap: 0.65rem;
    width: 100%;
    max-width: 38rem;
}

.system-color-option {
    cursor: pointer;
}

.system-color-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.system-color-option-swatch {
    display: block;
    width: 100%;
    height: 2.5rem;
    background-color: var(--system-color, #fff);
    border: 1px solid var(--system-border, transparent);
    border-radius: var(--awg-radius-sm);
    transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.system-color-option:hover .system-color-option-swatch {
    transform: translateY(-2px);
    box-shadow: var(--awg-shadow-sm);
}

.system-color-option input:checked + .system-color-option-swatch {
    outline: 3px solid var(--awg-blue);
    outline-offset: 3px;
}

.system-card-placeholder {
    display: grid;
    place-items: center;
}

.system-card-placeholder .system-color-swatch {
    width: 3.5rem;
    height: 1.35rem;
    border-radius: var(--awg-radius-sm);
    box-shadow: 0 0 0 0.45rem rgba(255, 255, 255, 0.16);
}

.system-card-meta {
    color: var(--awg-muted);
    font-size: 0.75rem;
}

.system-card-action {
    color: var(--awg-blue);
    font-size: 0.75rem;
    font-weight: 750;
}

.system-color-ffea00 { --system-color: #ffea00; --system-border: #ffea00; }
.system-color-b78103 { --system-color: #b78103; --system-border: #b78103; }
.system-color-ff9100 { --system-color: #ff9100; --system-border: #ff9100; }
.system-color-d84315 { --system-color: #d84315; --system-border: #d84315; }
.system-color-ff8a80 { --system-color: #ff8a80; --system-border: #ff8a80; }
.system-color-d50000 { --system-color: #d50000; --system-border: #d50000; }
.system-color-800020 { --system-color: #800020; --system-border: #800020; }
.system-color-4a000b { --system-color: #4a000b; --system-border: #4a000b; }
.system-color-ff4081 { --system-color: #ff4081; --system-border: #ff4081; }
.system-color-c2185b { --system-color: #c2185b; --system-border: #c2185b; }
.system-color-e040fb { --system-color: #e040fb; --system-border: #e040fb; }
.system-color-aa00ff { --system-color: #aa00ff; --system-border: #aa00ff; }
.system-color-b388ff { --system-color: #b388ff; --system-border: #b388ff; }
.system-color-30005a { --system-color: #30005a; --system-border: #30005a; }
.system-color-38b6ff { --system-color: #38b6ff; --system-border: #38b6ff; }
.system-color-0029ff { --system-color: #0029ff; --system-border: #0029ff; }
.system-color-0072b5 { --system-color: #0072b5; --system-border: #0072b5; }
.system-color-000080 { --system-color: #000080; --system-border: #000080; }
.system-color-00e5ff { --system-color: #00e5ff; --system-border: #00e5ff; }
.system-color-006064 { --system-color: #006064; --system-border: #006064; }
.system-color-80f6d2 { --system-color: #80f6d2; --system-border: #80f6d2; }
.system-color-0a4d3c { --system-color: #0a4d3c; --system-border: #0a4d3c; }
.system-color-00c851 { --system-color: #00c851; --system-border: #00c851; }
.system-color-004225 { --system-color: #004225; --system-border: #004225; }
.system-color-76ff03 { --system-color: #76ff03; --system-border: #76ff03; }
.system-color-365c00 { --system-color: #365c00; --system-border: #365c00; }
.system-color-bcaaa4 { --system-color: #bcaaa4; --system-border: #bcaaa4; }
.system-color-4e342e { --system-color: #4e342e; --system-border: #4e342e; }
.system-color-cfd8dc { --system-color: #cfd8dc; --system-border: #cfd8dc; }
.system-color-37474f { --system-color: #37474f; --system-border: #37474f; }
.system-color-aaaaaa { --system-color: #aaa; --system-border: #aaa; }
.system-color-555555 { --system-color: #555; --system-border: #555; }
.system-color-dddddd { --system-color: #ddd; --system-border: #ddd; }
.system-color-2b2b2b { --system-color: #2b2b2b; --system-border: #2b2b2b; }
.system-color-ffffff { --system-color: #fff; --system-border: #ced4da; }
.system-color-000000 { --system-color: #000; --system-border: #000; }

@media (max-width: 767.98px) {
    .app-page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .app-page-header .btn {
        align-self: flex-start;
    }

    .app-form-card {
        grid-template-columns: 1fr;
    }

    .app-form-media {
        min-height: 10rem;
        grid-row: 1;
    }

    .app-card-horizontal {
        grid-template-columns: 6rem minmax(0, 1fr);
        min-height: 6rem;
    }

    .app-card-media {
        min-height: 6rem;
    }

    .catalog-picker-grid {
        grid-template-columns: 1fr;
    }

    .catalog-picker-card {
        grid-template-columns: 72px minmax(0, 1fr);
        height: 72px;
    }

    .catalog-picker-media,
    .catalog-picker-content {
        height: 72px;
    }

    .catalog-selection-summary {
        grid-template-columns: 96px minmax(0, 1fr);
    }
}

@media (max-width: 600px) {
    .system-color-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 991.98px) {
    .app-navbar-wrap {
        margin-bottom: 1rem;
    }

    .app-navbar .navbar-collapse {
        max-height: calc(100vh - 6rem);
        overflow-y: auto;
        padding: 0.75rem 0.3rem 0.3rem;
    }

    .app-navbar .nav-link.active::after {
        top: 0.45rem;
        right: auto;
        bottom: 0.45rem;
        left: 0;
        width: 3px;
        height: auto;
    }

    .app-navbar-actions {
        align-items: stretch !important;
        gap: 0.55rem;
        padding-top: 0.6rem;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
    }

    .app-user-chip {
        width: max-content;
    }
}

/* Composants partagés du modèle 14AWG : alias sans duplication et familles complémentaires. */
.onglets {
    padding: 0;
    overflow: hidden;
    background: var(--awg-surface);
    border: 1px solid var(--awg-border);
    border-top: 3px solid var(--awg-blue);
    border-radius: var(--awg-radius);
    box-shadow: var(--awg-shadow);
}

.onglets-nav {
    display: flex;
    gap: 0;
        
    flex-wrap: nowrap;
}

.onglets-nav .nav-link {
    flex: 1;
    min-height: 42px;
    padding: 8px 13px;
    border: 0;
    border-right: 1px solid var(--awg-border);
    border-radius: 0;
    color: var(--awg-muted);
    background: transparent;
    font-weight: 750;
    font-family: var(--awg-font-technical);
    font-size: 0.6875rem;
    text-transform: uppercase;

    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
}

.onglets-nav .nav-link.active {
    color: var(--awg-navy);
    background: var(--awg-yellow);
}

.onglets-nav .nav-link.active::before {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 7px;
    content: "";
    background: var(--awg-navy);
    border-radius: 0;
}

.onglets-content {
    padding: 17px 16px 11px;
}

.cadres {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 14px;
}

.entete-principale {
    display: flex;
    min-height: 52px;
    align-items: center;
    color: #fff;
    background: var(--awg-navy);
    border-bottom: 3px solid var(--awg-yellow);
}

.entete-code {
    align-self: stretch;
    display: grid;
    place-items: center;
    color: var(--awg-navy);
    background: var(--awg-yellow);
    font-weight: 900;
        
    flex: 0 0 80px;
    font-family: var(--awg-font-technical);
}

.entete-principale h2,
.entete-principale h3,
.entete-principale input[type="text"] {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.035em;
    text-transform: uppercase;
    font-family: var(--awg-font-technical);
}

.entete-code.position-relative {
    flex-basis: 112px;
    padding: 0.25rem 0.5rem;
}

.entete-code.position-relative::after {
    background: rgb(var(--bs-secondary-rgb));
}

.entete-code input[type="number"] {
    width: 4ch;
    min-height: 0;
    max-width: 7ch;
    appearance: textfield;
    font-family: inherit;
    line-height: inherit;
}

@supports (field-sizing: content) {
    .entete-code input[type="number"] {
        width: auto;
        min-width: 1ch;
        field-sizing: content;
    }
}

.entete-code input[type="number"]::-webkit-inner-spin-button,
.entete-code input[type="number"]::-webkit-outer-spin-button {
    appearance: none;
    margin: 0;
}

.entete-code small {
    font-size: 0.65rem;
}

.entete-total {
    padding: 0 16px;
    font-weight: 850;
}

.entete-secondaire {
    display: flex;
    min-height: 39px;
    align-items: center;
    justify-content: space-between;
    padding: 8px 15px;
    background: var(--awg-surface-soft);
    border-bottom: 1px solid var(--awg-border);
    background-image: linear-gradient(90deg, rgba(0, 111, 185, 0.08), transparent 45%);
}

.entete-secondaire strong,
.entete-secondaire input[type="text"] {
    font-size: 12px;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    font-family: var(--awg-font-technical);
}

.entete-content {
    padding: 14px 15px;
    color: var(--awg-muted);
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--awg-border);
}

.table-search {
    width: 210px;
    padding: 7px 9px;
    color: var(--awg-text);
    background: var(--awg-surface-soft);
    border: 1px solid var(--awg-border);
    border-radius: var(--awg-radius-sm);
    font-family: var(--awg-font-technical);
}

.col-product {
    width: 100%;
    min-width: 260px;
    white-space: normal;
}

.col-small {
    width: 80px;
    text-align: center;
}

.col-medium {
    width: 115px;
}

.col-price {
    width: 120px;
    text-align: right;
}

.price-offer {
    color: var(--awg-blue);
    font-weight: 850;
}

.price-budget {
    color: var(--awg-success);
    font-weight: 850;
}

.price-zero {
    color: var(--awg-danger);
    font-weight: 850;
}

.selection-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    font-size: 10px;
}

.popup-close {
    padding: 0 5px;
    color: #fff;
    background: transparent;
    border: 0;
    font-size: 22px;
}

.popup-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 16px;
}

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

.field label,
.app-form-body .form-label,
.app-form-card .form-label,
.formulaires-popup .form-label {
    display: block;
    margin-bottom: 5px;
    font-size: 11px;
    font-weight: 750;
    font-family: var(--awg-font-technical);
    text-transform: uppercase;
}

.field input,
        .field select,
        .field textarea {
    width: 100%;
    min-height: 38px;
    padding: 8px 9px;
    color: var(--awg-text);
    background: #fff;
    border: 1px solid var(--awg-border);
    border-radius: 1px;
}

.field input:focus,
        .field select:focus,
        .field textarea:focus {
    outline: 3px solid rgba(0,111,185,0.12);
    border-color: var(--awg-blue);
}

.field textarea {
    min-height: 65px;
    resize: vertical;
}

.index-header h3 {
    margin: 0;
    font-size: 16px;
    font-family: var(--awg-font-technical);
}

.index-row {
    display: grid;
    grid-template-columns: 44px minmax(220px, 1.6fr) minmax(150px, 1fr) 110px 90px;
    align-items: center;
    gap: 12px;
    padding: 11px 15px 11px 20px;
    position: relative;
    border-bottom: 1px solid var(--awg-border);
}

.index-row::before {
    position: absolute;
    left: 8px;
    width: 4px;
    height: 4px;
    background: var(--awg-blue);
    content: "";
}

.index-row:last-child {
    border-bottom: 0;
}

.index-row:hover {
    background: var(--awg-surface-soft);
}

.index-id {
    color: var(--awg-blue);
    font-size: 11px;
    font-weight: 850;
}

.index-title {
    font-weight: 780;
}

.index-meta {
    color: var(--awg-muted);
    font-size: 11px;
}

.index-actions {
    text-align: right;
}

.resume-header {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 20px;
    padding: 17px 18px;
    color: #fff;
    background:
        linear-gradient(120deg, var(--awg-navy), var(--awg-navy-light));
}

.resume-header h3 {
    margin: 0 0 3px;
    font-size: 15px;
    font-family: var(--awg-font-technical);
}

.resume-header h2,
.resume-header h4,
.resume-header h5,
.resume-header h6 {
    font-family: var(--awg-font-technical);
}

.resume-header small {
    color: #b8c5d1;
}

.resume-total {
    color: var(--awg-yellow);
    font-size: 1.4em;
    font-weight: 900;
    letter-spacing: -0.025em;
    font-family: var(--awg-font-technical);
}

.resume-body {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

.resume-column {
    padding: 16px 18px;
}

.resume-column + .resume-column {
    border-left: 1px solid var(--awg-border);
}

.resume-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 20px;
    padding: 7px 0;
    border-bottom: 1px solid var(--awg-border);
}

.resume-line:last-child {
    border-bottom: 0;
}

.resume-line span {
    color: var(--awg-muted);
}

.resume-line strong {
    white-space: nowrap;
}

.resume-footer {
    padding: 13px 18px;
    background: linear-gradient(90deg, var(--awg-yellow-soft), var(--awg-surface));
    border-top: 1px solid var(--awg-border);
}

.resume-footer .resume-line {
    padding: 0;
    border: 0;
    font-size: 17px;
}



.onglets-nav .nav-link:focus-visible {
    outline: 0;
    box-shadow: var(--app-focus-ring);
}
.tableaux table {
    width: 100%;
    border-collapse: collapse;
}
.tableaux th,
.tableaux td,
.catalog-index th,
.catalog-index td {
    padding: 9px 11px;
    border-bottom: 1px solid var(--awg-border);
    vertical-align: middle;
    border-right: 1px solid rgba(184, 197, 206, 0.55);
}
.tableaux th,
.catalog-index th {
    color: #fff;
    background: var(--awg-blue-dark);
    font-size: 0.7rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    font-family: var(--awg-font-technical);
    --bs-table-color: #fff;
    --bs-table-bg: var(--awg-blue-dark);
}
.tableaux tbody tr:last-child > td {
    border-bottom: 0;
}
.tableaux [data-notes-for] > .col-product > .d-flex {
    position: relative;
    margin-top: -8px;
}
.tableaux [data-notes-for] .line-commentaire {
    min-height: 0;
    padding-block: 0;
}
@media (min-width: 576px) {
    .tableaux [data-notes-for] > .col-product > .d-flex {
        margin-top: -12px;
    }
}
.tableaux .col-small {
    flex-shrink: 0;
}
.tableaux .col-medium {
    flex-shrink: 0;
}
.entetes-sections > .entete-principale {
    border-radius: var(--awg-radius) var(--awg-radius) 0 0;
}
.entetes-sections .popup-actions {
    border-radius: 0 0 var(--awg-radius) var(--awg-radius);
}
.selection-content {
    padding: 10px;
}
.selection-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.selection-item .selection-image {
    display: block;
    min-width: 0;
}
.popup-header h2,
.popup-header h3 {
    margin: 0;
    font-size: 1rem;
    font-family: var(--awg-font-technical);
    text-transform: uppercase;
}
.index-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.popup-visual {
    display: grid;
    place-items: center;
}
@media (max-width: 900px) {
    .cadres { grid-template-columns: 1fr; }
    .index-row { grid-template-columns: 44px minmax(0, 1fr) 110px; }
    .index-client, .index-actions { display: none; }
}
@media (max-width: 650px) {
    .onglets-nav { overflow-x: auto; }
    .onglets-nav .nav-link { flex: 0 0 auto; }
    .cadre-avec-image { grid-template-columns: 96px minmax(0, 1fr); }
    .formulaires-popup { grid-template-columns: minmax(0, 1fr); }
    .formulaires-popup > .popup-visual { display: none; }
    .popup-body, .resume-body { grid-template-columns: minmax(0, 1fr); }
    .resume-column + .resume-column { border-top: 1px solid var(--awg-border); border-left: 0; }
    .resume-header { grid-template-columns: minmax(0, 1fr); }
    .index-row { grid-template-columns: 38px minmax(0, 1fr); }
    .index-status { display: none; }
}


/* Tables de documents existantes : conserver la répartition de leurs colonnes
   quand une vue utilise uniquement la feuille générale. */
.previsionnel-mo-table,
.assemblage-subtable {
    table-layout: fixed;
    width: 100%;
}

.public-detail-lines-table th,
.public-detail-lines-table td {
    padding-left: 16px;
    padding-right: 16px;
}

.public-detail-lines-table th.public-detail-coeff-cell,
.public-detail-lines-table td.public-detail-coeff-cell {
    width: 6%;
    min-width: 58px;
    white-space: nowrap;
    text-align: left !important;
    padding-right: 2px !important;
}

.public-detail-lines-table th:nth-child(5),
.public-detail-lines-table td:nth-child(5) {
    width: 12%;
    padding-left: 2px !important;
}
