* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    color: #17202a;
    background: #f4f7fa;
}

.billing-page {
    min-height: 100vh;
    display: flex;
    flex-direction: row;
    gap: 14px;
    padding: 14px;
}

.categories-section,
.items-section,
.bill-section {
    background: #ffffff;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    padding: 16px;
    overflow: auto;
}

.categories-section {
    flex: 0 0 220px;
}

.items-section {
    flex: 1 1 auto;
}

.bill-section {
    flex: 0 0 340px;
    display: flex;
    flex-direction: column;
}

h2 {
    margin: 0 0 14px;
    font-size: 20px;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-button {
    width: 100%;
    min-height: 40px;
    border: 1px solid #b9c7d6;
    border-radius: 6px;
    background: #ffffff;
    color: #17202a;
    text-align: left;
    padding: 9px 10px;
    cursor: pointer;
    font-weight: 700;
}

.category-button.active,
.category-button:hover {
    background: #16745f;
    border-color: #16745f;
    color: #ffffff;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}

.item-card {
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(23, 32, 42, 0.08);
}

.item-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    background: #e8eef5;
}

.item-card-content {
    padding: 10px;
}

.item-card h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

.item-card p {
    margin: 0;
    color: #16745f;
    font-weight: 700;
}

.bill-items {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 180px;
}

.empty-bill {
    color: #66788a;
    margin: 0;
}

.bill-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    border-bottom: 1px solid #e6edf3;
    padding-bottom: 10px;
}

.bill-row strong,
.bill-row span {
    display: block;
}

.bill-row small {
    color: #66788a;
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 7px;
}

.qty-controls button {
    width: 28px;
    height: 28px;
    border: 1px solid #b9c7d6;
    border-radius: 6px;
    background: #ffffff;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.bill-total,
.receipt-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 2px solid #17202a;
    padding-top: 14px;
    margin-top: 14px;
    font-size: 20px;
}

.checkout-button {
    width: 100%;
    min-height: 44px;
    margin-top: 14px;
    border: 0;
    border-radius: 6px;
    background: #16745f;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.checkout-button:hover {
    background: #105b4b;
}

.receipt {
    display: none;
}

@media (max-width: 900px) {
    .billing-page {
        flex-direction: column;
    }

    .categories-section,
    .items-section,
    .bill-section {
        flex: none;
    }
}

@media print {
    body {
        background: #ffffff;
    }

    .billing-page {
        display: none;
    }

    .receipt {
        display: block;
        padding: 20px;
        color: #000000;
    }

    .receipt h1 {
        margin: 0 0 8px;
    }
}
