* {
    box-sizing: border-box;
}

:root {
    --blue: #1769aa;
    --dark: #0d4777;
    --yellow: #f6c744;
    --bg: #f4f6f8;
    --text: #17202a;
    --muted: #718096;
    --border: #e2e8f0;
    --green: #2f855a;
    --red: #c53030;
}

/* =========================
   Base
   ========================= */

html,
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

body {
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

button,
input {
    font: inherit;
}

/* =========================
   Header
   ========================= */

.app-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: linear-gradient(135deg, var(--dark), var(--blue));
    color: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.14);
}

.header-inner {
    max-width: 900px;
    margin: auto;
    min-height: 62px;
    padding: 9px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand {
    flex: 1;
    font-weight: 800;
    font-size: 18px;
}

    .brand small {
        display: block;
        font-size: 11px;
        font-weight: 500;
        opacity: 0.78;
        margin-top: 2px;
    }

.back {
    font-size: 30px;
    padding: 0 8px;
    line-height: 1;
}

/* =========================
   Page
   ========================= */

.page {
    max-width: 900px;
    margin: auto;
    padding: 14px 14px 100px;
}

/* =========================
   Hero
   ========================= */

.hero {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 19px;
    margin-bottom: 14px;
    box-shadow: 0 4px 18px rgba(23, 45, 70, 0.05);
}

    .hero h1 {
        margin: 0 0 5px;
        font-size: 24px;
    }

    .hero p {
        margin: 0;
        color: var(--muted);
        font-size: 13px;
    }

/* =========================
   Card
   ========================= */

.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 15px;
    margin-bottom: 13px;
    box-shadow: 0 3px 14px rgba(23, 45, 70, 0.045);
}

.card-title {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 12px;
}

/* =========================
   Menu
   ========================= */

.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.menu-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 19px;
    padding: 19px 16px;
    min-height: 118px;
    box-shadow: 0 4px 15px rgba(23, 45, 70, 0.05);
}

.menu-icon {
    font-size: 30px;
    margin-bottom: 11px;
}

.menu-card strong {
    display: block;
    font-size: 17px;
}

.menu-card span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 5px;
    line-height: 1.45;
}

/* =========================
   Form
   ========================= */

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.field {
    margin-bottom: 12px;
}

    .field label {
        display: block;
        font-size: 13px;
        font-weight: 700;
        color: #4a5568;
        margin-bottom: 6px;
    }

.input {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 12px;
    background: #fff;
    outline: none;
}

    .input:focus {
        border-color: var(--blue);
        box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.12);
    }

/* =========================
   Buttons
   ========================= */

.btn {
    border: 0;
    border-radius: 12px;
    min-height: 46px;
    padding: 10px 15px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.btn-primary {
    background: var(--blue);
    color: #fff;
}

.btn-yellow {
    background: var(--yellow);
    color: #17202a;
}

.btn-light {
    background: #edf2f7;
    color: #2d3748;
}

.btn-block {
    width: 100%;
}

.btn-big {
    min-height: 56px;
    font-size: 17px;
    border-radius: 15px;
}

/* =========================
   Scanner
   ========================= */

.scan-box {
    background: #fff;
    border: 2px dashed #a8c6df;
    border-radius: 19px;
    padding: 15px;
    text-align: center;
}

.scan-video {
    width: 100%;
    max-height: 300px;
    background: #111;
    border-radius: 15px;
    display: none;
    object-fit: cover;
}

.scan-status {
    color: var(--muted);
    font-size: 13px;
    margin: 8px 0;
}

.sticky-scan {
    position: sticky;
    top: 74px;
    z-index: 20;
    margin-bottom: 13px;
}

/* =========================
   Cart
   ========================= */

.cart-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
}

    .cart-item:last-child {
        border-bottom: 0;
    }

.cart-main {
    flex: 1;
    min-width: 0;
}

.cart-name {
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-code {
    font-size: 11px;
    color: var(--muted);
    margin-top: 3px;
}

.cart-price {
    font-weight: 800;
    margin-top: 4px;
}

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

    .qty a {
        width: 36px;
        height: 36px;
        min-height: 36px;
        padding: 0;
        border-radius: 10px;
    }

/* =========================
   Total Bar
   ========================= */

.total-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    background: #fff;
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.08);
}

.total-inner {
    max-width: 900px;
    margin: auto;
    padding: 9px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.total-amount {
    flex: 1;
}

    .total-amount small {
        display: block;
        color: var(--muted);
        font-size: 11px;
    }

    .total-amount strong {
        font-size: 22px;
    }

/* =========================
   Statistics
   ========================= */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
}

.stat {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 14px 6px;
    text-align: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 900;
    color: var(--dark);
}

.stat-label {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

/* =========================
   Table
   ========================= */

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

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    .table th,
    .table td {
        padding: 10px 8px;
        border-bottom: 1px solid var(--border);
        text-align: left;
        white-space: nowrap;
    }

    .table th {
        color: #4a5568;
        font-size: 12px;
        background: #f8fafc;
    }

/* =========================
   Alert
   ========================= */

.alert {
    display: block;
    border-radius: 12px;
    padding: 10px 12px;
    margin: 10px 0;
    font-size: 13px;
}

.alert-ok {
    background: #e9f7ef;
    color: #276749;
}

.alert-error {
    background: #fff0f0;
    color: #9b2c2c;
}

.muted {
    color: var(--muted);
}

/* =========================
   Payment Buttons
   ========================= */

.payment-buttons {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
}

    .payment-buttons button.payment-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 52px;
        padding: 10px 8px;
        margin: 0;
        border: 2px solid #cbd5e0 !important;
        border-radius: 12px !important;
        background: #ffffff !important;
        color: #2d3748 !important;
        font-family: inherit;
        font-size: 16px;
        font-weight: 800;
        line-height: 1.2;
        cursor: pointer;
        box-shadow: none !important;
        -webkit-appearance: none;
        appearance: none;
        transition: all 0.15s ease;
    }

        .payment-buttons button.payment-btn:hover {
            border-color: #1769aa !important;
        }

        .payment-buttons button.payment-btn:active {
            transform: scale(0.97);
        }

        .payment-buttons button.payment-btn.selected,
        .payment-buttons button.payment-btn.selected:hover,
        .payment-buttons button.payment-btn.selected:focus,
        .payment-buttons button.payment-btn.selected:active {
            background: #1769aa !important;
            border-color: #1769aa !important;
            color: #ffffff !important;
            box-shadow: 0 3px 8px rgba(23, 105, 170, 0.25) !important;
        }


/* =========================
   Actual Received Amount
   ========================= */

.received-amount {
    font-size: 20px;
    font-weight: 700;
}

/* =========================
   Desktop
   ========================= */

@media (min-width: 700px) {

    .menu-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 12px;
    }
}

/* =========================
   Mobile
   ========================= */

@media (max-width: 520px) {

    .page {
        padding: 12px 12px 100px;
    }

    .hero {
        padding: 17px;
    }

    .stat-value {
        font-size: 18px;
    }

    .payment-buttons {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

        .payment-buttons button.payment-btn {
            min-height: 54px;
            font-size: 17px;
        }
}
