* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Arial, sans-serif; }
body { background: #f4f1ea; color: #3a2c20; }

/* ---------- Login ---------- */
.login-page { display: flex; align-items: center; justify-content: center; height: 100vh; background: #6b4226; }
.login-box { background: #fff; padding: 40px; border-radius: 12px; width: 340px; box-shadow: 0 10px 30px rgba(0,0,0,.3); text-align: center; }
.login-box h2 { margin-bottom: 20px; color: #6b4226; }
.login-box label { display: block; text-align: left; margin: 10px 0 4px; font-size: 14px; }
.login-box input { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 6px; }
.login-box button { width: 100%; margin-top: 20px; padding: 10px; background: #6b4226; color: #fff; border: none; border-radius: 6px; font-size: 16px; cursor: pointer; }
.login-box button:hover { background: #543119; }
.error-msg { background: #ffe1e1; color: #b00020; padding: 8px; border-radius: 6px; margin-bottom: 10px; font-size: 13px; }
.hint { margin-top: 14px; font-size: 12px; color: #888; }

/* ---------- Layout ---------- */
.navbar { background: #6b4226; color: #fff; padding: 14px 24px; display: flex; justify-content: space-between; align-items: center; }
.navbar a { color: #fff; text-decoration: none; margin-left: 16px; font-size: 14px; }
.navbar a:hover { text-decoration: underline; }
.container { padding: 24px; max-width: 1300px; margin: 0 auto; }

.card { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,.08); margin-bottom: 20px; }
.btn { display: inline-block; padding: 8px 16px; border-radius: 6px; border: none; cursor: pointer; font-size: 14px; text-decoration: none; color: #fff; }
.btn-primary { background: #6b4226; }
.btn-success { background: #2e7d32; }
.btn-danger { background: #c62828; }
.btn-secondary { background: #888; }
.btn:hover { opacity: .88; }

table { width: 100%; border-collapse: collapse; margin-top: 10px; }
table th, table td { padding: 10px; border-bottom: 1px solid #eee; text-align: left; font-size: 14px; }
table th { background: #f0e7da; }

input, select, textarea { padding: 8px; border: 1px solid #ccc; border-radius: 6px; width: 100%; font-size: 14px; }
.form-group { margin-bottom: 14px; }
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }

.badge { padding: 3px 8px; border-radius: 12px; font-size: 12px; color: #fff; }
.badge-admin { background: #6b4226; }
.badge-cashier { background: #2e7d32; }
.badge-accountant { background: #1565c0; }

/* ---------- POS Screen ---------- */
.pos-wrapper { display: flex; gap: 20px; }
.pos-items { flex: 2; }
.pos-cart { flex: 1; background: #fff; border-radius: 10px; padding: 16px; height: fit-content; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.pos-cart input, .pos-cart select, .pos-cart label { font-size: 18px; }
.pos-cart .btn { font-size: 18px; padding: 10px 18px; }
.category-tabs { margin-bottom: 14px; }
.category-tabs button { background: #eee; border: none; padding: 8px 16px; border-radius: 20px; margin-right: 8px; cursor: pointer; }
.category-tabs button.active { background: #6b4226; color: #fff; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.item-card { background: #fff; border-radius: 10px; padding: 14px; text-align: center; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.item-card .stock { font-size: 11px; color: #999; margin-bottom: 8px; }
.size-buttons { display: flex; gap: 8px; }
.size-btn { flex: 1; background: #f0e7da; border: 1px solid #d8c9b3; border-radius: 8px; padding: 8px 4px; font-size: 13px; cursor: pointer; line-height: 1.4; }
.size-btn:hover { background: #6b4226; color: #fff; }
.size-btn.large { background: #6b4226; color: #fff; }
.size-btn.large:hover { background: #4a2d18; }

.payment-mode-tabs { display: flex; gap: 8px; margin-top: 6px; }
.pay-mode-btn { flex: 1; padding: 12px; border: 2px solid #ddd; border-radius: 8px; background: #fafafa; font-size: 16px; cursor: pointer; }
.pay-mode-btn.active { border-color: #6b4226; background: #6b4226; color: #fff; }

.cart-line { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #f0e7da; font-size: 18px; }
.cart-line button { background: #c62828; color: #fff; border: none; border-radius: 6px; width: 32px; height: 32px; font-size: 20px; line-height: 1; cursor: pointer; }
.totals-row { display: flex; justify-content: space-between; margin: 8px 0; font-size: 18px; }
.totals-row.grand { font-size: 24px; font-weight: bold; color: #6b4226; border-top: 2px solid #6b4226; padding-top: 10px; margin-top: 10px; }

/* ---------- Header clock ---------- */
.header-clock { font-size: 13px; opacity: .9; white-space: nowrap; margin-right: 4px; }

/* ---------- Shop badges ---------- */
.badge-shop { background: #8d6e63; }
.shop-pill { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; background: #f0e7da; color: #6b4226; }

/* =====================================================================
   Mobile / tablet responsiveness
   ===================================================================== */

/* Tablets (and small laptops) */
@media (max-width: 1024px) {
    .pos-wrapper { flex-direction: column; }
    .pos-cart { order: -1; }
    .item-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* Phones */
@media (max-width: 768px) {
    .container { padding: 12px; }

    .navbar { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 14px; }
    .navbar > div:last-child { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; }
    .navbar a { margin-left: 0; padding: 6px 8px; background: rgba(255,255,255,.12); border-radius: 6px; }
    .header-clock { order: -1; }

    .form-row { flex-direction: column; gap: 0; }

    table { display: block; overflow-x: auto; white-space: nowrap; }

    .pos-wrapper { flex-direction: column; gap: 12px; }
    .pos-cart { order: -1; position: static; }
    .item-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
    .item-card { padding: 10px; }
    .size-buttons { flex-direction: column; }
    .size-btn { padding: 12px 4px; font-size: 14px; }

    .category-tabs { display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
    .category-tabs button { flex-shrink: 0; }

    .pos-cart input, .pos-cart select, .pos-cart label { font-size: 16px; }
    .pos-cart .btn { width: 100%; }

    .btn { padding: 10px 16px; font-size: 15px; } /* larger touch targets */
}

@media (max-width: 480px) {
    .login-box { width: 90%; padding: 28px 20px; }
    .item-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
    .totals-row.grand { font-size: 20px; }
}
