:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 12px rgba(0,0,0,0.08);
  --radius: 8px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }
.hidden { display: none !important; }
.error { color: var(--danger); font-size: 0.9rem; margin-top: 0.5rem; }

/* LOGIN */
#login-screen { height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); }
.login-card { background: var(--card); padding: 2rem; border-radius: var(--radius); width: 320px; box-shadow: var(--shadow); text-align: center; }
.login-card h1 { margin-bottom: 0.25rem; }
.login-card input, .login-card button { width: 100%; margin: 0.5rem 0; padding: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); }
.login-card button { background: var(--primary); color: white; cursor: pointer; font-weight: 600; }

/* TOP BAR */
.top-bar { background: var(--card); padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
.brand { font-size: 1.25rem; font-weight: 700; color: var(--primary); }
.user-info { display: flex; gap: 1rem; align-items: center; }
.badge { padding: 0.25rem 0.5rem; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.badge.offline { background: #fee2e2; color: var(--danger); }
.badge.online { background: #dcfce7; color: var(--success); }
#logout-btn { background: var(--border); color: var(--text); padding: 0.4rem 0.8rem; border-radius: var(--radius); cursor: pointer; border: none; }

/* TABS */
.tab-nav { background: var(--card); padding: 0 2rem; display: flex; gap: 0.5rem; border-bottom: 1px solid var(--border); }
.tab-btn { padding: 1rem 1.5rem; background: none; border: none; cursor: pointer; font-weight: 500; color: var(--text-light); border-bottom: 3px solid transparent; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn.hidden { display: none; }

/* SCREENS */
.screen { padding: 1.5rem; }
.pos-layout { display: grid; grid-template-columns: 1fr 1.5fr; gap: 1.5rem; }
.panel { background: var(--card); padding: 1.25rem; border-radius: var(--radius); box-shadow: var(--shadow); }
h3 { margin-bottom: 0.75rem; font-size: 1.1rem; }
.form-row { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
input, select { padding: 0.5rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.9rem; }
button { cursor: pointer; }
.btn-sm { padding: 0.4rem 0.6rem; font-size: 0.85rem; background: var(--border); border: none; border-radius: var(--radius); }
.btn-primary { background: var(--primary); color: white; border: none; padding: 0.6rem 1rem; border-radius: var(--radius); font-weight: 500; }
.btn-success { background: var(--success); color: white; border: none; padding: 0.6rem 1rem; border-radius: var(--radius); font-weight: 500; }
.btn-danger { background: var(--danger); color: white; }
.info-box { background: #f8fafc; padding: 0.75rem; border-radius: var(--radius); margin: 0.5rem 0; font-size: 0.9rem; }

/* CART */
.cart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.cart-table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.cart-table th, .cart-table td { padding: 0.6rem; text-align: left; border-bottom: 1px solid var(--border); }
.totals { margin-top: 1rem; padding-top: 0.5rem; }
.row { display: flex; justify-content: space-between; margin: 0.25rem 0; font-size: 0.95rem; }
.grand { font-weight: 700; font-size: 1.1rem; color: var(--primary); }
.checkout-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0.5rem; margin-top: 1rem; align-items: center; }
.change-box { font-weight: 600; color: var(--success); }

/* INVENTORY & ADMIN */
.inv-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.inv-panel { background: var(--card); padding: 1.25rem; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.5rem; }
.data-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
.data-table th { background: #f1f5f9; padding: 0.5rem; text-align: left; font-weight: 600; }
.data-table td { padding: 0.5rem; border-bottom: 1px solid var(--border); }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.card { background: var(--card); padding: 1.5rem; border-radius: var(--radius); box-shadow: var(--shadow); }

/* MODAL */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(2px); }
.modal-content { background: var(--card); padding: 1.5rem; border-radius: var(--radius); width: 360px; box-shadow: var(--shadow); }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }
.results-list { list-style: none; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); max-height: 200px; overflow-y: auto; position: absolute; width: calc(100% - 0.5rem); z-index: 10; }
.results-list li { padding: 0.6rem; cursor: pointer; border-bottom: 1px solid var(--border); }
.results-list li:hover { background: #f8fafc; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .pos-layout { grid-template-columns: 1fr; }
  .top-bar { flex-direction: column; gap: 0.5rem; }
  .checkout-row { grid-template-columns: 1fr; }
}