/* BB Invoice Pro 1.8.0 */
/* ============================================================
   BB LOCAL TTF FONTS
   Server location: /wp-content/uploads/_files/invoice/assets/fonts/
   ============================================================ */
@font-face { font-family: "BB Display"; src: url("/wp-content/uploads/_files/invoice/assets/fonts/BB-Light.ttf") format("truetype"); font-style: normal; font-weight: 300; font-display: swap; }
@font-face { font-family: "BB Display"; src: url("/wp-content/uploads/_files/invoice/assets/fonts/BB.ttf") format("truetype"); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: "BB Display"; src: url("/wp-content/uploads/_files/invoice/assets/fonts/BB-Medium.ttf") format("truetype"); font-style: normal; font-weight: 500; font-display: swap; }
@font-face { font-family: "BB Display"; src: url("/wp-content/uploads/_files/invoice/assets/fonts/BB-Semibold.ttf") format("truetype"); font-style: normal; font-weight: 600; font-display: swap; }
@font-face { font-family: "BB Display"; src: url("/wp-content/uploads/_files/invoice/assets/fonts/BB-Bold.ttf") format("truetype"); font-style: normal; font-weight: 700; font-display: swap; }
@font-face { font-family: "BB Text"; src: url("/wp-content/uploads/_files/invoice/assets/fonts/BB-Text.ttf") format("truetype"); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: "BB Text"; src: url("/wp-content/uploads/_files/invoice/assets/fonts/BB-Text-Semibold.ttf") format("truetype"); font-style: normal; font-weight: 600; font-display: swap; }

/* ============================================================
       GLOBAL VARIABLES
       ============================================================ */
        .bb-invoice-app {
            --page-width: 612px;
            --page-height: 792px;
            --page-padding: 50px;
            --content-width: 512px;
            --content-height: 692px;
            --black: #303030;
            --body-text: #383838;
            --gray: #969696;
            --light-gray: #aaaaaa;
            --line: #e7e7e7;
            --table-bg: #f7f7f7;
            --link: #387cc0;
        }

        /* ============================================================
       RESET
       ============================================================ */
        .bb-invoice-app,
        .bb-invoice-app * {
            box-sizing: border-box;
        }

        .bb-invoice-app {
            position: relative;
            width: 100%;
            isolation: isolate;
        }

        .bb-invoice-stage {
            min-height: 852px;
            background: #ededed;
            display: flex;
            justify-content: center;
            align-items: flex-start;
            padding: 30px 0;
            font-family: "BB Text", sans-serif;
        }

        /* ============================================================
       INVOICE PAGE
       612px × 792px
       INNER: 512px × 692px
       ============================================================ */
        .bb-invoice-app .invoice-page {
            width: var(--page-width);
            height: var(--page-height);
            min-width: var(--page-width);
            min-height: var(--page-height);
            padding: var(--page-padding);
            background: #fff;
            color: var(--body-text);
            font-family: "BB Text", sans-serif;
            font-size: 10px;
            line-height: 12px;
            font-weight: 400;
            letter-spacing: -0.01em;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            box-shadow: 0 4px 20px rgba(0, 0, 0, .10);
        }

        /* ============================================================
       COMMON TYPOGRAPHY
       ============================================================ */
        .bb-invoice-app .text {
            font-family: "BB Text", sans-serif;
            font-size: 10px;
            line-height: 12px;
            font-weight: 400;
            letter-spacing: -0.01em;
        }

        .bb-invoice-app .text-strong {
            font-family: "BB Text", sans-serif;
            font-size: 10px;
            line-height: 12px;
            font-weight: 600;
            letter-spacing: -0.01em;
        }

        .bb-invoice-app .label {
            font-family: "BB Text", sans-serif;
            font-size: 10px;
            line-height: 12px;
            font-weight: 400;
            letter-spacing: -0.01em;
            color: var(--gray);
        }

        /* ============================================================
       HEADER
       ============================================================ */
        .bb-invoice-app .invoice-header {
            width: 100%;
            min-height: 70px;
            display: grid;
            grid-template-columns: 64px minmax(0, 1fr) 42px;
            column-gap: 13px;
            align-items: start;
            flex-shrink: 0;
        }

        .bb-invoice-app .brand-logo {
            display: block;
            width: 64px;
            height: 64px;
            object-fit: contain;
        }

        .bb-invoice-app .brand-info {
            min-width: 0;
            padding-top: 1px;
        }

        .bb-invoice-app .brand-name {
            margin: 0;
            font-family: "BB Display", sans-serif;
            font-size: 20px;
            line-height: 24px;
            font-weight: 600;
            letter-spacing: .01em;
            color: var(--black);
        }

        .bb-invoice-app .brand-subtitle {
            margin: 3px 0 0;
            font-family: "BB Text", sans-serif;
            font-size: 13px;
            line-height: 17px;
            font-weight: 300;
            letter-spacing: -.01em;
            color: var(--black);
        }

        .bb-invoice-app .brand-contact {
            margin-top: 6px;
            font-family: "BB Text", sans-serif;
            font-size: 10px;
            line-height: 12px;
            font-weight: 600;
            letter-spacing: -.01em;
            color: #999;
            white-space: nowrap;
        }

        /* ============================================================
       QR
       ============================================================ */
        .bb-invoice-app .qr-wrapper {
            position: relative;
            width: 42px;
            text-align: center;
        }

        .bb-invoice-app .invoice-qr {
            display: block;
            width: 42px;
            height: 42px;
            object-fit: contain;
        }

        .bb-invoice-app .qr-center-link {
            position: absolute;
            left: 50%;
            top: 21px;
            transform: translate(-50%, -50%);
            width: max-content;
            max-width: 42px;
            white-space: nowrap;
            overflow: hidden;
            z-index: 2;
            font-family: "BB Text", sans-serif;
            font-size: 3.4px;
            line-height: 4px;
            font-weight: 400;
            letter-spacing: -.02em;
            color: #303030;
            text-align: center;
            text-decoration: none;
        }

        .bb-invoice-app .qr-bottom-link {
            display: block;
            width: max-content;
            position: relative;
            left: 50%;
            transform: translateX(-50%);
            margin-top: 2px;
            white-space: nowrap;
            font-family: "BB Text", sans-serif;
            font-size: 3.6px;
            line-height: 6px;
            font-weight: 400;
            letter-spacing: -.01em;
            color: #999;
            text-align: center;
            text-decoration: none;
        }

        /* ============================================================
       INVOICE + BILL TO
       ============================================================ */
        .bb-invoice-app .invoice-summary {
            width: 100%;
            min-height: 92px;
            margin-top: 40px;
            display: grid;
            grid-template-columns: 220px 257px;
            column-gap: 35px;
            align-items: start;
            flex-shrink: 0;
        }

        .bb-invoice-app .summary-left {
            width: 220px;
        }

        .bb-invoice-app .invoice-title {
            margin: 0;
            font-family: "BB Display", sans-serif;
            font-size: 23px;
            line-height: 28px;
            font-weight: 600;
            letter-spacing: .005em;
            color: #929292;
        }

        .bb-invoice-app .invoice-meta {
            width: 210px;
            margin-top: 11px;
        }

        .bb-invoice-app .meta-row {
            display: grid;
            grid-template-columns: 95px 1fr;
            min-height: 16px;
            padding-top: 4px;
        }

        .bb-invoice-app .meta-label {
            font-family: "BB Text", sans-serif;
            font-size: 10px;
            line-height: 12px;
            font-weight: 400;
            letter-spacing: -.01em;
            color: var(--gray);
        }

        .bb-invoice-app .meta-value {
            font-family: "BB Text", sans-serif;
            font-size: 10px;
            line-height: 12px;
            font-weight: 400;
            letter-spacing: -.01em;
            color: var(--black);
        }

        .bb-invoice-app .bill-to {
            width: 257px;
            margin-top: 13px;
        }

        .bb-invoice-app .section-title {
            margin: 0;
            font-family: "BB Text", sans-serif;
            font-size: 13px;
            line-height: 17px;
            font-weight: 600;
            letter-spacing: .005em;
            color: var(--black);
        }

        .bb-invoice-app .bill-title {
            padding-bottom: 3px;
            border-bottom: 1px solid var(--line);
        }

        .bb-invoice-app .bill-details {
            margin-top: 9px;
            font-family: "BB Text", sans-serif;
            font-size: 10px;
            line-height: 12px;
            font-weight: 400;
            letter-spacing: -.01em;
            color: var(--black);
        }

        .bb-invoice-app .bill-name {
            margin-bottom: 2px;
            font-weight: 600;
        }

        /* ============================================================
       ITEMS
       ============================================================ */
        .bb-invoice-app .invoice-items {
            width: 100%;
            margin-top: 18px;
            flex-shrink: 0;
        }

        .bb-invoice-app .item-header {
            width: 100%;
            height: 18px;
            display: grid;
            grid-template-columns: 245px 112px 76px 79px;
            align-items: center;
            background: var(--table-bg);
            border-radius: 3px;
            font-family: "BB Text", sans-serif;
            font-size: 10px;
            line-height: 12px;
            font-weight: 400;
            letter-spacing: -.01em;
            color: var(--gray);
        }

        .bb-invoice-app .item-header>div {
            padding-left: 9px;
        }

        .bb-invoice-app .item-header .quantity,
        .bb-invoice-app .item-header .price {
            padding-left: 0;
            padding-right: 9px;
        }

        .bb-invoice-app .item-header .price {
            text-align: right;
        }

        .bb-invoice-app .item-row {
            width: 100%;
            height: 33px;
            display: grid;
            grid-template-columns: 245px 112px 76px 79px;
            align-items: center;
            border-bottom: 1px solid var(--line);
            font-family: "BB Text", sans-serif;
            font-size: 10px;
            line-height: 12px;
            font-weight: 400;
            letter-spacing: -.01em;
            color: var(--black);
        }

        .bb-invoice-app .item-row>div {
            padding-left: 9px;
        }

        .bb-invoice-app .item-type {
            color: var(--gray);
        }

        .bb-invoice-app .item-row .quantity {
            padding-left: 0;
            padding-right: 9px;
            text-align: left;
            color: var(--gray);
        }

        .bb-invoice-app .item-row .price {
            padding-left: 0;
            padding-right: 9px;
            text-align: right;
        }

        /* ============================================================
       TOTAL
       ============================================================ */
        .bb-invoice-app .invoice-total {
            width: 257px;
            margin-left: auto;
        }

        .bb-invoice-app .total-row {
            width: 257px;
            min-height: 34px;
            display: grid;
            grid-template-columns: 151px 106px;
            align-items: center;
            border-bottom: 1px solid var(--line);
        }

        .bb-invoice-app .total-label {
            height: 34px;
            display: flex;
            align-items: center;
            justify-content: flex-end;
            padding-right: 17px;
            border-right: 1px solid var(--line);
            font-family: "BB Text", sans-serif;
            font-size: 10px;
            line-height: 12px;
            font-weight: 400;
            letter-spacing: -.01em;
            color: var(--gray);
        }

        .bb-invoice-app .total-amount {
            padding-right: 9px;
            text-align: right;
            font-family: "BB Text", sans-serif;
            font-size: 18px;
            line-height: 22px;
            font-weight: 600;
            letter-spacing: -.022em;
            color: var(--black);
        }

        .bb-invoice-app .amount-in-words {
            padding-top: 7px;
            padding-right: 9px;
            text-align: right;
            font-family: "BB Text", sans-serif;
            font-size: 10px;
            line-height: 12px;
            font-weight: 400;
            letter-spacing: -.01em;
            color: var(--gray);
        }

        /* ============================================================
       PAYMENT
       ============================================================ */
        .bb-invoice-app .payment-information {
            width: 100%;
            margin-top: 47px;
            flex-shrink: 0;
        }

        .bb-invoice-app .payment-title {
            padding-bottom: 6px;
            border-bottom: 1px solid var(--line);
        }

        .bb-invoice-app .payment-body {
            width: 100%;
            display: grid;
            grid-template-columns: 245px 257px;
            column-gap: 10px;
            align-items: start;
            padding-top: 10px;
        }

        .bb-invoice-app .payment-left {
            width: 245px;
        }

        .bb-invoice-app .payment-row {
            display: grid;
            grid-template-columns: 101px 144px;
            min-height: 16px;
            align-items: start;
        }

        .bb-invoice-app .payment-row+.payment-row {
            margin-top: 1px;
        }

        .bb-invoice-app .payment-method-label {
            font-weight: 600;
        }

        .bb-invoice-app .payoneer {
            font-family: "BB Text", sans-serif;
            font-size: 10px;
            line-height: 12px;
            font-weight: 600;
            letter-spacing: -.01em;
            color: var(--black);
        }

        .bb-invoice-app .payment-right {
            width: 257px;
        }

        .bb-invoice-app .info-row {
            display: grid;
            grid-template-columns: 94px 163px;
            min-height: 16px;
            padding-top: 4px;
        }

        .bb-invoice-app .info-label {
            font-family: "BB Text", sans-serif;
            font-size: 10px;
            line-height: 12px;
            font-weight: 400;
            letter-spacing: -.01em;
            color: var(--gray);
        }

        .bb-invoice-app .info-value {
            font-family: "BB Text", sans-serif;
            font-size: 10px;
            line-height: 12px;
            font-weight: 400;
            letter-spacing: -.01em;
            color: var(--black);
        }

        /* ============================================================
       BOTTOM
       ============================================================ */
        .bb-invoice-app .bottom-area {
            width: 100%;
            min-height: 105px;
            margin-top: auto;
            flex-shrink: 0;
        }

        .bb-invoice-app .invoice-footer {
            width: 380px;
        }

        .bb-invoice-app .footer-text {
            margin: 0 0 5px;
            font-family: "BB Text", sans-serif;
            font-size: 7px;
            line-height: 9px;
            font-weight: 400;
            letter-spacing: -.006em;
            color: #999;
        }

        .bb-invoice-app .footer-text a {
            color: var(--link);
            text-decoration: none;
        }

        .bb-invoice-app .bb-verification-link {
            cursor: pointer;
            white-space: nowrap;
        }

        .bb-invoice-app [data-bb-invoice-number][aria-invalid="true"] {
            outline: 1px dashed #b42318;
            outline-offset: 1px;
        }

        .bb-invoice-app .thank-you {
            margin-top: 13px;
            color: var(--black);
        }

        /* ============================================================
       SIGNATURE
       ============================================================ */
        .bb-invoice-app .signature-section {
            width: 130px;
            margin-top: 7px;
        }

        .bb-invoice-app .signature-image {
            display: block;
            width: 70px;
            height: auto;
            margin-bottom: 6px;
        }

        .bb-invoice-app .signature-line {
            width: 120px;
            height: 1px;
            margin-bottom: 6px;
            background-image: radial-gradient(circle, #bebebe .5px, transparent .55px);
            background-size: 3px 1px;
            background-repeat: repeat-x;
            background-position: left center;
        }

        .bb-invoice-app .signature-name {
            margin: 0;
            font-family: "BB Text", sans-serif;
            font-size: 10px;
            line-height: 12px;
            font-weight: 400;
            letter-spacing: -.01em;
            color: var(--black);
        }

        /* ============================================================
       VISUAL TEXT EDITING
       Does not add padding, margins, borders, or change layout.
       ============================================================ */
        .bb-invoice-app .invoice-editable {
            cursor: text;
            outline: none;
            caret-color: currentColor;
        }

        .bb-invoice-app .invoice-editable:focus {
            outline: 1px dashed rgba(56, 124, 192, .55);
            outline-offset: 1px;
        }

        /* ============================================================
       DOWNLOAD BUTTON
       ============================================================ */
        .bb-invoice-app button.pdf-export-btn {
            position: fixed;
            top: 24px;
            right: 24px;
            z-index: 9999;
            padding: 10px 16px;
            border: 0;
            border-radius: 6px;
            background: #303030;
            color: #fff;
            font-family: "BB Text", sans-serif;
            font-size: 12px;
            line-height: 16px;
            font-weight: 600;
            letter-spacing: -.01em;
            cursor: pointer;
        }

        .bb-invoice-app button.pdf-export-btn:hover {
            opacity: .85;
        }

        .bb-invoice-app button.pdf-export-btn:disabled {
            opacity: .45;
            cursor: wait;
        }

        @media screen and (max-width: 650px) {
            .bb-invoice-stage {
                display: block;
                padding: 0;
                overflow-x: auto;
            }

            .bb-invoice-app .invoice-page {
                margin: 0 auto;
                box-shadow: none;
            }
        }
    

        .bb-invoice-app .bb-invoice-status {
            position: fixed;
            top: 72px;
            right: 24px;
            z-index: 10000;
            max-width: min(360px, calc(100vw - 48px));
            padding: 8px 10px;
            border-radius: 6px;
            background: rgba(48, 48, 48, .92);
            color: #fff;
            font-family: "BB Text", sans-serif;
            font-size: 11px;
            line-height: 15px;
            opacity: 0;
            pointer-events: none;
            transform: translateY(-4px);
            transition: opacity .16s ease, transform .16s ease;
        }

        .bb-invoice-app .bb-invoice-status.is-visible {
            opacity: 1;
            transform: translateY(0);
        }

        .bb-invoice-app .bb-invoice-status.is-error {
            background: rgba(145, 28, 28, .96);
        }

        @media print {
            .bb-invoice-app button.pdf-export-btn,
            .bb-invoice-app .bb-invoice-status {
                display: none;
            }

            .bb-invoice-stage {
                min-height: 0;
                padding: 0;
                background: #fff;
                display: block;
            }

            .bb-invoice-app .invoice-page {
                box-shadow: none;
                margin: 0;
            }
        }

/* ============================================================
   CANVAS WORKSPACE — legacy v1.3.0
   View transforms never alter the exported PDF geometry.
   ============================================================ */
.bb-invoice-app .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.bb-invoice-app .bb-canvas-toolbar {
    position: sticky;
    top: 8px;
    z-index: 10020;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: min(1180px, calc(100% - 24px));
    margin: 12px auto 10px;
    padding: 8px;
    border: 1px solid #dedede;
    border-radius: 10px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 4px 18px rgba(0, 0, 0, .08);
    backdrop-filter: blur(10px);
    font-family: "BB Text", sans-serif;
}

.bb-invoice-app .bb-tool-group {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    padding-right: 8px;
    border-right: 1px solid #e8e8e8;
}

.bb-invoice-app .bb-tool-group:last-child,
.bb-invoice-app .bb-export-group {
    border-right: 0;
    padding-right: 0;
}

.bb-invoice-app .bb-export-group {
    margin-left: auto;
}

/* Elementor/theme isolation: target the native elements directly instead of
   force-overriding generic button styles. */
.bb-invoice-app button.bb-tool-btn,
.bb-invoice-app button.pdf-export-btn {
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    background-image: none;
    text-decoration: none;
    text-transform: none;
    text-shadow: none;
    font-style: normal;
}


.bb-invoice-app button.bb-tool-btn,
.bb-invoice-app button.pdf-export-btn {
    appearance: none;
    position: static;
    inset: auto;
    z-index: auto;
    min-height: 32px;
    margin: 0;
    padding: 6px 9px;
    border: 1px solid #d8d8d8;
    border-radius: 6px;
    background: #fff;
    color: #303030;
    font-family: "BB Text", sans-serif;
    font-size: 11px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0;
    white-space: nowrap;
    cursor: pointer;
    transition: background .14s ease, border-color .14s ease, opacity .14s ease;
}

.bb-invoice-app button.bb-tool-btn:hover {
    background: #f5f5f5;
    border-color: #c8c8c8;
}

.bb-invoice-app button.bb-tool-btn:focus-visible,
.bb-invoice-app button.pdf-export-btn:focus-visible,
.bb-invoice-app .bb-zoom-number-wrap input:focus-visible,
.bb-invoice-app .bb-zoom-slider-wrap input:focus-visible,
.bb-invoice-app .bb-canvas-viewport:focus-visible {
    outline: 2px solid #387cc0;
    outline-offset: 2px;
}

.bb-invoice-app button.bb-tool-btn.is-active {
    background: #303030;
    border-color: #303030;
    color: #fff;
}

.bb-invoice-app button.bb-icon-btn {
    width: 32px;
    min-width: 32px;
    padding-left: 0;
    padding-right: 0;
    text-align: center;
    font-size: 16px;
    line-height: 18px;
}

.bb-invoice-app button.pdf-export-btn {
    border-color: #303030;
    background: #303030;
    color: #fff;
    padding-left: 13px;
    padding-right: 13px;
}

.bb-invoice-app button.pdf-export-btn:hover {
    opacity: .86;
}

.bb-invoice-app button.pdf-export-btn:disabled,
.bb-invoice-app button.bb-tool-btn:disabled {
    opacity: .45;
    cursor: wait;
}

.bb-invoice-app .bb-zoom-number-wrap {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 32px;
    padding: 0 6px;
    border: 1px solid #d8d8d8;
    border-radius: 6px;
    background: #fff;
    color: #555;
    font-family: "BB Text", sans-serif;
    font-size: 11px;
}

.bb-invoice-app .bb-zoom-number-wrap input {
    width: 44px;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #303030;
    font: inherit;
    font-weight: 600;
    text-align: right;
}

.bb-invoice-app .bb-zoom-number-wrap input::-webkit-inner-spin-button,
.bb-invoice-app .bb-zoom-number-wrap input::-webkit-outer-spin-button {
    margin: 0;
    appearance: none;
}

.bb-invoice-app .bb-zoom-slider-wrap {
    display: inline-flex;
    align-items: center;
    width: 104px;
    height: 32px;
}

.bb-invoice-app .bb-zoom-slider-wrap input {
    width: 100%;
    cursor: pointer;
}

.bb-invoice-app .bb-invoice-status {
    position: fixed;
    top: 76px;
    right: 24px;
    z-index: 10040;
}

.bb-invoice-app .bb-canvas-shell {
    position: relative;
    width: min(1180px, calc(100% - 24px));
    margin: 0 auto 24px;
    border: 1px solid #d7d7d7;
    border-radius: 10px;
    overflow: hidden;
    background: #dcdcdc;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .4);
    font-family: "BB Text", sans-serif;
}

.bb-invoice-app .bb-canvas-viewport {
    position: relative;
    width: 100%;
    height: clamp(560px, calc(100vh - 170px), 920px);
    min-height: 500px;
    overflow: hidden;
    background-color: #e9e9e9;
    background-image: radial-gradient(circle at center, rgba(0, 0, 0, .055) 1px, transparent 1px);
    background-size: 18px 18px;
    touch-action: none;
    user-select: none;
    cursor: grab;
    overscroll-behavior: contain;
}

.bb-invoice-app .bb-canvas-viewport.is-panning {
    cursor: grabbing;
}

.bb-invoice-app .bb-canvas-viewport.is-move-locked {
    cursor: default;
}

.bb-invoice-app .bb-canvas-world {
    position: absolute;
    left: 0;
    top: 0;
    width: var(--page-width);
    height: var(--page-height);
    overflow: visible;
    transform-origin: 0 0;
    backface-visibility: visible;
    contain: none;
}

.bb-invoice-app .bb-canvas-world.is-transform-fallback {
    left: 0;
    top: 0;
}

.bb-invoice-app .bb-canvas-rotation {
    width: var(--page-width);
    height: var(--page-height);
    overflow: visible;
    transform-origin: 50% 50%;
    backface-visibility: visible;
    transform-style: flat;
    contain: none;
    zoom: 1;
}

.bb-invoice-app .invoice-page {
    position: relative;
    margin: 0;
    box-shadow: 0 10px 34px rgba(0, 0, 0, .20);
    user-select: text;
    content-visibility: visible;
    contain: none;
    isolation: isolate;
    text-rendering: geometricPrecision;
}

.bb-invoice-app .invoice-page * {
    content-visibility: visible;
}

.bb-invoice-app .brand-logo,
.bb-invoice-app .invoice-qr,
.bb-invoice-app .signature-image {
    max-width: none;
    image-rendering: auto;
}

.bb-invoice-app .invoice-editable {
    position: relative;
    z-index: 2;
    user-select: text;
}

.bb-invoice-app .invoice-editable:hover {
    box-shadow: inset 0 -1px rgba(56, 124, 192, .24);
}

.bb-invoice-app .bb-canvas-grid {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: none;
    pointer-events: none;
    opacity: .48;
    background-image:
        linear-gradient(to right, rgba(48, 48, 48, .13) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(48, 48, 48, .13) 1px, transparent 1px),
        linear-gradient(to right, rgba(48, 48, 48, .055) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(48, 48, 48, .055) 1px, transparent 1px);
    background-size:
        var(--bb-grid-major, 100px) var(--bb-grid-major, 100px),
        var(--bb-grid-major, 100px) var(--bb-grid-major, 100px),
        var(--bb-grid-minor, 20px) var(--bb-grid-minor, 20px),
        var(--bb-grid-minor, 20px) var(--bb-grid-minor, 20px);
    background-position:
        var(--bb-grid-x, 0px) var(--bb-grid-y, 0px),
        var(--bb-grid-x, 0px) var(--bb-grid-y, 0px),
        var(--bb-grid-x, 0px) var(--bb-grid-y, 0px),
        var(--bb-grid-x, 0px) var(--bb-grid-y, 0px);
}

.bb-invoice-app .bb-canvas-shell.show-grid .bb-canvas-grid {
    display: block;
}

.bb-invoice-app .bb-ruler,
.bb-invoice-app .bb-ruler-corner {
    position: absolute;
    z-index: 10015;
    display: none;
    pointer-events: none;
    background: rgba(255, 255, 255, .95);
    color: #666;
    border-color: #d8d8d8;
    font-family: "BB Text", sans-serif;
    font-size: 8px;
    line-height: 10px;
}

.bb-invoice-app .bb-canvas-shell.show-rulers .bb-ruler,
.bb-invoice-app .bb-canvas-shell.show-rulers .bb-ruler-corner {
    display: block;
}

.bb-invoice-app .bb-ruler-corner {
    left: 0;
    top: 0;
    width: 25px;
    height: 25px;
    border-right: 1px solid #d8d8d8;
    border-bottom: 1px solid #d8d8d8;
}

.bb-invoice-app .bb-ruler-x {
    left: 25px;
    right: 0;
    top: 0;
    height: 25px;
    overflow: hidden;
    border-bottom: 1px solid #d8d8d8;
}

.bb-invoice-app .bb-ruler-y {
    left: 0;
    top: 25px;
    bottom: 0;
    width: 25px;
    overflow: hidden;
    border-right: 1px solid #d8d8d8;
}

.bb-invoice-app .bb-ruler-labels {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.bb-invoice-app .bb-ruler-mark {
    position: absolute;
    color: #666;
    white-space: nowrap;
}

.bb-invoice-app .bb-ruler-mark::after {
    content: "";
    position: absolute;
    background: #a9a9a9;
}

.bb-invoice-app .bb-ruler-x .bb-ruler-mark {
    top: 2px;
    transform: translateX(-1px);
}

.bb-invoice-app .bb-ruler-x .bb-ruler-mark::after {
    left: 0;
    top: 11px;
    width: 1px;
    height: 10px;
}

.bb-invoice-app .bb-ruler-y .bb-ruler-mark {
    left: 2px;
    writing-mode: vertical-rl;
    transform: translateY(-1px);
}

.bb-invoice-app .bb-ruler-y .bb-ruler-mark::after {
    left: 11px;
    top: 0;
    width: 10px;
    height: 1px;
}

.bb-invoice-app .bb-canvas-hud {
    position: absolute;
    left: 10px;
    bottom: 10px;
    z-index: 10010;
    padding: 5px 7px;
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 5px;
    background: rgba(255, 255, 255, .88);
    color: #505050;
    font-family: "BB Text", sans-serif;
    font-size: 10px;
    line-height: 13px;
    pointer-events: none;
    backdrop-filter: blur(5px);
}

.bb-invoice-app .bb-canvas-minimap {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 10010;
    width: 142px;
    padding: 7px;
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 7px;
    background: rgba(255, 255, 255, .92);
    color: #505050;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .12);
    backdrop-filter: blur(5px);
}

.bb-invoice-app .bb-canvas-minimap.is-hidden {
    display: none;
}

.bb-invoice-app .bb-minimap-title {
    margin-bottom: 5px;
    font-size: 9px;
    line-height: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.bb-invoice-app .bb-minimap-track {
    position: relative;
    width: 128px;
    height: 128px;
    overflow: hidden;
    border: 1px solid #d4d4d4;
    background: #ececec;
    cursor: crosshair;
}

.bb-invoice-app .bb-minimap-page {
    position: absolute;
    border: 1px solid #8f8f8f;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .13);
}

.bb-invoice-app .bb-minimap-view {
    position: absolute;
    min-width: 5px;
    min-height: 5px;
    border: 1px solid #387cc0;
    background: rgba(56, 124, 192, .14);
    cursor: move;
}

.bb-invoice-app .bb-shortcuts-dialog {
    width: min(540px, calc(100vw - 28px));
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #303030;
}

.bb-invoice-app .bb-shortcuts-dialog::backdrop {
    background: rgba(0, 0, 0, .34);
}

.bb-invoice-app .bb-shortcuts-card {
    padding: 14px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 16px 50px rgba(0, 0, 0, .22);
    font-family: "BB Text", sans-serif;
}

.bb-invoice-app .bb-shortcuts-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.bb-invoice-app .bb-shortcuts-grid {
    display: grid;
    grid-template-columns: minmax(120px, .8fr) minmax(0, 1.2fr);
    gap: 7px 14px;
    font-size: 12px;
    line-height: 16px;
}

.bb-invoice-app kbd {
    display: inline-block;
    min-width: 21px;
    padding: 2px 5px;
    border: 1px solid #d1d1d1;
    border-bottom-width: 2px;
    border-radius: 4px;
    background: #f7f7f7;
    color: #333;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 10px;
    line-height: 14px;
    text-align: center;
}

.bb-invoice-app:fullscreen,
.bb-invoice-app.is-fullscreen-fallback {
    width: 100%;
    height: 100%;
    padding: 8px;
    background: #e4e4e4;
}

.bb-invoice-app:fullscreen .bb-canvas-toolbar,
.bb-invoice-app.is-fullscreen-fallback .bb-canvas-toolbar,
.bb-invoice-app:fullscreen .bb-canvas-shell,
.bb-invoice-app.is-fullscreen-fallback .bb-canvas-shell {
    width: 100%;
}

.bb-invoice-app:fullscreen .bb-canvas-viewport,
.bb-invoice-app.is-fullscreen-fallback .bb-canvas-viewport {
    height: calc(100vh - 76px);
}

@media (max-width: 900px) {
    .bb-invoice-app .bb-canvas-toolbar,
    .bb-invoice-app .bb-canvas-shell {
        width: calc(100% - 12px);
    }

    .bb-invoice-app .bb-tool-group {
        border-right: 0;
        padding-right: 0;
    }

    .bb-invoice-app .bb-export-group {
        margin-left: 0;
    }

    .bb-invoice-app .bb-zoom-slider-wrap {
        width: 86px;
    }
}

@media (max-width: 600px) {
    .bb-invoice-app .bb-canvas-viewport {
        height: 70vh;
        min-height: 480px;
    }

    .bb-invoice-app .bb-canvas-minimap {
        width: 118px;
    }

    .bb-invoice-app .bb-minimap-track {
        width: 104px;
        height: 104px;
    }

    .bb-invoice-app .bb-shortcuts-grid {
        grid-template-columns: 1fr 1fr;
        gap: 7px 10px;
        font-size: 11px;
    }
}

@media print {
    .bb-invoice-app .bb-canvas-toolbar,
    .bb-invoice-app .bb-invoice-status,
    .bb-invoice-app .bb-canvas-hud,
    .bb-invoice-app .bb-canvas-minimap,
    .bb-invoice-app .bb-ruler,
    .bb-invoice-app .bb-ruler-corner,
    .bb-invoice-app .bb-canvas-grid,
    .bb-invoice-app .bb-shortcuts-dialog {
        display: none;
    }

    .bb-invoice-app .bb-canvas-shell,
    .bb-invoice-app .bb-canvas-viewport {
        width: 612px;
        height: 792px;
        min-height: 0;
        margin: 0;
        padding: 0;
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: #fff;
        box-shadow: none;
    }

    .bb-invoice-app .bb-canvas-world {
        left: 0;
        top: 0;
        transform: none;
    }

    .bb-invoice-app .bb-canvas-rotation {
        zoom: 1;
        transform: none;
    }

    .bb-invoice-app .invoice-page {
        box-shadow: none;
    }
}

.bb-invoice-app .brand-logo,
.bb-invoice-app .invoice-qr,
.bb-invoice-app .signature-image {
    -webkit-user-drag: none;
    user-drag: none;
}

/* ============================================================
   CANVAS WORKSPACE — v1.4.0
   Flicker-free boot, exact center rotation, compact scroll UI.
   These final overrides intentionally win over legacy canvas rules.
   ============================================================ */
.bb-invoice-app.bb-is-booting .bb-canvas-world {
    visibility: hidden;
    opacity: 0;
}

.bb-invoice-app.bb-is-booting .bb-canvas-toolbar {
    pointer-events: none;
    opacity: .72;
}

.bb-invoice-app.bb-is-ready .bb-canvas-world {
    visibility: visible;
    opacity: 1;
}

.bb-invoice-app .bb-canvas-preloader {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    padding: 4px 8px;
    border: 1px solid rgba(0, 0, 0, .10);
    border-radius: 5px;
    background: rgba(255, 255, 255, .90);
    color: #666;
    font-family: "BB Text", sans-serif;
    font-size: 9px;
    line-height: 12px;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.bb-invoice-app.bb-is-ready .bb-canvas-preloader {
    display: none;
}

.bb-invoice-app .bb-canvas-loader-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: bb-invoice-loader-pulse .85s ease-in-out infinite alternate;
}

@keyframes bb-invoice-loader-pulse {
    from { opacity: .25; transform: scale(.75); }
    to { opacity: .9; transform: scale(1); }
}

/* One compact horizontal control strip. It deliberately scrolls sideways on
   narrow screens instead of wrapping into a tall toolbar. */
.bb-invoice-app .bb-canvas-toolbar {
    position: sticky;
    top: 4px;
    z-index: 10020;
    display: block;
    width: min(1180px, calc(100% - 8px));
    margin: 4px auto;
    padding: 3px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 9px rgba(0, 0, 0, .07);
    backdrop-filter: blur(8px);
}

.bb-invoice-app .bb-toolbar-scroll {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 3px;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 1px;
    scrollbar-width: thin;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
}

.bb-invoice-app .bb-toolbar-scroll::-webkit-scrollbar {
    height: 3px;
}

.bb-invoice-app .bb-toolbar-scroll::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(0, 0, 0, .18);
}

.bb-invoice-app .bb-tool-group {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-width: max-content;
    padding-right: 3px;
    border-right: 1px solid #e7e7e7;
}

.bb-invoice-app .bb-export-group {
    margin-left: 0;
    padding-right: 0;
    border-right: 0;
}

.bb-invoice-app button.bb-tool-btn,
.bb-invoice-app button.pdf-export-btn {
    min-width: 24px;
    min-height: 24px;
    height: 24px;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 9px;
    line-height: 18px;
    font-weight: 600;
}

.bb-invoice-app button.bb-icon-btn {
    width: 24px;
    min-width: 24px;
    height: 24px;
    padding: 0;
    font-size: 13px;
    line-height: 22px;
}

.bb-invoice-app button.bb-compact-text {
    min-width: 24px;
    padding-inline: 5px;
}

.bb-invoice-app button.pdf-export-btn {
    min-width: 34px;
    padding-inline: 7px;
    font-size: 9px;
}

.bb-invoice-app .bb-zoom-number-wrap {
    height: 24px;
    padding: 0 4px;
    gap: 1px;
    border-radius: 4px;
    font-size: 9px;
    line-height: 18px;
}

.bb-invoice-app .bb-zoom-number-wrap input {
    width: 31px;
    font-size: 9px;
}

.bb-invoice-app .bb-zoom-slider-wrap {
    width: 76px;
    height: 24px;
}

.bb-invoice-app .bb-zoom-slider-wrap input {
    margin: 0;
}

.bb-invoice-app .bb-canvas-shell {
    width: min(1180px, calc(100% - 8px));
    margin: 0 auto 8px;
    border-radius: 6px;
}

.bb-invoice-app .bb-canvas-viewport {
    height: clamp(520px, calc(100vh - 76px), 940px);
    min-height: 420px;
}

/* World coordinates are now the top-left of the ROTATED bounding box. The
   scale frame owns zoom; the rotation element is always center-to-center with
   that frame, so 90/270 degree rotation is geometrically exact. */
.bb-invoice-app .bb-canvas-world {
    position: absolute;
    left: 0;
    top: 0;
    width: var(--page-width);
    height: var(--page-height);
    overflow: visible;
    transform: none;
    transform-origin: 0 0;
    contain: none;
    will-change: auto;
}

.bb-invoice-app .bb-canvas-scale {
    position: relative;
    width: var(--page-width);
    height: var(--page-height);
    overflow: visible;
    transform: none;
    transform-origin: 0 0;
    backface-visibility: visible;
    contain: none;
}

.bb-invoice-app .bb-canvas-world.is-transform-fallback .bb-canvas-scale {
    transform-origin: 0 0;
}

.bb-invoice-app .bb-canvas-rotation {
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--page-width);
    height: var(--page-height);
    overflow: visible;
    zoom: 1;
    transform: translate(-50%, -50%) rotate(0deg);
    transform-origin: 50% 50%;
    transform-style: flat;
    backface-visibility: visible;
    contain: none;
}

.bb-invoice-app .invoice-page {
    left: 0;
    top: 0;
    margin: 0;
}

/* Export geometry is measured here, never by disturbing the visible canvas. */
.bb-invoice-app.bb-export-measurement {
    position: fixed;
    left: -100000px;
    top: 0;
    z-index: -2147483647;
    display: block;
    width: 612px;
    height: 792px;
    margin: 0;
    padding: 0;
    overflow: visible;
    opacity: 0;
    pointer-events: none;
}

.bb-invoice-app.bb-export-measurement .invoice-page {
    width: 612px;
    height: 792px;
    min-width: 612px;
    min-height: 792px;
    margin: 0;
    box-shadow: none;
    transform: none;
    zoom: 1;
}

.bb-invoice-app .bb-canvas-hud {
    left: 5px;
    bottom: 5px;
    padding: 3px 5px;
    border-radius: 4px;
    font-size: 8px;
    line-height: 10px;
}

.bb-invoice-app .bb-canvas-minimap {
    right: 5px;
    bottom: 5px;
    width: 108px;
    padding: 4px;
    border-radius: 5px;
}

.bb-invoice-app .bb-minimap-title {
    margin-bottom: 3px;
    font-size: 7px;
    line-height: 9px;
}

.bb-invoice-app .bb-minimap-track {
    width: 98px;
    height: 98px;
}

.bb-invoice-app .bb-invoice-status {
    top: 48px;
    right: 12px;
    max-width: min(420px, calc(100vw - 24px));
}

.bb-invoice-app:fullscreen .bb-canvas-viewport,
.bb-invoice-app.is-fullscreen-fallback .bb-canvas-viewport {
    height: calc(100vh - 42px);
}

@media (max-width: 600px) {
    .bb-invoice-app .bb-canvas-toolbar {
        position: sticky;
        top: 2px;
        width: calc(100% - 4px);
        margin: 2px auto;
        gap: 0;
    }

    .bb-invoice-app .bb-toolbar-scroll {
        gap: 2px;
    }

    .bb-invoice-app button.bb-tool-btn,
    .bb-invoice-app button.pdf-export-btn,
    .bb-invoice-app button.bb-icon-btn {
        min-height: 24px;
        height: 24px;
    }

    .bb-invoice-app .bb-zoom-slider-wrap {
        display: inline-flex;
        width: 64px;
    }

    .bb-invoice-app .bb-canvas-shell {
        width: calc(100% - 4px);
        margin-bottom: 4px;
    }

    .bb-invoice-app .bb-canvas-viewport {
        height: 72vh;
        min-height: 400px;
    }

    .bb-invoice-app .bb-canvas-minimap {
        width: 92px;
    }

    .bb-invoice-app .bb-minimap-track {
        width: 82px;
        height: 82px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bb-invoice-app .bb-canvas-loader-dot {
        animation: none;
    }
}

@media print {
    .bb-invoice-app .bb-canvas-preloader {
        display: none;
    }

    .bb-invoice-app .bb-canvas-world {
        visibility: visible;
        opacity: 1;
        width: 612px;
        height: 792px;
    }

    .bb-invoice-app .bb-canvas-scale {
        width: 612px;
        height: 792px;
        zoom: 1;
        transform: none;
    }

    .bb-invoice-app .bb-canvas-rotation {
        left: 0;
        top: 0;
        transform: none;
    }
}

@media (max-width: 760px) {
    .bb-invoice-app .bb-toolbar-scroll {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .bb-invoice-app .bb-toolbar-scroll::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }

    .bb-invoice-app .bb-tool-group {
    }

    .bb-invoice-app .bb-export-group {
    }
}

/* ============================================================
   v1.8.0 DRAGGABLE TOOLBAR + IN-TOOLBAR PDF ACTION
   The toolbar is the sticky control surface. Its tool rail can be dragged,
   swiped, wheeled or keyboard-scrolled while PDF remains visible at the end.
   ============================================================ */
.bb-invoice-app .bb-canvas-toolbar {
    position: sticky;
    top: max(4px, env(safe-area-inset-top));
    z-index: 10020;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 3px;
    width: min(1180px, calc(100% - 8px));
    margin: 4px auto;
    padding: 3px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, .10);
    border-radius: 6px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 2px 9px rgba(0, 0, 0, .07);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.bb-invoice-app .bb-toolbar-scroll {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 3px;
    min-width: 0;
    width: auto;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 1px;
    scrollbar-width: thin;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y pinch-zoom;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: auto;
}

.bb-invoice-app .bb-toolbar-scroll.is-dragging {
    cursor: grabbing;
}

.bb-invoice-app .bb-toolbar-scroll:focus-visible {
    outline: 2px solid #387cc0;
    outline-offset: -2px;
    border-radius: 4px;
}

.bb-invoice-app .bb-toolbar-scroll button,
.bb-invoice-app .bb-toolbar-scroll input,
.bb-invoice-app .bb-toolbar-scroll label {
    user-select: none;
    -webkit-user-select: none;
}

.bb-invoice-app .bb-toolbar-export-slot {
    position: relative;
    z-index: 3;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    align-self: stretch;
    padding-left: 4px;
    border-left: 1px solid #dedede;
    background: rgba(255, 255, 255, .98);
}

.bb-invoice-app .bb-canvas-toolbar button.pdf-export-btn.bb-toolbar-export {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    inset: auto;
    z-index: auto;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    min-width: 48px;
    max-width: 48px;
    height: 24px;
    min-height: 24px;
    max-height: 24px;
    margin: 0;
    padding: 0 7px;
    overflow: hidden;
    border: 1px solid #8f1f16;
    border-radius: 4px;
    background: #b42318;
    background-image: none;
    color: #fff;
    font-family: "BB Text", sans-serif;
    font-size: 9px;
    line-height: 22px;
    font-style: normal;
    font-weight: 700;
    letter-spacing: .035em;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    text-shadow: none;
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
    box-shadow: 0 1px 4px rgba(88, 20, 15, .24);
    transition: background-color .14s ease, border-color .14s ease, box-shadow .14s ease, opacity .14s ease;
}

.bb-invoice-app .bb-canvas-toolbar button.pdf-export-btn.bb-toolbar-export:hover {
    border-color: #761a13;
    background: #951f16;
    color: #fff;
    box-shadow: 0 2px 6px rgba(88, 20, 15, .30);
}

.bb-invoice-app .bb-canvas-toolbar button.pdf-export-btn.bb-toolbar-export:focus-visible {
    outline: 2px solid #387cc0;
    outline-offset: 1px;
}

.bb-invoice-app .bb-canvas-toolbar button.pdf-export-btn.bb-toolbar-export:disabled,
.bb-invoice-app .bb-canvas-toolbar button.pdf-export-btn.bb-toolbar-export[aria-busy="true"] {
    opacity: .78;
    cursor: progress;
}

.bb-invoice-app .bb-canvas-toolbar button.pdf-export-btn.bb-toolbar-export[aria-busy="true"] {
    color: transparent;
}

.bb-invoice-app .bb-canvas-toolbar button.pdf-export-btn.bb-toolbar-export[aria-busy="true"]::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    box-sizing: border-box;
    border: 1.5px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: bb-export-spin .7s linear infinite;
}

@keyframes bb-export-spin {
    to { transform: rotate(360deg); }
}

body.admin-bar .bb-invoice-app .bb-canvas-toolbar {
    top: calc(36px + env(safe-area-inset-top));
}

@media (max-width: 782px) {
    body.admin-bar .bb-invoice-app .bb-canvas-toolbar {
        top: calc(50px + env(safe-area-inset-top));
    }
}

@media (max-width: 600px) {
    .bb-invoice-app .bb-canvas-toolbar {
        width: calc(100% - 4px);
        margin: 2px auto;
        padding: 2px;
        gap: 2px;
    }

    .bb-invoice-app .bb-toolbar-scroll {
        gap: 2px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .bb-invoice-app .bb-toolbar-scroll::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }

    .bb-invoice-app .bb-toolbar-export-slot {
        padding-left: 3px;
    }

    .bb-invoice-app .bb-canvas-toolbar button.pdf-export-btn.bb-toolbar-export {
        width: 44px;
        min-width: 44px;
        max-width: 44px;
        padding-inline: 5px;
    }
}

@media print {
    .bb-invoice-app .bb-toolbar-export-slot {
        display: none;
    }
}

/* ============================================================
   QR LINK POSITIONING — v1.10.0
   Geometrically lock the center URL to the 42x42 QR box and
   anchor the secondary URL tightly to the QR's lower edge.
   ============================================================ */
.bb-invoice-app .qr-wrapper {
    position: relative;
    width: 42px;
    height: 47px;
    text-align: center;
    overflow: visible;
}

.bb-invoice-app .invoice-qr {
    position: absolute;
    inset: 0 auto auto 0;
    display: block;
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.bb-invoice-app .qr-center-link {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    width: 42px;
    height: 42px;
    max-width: 42px;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    transform: none;
    white-space: nowrap;
    overflow: hidden;
    font-family: "BB Text", sans-serif;
    font-size: 3.4px;
    line-height: 4px;
    font-weight: 400;
    letter-spacing: -.02em;
    color: #ffffff00;
    text-align: center;
    text-decoration: none;
}

.bb-invoice-app .qr-bottom-link {
    position: absolute;
    left: 50%;
    top: 44px;
    z-index: 2;
    display: block;
    width: max-content;
    max-width: none;
    margin: 0;
    padding: 0;
    transform: translateX(-50%);
    white-space: nowrap;
    font-family: "BB Text", sans-serif;
    font-size: 3.6px;
    line-height: 5px;
    font-weight: 400;
    letter-spacing: -.01em;
    color: #999;
    text-align: center;
    text-decoration: none;
}


/* ============================================================
   v1.10.0 FREE-SLIDE TOOLBAR + UNIFIED ZOOM + EXISTING DARK THEME
   No scroll snapping: drag/swipe/trackpad motion stops naturally.
   `.theme-dark` may exist on body, a page wrapper, or the app itself.
   ============================================================ */
.bb-invoice-app .bb-toolbar-scroll {
    scroll-behavior: auto;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
    scrollbar-gutter: stable;
}

.bb-invoice-app .bb-toolbar-scroll.is-dragging {
    cursor: grabbing;
}

.bb-invoice-app .bb-tool-group,
.bb-invoice-app .bb-toolbar-export-slot {
    scroll-margin: 0;
}

.bb-invoice-app .bb-zoom-number-wrap.bb-zoom-unified {
    width: 58px;
    min-width: 58px;
    max-width: 58px;
    height: 24px;
    min-height: 24px;
    max-height: 24px;
    gap: 1px;
    padding: 0 4px;
    border-radius: 4px;
    cursor: text;
}

.bb-invoice-app .bb-zoom-number-wrap.bb-zoom-unified input {
    width: 39px;
    min-width: 0;
    height: 22px;
    min-height: 22px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 9px;
    line-height: 22px;
    text-align: right;
}

.bb-invoice-app .bb-zoom-number-wrap.bb-zoom-unified > span[aria-hidden="true"] {
    flex: 0 0 auto;
    font-size: 9px;
    line-height: 22px;
    pointer-events: none;
}

/* Existing-site dark mode integration. The invoice sheet itself intentionally
   remains white because it represents the exported PDF; only editor chrome changes. */
.theme-dark .bb-invoice-app .bb-canvas-toolbar,
.bb-invoice-app.theme-dark .bb-canvas-toolbar {
    border-color: rgba(255, 255, 255, .12);
    background: rgba(24, 24, 24, .96);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}

.theme-dark .bb-invoice-app .bb-toolbar-export-slot,
.bb-invoice-app.theme-dark .bb-toolbar-export-slot {
    border-left-color: rgba(255, 255, 255, .12);
    background: rgba(24, 24, 24, .98);
}

.theme-dark .bb-invoice-app .bb-tool-group,
.bb-invoice-app.theme-dark .bb-tool-group {
    border-right-color: rgba(255, 255, 255, .11);
}

.theme-dark .bb-invoice-app button.bb-tool-btn,
.bb-invoice-app.theme-dark button.bb-tool-btn,
.theme-dark .bb-invoice-app .bb-zoom-number-wrap,
.bb-invoice-app.theme-dark .bb-zoom-number-wrap {
    border-color: #4a4a4a;
    background: #272727;
    color: #e9e9e9;
}

.theme-dark .bb-invoice-app button.bb-tool-btn:hover,
.bb-invoice-app.theme-dark button.bb-tool-btn:hover {
    border-color: #5c5c5c;
    background: #343434;
}

.theme-dark .bb-invoice-app button.bb-tool-btn.is-active,
.bb-invoice-app.theme-dark button.bb-tool-btn.is-active {
    border-color: #d6d6d6;
    background: #e7e7e7;
    color: #202020;
}

.theme-dark .bb-invoice-app .bb-zoom-number-wrap input,
.bb-invoice-app.theme-dark .bb-zoom-number-wrap input {
    color: #f3f3f3;
}

.theme-dark .bb-invoice-app .bb-canvas-shell,
.bb-invoice-app.theme-dark .bb-canvas-shell {
    border-color: #3d3d3d;
    background: #202020;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .035);
}

.theme-dark .bb-invoice-app .bb-canvas-viewport,
.bb-invoice-app.theme-dark .bb-canvas-viewport {
    background-color: #171717;
    background-image: radial-gradient(circle at center, rgba(255, 255, 255, .07) 1px, transparent 1px);
}

.theme-dark .bb-invoice-app .bb-ruler,
.theme-dark .bb-invoice-app .bb-ruler-corner,
.bb-invoice-app.theme-dark .bb-ruler,
.bb-invoice-app.theme-dark .bb-ruler-corner {
    border-color: #444;
    background: rgba(30, 30, 30, .96);
    color: #bdbdbd;
}

.theme-dark .bb-invoice-app .bb-canvas-minimap,
.bb-invoice-app.theme-dark .bb-canvas-minimap {
    border-color: #484848;
    background: rgba(30, 30, 30, .94);
    color: #d0d0d0;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .38);
}

.theme-dark .bb-invoice-app .bb-minimap-track,
.bb-invoice-app.theme-dark .bb-minimap-track {
    border-color: #555;
    background: #151515;
}

.theme-dark .bb-invoice-app .bb-shortcuts-card,
.bb-invoice-app.theme-dark .bb-shortcuts-card {
    background: #222;
    color: #ededed;
    box-shadow: 0 16px 50px rgba(0, 0, 0, .55);
}

.theme-dark .bb-invoice-app kbd,
.bb-invoice-app.theme-dark kbd {
    border-color: #555;
    background: #303030;
    color: #f3f3f3;
}

.theme-dark .bb-invoice-app .bb-invoice-status,
.bb-invoice-app.theme-dark .bb-invoice-status {
    border-color: #494949;
    background: rgba(30, 30, 30, .96);
    color: #efefef;
}

.theme-dark .bb-invoice-app .bb-canvas-hud,
.bb-invoice-app.theme-dark .bb-canvas-hud,
.theme-dark .bb-invoice-app .bb-canvas-preloader,
.bb-invoice-app.theme-dark .bb-canvas-preloader {
    border-color: rgba(255, 255, 255, .13);
    background: rgba(28, 28, 28, .90);
    color: #d7d7d7;
}

.theme-dark .bb-invoice-app .bb-toolbar-scroll,
.bb-invoice-app.theme-dark .bb-toolbar-scroll {
    scrollbar-color: #555 transparent;
}

.theme-dark .bb-invoice-app .bb-toolbar-scroll::-webkit-scrollbar-thumb,
.bb-invoice-app.theme-dark .bb-toolbar-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .22);
}

.theme-dark .bb-invoice-app .bb-zoom-slider-wrap input,
.bb-invoice-app.theme-dark .bb-zoom-slider-wrap input {
    accent-color: #d7d7d7;
}

.theme-dark .bb-invoice-app .bb-ruler-mark,
.bb-invoice-app.theme-dark .bb-ruler-mark {
    color: #bdbdbd;
}

.theme-dark .bb-invoice-app .bb-ruler-mark::after,
.bb-invoice-app.theme-dark .bb-ruler-mark::after {
    background: #747474;
}


/* ============================================================
   v1.11.0 UNIVERSAL MANUAL TOOLBAR INTERACTION
   Same controls and scrolling behavior at every viewport width.
   No snap, momentum, glide, delayed target, or automatic scroll animation.
   ============================================================ */
.bb-invoice-app .bb-canvas-toolbar {
    flex-wrap: nowrap;
}

.bb-invoice-app .bb-toolbar-scroll {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    align-items: center;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: auto;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
    -webkit-overflow-scrolling: auto;
    touch-action: pan-y pinch-zoom;
    cursor: grab;
}

.bb-invoice-app .bb-toolbar-scroll.is-dragging {
    cursor: grabbing;
}

/* The native zoom controls must always receive mouse, touch and pen input
   themselves and must never become a toolbar-drag gesture. */
.bb-invoice-app .bb-zoom-number-wrap,
.bb-invoice-app .bb-zoom-slider-wrap,
.bb-invoice-app .bb-zoom-number-wrap input,
.bb-invoice-app .bb-zoom-slider-wrap input {
    pointer-events: auto;
}

.bb-invoice-app .bb-zoom-slider-wrap {
    display: inline-flex;
    flex: 0 0 auto;
}

.bb-invoice-app .bb-zoom-slider-wrap input[type="range"] {
    cursor: pointer;
}

/* Keep every toolbar action available on both sides of the historical
   600px breakpoint. Only dimensions adapt; capabilities do not. */
@media (max-width: 600px) {
    .bb-invoice-app .bb-zoom-slider-wrap {
        display: inline-flex;
        width: 64px;
    }

    .bb-invoice-app button.bb-tool-btn,
    .bb-invoice-app button.bb-icon-btn,
    .bb-invoice-app .bb-zoom-number-wrap,
    .bb-invoice-app .bb-zoom-slider-wrap,
    .bb-invoice-app .bb-canvas-toolbar button.pdf-export-btn.bb-toolbar-export {
        min-height: 24px;
        max-height: 24px;
    }
}

@media (min-width: 601px) {
    .bb-invoice-app .bb-zoom-slider-wrap {
        display: inline-flex;
    }
}
