* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    background: #f2f4f7;
    color: #222;
}
a { text-decoration: none; color: inherit; }

/* ---- Login ---- */
.login-body {
    display: flex; align-items: center; justify-content: center;
    height: 100vh; background: linear-gradient(135deg,#1f2937,#374151);
}
.login-box {
    background: #fff; padding: 40px; border-radius: 10px;
    width: 320px; box-shadow: 0 10px 30px rgba(0,0,0,.3);
}
.login-box h2 { margin-bottom: 20px; text-align: center; color: #1f2937; }
.login-box label { display: block; margin: 12px 0 4px; font-size: 14px; color: #555; }
.login-box input {
    width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 15px;
}
.hint { text-align: center; margin-top: 14px; font-size: 12px; color: #999; }
.alert { padding: 10px; border-radius: 6px; margin-bottom: 10px; font-size: 14px; }
.alert-error { background: #fde8e8; color: #c0392b; }
.alert-success { background: #e6f9ec; color: #1e8449; }

/* ---- Buttons ---- */
.btn {
    display: inline-block; padding: 9px 16px; border: none; border-radius: 6px;
    cursor: pointer; font-size: 14px; font-weight: 600;
}
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: transparent; border: 1px solid #cbd5e1; color: #334155; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; margin-top: 18px; }

/* ---- Top Navigation ---- */
.topnav {
    display: flex; align-items: center; justify-content: space-between;
    background: #1f2937; color: #fff; padding: 0 20px; height: 56px;
}
.nav-brand { font-weight: 700; font-size: 18px; }
.nav-links { display: flex; gap: 6px; }
.nav-links a {
    padding: 8px 14px; border-radius: 6px; font-size: 14px; color: #cbd5e1;
}
.nav-links a:hover, .nav-links a.active { background: #374151; color: #fff; }
.nav-user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #cbd5e1; }

/* ---- Layout ---- */
.container { padding: 20px; max-width: 1300px; margin: 0 auto; }
.card {
    background: #fff; border-radius: 10px; padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08); margin-bottom: 20px;
}
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 10px; border-bottom: 1px solid #eee; text-align: left; font-size: 14px; }
table th { background: #f8fafc; color: #475569; font-size: 13px; text-transform: uppercase; }
table tr:hover { background: #fafbfc; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 13px; color: #475569; font-weight: 600; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.page-title { display:flex; justify-content: space-between; align-items:center; margin-bottom: 16px; }
.page-title h1 { font-size: 22px; color: #1f2937; }
.badge { padding: 3px 9px; border-radius: 20px; font-size: 12px; }
.badge-green { background: #dcfce7; color: #16a34a; }
.badge-red { background: #fee2e2; color: #dc2626; }

/* ---- POS Screen ---- */
.pos-layout { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; height: calc(100vh - 96px); }
.pos-left, .pos-right { background: #fff; border-radius: 10px; padding: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.08); display: flex; flex-direction: column; }
#barcode-input { font-size: 18px; padding: 12px; border: 2px solid #2563eb; border-radius: 8px; width: 100%; }
.cart-table { flex: 1; overflow-y: auto; margin-top: 12px; }
.cart-table table { font-size: 14px; }
.qty-input { width: 55px; text-align: center; padding: 4px; border: 1px solid #d1d5db; border-radius: 4px; }
.remove-btn { color: #dc2626; cursor: pointer; font-weight: bold; }
.totals-box { border-top: 2px dashed #e5e7eb; padding-top: 12px; margin-top: 10px; }
.totals-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 15px; }
.totals-row.grand { font-size: 22px; font-weight: 800; color: #1f2937; border-top: 1px solid #e5e7eb; margin-top: 6px; padding-top: 10px; }
#pay-btn { width: 100%; padding: 16px; font-size: 18px; margin-top: 12px; }
.product-quick-list { overflow-y: auto; flex: 1; }
.product-quick-item {
    display: flex; justify-content: space-between; padding: 10px; border: 1px solid #eee;
    border-radius: 8px; margin-bottom: 6px; cursor: pointer;
}
.product-quick-item:hover { background: #f0f7ff; border-color: #2563eb; }
#search-product { margin-bottom: 10px; }

/* ---- Receipt / Print ---- */
.receipt-wrapper { display:flex; justify-content:center; padding: 20px; background:#e5e7eb; min-height:100vh;}
.receipt {
    background: #fff; padding: 14px; font-family: 'Courier New', monospace; color:#000;
}
.receipt.w80 { width: 80mm; }
.receipt.w58 { width: 58mm; font-size: 11px; }
.receipt h2 { text-align: center; font-size: 15px; }
.receipt .center { text-align: center; }
.receipt .line { border-top: 1px dashed #000; margin: 6px 0; }
.receipt table { width: 100%; font-size: 12px; border-collapse: collapse; }
.receipt table th, .receipt table td { padding: 3px 2px; border: none; text-align: left; }
.receipt .totals td { padding: 2px; }
.receipt .grand-total { font-size: 16px; font-weight: bold; }
.no-print { text-align:center; margin-top: 14px; }
@media print {
    body * { visibility: hidden; }
    .receipt, .receipt * { visibility: visible; }
    .receipt { position: absolute; left: 0; top: 0; }
    .no-print { display: none; }
    .receipt-wrapper { background: #fff; padding:0; }
}
