.billing-preferences__nav {
    position: sticky;
    top: 80px;
}

.billing-preferences__group-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--billing-muted, #878a99);
    padding: 0.5rem 0.75rem 0.25rem;
    text-transform: uppercase;
}

.billing-preferences__menu .nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: #495057;
    border-radius: 6px;
    margin-bottom: 2px;
    transition: background 0.15s, color 0.15s;
}

.billing-preferences__menu .nav-link:hover:not(.disabled) {
    background: rgba(64, 81, 137, 0.06);
    color: var(--billing-purchase, #405189);
}

.billing-preferences__menu .nav-link.active {
    background: rgba(64, 81, 137, 0.1);
    color: var(--billing-purchase, #405189);
    font-weight: 600;
}

.billing-preferences__menu-icon {
    font-size: 1rem;
    opacity: 0.75;
    flex-shrink: 0;
}

.billing-preferences__menu .nav-link.active .billing-preferences__menu-icon {
    opacity: 1;
}

.billing-preferences__menu .nav-link.disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.billing-preferences__toggles {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.billing-pref-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid #f0f1f3;
}

.billing-pref-toggle:last-child {
    border-bottom: none;
}

.billing-pref-toggle__label {
    font-size: 0.875rem;
    color: #334155;
}

.billing-pref-switch {
    width: 2.5rem;
    height: 1.25rem;
    cursor: pointer;
}

.billing-pref-switch:checked {
    background-color: var(--billing-product, #0ab39c);
    border-color: var(--billing-product, #0ab39c);
}

.billing-signature-upload__zone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    padding: 1.25rem;
    border: 2px dashed #c5d4f7;
    border-radius: 8px;
    background: #f8fbff;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    overflow: hidden;
}

.billing-signature-upload__zone:hover,
.billing-signature-upload__zone:focus {
    border-color: #3577f1;
    background: #eef4ff;
    outline: none;
}

.billing-signature-upload__zone.is-dragover {
    border-color: #0ab39c;
    background: #e8faf6;
    box-shadow: inset 0 0 0 2px rgba(10, 179, 156, 0.2);
}

.billing-signature-upload__input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.billing-signature-upload__placeholder {
    pointer-events: none;
}

.billing-signature-upload__zone .billing-signature-upload__preview {
    max-width: 100%;
    pointer-events: none;
}

.billing-signature-upload__preview {
    max-width: 240px;
    max-height: 80px;
    object-fit: contain;
    border: 1px solid #e9ebec;
    border-radius: 4px;
    padding: 4px;
    background: #fff;
}

.billing-preferences__footer .btn-success {
    min-width: 120px;
}

.billing-file-drop--logo {
    min-height: 160px;
}

.billing-file-drop__preview-square {
    max-width: 120px;
    max-height: 120px;
    object-fit: contain;
    border: 1px solid #e9ebec;
    border-radius: 4px;
    padding: 6px;
    background: #fff;
}

.billing-file-drop.is-dragover {
    border-color: #0ab39c;
    background: #e8faf6;
    box-shadow: inset 0 0 0 2px rgba(10, 179, 156, 0.2);
}

.billing-profile-extra__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
}

.billing-profile-extra__chevron {
    font-size: 1.1rem;
    transition: transform 0.2s ease;
}

.billing-profile-extra__chevron.is-open {
    transform: rotate(180deg);
}

.billing-profile-extra__panel {
    border-top: 1px dashed #e9ebec;
    padding-top: 0.25rem;
}

.billing-taxes-table__name {
    color: var(--billing-purchase, #405189);
    text-decoration: none;
    font-weight: 500;
}

.billing-taxes-table__name:hover {
    text-decoration: underline;
}

.billing-tax-group-row__remove {
    line-height: 1;
}

/* ─── Document settings (Invoices, Quotes, Credit Notes, etc.) ─── */

.billing-doc-settings {
    background: #fff;
    border: 1px solid var(--billing-border, #e9ebec);
    border-radius: var(--billing-radius-lg, 0.75rem);
    box-shadow: var(--billing-shadow, 0 1px 2px rgba(15, 23, 42, 0.06));
    overflow: hidden;
}

.billing-doc-settings__hero {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.35rem 1.5rem;
    background: linear-gradient(135deg, rgba(64, 81, 137, 0.06) 0%, rgba(10, 179, 156, 0.05) 100%);
    border-bottom: 1px solid var(--billing-border, #e9ebec);
}

.billing-doc-settings__hero-icon {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #fff;
    color: var(--billing-purchase, #405189);
    font-size: 1.35rem;
    box-shadow: 0 2px 8px rgba(64, 81, 137, 0.12);
}

.billing-doc-settings__title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: #212529;
    margin: 0 0 0.2rem;
}

.billing-doc-settings__subtitle {
    font-size: 0.8125rem;
    color: var(--billing-muted, #878a99);
    line-height: 1.45;
}

/* Pill tabs */
.billing-doc-settings__tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid var(--billing-border, #e9ebec);
}

.billing-doc-settings__tab {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    border: 1px solid transparent;
    background: #fff;
    color: #495057;
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s, color 0.15s;
}

.billing-doc-settings__tab > i {
    font-size: 1.1rem;
    color: var(--billing-muted, #878a99);
    margin-bottom: 0.15rem;
}

.billing-doc-settings__tab span {
    font-size: 0.875rem;
    font-weight: 600;
}

.billing-doc-settings__tab small {
    font-size: 0.7rem;
    color: var(--billing-muted, #878a99);
    font-weight: 400;
}

.billing-doc-settings__tab:hover {
    border-color: #c5d4f7;
    color: var(--billing-purchase, #405189);
}

.billing-doc-settings__tab.is-active {
    border-color: var(--billing-purchase, #405189);
    background: #fff;
    box-shadow: 0 2px 8px rgba(64, 81, 137, 0.1);
    color: var(--billing-purchase, #405189);
}

.billing-doc-settings__tab.is-active > i {
    color: var(--billing-purchase, #405189);
}

.billing-doc-settings__panel {
    padding: 1.25rem 1.5rem 0;
}

.billing-doc-callout {
    display: flex;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #495057;
    background: #f0f7ff;
    border: 1px solid #d4e5ff;
    border-radius: 8px;
}

.billing-doc-callout > i {
    font-size: 1.2rem;
    color: #3577f1;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.billing-doc-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.billing-doc-toolbar__label {
    margin-right: 0.25rem;
}

.btn-soft-success {
    color: #0ab39c;
    background: rgba(10, 179, 156, 0.1);
    border: 1px solid rgba(10, 179, 156, 0.2);
}

.btn-soft-success:hover {
    color: #fff;
    background: #0ab39c;
    border-color: #0ab39c;
}

.btn-soft-secondary {
    color: #495057;
    background: #f3f6f9;
    border: 1px solid #e9ebec;
}

.btn-soft-secondary:hover {
    background: #e9ebec;
    border-color: #dde1e6;
    color: #212529;
}

/* Option groups */
.billing-doc-section {
    margin-bottom: 1.25rem;
}

.billing-doc-section--options {
    margin-bottom: 1rem;
}

.billing-doc-section__head {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin-bottom: 0.65rem;
}

.billing-doc-section__head--compact {
    align-items: center;
    margin-bottom: 0.5rem;
}

.billing-doc-section__icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--billing-purchase-bg, rgba(64, 81, 137, 0.08));
    color: var(--billing-purchase, #405189);
    font-size: 1rem;
}

.billing-doc-section__title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #212529;
    margin: 0;
}

.billing-doc-section__desc {
    font-size: 0.75rem;
    color: var(--billing-muted, #878a99);
    margin: 0.1rem 0 0;
}

.billing-doc-section__reset {
    margin-left: auto;
    font-size: 0.75rem;
    white-space: nowrap;
}

.billing-doc-options {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--billing-border, #e9ebec);
    border-radius: 8px;
    overflow: hidden;
}

.billing-doc-options__item {
    border-bottom: 1px solid #f0f1f3;
}

.billing-doc-options__item:last-child {
    border-bottom: none;
}

.billing-doc-options__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    margin: 0;
    cursor: pointer;
    transition: background 0.12s;
}

.billing-doc-options__row:hover {
    background: #fafbfc;
}

.billing-doc-options__text {
    font-size: 0.875rem;
    color: #495057;
    line-height: 1.4;
    flex: 1;
}

.billing-doc-options__switch {
    position: relative;
    flex-shrink: 0;
    width: 2.75rem;
    height: 1.5rem;
}

.billing-doc-options__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.billing-doc-options__track {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 999px;
    transition: background 0.2s ease;
    pointer-events: none;
}

.billing-doc-options__track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1.25rem;
    height: 1.25rem;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s ease;
}

.billing-doc-options__input:checked + .billing-doc-options__track {
    background: #0ab39c;
}

.billing-doc-options__input:checked + .billing-doc-options__track::after {
    transform: translateX(1.25rem);
}

.billing-doc-options__input:focus-visible + .billing-doc-options__track {
    outline: 2px solid var(--billing-purchase, #405189);
    outline-offset: 2px;
}

/* Label fields */
.billing-doc-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

@media (max-width: 767.98px) {
    .billing-doc-fields {
        grid-template-columns: 1fr;
    }
}

.billing-doc-field {
    padding: 0.75rem;
    background: #fafbfc;
    border: 1px solid #eef0f2;
    border-radius: 8px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.billing-doc-field:hover {
    border-color: #dde1e6;
}

.billing-doc-field.is-modified {
    background: #fff;
    border-color: rgba(10, 179, 156, 0.35);
    box-shadow: 0 0 0 1px rgba(10, 179, 156, 0.08);
}

.billing-doc-field__label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.4rem;
}

.billing-doc-field__input-wrap {
    display: flex;
    gap: 0.35rem;
}

.billing-doc-field__input {
    flex: 1;
    min-width: 0;
    font-size: 0.875rem;
    border-radius: 6px;
}

.billing-doc-field__reset {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e9ebec;
    border-radius: 6px;
    background: #fff;
    color: var(--billing-muted, #878a99);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.billing-doc-field__reset:hover {
    color: var(--billing-purchase, #405189);
    border-color: #c5d4f7;
    background: #f8f9ff;
}

.billing-doc-field__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.billing-doc-field__badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #0ab39c;
    background: rgba(10, 179, 156, 0.12);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.billing-doc-field__default {
    font-size: 0.7rem;
    color: #adb5bd;
}

.billing-doc-field__input.is-reset-flash {
    animation: billing-doc-flash 0.5s ease;
}

@keyframes billing-doc-flash {
    0%, 100% { background-color: #fff; }
    50% { background-color: #e8faf6; }
}

/* Footer */
.billing-doc-form {
    padding-bottom: 0.5rem;
}

.billing-doc-footer-sentinel {
    height: 1px;
}

.billing-doc-settings__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1rem 0 1.25rem;
    border-top: 1px solid var(--billing-border, #e9ebec);
    background: #fff;
    transition: box-shadow 0.2s;
}

.billing-doc-settings__footer.is-sticky {
    position: sticky;
    bottom: 0;
    z-index: 10;
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
}

.billing-doc-settings__footer-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.billing-doc-settings__footer-note {
    font-size: 0.75rem;
    color: var(--billing-muted, #878a99);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.billing-doc-settings__unsaved {
    font-size: 0.75rem;
    font-weight: 500;
    color: #f06548;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.billing-doc-settings__submit {
    font-weight: 600;
    padding: 0.5rem 1.35rem;
    min-width: 150px;
}

@media (max-width: 575.98px) {
    .billing-doc-settings__hero,
    .billing-doc-settings__panel {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .billing-doc-settings__tabs {
        padding: 0.85rem 1rem;
    }

    .billing-doc-settings__footer.is-sticky {
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .billing-doc-settings__footer {
        flex-direction: column;
        align-items: stretch;
    }

    .billing-doc-settings__submit {
        width: 100%;
    }

    .billing-doc-section__head {
        flex-wrap: wrap;
    }

    .billing-doc-section__reset {
        margin-left: 0;
        width: 100%;
        text-align: left;
    }
}

@media (max-width: 991.98px) {
    .billing-preferences__nav {
        position: static;
        margin-bottom: 1rem;
    }

    .billing-preferences__content {
        padding-left: 0 !important;
    }
}
