* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; margin: 0; background: #f5f6f8; color: #333; }
button, select { font-family: inherit; }
.wrap { max-width: 720px; margin: 0 auto; }
.app-header { background: #fff; padding: 15px; text-align: center; font-size: 18px; font-weight: bold; color: #0077cc; box-shadow: 0 1px 3px rgba(0,0,0,.05); position: sticky; top: 0; z-index: 100; }
.view-container { padding: 12px; padding-bottom: 90px; display: none; max-width: 720px; margin: 0 auto; }
.view-container.active { display: block; }
.card { background: #fff; padding: 16px; border-radius: 12px; box-shadow: 0 2px 6px rgba(0,0,0,.04); margin-bottom: 12px; }
input.form-control, textarea.form-control { width: 100%; padding: 12px; margin: 8px 0; border: 1px solid #ddd; border-radius: 8px; font-size: 16px; background: #fff; font-family: inherit; }
input.form-control:read-only { background: #f0f0f0; color: #777; border-color: #eee; }

button.btn-primary { width: 100%; background: #0077cc; color: #fff; border: none; padding: 12px; border-radius: 8px; font-weight: bold; font-size: 15px; cursor: pointer; }
button.btn-primary:hover { background: #005fa3; }
button.btn-primary:disabled { opacity: .6; cursor: default; }
button.btn-secondary { width: 100%; background: #555; color: #fff; border: none; padding: 12px; border-radius: 8px; font-weight: bold; font-size: 15px; margin-top: 8px; cursor: pointer; }
button.btn-outline { width: 100%; background: transparent; color: #0077cc; border: 2px solid #0077cc; padding: 10px; border-radius: 8px; font-weight: bold; font-size: 15px; margin-top: 8px; cursor: pointer; }
button.btn-danger-outline { width: 100%; background: transparent; color: #dc3545; border: 2px solid #dc3545; padding: 10px; border-radius: 8px; font-weight: bold; font-size: 15px; margin-top: 8px; cursor: pointer; }
a.btn-link { display: block; text-align: center; text-decoration: none; background: #0077cc; color: #fff; padding: 12px; border-radius: 8px; font-weight: bold; font-size: 15px; margin: 8px 0; }
button.btn-sm { border: none; border-radius: 6px; padding: 8px 12px; font-weight: bold; font-size: 13px; cursor: pointer; color: #fff; background: #0077cc; }
button.btn-sm.red { background: #dc3545; }

.filter-bar { margin-bottom: 10px; }
.filter-bar input.form-control { margin: 0 0 8px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.chip { flex: 0 0 auto; border: 1px solid #ccd; background: #fff; color: #444; border-radius: 16px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.chip.active { background: #0077cc; border-color: #0077cc; color: #fff; font-weight: 600; }

.product-row { display: flex; align-items: center; padding: 12px; border-radius: 10px; background: #fff; margin-bottom: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.05); gap: 12px; }
.product-img { width: 75px; height: 75px; min-width: 75px; object-fit: cover; border-radius: 8px; border: 1px solid #eaeaea; background: #fafafa; cursor: pointer; }
.product-info { flex: 1; min-width: 0; }
.product-title { font-size: 15px; font-weight: 600; margin: 0 0 4px; color: #222; }
.product-meta { font-size: 12px; color: #666; margin-bottom: 8px; }
.action-row { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.qty-control { display: flex; align-items: center; border: 1px solid #0077cc; border-radius: 6px; overflow: hidden; height: 34px; background: #fff; }
.qty-control button { width: 32px; height: 100%; background: #0077cc; color: #fff; border: none; font-size: 18px; font-weight: bold; cursor: pointer; }
.qty-control button:disabled { background: #9cc7e6; cursor: default; }
.qty-val { min-width: 32px; text-align: center; font-size: 14px; font-weight: bold; color: #0077cc; }
.add-btn { flex: 1; background: #0077cc; color: #fff; border: none; height: 34px; border-radius: 6px; font-weight: 600; font-size: 13px; cursor: pointer; }
.add-btn:disabled { background: #bbb; cursor: default; }
.add-btn.in-cart { background: #e8f6ec; color: #1c7c38; border: 1px solid #28a745; }

.cart-line { border-bottom: 1px solid #eee; padding: 12px 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cart-line .qty-control { height: 30px; margin-top: 6px; display: inline-flex; }
.cart-line .qty-control button { width: 28px; font-size: 16px; }
.remove-link { color: #dc3545; font-size: 12px; font-weight: bold; cursor: pointer; background: none; border: none; padding: 4px 0 0; }
.pay-opt { display: flex; gap: 10px; align-items: flex-start; border: 2px solid #e3e6ea; border-radius: 10px; padding: 12px; margin-top: 8px; cursor: pointer; }
.pay-opt input { margin-top: 3px; }
.pay-opt small { display: block; color: #777; margin-top: 2px; font-size: 12px; }
.pay-opt.selected { border-color: #0077cc; background: #f2f8fd; }
.deliver-box { background: #f9f9f9; border-radius: 8px; padding: 10px 12px; font-size: 13px; color: #555; margin-top: 10px; line-height: 1.5; }

.bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; background: #fff; border-top: 1px solid #ddd; display: flex; justify-content: space-around; padding: 8px 0; padding-bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 1000; }
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; color: #888; font-size: 11px; cursor: pointer; flex: 1; position: relative; }
.nav-item.active { color: #0077cc; font-weight: bold; }
.nav-icon { font-size: 21px; margin-bottom: 2px; }
.cart-badge { position: absolute; top: -4px; right: calc(50% - 20px); background: #dc3545; color: #fff; font-size: 10px; font-weight: bold; padding: 2px 6px; border-radius: 10px; display: none; transition: transform .2s; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: none; justify-content: center; align-items: center; z-index: 99999; padding: 15px; }
.modal-content { background: #fff; padding: 20px; border-radius: 12px; width: 100%; max-width: 420px; text-align: center; position: relative; max-height: 90vh; overflow-y: auto; }
.modal-content img { width: 100%; height: auto; max-height: 350px; object-fit: contain; border-radius: 8px; margin-bottom: 15px; }
.close-btn { position: absolute; top: 10px; right: 15px; font-size: 28px; font-weight: bold; cursor: pointer; color: #888; }

.status-badge { padding: 4px 8px; border-radius: 12px; font-size: 11px; font-weight: bold; white-space: nowrap; }
.bg-pending { background: #ffeeba; color: #856404; }
.bg-confirmed { background: #d6e9ff; color: #0b4f9c; }
.bg-completed { background: #d4edda; color: #155724; }
.bg-cancelled { background: #f8d7da; color: #721c24; }
.tag { font-size: 11px; background: #eef0f3; color: #555; padding: 2px 8px; border-radius: 10px; margin-left: 6px; }
.empty-state { text-align: center; padding: 40px 20px; color: #777; font-size: 14px; }
.auth-toggle { color: #0077cc; cursor: pointer; text-align: center; display: block; margin-top: 15px; font-size: 14px; font-weight: bold; }
.history-card { cursor: pointer; border: 1px solid transparent; }
.history-card:hover { border-color: #0077cc; }

.note { background: #f4f7fa; border-radius: 8px; padding: 12px; margin: 12px 0; font-size: 14px; line-height: 1.5; text-align: left; color: #444; }
.note-green { background: #e8f6ec; color: #1c5d30; }
.note-red { background: #fdecee; color: #8a1c28; }
.qr-box { text-align: center; margin: 10px 0; }
.qr-frame { display: inline-block; background: #fff; padding: 10px; border-radius: 10px; border: 1px solid #dde; }
.qr-frame img, .qr-frame canvas { display: block; }
.upi-id-row { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; margin-top: 8px; flex-wrap: wrap; }
.upi-id-row button { border: 1px solid #0077cc; background: #fff; color: #0077cc; border-radius: 6px; padding: 4px 10px; font-size: 12px; font-weight: bold; cursor: pointer; }

.pay-pill { font-size: 11px; font-weight: bold; padding: 3px 8px; border-radius: 10px; }
.pill-paid { background: #d4edda; color: #155724; }
.pill-unpaid { background: #ffeeba; color: #856404; }
.pill-refunded { background: #f8d7da; color: #721c24; }
.pill-cod { background: #eef0f3; color: #555; }
.status-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin: 10px 0; }
.status-grid > div { background: #f4f7fa; border-radius: 8px; padding: 8px 4px; text-align: center; font-size: 11px; color: #666; }
.status-grid b { display: block; font-size: 12px; color: #222; margin-top: 3px; }
.track { display: flex; justify-content: space-between; margin: 14px 0 6px; }
.track .step { flex: 1; text-align: center; font-size: 10px; color: #999; position: relative; }
.track .dot { width: 14px; height: 14px; border-radius: 50%; background: #ddd; margin: 0 auto 4px; position: relative; z-index: 1; }
.track .step.done { color: #1c7c38; font-weight: 600; }
.track .step.done .dot { background: #28a745; }
.track .step:not(:first-child)::before { content: ''; position: absolute; top: 6px; left: -50%; width: 100%; height: 2px; background: #ddd; }
.track .step.done:not(:first-child)::before { background: #28a745; }

/* admin */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.tile { background: #fff; border-radius: 12px; padding: 12px; box-shadow: 0 2px 6px rgba(0,0,0,.04); }
.tile b { display: block; font-size: 22px; color: #0077cc; }
.tile span { font-size: 12px; color: #666; }
.adm-line { display: flex; justify-content: space-between; font-size: 13px; padding: 2px 0; }
.low-row { display: flex; justify-content: space-between; font-size: 14px; padding: 6px 0; border-bottom: 1px dashed #eee; }
.adm-selects { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 10px; }
.adm-selects label { font-size: 10px; color: #777; display: block; margin-bottom: 2px; }
.adm-selects select { width: 100%; padding: 6px 2px; border: 1px solid #ccd; border-radius: 6px; font-size: 12px; background: #fff; }
.row-btns { display: flex; gap: 8px; margin-top: 8px; }
.row-btns > * { flex: 1; }
.adm-top { display: flex; justify-content: space-between; align-items: center; padding: 0 12px; }
.adm-top button { background: none; border: none; color: #dc3545; font-weight: bold; cursor: pointer; font-size: 13px; }
.top-tabs { display: flex; max-width: 720px; margin: 0 auto; background: #fff; border-bottom: 1px solid #ddd; }
.top-tabs button { flex: 1; padding: 12px; border: none; background: none; font-weight: 600; color: #888; cursor: pointer; border-bottom: 3px solid transparent; }
.top-tabs button.active { color: #0077cc; border-bottom-color: #0077cc; }
@media (min-width: 720px) { .bottom-nav { max-width: 720px; left: 50%; transform: translateX(-50%); } }

#toast { position: fixed; left: 50%; bottom: calc(85px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: #222; color: #fff; padding: 10px 16px; border-radius: 20px; font-size: 13px; opacity: 0; pointer-events: none; transition: .25s; z-index: 100000; max-width: 90%; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
