/* POS styles */
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, sans-serif; background: #f4f6f8; color: #1f2a37; }
a { text-decoration: none; color: inherit; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 230px; background: #111827; color: #fff; padding: 16px; }
.brand { margin-bottom: 16px; }
.brand-title { font-size: 18px; font-weight: bold; }
.brand-sub { font-size: 12px; color: #9ca3af; }
.menu a { display: block; padding: 10px 12px; border-radius: 8px; color: #e5e7eb; margin-bottom: 6px; }
.menu a:hover { background: #1f2937; }

.main { flex: 1; display: flex; flex-direction: column; }
.topbar { background: #fff; padding: 12px 16px; border-bottom: 1px solid #e5e7eb; display: flex; justify-content: space-between; align-items: center; }
.content { padding: 16px; }

.card { background: #fff; padding: 16px; border-radius: 12px; box-shadow: 0 2px 4px rgba(0,0,0,0.06); margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.stat .label { color: #6b7280; font-size: 12px; }
.stat .value { font-size: 18px; font-weight: bold; }

.form-grid { display: grid; gap: 8px; grid-template-columns: repeat(2, 1fr); }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; padding: 8px; }
.form-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.form-inline input, .form-inline select { padding: 6px; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 8px; border-bottom: 1px solid #e5e7eb; text-align: left; }
.actions { display: flex; gap: 6px; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.muted { color: #6b7280; }

.btn { padding: 10px 16px; border: 1px solid #d1d5db; border-radius: 10px; background: #fff; cursor: pointer; font-size: 14px; }
.btn.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn.danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn.full { width: 100%; }

.badge { background: #e5e7eb; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.alert { padding: 10px; margin-bottom: 12px; border-radius: 8px; }
.alert.success { background: #ecfdf3; color: #065f46; }
.alert.error { background: #fef2f2; color: #991b1b; }

.toast { position: fixed; bottom: 20px; right: 20px; background: #111827; color: #fff; padding: 10px 12px; border-radius: 8px; opacity: 0; transition: opacity .2s; }
.toast.show { opacity: 1; }

/* POS full-screen */
.pos-mode .sidebar { display: none; }
.pos-mode .topbar { display: none; }
.pos-mode .content { padding: 0; }
.pos-mode .main { background: #0f0f1a; }
.pos-mode .app-shell { background: #0f0f1a; }

/* Login */
.login-body { display: flex; justify-content: center; align-items: center; height: 100vh; background: #111827; }
.login-card { background: #fff; padding: 24px; width: 320px; border-radius: 12px; }
.login-card input { width: 100%; margin-bottom: 10px; padding: 8px; }
.login-hint { color: #6b7280; font-size: 12px; margin-top: 8px; }

/* POS */
.pos-shell { background: linear-gradient(135deg, #d81b60, #3a2a7a); border-radius: 18px; padding: 12px; color: #111827; margin: 12px; min-height: calc(100vh - 24px); }
.pos-header { display: flex; align-items: center; justify-content: space-between; color: #fff; padding: 8px 12px 12px; }
.pos-brand { font-weight: 700; letter-spacing: 0.6px; }
.pos-breadcrumb { opacity: 0.9; font-size: 13px; }
.pos-header-right { display: flex; gap: 12px; align-items: center; font-size: 12px; }
.pos-status { background: rgba(255,255,255,0.2); padding: 4px 10px; border-radius: 999px; }
.pos-user { background: #fff; color: #111827; padding: 4px 10px; border-radius: 999px; }

.pos-body { display: grid; grid-template-columns: 64px 380px 1fr 180px; gap: 12px; }
.pos-actionbar { background: #6a1b5d; border-radius: 16px; padding: 8px; display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.action-btn { background: rgba(255,255,255,0.2); color: #fff; border: none; padding: 10px 6px; border-radius: 12px; font-size: 11px; cursor: pointer; }
.action-btn:hover { background: rgba(255,255,255,0.3); }
.action-link { display: block; text-align: center; }

.pos-order-panel, .pos-products-panel, .pos-category-panel { background: #f9f9fd; border-radius: 16px; padding: 12px; height: calc(100vh - 120px); }
.pos-order-panel { display: flex; flex-direction: column; }
.pos-order-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.pos-order-header input { padding: 6px 8px; border-radius: 10px; border: 1px solid #e5e7eb; }
.selected-table { font-size: 18px; font-weight: 700; }
.pos-table-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.tables-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.table-chip { padding: 12px 12px; border: 1px solid #e5e7eb; border-radius: 14px; background: #fff; cursor: pointer; text-align: left; min-width: 140px; min-height: 80px; }
.table-chip.active { border-color: #e11d48; box-shadow: 0 0 0 2px rgba(225, 29, 72, 0.15); }
.table-chip .status { margin-top: 6px; display: inline-block; }
.table-chip[data-status="open"] { background: #dcfce7; border-color: #86efac; }
.table-chip[data-status="empty"] { background: #fee2e2; border-color: #fca5a5; }
.table-chip .status[data-status="open"] { background: #bbf7d0; color: #166534; }
.table-chip .status[data-status="empty"] { background: #fecaca; color: #b91c1c; }

.pos-cart { margin-top: 12px; background: #fff; border-radius: 14px; padding: 10px; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.pos-cart-title { font-weight: 700; margin-bottom: 6px; }
.cart-list { min-height: 140px; overflow: auto; flex: 1; max-height: 320px; }
.cart-item { display: grid; grid-template-columns: 1.6fr 0.8fr 0.8fr 0.2fr; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid #e5e7eb; font-size: 12px; }
.qty-controls { display: flex; gap: 6px; align-items: center; }
.cart-summary { margin-top: auto; font-weight: 600; }
.total-line { font-size: 16px; }
.cart-actions { display: flex; gap: 10px; margin-top: 12px; }
.cart-actions .btn { font-size: 16px; padding: 14px 18px; }

/* 18.5" class screens (1366x768) */
@media (max-width: 1366px) {
    .pos-shell { margin: 8px; min-height: calc(100vh - 16px); }
    .pos-body { grid-template-columns: 56px 340px 1fr 170px; gap: 10px; }
    .pos-order-panel, .pos-products-panel, .pos-category-panel { height: calc(100vh - 104px); padding: 10px; }
    .products-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
    .product-card img { height: 95px; }
    .cart-list { max-height: 260px; }
    .cart-actions .btn { font-size: 15px; padding: 12px 16px; }
    .action-btn { font-size: 10px; padding: 8px 6px; }
    .table-chip { min-width: 130px; min-height: 70px; }
}

.pos-section-title { font-weight: 700; margin-bottom: 8px; }
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; height: calc(100% - 48px); overflow-y: auto; align-content: start; }
.product-card { border: none; border-radius: 14px; background: #fff; padding: 8px; cursor: pointer; text-align: center; box-shadow: 0 4px 10px rgba(0,0,0,0.06); }
.product-card img { width: 100%; height: 110px; object-fit: cover; border-radius: 10px; }
.product-name { font-weight: 600; margin-top: 6px; font-size: 13px; }
.product-price { color: #e11d48; font-weight: 700; }
.pos-products-header { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 10px; }
.pos-products-header input { padding: 6px 8px; border-radius: 10px; border: 1px solid #e5e7eb; }

.pos-category-panel { background: #2a1b4d; color: #fff; }
.pos-side-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.side-tab { flex: 1; border: none; border-radius: 999px; padding: 8px 10px; background: rgba(255,255,255,0.15); color: #fff; cursor: pointer; font-weight: 600; }
.side-tab.active { background: #fff; color: #2a1b4d; }
.pos-category-panel .pos-section-title { color: #fff; }
.category-list { display: flex; flex-direction: column; gap: 8px; }
.category-btn { border: none; border-radius: 999px; padding: 10px 12px; background: rgba(255,255,255,0.12); color: #fff; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.category-btn img { width: 24px; height: 24px; border-radius: 6px; object-fit: cover; }
.category-btn:hover { background: rgba(255,255,255,0.2); }
.favorite-btn { background: rgba(255,255,255,0.12); color: #fff; font-weight: 600; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: none; align-items: center; justify-content: center; }
.modal.show { display: flex; }
.modal-content { background: #fff; padding: 18px; width: 460px; border-radius: 18px; box-shadow: 0 24px 70px rgba(0,0,0,0.28); }
.modal-content input, .modal-content select, .modal-content textarea { width: 100%; padding: 8px; margin-bottom: 8px; }
.pay-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.pay-title { font-size: 18px; font-weight: 700; }
.pay-sub { color: #6b7280; font-size: 12px; margin-top: 4px; }
.pay-remaining { font-size: 20px; font-weight: 800; color: #111827; }
.pay-total { background: #f3f4f6; padding: 10px 12px; border-radius: 12px; text-align: right; }
.pay-total-label { font-size: 11px; color: #6b7280; }
.pay-total-amount { font-size: 18px; font-weight: 800; }

.pay-section { margin: 10px 0; }
.section-title { font-weight: 700; margin-bottom: 8px; }
.payment-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pay-pill { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 8px; border-radius: 12px; border: 1px solid #e5e7eb; background: #f9fafb; cursor: pointer; font-weight: 600; }
.pay-pill input { display: none; }
.pay-pill span { font-size: 13px; }
.pay-pill:has(input:checked) { background: #2563eb; color: #fff; border-color: #2563eb; }

.pay-input { display: grid; gap: 6px; }
.pay-input input { border-radius: 10px; border: 1px solid #e5e7eb; padding: 10px; font-size: 14px; }

.payment-inputs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.split-controls { margin: 10px 0; }
.split-controls .btn { width: 100%; }
.split-list { font-size: 12px; color: #4b5563; display: grid; gap: 4px; }
.payment-remaining { font-weight: 700; margin-bottom: 6px; }
.payment-total { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.payment-change { background: #f3f4f6; padding: 8px 10px; border-radius: 10px; font-weight: 600; }
.modal-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.modal-actions .btn { font-size: 14px; padding: 12px 10px; }

@media (max-width: 1366px) {
    .modal-content { width: 440px; }
}

.summary-block { display: grid; gap: 4px; font-weight: 600; }

.refund-row { display: grid; grid-template-columns: 1fr 80px; gap: 8px; align-items: center; margin-bottom: 8px; }

/* Print */
.print-body { background: #fff; }
.print-receipt { width: 300px; margin: 0 auto; font-size: 12px; }
.print-receipt table { width: 100%; border-collapse: collapse; }
.print-receipt th, .print-receipt td { text-align: left; padding: 4px 0; }
.print-footer { text-align: center; margin-top: 10px; }
