@keyframes bdPop {
    from { transform: scale(.98); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.jaluz-app {
    --navy: #10263b;
    --navy-2: #17324c;
    --blue: #fab90a;
    --blue-soft: rgba(250, 185, 10, .14);
    --ink: #171f30;
    --muted: #797979;
    --line: #e4e8ed;
    --surface: #ffffff;
    --surface-2: #f4f7fa;
    --page: #f6f7f9;
    --success: #1a7a4c;
    --success-soft: rgba(26, 122, 76, .1);
    --warning: #b7791f;
    --danger: #b42318;
    --primary: #10263b;
    --secondary: #fab90a;
    --accent: #fab90a;
    --gold: #fab90a;
    --gold-2: #ffba00;
    --gold-soft: rgba(250, 185, 10, .14);
    --teal: #1a7a4c;
    --teal-soft: rgba(26, 122, 76, .1);
    --copper: #875a2a;
    --ring: rgba(16, 38, 59, .18);
    --radius: 8px;
    --shadow: 0 1px 2px rgba(15, 35, 62, .06), 0 8px 24px rgba(15, 35, 62, .06);
    --shadow-sm: 0 1px 2px rgba(15, 35, 62, .05);
    --font: inherit;
    --display: Roboto, "Segoe UI", system-ui, sans-serif;
}

.jaluz-app, .jaluz-app * { box-sizing: border-box; }

.jaluz-app {
    color: var(--ink);
    background: transparent;
    letter-spacing: 0;
    overflow-x: hidden;
}

.container-xxl {
    max-width: 1320px;
    padding-left: 16px;
    padding-right: 16px;
}

/* ── Top bar ────────────────────────────────────────────── */
.bd-topbar {
    background: var(--navy);
    color: #fff;
    border-bottom: 3px solid var(--blue);
}

.bd-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
}

.bd-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bd-logo {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    background: var(--blue);
    color: #fff;
    font-size: 1.05rem;
}
.bd-logo.has-img {
    background: #fff;
    padding: 3px;
    overflow: hidden;
}
.bd-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.bd-brand-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.bd-topbar h1 {
    font-family: var(--display);
    font-weight: 600;
    letter-spacing: -.01em;
    margin: 0;
    font-size: 1.2rem;
    color: #fff;
}

.bd-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #d7e4f5;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .18);
}

.tagline {
    margin: 2px 0 0;
    font-size: .8rem;
    color: #9cb0c9;
}

.bd-topbar-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: .82rem;
    color: #c5d4e6;
    white-space: nowrap;
}

.bd-topbar-meta a {
    color: #e8eef6;
    text-decoration: none;
}

.bd-topbar-meta a:hover { color: #fff; text-decoration: underline; }

.bd-session-welcome {
    display: flex;
    align-items: center;
    gap: 14px;
}

.bd-session-text {
    text-align: right;
    line-height: 1.25;
}

.bd-session-hello {
    display: block;
    font-size: .72rem;
    color: #9cb0c9;
    letter-spacing: .04em;
    text-transform: uppercase;
}

#sessionNameLabel {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

.btn-bd-logout {
    background: transparent;
    color: #e8eef6;
    border: 1px solid rgba(255,255,255,.28) !important;
    border-radius: 6px;
    font-size: .8rem;
    font-weight: 600;
    padding: 6px 12px;
}

.btn-bd-logout:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
}

.session-gate {
    min-height: calc(100vh - 84px);
    min-height: calc(100dvh - 84px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 48px 16px 32px;
}

.session-card {
    width: 100%;
    max-width: 420px;
}

.session-lead {
    color: var(--muted);
    font-size: .9rem;
    margin-bottom: 18px;
}

.session-gate.d-none,
#appMain.d-none,
.bd-session-welcome.d-none,
#sessionContacts.d-none {
    display: none !important;
}

.bd-header { display: none; }

/* ── Summary / KPI ──────────────────────────────────────── */
.summary-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
}

.summary-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: #fff;
    border: 1px solid var(--line);
    white-space: nowrap;
    font-size: 0.82rem;
    color: var(--muted);
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.summary-chip strong {
    color: var(--ink);
    font-weight: 600;
}

.chip-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    font-size: .8rem;
    flex-shrink: 0;
}

.chip-gold { background: var(--blue-soft); color: var(--blue); }
.chip-copper { background: #f3eee7; color: var(--copper); }
.chip-teal { background: var(--success-soft); color: var(--success); }
.chip-navy { background: #e8edf3; color: var(--navy); }

/* ── Cards ──────────────────────────────────────────────── */
.bd-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--line);
}

.bd-card-header {
    background: #fff;
    color: var(--navy);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--line);
}

.bd-card-header h2 {
    font-family: var(--display);
    font-weight: 600;
    letter-spacing: 0;
    font-size: .92rem !important;
}

.bd-card-header .header-icon {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: grid;
    place-items: center;
    background: var(--navy);
    color: #fff;
    font-size: .75rem;
}

.bd-card-header .req-pill {
    margin-left: auto;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--danger);
    background: #fdecec;
    border: 1px solid #f3c4c0;
    border-radius: 4px;
    padding: 2px 7px;
}

.bd-card-body { padding: 16px 18px 18px; }

.form-label {
    color: #3d4b5c;
    margin-bottom: 6px;
    font-weight: 600;
}

.form-control, .form-select {
    border: 1px solid #c9d3de !important;
    border-radius: 6px !important;
    padding: 8px 12px;
    background: #fff;
    min-height: 40px;
    color: var(--ink);
    box-shadow: none !important;
    font-size: .9rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--blue) !important;
    box-shadow: 0 0 0 .18rem var(--ring) !important;
}

.input-wrap { position: relative; }
.input-wrap .form-control { padding-right: 36px; }

.input-wrap .unit {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-weight: 600;
    font-size: .78rem;
}

.color-select-wrap { position: relative; }

.color-swatch {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, .18);
    z-index: 2;
    background: #f4f4f1;
}

.color-select-wrap .form-select { padding-left: 34px; }

/* ── Option cards ───────────────────────────────────────── */
.option-card, .sub-option-card {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink);
    border-radius: 6px;
    padding: 10px 12px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-start;
    transition: border-color .15s ease, background .15s ease;
    box-shadow: none;
    cursor: pointer;
    text-align: left;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
}

.option-card i, .sub-option-card i {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    display: grid;
    place-items: center;
    background: var(--surface-2);
    flex-shrink: 0;
    color: var(--navy);
}

.option-card .text-primary { color: var(--navy) !important; }

.option-card:hover, .sub-option-card:hover {
    border-color: var(--blue);
}

.option-card[aria-pressed="true"], .sub-option-card[aria-pressed="true"] {
    border-color: var(--blue);
    background: var(--blue-soft);
}

.installation-included {
    cursor: default !important;
    border-color: #b7dcc8 !important;
    background: var(--success-soft) !important;
}

.installation-included i {
    background: #d9efe4;
    color: var(--success);
}

.alert {
    border-radius: 6px;
    border: 1px solid transparent;
}

.customer-toolbar {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.customer-toolbar .form-select { flex: 1; }

.customer-toolbar .btn {
    white-space: nowrap;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: .84rem;
    font-weight: 600;
}

.customer-saved-hint {
    font-size: .8rem;
    color: var(--success);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.alert-warning {
    background: #fff8e8;
    color: #7a5b14;
    border-color: #f0deae;
}

.alert-info {
    background: #eef4fb;
    color: #1d4a7a;
    border-color: #c9dbed;
}

/* ── Actions ────────────────────────────────────────────── */
.bd-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: stretch;
    background: #fff;
    border-radius: var(--radius);
    padding: 10px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--line);
}

.bd-actions .btn {
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-family: var(--display);
    padding: 9px 12px;
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    letter-spacing: 0;
    white-space: nowrap;
    font-size: .84rem;
}

.btn-bd-calc {
    background: var(--navy);
    color: #fff;
}

.btn-bd-calc:hover { background: var(--navy-2); color: #fff; }

.btn-bd-calc.is-locked,
.btn-bd-calc.btn-secondary {
    background: #8b97a6;
    color: #fff;
}

.btn-bd-invoice {
    background: var(--blue);
    color: #fff;
}

.btn-bd-invoice:hover { background: #164a91; color: #fff; }

.btn-bd-print {
    background: #e8edf3;
    color: var(--navy);
}

.btn-bd-print:hover { background: #dce3eb; color: var(--navy); }

.btn-bd-wa {
    background: #128C7E;
    color: #fff;
    font-weight: 600;
}

.btn-bd-wa:hover { background: #0e7468; color: #fff; }

.btn-bd-reset {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line) !important;
}

.btn-bd-reset:hover { background: var(--surface-2); color: var(--ink); }

.bd-actions .btn:disabled { cursor: not-allowed; }

/* ── Mini stats ─────────────────────────────────────────── */
.bd-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.bd-mini {
    background: var(--surface-2);
    border-radius: 6px;
    padding: 12px 8px 10px;
    text-align: left;
    box-shadow: none;
    border: 1px solid var(--line);
}

.bd-mini i {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    display: inline-grid;
    place-items: center;
    background: #fff;
    margin-bottom: 6px;
    font-size: .8rem;
    border: 1px solid var(--line);
}

.bd-mini .label {
    margin: .15rem 0 0;
    color: var(--muted);
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 600;
}

.bd-mini .value {
    margin: 0;
    font-family: var(--display);
    font-weight: 600;
    font-size: .98rem;
    color: var(--ink);
}

/* ── Tabs ───────────────────────────────────────────────── */
.bd-tabs {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--line);
}

.tab-nav {
    display: flex;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 8px;
    font-weight: 600;
    color: var(--muted);
    transition: .15s;
    cursor: pointer;
    font-size: 0.82rem;
    font-family: var(--display);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.tab-btn:hover { color: var(--navy); background: var(--surface-2); }

.tab-btn.active {
    background: transparent;
    color: var(--blue);
    border-bottom-color: var(--blue);
}

.tab-content { display: none; padding: 16px; }
.tab-content.active { display: block; }

.table { --bs-table-hover-bg: #f4f8fc; }

.table thead th {
    background: var(--navy);
    color: #fff;
    font-size: .72rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    font-weight: 600;
    border: none;
    padding: 10px 12px;
}

.table tbody td {
    vertical-align: middle;
    border-color: var(--line);
    font-size: .86rem;
}

.table-success, .table tfoot .table-success td {
    background: var(--success-soft) !important;
    color: var(--ink);
}

/* ── Footer ─────────────────────────────────────────────── */
.jaluz-app .bd-footer {
    color: var(--muted);
    text-align: center;
    padding: 20px 8px 28px;
    background: transparent;
    border: none;
    border-top: 1px solid var(--line);
    border-radius: 0;
    margin-top: 28px;
}

.jaluz-app .bd-footer a { color: var(--blue); text-decoration: none; }
.jaluz-app .bd-footer a:hover { text-decoration: underline; }

/* ── Notifications ──────────────────────────────────────── */
.notification {
    position: fixed;
    top: 16px;
    right: 16px;
    padding: 12px 18px;
    border-radius: 6px;
    color: #fff;
    font-weight: 600;
    z-index: 9999;
    transform: translateX(150%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow);
    font-size: .88rem;
}

.notification.show { transform: translateX(0); }
.notification.success { background: var(--success); }
.notification.error { background: var(--danger); }
.notification.warning { background: var(--warning); }
.notification.info { background: var(--navy); }

/* ── Cutting / history ──────────────────────────────────── */
.cutting-plan { padding: 6px; }

.cutting-item {
    background: var(--surface-2);
    border-radius: 6px;
    padding: 14px;
    margin-bottom: 12px;
    border-left: 3px solid var(--blue);
}

.cutting-bar {
    height: 36px;
    background: #d5deea;
    border-radius: 4px;
    position: relative;
    margin: 10px 0;
    overflow: hidden;
}

.cutting-used,
.cutting-remaining {
    height: 100%;
    position: absolute;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.8rem;
}

.cutting-used { background: var(--success); left: 0; }
.cutting-remaining { background: var(--warning); }

.inventory-list { max-height: 200px; overflow-y: auto; }

.inventory-item {
    background: var(--success-soft);
    border-radius: 4px;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-left: 3px solid var(--success);
    font-size: 0.84rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ── Invoice ────────────────────────────────────────────── */
/* ── Proposal / A4 ──────────────────────────────────────── */
.invoice-preview {
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
    margin-top: 20px;
}

.proposal-sheet {
    width: 210mm;
    max-width: 100%;
    min-height: 297mm;
    margin: 0 auto;
    background: #ffffff;
    color: #111111;
    padding: 16mm 16mm 14mm;
    box-shadow: 0 8px 24px rgba(15, 35, 62, .12);
    border: 1px solid #d8e0e8;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    font-size: 10.5pt;
    line-height: 1.45;
}

.prop-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid #1B365D;
}

.prop-logo-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.prop-logo-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 4px;
    background: #fff;
}

.prop-mark {
    width: 36px;
    height: 36px;
    background: #1B365D;
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 18px;
    border-radius: 4px;
}

.prop-company {
    font-size: 16px;
    font-weight: 700;
    color: #1B365D;
    letter-spacing: .02em;
}

.prop-tag {
    font-size: 9px;
    color: #667;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.prop-contacts {
    margin-top: 8px;
    font-size: 8.5pt;
    color: #555;
    line-height: 1.5;
}

.prop-titlebox { text-align: right; }

.prop-title {
    font-size: 18px;
    font-weight: 700;
    color: #1B365D;
    letter-spacing: .06em;
}

.prop-meta {
    font-size: 9.5pt;
    color: #333;
    margin-top: 3px;
}

.prop-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid #d8dee6;
    margin: 16px 0 14px;
}

.prop-cell {
    padding: 8px 12px;
    border-bottom: 1px solid #e6ebf0;
    border-right: 1px solid #e6ebf0;
}

.prop-cell:nth-child(2n) { border-right: none; }
.prop-cell-wide {
    grid-column: 1 / -1;
    border-right: none;
    border-bottom: none;
}

.prop-cell span {
    display: block;
    font-size: 8pt;
    color: #6b7785;
    margin-bottom: 2px;
}

.prop-cell strong {
    font-size: 10pt;
    font-weight: 600;
    color: #1a1a1a;
}

.prop-h {
    font-size: 10.5pt;
    font-weight: 700;
    color: #1B365D;
    letter-spacing: .06em;
    margin: 14px 0 6px;
}

.prop-intro {
    font-size: 9.5pt;
    color: #333;
    margin: 0 0 10px;
}

.prop-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
}

.prop-table th {
    background: #1B365D;
    color: #fff;
    font-weight: 600;
    padding: 7px 8px;
    text-align: left;
    border: 1px solid #1B365D;
}

.prop-table td {
    padding: 8px;
    border: 1px solid #d5dce4;
    vertical-align: top;
}

.prop-table .c-num { width: 28px; text-align: center; }
.prop-table .c-qty { width: 52px; text-align: center; }
.prop-table .c-unit { width: 52px; text-align: center; }
.prop-table .c-price, .prop-table .c-sum { width: 92px; text-align: right; white-space: nowrap; }

.prop-totals {
    width: 260px;
    margin: 10px 0 0 auto;
    font-size: 9.5pt;
}

.prop-tot-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #e6ebf0;
}

.prop-tot-grand {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1B365D;
    color: #fff;
    font-weight: 700;
    padding: 8px 10px;
    margin-top: 4px;
}

.prop-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    margin-top: 16px;
}

.prop-list {
    margin: 0;
    padding-left: 18px;
    font-size: 9pt;
    color: #333;
}

.prop-list li { margin-bottom: 4px; }
.prop-bullets { list-style: disc; }

.prop-sign {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 28px;
}

.prop-sign-label {
    font-size: 9.5pt;
    font-weight: 700;
    color: #1B365D;
}

.prop-sign-line {
    border-bottom: 1px solid #c5ced8;
    height: 36px;
    margin: 4px 0 6px;
}

.prop-sign-name { font-size: 10pt; font-weight: 600; }
.prop-sign-role { font-size: 8.5pt; color: #667; }

.prop-foot {
    margin-top: 22px;
    padding-top: 8px;
    border-top: 1px solid #e6ebf0;
    text-align: center;
    font-size: 8pt;
    color: #778;
}

.proposal-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 16px 0 8px;
}

@media print {
    body { background: #fff !important; }
    .jaluz-app .bd-topbar, .jaluz-app .summary-bar, .jaluz-app .bd-card, .jaluz-app .bd-tabs, .jaluz-app .bd-footer,
    .jaluz-app .btn, .jaluz-app button, .jaluz-app .bd-actions, .jaluz-app .proposal-actions, .jaluz-app .no-print,
    .jaluz-app .session-gate, .jaluz-app #sessionWelcome, .jaluz-app #notification {
        display: none !important;
    }
    #appMain, #appMain.d-none { display: block !important; }
    .invoice-preview, #invoicePreview {
        display: block !important;
        box-shadow: none;
        margin: 0;
        padding: 0;
        border: none;
    }
    .proposal-sheet {
        box-shadow: none;
        border: none;
        width: 100%;
        min-height: auto;
        padding: 10mm;
    }
    .container-xxl { max-width: 100%; }
}

.invoice-header {
    border-bottom: 2px solid var(--navy);
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.invoice-logo { font-size: 1.7rem; color: var(--navy); font-family: var(--display); font-weight: 600; }
.invoice-title { font-size: 1.3rem; color: var(--navy); font-weight: 600; }

.invoice-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.invoice-section {
    background: var(--surface-2);
    padding: 15px;
    border-radius: 6px;
}

.invoice-section h4 {
    color: var(--navy);
    font-size: 0.86rem;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 5px;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.invoice-table th {
    background: var(--navy);
    color: #fff;
    padding: 12px;
    text-align: left;
    font-size: 0.82rem;
}

.invoice-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    font-size: 0.85rem;
}

.invoice-table tr:nth-child(even) { background: var(--surface-2); }

.invoice-total {
    background: var(--navy);
    color: #fff;
    padding: 14px;
    border-radius: 6px;
    text-align: right;
    font-size: 1.1rem;
    font-weight: 600;
}

.invoice-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px dashed var(--line);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.signature-box {
    border: 1px dashed var(--line);
    padding: 20px;
    border-radius: 6px;
    text-align: center;
}

.signature-line {
    border-bottom: 1px solid var(--navy);
    margin: 40px 0 10px;
}

@media (min-width: 992px) {
    .bd-card-summary {
        position: sticky;
        top: 20px;
    }
}

@media (max-width: 992px) {
    .summary-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .container-xxl { padding-left: 12px; padding-right: 12px; }
    .bd-topbar-inner { flex-direction: column; align-items: flex-start; padding: 12px 0; gap: 10px; }
    .bd-topbar-meta, .bd-session-welcome { flex-wrap: wrap; white-space: normal; width: 100%; }
    .bd-session-welcome { justify-content: space-between; }
    .bd-session-text { text-align: left; }
    .session-gate { min-height: auto; padding: 20px 12px 28px; }
    .customer-toolbar { flex-direction: column; }
    .summary-bar { position: static; grid-template-columns: 1fr 1fr; gap: 8px; }
    .summary-chip { white-space: normal; font-size: 0.72rem; padding: 8px 10px; }
    .summary-chip strong { word-break: break-word; }
    .bd-mini .value { font-size: 0.9rem; }
    .tab-nav { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .tab-nav::-webkit-scrollbar { display: none; }
    .tab-btn { flex: 0 0 auto; min-width: 96px; font-size: 0.68rem; padding: 10px 8px; white-space: nowrap; }
    .form-control, .form-select { font-size: 16px; }
    .invoice-info, .invoice-footer { grid-template-columns: 1fr; }
    .bd-actions { gap: 6px; }
    .bd-actions .btn { flex: 1 1 100%; width: 100%; white-space: normal; }
    .bd-actions .btn-bd-print { flex: 1 1 calc(50% - 3px); width: auto; }
    .bd-actions .btn-bd-reset { flex: 1 1 calc(50% - 3px); width: auto; }
    .opt-summary { grid-template-columns: 1fr 1fr; }
    .opt-alt { grid-template-columns: 1fr; }
    .opt-card-head { flex-direction: column; align-items: flex-start; }
    .opt-badge { white-space: normal; }
    .table { font-size: 0.78rem; }
    .table thead th, .table tbody td { padding: 8px 6px; }
    .bd-card-body { padding: 14px 12px 16px; }
    .tab-content { padding: 12px; }
}

.opt-wrap { display: flex; flex-direction: column; gap: 12px; }

.opt-empty {
    background: var(--surface-2);
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 16px;
    color: var(--muted);
    font-size: .86rem;
}

.opt-empty strong { display: block; color: var(--navy); margin-bottom: 6px; }
.opt-empty p { margin: 0 0 8px; }
.opt-empty ul { margin: 0; padding-left: 18px; }

.opt-howto {
    font-size: .84rem;
    color: #334;
    background: #eef3f9;
    border-radius: 8px;
    padding: 10px 12px;
    line-height: 1.45;
}

.opt-howto strong { display: block; color: var(--navy); margin-bottom: 2px; }

.opt-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
}

.opt-summary span {
    display: block;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    font-weight: 600;
}

.opt-summary strong { font-size: .95rem; }

.opt-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.opt-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 6px;
}

.opt-name { font-weight: 700; font-size: 1rem; color: var(--navy); }
.opt-hint { font-size: .8rem; color: var(--muted); }

.opt-badge {
    background: var(--navy);
    color: #fff;
    font-size: .72rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.opt-explain {
    margin: 0 0 10px;
    font-size: .86rem;
    color: #334;
}

.opt-facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    margin-bottom: 10px;
}

.opt-facts span {
    display: block;
    font-size: .72rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.opt-facts strong { font-size: .88rem; }
.opt-facts .is-waste { color: #b7791f; }
.opt-facts .is-ok { color: var(--success); }

.opt-meter-top {
    display: flex;
    justify-content: space-between;
    font-size: .78rem;
    margin-bottom: 4px;
    color: var(--muted);
}

.opt-track {
    height: 8px;
    background: #e8edf3;
    border-radius: 99px;
    overflow: hidden;
}

.opt-fill { height: 100%; border-radius: 99px; }
.opt-good { color: var(--success); }
.opt-fill.opt-good { background: var(--success); }
.opt-ok { color: #b7791f; }
.opt-fill.opt-ok { background: #d59a1c; }
.opt-bad { color: var(--danger); }
.opt-fill.opt-bad { background: var(--danger); }

.opt-note {
    margin-top: 8px;
    font-size: .8rem;
    padding: 7px 9px;
    border-radius: 6px;
}

.opt-note.ok { background: var(--success-soft); color: #166534; }
.opt-note.warn { background: #fff8e8; color: #7a5b14; }

.opt-compare {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--line);
}
.opt-stock {
    font-size: .78rem;
    color: var(--muted);
    margin-bottom: 8px;
}
.opt-alt {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 8px;
    align-items: baseline;
    font-size: .8rem;
    padding: 5px 8px;
    border-radius: 4px;
    color: #445;
}
.opt-alt span { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; }
.opt-alt em { font-style: normal; color: var(--muted); white-space: nowrap; }
.opt-alt.is-best {
    background: var(--success-soft);
    color: #166534;
}
.opt-alt.is-best em { color: #166534; font-weight: 600; }

.opt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: .78rem;
    color: var(--muted);
}

.opt-legend .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

.opt-bars { margin-top: 12px; }
.opt-bars-title {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    margin-bottom: 8px;
}
.opt-bar-row + .opt-bar-row { margin-top: 8px; }
.opt-bar-cap { font-size: .78rem; color: #445; margin-bottom: 4px; }
.opt-bar {
    display: flex;
    height: 26px;
    background: #d5deea;
    border-radius: 4px;
    overflow: hidden;
}
.opt-bar-used,
.opt-bar-keep,
.opt-bar-rest {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: .72rem;
    font-weight: 600;
    min-width: 0;
}
.opt-bar-used { background: var(--success); }
.opt-bar-keep { background: #2b6cb0; }
.opt-bar-rest { background: #d59a1c; }

.opt-legend .dot.used { background: var(--success); }
.opt-legend .dot.keep { background: #2b6cb0; }
.opt-legend .dot.rest { background: #d59a1c; }
.opt-legend .dot.good { background: var(--success); }
.opt-legend .dot.ok { background: #d59a1c; }
.opt-legend .dot.bad { background: var(--danger); }
