:root {
  --primary: #0f172a;
  --accent: #22c55e;
  --accent-dark: #16a34a;
  --danger: #ef4444;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  padding-top: 28px; /* space for online/offline bar */
  padding-bottom: 110px; /* space for taller two-row navigation */
}

/* Header */
.header {
  background: var(--primary);
  color: white;
  padding: 14px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header h1 {
  font-size: 1.25rem;
  font-weight: 700;
}
.header .user {
  font-size: 0.85rem;
  opacity: 0.9;
}

/* ========== BOTTOM NAVIGATION (Two Rows) ========== */
.nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 6px 0 10px;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.nav-row {
  display: flex;
  justify-content: space-around;
  margin-bottom: 2px;
}

.nav button {
  background: none;
  border: none;
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 8px;
  cursor: pointer;
  flex: 1;
  max-width: 90px;
}

.nav button.active {
  color: var(--accent);
  font-weight: 600;
}

.nav svg {
  width: 20px;
  height: 20px;
}

/* Cards & lists */
.container {
  padding: 16px;
  max-width: 640px;
  margin: 0 auto;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid var(--border);
}

.product-item, .customer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.product-item:last-child, .customer-item:last-child {
  border-bottom: none;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.badge.low {
  background: #fef2f2;
  color: var(--danger);
}
.badge.ok {
  background: #f0fdf4;
  color: var(--accent-dark);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: white;
  width: 100%;
}
.btn-primary:active {
  background: var(--accent-dark);
}
.btn-outline {
  background: white;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-danger {
  background: var(--danger);
  color: white;
}

/* Forms */
input, select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  margin-bottom: 12px;
  background: white;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Login */
.login-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  background: var(--primary);
  color: white;
}
.login-screen h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}
.login-screen p {
  opacity: 0.8;
  margin-bottom: 32px;
}
.login-screen input {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
}
.login-screen input::placeholder {
  color: rgba(255,255,255,0.6);
}

/* Cart */
.cart-bar {
  position: fixed;
  bottom: 115px; /* offset to sit directly above the updated nav */
  left: 16px;
  right: 16px;
  background: var(--primary);
  color: white;
  padding: 14px 18px;
  border-radius: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  z-index: 90;
}
.cart-bar .total {
  font-size: 1.15rem;
  font-weight: 700;
}

/* Utility */
.hidden { display: none !important; }
.text-muted { color: var(--muted); }
.text-right { text-align: right; }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }
.flex { display: flex; gap: 8px; }
.flex-1 { flex: 1; }

/* Better loading & empty states */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

/* Smooth transitions */
.card, .btn, .product-item, .customer-item {
  transition: all 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}


/* ===== Public login brand ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 28px 18px 40px;
  background: linear-gradient(165deg, #0b1f3a 0%, #132a4a 45%, #0f172a 100%);
  color: #e2e8f0;
}
.brand-hero {
  text-align: center;
  margin-bottom: 18px;
}
.brand-logo {
  height: 88px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  margin-bottom: 8px;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.35));
}
.brand-tagline {
  font-size: 0.9rem;
  opacity: 0.85;
  margin: 0;
  color: #cbd5e1;
}
.login-screen .auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  justify-content: center;
}
.login-screen form {
  width: 100%;
  max-width: 400px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 18px 16px;
  backdrop-filter: blur(8px);
}
.login-screen input {
  background: rgba(15, 23, 42, 0.55);
  border: 1.5px solid rgba(255,255,255,0.15);
  color: #f8fafc;
}
.login-screen input::placeholder { color: #94a3b8; }
.login-screen h1 { display: none; }

/* ===== Bottom nav + More ===== */
.nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #0f172a;
  border-top: 1px solid rgba(255,255,255,0.08);
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-primary {
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  padding: 6px 4px 8px;
}
.nav-primary button {
  flex: 1;
  max-width: 76px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.68rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px;
  cursor: pointer;
}
.nav-primary button svg { width: 22px; height: 22px; }
.nav-primary button.active,
.nav-primary button[aria-expanded="true"] {
  color: #f0b429;
}
.nav-more-panel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 10px 12px 14px;
  background: #132033;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.nav-more-panel.hidden { display: none !important; }
.nav-more-panel button {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #e2e8f0;
  border-radius: 10px;
  padding: 10px 6px;
  font-size: 0.75rem;
  cursor: pointer;
}
.nav-more-panel button.active {
  background: rgba(240, 180, 41, 0.2);
  border-color: #f0b429;
  color: #f0b429;
}
#app-screen { padding-bottom: 72px; }
