/* PayPal-style invoice builder */

[x-cloak] {
    display: none !important;
}

.chp-invoice-page .fi-header,
.chp-invoice-page .fi-page-header,
.chp-customer-page .fi-header,
.chp-customer-page .fi-page-header {
    display: none;
}

.chp-invoice-page .fi-page-content,
.chp-customer-page .fi-page-content {
    padding: 0 8px 48px;
}

.chp-inv {
    max-width: 1180px;
    margin: 0 auto;
    color: #111827;
    font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.chp-inv a {
    color: #0070ba;
    text-decoration: none;
}

.chp-inv a:hover {
    text-decoration: underline;
}

.chp-inv__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #0070ba;
    font-size: 14px;
    font-weight: 600;
    margin: 4px 0 8px;
}

.chp-inv__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.chp-inv__title {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: #001c64;
    letter-spacing: -0.02em;
}

.chp-inv__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.chp-inv__saved {
    color: #6b7280;
    font-size: 13px;
    margin-right: 4px;
}

.chp-inv__icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #111827;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.chp-inv__icon-btn:hover {
    background: #f3f4f6;
}

.chp-inv__icon-btn svg {
    width: 18px;
    height: 18px;
}

.chp-inv__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 20px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
}

.chp-inv__btn--ghost {
    background: #fff;
    border-color: #111827;
    color: #111827;
}

.chp-inv__btn--muted {
    background: #eef0f2;
    color: #111827;
    border-color: #eef0f2;
}

.chp-inv__btn--primary {
    background: #111827;
    color: #fff;
}

.chp-inv__btn--primary:hover {
    background: #000;
}

.chp-inv__btn--wide {
    width: 100%;
}

.chp-inv__split {
    display: inline-flex;
    position: relative;
}

.chp-inv__split .chp-inv__btn--primary:not(.chp-inv__split-toggle) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    padding-right: 16px;
}

.chp-inv__split .chp-inv__split-toggle {
    width: 42px;
    min-width: 42px;
    padding: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.28);
}

.chp-inv__split-toggle svg {
    width: 12px;
    height: 8px;
    display: block;
    flex-shrink: 0;
}

.chp-inv__menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 230px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(17, 24, 39, 0.16);
    padding: 8px;
    z-index: 30;
}

.chp-inv__menu button {
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    cursor: pointer;
}

.chp-inv__menu button:hover,
.chp-inv__menu button.is-active {
    background: #eff6ff;
    box-shadow: inset 0 0 0 1px #0070ba;
}

.chp-inv__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.85fr);
    gap: 24px;
    align-items: start;
}

.chp-inv__card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 20px 22px;
    margin-bottom: 16px;
}

.chp-inv__section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.chp-inv__section-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}

.chp-inv__section-icon {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #e6f1fb;
    color: #0070ba;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chp-inv__section-icon svg {
    width: 16px;
    height: 16px;
}

.chp-inv__search {
    position: relative;
}

.chp-inv__search input,
.chp-inv__field,
.chp-inv textarea,
.chp-inv select {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    min-height: 48px;
    padding: 10px 14px;
    font-size: 15px;
    color: #111827;
    background: #fff;
}

.chp-inv textarea {
    min-height: 96px;
    resize: vertical;
}

.chp-inv__search input:focus,
.chp-inv__field:focus,
.chp-inv textarea:focus,
.chp-inv select:focus {
    outline: none;
    border-color: #0070ba;
    box-shadow: 0 0 0 3px rgba(0, 112, 186, 0.15);
}

.chp-inv__label {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.chp-inv__suggest {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(17, 24, 39, 0.14);
    z-index: 20;
    overflow: hidden;
}

.chp-inv__suggest button {
    width: 100%;
    text-align: left;
    border: 0;
    background: #fff;
    padding: 12px 14px;
    cursor: pointer;
}

.chp-inv__suggest button:hover {
    background: #f3f4f6;
}

.chp-inv__suggest strong {
    display: block;
    font-size: 14px;
}

.chp-inv__suggest span {
    color: #6b7280;
    font-size: 13px;
}

.chp-inv__create-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-weight: 700;
    font-size: 14px;
    background: none;
    border: 0;
    color: #0070ba;
    cursor: pointer;
    padding: 0;
}

.chp-inv__box {
    background: #f3f4f6;
    border-radius: 12px;
    padding: 16px;
}

.chp-inv__item-slot {
    margin-bottom: 10px;
}

.chp-inv__item-list + .chp-inv__btn {
    margin-top: 4px;
}

.chp-inv__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.chp-inv__form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.chp-inv__selected {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    background: #f3f4f6;
    border-radius: 12px;
    padding: 14px 16px;
}

.chp-inv__selected strong {
    display: block;
    font-size: 15px;
}

.chp-inv__selected span {
    color: #6b7280;
    font-size: 13px;
}

.chp-inv__selected-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chp-inv__text-btn {
    background: none;
    border: 0;
    color: #0070ba;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
}

.chp-inv__x {
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
    color: #6b7280;
    font-size: 18px;
    cursor: pointer;
    border-radius: 999px;
}

.chp-inv__x:hover {
    background: #e5e7eb;
}

.chp-inv__check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #111827;
}

.chp-inv__pill-select,
.chp-inv__pill {
    min-height: 36px;
    border-radius: 999px;
    background: #f3f4f6;
    border: 0;
    padding: 8px 14px;
    font-weight: 700;
    min-width: 86px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #111827;
}

.chp-inv__radios {
    display: flex;
    gap: 18px;
    margin: 8px 0 14px;
    flex-wrap: wrap;
}

.chp-inv__radios label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
}

.chp-inv__item-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) 132px minmax(120px, 0.7fr);
    gap: 10px;
}

.chp-inv__item-card {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    gap: 12px;
    background: #f3f4f6;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
}

.chp-inv__drag {
    color: #9ca3af;
    padding-top: 6px;
    letter-spacing: 1px;
    font-size: 11px;
    line-height: 1;
    cursor: grab;
    user-select: none;
    touch-action: none;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.chp-inv__drag:active {
    cursor: grabbing;
}

.chp-inv__item-card.fi-sortable-ghost {
    opacity: 0.45;
}

.chp-inv__item-meta {
    color: #6b7280;
    font-size: 13px;
    margin-top: 2px;
}

.chp-inv__badge {
    display: inline-flex;
    margin-top: 6px;
    margin-right: 6px;
    background: #e5e7eb;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    color: #374151;
}

.chp-inv__item-side {
    text-align: right;
}

.chp-inv__item-side .chp-inv__mini-grid {
    display: grid;
    grid-template-columns: 70px 110px;
    gap: 8px;
    margin-bottom: 8px;
}

.chp-inv__qty {
    display: flex;
    align-items: stretch;
    height: 48px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}

.chp-inv__qty:focus-within {
    border-color: #0070ba;
    box-shadow: 0 0 0 3px rgba(0, 112, 186, 0.15);
}

.chp-inv__qty-btn {
    width: 32px;
    flex: 0 0 32px;
    border: 0;
    background: #f3f4f6;
    color: #111827;
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}

.chp-inv__qty-btn:hover {
    background: #e5e7eb;
}

.chp-inv__qty-input.chp-inv__field {
    min-width: 0;
    width: 100%;
    min-height: 46px;
    height: 46px;
    border: 0;
    border-radius: 0;
    padding: 0 4px;
    text-align: center;
    box-shadow: none;
}

.chp-inv__qty-input.chp-inv__field:focus {
    border: 0;
    box-shadow: none;
}

.chp-inv__total-line {
    font-weight: 700;
    margin-top: 6px;
}

.chp-inv__help {
    color: #6b7280;
    font-size: 12px;
}

.chp-inv__count {
    text-align: right;
    color: #9ca3af;
    font-size: 12px;
    margin-top: 4px;
}

.chp-inv__accordion-head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 0;
    cursor: pointer;
}

.chp-inv__card.is-open {
    border-color: #0070ba;
}

.chp-inv__plus-list {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
}

.chp-inv__tabs {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 16px;
}

.chp-inv__tab {
    background: none;
    border: 0;
    padding: 8px 0 12px;
    font-size: 15px;
    color: #6b7280;
    font-weight: 600;
    cursor: pointer;
}

.chp-inv__tab.is-active {
    color: #111827;
    font-weight: 700;
    box-shadow: inset 0 -3px 0 #111827;
}

.chp-inv__summary-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.chp-inv__summary-head h3 {
    margin: 0;
    font-size: 18px;
}

.chp-inv__muted {
    color: #6b7280;
    font-size: 13px;
    margin: 0 0 12px;
}

.chp-inv__line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid #eef0f2;
    font-size: 14px;
}

.chp-inv__line:hover {
    background: #f9fafb;
    margin-left: -8px;
    margin-right: -8px;
    padding-left: 8px;
    padding-right: 8px;
}

.chp-inv__line--total {
    font-weight: 700;
    font-size: 15px;
}

.chp-inv__line--total span:first-child span {
    color: #0070ba;
    font-weight: 600;
}

.chp-inv__option {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    text-align: left;
    background: #f3f4f6;
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 8px;
    cursor: pointer;
}

.chp-inv__option.is-active {
    border-color: #0070ba;
    background: #eef4fb;
}

.chp-inv__option svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

.chp-inv__option strong {
    display: block;
    font-size: 14px;
}

.chp-inv__option small {
    display: block;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.35;
}

.chp-inv__preview {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
    padding: 22px;
}

.chp-inv__preview-top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.chp-inv__preview-top strong {
    display: block;
    font-size: 16px;
}

.chp-inv__preview-meta {
    text-align: right;
    font-size: 13px;
    color: #4b5563;
}

.chp-inv__preview-amount {
    margin: 10px 0 16px;
    font-size: 32px;
    font-weight: 700;
    text-align: right;
    letter-spacing: -0.03em;
}

.chp-inv__contact-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    color: #374151;
    margin-bottom: 16px;
}

.chp-inv__preview-item {
    display: flex;
    justify-content: space-between;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
    margin: 8px 0 16px;
}

.chp-inv__preview-totals {
    margin-left: auto;
    width: min(220px, 100%);
}

.chp-inv__pay-icons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.chp-inv__pay-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    min-width: 48px;
    padding: 4px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    box-sizing: border-box;
}

.chp-inv__pay-icon img {
    display: block;
    height: 22px;
    width: auto;
    max-width: 52px;
}

.chp-inv__banner {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: #eef0f2;
    border-radius: 10px;
    padding: 12px 14px;
    color: #4b5563;
    font-size: 12px;
    line-height: 1.45;
    margin-top: 8px;
}

.chp-inv__error {
    background: #fef2f2;
    color: #991b1b;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 14px;
}

.chp-inv__overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.chp-inv__modal {
    width: min(460px, 100%);
    max-height: 90vh;
    overflow: auto;
    background: #fff;
    border-radius: 20px;
    padding: 28px 24px 24px;
    position: relative;
    text-align: center;
}

.chp-inv__modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 2px solid #0070ba;
    background: #fff;
    color: #0070ba;
    cursor: pointer;
    font-size: 18px;
}

.chp-inv__success-icon {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    background: #e6f1fb;
    color: #0070ba;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.chp-inv__modal h2 {
    margin: 0 0 8px;
    font-size: 22px;
    color: #111827;
}

.chp-inv__quick {
    display: flex;
    justify-content: center;
    gap: 28px;
    padding: 18px 0;
    border-top: 1px solid #eef0f2;
    border-bottom: 1px solid #eef0f2;
    margin: 16px 0;
}

.chp-inv__quick button {
    background: none;
    border: 0;
    cursor: pointer;
    color: #111827;
    font-size: 12px;
    font-weight: 600;
}

.chp-inv__quick span {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 6px;
}

.chp-inv__promo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 18px;
}

.chp-inv__promo strong {
    display: block;
    font-size: 14px;
}

.chp-inv__promo span {
    color: #6b7280;
    font-size: 12px;
}

.chp-inv__or {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #9ca3af;
    font-size: 12px;
    font-weight: 700;
    margin: 16px 0;
}

.chp-inv__or::before,
.chp-inv__or::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

.chp-inv__qr {
    width: 200px;
    height: 200px;
    border: 2px solid #0070ba;
    border-radius: 8px;
    margin: 8px auto 18px;
}

.chp-inv__panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    margin: 0 0 12px;
}

.chp-inv__toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.chp-inv input[type="checkbox"],
.chp-inv input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #111827;
}

@media print {
    .fi-topbar-ctn,
    .chp-inv__header,
    .chp-inv__grid > .chp-inv__main,
    .chp-inv__tabs,
    .chp-inv__banner,
    .chp-inv__overlay {
        display: none !important;
    }

    .chp-invoice-page .fi-page-content,
    .chp-inv,
    .chp-inv__side {
        padding: 0;
        max-width: none;
        display: block;
    }

    .chp-inv__preview {
        box-shadow: none;
        border: 0;
    }
}

.chp-customer-page .chp-cust {
    max-width: 820px;
}

.chp-cust__address-row {
    grid-template-columns: 1.2fr 0.8fr 0.9fr 0.6fr;
}

@media (max-width: 980px) {
    .chp-inv__grid,
    .chp-inv__row,
    .chp-inv__item-grid,
    .chp-cust__address-row {
        grid-template-columns: 1fr;
    }

    .chp-inv__title {
        font-size: 24px;
    }
}
