/*
Theme Name: BillSaaS Invoice
Theme URI: https://example.com/
Author: BillSaaS
Description: Responsive free GST invoice generator WordPress theme.
Version: 1.2.4
Requires at least: 6.0
Requires PHP: 7.4
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: billsaas-invoice
*/

:root {
    --bs-primary: #111827;
    --bs-border: #e5e7eb;
    --bs-muted: #6b7280;
    --bs-bg: #f7f8fa;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    background: var(--bs-bg);
    color: #1f2937;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.5;
}

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

.bs-site-header {
    background: #fff;
    border-bottom: 1px solid var(--bs-border);
}

.bs-header-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.bs-brand {
    color: var(--bs-primary);
    text-decoration: none;
    font-size: 22px;
    font-weight: 800;
}

.bs-site-main {
    min-height: calc(100vh - 140px);
}

.bs-container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 20px;
}

.bs-site-footer {
    background: #fff;
    border-top: 1px solid var(--bs-border);
    padding: 24px 20px;
    text-align: center;
    color: var(--bs-muted);
    font-size: 13px;
}

.bs-app {
    width: 100%;
}

.bs-hero {
    text-align: center;
    margin-bottom: 24px;
}

.bs-hero h1 {
    margin: 0 0 8px;
    font-size: clamp(28px, 5vw, 42px);
    line-height: 1.1;
}

.bs-hero p {
    margin: 0;
    color: var(--bs-muted);
}

.bs-card {
    background: #fff;
    border: 1px solid var(--bs-border);
    border-radius: 14px;
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: 0 2px 12px rgba(15, 23, 42, .04);
}

.bs-title {
    margin: 0 0 16px;
    font-size: 20px;
}

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

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

.bs-field label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 700;
}

.bs-field input,
.bs-field textarea,
.bs-field select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    outline: none;
}

.bs-field input:focus,
.bs-field textarea:focus,
.bs-field select:focus {
    border-color: #111827;
    box-shadow: 0 0 0 2px rgba(17,24,39,.08);
}

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

.bs-logo-box {
    border: 1px dashed #cbd5e1;
    padding: 14px;
    border-radius: 9px;
    background: #fafafa;
}

.bs-muted {
    color: var(--bs-muted);
    font-size: 12px;
    margin-top: 6px;
}

.bs-table-wrap { width: 100%; overflow-x: visible; }

.bs-items {
    width: 100%;
    min-width: 780px;
    border-collapse: collapse;
}

.bs-items th,
.bs-items td {
    border-bottom: 1px solid var(--bs-border);
    padding: 9px 7px;
    text-align: left;
    vertical-align: middle;
}

.bs-items th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.bs-items input {
    width: 100%;
    padding: 8px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
}

.bs-btn {
    border: 0;
    border-radius: 8px;
    padding: 10px 15px;
    cursor: pointer;
    font-weight: 700;
}

.bs-btn:focus-visible {
    outline: 3px solid rgba(17,24,39,.2);
}

.bs-primary { background: var(--bs-primary); color: #fff; }
.bs-secondary { background: #f3f4f6; color: #111827; }
.bs-danger { background: #fee2e2; color: #991b1b; }

.bs-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.bs-totals {
    max-width: 430px;
    margin-left: auto;
}

.bs-total-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 7px 0;
}

.bs-grand {
    border-top: 2px solid #111827;
    margin-top: 6px;
    padding-top: 12px;
    font-size: 20px;
    font-weight: 800;
}

.bs-preview {
    display: none;
}

.bs-preview-head {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 2px solid #111827;
    padding-bottom: 18px;
}

.bs-preview-head h1 {
    margin: 0 0 8px;
    font-size: 28px;
}

.bs-preview-right {
    text-align: right;
}

.bs-preview-right h2 {
    margin: 0 0 10px;
}

.bs-logo-preview {
    max-width: 170px;
    max-height: 90px;
    object-fit: contain;
    display: none;
    margin-bottom: 10px;
}

.bs-preview-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 22px;
}

.bs-preview-table th,
.bs-preview-table td {
    border: 1px solid #d1d5db;
    padding: 9px;
}

.bs-preview-table th {
    background: #f9fafb;
}

.bs-error {
    color: #b91c1c;
    font-size: 13px;
    margin-top: 8px;
}

@media (max-width: 760px) {
    .bs-grid { grid-template-columns: 1fr; }
    .bs-card { padding: 16px; }
    .bs-preview-head { display: block; }
    .bs-preview-right { text-align: left; margin-top: 16px; }
    .bs-container { padding: 22px 12px; }
}


/* Mobile invoice-table redesign */
@media (max-width: 760px) {
    #billsaas-app {
        width: 100%;
        overflow-x: hidden;
    }

    .bs-card {
        width: 100%;
        border-radius: 10px;
        padding: 14px;
    }

    .bs-field input,
    .bs-field textarea,
    .bs-field select,
    .bs-items input {
        font-size: 16px; /* avoids mobile browser zoom while typing */
        min-height: 44px;
    }

    .bs-field textarea {
        min-height: 100px;
    }

    .bs-actions .bs-btn {
        flex: 1 1 100%;
        min-height: 46px;
    }

    .bs-totals {
        width: 100%;
        max-width: none;
    }

    .bs-items {
        min-width: 0;
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;
    }

    .bs-items thead {
        display: none;
    }

    .bs-items,
    .bs-items tbody,
    .bs-items tr,
    .bs-items td {
        display: block;
        width: 100%;
    }

    .bs-items tr {
        background: #fafafa;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        padding: 10px;
        margin-bottom: 12px;
    }

    .bs-items td {
        border: 0;
        padding: 6px 0;
    }

    .bs-items td::before {
        content: attr(data-label);
        display: block;
        font-size: 12px;
        font-weight: 700;
        color: #6b7280;
        margin-bottom: 5px;
    }

    .bs-items td.bs-item-amount-cell {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding-top: 10px;
        border-top: 1px solid #e5e7eb;
        margin-top: 4px;
    }

    .bs-items td.bs-item-amount-cell::before {
        margin: 0;
    }

    .bs-items td.bs-item-action {
        text-align: right;
        padding-top: 8px;
    }

    .bs-items td.bs-item-action::before {
        display: none;
    }

    .bs-items .bs-remove {
        min-height: 42px;
        min-width: 48px;
    }

    .bs-preview-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .bs-preview-table th,
    .bs-preview-table td {
        padding: 8px;
        font-size: 13px;
    }

    .bs-preview-head h1 {
        font-size: 24px;
        word-break: break-word;
    }
}


/* v1.2.4 workspace, live preview and invoice controls */
.bs-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.78fr);
    gap: 22px;
    align-items: start;
}

.bs-live-preview-column {
    position: sticky;
    top: 20px;
    min-width: 0;
}

.bs-live-preview-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 10px;
    padding: 0 2px;
}

.bs-preview {
    display: block;
    margin-bottom: 0;
    max-height: calc(100vh - 90px);
    overflow: auto;
}

.bs-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: end;
}

.bs-toggle {
    min-height: 44px;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #d1d5db;
    background: #f3f4f6;
    color: #111827;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    font-weight: 700;
    text-align: left;
}

.bs-toggle.active {
    background: #111827;
    color: #fff;
    border-color: #111827;
}

.bs-toggle-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #9ca3af;
    flex: 0 0 14px;
}

.bs-toggle.active .bs-toggle-dot {
    background: #fff;
}

.bs-status-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.bs-status-paid {
    background: #dcfce7;
    color: #166534;
}

.bs-status-unpaid {
    background: #fee2e2;
    color: #991b1b;
}

.bs-preview-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
}

@media (max-width: 980px) {
    .bs-workspace {
        grid-template-columns: 1fr;
    }

    .bs-live-preview-column {
        position: static;
    }

    .bs-preview {
        max-height: none;
        overflow: visible;
    }
}

@media (max-width: 760px) {
    .bs-settings-grid {
        grid-template-columns: 1fr;
    }

    .bs-live-preview-title {
        margin-top: 8px;
    }
}


/* v1.2.4 settings, GST presets and responsive preview modal */
.bs-live-preview-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.bs-gst-presets {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
}

.bs-gst-label {
    font-size: 13px;
    font-weight: 800;
    margin-right: 2px;
}

.bs-gst-chip {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #111827;
    border-radius: 999px;
    padding: 7px 12px;
    cursor: pointer;
    font-weight: 700;
}

.bs-gst-chip.active {
    background: #111827;
    color: #fff;
    border-color: #111827;
}

.bs-gst-presets .bs-muted {
    flex-basis: 100%;
    margin-top: 2px;
}

.bs-live-preview-column {
    min-width: 0;
}

.bs-preview {
    min-width: 0;
}

.bs-preview-modal {
    position: fixed !important;
    z-index: 999999;
    inset: 0;
    width: 100vw !important;
    max-width: none !important;
    height: 100vh !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    overflow: auto !important;
    background: #f7f8fa !important;
    padding: 18px !important;
}

.bs-preview-modal .bs-preview-inner {
    max-width: 820px;
    margin: 0 auto;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
}

.bs-modal-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    max-width: 820px;
    margin: 0 auto 12px;
    padding: 10px 0;
}

.bs-modal-close {
    min-width: 44px;
    min-height: 44px;
}

.bs-mobile-preview-backdrop {
    display: none;
}

@media (max-width: 980px) {
    .bs-workspace {
        display: block;
    }

    .bs-live-preview-column {
        position: static;
    }

    .bs-live-preview-title {
        margin-top: 10px;
    }

    #bs-invoice-preview.bs-mobile-preview-hidden {
        display: none !important;
    }

    #bs-invoice-preview.bs-mobile-preview-open {
        display: block !important;
    }
}

@media (max-width: 600px) {
    .bs-container {
        padding: 12px 8px;
    }

    .bs-card {
        border-radius: 10px;
        padding: 13px;
        margin-bottom: 12px;
    }

    .bs-hero h1 {
        font-size: 28px;
    }

    .bs-hero p {
        font-size: 14px;
    }

    .bs-settings-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .bs-toggle {
        min-height: 48px;
    }

    .bs-gst-presets {
        gap: 7px;
    }

    .bs-gst-chip {
        flex: 1 1 calc(20% - 7px);
        min-width: 52px;
        padding: 9px 8px;
    }

    .bs-live-preview-actions .bs-btn {
        min-height: 42px;
        padding: 8px 10px;
    }

    .bs-preview-modal {
        padding: 8px !important;
    }

    .bs-preview-modal .bs-preview-inner {
        padding: 12px;
        border-radius: 8px;
    }

    .bs-preview-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .bs-preview-head h1 {
        font-size: 22px;
    }

    .bs-preview-right {
        margin-top: 12px;
    }

    .bs-preview-actions {
        position: sticky;
        bottom: 0;
        background: #fff;
        padding: 10px 0 0;
    }

    .bs-preview-actions .bs-btn {
        width: 100%;
        min-height: 46px;
    }
}


/* v1.2.4: item GST dropdown and responsive item layout */
.bs-items select.bs-item-gst {
    width: 100%;
    min-height: 42px;
    padding: 8px 30px 8px 9px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #fff;
    color: #111827;
    font-size: 14px;
}

.bs-items select.bs-item-gst:focus {
    outline: none;
    border-color: #111827;
    box-shadow: 0 0 0 2px rgba(17,24,39,.08);
}

@media (max-width: 900px) {
    .bs-items {
        min-width: 0;
        width: 100%;
    }

    .bs-items thead {
        display: none;
    }

    .bs-items,
    .bs-items tbody,
    .bs-items tr,
    .bs-items td {
        display: block;
        width: 100%;
    }

    .bs-items tr {
        background: #fafafa;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        padding: 10px;
        margin-bottom: 12px;
    }

    .bs-items td {
        border: 0;
        padding: 6px 0;
    }

    .bs-items td::before {
        content: attr(data-label);
        display: block;
        font-size: 12px;
        font-weight: 700;
        color: #6b7280;
        margin-bottom: 5px;
    }

    .bs-items td.bs-item-amount-cell {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding-top: 10px;
        border-top: 1px solid #e5e7eb;
        margin-top: 4px;
    }

    .bs-items td.bs-item-amount-cell::before {
        margin: 0;
    }

    .bs-items td.bs-item-action {
        text-align: right;
        padding-top: 8px;
    }

    .bs-items td.bs-item-action::before {
        display: none;
    }

    .bs-items input,
    .bs-items select.bs-item-gst {
        width: 100%;
        min-height: 44px;
        font-size: 16px;
    }
}


/* v1.2.4: prevent Amount column clipping inside the desktop live-preview layout */
.bs-builder .bs-table-wrap {
    width: 100%;
    overflow-x: visible;
}

.bs-builder .bs-items {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.bs-builder .bs-items th:nth-child(1),
.bs-builder .bs-items td:nth-child(1) { width: 22%; }

.bs-builder .bs-items th:nth-child(2),
.bs-builder .bs-items td:nth-child(2) { width: 18%; }

.bs-builder .bs-items th:nth-child(3),
.bs-builder .bs-items td:nth-child(3) { width: 11%; }

.bs-builder .bs-items th:nth-child(4),
.bs-builder .bs-items td:nth-child(4) { width: 13%; }

.bs-builder .bs-items th:nth-child(5),
.bs-builder .bs-items td:nth-child(5) { width: 14%; }

.bs-builder .bs-items th:nth-child(6),
.bs-builder .bs-items td:nth-child(6) { width: 15%; }

.bs-builder .bs-items th:nth-child(7),
.bs-builder .bs-items td:nth-child(7) { width: 7%; }

.bs-builder .bs-items th,
.bs-builder .bs-items td {
    overflow: hidden;
}

.bs-builder .bs-items input,
.bs-builder .bs-items select.bs-item-gst {
    min-width: 0;
    width: 100%;
}

.bs-builder .bs-items .bs-item-amount-cell {
    white-space: nowrap;
    font-size: 13px;
}

.bs-builder .bs-items .bs-item-action {
    text-align: center;
}

@media (max-width: 1100px) and (min-width: 901px) {
    .bs-workspace {
        grid-template-columns: 1fr;
    }

    .bs-live-preview-column {
        position: static;
    }

    .bs-builder .bs-items th,
    .bs-builder .bs-items td {
        font-size: 13px;
    }
}


.bs-footer-inner {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
}

.bs-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.bs-footer-links a {
    color: #374151;
    text-decoration: none;
    font-weight: 700;
}

.bs-footer-links a:hover,
.bs-footer-links a:focus {
    text-decoration: underline;
}

.bs-footer-copy {
    width: 100%;
    padding-top: 4px;
    border-top: 1px solid #e5e7eb;
}

@media (max-width: 600px) {
    .bs-footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .bs-footer-links {
        justify-content: center;
    }
}


.bs-content-page {
    max-width: 900px;
    margin: 0 auto;
}

.bs-content-page h1 {
    margin-top: 0;
    font-size: 34px;
}

.bs-content-page h2 {
    margin-top: 26px;
    font-size: 21px;
}

.bs-content-page li {
    margin-bottom: 8px;
}


/* v1.2.4 final layout fixes */
.bs-workspace {
    grid-template-columns: minmax(0, 1.62fr) minmax(330px, 0.88fr);
    gap: 18px;
}

.bs-live-preview-column {
    max-width: 480px;
    justify-self: end;
    width: 100%;
}

.bs-live-preview-column .bs-preview {
    width: 100%;
}

.bs-builder .bs-items {
    table-layout: fixed;
    width: 100%;
    min-width: 0;
}

.bs-builder .bs-items th,
.bs-builder .bs-items td {
    padding: 8px 6px;
}

.bs-builder .bs-items th:nth-child(1),
.bs-builder .bs-items td:nth-child(1) { width: 24%; }

.bs-builder .bs-items th:nth-child(2),
.bs-builder .bs-items td:nth-child(2) { width: 16%; }

.bs-builder .bs-items th:nth-child(3),
.bs-builder .bs-items td:nth-child(3) { width: 9%; }

.bs-builder .bs-items th:nth-child(4),
.bs-builder .bs-items td:nth-child(4) { width: 11%; }

.bs-builder .bs-items th:nth-child(5),
.bs-builder .bs-items td:nth-child(5) { width: 13%; }

.bs-builder .bs-items th:nth-child(6),
.bs-builder .bs-items td:nth-child(6) { width: 14%; }

.bs-builder .bs-items th:nth-child(7),
.bs-builder .bs-items td:nth-child(7) { width: 13%; }

.bs-builder .bs-items .bs-item-action {
    text-align: center;
    white-space: nowrap;
}

.bs-builder .bs-items .bs-item-action .bs-remove {
    width: 100%;
    min-height: 40px;
    padding: 8px 7px;
    font-size: 12px;
}

.bs-builder .bs-items input,
.bs-builder .bs-items select.bs-item-gst {
    min-width: 0;
    max-width: 100%;
    height: 42px;
}

.bs-builder .bs-items select.bs-item-gst {
    padding: 8px 26px 8px 8px;
    font-size: 14px;
}

@media (max-width: 1050px) and (min-width: 901px) {
    .bs-workspace {
        grid-template-columns: 1fr;
    }

    .bs-live-preview-column {
        max-width: 100%;
        justify-self: stretch;
    }
}

@media (max-width: 900px) {
    .bs-workspace {
        grid-template-columns: 1fr;
    }

    .bs-live-preview-column {
        max-width: none;
        justify-self: stretch;
    }
}


/* v1.2.4 page rendering fix */
.bs-site-main {
    min-height: calc(100vh - 180px);
    padding: 42px 0;
}

.bs-page-content {
    line-height: 1.7;
}

.bs-page-content img {
    max-width: 100%;
    height: auto;
}

@media print {
    .bs-live-preview-title,
    .bs-modal-toolbar,
    .bs-preview-actions,
    #bs_open_preview,
    #bs_print_top,
    .bs-status-card {
        display: none !important;
    }

    #bs-invoice-preview,
    #bs-invoice-preview.bs-preview-modal {
        position: static !important;
        inset: auto !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 0 !important;
        background: #fff !important;
    }
}


/* v1.2.4: item GST dropdown and responsive item layout */
.bs-items select.bs-item-gst {
    width: 100%;
    min-height: 42px;
    padding: 8px 30px 8px 9px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #fff;
    color: #111827;
    font-size: 14px;
}

.bs-items select.bs-item-gst:focus {
    outline: none;
    border-color: #111827;
    box-shadow: 0 0 0 2px rgba(17,24,39,.08);
}

@media (max-width: 900px) {
    .bs-items {
        min-width: 0;
        width: 100%;
    }

    .bs-items thead {
        display: none;
    }

    .bs-items,
    .bs-items tbody,
    .bs-items tr,
    .bs-items td {
        display: block;
        width: 100%;
    }

    .bs-items tr {
        background: #fafafa;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        padding: 10px;
        margin-bottom: 12px;
    }

    .bs-items td {
        border: 0;
        padding: 6px 0;
    }

    .bs-items td::before {
        content: attr(data-label);
        display: block;
        font-size: 12px;
        font-weight: 700;
        color: #6b7280;
        margin-bottom: 5px;
    }

    .bs-items td.bs-item-amount-cell {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding-top: 10px;
        border-top: 1px solid #e5e7eb;
        margin-top: 4px;
    }

    .bs-items td.bs-item-amount-cell::before {
        margin: 0;
    }

    .bs-items td.bs-item-action {
        text-align: right;
        padding-top: 8px;
    }

    .bs-items td.bs-item-action::before {
        display: none;
    }

    .bs-items input,
    .bs-items select.bs-item-gst {
        width: 100%;
        min-height: 44px;
        font-size: 16px;
    }
}


/* v1.2.4: prevent Amount column clipping inside the desktop live-preview layout */
.bs-builder .bs-table-wrap {
    width: 100%;
    overflow-x: visible;
}

.bs-builder .bs-items {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.bs-builder .bs-items th:nth-child(1),
.bs-builder .bs-items td:nth-child(1) { width: 22%; }

.bs-builder .bs-items th:nth-child(2),
.bs-builder .bs-items td:nth-child(2) { width: 18%; }

.bs-builder .bs-items th:nth-child(3),
.bs-builder .bs-items td:nth-child(3) { width: 11%; }

.bs-builder .bs-items th:nth-child(4),
.bs-builder .bs-items td:nth-child(4) { width: 13%; }

.bs-builder .bs-items th:nth-child(5),
.bs-builder .bs-items td:nth-child(5) { width: 14%; }

.bs-builder .bs-items th:nth-child(6),
.bs-builder .bs-items td:nth-child(6) { width: 15%; }

.bs-builder .bs-items th:nth-child(7),
.bs-builder .bs-items td:nth-child(7) { width: 7%; }

.bs-builder .bs-items th,
.bs-builder .bs-items td {
    overflow: hidden;
}

.bs-builder .bs-items input,
.bs-builder .bs-items select.bs-item-gst {
    min-width: 0;
    width: 100%;
}

.bs-builder .bs-items .bs-item-amount-cell {
    white-space: nowrap;
    font-size: 13px;
}

.bs-builder .bs-items .bs-item-action {
    text-align: center;
}

@media (max-width: 1100px) and (min-width: 901px) {
    .bs-workspace {
        grid-template-columns: 1fr;
    }

    .bs-live-preview-column {
        position: static;
    }

    .bs-builder .bs-items th,
    .bs-builder .bs-items td {
        font-size: 13px;
    }
}


.bs-footer-inner {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
}

.bs-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.bs-footer-links a {
    color: #374151;
    text-decoration: none;
    font-weight: 700;
}

.bs-footer-links a:hover,
.bs-footer-links a:focus {
    text-decoration: underline;
}

.bs-footer-copy {
    width: 100%;
    padding-top: 4px;
    border-top: 1px solid #e5e7eb;
}

@media (max-width: 600px) {
    .bs-footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .bs-footer-links {
        justify-content: center;
    }
}


.bs-content-page {
    max-width: 900px;
    margin: 0 auto;
}

.bs-content-page h1 {
    margin-top: 0;
    font-size: 34px;
}

.bs-content-page h2 {
    margin-top: 26px;
    font-size: 21px;
}

.bs-content-page li {
    margin-bottom: 8px;
}


/* v1.2.4 final layout fixes */
.bs-workspace {
    grid-template-columns: minmax(0, 1.62fr) minmax(330px, 0.88fr);
    gap: 18px;
}

.bs-live-preview-column {
    max-width: 480px;
    justify-self: end;
    width: 100%;
}

.bs-live-preview-column .bs-preview {
    width: 100%;
}

.bs-builder .bs-items {
    table-layout: fixed;
    width: 100%;
    min-width: 0;
}

.bs-builder .bs-items th,
.bs-builder .bs-items td {
    padding: 8px 6px;
}

.bs-builder .bs-items th:nth-child(1),
.bs-builder .bs-items td:nth-child(1) { width: 24%; }

.bs-builder .bs-items th:nth-child(2),
.bs-builder .bs-items td:nth-child(2) { width: 16%; }

.bs-builder .bs-items th:nth-child(3),
.bs-builder .bs-items td:nth-child(3) { width: 9%; }

.bs-builder .bs-items th:nth-child(4),
.bs-builder .bs-items td:nth-child(4) { width: 11%; }

.bs-builder .bs-items th:nth-child(5),
.bs-builder .bs-items td:nth-child(5) { width: 13%; }

.bs-builder .bs-items th:nth-child(6),
.bs-builder .bs-items td:nth-child(6) { width: 14%; }

.bs-builder .bs-items th:nth-child(7),
.bs-builder .bs-items td:nth-child(7) { width: 13%; }

.bs-builder .bs-items .bs-item-action {
    text-align: center;
    white-space: nowrap;
}

.bs-builder .bs-items .bs-item-action .bs-remove {
    width: 100%;
    min-height: 40px;
    padding: 8px 7px;
    font-size: 12px;
}

.bs-builder .bs-items input,
.bs-builder .bs-items select.bs-item-gst {
    min-width: 0;
    max-width: 100%;
    height: 42px;
}

.bs-builder .bs-items select.bs-item-gst {
    padding: 8px 26px 8px 8px;
    font-size: 14px;
}

@media (max-width: 1050px) and (min-width: 901px) {
    .bs-workspace {
        grid-template-columns: 1fr;
    }

    .bs-live-preview-column {
        max-width: 100%;
        justify-self: stretch;
    }
}

@media (max-width: 900px) {
    .bs-workspace {
        grid-template-columns: 1fr;
    }

    .bs-live-preview-column {
        max-width: none;
        justify-self: stretch;
    }
}


/* v1.2.4 page rendering fix */
.bs-site-main {
    min-height: calc(100vh - 180px);
    padding: 42px 0;
}

.bs-page-content {
    line-height: 1.7;
}

.bs-page-content img {
    max-width: 100%;
    height: auto;
}

@media print {
    .bs-live-preview-title,
    .bs-preview-actions,
    .bs-status-card {
        display: none !important;
    }

    .bs-workspace {
        display: block !important;
    }

    .bs-live-preview-column {
        position: static !important;
    }

    .bs-preview {
        max-height: none !important;
        overflow: visible !important;
    }
}


/* v1.2.4 settings, GST presets and responsive preview modal */
.bs-live-preview-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.bs-gst-presets {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
}

.bs-gst-label {
    font-size: 13px;
    font-weight: 800;
    margin-right: 2px;
}

.bs-gst-chip {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #111827;
    border-radius: 999px;
    padding: 7px 12px;
    cursor: pointer;
    font-weight: 700;
}

.bs-gst-chip.active {
    background: #111827;
    color: #fff;
    border-color: #111827;
}

.bs-gst-presets .bs-muted {
    flex-basis: 100%;
    margin-top: 2px;
}

.bs-live-preview-column {
    min-width: 0;
}

.bs-preview {
    min-width: 0;
}

.bs-preview-modal {
    position: fixed !important;
    z-index: 999999;
    inset: 0;
    width: 100vw !important;
    max-width: none !important;
    height: 100vh !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    overflow: auto !important;
    background: #f7f8fa !important;
    padding: 18px !important;
}

.bs-preview-modal .bs-preview-inner {
    max-width: 820px;
    margin: 0 auto;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
}

.bs-modal-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    max-width: 820px;
    margin: 0 auto 12px;
    padding: 10px 0;
}

.bs-modal-close {
    min-width: 44px;
    min-height: 44px;
}

.bs-mobile-preview-backdrop {
    display: none;
}

@media (max-width: 980px) {
    .bs-workspace {
        display: block;
    }

    .bs-live-preview-column {
        position: static;
    }

    .bs-live-preview-title {
        margin-top: 10px;
    }

    #bs-invoice-preview.bs-mobile-preview-hidden {
        display: none !important;
    }

    #bs-invoice-preview.bs-mobile-preview-open {
        display: block !important;
    }
}

@media (max-width: 600px) {
    .bs-container {
        padding: 12px 8px;
    }

    .bs-card {
        border-radius: 10px;
        padding: 13px;
        margin-bottom: 12px;
    }

    .bs-hero h1 {
        font-size: 28px;
    }

    .bs-hero p {
        font-size: 14px;
    }

    .bs-settings-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .bs-toggle {
        min-height: 48px;
    }

    .bs-gst-presets {
        gap: 7px;
    }

    .bs-gst-chip {
        flex: 1 1 calc(20% - 7px);
        min-width: 52px;
        padding: 9px 8px;
    }

    .bs-live-preview-actions .bs-btn {
        min-height: 42px;
        padding: 8px 10px;
    }

    .bs-preview-modal {
        padding: 8px !important;
    }

    .bs-preview-modal .bs-preview-inner {
        padding: 12px;
        border-radius: 8px;
    }

    .bs-preview-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .bs-preview-head h1 {
        font-size: 22px;
    }

    .bs-preview-right {
        margin-top: 12px;
    }

    .bs-preview-actions {
        position: sticky;
        bottom: 0;
        background: #fff;
        padding: 10px 0 0;
    }

    .bs-preview-actions .bs-btn {
        width: 100%;
        min-height: 46px;
    }
}


/* v1.2.4: item GST dropdown and responsive item layout */
.bs-items select.bs-item-gst {
    width: 100%;
    min-height: 42px;
    padding: 8px 30px 8px 9px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #fff;
    color: #111827;
    font-size: 14px;
}

.bs-items select.bs-item-gst:focus {
    outline: none;
    border-color: #111827;
    box-shadow: 0 0 0 2px rgba(17,24,39,.08);
}

@media (max-width: 900px) {
    .bs-items {
        min-width: 0;
        width: 100%;
    }

    .bs-items thead {
        display: none;
    }

    .bs-items,
    .bs-items tbody,
    .bs-items tr,
    .bs-items td {
        display: block;
        width: 100%;
    }

    .bs-items tr {
        background: #fafafa;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        padding: 10px;
        margin-bottom: 12px;
    }

    .bs-items td {
        border: 0;
        padding: 6px 0;
    }

    .bs-items td::before {
        content: attr(data-label);
        display: block;
        font-size: 12px;
        font-weight: 700;
        color: #6b7280;
        margin-bottom: 5px;
    }

    .bs-items td.bs-item-amount-cell {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding-top: 10px;
        border-top: 1px solid #e5e7eb;
        margin-top: 4px;
    }

    .bs-items td.bs-item-amount-cell::before {
        margin: 0;
    }

    .bs-items td.bs-item-action {
        text-align: right;
        padding-top: 8px;
    }

    .bs-items td.bs-item-action::before {
        display: none;
    }

    .bs-items input,
    .bs-items select.bs-item-gst {
        width: 100%;
        min-height: 44px;
        font-size: 16px;
    }
}


/* v1.2.4: prevent Amount column clipping inside the desktop live-preview layout */
.bs-builder .bs-table-wrap {
    width: 100%;
    overflow-x: visible;
}

.bs-builder .bs-items {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.bs-builder .bs-items th:nth-child(1),
.bs-builder .bs-items td:nth-child(1) { width: 22%; }

.bs-builder .bs-items th:nth-child(2),
.bs-builder .bs-items td:nth-child(2) { width: 18%; }

.bs-builder .bs-items th:nth-child(3),
.bs-builder .bs-items td:nth-child(3) { width: 11%; }

.bs-builder .bs-items th:nth-child(4),
.bs-builder .bs-items td:nth-child(4) { width: 13%; }

.bs-builder .bs-items th:nth-child(5),
.bs-builder .bs-items td:nth-child(5) { width: 14%; }

.bs-builder .bs-items th:nth-child(6),
.bs-builder .bs-items td:nth-child(6) { width: 15%; }

.bs-builder .bs-items th:nth-child(7),
.bs-builder .bs-items td:nth-child(7) { width: 7%; }

.bs-builder .bs-items th,
.bs-builder .bs-items td {
    overflow: hidden;
}

.bs-builder .bs-items input,
.bs-builder .bs-items select.bs-item-gst {
    min-width: 0;
    width: 100%;
}

.bs-builder .bs-items .bs-item-amount-cell {
    white-space: nowrap;
    font-size: 13px;
}

.bs-builder .bs-items .bs-item-action {
    text-align: center;
}

@media (max-width: 1100px) and (min-width: 901px) {
    .bs-workspace {
        grid-template-columns: 1fr;
    }

    .bs-live-preview-column {
        position: static;
    }

    .bs-builder .bs-items th,
    .bs-builder .bs-items td {
        font-size: 13px;
    }
}


.bs-footer-inner {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
}

.bs-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.bs-footer-links a {
    color: #374151;
    text-decoration: none;
    font-weight: 700;
}

.bs-footer-links a:hover,
.bs-footer-links a:focus {
    text-decoration: underline;
}

.bs-footer-copy {
    width: 100%;
    padding-top: 4px;
    border-top: 1px solid #e5e7eb;
}

@media (max-width: 600px) {
    .bs-footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .bs-footer-links {
        justify-content: center;
    }
}


.bs-content-page {
    max-width: 900px;
    margin: 0 auto;
}

.bs-content-page h1 {
    margin-top: 0;
    font-size: 34px;
}

.bs-content-page h2 {
    margin-top: 26px;
    font-size: 21px;
}

.bs-content-page li {
    margin-bottom: 8px;
}


/* v1.2.4 final layout fixes */
.bs-workspace {
    grid-template-columns: minmax(0, 1.62fr) minmax(330px, 0.88fr);
    gap: 18px;
}

.bs-live-preview-column {
    max-width: 480px;
    justify-self: end;
    width: 100%;
}

.bs-live-preview-column .bs-preview {
    width: 100%;
}

.bs-builder .bs-items {
    table-layout: fixed;
    width: 100%;
    min-width: 0;
}

.bs-builder .bs-items th,
.bs-builder .bs-items td {
    padding: 8px 6px;
}

.bs-builder .bs-items th:nth-child(1),
.bs-builder .bs-items td:nth-child(1) { width: 24%; }

.bs-builder .bs-items th:nth-child(2),
.bs-builder .bs-items td:nth-child(2) { width: 16%; }

.bs-builder .bs-items th:nth-child(3),
.bs-builder .bs-items td:nth-child(3) { width: 9%; }

.bs-builder .bs-items th:nth-child(4),
.bs-builder .bs-items td:nth-child(4) { width: 11%; }

.bs-builder .bs-items th:nth-child(5),
.bs-builder .bs-items td:nth-child(5) { width: 13%; }

.bs-builder .bs-items th:nth-child(6),
.bs-builder .bs-items td:nth-child(6) { width: 14%; }

.bs-builder .bs-items th:nth-child(7),
.bs-builder .bs-items td:nth-child(7) { width: 13%; }

.bs-builder .bs-items .bs-item-action {
    text-align: center;
    white-space: nowrap;
}

.bs-builder .bs-items .bs-item-action .bs-remove {
    width: 100%;
    min-height: 40px;
    padding: 8px 7px;
    font-size: 12px;
}

.bs-builder .bs-items input,
.bs-builder .bs-items select.bs-item-gst {
    min-width: 0;
    max-width: 100%;
    height: 42px;
}

.bs-builder .bs-items select.bs-item-gst {
    padding: 8px 26px 8px 8px;
    font-size: 14px;
}

@media (max-width: 1050px) and (min-width: 901px) {
    .bs-workspace {
        grid-template-columns: 1fr;
    }

    .bs-live-preview-column {
        max-width: 100%;
        justify-self: stretch;
    }
}

@media (max-width: 900px) {
    .bs-workspace {
        grid-template-columns: 1fr;
    }

    .bs-live-preview-column {
        max-width: none;
        justify-self: stretch;
    }
}


/* v1.2.4 page rendering fix */
.bs-site-main {
    min-height: calc(100vh - 180px);
    padding: 42px 0;
}

.bs-page-content {
    line-height: 1.7;
}

.bs-page-content img {
    max-width: 100%;
    height: auto;
}

@media print {
    .bs-live-preview-title,
    .bs-modal-toolbar,
    .bs-preview-actions,
    #bs_open_preview,
    #bs_print_top,
    .bs-status-card {
        display: none !important;
    }

    #bs-invoice-preview,
    #bs-invoice-preview.bs-preview-modal {
        position: static !important;
        inset: auto !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 0 !important;
        background: #fff !important;
    }
}


/* v1.2.4: item GST dropdown and responsive item layout */
.bs-items select.bs-item-gst {
    width: 100%;
    min-height: 42px;
    padding: 8px 30px 8px 9px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #fff;
    color: #111827;
    font-size: 14px;
}

.bs-items select.bs-item-gst:focus {
    outline: none;
    border-color: #111827;
    box-shadow: 0 0 0 2px rgba(17,24,39,.08);
}

@media (max-width: 900px) {
    .bs-items {
        min-width: 0;
        width: 100%;
    }

    .bs-items thead {
        display: none;
    }

    .bs-items,
    .bs-items tbody,
    .bs-items tr,
    .bs-items td {
        display: block;
        width: 100%;
    }

    .bs-items tr {
        background: #fafafa;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        padding: 10px;
        margin-bottom: 12px;
    }

    .bs-items td {
        border: 0;
        padding: 6px 0;
    }

    .bs-items td::before {
        content: attr(data-label);
        display: block;
        font-size: 12px;
        font-weight: 700;
        color: #6b7280;
        margin-bottom: 5px;
    }

    .bs-items td.bs-item-amount-cell {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding-top: 10px;
        border-top: 1px solid #e5e7eb;
        margin-top: 4px;
    }

    .bs-items td.bs-item-amount-cell::before {
        margin: 0;
    }

    .bs-items td.bs-item-action {
        text-align: right;
        padding-top: 8px;
    }

    .bs-items td.bs-item-action::before {
        display: none;
    }

    .bs-items input,
    .bs-items select.bs-item-gst {
        width: 100%;
        min-height: 44px;
        font-size: 16px;
    }
}


/* v1.2.4: prevent Amount column clipping inside the desktop live-preview layout */
.bs-builder .bs-table-wrap {
    width: 100%;
    overflow-x: visible;
}

.bs-builder .bs-items {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.bs-builder .bs-items th:nth-child(1),
.bs-builder .bs-items td:nth-child(1) { width: 22%; }

.bs-builder .bs-items th:nth-child(2),
.bs-builder .bs-items td:nth-child(2) { width: 18%; }

.bs-builder .bs-items th:nth-child(3),
.bs-builder .bs-items td:nth-child(3) { width: 11%; }

.bs-builder .bs-items th:nth-child(4),
.bs-builder .bs-items td:nth-child(4) { width: 13%; }

.bs-builder .bs-items th:nth-child(5),
.bs-builder .bs-items td:nth-child(5) { width: 14%; }

.bs-builder .bs-items th:nth-child(6),
.bs-builder .bs-items td:nth-child(6) { width: 15%; }

.bs-builder .bs-items th:nth-child(7),
.bs-builder .bs-items td:nth-child(7) { width: 7%; }

.bs-builder .bs-items th,
.bs-builder .bs-items td {
    overflow: hidden;
}

.bs-builder .bs-items input,
.bs-builder .bs-items select.bs-item-gst {
    min-width: 0;
    width: 100%;
}

.bs-builder .bs-items .bs-item-amount-cell {
    white-space: nowrap;
    font-size: 13px;
}

.bs-builder .bs-items .bs-item-action {
    text-align: center;
}

@media (max-width: 1100px) and (min-width: 901px) {
    .bs-workspace {
        grid-template-columns: 1fr;
    }

    .bs-live-preview-column {
        position: static;
    }

    .bs-builder .bs-items th,
    .bs-builder .bs-items td {
        font-size: 13px;
    }
}


.bs-footer-inner {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
}

.bs-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.bs-footer-links a {
    color: #374151;
    text-decoration: none;
    font-weight: 700;
}

.bs-footer-links a:hover,
.bs-footer-links a:focus {
    text-decoration: underline;
}

.bs-footer-copy {
    width: 100%;
    padding-top: 4px;
    border-top: 1px solid #e5e7eb;
}

@media (max-width: 600px) {
    .bs-footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .bs-footer-links {
        justify-content: center;
    }
}


.bs-content-page {
    max-width: 900px;
    margin: 0 auto;
}

.bs-content-page h1 {
    margin-top: 0;
    font-size: 34px;
}

.bs-content-page h2 {
    margin-top: 26px;
    font-size: 21px;
}

.bs-content-page li {
    margin-bottom: 8px;
}


/* v1.2.4 final layout fixes */
.bs-workspace {
    grid-template-columns: minmax(0, 1.62fr) minmax(330px, 0.88fr);
    gap: 18px;
}

.bs-live-preview-column {
    max-width: 480px;
    justify-self: end;
    width: 100%;
}

.bs-live-preview-column .bs-preview {
    width: 100%;
}

.bs-builder .bs-items {
    table-layout: fixed;
    width: 100%;
    min-width: 0;
}

.bs-builder .bs-items th,
.bs-builder .bs-items td {
    padding: 8px 6px;
}

.bs-builder .bs-items th:nth-child(1),
.bs-builder .bs-items td:nth-child(1) { width: 24%; }

.bs-builder .bs-items th:nth-child(2),
.bs-builder .bs-items td:nth-child(2) { width: 16%; }

.bs-builder .bs-items th:nth-child(3),
.bs-builder .bs-items td:nth-child(3) { width: 9%; }

.bs-builder .bs-items th:nth-child(4),
.bs-builder .bs-items td:nth-child(4) { width: 11%; }

.bs-builder .bs-items th:nth-child(5),
.bs-builder .bs-items td:nth-child(5) { width: 13%; }

.bs-builder .bs-items th:nth-child(6),
.bs-builder .bs-items td:nth-child(6) { width: 14%; }

.bs-builder .bs-items th:nth-child(7),
.bs-builder .bs-items td:nth-child(7) { width: 13%; }

.bs-builder .bs-items .bs-item-action {
    text-align: center;
    white-space: nowrap;
}

.bs-builder .bs-items .bs-item-action .bs-remove {
    width: 100%;
    min-height: 40px;
    padding: 8px 7px;
    font-size: 12px;
}

.bs-builder .bs-items input,
.bs-builder .bs-items select.bs-item-gst {
    min-width: 0;
    max-width: 100%;
    height: 42px;
}

.bs-builder .bs-items select.bs-item-gst {
    padding: 8px 26px 8px 8px;
    font-size: 14px;
}

@media (max-width: 1050px) and (min-width: 901px) {
    .bs-workspace {
        grid-template-columns: 1fr;
    }

    .bs-live-preview-column {
        max-width: 100%;
        justify-self: stretch;
    }
}

@media (max-width: 900px) {
    .bs-workspace {
        grid-template-columns: 1fr;
    }

    .bs-live-preview-column {
        max-width: none;
        justify-self: stretch;
    }
}


/* v1.2.4 page rendering fix */
.bs-site-main {
    min-height: calc(100vh - 180px);
    padding: 42px 0;
}

.bs-page-content {
    line-height: 1.7;
}

.bs-page-content img {
    max-width: 100%;
    height: auto;
}

@media print {
    body { background: #fff; }
    .bs-site-header,
    .bs-site-footer,
    .bs-hero,
    .bs-builder,
    .bs-no-print {
        display: none !important;
    }

    .bs-site-main,
    .bs-container,
    .bs-app {
        margin: 0 !important;
        padding: 0 !important;
        max-width: none !important;
    }

    .bs-preview {
        display: block !important;
        border: 0 !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    @page {
        size: A4;
        margin: 12mm;
    }
}
