/* ═══════════════════════════════════════════════════════════════
   BillZen v3 — AARUNYA Web Solutions
   Complete UI Overhaul — Modern, Clean, Competitive
   Font: Plus Jakarta Sans (Google Fonts)
   Design: Refined Professional — Light surface, deep navy sidebar
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
  /* Brand */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-rgb: 37, 99, 235;
  --primary-light: #3b82f6;
  --primary-bg: #eff6ff;
  --primary-bg2: #dbeafe;

  /* Accent */
  --accent: #f97316;
  --accent-bg: #fff7ed;

  /* Money / Success */
  --money: #059669;
  --money-light: #10b981;
  --money-bg: #ecfdf5;
  --money-border: #a7f3d0;

  /* Semantic */
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --info: #0284c7;
  --info-bg: #f0f9ff;
  --success: #059669;
  --success-bg: #ecfdf5;

  /* Neutrals */
  --text: #0f172a;
  --text2: #475569;
  --text3: #94a3b8;
  --border: #e2e8f0;
  --border2: #cbd5e1;
  --surface: #ffffff;
  --surface2: #f8fafc;
  --surface3: #f1f5f9;
  --bg: #f1f5f9;

  /* Sidebar */
  --sb-bg: #0f172a;
  --sb-bg2: #1e293b;
  --sb-text: #94a3b8;
  --sb-text-active: #f1f5f9;
  --sb-active: var(--primary);
  --sb-hover: var(--sb-bg2);
  --sb-border: rgba(255,255,255,0.07);

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(15,23,42,0.06);
  --shadow-sm: 0 1px 3px rgba(15,23,42,0.08), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md: 0 4px 6px rgba(15,23,42,0.07), 0 2px 4px rgba(15,23,42,0.04);
  --shadow-lg: 0 10px 15px rgba(15,23,42,0.08), 0 4px 6px rgba(15,23,42,0.04);
  --shadow-xl: 0 20px 25px rgba(15,23,42,0.10), 0 8px 10px rgba(15,23,42,0.04);

  /* Radius */
  --r-sm: 6px;
  --r-md: 9px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-full: 9999px;

  /* Transitions */
  --t-fast: all 0.12s ease;
  --t-base: all 0.18s ease;
  --t-slow: all 0.28s ease;
}

/* ── RESET & BASE ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
input, select, button, textarea { font-family: inherit; }
button { cursor: pointer; }
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── LAYOUT ────────────────────────────────────────────────── */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ───────────────────────────────────────────────── */
#sidebar {
  width: 232px;
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  overflow: hidden;
  border-right: none;
}

.sb-logo {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--sb-border);
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}
.sb-logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(var(--primary-rgb),0.4);
}
.sb-logo-text {
  font-weight: 800;
  font-size: 15px;
  color: #f1f5f9;
  line-height: 1.2;
  letter-spacing: -0.3px;
}
.sb-logo-sub { font-size: 10px; color: #475569; margin-top: 1px; font-weight: 500; }

.sb-plan { padding: 10px 14px 6px; }
.plan-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.sb-nav { flex: 1; overflow-y: auto; padding: 4px 10px 10px; }
.sb-nav::-webkit-scrollbar { width: 3px; }

.nav-group-label {
  font-size: 9.5px;
  font-weight: 700;
  color: #334155;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  padding: 12px 10px 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  margin-bottom: 1px;
  font-size: 13px;
  font-weight: 500;
  color: var(--sb-text);
  border: none;
  transition: var(--t-fast);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  position: relative;
}
.nav-item:hover { background: var(--sb-hover); color: #e2e8f0; }
.nav-item.active {
  background: rgba(var(--primary-rgb),0.18);
  color: var(--primary);
  font-weight: 700;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--primary-light);
  border-radius: 0 3px 3px 0;
}
.nav-item.locked { color: #334155; cursor: not-allowed; }
.nav-item.locked:hover { background: transparent; color: #334155; }

.sb-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--sb-border);
  font-size: 10px;
  color: #334155;
  line-height: 2;
}

/* ── MAIN AREA ─────────────────────────────────────────────── */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ── TOPBAR ────────────────────────────────────────────────── */
#topbar {
  height: 54px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 22px;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
  box-shadow: var(--shadow-xs);
}

/* ── CONTENT ───────────────────────────────────────────────── */
#content { flex: 1; overflow-y: auto; padding: 22px 24px; min-height: 0; }
#content.no-pad { padding: 0; overflow: hidden; }

/* ── CARDS ─────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}
.card.p14 { padding: 14px; }
.card.p0 { padding: 0; overflow: hidden; }
.card:hover { box-shadow: var(--shadow-md); }

/* ── STAT CARDS ────────────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  opacity: 0;
  transition: opacity 0.2s;
}
.stat-card:hover::before { opacity: 1; }

.stat-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}
.stat-sub { font-size: 12px; color: var(--text2); }
.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── BUTTONS ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  transition: var(--t-fast);
  white-space: nowrap;
  line-height: 1.3;
  cursor: pointer;
  letter-spacing: -0.1px;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.48; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 1px 3px rgba(var(--primary-rgb),0.25), 0 1px 2px rgba(var(--primary-rgb),0.1);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 10px rgba(var(--primary-rgb),0.35);
}

.btn-secondary {
  background: var(--primary-bg);
  color: var(--primary);
  border-color: var(--primary-bg2);
}
.btn-secondary:hover { background: var(--primary-bg2); }

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface3); color: var(--text); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(220,38,38,0.18);
}
.btn-danger:hover { background: #fee2e2; }

.btn-white {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border2);
  box-shadow: var(--shadow-xs);
}
.btn-white:hover { background: var(--surface2); box-shadow: var(--shadow-sm); }

.btn-whatsapp { background: #25d366; color: #fff; border-color: #22c55e; }
.btn-whatsapp:hover { background: #16a34a; border-color: #16a34a; }

.btn-sm { padding: 5px 12px; font-size: 12px; gap: 5px; }
.btn-lg { padding: 11px 24px; font-size: 14px; }
.btn-full { width: 100%; }

/* ── FORMS ─────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: #374151; }
.field label span.req { color: var(--danger); }
.field-hint { font-size: 11px; color: var(--text3); }
.field-error { font-size: 11px; color: var(--danger); display: flex; align-items: center; gap: 3px; }

input.inp, select.inp, textarea.inp {
  padding: 8px 11px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface2);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  width: 100%;
}
input.inp:hover, select.inp:hover { border-color: var(--border2); background: var(--surface); }
input.inp:focus, select.inp:focus, textarea.inp:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb),0.12);
}
input.inp.error, select.inp.error { border-color: var(--danger); }
input.inp[readonly] { background: var(--surface3); color: var(--text2); cursor: default; }
select.inp { cursor: pointer; }

/* ── TABLES ────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; border-radius: var(--r-lg); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }

table.tbl thead tr {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
table.tbl th {
  padding: 11px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 10.5px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  white-space: nowrap;
}
table.tbl th.r { text-align: right; }
table.tbl td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
  font-weight: 500;
}
table.tbl td.r { text-align: right; }
table.tbl tbody tr { transition: background 0.1s; }
table.tbl tbody tr:hover { background: #f8faff; }
table.tbl tbody tr:last-child td { border-bottom: none; }
.tbl-empty { padding: 52px 14px; text-align: center; color: var(--text3); }

/* ── ALERTS ────────────────────────────────────────────────── */
.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-radius: var(--r-md);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  border: 1px solid;
}
.alert-info    { background: var(--info-bg);    border-color: rgba(2,132,199,0.25);   color: var(--info); }
.alert-success { background: var(--success-bg); border-color: rgba(5,150,105,0.25);   color: var(--success); }
.alert-warning { background: var(--warning-bg); border-color: rgba(217,119,6,0.25);   color: var(--warning); }
.alert-error   { background: var(--danger-bg);  border-color: rgba(220,38,38,0.25);   color: var(--danger); }

/* ── MODAL ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.15s ease;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--r-xl);
  width: 580px;
  max-width: 96vw;
  max-height: 93vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(15,23,42,0.06);
  animation: slideUp 0.2s ease;
}
.modal-box.wide { width: 700px; }
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.modal-head span { font-weight: 700; font-size: 15px; color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }

@keyframes fadeIn  { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(10px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }

/* ── CHIPS / PILLS ─────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.pill-paid    { background: var(--money-bg);    color: var(--money); }
.pill-unpaid  { background: var(--danger-bg);   color: var(--danger); }
.pill-partial { background: var(--warning-bg);  color: var(--warning); }
.pill-draft   { background: var(--surface3);    color: var(--text2); }

/* ── TOGGLE ────────────────────────────────────────────────── */
.toggle {
  width: 38px;
  height: 21px;
  border-radius: var(--r-full);
  position: relative;
  transition: background 0.2s;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle-knob {
  position: absolute;
  top: 2px;
  width: 17px;
  height: 17px;
  border-radius: var(--r-full);
  background: #fff;
  transition: left 0.2s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

/* ── GRID HELPERS ──────────────────────────────────────────── */
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.g3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.g4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 14px; }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.gap14 { gap: 14px; }
.mb14 { margin-bottom: 14px; }
.mb20 { margin-bottom: 20px; }
.flex { display: flex; align-items: center; }
.flex-gap8  { display: flex; align-items: center; gap: 8px; }
.flex-gap10 { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }

/* ── PAGE HEADER ───────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.4px;
}
.page-sub { font-size: 13px; color: var(--text2); margin-top: 3px; font-weight: 500; }

/* ── TABS ──────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 3px;
  background: var(--surface3);
  padding: 4px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  width: fit-content;
  margin-bottom: 20px;
}
.tab-btn {
  padding: 6px 15px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text2);
  transition: var(--t-fast);
  cursor: pointer;
}
.tab-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.tab-btn:not(.active):hover { background: rgba(255,255,255,0.5); color: var(--text); }

/* ── AGRI / COST LAYER ─────────────────────────────────────── */
.agri-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(5,150,105,0.09);
  border: 1px solid rgba(5,150,105,0.3);
  border-radius: var(--r-full);
  padding: 2px 9px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--money);
  letter-spacing: 0.3px;
}
.cost-row {
  display: grid;
  grid-template-columns: 26px 1fr 110px 26px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  margin-bottom: 5px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  transition: border-color 0.12s;
}
.cost-row:hover { border-color: var(--money-border); }
.cost-label { font-size: 12px; font-weight: 600; color: #374151; }
.cost-inp {
  width: 100%;
  padding: 6px 8px 6px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  outline: none;
  font-family: inherit;
  background: var(--surface2);
}
.cost-inp:focus { border-color: var(--money); background: var(--surface); }
.cost-total-bar {
  background: linear-gradient(135deg, var(--money-bg), #d1fae5);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-top: 12px;
  border: 1px solid var(--money-border);
}
.cost-alert {
  background: var(--danger-bg);
  border: 1.5px solid rgba(220,38,38,0.35);
  border-radius: var(--r-md);
  padding: 9px 12px;
  margin: 6px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--danger);
}
.cost-ok {
  background: var(--money-bg);
  border: 1.5px solid var(--money-border);
  border-radius: var(--r-md);
  padding: 9px 12px;
  margin: 6px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--money);
}

/* ── ADJUSTMENTS ───────────────────────────────────────────── */
.adj-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--border);
  flex-wrap: nowrap;
  overflow: hidden;
}
.adj-row:last-child { border-bottom: none; }
.adj-type-btn {
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 800;
  border: 1.5px solid;
  cursor: pointer;
  transition: var(--t-fast);
}
.adj-type-add { background: var(--money-bg); color: var(--money); border-color: var(--money-border); }
.adj-type-add.active { background: var(--money); color: #fff; border-color: var(--money); }
.adj-type-ded { background: var(--danger-bg); color: var(--danger); border-color: rgba(220,38,38,0.3); }
.adj-type-ded.active { background: var(--danger); color: #fff; border-color: var(--danger); }
.adj-label-inp {
  flex: 1;
  padding: 5px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 12px;
  outline: none;
  font-family: inherit;
  background: var(--surface2);
}
.adj-label-inp:focus { border-color: var(--primary); background: var(--surface); }
.adj-amt-inp {
  width: 72px;
  min-width: 60px;
  flex-shrink: 0;
  padding: 5px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  outline: none;
  font-family: inherit;
  background: var(--surface2);
}
.adj-amt-inp:focus { border-color: var(--primary); background: var(--surface); }

.profit-bar { height: 6px; border-radius: var(--r-full); background: var(--border); overflow: hidden; margin-top: 4px; }
.profit-fill { height: 100%; border-radius: var(--r-full); transition: width 0.4s ease; }

/* ── BILLING LAYOUT ────────────────────────────────────────── */
#billing-wrap { display: flex; flex: 1; overflow: hidden; }
#product-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg);
}
#cart-panel {
  width: 360px;
  display: flex;
  flex-direction: column;
  background: var(--surface2);
  overflow: hidden;
}

/* ── POS LAYOUT ───────────────────────────────────────────── */
#pos-wrap {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 14px;
  height: calc(100vh - 64px);
  overflow: hidden;
  background: var(--bg);
}
#pos-products {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  padding: 14px;
}
#pos-cart {
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  padding: 16px;
}
.branding-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}


.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  padding: 14px;
}
.prod-card {
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 13px 14px;
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  box-shadow: var(--shadow-xs);
}
.prod-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.prod-card.selected {
  border-color: var(--primary);
  background: var(--primary-bg);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb),0.12);
}
.prod-card.oos { opacity: 0.45; cursor: not-allowed; transform: none !important; }

/* ── LICENSE SCREEN ────────────────────────────────────────── */
#license-screen {
  min-height: 100vh;
  background: radial-gradient(ellipse at 30% 20%, #1e3a5f 0%, #0f172a 60%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lic-box {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 32px;
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.05);
  width: 420px;
  max-width: 100%;
}
.lic-key-input {
  width: 100%;
  padding: 11px 44px;
  font-size: 14px;
  border: 1.5px solid var(--border2);
  border-radius: var(--r-md);
  outline: none;
  font-family: 'Courier New', monospace;
  letter-spacing: 2px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface2);
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.lic-key-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb),0.12); }

/* ── PWA SPLASH ────────────────────────────────────────────── */
#pwa-splash {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 30% 20%, #1e3a5f 0%, #0f172a 70%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: opacity 0.5s ease;
}
#pwa-splash.hide { opacity: 0; pointer-events: none; }
.splash-logo {
  width: 88px;
  height: 88px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
  box-shadow: 0 16px 48px rgba(var(--primary-rgb),0.45);
  animation: splashPulse 2s ease infinite;
}
@keyframes splashPulse {
  0%,100% { box-shadow: 0 16px 48px rgba(var(--primary-rgb),0.45); }
  50%      { box-shadow: 0 16px 64px rgba(var(--primary-rgb),0.65); }
}
.splash-name { font-size: 36px; font-weight: 800; color: #f1f5f9; letter-spacing: -1px; margin-bottom: 6px; }
.splash-sub  { font-size: 14px; color: #475569; margin-bottom: 48px; font-weight: 500; }
.splash-bar  { width: 180px; height: 2px; background: rgba(255,255,255,0.1); border-radius: 2px; overflow: hidden; }
.splash-progress { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light)); border-radius: 2px; animation: splashLoad 1.8s ease forwards; }
@keyframes splashLoad { from { width: 0% } to { width: 100% } }
.splash-by { position: absolute; bottom: 28px; font-size: 12px; color: #334155; font-weight: 500; }

/* ── PWA INSTALL BANNER ────────────────────────────────────── */
#install-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--sb-bg);
  border-top: 1px solid rgba(var(--primary-rgb),0.3);
  padding: 14px 20px;
  display: none;
  align-items: center;
  gap: 12px;
  z-index: 1000;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.4);
}
#install-banner .ib-icon { width: 42px; height: 42px; border-radius: 10px; background: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
#install-banner .ib-text { flex: 1; }
#install-banner .ib-title { font-size: 13px; font-weight: 700; color: #f1f5f9; margin-bottom: 2px; }
#install-banner .ib-sub   { font-size: 11px; color: #475569; }
#install-banner .ib-btn   { background: var(--primary); color: #fff; border: none; border-radius: var(--r-md); padding: 9px 18px; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; font-family: inherit; }
#install-banner .ib-close { background: none; border: none; color: #475569; cursor: pointer; padding: 4px; font-size: 18px; line-height: 1; }

/* ── TOAST NOTIFICATIONS ───────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-lg);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.28s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: all;
  min-width: 240px;
  max-width: 340px;
  border: 1px solid rgba(255,255,255,0.15);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.toast-success { background: #065f46; color: #d1fae5; }
.toast-error   { background: #991b1b; color: #fee2e2; }
.toast-info    { background: #1e3a5f; color: #bfdbfe; }
.toast-warning { background: #92400e; color: #fde68a; }
@keyframes toastIn  { from { transform: translateX(60px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(60px); } }

/* ── SYNC DOT ──────────────────────────────────────────────── */
#sync-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--r-full);
  transition: all 0.3s;
}
.sync-saved  { background: var(--money-bg); color: var(--money); }
.sync-saving { background: var(--warning-bg); color: var(--warning); }
.sync-error  { background: var(--danger-bg); color: var(--danger); }

/* ── PRINT ─────────────────────────────────────────────────── */
/* Unified @media print now handled in print.css */

#inv-print-portal { display: none; }

/* ── MOBILE OVERLAY ────────────────────────────────────────── */
#mob-overlay { display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.5); z-index: 199; }
#mob-menu-btn { display: none; background: none; border: none; cursor: pointer; padding: 6px; border-radius: var(--r-md); align-items: center; justify-content: center; }
#mob-menu-btn:hover { background: var(--surface3); }
#mob-close-btn { display: none; position: absolute; top: 14px; right: 14px; background: none; border: none; cursor: pointer; padding: 4px; }

/* ── RESPONSIVE ────────────────────────────────────────────── */

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE LAYOUT — BillZen v3
   Mobile-first. Tested: 320px → 1440px+
   Breakpoints: 480px | 768px | 1024px
   ══════════════════════════════════════════════════════════════ */

/* ── Mobile overlay + hamburger ─────────────────────────────── */
#mob-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  z-index: 199;
  backdrop-filter: blur(2px);
}
#mob-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--r-md);
  align-items: center;
  justify-content: center;
  color: var(--text2);
}
#mob-menu-btn:hover { background: var(--surface3); }
#mob-close-btn {
  display: none;
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255,255,255,.08);
  border: none;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 6px;
  color: #94a3b8;
  font-size: 16px;
  line-height: 1;
}

/* ── Sidebar transition (all sizes) ────────────────────────── */
#sidebar {
  transition: left 0.26s cubic-bezier(0.4,0,0.2,1), box-shadow 0.26s;
}

/* ── Bottom nav (mobile only, hidden by default) ─────────────── */
#mob-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 90;
  padding: 5px 0 env(safe-area-inset-bottom, 6px);
  box-shadow: 0 -4px 12px rgba(15,23,42,.08);
}
#mob-bottom-nav .mob-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 9px;
  font-weight: 700;
  color: var(--text3);
  font-family: inherit;
  transition: color 0.12s;
}
#mob-bottom-nav .mob-nav-item.active { color: var(--primary); }

/* ══════════════════════════════════════════════════════════════
   TABLET — 769px to 1024px
   Sidebar narrows, grids go 2-col
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  #sidebar { width: 200px; }
  .g4 { grid-template-columns: 1fr 1fr; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  #cart-panel { width: 300px; }
}

/* ══════════════════════════════════════════════════════════════
   MOBILE LANDSCAPE + SMALL TABLET — up to 768px
   Sidebar slides over, hamburger visible
   ══════════════════════════════════════════════════════════════ */
/* ── Mobile Responsive Overrides — Consolidated in mobile-responsive.css ── */
@media (max-width: 768px) {
  #app { flex-direction: column; }
  #main { width: 100%; flex: 1; }
  .g2, .g3, .g4 { grid-template-columns: 1fr 1fr; gap: 10px; }
}

/* ══════════════════════════════════════════════════════════════
   MOBILE PORTRAIT — up to 480px
   Single column everything
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  /* Single column grids */
  .g2, .g3, .g4, .branding-grid, .dashboard-grid { grid-template-columns: 1fr !important; gap: 10px; }

  /* Content padding */
  #content { padding: 10px 10px 80px !important; }

  /* Stat cards — horizontal on tiny screens */
  .stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px !important;
  }
  .stat-card .stat-icon { flex-shrink: 0; }
  .stat-card .stat-value { font-size: 18px !important; margin: 2px 0 !important; }
  .stat-card .stat-label { margin-bottom: 2px; }
  .stat-card .stat-sub { font-size: 11px !important; }
  .stat-card::before { display: none; } /* remove top accent bar in horizontal mode */

  /* Page title */
  .page-title { font-size: 17px !important; }

  /* Topbar minimal */
  #topbar-user { display: none !important; }
  #sync-dot { display: none !important; }

  /* Product grid — 2 cols on small mobile */
  .product-grid { grid-template-columns: repeat(2, 1fr); }

  /* Billing cart panel — more compact */
  #cart-panel { font-size: 12px; }

  /* Invoice print bar — wrap buttons */
  div[style*="display:flex;gap:8px;flex-wrap:wrap"] { gap: 6px !important; }

  /* Adjustment row — stack fully */
  .adj-row { gap: 4px; }
  .adj-type-btn { font-size: 10px; padding: 3px 7px; }
  .adj-label-inp { min-width: 100px; }
  .adj-amt-inp { width: 75px !important; min-width: 70px; }

  /* Modal full height */
  .modal-box { max-height: 95vh !important; }

  /* Buttons in rows — wrap */
  .flex-gap8, .flex-gap10 { flex-wrap: wrap; }

  /* Tables */
  .tbl-wrap table { min-width: 400px; }
  table.tbl th, table.tbl td { padding: 8px 10px !important; font-size: 11px !important; }

  /* Dashboard Quick Actions Font Size */
  button[style*="padding:14px 6px"] div[style*="font-size:11px"] {
    font-size: 12px !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   VERY SMALL — under 360px (older Android)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 360px) {
  #content { padding: 8px 8px 70px !important; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 8px; }
  .stat-card { padding: 10px !important; }
  .stat-value { font-size: 16px !important; }
}

/* ══════════════════════════════════════════════════════════════
   PRINT MEDIA — clean invoice output
   ══════════════════════════════════════════════════════════════ */
/* Simplified @media print */
@media print {
  .no-print { display: none !important; }
}

/* ── Invoice print portal ───────────────────────────────────── */
#inv-print-portal { display: none; }

/* ══════════════════════════════════════════════════════════════
   PWA SAFE AREA (iPhone notch / home indicator)
   ══════════════════════════════════════════════════════════════ */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #mob-bottom-nav { padding-bottom: calc(5px + env(safe-area-inset-bottom)); }
  #content { padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important; }
}

/* ══════════════════════════════════════════════════════════════
   TOUCH DEVICES — better tap targets
   ══════════════════════════════════════════════════════════════ */
@media (hover: none) and (pointer: coarse) {
  .btn { min-height: 42px; }
  .btn-sm { min-height: 36px; }
  .nav-item { min-height: 40px; padding: 10px 12px; }
  input.inp, select.inp { min-height: 44px; }
  .toggle { width: 44px; height: 24px; }
  .toggle-knob { width: 20px; height: 20px; }
  .tab-btn { min-height: 36px; padding: 8px 14px; }
}

.settings-container {
  max-width: 1100px;
  margin: 0 auto;
}

.card-title {
  font-weight: 800;
  margin-bottom: 14px;
}

svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}