:root {
    --es-primary: #2563eb;
    --es-primary-dark: #1d4ed8;
    --es-sidebar: #0f172a;
    --es-sidebar-soft: #1e293b;
    --es-canvas: #f4f7fb;
    --es-surface: #ffffff;
    --es-border: #e2e8f0;
    --es-text: #172033;
    --es-muted: #64748b;
    --es-success: #15803d;
    --es-warning: #b45309;
    --es-danger: #b91c1c;
    --es-radius: 12px;
    --es-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--es-canvas); color: var(--es-text); font-family: Inter, "Segoe UI", sans-serif; }
.app-shell { min-height: 100vh; display: flex; }
.sidebar-nav { width: 300px; min-width: 300px; height: 100vh; overflow-y: auto; position: sticky; top: 0; background: var(--es-sidebar); padding: 20px 14px; z-index: 1040; }
.app-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; color: #fff; text-decoration: none; }
.app-brand-mark { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg, #3b82f6, #1d4ed8); box-shadow: 0 8px 20px rgba(37,99,235,.28); }
.app-brand strong { display: block; font-size: 1.08rem; letter-spacing: .01em; }
.app-brand small { display: block; color: #94a3b8; font-size: .875rem; }
.sidebar-company { margin: 0 8px 18px; padding: 10px 12px; border: 1px solid rgba(148,163,184,.18); border-radius: 10px; color: #cbd5e1; font-size: .875rem; }
.sidebar-company strong { display: block; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-nav .nav { gap: 3px; }
.sidebar-nav .nav-link, .sidebar-nav summary { color: #cbd5e1 !important; border-radius: 9px; padding: 9px 11px; font-size: .9375rem; text-decoration: none; transition: .18s ease; font-weight: 700; }
.sidebar-nav .nav-link:hover, .sidebar-nav summary:hover { color: #fff !important; background: rgba(148,163,184,.12); }
.sidebar-nav .nav-link.active { color: #fff !important; background: var(--es-primary); box-shadow: 0 6px 14px rgba(37,99,235,.2); }
.sidebar-nav summary { cursor: pointer; list-style: none; display: flex; align-items: center; }
.sidebar-nav summary::-webkit-details-marker { display: none; }
.sidebar-nav summary::after { content: "\f078"; font-family: "Font Awesome 5 Free"; font-weight: 900; font-size: .875rem; margin-left: auto; transition: transform .2s ease; }
.sidebar-nav details[open] > summary::after { transform: rotate(180deg); }
.sidebar-nav details[open] > summary { color: #fff !important; background: rgba(148,163,184,.09); }
.sidebar-nav details ul { border-left: 1px solid rgba(148,163,184,.18); margin: 5px 0 7px 20px !important; padding-left: 7px; }
.sidebar-nav details ul .nav-link { font-size: .9375rem; padding: 7px 10px; font-weight: 700; }
.sidebar-section-label, .nav-section-label { color: #64748b; font-size: .875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; padding: 12px 10px 4px; list-style: none; }
.app-main { min-width: 0; flex: 1; }
.app-topbar { height: 68px; position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--es-border); backdrop-filter: blur(12px); }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--es-primary); background: #dbeafe; }
.topbar-user small { display: block; color: var(--es-muted); line-height: 1.1; }
.topbar-user strong { font-size: .9375rem; }
.sidebar-toggle { display: none; border: 0; background: transparent; color: var(--es-text); font-size: 1.15rem; }
.app-content { padding: 26px 30px 42px; max-width: 1600px; margin: 0 auto; }
.page-header, .app-content > .d-flex.border-bottom { border: 0 !important; padding: 0 0 18px !important; margin-bottom: 20px !important; }
.page-header h1, .app-content h1.h2, .app-content > h1, .app-content > h2 { color: #0f172a; font-weight: 700; font-size: 1.55rem; letter-spacing: -.02em; }
.page-subtitle { color: var(--es-muted); margin: 4px 0 0; }
.card { border: 1px solid var(--es-border); border-radius: var(--es-radius); box-shadow: var(--es-shadow); overflow: visible; }
.card-header { padding: 14px 18px; background: #fff; border-bottom: 1px solid var(--es-border); border-radius: var(--es-radius) var(--es-radius) 0 0 !important; }
.card-body { padding: 18px; }
.table-responsive { border-radius: 10px; }
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table thead th { padding: 11px 12px; background: #f8fafc; border-bottom: 1px solid var(--es-border); color: #475569; font-size: .875rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.table tbody td { padding: 12px; border-color: #edf2f7; vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8fbff; }
.form-label, .form-group > label { color: #334155; font-size: .9375rem; font-weight: 600; margin-bottom: 6px; }
.form-control, .form-select, .select2-container--bootstrap-5 .select2-selection { border-color: #cbd5e1; border-radius: 9px; min-height: 42px; }
.form-control:focus, .form-select:focus { border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-group { margin-bottom: 16px; }
.btn { border-radius: 8px; font-weight: 600; font-size: .9375rem; padding: .55rem .85rem; }
.btn-sm { padding: .38rem .62rem; font-size: .875rem; }
.btn-primary { background: var(--es-primary); border-color: var(--es-primary); }
.btn-primary:hover { background: var(--es-primary-dark); border-color: var(--es-primary-dark); }
.alert { border: 1px solid transparent; border-radius: 10px; box-shadow: none; }
.alert-info { color: #1e40af; background: #eff6ff; border-color: #bfdbfe; }
.alert-warning { color: #92400e; background: #fffbeb; border-color: #fde68a; }
.alert-success { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }
.alert-danger { color: #991b1b; background: #fef2f2; border-color: #fecaca; }
.badge { border-radius: 999px; padding: .42em .7em; font-weight: 700; }
.badge-success { background-color: #198754 !important; color: #fff !important; }
.badge-warning { background-color: #ffc107 !important; color: #212529 !important; }
.badge-danger { background-color: #dc3545 !important; color: #fff !important; }
.badge-secondary { background-color: #6c757d !important; color: #fff !important; }
.badge-info { background-color: #0dcaf0 !important; color: #000 !important; }
.badge-success, .badge-warning, .badge-danger, .badge-secondary, .badge-info { display: inline-block; padding: .42em .7em; border-radius: 999px; font-size: .75em; font-weight: 700; line-height: 1; }
.stock-context-card { background: linear-gradient(90deg, #eff6ff, #fff); }
.stock-context-card .card-body { padding: 11px 16px; }
.dataTables_wrapper .dataTables_filter input, .dataTables_wrapper .dataTables_length select { border: 1px solid #cbd5e1; border-radius: 8px; padding: 6px 9px; }
.pagination .page-link { color: var(--es-primary); border-color: var(--es-border); }
.sidebar-overlay { display: none; }
.platform-nav { min-height: 68px; padding: 0 28px; background: var(--es-sidebar); box-shadow: 0 5px 20px rgba(15,23,42,.12); }
.platform-nav .navbar-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; }
.platform-nav .app-brand-mark { width: 36px; height: 36px; }
.platform-main { width: min(1400px, calc(100% - 32px)); margin: 0 auto; padding: 30px 0 50px; }

/* Point de vente */
.pos-shell { --pos-ink: #10233f; --pos-soft: #f4f7fb; --pos-line: #dfe7f1; padding: 14px 0 30px; }
.pos-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 14px; }
.pos-header h1 { margin: 0; color: var(--pos-ink); font-size: 1.65rem; font-weight: 800; letter-spacing: -.03em; }
.pos-header p { margin: 2px 0 0; color: var(--es-muted); font-size: .9375rem; }
.pos-kicker { display: block; margin-bottom: 2px; color: var(--es-primary); font-size: .875rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.pos-context { display: grid; grid-template-columns: minmax(280px, 1.55fr) minmax(150px, .55fr) minmax(230px, .9fr); gap: 14px; margin-bottom: 14px; padding: 14px 16px; border: 1px solid var(--pos-line); border-radius: 14px; background: #fff; box-shadow: 0 8px 24px rgba(15, 35, 65, .06); }
.pos-field label, .pos-product-grid label, .pos-summary-card label { display: block; margin-bottom: 5px; color: #526177; font-size: .9375rem; font-weight: 750; text-transform: uppercase; letter-spacing: .035em; }
.pos-context .select2-container { width: 100% !important; }
.pos-workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.pos-main { min-width: 0; display: grid; gap: 14px; }
.pos-card, .pos-summary-card { border: 1px solid var(--pos-line); border-radius: 14px; background: #fff; box-shadow: 0 8px 24px rgba(15, 35, 65, .06); }
.pos-card { padding: 16px; }
.pos-card-title { min-height: 28px; display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; color: var(--pos-ink); }
.pos-card-title > div { display: flex; align-items: center; gap: 9px; }
.pos-card-title strong { font-size: .9375rem; }
.pos-card-title small { color: var(--es-muted); font-size: .875rem; }
.pos-step { min-width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 8px; color: #fff; background: var(--es-primary); font-size: .9375rem; font-weight: 800; }
.pos-product-grid { display: grid; grid-template-columns: minmax(260px, 1fr) 105px 140px 110px; gap: 10px; align-items: end; }
.pos-product-grid .select2-container { width: 100% !important; }
.pos-product-grid > .btn { min-height: 38px; }
.pos-counter { padding: 5px 10px; border-radius: 999px; color: #315780; background: #edf5ff; font-size: .875rem; }
.pos-cart-table-wrap { height: clamp(270px, calc(100vh - 405px), 520px); overflow: auto; border: 1px solid #edf1f6; border-radius: 10px; }
.pos-cart-table-wrap thead { position: sticky; top: 0; z-index: 2; background: #f8fafc; box-shadow: 0 1px 0 var(--pos-line); }
.pos-cart-table-wrap th { padding: 11px 12px; color: #5b687b; font-size: .875rem; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.pos-cart-table-wrap td { padding: 12px; }
.pos-summary { position: sticky; top: 82px; }
.pos-summary-card { padding: 17px; }
.pos-payment-button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid #bfdbfe; border-radius: 11px; color: #183a66; background: #f3f8ff; text-align: left; }
.pos-payment-button:hover { border-color: #74aaf0; background: #eaf3ff; }
.pos-payment-button span strong, .pos-payment-button span small { display: block; }
.pos-payment-button span small { max-width: 225px; overflow: hidden; color: #64748b; font-size: .875rem; text-overflow: ellipsis; white-space: nowrap; }
.pos-payment-icon { width: 34px; height: 34px; display: grid !important; place-items: center; flex: 0 0 auto; border-radius: 9px; color: #fff; background: var(--es-primary); }
.pos-payment-progress { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 9px; }
.pos-payment-progress > div { padding: 9px 10px; border-radius: 9px; background: var(--pos-soft); }
.pos-payment-progress span, .pos-payment-progress strong { display: block; }
.pos-payment-progress span { color: #6b778a; font-size: .875rem; text-transform: uppercase; }
.pos-payment-progress strong { margin-top: 2px; color: var(--pos-ink); font-size: .9375rem; }
.pos-total { margin: 16px 0 12px; padding: 16px; border-radius: 12px; color: #fff; background: linear-gradient(135deg, #10233f, #1f4d7a); }
.pos-total > span { display: block; color: #b9cae0; font-size: .875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.pos-total > strong { display: flex; align-items: baseline; gap: 7px; margin-top: 3px; font-size: 2rem; letter-spacing: -.04em; }
.pos-total small { font-size: .9375rem; color: #cfe1f6; }
.pos-audit-note { display: flex; gap: 7px; margin: 10px 0 0; color: #728096; font-size: .875rem; line-height: 1.35; }
.pos-checkout-bar { position: sticky; bottom: 12px; z-index: 20; display: grid; grid-template-columns: minmax(120px, .55fr) minmax(180px, .7fr) auto; align-items: center; gap: 18px; margin-top: 14px; padding: 12px 14px 12px 18px; border: 1px solid #c9d8ea; border-radius: 14px; background: rgba(255,255,255,.96); box-shadow: 0 14px 35px rgba(15,35,65,.17); backdrop-filter: blur(12px); }
.pos-checkout-bar > div span, .pos-checkout-bar > div strong { display: block; }
.pos-checkout-bar > div span { color: #78869a; font-size: .875rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.pos-checkout-bar > div strong { color: var(--pos-ink); font-size: .9375rem; }
.pos-checkout-bar .pos-checkout-amount strong { color: var(--es-primary-dark); font-size: 1.25rem; }
.pos-modal-total { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; padding: 14px 16px; border-radius: 11px; color: #fff; background: linear-gradient(135deg, #10233f, #1f4d7a); }
.pos-modal-total span { color: #c6d6e8; font-size: .875rem; text-transform: uppercase; letter-spacing: .06em; }
.pos-modal-total strong { font-size: 1.45rem; }

.sales-eyebrow { display: block; margin-bottom: 3px; color: var(--es-primary); font-size: .875rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.sale-card { border: 0; background: transparent; box-shadow: none; }
.sale-card > .card-body { padding: 0; }
.sale-mode-info { margin-bottom: 18px; padding: 14px 16px; border: 1px solid #bfdbfe; border-radius: 12px; background: linear-gradient(90deg, #eff6ff, #fff); }
.sale-mode-info > div { display: flex; align-items: center; gap: 12px; }
.sale-mode-info small, .sale-accounting-note small, .sale-panel-title small { display: block; color: var(--es-muted); font-size: .875rem; font-weight: 400; }
.sale-mode-icon { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; color: var(--es-primary); background: #dbeafe; }
.sale-form-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .75fr); gap: 18px; align-items: start; }
.sale-form-grid > .alert-danger { grid-column: 1 / -1; }
.sale-customer-panel, .sale-product-panel, .sale-cart-panel, .sale-accounting-note, .sale-checkout-panel { margin: 0 !important; padding: 18px; border: 1px solid var(--es-border); border-radius: var(--es-radius); background: #fff; box-shadow: var(--es-shadow); }
.sale-product-panel { grid-column: 1; grid-row: 1; }
.sale-cart-panel { grid-column: 1; grid-row: 2 / span 3; }
.sale-customer-panel { grid-column: 2; grid-row: 1; }
.sale-accounting-note { grid-column: 2; grid-row: 2; display: flex; gap: 10px; color: #1e40af; background: #eff6ff; border-color: #bfdbfe; box-shadow: none; }
.sale-checkout-panel { grid-column: 2; grid-row: 3; position: sticky; top: 86px; }
.sale-panel-title { display: flex; align-items: center; gap: 10px; margin-bottom: 17px; }
.sale-panel-title > span { width: 29px; height: 29px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: #fff; background: var(--es-primary); font-size: .9375rem; font-weight: 800; }
.sale-panel-title h5 { margin: 0; color: #0f172a; font-size: .98rem; font-weight: 750; }
.sale-product-panel > .col-md-12 { padding: 0; }
.sale-cart-panel > .col-md-12 { padding: 0; }
.sale-cart-table tfoot td { border-top: 2px solid var(--es-border); background: #f8fafc; font-size: .9375rem; }
.sale-cart-table #total_facture { color: var(--es-primary-dark); font-size: 1.05rem; }
.sale-product-panel .select2-container, .sale-customer-panel .select2-container { width: 100% !important; }
.sale-cart-scroll { max-height: calc(100vh - 430px); min-height: 210px; overflow: auto; }
.sale-cart-scroll thead { position: sticky; top: 0; z-index: 2; background: #fff; box-shadow: 0 1px 0 var(--es-border); }
.sale-checkout-compact { background: linear-gradient(180deg, #fff, #f8fafc); }
@media (min-width: 1200px) {
    .sale-workspace-side { position: sticky; top: 82px; align-self: flex-start; }
    .sale-workspace-side .sale-customer-panel { max-height: calc(100vh - 100px); overflow-y: auto; }
}
.sale-empty-cart td { padding: 42px 16px !important; color: var(--es-muted); text-align: center; }
.sale-total-box { margin: 4px 0 16px; padding: 16px; border-radius: 10px; background: #0f172a; color: #fff; }
.sale-total-box span { display: block; color: #94a3b8; font-size: .875rem; }
.sale-total-box strong { display: block; margin-top: 2px; font-size: 1.65rem; letter-spacing: -.03em; }
.sale-total-box strong span { display: inline; color: inherit; font-size: inherit; }
#quickClientErrors { white-space: pre-line; }
.quick-client-errors { white-space: pre-line; }
.sales-order-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .72fr); gap: 18px; align-items: start; }
.sales-order-main, .sales-order-side { display: grid; gap: 18px; }
.order-panel { padding: 18px; border: 1px solid var(--es-border); border-radius: var(--es-radius); background: #fff; box-shadow: var(--es-shadow); }
.order-checkout-panel { position: sticky; top: 86px; }
.order-checkout-panel .sale-total-box strong { font-size: 1.65rem; }
.generated-reference { min-height: 42px; display: flex; align-items: center; padding: 9px 12px; border: 1px dashed #93c5fd; border-radius: 9px; color: #1e40af; background: #eff6ff; font-size: .9375rem; font-weight: 700; }

@media (max-width: 1199.98px) {
    .pos-workspace { grid-template-columns: minmax(0, 1fr); }
    .pos-product-grid { grid-template-columns: minmax(220px, 1fr) 95px 125px 100px; }
    .sales-order-grid { grid-template-columns: 1fr; }
    .order-checkout-panel { position: static; }
}

@media (max-width: 1199.98px) {
    .sale-form-grid { grid-template-columns: 1fr; }
    .sale-product-panel, .sale-cart-panel, .sale-customer-panel, .sale-accounting-note, .sale-checkout-panel { grid-column: 1; grid-row: auto; }
    .sale-customer-panel { order: -1; }
    .sale-checkout-panel { position: static; }
    .sale-cart-scroll { max-height: 420px; }
}

@media (max-width: 991.98px) {
    .pos-context { grid-template-columns: 1fr 1fr; }
    .pos-client-field { grid-column: 1 / -1; }
    .pos-workspace { grid-template-columns: 1fr; }
    .pos-summary { position: static; }
    .pos-cart-table-wrap { height: 360px; }
    .sidebar-nav { position: fixed; left: -320px; transition: left .22s ease; }
    body.sidebar-open .sidebar-nav { left: 0; }
    .sidebar-overlay { position: fixed; inset: 0; z-index: 1030; background: rgba(15,23,42,.5); }
    body.sidebar-open .sidebar-overlay { display: block; }
    .sidebar-toggle { display: inline-grid; }
    .app-topbar { padding: 0 16px; }
    .app-content { padding: 20px 15px 35px; }
}

@media (max-width: 575.98px) {
    .pos-header { align-items: flex-start; flex-direction: column; }
    .pos-header > .d-flex { width: 100%; }
    .pos-header > .d-flex .btn { flex: 1; font-size: .9375rem; }
    .pos-context { grid-template-columns: 1fr; padding: 12px; }
    .pos-client-field { grid-column: auto; }
    .pos-card, .pos-summary-card { padding: 12px; }
    .pos-product-grid { grid-template-columns: 1fr 1fr; }
    .pos-product-grid > div:first-child { grid-column: 1 / -1; }
    .pos-product-grid > .btn { grid-column: 1 / -1; }
    .pos-cart-table-wrap { height: 310px; }
    .pos-checkout-bar { bottom: 6px; grid-template-columns: 1fr auto; gap: 9px; padding: 10px; }
    .pos-checkout-bar > div:first-child { display: none; }
    .pos-checkout-bar .btn { padding-left: 12px; padding-right: 12px; font-size: .9375rem; }
    .topbar-user small { display: none; }
    .app-content > .d-flex.justify-content-between,
    .app-content > .container-fluid > .d-flex.justify-content-between { align-items: flex-start !important; gap: 12px; flex-direction: column; }
    .sale-mode-info { align-items: flex-start !important; flex-direction: column; }
    .sale-customer-panel, .sale-product-panel, .sale-cart-panel, .sale-accounting-note, .sale-checkout-panel { padding: 14px; }
}

/* Interface commune : hiérarchie, confort de lecture et navigation accessible. */
:root { --es-primary: #315be8; --es-primary-dark: #2447bd; --es-canvas: #f5f6fa; --es-shadow: 0 2px 8px rgba(20,32,58,.035); --es-radius: 14px; }
body { font-size: 1rem; line-height: 1.6; }
:focus-visible { outline: 3px solid #7597ff; outline-offset: 3px; }
[hidden] { display: none !important; }
.skip-link { position: fixed; left: 16px; top: -100px; z-index: 1100; background: #fff; padding: 12px 20px; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.sidebar-nav { background: #142039; padding: 26px 16px; scrollbar-width: thin; scrollbar-color: #495773 transparent; }
.app-brand { padding-bottom: 26px; }
.app-brand-mark { background: #4167ed; box-shadow: none; }
.sidebar-company { background: #1e2c46; border: 1px solid #34425c; margin-inline: 0; padding: 13px; }
.sidebar-company strong { margin-top: 4px; font-weight: 600; }
.sidebar-search { display: flex; align-items: center; gap: 9px; border: 1px solid #46536b; border-radius: 9px; padding: 10px; color: #b8c5dc; }
.sidebar-search:focus-within { border-color: #8ca7ff; box-shadow: 0 0 0 2px #4167ed; }
.sidebar-search input { min-width: 0; width: 100%; background: transparent; border: 0; color: #fff; font: inherit; font-size: .9375rem; outline: none; }
.sidebar-search input::placeholder { color: #b8c5dc; }
.sidebar-empty { color: #cbd5e1; padding: 14px 10px; font-size: .9375rem; }
.sidebar-section-label, .nav-section-label { color: #a5b3cb; padding-top: 22px; padding-bottom: 9px; }
.sidebar-nav .nav-link, .sidebar-nav summary { font-size: 1rem; min-height: 46px; padding-block: 11px; font-weight: 700; }
.sidebar-nav .nav-link.active { background: #365ee5; box-shadow: none; }
.sidebar-nav summary > i, .sidebar-nav > .nav > li > a > i { width: 20px; text-align: center; }
.sidebar-close { display: none; }
.app-topbar { height: 76px; background: #fff; backdrop-filter: none; }
.app-content { padding: 32px clamp(20px, 3vw, 48px) 48px; }
.topbar-user small { font-size: .875rem; margin-bottom: 3px; }
.topbar-user strong { overflow-wrap: anywhere; }
.card-header { padding: 17px 20px; font-weight: 600; }
.card-body { padding: 22px; }
.table tbody td { padding-block: 16px; font-size: .9375rem; }
.table thead th { padding-block: 14px; font-size: .875rem; }
.form-control, .form-select { font-size: 1rem; min-height: 48px; padding: .65rem .8rem; }
.form-control::placeholder { color: #778396; }
.btn { font-size: .9375rem; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.btn-sm { min-height: 40px; font-size: .875rem; }
.btn-primary { --bs-btn-active-bg: #2447bd; --bs-btn-active-border-color: #2447bd; }
.pagination .active > .page-link { background: var(--es-primary); color: #fff; }
.workspace-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.workspace-eyebrow { display: block; text-transform: uppercase; font-size: .875rem; font-weight: 700; letter-spacing: .12em; color: var(--es-primary); margin-bottom: 9px; }
.workspace-heading h1 { font-size: clamp(1.5rem, 2.5vw, 2rem); font-weight: 700; letter-spacing: -.04em; margin-bottom: 7px; }
.workspace-heading p, .workspace-section-heading p { color: #627087; margin: 0; }
.workspace-date { display: flex; gap: 9px; align-items: center; flex-shrink: 0; color: #526079; font-size: .875rem; background: #fff; border: 1px solid var(--es-border); padding: 9px 13px; border-radius: 8px; }
.workspace-banner { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 32px 36px; border: 1px solid #d9e2fb; border-radius: 18px; background: #ebf0ff; margin-bottom: 34px; }
.workspace-banner h2 { font-size: clamp(1.6rem, 2.7vw, 2.2rem); font-weight: 700; line-height: 1.22; letter-spacing: -.035em; color: #172c5a; }
.workspace-banner p { max-width: 510px; margin: 14px 0 0; color: #52658a; }
.workspace-banner-symbol { flex-shrink: 0; width: 130px; height: 130px; display: grid; place-items: center; background: #dfe7ff; color: #496ce0; border-radius: 30px; font-size: 3.6rem; transform: rotate(-8deg); margin-right: 18px; }
.workspace-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 20px; }
.workspace-section-heading h2 { font-weight: 700; font-size: 1.15rem; margin-bottom: 5px; }
.workspace-section-heading p { font-size: .9375rem; }
.workspace-pill { color: #5a667d; background: #e9edf4; font-size: .875rem; padding: 6px 11px; border-radius: 20px; white-space: nowrap; }
.workspace-modules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.workspace-module { display: flex; flex-direction: column; padding: 24px; border: 1px solid var(--es-border); border-radius: 14px; background: #fff; text-decoration: none; color: var(--es-text); transition: border-color .15s, box-shadow .15s, transform .15s; }
.workspace-module:hover { color: var(--es-text); border-color: #a7b9f8; box-shadow: 0 8px 22px #263f7710; transform: translateY(-3px); }
.module-icon { width: 45px; height: 45px; display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 12px; background: #edf1ff; color: #3658bf; font-size: 1.15rem; }
.module-icon-green { background: #e7f5ee; color: #237951; }
.module-icon-orange { background: #fff1e4; color: #aa621b; }
.module-icon-purple { background: #f0eaff; color: #7954bd; }
.workspace-module h3 { margin: 19px 0 8px; font-size: 1.15rem; font-weight: 700; }
.workspace-module p { margin: 0 0 22px; color: #66738a; font-size: .9375rem; }
.module-link { margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding-top: 15px; border-top: 1px solid #eef1f6; color: var(--es-primary); font-size: .9375rem; font-weight: 600; }
.workspace-tip { display: flex; align-items: center; gap: 15px; padding: 22px 0; margin-top: 14px; }
.workspace-tip strong { font-size: .9375rem; }
.workspace-tip p { color: #627087; font-size: .875rem; margin: 3px 0 0; }
.workspace-empty { grid-column: 1 / -1; background: #fff; border: 1px dashed #c4cfdf; padding: 28px; border-radius: 14px; }
@media (max-width: 1199.98px) { .workspace-modules { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 991.98px) {
    body.sidebar-open { overflow: hidden; }
    .sidebar-nav { min-width: 0; height: 100dvh; padding-top: 24px; max-width: calc(100vw - 36px); }
    .sidebar-close { display: grid; place-items: center; position: absolute; right: 10px; top: 8px; width: 32px; height: 32px; border: 0; border-radius: 6px; color: #fff; background: #293954; }
    .sidebar-toggle { place-items: center; width: 40px; height: 40px; }
    .app-content { padding: 24px 20px; }
}
@media (max-width: 575.98px) {
    .workspace-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
    .workspace-banner { padding: 24px; }
    .workspace-banner-symbol { display: none; }
    .workspace-section-heading { align-items: flex-start; flex-direction: column; }
    .workspace-modules { grid-template-columns: 1fr; gap: 12px; }
    .workspace-module { padding: 20px; }
    .app-topbar { gap: 12px; padding-inline: 10px; }
    .topbar-avatar { display: none; }
    .topbar-user strong { font-size: .9375rem; }
    .workspace-tip { align-items: flex-start; }
    .page-header { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
@media print { .sidebar-nav, .app-topbar, .sidebar-overlay, .skip-link { display: none !important; } .app-content { padding: 0; max-width: none; } .app-shell { display: block; } body { background: #fff; } }

.login-page { background: #fff; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-intro { display: flex; flex-direction: column; justify-content: space-between; gap: 60px; background: #142039; color: #fff; padding: clamp(32px, 5vw, 80px); }
.login-brand { display: flex; align-items: center; gap: 12px; color: #fff; font-size: 1.3rem; font-weight: 700; text-decoration: none; }
.login-brand-mark { display: grid; place-items: center; background: #4167ed; width: 42px; height: 42px; border-radius: 12px; }
.login-intro .workspace-eyebrow { color: #a5baff; }
.login-intro h1 { font-size: clamp(2.5rem, 5vw, 4.6rem); line-height: 1.12; font-weight: 650; letter-spacing: -.05em; }
.login-intro p { color: #bdc9dc; max-width: 380px; margin-top: 24px; font-size: 1rem; }
.login-intro-footer { color: #a6b6ce; font-size: .875rem; }
.login-form-panel { display: grid; place-items: center; padding: 40px 28px; }
.login-form-wrap { width: 100%; max-width: 390px; }
.login-form-wrap h2 { font-weight: 700; font-size: 2rem; letter-spacing: -.035em; }
.login-description { color: #64748b; margin: 12px 0 32px; }
.login-password { position: relative; }
.login-password input { padding-right: 100px; }
.login-password button { position: absolute; inset: 4px 4px 4px auto; border: 0; background: #f1f4fa; color: #3154b4; border-radius: 6px; padding: 0 10px; font-size: .875rem; font-weight: 600; }
.login-submit { justify-content: space-between; min-height: 48px; }
.login-help { color: #64748b; font-size: .875rem; text-align: center; margin: 28px 0 0; }
@media (max-width: 767.98px) { .login-shell { grid-template-columns: 1fr; } .login-intro { padding: 24px; gap: 24px; } .login-intro h1 { font-size: 2rem; } .login-intro h1 br { display: none; } .login-intro h1 br::after { content: ' '; } .login-intro p, .login-intro-footer { display: none; } .login-form-panel { padding: 32px 24px; } }

/* Adaptation à la largeur réellement disponible, y compris avec le menu latéral. */
.app-main { container-type: inline-size; container-name: workspace; }
.app-content, .platform-main { overflow-wrap: anywhere; }
.app-content .row > *, .platform-main .row > *,
.pos-context > *, .pos-product-grid > *, .sale-form-grid > *,
.sales-order-grid > *, .workspace-modules > *, .login-shell > * { min-width: 0; }
.app-brand-mark, .topbar-avatar, .sidebar-toggle { flex-shrink: 0; }
.app-topbar { min-height: 76px; height: auto; padding-block: 10px; gap: 12px; }
.app-topbar > .d-flex, .topbar-user, .topbar-user > span:last-child { min-width: 0; }
.app-topbar > form { flex-shrink: 0; }
.topbar-user strong { display: block; }
.table-responsive { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.table-responsive > table { width: 100%; }
.select2-container { max-width: 100%; }
.select2-container--bootstrap-5 .select2-selection { font-size: 1rem; }
.page-header, .pos-header, .workspace-heading, .workspace-section-heading,
.app-content > .d-flex.justify-content-between,
.app-content > .container-fluid > .d-flex.justify-content-between { flex-wrap: wrap; gap: 16px; }
.page-header .d-flex, .pos-header > .d-flex,
.app-content > .d-flex.justify-content-between > .d-flex,
.app-content > .container-fluid > .d-flex.justify-content-between > .d-flex { flex-wrap: wrap; }
.btn { white-space: normal; }
.pos-card-title, .pos-modal-total { flex-wrap: wrap; }
.pos-checkout-bar { grid-template-columns: minmax(0, .55fr) minmax(0, .7fr) minmax(0, 1fr); }
.pos-checkout-bar > *, .pos-payment-button > span { min-width: 0; }
.pos-payment-button span small { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.login-shell { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.platform-nav { gap: 16px; padding-block: 12px; }
.platform-nav > .d-flex { flex-wrap: wrap; min-width: 0; }
.platform-nav .navbar-brand { white-space: normal; min-width: 0; }

@container workspace (max-width: 900px) {
    .pos-context { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pos-client-field { grid-column: 1 / -1; }
    .pos-product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .pos-product-grid > div:first-child { grid-column: 1 / -1; }
    .sale-form-grid, .sales-order-grid { grid-template-columns: minmax(0, 1fr); }
    .sale-product-panel, .sale-cart-panel, .sale-customer-panel,
    .sale-accounting-note, .sale-checkout-panel { grid-column: 1; grid-row: auto; }
    .sale-customer-panel { order: -1; }
    .sale-checkout-panel, .order-checkout-panel, .sale-workspace-side { position: static; }
    .sale-workspace-side .sale-customer-panel { max-height: none; overflow-y: visible; }
    .workspace-modules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container workspace (max-width: 600px) {
    .pos-context, .workspace-modules { grid-template-columns: minmax(0, 1fr); }
    .pos-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pos-product-grid > .btn { grid-column: 1 / -1; }
    .pos-checkout-bar { grid-template-columns: minmax(0, 1fr); position: static; }
    .pos-checkout-bar > div:first-child { display: none; }
    .workspace-banner-symbol { display: none; }
    .workspace-heading, .workspace-section-heading { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 767.98px) {
    .login-shell { grid-template-columns: minmax(0, 1fr); }
    .platform-nav { padding-inline: 16px; }
    .platform-nav > .d-flex { width: 100%; justify-content: space-between; }
    .dataTables_wrapper .dataTables_filter { text-align: left; margin: 12px 0; }
    .dataTables_wrapper .dataTables_filter label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
    .dataTables_wrapper .dataTables_filter input { margin-left: 0; flex: 1; min-width: 0; width: 100%; }
    .dataTables_wrapper .dataTables_paginate .pagination { flex-wrap: wrap; justify-content: center !important; gap: 4px; }
    .dataTables_wrapper .dataTables_info { white-space: normal; }
}
@media (max-width: 575.98px) {
    .app-content { padding: 20px 12px 32px; }
    .app-content > .container-fluid { padding-inline: 0; }
    .card-body, .card-header { padding: 16px; }
    .sidebar-nav { padding-top: 58px; overscroll-behavior-y: contain; }
    .sidebar-close { width: 44px; height: 44px; }
    .sidebar-toggle { width: 44px; height: 44px; }
    .sidebar-search input { font-size: 1rem; }
    .page-header > .btn,
    .app-content > .d-flex.justify-content-between > .btn,
    .app-content > .container-fluid > .d-flex.justify-content-between > .btn { width: 100%; }
    .app-content .card-header.d-flex { flex-wrap: wrap; gap: 12px; }
    .workspace-banner { padding: 20px; }
    .workspace-pill { white-space: normal; }
    .modal-dialog { margin: 8px; }
    .modal-body { padding: 16px; }
    .modal-footer > .btn { flex: 1 1 auto; }
}
@media print {
    .app-main { container-type: normal; }
    .table-responsive { overflow: visible; }
}
