
:root {
    --maroon: #6e1e32;
    --maroon-dark: #481321;
    --maroon-light: #8c344b;
    --gold: #c6a15b;
    --cream: #fbf7f0;
    --surface: #ffffff;
    --text: #30252a;
    --muted: #81757a;
    --border: #eee5e0;
    --success: #28774d;
    --danger: #b42335;
    --shadow: 0 12px 35px rgba(72, 19, 33, 0.07);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--cream);
    color: var(--text);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #e6dbd5;
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    padding: 11px 12px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(198, 161, 91, 0.16);
}

textarea {
    resize: vertical;
}

label {
    display: block;
    margin-bottom: 6px;
    color: #4e3d43;
    font-size: 12px;
    font-weight: 650;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    letter-spacing: -0.3px;
}

h3 {
    margin-bottom: 5px;
    font-size: 19px;
}

.hidden {
    display: none !important;
}

.muted,
.hint {
    color: var(--muted);
}

.muted {
    margin-bottom: 0;
    font-size: 12px;
}

.hint {
    margin: 12px 0 0;
    font-size: 12px;
    line-height: 1.65;
}

.eyebrow {
    margin-bottom: 6px;
    color: var(--gold);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2px;
}

/* Buttons */

.btn {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-weight: 650;
    text-decoration: none;
    transition: transform 0.15s, background 0.15s;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--maroon);
    color: #fff;
}

.btn-primary:hover {
    background: var(--maroon-dark);
}

.btn-outline {
    border-color: var(--border);
    background: #fff;
    color: var(--maroon);
}

.btn-outline:hover {
    background: #fbf1f0;
}

.btn-small {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 12px;
}

.full-width {
    width: 100%;
}

.text-button {
    border: 0;
    background: transparent;
    color: var(--maroon);
    font-size: 12px;
    font-weight: 700;
}

.icon-button {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: #f8efeb;
    color: var(--maroon);
    font-size: 24px;
}

/* Login */

.login-screen {
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(ellipse at 10% 10%, rgba(198, 161, 91, 0.17), transparent 40%),
        linear-gradient(135deg, #fbf7f0, #f4e8e0);
}

.login-card {
    width: min(100%, 420px);
    padding: 38px;
    border: 1px solid rgba(198, 161, 91, 0.24);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 25px 80px rgba(72, 19, 33, 0.12);
    text-align: center;
}

.brand-mark {
    display: grid;
    width: 65px;
    height: 65px;
    margin: 0 auto 18px;
    place-items: center;
    border: 2px solid var(--gold);
    border-radius: 50%;
    background: var(--maroon);
    color: #f5dba3;
    font-family: Georgia, serif;
    font-size: 27px;
    font-weight: bold;
}

.login-card h1 {
    margin-bottom: 6px;
    color: var(--maroon);
    font-family: Georgia, serif;
    font-size: 32px;
}

.login-card form {
    margin-top: 28px;
    text-align: left;
}

.login-card form input {
    margin-bottom: 17px;
}

.login-footnote {
    margin: 23px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.error-message {
    min-height: 18px;
    margin: 12px 0 0;
    color: var(--danger);
    font-size: 12px;
}

/* Application layout */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    z-index: 20;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    width: 245px;
    flex-direction: column;
    padding: 25px 17px 18px;
    background: var(--maroon-dark);
    color: #fff;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 8px 27px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.13);
}

.brand-mark.small {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    margin: 0;
    font-size: 18px;
}

.sidebar-brand strong,
.sidebar-brand span,
.topbar-user strong,
.topbar-user span {
    display: block;
}

.sidebar-brand strong {
    font-family: Georgia, serif;
    font-size: 16px;
}

.sidebar-brand span,
.topbar-user span {
    margin-top: 3px;
    color: #d6bdc4;
    font-size: 11px;
}

.nav-heading {
    margin: 28px 10px 12px;
    color: #bfa5ad;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
}

.navigation {
    display: grid;
    gap: 7px;
}

.nav-link {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 13px;
    padding: 12px 14px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #e5d6da;
    text-align: left;
    font-weight: 550;
}

.nav-link > span {
    width: 19px;
    color: #e0c58e;
    font-size: 17px;
    text-align: center;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.nav-link.active {
    box-shadow: inset 3px 0 var(--gold);
}

.sidebar-bottom {
    margin-top: auto;
}

.sidebar-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 5px 20px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 9px;
    color: #dbcbd0;
    font-size: 11px;
}

.gold-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--gold);
}

.logout-link {
    color: #f0dfe3;
}

.main-content {
    width: calc(100% - 245px);
    min-width: 0;
    margin-left: 245px;
    padding: 0 28px 35px;
}

.topbar {
    display: flex;
    min-height: 94px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border);
}

.topbar h2 {
    margin: 0;
    color: var(--maroon);
    font-family: Georgia, serif;
    font-size: 25px;
}

.topbar .eyebrow {
    margin-bottom: 2px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-user strong {
    font-size: 12px;
}

.topbar-user span {
    color: var(--muted);
}

.avatar {
    display: grid;
    width: 39px;
    height: 39px;
    place-items: center;
    border-radius: 50%;
    background: #f0e2d2;
    color: var(--maroon);
    font-weight: 800;
}

.menu-button {
    display: none;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--maroon);
    font-size: 20px;
}

/* Dashboard */

.page-section {
    display: block;
}

.welcome-row,
.section-intro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.welcome-row h3,
.section-intro h3 {
    color: var(--maroon);
    font-family: Georgia, serif;
    font-size: 23px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.metric-card {
    min-width: 0;
    padding: 21px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.metric-icon {
    display: grid;
    width: 38px;
    height: 38px;
    margin-bottom: 14px;
    place-items: center;
    border-radius: 11px;
    background: #f7ede7;
    color: var(--maroon);
    font-size: 20px;
}

.metric-card p {
    margin-bottom: 9px;
    color: var(--muted);
    font-size: 12px;
}

.metric-card h3 {
    overflow-wrap: anywhere;
    margin: 0 0 6px;
    color: var(--maroon);
    font-family: Georgia, serif;
    font-size: clamp(20px, 2vw, 29px);
}

.metric-caption {
    color: #998b90;
    font-size: 10px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
    margin-bottom: 22px;
}

.panel {
    min-width: 0;
    margin-bottom: 22px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow);
}

.dashboard-grid .panel {
    margin-bottom: 0;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px;
}

.panel-header h3 {
    color: var(--maroon);
    font-family: Georgia, serif;
}

.low-stock-list {
    display: grid;
    gap: 11px;
}

.low-stock-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f2eae6;
}

.low-stock-item:last-child {
    border-bottom: 0;
}

.low-stock-item strong,
.low-stock-item span {
    display: block;
}

.low-stock-item strong {
    font-size: 12px;
}

.low-stock-item span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.stock-count {
    flex: 0 0 auto;
    padding: 5px 9px;
    border-radius: 7px;
    background: #fff0e7;
    color: #a24d21;
    font-size: 11px;
    font-weight: 800;
}

.snapshot-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 0;
    border-bottom: 1px solid #f2eae6;
    font-size: 12px;
}

.snapshot-row:last-of-type {
    border-bottom: 0;
}

.snapshot-row span {
    color: var(--muted);
}

.snapshot-row strong {
    color: var(--maroon);
    text-align: right;
}

/* Tables */

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

th {
    padding: 13px 12px;
    background: #faf5f1;
    color: #746269;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-align: left;
    text-transform: uppercase;
}

td {
    padding: 13px 12px;
    border-bottom: 1px solid #f1eae6;
    font-size: 12px;
}

tbody tr:hover {
    background: #fffcf9;
}

.table-primary {
    color: var(--maroon);
    font-weight: 750;
}

.table-secondary {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.empty-state {
    padding: 30px 12px;
    color: var(--muted);
    text-align: center;
}

.status-pill {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 20px;
    background: #eaf6ee;
    color: var(--success);
    font-size: 10px;
    font-weight: 750;
}

.status-pill.inactive {
    background: #f6e9eb;
    color: var(--danger);
}

.status-pill.low {
    background: #fff1df;
    color: #99551c;
}

.table-actions {
    display: flex;
    gap: 6px;
}

.action-button {
    padding: 6px 9px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    color: var(--maroon);
    font-size: 11px;
    font-weight: 650;
}

.action-button.delete {
    color: var(--danger);
}

/* Filters and pagination */

.filter-bar {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) minmax(140px, 1fr) minmax(130px, 1fr) auto;
    gap: 10px;
    margin-bottom: 18px;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
}

/* Forms */

.form-panel {
    max-width: 950px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form-field {
    min-width: 0;
}

.full-span {
    grid-column: 1 / -1;
}

.calculated-value {
    min-height: 43px;
    padding: 10px 12px;
    border: 1px dashed #d8c49e;
    border-radius: 9px;
    background: #fcf7ed;
    color: var(--maroon);
    font-size: 17px;
    font-weight: 800;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 6px;
}

/* Modal */

.modal {
    position: fixed;
    z-index: 50;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(40, 16, 25, 0.56);
}

.modal-card {
    position: relative;
    z-index: 1;
    width: min(100%, 760px);
    max-height: 90vh;
    overflow-y: auto;
    padding: 26px;
    border-radius: 17px;
    background: #fff;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 24px;
}

.modal-header h3 {
    color: var(--maroon);
    font-family: Georgia, serif;
    font-size: 24px;
}

/* Messages */

.message {
    margin-bottom: 18px;
    padding: 12px 15px;
    border: 1px solid #d8eadf;
    border-radius: 9px;
    background: #eff8f1;
    color: #25623f;
}

.message.error {
    border-color: #f0d1d5;
    background: #fff1f2;
    color: #9b2332;
}

.toast-container {
    position: fixed;
    z-index: 100;
    right: 22px;
    bottom: 22px;
    display: grid;
    width: min(360px, calc(100vw - 32px));
    gap: 9px;
}

.toast {
    padding: 13px 16px;
    border-radius: 10px;
    background: var(--maroon-dark);
    color: #fff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
    font-size: 13px;
}

.toast.error {
    background: #a32638;
}

@media (max-width: 1200px) {
    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 760px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 12px 0 35px rgba(0, 0, 0, 0.15);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        width: 100%;
        margin-left: 0;
        padding: 0 15px 25px;
    }

    .topbar {
        min-height: 80px;
        gap: 10px;
        margin-bottom: 22px;
    }

    .menu-button {
        display: inline-block;
    }

    .topbar h2 {
        font-size: 21px;
    }

    .topbar-user {
        gap: 0;
    }

    .topbar-user > div:last-child {
        display: none;
    }

    .welcome-row,
    .section-intro {
        align-items: flex-start;
        flex-direction: column;
    }

    .metrics-grid {
        gap: 10px;
    }

    .metric-card {
        padding: 15px;
    }

    .metric-card h3 {
        font-size: 22px;
    }

    .panel {
        padding: 15px;
    }

    .filter-bar {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .full-span {
        grid-column: auto;
    }

    .modal-card {
        padding: 18px;
    }

    .pagination-bar {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 420px) {
    .login-card {
        padding: 25px 20px;
    }

    .metrics-grid {
        grid-template-columns: 1fr 1fr;
    }

    .metric-icon {
        width: 32px;
        height: 32px;
        margin-bottom: 10px;
    }

    .metric-card p {
        min-height: 32px;
    }

    .topbar h2 {
        font-size: 18px;
    }
}

/* Multi-product sales and billing */

.sales-customer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sales-product-picker {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) minmax(220px, 2fr)
                           minmax(100px, 0.7fr) minmax(140px, 1fr);
    gap: 12px;
    align-items: end;
}

.sales-add-button .btn {
    min-height: 43px;
}

.sales-cart-quantity {
    width: 82px;
    min-width: 82px;
    padding: 8px;
}

.sales-totals {
    display: grid;
    gap: 12px;
    width: min(100%, 390px);
    margin: 22px 0 0 auto;
}

.sales-discount {
    margin-bottom: 4px;
}

.sales-total-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.sales-total-row strong {
    color: var(--maroon);
    text-align: right;
}

.sales-total-row.grand-total {
    border-bottom: 0;
    font-size: 18px;
}

.sales-total-row.grand-total strong {
    color: var(--maroon);
    font-size: 22px;
}

.sales-actions {
    margin-top: 20px;
}

.saved-sale-panel {
    margin-top: 22px;
    padding: 17px;
    border: 1px solid #d8eadf;
    border-radius: 12px;
    background: #f4faf5;
}

.saved-sale-panel p {
    color: var(--success);
    font-weight: 700;
}

@media (max-width: 1000px) {
    .sales-product-picker {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .sales-customer-grid,
    .sales-product-picker {
        grid-template-columns: 1fr;
    }

    .sales-totals {
        width: 100%;
    }

    .sales-actions .btn {
        width: 100%;
    }
}
.sales-search-wrapper {
    position: relative;
}

.sales-search-suggestions {
    position: absolute;
    top: calc(100% - 2px);
    left: 0;
    right: 0;
    z-index: 1000;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.sales-search-suggestion {
    display: block;
    width: 100%;
    padding: 12px;
    border: none;
    border-bottom: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.sales-search-suggestion:hover,
.sales-search-suggestion:focus {
    background: #fbf7f0;
    outline: none;
}

.sales-search-suggestion strong {
    display: block;
    color: var(--maroon);
}

.sales-search-suggestion small {
    display: block;
    margin-top: 4px;
    color: #666;
}

.sales-search-no-results {
    padding: 12px;
    color: #666;
}
/* Keep dashboard heading and View Sales button in the same row */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
        margin-bottom: 1rem;
}

.dashboard-header h2,
.dashboard-header h3 {
    margin: 0;
}

#toggleSalesVisibility {
    flex-shrink: 0;
    white-space: nowrap;
    margin: 0;
}

.report-date-filter {
    margin: 20px 0;
    padding: 20px;
    background: #fffaf5;
    border: 1px solid #e6d6c5;
    border-radius: 10px;
    text-align: center;
}

.report-date-filter h3 {
    margin: 0 0 16px;
    color: #7d2436;
}

.report-date-controls {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 16px;
    align-content: center;
    justify-content: center;
}


.report-date-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.report-date-field label {
    font-weight: 600;
    font-size: 14px;
}

.report-date-field input {
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid #d5c5b6;
    border-radius: 6px;
}

#downloadSalesReportButton {
    min-height: 40px;
}

#salesReportMessage {
    margin: 12px 0 0;
    font-size: 14px;
}

@media (max-width: 600px) {
    .report-date-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .report-date-field,
    #downloadSalesReportButton {
        width: 100%;
    }
}
/* =========================================================
   MANAGE SALE SOURCES
========================================================= */

.sale-source-panel {
    margin-bottom: 24px;
}

.sale-source-form-grid {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) minmax(160px, 1fr)
                           minmax(130px, 0.8fr);
    gap: 18px;
    align-items: end;
}

.sale-source-form-grid .form-group {
    min-width: 0;
}

.sale-source-form-grid input,
.sale-source-form-grid select {
    width: 100%;
    box-sizing: border-box;
}

.sale-source-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.sale-source-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 180px;
}

.btn-small {
    padding: 7px 12px;
    font-size: 13px;
}

.btn-danger {
    background: #a62f3e;
    color: #fff;
    border: 1px solid #a62f3e;
}

.btn-danger:hover {
    background: #812332;
}

.status-pill {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-active {
    background: #e5f5e9;
    color: #216e39;
}

.status-inactive {
    background: #f5e7e7;
    color: #8b2835;
}

.success-message {
    color: #216e39;
}

.form-message {
    margin-top: 12px;
}

@media (max-width: 768px) {
    .sale-source-form-grid {
        grid-template-columns: 1fr;
    }

    .sale-source-actions {
        min-width: 0;
    }

    .sale-source-form-actions .btn {
        flex: 1;
    }
}

/* Login screen logo */
.login-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 18px;
    width: 80px;
    max-width: 100%;
}

.login-logo img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}

/* Inventory sidebar logo */
.sidebar-logo {
    display: block;
    width: 64px;
    height: 64px;
    flex: 0 0 64px;
    object-fit: contain;
    border-radius: 8px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-brand-text strong {
    line-height: 1.3;
}

.sidebar-brand-text span {
    line-height: 1.4;
}

/* Top-right user logo */
.user-logo {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    overflow: hidden;
    border-radius: 50%;
    background: #fffdf3;
    border: 1px solid #d5b46a;
}

.user-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Responsive login logo */
@media (max-width: 480px) {
    .login-logo {
        width: 70px;
    }

    .sidebar-logo {
        width: 48px;
        height: 48px;
        flex-basis: 48px;
    }
}

/* =========================================
   MANAGE SALE SOURCES - MOBILE RESPONSIVE FIX
   ========================================= */

/* Prevent the sale-source section from overflowing */
#page-sale-sources,
#page-sale-sources .panel,
#page-sale-sources form {
    min-width: 0;
    max-width: 100%;
}

/* Page heading and Refresh button */
#page-sale-sources .section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

#page-sale-sources .section-heading > div {
    min-width: 0;
}

#page-sale-sources .section-heading h2 {
    overflow-wrap: anywhere;
}

/* Responsive source form */
#page-sale-sources .sale-source-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr)
                           minmax(0, 0.8fr);
    gap: 14px;
    align-items: end;
}

#page-sale-sources .sale-source-form-grid .form-group {
    min-width: 0;
}

#page-sale-sources .sale-source-form-grid input,
#page-sale-sources .sale-source-form-grid select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

/* Save and Clear buttons */
#page-sale-sources .sale-source-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

#page-sale-sources .sale-source-form-actions .btn {
    min-height: 42px;
}

/* Source list heading */
#page-sale-sources .table-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

#page-sale-sources .table-heading h3 {
    margin-bottom: 0;
}

/* Keep the table inside its own horizontal scroll area */
#page-sale-sources .table-responsive {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

#page-sale-sources .data-table {
    width: 100%;
    min-width: 540px;
    border-collapse: collapse;
}

#page-sale-sources .data-table th,
#page-sale-sources .data-table td {
    padding: 12px 10px;
    vertical-align: middle;
}

/* Edit/Delete actions must be allowed to wrap */
#page-sale-sources .sale-source-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

#page-sale-sources .sale-source-actions .btn {
    white-space: nowrap;
}

/* Tablet */
@media (max-width: 768px) {
    #page-sale-sources .sale-source-form-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    #page-sale-sources .sale-source-form-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #page-sale-sources .sale-source-form-actions .btn {
        width: 100%;
    }

    #page-sale-sources .section-heading {
        align-items: flex-start;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    #page-sale-sources .panel {
        padding: 14px;
    }

    #page-sale-sources .section-heading {
        flex-direction: column;
        align-items: stretch;
    }

    #page-sale-sources #refreshSaleSourcesButton {
        width: 100%;
    }

    #page-sale-sources .sale-source-form-actions {
        grid-template-columns: 1fr;
    }

    #page-sale-sources .table-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    #page-sale-sources .data-table {
        min-width: 520px;
    }
}
