* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f6f9;
    color: #222;
}


/* TOP BAR */

.topbar {
    height: 70px;
    background: #176b3a;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    gap: 15px;
}

.topbar-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.status-pill {
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 600;
}

.status-pill.locked {
    background: #ffe2e2;
    color: #b42318;
}

.status-pill.open {
    background: #e8f5ed;
    color: #176b3a;
}

.status-date {
    color: #e8f5ed;
}

.brand {
    font-size: 21px;
    font-weight: bold;
}

.brand span {
    display: block;
    font-size: 12px;
    font-weight: normal;
    margin-top: 4px;
}


/* LAYOUT */

.app-layout {
    display: flex;
    min-height: calc(100vh - 70px);
}


/* SIDEBAR */

.sidebar {
    width: 220px;
    background: #ffffff;
    padding: 20px 10px;
    border-right: 1px solid #ddd;
}

.sidebar a {
    display: block;
    text-decoration: none;
    color: #333;
    padding: 13px 15px;
    margin-bottom: 5px;
    border-radius: 7px;
}

.sidebar a:hover {
    background: #e8f5ed;
    color: #176b3a;
}


/* MAIN */

.main-content {
    flex: 1;
    padding: 30px;
    overflow-x: hidden;
}


/* PAGE HEADER */

.page-header {
    margin-bottom: 25px;
}

.page-header h1 {
    margin: 0 0 5px;
}

.page-header p {
    margin: 0;
    color: #666;
}


/* DASHBOARD */

.dashboard-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.dashboard-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow:
        0 3px 12px rgba(0,0,0,0.08);
}

.dashboard-card h3 {
    margin-top: 0;
}

.dashboard-amount {
    font-size: 28px;
    font-weight: bold;
    margin: 15px 0;
    color: #176b3a;
}

.dashboard-card p {
    color: #777;
    margin-bottom: 0;
}


/* CARD */

.card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow:
        0 3px 12px rgba(0,0,0,0.07);
}

.card h2 {
    margin-top: 0;
}


/* FORM */

.product-form {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    align-items: end;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: bold;
}

input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
}


/* BUTTONS */

.btn-primary {
    background: #176b3a;
    color: white;
    border: none;
    padding: 11px 20px;
    border-radius: 7px;
    cursor: pointer;
}

.bill-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    white-space: nowrap;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);
}

.btn-action-edit {
    background: linear-gradient(135deg, #2a6fdb, #4b8bf5);
    color: white;
}

.btn-action-print {
    background: linear-gradient(135deg, #176b3a, #2a8f4a);
    color: white;
}

.btn-action-delete {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: white;
    border: none;
    cursor: pointer;
}

.btn-toggle {
    background: #555;
    color: white;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 5px;
    display: inline-block;
}


/* MODAL */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9999;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* TABLE */

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
    text-align: left;
}

th {
    background: #f5f5f5;
}

.actions {
    white-space: nowrap;
}


/* STATUS */

.status-active {
    color: green;
    font-weight: bold;
}

.status-inactive {
    color: red;
    font-weight: bold;
}


/* ALERT */

.alert {
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 7px;
}

.alert.success {
    background: #dff5e5;
    color: #176b3a;
}

.alert.error {
    background: #ffe2e2;
    color: #b00020;
}

.empty {
    text-align: center;
    color: #777;
}


/* COMPANY BILLS / LEDGER */

.company-ledger-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
}

.company-ledger-filters .form-group {
    min-width: 170px;
    flex: 1 1 170px;
}

.company-ledger-filters .btn-primary {
    min-width: 110px;
}

.summary-date-form,
.payment-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.95rem;
    color: #334155;
    margin-bottom: 0;
}

.form-group select,
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #d7dfeb;
    border-radius: 10px;
    background: #ffffff;
    color: #0f172a;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #176b3a;
    box-shadow: 0 0 0 3px rgba(23, 107, 58, 0.12);
}

.btn-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #d7dfeb;
    padding: 10px 16px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.btn-reset:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, #176b3a 0%, #1f8f4b 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(23, 107, 58, 0.16);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(23, 107, 58, 0.22);
}

.generate-bill-area {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.company-ledger-summary,
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.summary-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fbf9 100%);
    border: 1px solid #e4ece7;
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.summary-card span {
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.summary-card strong {
    font-size: 1.15rem;
    color: #176b3a;
}

.summary-due-card {
    background: linear-gradient(135deg, #fff7f7 0%, #fff0f0 100%);
    border-color: #f6d3d3;
}

.summary-due-card strong {
    color: #b42318;
}

.ledger-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eef2f7;
}

.ledger-current-balance {
    min-width: 180px;
    background: #f7fbf8;
    border: 1px solid #e1ecdf;
    border-radius: 12px;
    padding: 12px 14px;
}

.ledger-current-balance span {
    display: block;
    font-size: 0.78rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.ledger-current-balance strong {
    color: #176b3a;
    font-size: 1.05rem;
}

.table-wrapper {
    overflow-x: auto;
}

.company-ledger-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #ffffff;
}

.company-ledger-table th {
    background: #f6fbf8;
    color: #334155;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid #e5e7eb;
}

.company-ledger-table td {
    padding: 12px 14px;
    vertical-align: top;
}

.company-ledger-table tbody tr:nth-child(even) {
    background: #fcfdfc;
}

.ledger-date-row:hover {
    background: #f4fbf6 !important;
}

.ledger-expand-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #e7f4eb;
    color: #176b3a;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.ledger-expand-btn:hover {
    background: #176b3a;
    color: #ffffff;
}

.ledger-detail-row td {
    padding: 0 14px 14px;
}

.ledger-detail-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    padding: 16px;
    background: #f8fbf9;
    border: 1px solid #e2ece5;
    border-radius: 12px;
}

.ledger-detail-section h3 {
    margin: 0 0 10px;
    font-size: 1rem;
    color: #0f172a;
}

.ledger-detail-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ledger-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #e7ece9;
    border-radius: 10px;
}

.ledger-detail-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.record-action-menu-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.record-menu-button {
    width: 32px;
    height: 32px;
    border: 1px solid #dfe7ef;
    background: #ffffff;
    color: #334155;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}

.record-menu-button:hover {
    background: #f8fafc;
    border-color: #c9d6e4;
}

.record-context-menu {
    position: fixed;
    min-width: 180px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
    z-index: 2000;
    overflow: hidden;
}

.record-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: none;
    background: transparent;
    padding: 10px 14px;
    text-align: left;
    color: #0f172a;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
}

.record-menu-item + .record-menu-item {
    border-top: 1px solid #edf2f7;
}

.record-menu-item:hover {
    background: #f8fafc;
}

.record-menu-item-danger {
    color: #b42318;
}

.ledger-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    z-index: 2100;
}

.ledger-modal-content {
    width: min(560px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
}

.ledger-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.hidden {
    display: none !important;
}

/* MOBILE */

@media (max-width: 768px) {

    .app-layout {
        display: block;
    }

    .sidebar {
        width: 100%;
        display: flex;
        overflow-x: auto;
        padding: 10px;
    }

    .sidebar a {
        white-space: nowrap;
        margin-right: 5px;
    }

    .main-content {
        padding: 15px;
    }

    .topbar {
        padding: 0 15px;
    }

    .product-form {
        grid-template-columns: 1fr;
    }

    .company-ledger-filters,
    .summary-date-form,
    .payment-form-grid {
        grid-template-columns: 1fr;
    }

    .ledger-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .ledger-current-balance {
        width: 100%;
    }

    .ledger-detail-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .bill-actions {
        flex-wrap: wrap;
    }

}
/* DASHBOARD */

.dashboard-header-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 20px 22px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fbf9 100%);
    border: 1px solid #e4ece7;
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
    margin-bottom: 20px;
}

.dashboard-date-selector {
    flex: 1;
}

.dashboard-date-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: #334155;
}

.dashboard-date-picker-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.dashboard-date-picker-row input[type="date"] {
    min-width: 180px;
    padding: 10px 12px;
    border: 1px solid #d7dfeb;
    border-radius: 10px;
    background: #ffffff;
}

.dashboard-quick-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-date-btn {
    border: 1px solid #d7dfeb;
    background: #f8fafc;
    color: #334155;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-date-btn:hover,
.quick-date-btn.active {
    background: #176b3a;
    color: #ffffff;
    border-color: #176b3a;
}

/* SHOP RATES */

.rate-shop-selector {
    display: flex;
    gap: 15px;
    max-width: 600px;
}

.rate-shop-selector select {
    flex: 1;
    padding: 11px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: white;
}

.save-rates-area {
    margin-top: 20px;
    text-align: right;
}


.btn-rate-remove {
    background: #d32f2f;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}


.btn-rate-remove:hover {
    background: #b32626;
}


@media (max-width: 768px) {

    .rate-shop-selector {
        flex-direction: column;
    }

    .save-rates-area {
        text-align: left;
    }

}
/* =========================================
   RETAIL BILLING
========================================= */

.billing-add-row {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 15px;
    align-items: end;
}


.billing-add-row select {
    width: 100%;
    padding: 11px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: white;
}


.bill-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}


.bill-header-row h2 {
    margin-bottom: 5px;
}


.bill-header-row p {
    margin-top: 0;
    color: #777;
}


.bill-qty-input {
    width: 90px;
}


.btn-remove {
    background: #d32f2f;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
}


.btn-clear {
    background: #666;
    color: white;
    border: none;
    padding: 9px 15px;
    border-radius: 6px;
    cursor: pointer;
}


.retail-total-section {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 30px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #eee;
    font-size: 20px;
}


.retail-total-section strong {
    font-size: 30px;
    color: #176b3a;
}


.generate-bill-area {
    text-align: right;
    margin-top: 20px;
}


.btn-generate {
    background: #176b3a;
    color: white;
    border: none;
    padding: 14px 25px;
    border-radius: 7px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}


.btn-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


.bill-success-message {
    margin-top: 20px;
    padding: 15px;
    background: #e5f5ea;
    color: #176b3a;
    border-radius: 7px;
    line-height: 1.7;
}


.bill-success-message:empty {
    display: none;
}


@media (max-width: 768px) {

    .billing-add-row {
        grid-template-columns: 1fr;
    }


    .bill-header-row {
        align-items: flex-start;
    }


    .retail-total-section {
        justify-content: space-between;
    }


    .generate-bill-area {
        text-align: left;
    }


    .btn-generate {
        width: 100%;
    }

}
/* =========================================
   WHOLESALE BILLING
========================================= */

.wholesale-shop-row {
    display: flex;
    gap: 15px;
    max-width: 600px;
}

.wholesale-shop-row select {
    flex: 1;
    padding: 11px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: white;
}


.wholesale-info-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}


.wholesale-info-box {
    padding: 18px;
    background: #f7f7f7;
    border-radius: 8px;
}


.wholesale-info-box span {
    display: block;
    color: #666;
    margin-bottom: 8px;
}


.wholesale-info-box strong {
    font-size: 21px;
}


.total-due-box {
    background: #e8f5ed;
}


.total-due-box strong {
    color: #176b3a;
}


.wholesale-product-title {
    margin-top: 10px;
}


.wholesale-product-picker-wrap {
    border: 1px solid #e7edf5;
    border-radius: 10px;
}


.wholesale-product-picker-table th,
.wholesale-product-picker-table td {
    vertical-align: middle;
}


.wholesale-select-qty {
    width: 95px;
    max-width: 100%;
}


.include-prev-balance-row {
    max-width: 450px;
    margin-left: auto;
    margin-top: 20px;
    margin-bottom: 4px;
}


.include-prev-balance-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #444;
    cursor: pointer;
    user-select: none;
}


.include-prev-balance-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #176b3a;
}


.wholesale-total-summary {
    max-width: 450px;
    margin-left: auto;
    margin-top: 25px;
}


.wholesale-total-summary > div {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
}


.summary-total-due {
    border-top: 2px solid #333;
    margin-top: 5px;
    padding-top: 15px !important;
    font-size: 22px;
}


.summary-total-due strong {
    color: #176b3a;
}


@media (max-width: 768px) {

    .wholesale-shop-row {
        flex-direction: column;
    }

    .wholesale-select-qty {
        width: 92px;
    }

}
/* =========================================
   WHOLESALE PAYMENTS
========================================= */

.payment-form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 20px;
    align-items: end;
}


.payment-form-grid select {
    width: 100%;
    padding: 11px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: white;
}


.payment-balance-box {
    padding: 10px 15px;
    background: #e8f5ed;
    border-radius: 7px;
}


.payment-balance-box span {
    display: block;
    color: #666;
    font-size: 13px;
    margin-bottom: 5px;
}


.payment-balance-box strong {
    color: #176b3a;
    font-size: 22px;
}


@media (max-width: 900px) {

    .payment-form-grid {
        grid-template-columns: 1fr;
    }

}
/* =========================================
   PAYMENT HISTORY / LEDGER / OUTSTANDING
========================================= */

.history-filter-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto auto;
    gap: 15px;
    align-items: end;
    margin-bottom: 25px;
}


.history-filter-grid select,
.ledger-shop-selector select {
    width: 100%;
    padding: 11px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: white;
}


.btn-reset {
    display: inline-block;
    padding: 11px 18px;
    background: #666;
    color: white;
    text-decoration: none;
    border-radius: 7px;
    text-align: center;
}


.payment-amount {
    color: #176b3a;
    font-weight: bold;
}


.ledger-shop-selector {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 15px;
    align-items: end;
    max-width: 700px;
}


.ledger-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}


.ledger-heading h2 {
    margin-bottom: 5px;
}


.ledger-heading p {
    margin: 0;
    color: #777;
}


.ledger-current-balance {
    background: #e8f5ed;
    padding: 15px 25px;
    border-radius: 8px;
}


.ledger-current-balance span {
    display: block;
    color: #666;
    font-size: 13px;
    margin-bottom: 5px;
}


.ledger-current-balance strong {
    font-size: 25px;
    color: #176b3a;
}


.ledger-bill {
    color: #d32f2f;
    font-weight: bold;
}


.ledger-payment {
    color: #176b3a;
    font-weight: bold;
}


.ledger-bill-link {
    color: #1d4ed8;
    text-decoration: underline;
    text-underline-offset: 2px;
}


.ledger-bill-link:hover {
    color: #1e40af;
}


.outstanding-total-card {
    background: #176b3a;
    color: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 25px;
}


.outstanding-total-card span {
    display: block;
    margin-bottom: 8px;
}


.outstanding-total-card strong {
    font-size: 32px;
}


@media (max-width: 768px) {

    .history-filter-grid {
        grid-template-columns: 1fr;
    }


    .ledger-shop-selector {
        grid-template-columns: 1fr;
    }


    .ledger-heading {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

}
/* =========================================
   DAILY WHOLESALE SUMMARY
========================================= */

.summary-date-form {
    display: flex;
    gap: 15px;
    align-items: end;
}


.summary-date-form .form-group {
    min-width: 220px;
}


.btn-print-summary {
    background: #333;
    color: white;
    border: none;
    padding: 11px 20px;
    border-radius: 7px;
    cursor: pointer;
}


.summary-cards {
    display: grid;
    grid-template-columns:
        repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}


.summary-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow:
        0 3px 12px rgba(0,0,0,0.07);
}


.summary-card span {
    display: block;
    color: #666;
    margin-bottom: 10px;
}


.summary-card strong {
    font-size: 25px;
}


.summary-due-card {
    background: #176b3a;
    color: white;
}


.summary-due-card span {
    color: #eee;
}


.print-summary-header {
    display: none;
    text-align: center;
}


.summary-table tfoot {
    background: #e8f5ed;
}


.summary-table tfoot th {
    font-weight: bold;
}


@media (max-width: 900px) {

    .summary-cards {
        grid-template-columns:
            repeat(2, 1fr);
    }

}


@media (max-width: 600px) {

    .summary-date-form {
        flex-direction: column;
        align-items: stretch;
    }


    .summary-date-form .form-group {
        min-width: 100%;
    }


    .summary-cards {
        grid-template-columns: 1fr;
    }

}
/* =========================================
   BILL HISTORY
========================================= */

.bill-history-filters {
    display: grid;
    grid-template-columns:
        1fr 2fr 1fr 1fr auto auto;
    gap: 15px;
    align-items: end;
}


.bill-history-filters select {
    width: 100%;
    padding: 11px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: white;
}


.bill-type-wholesale {
    color: #1976d2;
    font-weight: bold;
}


.bill-type-retail {
    color: #176b3a;
    font-weight: bold;
}


/* =========================================
   INDIVIDUAL POS BILL
========================================= */

.bill-view-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}


.pos-bill {
    max-width: 500px;
    margin: 0 auto;
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow:
        0 3px 12px rgba(0,0,0,0.08);
}


.pos-bill-header {
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 1px dashed #333;
}


.pos-bill-header h2 {
    margin: 0 0 5px;
}


.pos-bill-header p {
    margin: 0;
    font-weight: bold;
}


.pos-bill-info {
    padding: 15px 0;
    border-bottom: 1px dashed #333;
}


.pos-bill-info div {
    display: flex;
    justify-content: space-between;
    margin: 5px 0;
}


.pos-customer {
    padding: 15px 0;
    border-bottom: 1px dashed #333;
}


.pos-customer span {
    display: block;
    font-size: 12px;
    margin-bottom: 5px;
}


.pos-customer strong {
    font-size: 18px;
}


.pos-items-table {
    margin-top: 15px;
}


.pos-items-table th,
.pos-items-table td {
    padding: 8px 4px;
    font-size: 13px;
}


.pos-grand-total {
    display: flex;
    justify-content: space-between;
    font-size: 22px;
    padding: 15px 0;
    margin-top: 10px;
    border-top: 2px solid #333;
}


.pos-wholesale-totals {
    padding-top: 15px;
    margin-top: 10px;
    border-top: 1px dashed #333;
}


.pos-wholesale-totals > div {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
}


.pos-total-due {
    margin-top: 5px;
    padding-top: 12px !important;
    border-top: 2px solid #333;
    font-size: 20px;
}


.pos-thank-you {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed #333;
    font-weight: bold;
}


@media (max-width: 900px) {

    .bill-history-filters {
        grid-template-columns: 1fr;
    }

}
/* =========================================
   LIVE DASHBOARD
========================================= */

.dashboard-date {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    background: white;
    padding: 10px 16px;
    border-radius: 7px;
    margin-bottom: 20px;
    box-shadow:
        0 2px 8px rgba(0,0,0,0.06);
}


.dashboard-date span {
    color: #777;
}


.outstanding-dashboard-card {
    background: #176b3a;
    color: white;
}


.outstanding-dashboard-card h3 {
    color: white;
}


.outstanding-dashboard-card
.dashboard-amount {
    color: white;
}


.outstanding-dashboard-card p {
    color: #e5e5e5;
}


.dashboard-secondary-grid {
    display: grid;
    grid-template-columns:
        repeat(4, 1fr);
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 25px;
}


.dashboard-small-card,
.dashboard-action-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    text-decoration: none;
    color: #222;
    box-shadow:
        0 3px 12px rgba(0,0,0,0.07);
}


.dashboard-small-card span {
    display: block;
    color: #666;
    margin-bottom: 12px;
}


.dashboard-small-card strong {
    font-size: 24px;
    color: #176b3a;
}


.dashboard-action-card {
    background: #e8f5ed;
}


.dashboard-action-card strong {
    display: block;
    color: #176b3a;
    font-size: 18px;
    margin-bottom: 7px;
}


.dashboard-action-card span {
    color: #666;
    font-size: 13px;
}


.dashboard-quick-actions {
    margin-top: 10px;
}


.quick-action-grid {
    display: grid;
    grid-template-columns:
        repeat(3, 1fr);
    gap: 12px;
}


.quick-action-button {
    display: block;
    background: #f5f5f5;
    color: #333;
    text-decoration: none;
    padding: 15px;
    border-radius: 7px;
    text-align: center;
    font-weight: bold;
}


.quick-action-button:hover {
    background: #e8f5ed;
    color: #176b3a;
}


@media (max-width: 1000px) {

    .dashboard-secondary-grid {
        grid-template-columns:
            repeat(2, 1fr);
    }

}


@media (max-width: 600px) {

    .dashboard-secondary-grid {
        grid-template-columns: 1fr;
    }


    .quick-action-grid {
        grid-template-columns:
            repeat(2, 1fr);
    }

}
/* =========================================
   BILL VIEW NAVIGATION
========================================= */

.bill-navigation {
    display: flex;
    gap: 10px;
}


.btn-new-bill {
    display: inline-block;
    padding: 11px 18px;
    background: #176b3a;
    color: white;
    text-decoration: none;
    border-radius: 7px;
    text-align: center;
}


@media (max-width: 600px) {

    .bill-view-actions {
        flex-direction: column;
        gap: 15px;
    }


    .bill-navigation {
        flex-wrap: wrap;
    }


    .bill-view-actions > button {
        width: 100%;
    }

}
/* =========================================
   80MM POS BILL SCREEN PREVIEW
========================================= */

.pos-bill {
    width: 80mm;
    max-width: 100%;
    margin: 0 auto;
    background: white;
    padding: 15px;
    box-sizing: border-box;
}


.pos-items-table {
    width: 100%;
    table-layout: fixed;
}


.pos-items-table th:nth-child(1),
.pos-items-table td:nth-child(1) {
    width: 40%;
}


.pos-items-table th:nth-child(2),
.pos-items-table td:nth-child(2) {
    width: 15%;
    text-align: right;
}


.pos-items-table th:nth-child(3),
.pos-items-table td:nth-child(3) {
    width: 20%;
    text-align: right;
}


.pos-items-table th:nth-child(4),
.pos-items-table td:nth-child(4) {
    width: 25%;
    text-align: right;
}
/* =========================================
   LOGIN PAGE
========================================= */

.login-page {
    margin: 0;
    min-height: 100vh;
    background: #f3f6f4;
    font-family: Arial, sans-serif;
}


.login-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}


.login-card {
    width: 100%;
    max-width: 380px;
    background: white;
    padding: 35px;
    border-radius: 14px;
    box-shadow:
        0 8px 30px rgba(0, 0, 0, 0.10);
}


.login-header {
    text-align: center;
    margin-bottom: 30px;
}


.login-header h1 {
    margin: 0;
    color: #176b3a;
    font-size: 30px;
}


.login-header h2 {
    margin: 5px 0;
    font-size: 20px;
}


.login-header p {
    color: #777;
    margin-top: 10px;
}


.login-form-group {
    margin-bottom: 20px;
}


.login-form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: bold;
}


.login-form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 7px;
    box-sizing: border-box;
    font-size: 15px;
}


.login-form-group input:focus {
    outline: none;
    border-color: #176b3a;
}


.login-button {
    width: 100%;
    padding: 13px;
    background: #176b3a;
    color: white;
    border: none;
    border-radius: 7px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}


.login-error {
    background: #fdeaea;
    color: #b42318;
    padding: 10px;
    border-radius: 7px;
    margin-bottom: 20px;
    text-align: center;
}
/* =========================================
   CHANGE PASSWORD
========================================= */

.change-password-card {
    max-width: 550px;
}


.change-password-card .form-group {
    margin-bottom: 20px;
}


.change-password-card input {
    width: 100%;
    padding: 11px;
    border: 1px solid #ccc;
    border-radius: 7px;
    box-sizing: border-box;
}


.password-success {
    background: #e8f5ed;
    color: #176b3a;
    padding: 12px;
    border-radius: 7px;
    margin-bottom: 20px;
    font-weight: bold;
}
/* =====================================================
   MOBILE RESPONSIVE LAYOUT - FIXED
===================================================== */

.mobile-menu-button {
    display: none;
}

.mobile-overlay {
    display: none;
}


/* =====================================================
   MOBILE
===================================================== */

@media (max-width: 768px) {

    /* -----------------------------------------
       MOBILE MENU BUTTON
    ----------------------------------------- */

    .mobile-menu-button {
        display: flex;
        align-items: center;
        justify-content: center;

        position: fixed;
        top: 12px;
        left: 12px;

        width: 44px;
        height: 44px;

        padding: 0;
        margin: 0;

        border: none;
        border-radius: 8px;

        background: #176b3a;
        color: white;

        font-size: 26px;
        line-height: 1;

        cursor: pointer;

        z-index: 3000;
    }


    /* -----------------------------------------
       TOP HEADER
    ----------------------------------------- */

    .topbar {
        position: relative !important;

        width: 100% !important;
        height: auto !important;
        min-height: 70px;

        margin: 0 !important;
        padding: 12px 15px 12px 70px !important;

        box-sizing: border-box;

        display: flex !important;
        align-items: center !important;

        overflow: hidden;
    }


    .topbar h1,
    .topbar h2 {
        margin: 0 !important;
        padding: 0 !important;

        font-size: 20px !important;

        white-space: normal !important;
        word-break: normal;

        line-height: 1.2;
    }


    .topbar p {
        margin: 4px 0 0 0 !important;

        font-size: 12px !important;

        white-space: normal !important;
    }


    /* -----------------------------------------
       SIDEBAR
    ----------------------------------------- */

    .sidebar {
        position: fixed !important;

        top: 0 !important;
        left: -280px !important;

        width: 260px !important;
        max-width: 85vw;

        height: 100vh !important;

        margin: 0 !important;
        padding: 25px 15px !important;

        box-sizing: border-box;

        background: white;

        z-index: 2900;

        overflow-x: hidden !important;
        overflow-y: auto !important;

        transition: left 0.25s ease;
    }


    .sidebar.mobile-open {
        left: 0 !important;
    }


    /* -----------------------------------------
       SIDEBAR NAVIGATION
    ----------------------------------------- */

    .sidebar nav {
        display: flex !important;
        flex-direction: column !important;

        width: 100% !important;

        gap: 5px;
    }


    .sidebar a {
        display: block !important;

        width: 100% !important;

        padding: 12px 15px !important;
        margin: 0 !important;

        box-sizing: border-box;

        text-decoration: none;

        white-space: normal !important;

        overflow: visible !important;
    }


    /* -----------------------------------------
       OVERLAY
    ----------------------------------------- */

    .mobile-overlay {
        display: none;
    }


    .mobile-overlay.active {
        display: block !important;

        position: fixed;

        top: 0;
        left: 0;

        width: 100vw;
        height: 100vh;

        background: rgba(0, 0, 0, 0.45);

        z-index: 2800;
    }


    /* -----------------------------------------
       MAIN APP LAYOUT
    ----------------------------------------- */

    .app-layout {
        display: block !important;

        width: 100% !important;

        margin: 0 !important;
        padding: 0 !important;
    }


    .main-content {
        display: block !important;

        width: 100% !important;
        max-width: 100% !important;

        margin: 0 !important;

        padding:
            25px
            15px
            30px
            15px !important;

        box-sizing: border-box;
    }


    /* -----------------------------------------
       DASHBOARD
    ----------------------------------------- */

    .dashboard-grid {
        display: grid !important;

        grid-template-columns: 1fr !important;

        width: 100% !important;

        gap: 15px !important;
    }


    .dashboard-card {
        width: 100% !important;

        margin: 0 !important;

        box-sizing: border-box;
    }


    .dashboard-secondary-grid {
        grid-template-columns: 1fr !important;
    }


    /* -----------------------------------------
       CARDS
    ----------------------------------------- */

    .card {
        width: 100% !important;
        max-width: 100% !important;

        box-sizing: border-box;
    }


    /* -----------------------------------------
       TABLES
    ----------------------------------------- */

    .table-wrapper {
        width: 100% !important;

        overflow-x: auto !important;

        -webkit-overflow-scrolling: touch;
    }


    .table-wrapper table {
        min-width: 600px;
    }


    /* -----------------------------------------
       INPUTS
    ----------------------------------------- */

    input,
    select,
    textarea {
        max-width: 100% !important;

        box-sizing: border-box;
    }


    /* -----------------------------------------
       POS BILL PREVIEW
    ----------------------------------------- */

    .pos-bill {
        width: 100% !important;

        max-width: 80mm !important;

        box-sizing: border-box;
    }

}
@media (max-width: 768px) {

    .sidebar {
        display: flex !important;
        flex-direction: column !important;
        gap: 5px !important;
    }

    .sidebar a {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box;
    }

}
/* =====================================================
   DELETE BUTTON
===================================================== */

.btn-delete {
    display: inline-block;

    padding: 9px 16px;

    background: #dc3545;
    color: white;

    border: none;
    border-radius: 6px;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    text-decoration: none;

    transition:
        background 0.2s ease,
        transform 0.1s ease;
}


.btn-delete:hover {
    background: #bb2d3b;
}


.btn-delete:active {
    transform: scale(0.97);
}


/* Mobile */

@media (max-width: 768px) {

    .btn-delete {
        min-height: 44px;
        padding: 10px 16px;
    }

}
/* PRODUCTS FORM - DESKTOP HORIZONTAL */

.product-add-form {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) auto !important;
    gap: 15px !important;
    align-items: end !important;
}

.product-add-form .form-group {
    margin: 0 !important;
}

.product-add-form input {
    width: 100% !important;
    box-sizing: border-box !important;
}


/* TABLET */

@media (max-width: 1000px) {

    .product-add-form {
        grid-template-columns: repeat(2, 1fr) !important;
    }

}


/* MOBILE */

@media (max-width: 600px) {

    .product-add-form {
        grid-template-columns: 1fr !important;
    }

}
/* =====================================================
   MOBILE BARCODE SCANNER
===================================================== */

.mobile-barcode-section {
    display: none;
}


.barcode-scanner-modal {
    display: none;

    position: fixed;

    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    background: rgba(0, 0, 0, 0.75);

    z-index: 5000;

    align-items: center;
    justify-content: center;

    padding: 15px;

    box-sizing: border-box;
}


.barcode-scanner-modal.active {
    display: flex;
}


.barcode-scanner-box {
    width: 100%;
    max-width: 500px;

    background: white;

    border-radius: 12px;

    padding: 15px;

    box-sizing: border-box;
}


.barcode-scanner-header {
    display: flex;

    justify-content: space-between;
    align-items: center;

    margin-bottom: 15px;
}


.barcode-scanner-header h3 {
    margin: 0;
}


.scanner-close-button {
    width: 40px;
    height: 40px;

    border: none;
    border-radius: 50%;

    background: #eee;

    font-size: 25px;

    cursor: pointer;
}


.scanner-camera-container {
    position: relative;

    width: 100%;

    background: black;

    overflow: hidden;

    border-radius: 10px;
}


#barcodeVideo {
    display: block;

    width: 100%;

    max-height: 65vh;

    object-fit: cover;
}


.scanner-frame {
    position: absolute;

    top: 50%;
    left: 50%;

    transform:
        translate(-50%, -50%);

    width: 80%;
    height: 100px;

    border: 3px solid white;

    border-radius: 8px;

    pointer-events: none;
}


#scannerMessage {
    text-align: center;

    margin: 15px 0;

    font-size: 14px;
}


.btn-close-scanner {
    width: 100%;

    padding: 12px;

    border: none;
    border-radius: 7px;

    background: #555;
    color: white;

    cursor: pointer;
}


.barcode-scanner-status {
    margin-top: 8px;

    font-size: 14px;
}


/* MOBILE ONLY */

@media (max-width: 768px) {

    .mobile-barcode-section {
        display: block;

        margin-bottom: 20px;
    }


    .btn-scan-barcode {
        width: 100%;

        min-height: 48px;

        padding: 12px 18px;

        border: none;
        border-radius: 8px;

        background: #176b3a;
        color: white;

        font-size: 16px;
        font-weight: bold;

        cursor: pointer;
    }

}

/* =========================================
   WHOLESALE BILLING - ADD BUTTONS & TEMPORARY PRODUCT
   ========================================= */

.wholesale-add-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.wholesale-add-actions .wholesale-add-btn {
    width: 240px;
    max-width: 100%;
    padding: 11px 18px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
}

.btn-temp-product {
    background: #f3faf6;
    color: #176b3a;
    border: 1.5px dashed #2a8f4a;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.btn-temp-product:hover {
    background: #e3f4ea;
    transform: translateY(-1px);
}

.wholesale-add-hint {
    color: #6b7280;
    font-size: 12px;
    text-align: right;
    max-width: 240px;
}

.temp-product-modal {
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
}

.temp-product-card {
    width: 100%;
    max-width: 420px;
    margin: 60px auto;
    padding: 22px 24px;
    border-radius: 14px;
    border-top: 5px solid #176b3a;
}

.temp-product-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.temp-product-header h3 {
    margin: 0;
    color: #176b3a;
    font-size: 20px;
}

.temp-product-close {
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 0 4px;
}

.temp-product-close:hover {
    color: #111827;
}

.temp-product-note {
    margin: 0 0 16px;
    padding: 10px 12px;
    background: #f3faf6;
    border-radius: 8px;
    color: #374151;
    font-size: 13px;
    line-height: 1.45;
}

.temp-product-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 12px;
}

.temp-product-field label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.temp-product-optional {
    font-weight: 400;
    color: #9ca3af;
}

.temp-product-field input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
}

.temp-product-field input:focus {
    outline: none;
    border-color: #176b3a;
    box-shadow: 0 0 0 3px rgba(23, 107, 58, 0.12);
}

.temp-product-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.temp-product-warning {
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #fff6e0;
    border: 1px solid #f0c955;
    border-radius: 8px;
    font-size: 13px;
}

.temp-product-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 6px;
}

.temp-item-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #fff4d6;
    color: #8a5a00;
    border: 1px solid #f0c955;
    font-size: 11px;
    font-weight: 600;
    vertical-align: middle;
}

@media (max-width: 600px) {
    .wholesale-add-actions {
        align-items: stretch;
    }

    .wholesale-add-actions .wholesale-add-btn {
        width: 100%;
    }

    .wholesale-add-hint {
        max-width: none;
        text-align: center;
    }

    .temp-product-card {
        margin: 20px auto;
        padding: 18px;
    }
}

.temp-product-actions .btn-reset {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #d7dfeb;
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
}

.temp-product-actions .btn-reset:hover {
    background: #e2e8f0;
}

/* =========================================
   MOBILE / ANDROID: date filter forms
   (Shop Statement, Wholesale Summary, ...)
   Keep every field inside the card, full width,
   one below the other.
========================================= */

@media (max-width: 768px) {

    .summary-date-form {
        flex-direction: column;
        align-items: stretch !important;
    }

    .summary-date-form .form-group {
        min-width: 0 !important;
        width: 100%;
    }

    .summary-date-form select,
    .summary-date-form input[type="date"] {
        width: 100%;
        box-sizing: border-box;
    }

    .summary-date-form > button,
    .summary-date-form > a {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
    }
}

/* =========================================
   PAGINATION (Bill History, Payments)
========================================= */

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 18px 0 6px;
    flex-wrap: wrap;
}

.pager-btn {
    display: inline-flex;
    align-items: center;
    padding: 9px 18px;
    border-radius: 999px;
    background: #176b3a;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

.pager-btn.disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: default;
}

.pager-info {
    font-weight: 600;
    color: #374151;
}

.history-summary {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin: 4px 0 12px;
    color: #374151;
}
