html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.collapse {
    transition: all 0.25s ease-in-out;
}

.collapsible-card-header {
    background-color: var(--bs-card-cap-bg, var(--bs-light));
    border: 0;
    border-bottom: 1px solid var(--bs-border-color-translucent);
    border-radius: var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius) 0 0;
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-weight: 600;
    color: inherit;
    cursor: pointer;
    text-decoration: none;
}

.collapsible-card-header:hover,
.collapsible-card-header:focus {
    background-color: var(--bs-tertiary-bg);
}

.collapsible-card-header:focus {
    outline: none;
}

.collapsible-card-header:focus-visible {
    box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.35);
}

.customer-search {
    min-width: 0;
}

#customerSection .customer-search-field {
    flex: 1 1 14rem;
    min-width: 10rem;
}

@media (max-width: 400px) {
    #customerSection .customer-search-field {
        flex: 1 1 8rem;
        min-width: 7rem;
    }
}

.collapsible-card {
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: var(--bs-card-border-radius);
}

.customer-search .customer-suggestions {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    z-index: 1060;
    max-height: 15rem;
    overflow-y: auto;
    border-radius: 0.5rem;
}

.customer-search .customer-suggestions .list-group-item {
    cursor: pointer;
}

@keyframes flashHighlight {
    0% {
        background-color: #fff3cd;
    }

    100% {
        background-color: transparent;
    }
}

#requestJson.flash {
    animation: flashHighlight 0.8s ease-out;
}

#modeToolbar {
    transition: opacity 0.3s ease;
}

#modeToolbar.show {
    opacity: 1;
}

#modeBadge {
    font-size: 0.95rem;
}

#amountWrapper, #dueDateWrapper {
    transition: opacity .2s ease, height .2s ease;
}

#customerBalanceValue {
    white-space: nowrap;
}

#productSection .product-section-field {
    flex: 0 1 auto;
    min-width: 6.75rem;
}

#productSection .product-section-field.product-type-field {
    flex: 1 1 9rem;
    min-width: 7rem;
}

#productSection .product-section-field.order-date-field {
    flex: 0 1 9rem;
    min-width: 8rem;
}

#productSection .product-section-field.amount-field {
    flex: 0 1 7.5rem;
    min-width: 6.5rem;
    max-width: 8.5rem;
}

#productSection .product-section-field.amount-field #amountWrapper {
    width: 100%;
}

#productSection #amountWrapper.d-none {
    display: none !important;
}

#productSection .product-section-field.account-field {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    min-width: auto;
    margin-left: 0.5rem;
}

#productSection #onAccountWrapper {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0;
    padding-left: 0;
    white-space: nowrap;
}

#productSection #onAccountWrapper.d-none {
    display: none !important;
}

#productSection #onAccountWrapper .form-check-input {
    margin-top: 0;
    margin-left: 0;
    float: none;
}

#productSection .product-section-field.action-field {
    flex: 1 0 100%;
    max-width: none;
    order: 99;
}

#productSection .product-section-field.action-field .btn {
    width: 100%;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.customer-orders-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.customer-orders-card {
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: 0.75rem;
    overflow: hidden;
    background-color: #fff;
    box-shadow: none;
}

.customer-orders-header-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-align: left;
    flex: 1 1 auto;
    min-width: 0;
}

.customer-name {
    font-size: 1.15rem;
    margin: 0;
}

.customer-order-count {
    font-size: 0.85rem;
}

.customer-orders-header-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.customer-orders-balance,
.customer-orders-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    justify-content: flex-end;
}

.customer-order-panel-btn {
    white-space: nowrap;
}

.customer-metric {
    display: inline-flex;
    flex-direction: row;
    gap: 0.35rem;
    min-width: 6rem;
    text-align: right;
    align-items: baseline;
    justify-content: flex-end;
}

.customer-metric-label {
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.customer-metric-link {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-decoration: underline;
}

.customer-metric-value {
    font-size: 1rem;
    font-weight: 600;
}

.customer-orders-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
}

.customer-orders-balance {
    border-top: 1px solid var(--bs-border-color-translucent);
    padding-top: 1rem;
    margin-top: 0.5rem;
}

.customer-orders-summary {
    border-top: 2px solid var(--bs-border-color-translucent);
    padding-top: 1rem;
}

.customer-orders-summary-inline {
    border-top: 0;
    padding-top: 0;
}

.order-detail-total {
    display: inline-flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
}

.order-detail-delete-btn {
    line-height: 1;
    border-radius: 0.25rem;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}


.customer-order-table {
    table-layout: auto;
    width: 100%;
}

.customer-order-table .order-toggle-col {
    width: 3rem;
    min-width: 3rem;
}

.customer-order-table .order-placed-col {
    min-width: 7rem;
}

.customer-order-table th.order-placed-col,
.customer-order-table td.order-placed-col {
    white-space: nowrap;
}

.customer-order-table .order-actions-col {
    width: 3.5rem;
    text-align: right;
}

.customer-order-table th:first-child,
.customer-order-table td:first-child {
    text-align: left;
}

.customer-order-table th:not(:first-child),
.customer-order-table td:not(:first-child) {
    text-align: right;
}

.customer-order-table tfoot th {
    font-weight: 600;
}

.customer-order-table .order-total-row .order-total-label,
.customer-order-table .order-total-row .order-total-value {
    text-align: right;
}

.customer-order-table .order-total-row .order-total-label {
    padding-right: 0.5rem;
}

.customer-order-table .customer-payment-row td {
    font-style: italic;
    color: var(--bs-success-text-emphasis);
}

.customer-order-table .customer-debit-row td {
    background-color: rgba(249, 62, 62, 0.1);
}

.customer-order-table .customer-credit-row td {
    background-color: rgba(73, 204, 144, 0.1);
}

.customer-order-table .starting-balance-row td {
    background-color: rgba(252, 161, 48, 0.1);
}

.customer-order-table tfoot .order-total-row th,
.customer-order-table tfoot .order-total-row td {
    background-color: rgba(97, 175, 254, 0.1);
}

@media (max-width: 480px) {
    .customer-order-table th.order-due-col,
    .customer-order-table td.order-due-col {
        display: none;
    }
}

.order-balance-alert {
    margin-bottom: 0;
}

@media (max-width: 576px) {
    .customer-orders-header-content {
        width: 100%;
    }
}

#batchActions .batch-action-field .btn {
    width: 100%;
}

#batchPanel .card-body,
#orderPanel .card-body {
    padding: 1.25rem;
}

#requestPreview .card-body {
    display: flex;
    flex-direction: column;
}

#requestJson {
    min-height: 14rem;
    resize: vertical;
}

.order-entry-modal-frame {
    min-height: 70vh;
}

.order-entry-iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

@media (min-width: 576px) {
    #customerSection {
        gap: 0.75rem;
    }

    #customerSection #addCustomerBtn {
        width: auto;
    }
}

@media (max-width: 400px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .card-body,
    .card-header {
        padding: 0.75rem;
    }

    #customerSection,
    #productSection {
        row-gap: 0.75rem;
    }

    #productSection {
        gap: 0.5rem;
    }

    #productSection .product-section-field {
        min-width: 6.5rem;
    }

    #productSection .product-section-field.order-date-field {
        flex-basis: 7rem;
        min-width: 6.25rem;
    }

    #productSection .product-section-field.product-type-field {
        flex-basis: 7rem;
        min-width: 6rem;
    }

    #productSection .product-section-field.amount-field {
        flex-basis: 6rem;
    }

    #productSection .product-section-field.account-field {
        flex: 0 0 auto;
    }

    #requestJson {
        min-height: 10rem;
        font-size: 0.85rem;
    }

    .collapsible-card-header,
    #addBtn,
    #createBatchBtn,
    #addCustomerBtn {
        padding-top: 0.6rem;
        padding-bottom: 0.6rem;
    }

    .customer-search .customer-suggestions {
        max-height: 12rem;
    }

    .form-select,
    .form-control {
        font-size: 0.95rem;
    }

    #customerBalanceWrapper {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}
