/* VPM StockPro — Design System */
:root {
  --accent: #4f46e5;
  --accent-strong: #4f46e5;
  --accent-50: #eef2ff;
  --accent-100: #e0e7ff;
  --indigo-deep: #1e1b4b;
  --indigo-mid: #312e81;
  --bg: #f8fafc;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-soft: #334155;
  --ink-mute: #64748b;
  --line: #e2e8f0;
  --line-soft: #eef0f4;
  --green: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --slate: #64748b;
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04), 0 1px 3px rgba(15,23,42,0.06);
  --shadow-md: 0 2px 4px rgba(15,23,42,0.04), 0 8px 24px rgba(15,23,42,0.06);
  --shadow-lg: 0 24px 60px rgba(15,23,42,0.18);
  --r-card: 16px;
  --r-input: 10px;
  --r-pill: 999px;
  --row-pad: 14px 18px;
  --font-scale: 1;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Outfit", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: calc(15px * var(--font-scale));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
#root, #vpm-root { height: 100%; }

button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select { font-family: inherit; }
h1,h2,h3,h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

/* ───────────── App shell ───────────── */
.app-shell { display: grid; grid-template-columns: 260px 1fr; height: 100vh; min-height: 720px; }
.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.content { flex: 1; overflow-y: auto; padding: 24px 32px 48px; }

/* ───────────── Sidebar ───────────── */
.sidebar {
  background: var(--indigo-deep);
  color: #e5e7ff;
  display: flex; flex-direction: column;
  padding: 22px 14px;
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.04);
}
[data-sidebar="light"] .sidebar {
  background: #ffffff;
  color: var(--ink);
  border-right: 1px solid var(--line);
  box-shadow: none;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 18px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: #fff; display: grid; place-items: center;
  font-size: 18px; box-shadow: 0 6px 16px rgba(79,70,229,0.4);
  flex-shrink: 0;
}
.brand-name { font-size: 17px; font-weight: 600; color: inherit; }
.brand-sub { font-size: 12px; color: rgba(229,231,255,0.55); }
[data-sidebar="light"] .brand-sub { color: var(--ink-mute); }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: rgba(229,231,255,0.78);
  font-size: 14.5px;
  text-align: left;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
  width: 100%;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-item i { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; }
.nav-active {
  background: rgba(99,102,241,0.18) !important;
  color: #fff !important;
  border-left-color: var(--accent) !important;
  padding-left: 11px;
}
[data-sidebar="light"] .nav-item { color: var(--ink-soft); }
[data-sidebar="light"] .nav-item:hover { background: var(--accent-50); color: var(--ink); }
[data-sidebar="light"] .nav-active { background: var(--accent-50) !important; color: var(--ink) !important; }

.profile {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border-radius: 12px;
  background: rgba(255,255,255,0.04);
  margin-top: auto;
}
[data-sidebar="light"] .profile { background: var(--bg); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.profile-meta { flex: 1; min-width: 0; }
.profile-name { font-size: 13.5px; font-weight: 500; color: inherit; }
.profile .pill { font-size: 10.5px; padding: 2px 8px; margin-top: 3px; display: inline-block; }
.profile .icon-btn { color: inherit; opacity: 0.7; }
.profile .icon-btn:hover { opacity: 1; }

/* ───────────── Top bar ───────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.7); backdrop-filter: blur(8px);
}
.page-title { font-size: 22px; font-weight: 600; }
.page-date { font-size: 12.5px; color: var(--ink-mute); margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.bell-wrap { position: relative; }
.bell { position: relative; width: 40px; height: 40px; border-radius: 10px; background: var(--bg); }
.bell:hover { background: var(--accent-50); }
.bell-badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--red); color: #fff;
  border-radius: 999px; font-size: 10.5px; font-weight: 600;
  display: grid; place-items: center;
  border: 2px solid #fff;
}
.bell-pop {
  position: absolute; top: 48px; right: 0;
  width: 340px; background: #fff; border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 8px; z-index: 20;
  border: 1px solid var(--line);
}
.bell-head { padding: 8px 12px 10px; font-weight: 600; font-size: 13px; color: var(--ink-soft); border-bottom: 1px solid var(--line-soft); }
.bell-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; padding: 10px 12px; border-radius: 8px; text-align: left; }
.bell-row:hover { background: var(--bg); }
.bell-name { font-size: 13.5px; font-weight: 500; }
.bell-sub { font-size: 11.5px; color: var(--ink-mute); }

/* ───────────── Buttons ───────────── */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 500; transition: filter 0.15s, transform 0.05s, background 0.15s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 14px rgba(79,70,229,0.25); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline { background: #fff; border: 1px solid var(--line); color: var(--ink-soft); }
.btn-outline:hover { background: var(--bg); border-color: #cbd5e1; }
.btn-block { width: 100%; justify-content: center; padding: 13px; font-size: 14.5px; }
.btn-checkout { background: var(--accent); color: #fff; width: 100%; justify-content: center; padding: 14px; font-size: 15px; font-weight: 600; box-shadow: 0 8px 20px rgba(79,70,229,0.3); border-radius: 10px; display: flex; align-items: center; gap: 8px; cursor: pointer; border: 0; font-family: inherit; }
.btn-checkout:disabled { background: #cbd5e1; box-shadow: none; cursor: not-allowed; }
.btn-share { color: #fff; }
.btn-wa { background: #25D366; }
.btn-tg { background: #229ED9; }
.link-btn { color: var(--accent); font-size: 13px; font-weight: 500; padding: 4px 8px; border-radius: 6px; }
.link-btn:hover { background: var(--accent-50); }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; display: inline-grid; place-items: center; color: var(--ink-soft); transition: background 0.12s; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn-danger:hover { background: #fef2f2; color: var(--red); }

/* ───────────── Cards & panels ───────────── */
.vpm-card { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow-sm); border: 1px solid var(--line-soft); }

/* Screens — hidden by default, flex when active */
.screen { display: none; flex-direction: column; gap: 22px; }
.screen.active { display: flex; }

.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.kpi { padding: 22px; display: flex; flex-direction: column; gap: 8px; position: relative; overflow: hidden; }
.kpi-label { font-size: 12.5px; color: var(--ink-mute); font-weight: 500; display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-label i { color: var(--ink-mute); }
.kpi-value { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.kpi-sub { font-size: 12.5px; color: var(--ink-mute); }
.kpi-warn { color: var(--amber); }
.kpi-warn-sub { color: var(--amber); }
.kpi-pos { color: var(--green); }
.kpi-primary { background: linear-gradient(135deg, var(--accent), #6366f1); color: #fff; border-color: transparent; }
.kpi-primary .kpi-label, .kpi-primary .kpi-sub, .kpi-primary .kpi-label i { color: rgba(255,255,255,0.85); }
.kpi-primary .kpi-value { color: #fff; }

.panel-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; }
.panel { padding: 22px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel-head h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.panel-head .muted { color: var(--ink-mute); font-size: 12.5px; }

.alert-list, .rank-list { display: flex; flex-direction: column; }
.alert-row, .rank-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.alert-row:last-child, .rank-row:last-child { border-bottom: 0; }
.alert-main { flex: 1; min-width: 0; }
.alert-name { font-size: 13.5px; font-weight: 500; }
.alert-meta { margin-top: 3px; }
.rank-num { width: 26px; height: 26px; border-radius: 8px; background: var(--accent-50); color: var(--accent); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.rank-main { flex: 1; min-width: 0; }
.rank-name { font-size: 13.5px; font-weight: 500; }
.rank-sub { font-size: 11.5px; color: var(--ink-mute); margin-top: 2px; }
.rank-value { font-size: 14px; font-weight: 600; color: var(--ink); }
.empty { padding: 24px; text-align: center; color: var(--ink-mute); font-size: 13.5px; }

/* ───────────── Pills, chips, badges ───────────── */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 500; }
.pill i { font-size: 9px; }
.pill-green { background: #d1fae5; color: #047857; }
.pill-amber { background: #fef3c7; color: #b45309; }
.pill-red { background: #fee2e2; color: #b91c1c; }
.pill-blue { background: #dbeafe; color: #1e40af; }
.pill-purple { background: #ede9fe; color: #6d28d9; }
.cat-chip { display: inline-block; padding: 3px 9px; background: var(--bg); color: var(--ink-soft); border-radius: var(--r-pill); font-size: 11.5px; font-weight: 500; }

/* ───────────── Action bar ───────────── */
.action-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.bar-title h2 { font-size: 18px; }
.bar-sub { font-size: 12.5px; color: var(--ink-mute); margin-top: 3px; }
.actions { display: flex; gap: 10px; margin-left: auto; }
.search { position: relative; flex: 1; max-width: 360px; }
.search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-mute); font-size: 13px; }
.search input { width: 100%; padding: 11px 14px 11px 38px; border: 1px solid var(--line); border-radius: var(--r-input); background: #fff; font-size: 13.5px; outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,0.15); }
.cat-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips-row { padding: 4px 0; }
.chip { padding: 7px 14px; border-radius: var(--r-pill); background: #fff; border: 1px solid var(--line); color: var(--ink-soft); font-size: 12.5px; font-weight: 500; transition: all 0.12s; cursor: pointer; }
.chip:hover { background: var(--bg); }
.chip-active, .chip.active { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; }

/* ───────────── Tables ───────────── */
.table-card { padding: 8px; overflow-x: auto; }
.table-card.no-shadow { box-shadow: none; border: 1px solid var(--line); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table thead th { text-align: left; padding: 14px 18px; font-size: 11.5px; font-weight: 600; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--line); background: var(--bg); }
.data-table thead th:first-child { border-top-left-radius: 10px; }
.data-table thead th:last-child { border-top-right-radius: 10px; }
.data-table td { padding: var(--row-pad); border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:nth-child(even) { background: rgba(248,250,252,0.5); }
.data-table tbody tr:hover { background: var(--accent-50); }
.data-table .num { text-align: right; }
.data-table .strong { font-weight: 600; }
.data-table .muted { color: var(--ink-mute); }
.actions-col { width: 110px; text-align: right; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.cell-name { font-weight: 500; }
.cell-bc { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11.5px; color: var(--ink-mute); margin-top: 3px; }
.margin-pct { font-size: 11.5px; color: var(--green); font-weight: 500; margin-top: 2px; }
.view-only { font-size: 11.5px; color: var(--ink-mute); font-style: italic; }
.total-row { background: var(--bg) !important; }
.total-row td { border-top: 2px solid var(--line); }
.check-col { width: 42px; text-align: center; padding-left: 14px !important; padding-right: 4px !important; }
.data-table input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); border-radius: 4px; vertical-align: middle; }

/* ───────────── Bulk action bar ───────────── */
.bulk-bar {
  display: none; align-items: center; gap: 10px;
  padding: 13px 20px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: white; border-radius: 0 0 var(--r-card) var(--r-card);
  flex-wrap: wrap;
}
.bulk-bar .bulk-count { font-weight: 600; font-size: 14px; flex: 1; white-space: nowrap; }
.bulk-deselect { background: none; border: none; color: rgba(255,255,255,.7); cursor: pointer; font-size: 17px; padding: 2px 6px; border-radius: 6px; transition: background 0.15s; flex-shrink: 0; }
.bulk-deselect:hover { background: rgba(255,255,255,.15); color: white; }
.bulk-action-btn {
  padding: 7px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  border: 1.5px solid rgba(255,255,255,.45); background: transparent;
  color: white; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.15s; white-space: nowrap; font-family: inherit;
}
.bulk-action-btn:hover { background: rgba(255,255,255,.18); }
.bulk-action-btn.danger { border-color: #fca5a5; color: #fca5a5; }
.bulk-action-btn.danger:hover { background: rgba(239,68,68,.25); color: #fecaca; }

/* ───────────── POS ───────────── */
.pos-screen { display: grid; grid-template-columns: 1fr 380px; gap: 18px; align-items: start; }
.pos-left { display: flex; flex-direction: column; gap: 14px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.prod-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; transition: all 0.15s; display: flex; flex-direction: column; gap: 10px; min-height: 130px; }
.prod-card:hover { border-color: var(--accent); box-shadow: 0 8px 24px rgba(79,70,229,0.12); transform: translateY(-1px); }
.prod-disabled { opacity: 0.5; cursor: not-allowed; }
.prod-disabled:hover { transform: none; box-shadow: none; border-color: var(--line); }
.prod-cat { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-mute); font-weight: 600; }
.prod-name { font-size: 13.5px; font-weight: 500; flex: 1; line-height: 1.3; }
.prod-foot { display: flex; justify-content: space-between; align-items: flex-end; }
.prod-price { font-size: 16px; font-weight: 600; color: var(--ink); }
.prod-stock { font-size: 11px; color: var(--ink-mute); margin-top: 2px; }
.stock-low { color: var(--amber); }
.stock-zero { color: var(--red); }
.prod-add { width: 32px; height: 32px; border-radius: 8px; background: var(--accent-50); color: var(--accent); display: grid; place-items: center; border: 0; cursor: pointer; }
.prod-add:disabled { opacity: 0.5; }
.prod-card:hover .prod-add { background: var(--accent); color: #fff; }

.pos-right { position: sticky; top: 0; }
.cart-card { display: flex; flex-direction: column; max-height: calc(100vh - 140px); }
.cart-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line-soft); }
.cart-head h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.cart-list { flex: 1; overflow-y: auto; padding: 8px 12px; min-height: 200px; }
.cart-empty { padding: 40px 20px; text-align: center; color: var(--ink-mute); }
.cart-empty i { font-size: 32px; color: var(--line); display: block; margin-bottom: 12px; }
.cart-empty-sub { font-size: 12px; margin-top: 4px; }
.cart-row { padding: 12px 8px; border-bottom: 1px solid var(--line-soft); }
.cart-row:last-child { border-bottom: 0; }
.cart-name { font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.cart-controls { display: flex; align-items: center; gap: 8px; }
.qty { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty button { width: 26px; height: 26px; background: var(--bg); font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.qty button:hover { background: var(--accent-50); color: var(--accent); }
.qty span { width: 32px; text-align: center; font-size: 13px; font-weight: 600; line-height: 26px; }
.cart-line { flex: 1; text-align: right; }
.cart-unit { font-size: 11px; color: var(--ink-mute); }
.cart-total { font-size: 13.5px; font-weight: 600; }
.cart-foot { padding: 16px 20px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 10px; }
.cart-sub-row { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--ink-soft); }
.cart-sub-row.total { font-size: 18px; font-weight: 600; color: var(--ink); margin-top: 2px; }
.method-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: var(--bg); padding: 4px; border-radius: 10px; margin-top: 4px; }
.method-toggle button { padding: 10px; font-size: 13px; font-weight: 500; border-radius: 7px; color: var(--ink-soft); display: flex; align-items: center; justify-content: center; gap: 6px; }
.method-toggle button.active { background: #fff; color: var(--accent); box-shadow: var(--shadow-sm); }

/* ───────────── Forms ───────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; font-weight: 500; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }
.field > span i { color: var(--ink-mute); }
.field input, .field select { padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--r-input); font-size: 13.5px; outline: none; transition: border-color 0.15s, box-shadow 0.15s; background: #fff; color: var(--ink); }
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,0.15); }
.form-card { padding: 24px; }
.form-desc { font-size: 13px; margin-top: -4px; margin-bottom: 14px; }
.muted { color: var(--ink-mute); }
.settings-foot { display: flex; justify-content: flex-end; margin-top: 16px; }

/* ───────────── Expenses ───────────── */
.budget-strip { display: flex; flex-direction: column; gap: 14px; }
.budget-row { display: flex; flex-direction: column; gap: 6px; }
.budget-head { display: flex; justify-content: space-between; font-size: 13px; }
.budget-name { font-weight: 500; }
.budget-amt { color: var(--ink-soft); }
.budget-bar { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.budget-fill { height: 100%; border-radius: 999px; transition: width 0.4s; }
.budget-fill-green { background: var(--green); }
.budget-fill-amber { background: var(--amber); }
.budget-fill-red { background: var(--red); }

/* ───────────── Owner ───────────── */
.period-toggle { display: flex; gap: 6px; background: #fff; padding: 4px; border-radius: var(--r-pill); border: 1px solid var(--line); }
.period-pill { padding: 8px 16px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 500; color: var(--ink-soft); cursor: pointer; }
.period-pill.active { background: var(--accent); color: #fff; }
.sparkline { width: 100%; height: auto; display: block; }

/* ───────────── Login ───────────── */
.login-stage {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--indigo-deep), var(--indigo-mid), var(--accent));
  padding: 24px; position: relative; overflow: hidden;
}
.login-stage::before, .login-stage::after {
  content: ""; position: absolute; width: 480px; height: 480px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.08), transparent 70%);
  pointer-events: none;
}
.login-stage::before { top: -160px; left: -160px; }
.login-stage::after { bottom: -200px; right: -180px; }
.login-card {
  width: 100%; max-width: 420px; background: #fff; border-radius: 24px;
  padding: 36px 34px 28px; box-shadow: 0 30px 80px rgba(15,23,42,0.35);
  position: relative; z-index: 1; min-width: 0;
}
.login-card .field input { width: 100%; min-width: 0; }
.login-logo {
  width: 60px; height: 60px; border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: #fff; display: grid; place-items: center;
  font-size: 24px; margin: 0 auto 18px;
  box-shadow: 0 12px 28px rgba(79,70,229,0.45);
}
.login-title { font-size: 26px; text-align: center; font-weight: 600; letter-spacing: -0.02em; }
.login-sub { text-align: center; color: var(--ink-mute); font-size: 13.5px; margin: 6px 0 24px; }
.login-card .field { margin-bottom: 14px; }
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 44px; width: 100%; }
.pass-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; color: var(--ink-mute); border-radius: 6px; }
.pass-eye:hover { background: var(--bg); color: var(--ink); }
.error-banner { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; padding: 10px 12px; border-radius: 10px; font-size: 13px; display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.error-banner button { margin-left: auto; color: inherit; }
.login-foot { text-align: center; color: var(--ink-mute); font-size: 11.5px; margin-top: 16px; }
.spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────────── Modal ───────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,0.55);
  backdrop-filter: blur(4px);
  display: none; place-items: center; z-index: 100;
  padding: 24px;
}
.modal-backdrop.active { display: grid; animation: fade 0.15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 540px; max-width: 100%; background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); max-height: 90vh; display: flex; flex-direction: column; animation: pop 0.18s; }
.modal-wide { width: 820px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line-soft); flex-shrink: 0; }
.modal-head h3 { font-size: 16px; display: flex; align-items: center; gap: 10px; }
.modal-head h3 i { color: var(--accent); }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line-soft); flex-shrink: 0; }

/* ───────────── Toasts ───────────── */
.toast-stack { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; min-width: 260px;
  background: #fff; border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15,23,42,0.18);
  font-size: 13.5px; font-weight: 500;
  animation: slidein 0.25s;
  border-left: 4px solid var(--slate);
}
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }
.toast-success { border-left-color: var(--green); }
.toast-success i { color: var(--green); }
.toast-error { border-left-color: var(--red); }
.toast-error i { color: var(--red); }
.toast-warning { border-left-color: var(--amber); }
.toast-warning i { color: var(--amber); }
.toast-info { border-left-color: var(--accent); }
.toast-info i { color: var(--accent); }

/* ───────────── Loader ───────────── */
#vpm-loader {
  position: fixed; inset: 0;
  background: rgba(255,255,255,0.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 9998;
}
.vpm-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
[data-theme="dark"] #vpm-loader { background: rgba(11,16,32,0.65); }

/* ───────────── Avatar sizes ───────────── */
.avatar-md { width: 40px; height: 40px; font-size: 13px; }

/* ───────────── KPI 3-col variant ───────────── */
.kpi-row-3 { grid-template-columns: repeat(3, 1fr); }

/* ───────────── Theme toggle (sidebar) ───────────── */
.theme-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: rgba(255,255,255,0.06);
  padding: 4px;
  border-radius: 10px;
  margin: 0 4px 10px;
}
.theme-opt {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 12.5px; font-weight: 500;
  color: rgba(229,231,255,0.7);
  transition: all 0.12s;
}
.theme-opt:hover { color: #fff; }
.theme-opt i { font-size: 12px; }
.theme-active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
[data-sidebar="light"] .theme-toggle { background: var(--bg); }
[data-sidebar="light"] .theme-opt { color: var(--ink-mute); }
[data-sidebar="light"] .theme-opt:hover { color: var(--ink); }
[data-sidebar="light"] .theme-active { background: #fff; color: var(--ink); }

/* ───────────── Dark theme ───────────── */
[data-theme="dark"] {
  --bg: #0b1020;
  --card: #131a2c;
  --ink: #e2e8f0;
  --ink-soft: #cbd5e1;
  --ink-mute: #94a3b8;
  --line: #1e293b;
  --line-soft: #1a2236;
  --accent-50: rgba(99,102,241,0.12);
  --accent-100: rgba(99,102,241,0.25);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 2px 4px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 24px 60px rgba(0,0,0,0.55);
}
[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
[data-theme="dark"] .topbar { background: rgba(11,16,32,0.7); border-bottom-color: var(--line); }
[data-theme="dark"] .bell { background: var(--card); }
[data-theme="dark"] .bell:hover { background: rgba(99,102,241,0.15); }
[data-theme="dark"] .btn-outline { background: var(--card); border-color: var(--line); color: var(--ink-soft); }
[data-theme="dark"] .btn-outline:hover { background: rgba(255,255,255,0.05); border-color: #334155; }
[data-theme="dark"] .icon-btn { color: var(--ink-soft); }
[data-theme="dark"] .icon-btn:hover { background: rgba(255,255,255,0.06); color: var(--ink); }
[data-theme="dark"] .chip { background: var(--card); border-color: var(--line); color: var(--ink-soft); }
[data-theme="dark"] .chip:hover { background: rgba(255,255,255,0.05); }
[data-theme="dark"] .cat-chip { background: rgba(255,255,255,0.07); color: var(--ink-soft); }
[data-theme="dark"] .search input,
[data-theme="dark"] .field input,
[data-theme="dark"] .field select { background: var(--card); border-color: var(--line); color: var(--ink); }
[data-theme="dark"] .data-table thead th { background: rgba(255,255,255,0.04); color: var(--ink-mute); border-bottom-color: var(--line); }
[data-theme="dark"] .data-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }
[data-theme="dark"] .data-table tbody tr:hover { background: rgba(99,102,241,0.08); }
[data-theme="dark"] .data-table td { border-bottom-color: var(--line-soft); }
[data-theme="dark"] .total-row { background: rgba(255,255,255,0.03) !important; }
[data-theme="dark"] .prod-card { background: var(--card); border-color: var(--line); }
[data-theme="dark"] .prod-card:hover { border-color: var(--accent); }
[data-theme="dark"] .cart-empty i { color: var(--line); }
[data-theme="dark"] .qty { border-color: var(--line); }
[data-theme="dark"] .qty button { background: rgba(255,255,255,0.04); color: var(--ink-soft); }
[data-theme="dark"] .qty button:hover { background: rgba(99,102,241,0.18); color: var(--ink); }
[data-theme="dark"] .method-toggle { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .method-toggle button { color: var(--ink-soft); }
[data-theme="dark"] .method-toggle button.active { background: var(--card); color: var(--ink); }
[data-theme="dark"] .modal { background: var(--card); }
[data-theme="dark"] .modal-head, [data-theme="dark"] .modal-foot { border-color: var(--line-soft); }
[data-theme="dark"] .toast { background: var(--card); color: var(--ink); }
[data-theme="dark"] .budget-bar { background: rgba(255,255,255,0.08); }

/* ───────────── Responsive ───────────── */
@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .panel-grid { grid-template-columns: 1fr; }
  .pos-screen { grid-template-columns: 1fr; }
  .kpi-row-3 { grid-template-columns: 1fr 1fr; }
}
/* ── Hamburger button (hidden on desktop) ───────────── */
.hamburger-btn {
  display: none;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 5px; width: 40px; height: 40px;
  border-radius: 10px; flex-shrink: 0;
  background: transparent;
  transition: background 0.15s;
}
.hamburger-btn:hover { background: var(--accent-50); }
.hamburger-btn span {
  display: block; width: 20px; height: 2px;
  background: var(--ink); border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}
.sidebar-open .hamburger-btn span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.sidebar-open .hamburger-btn span:nth-child(2) { opacity: 0; }
.sidebar-open .hamburger-btn span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.topbar-left { display: flex; align-items: center; gap: 10px; }

/* ── Sidebar overlay ────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 199;
  backdrop-filter: blur(2px);
}
.sidebar-open .sidebar-overlay { display: block; }

/* ── Tablet + mobile: hamburger sidebar ─────────────── */
@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 1fr; }
  .hamburger-btn { display: flex; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.32,0.72,0,1);
    box-shadow: none;
  }
  .sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0,0,0,0.25);
  }

  .content { padding: 18px; }
  .topbar { padding: 14px 18px; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: 1; }
}

@media (max-width: 480px) {
  .kpi-row { grid-template-columns: 1fr; }
  .login-stage { padding: 16px; }
  .login-card { padding: 28px 20px; border-radius: 20px; }
  .login-title { font-size: 22px; }
  .sidebar { width: 82vw; max-width: 300px; }
}

/* ══════════════════════════════════════
   KHATA (Credit Book)
══════════════════════════════════════ */
.khata-layout { display: grid; grid-template-columns: 360px 1fr; gap: 18px; align-items: start; }
.khata-list { padding: 18px; }
.khata-rows { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; max-height: 560px; overflow-y: auto; }
.khata-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; text-align: left; transition: background 0.12s; border: 1px solid transparent; width: 100%; background: none; cursor: pointer; }
.khata-row:hover { background: var(--bg); }
.khata-row-active { background: var(--accent-50) !important; border-color: var(--accent) !important; }
.khata-main { flex: 1; min-width: 0; }
.khata-name { font-size: 13.5px; font-weight: 500; }
.khata-meta { font-size: 11.5px; color: var(--ink-mute); margin-top: 2px; }
.khata-bal { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.khata-amt { font-size: 15px; font-weight: 600; color: #b45309; }
.khata-detail { padding: 22px; display: flex; flex-direction: column; }
.khata-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.khata-detail-head h3 { font-size: 18px; }
.khata-detail-sub { font-size: 12.5px; color: var(--ink-mute); margin-top: 4px; }
.khata-detail-bal { text-align: right; flex-shrink: 0; }
.khata-detail-amt { font-size: 26px; font-weight: 600; color: #b91c1c; letter-spacing: -0.02em; line-height: 1.1; margin-top: 4px; }
.khata-actions { display: flex; gap: 10px; margin-top: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.ledger-head { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; margin-bottom: 8px; }
.ledger-head h4 { font-size: 14px; }
.ledger { display: flex; flex-direction: column; }
.ledger-row { display: grid; grid-template-columns: 60px 32px 1fr auto; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.ledger-row:last-child { border-bottom: 0; }
.ledger-date { font-size: 11.5px; color: var(--ink-mute); font-weight: 500; }
.ledger-icon { width: 28px; height: 28px; border-radius: 50%; background: #fee2e2; color: #b91c1c; display: grid; place-items: center; font-size: 11px; }
.ledger-pay .ledger-icon { background: #d1fae5; color: #047857; }
.ledger-note { font-weight: 500; }
.ledger-inv { font-size: 11.5px; color: var(--ink-mute); margin-top: 2px; font-family: "JetBrains Mono", monospace; }
.ledger-amt { font-size: 14px; font-weight: 600; color: #b91c1c; }
.ledger-pay .ledger-amt { color: #047857; }

/* ══════════════════════════════════════
   CUSTOMERS
══════════════════════════════════════ */
.customer-cell { display: flex; align-items: center; gap: 12px; }
.balance-due { color: #b91c1c; font-weight: 600; }

/* ══════════════════════════════════════
   PURCHASES — seg-toggle + btn-sm
══════════════════════════════════════ */
.seg-toggle { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px; gap: 4px; }
.seg-toggle button { padding: 8px 16px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--ink-soft); background: none; }
.seg-toggle button.active { background: var(--accent); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 7px; font-weight: 500; cursor: pointer; border: none; }
.btn-primary-sm { background: var(--accent-50); color: var(--accent); }
.btn-primary-sm:hover { background: var(--accent); color: #fff; }

/* ══════════════════════════════════════
   CUSTOMER PICKER
══════════════════════════════════════ */
.cust-pick-list { display: flex; flex-direction: column; gap: 4px; max-height: 360px; overflow-y: auto; }
.cust-pick-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px; border: 1px solid transparent; text-align: left; transition: background 0.12s; width: 100%; background: none; cursor: pointer; }
.cust-pick-row:hover { background: var(--accent-50); border-color: var(--accent-100, #e0e7ff); }
.cust-pick-walkin { border-bottom: 1px solid var(--line-soft); border-radius: 10px 10px 0 0; padding-bottom: 14px; margin-bottom: 8px; }
.cust-pick-add { padding: 14px; border: 2px dashed var(--accent); border-radius: 10px; color: var(--accent); font-weight: 500; text-align: center; margin-top: 8px; background: none; cursor: pointer; width: 100%; }
.cust-pick-add:hover { background: var(--accent-50); }

/* ══════════════════════════════════════
   SCAN MODAL
══════════════════════════════════════ */
.scan-modal { width: 500px; }
.scan-stage { display: flex; flex-direction: column; gap: 16px; }
.scan-frame { height: 180px; border-radius: 14px; background: linear-gradient(135deg, #0f172a, #1e293b); display: grid; place-items: center; position: relative; overflow: hidden; color: rgba(255,255,255,0.7); }
.scan-icon { font-size: 56px; opacity: 0.25; }
.scan-instr { position: absolute; bottom: 16px; font-size: 12px; color: rgba(255,255,255,0.6); letter-spacing: 0.04em; text-transform: uppercase; }
.scan-laser { position: absolute; left: 8%; right: 8%; height: 2px; background: #ef4444; box-shadow: 0 0 14px #ef4444, 0 0 30px rgba(239,68,68,0.6); animation: laser 1.8s ease-in-out infinite; }
@keyframes laser { 0%, 100% { top: 30%; } 50% { top: 70%; } }
.scan-input-row { display: flex; gap: 8px; }
.scan-input { flex: 1; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; font-family: "JetBrains Mono", monospace; outline: none; background: var(--card); color: var(--ink); }
.scan-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,0.15); }
.scan-hint { font-size: 11.5px; color: var(--ink-mute); }
.scan-recent-head { font-size: 11.5px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; margin-top: 6px; }
.scan-recent { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.scan-recent-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--bg); border-radius: 8px; font-size: 13px; }
.scan-recent-row i { color: var(--green, #10b981); }
.scan-recent-name { flex: 1; }
.scan-recent-price { font-weight: 600; }

/* ══════════════════════════════════════
   INVOICE MODAL
══════════════════════════════════════ */
.invoice-modal { width: min(720px, 95vw); }
.invoice-paper { background: #fff; color: #0f172a; padding: 28px; border: 1px solid #e2e8f0; border-radius: 10px; font-size: 13px; }
.inv-head { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 18px; border-bottom: 2px solid #0f172a; }
.inv-brand { font-size: 18px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.inv-brand i { color: var(--accent); }
.inv-addr, .inv-gstin { font-size: 12px; color: #64748b; margin-top: 4px; }
.inv-meta { text-align: right; }
.inv-no { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; color: #94a3b8; text-transform: uppercase; }
.inv-no-val { font-size: 15px; font-weight: 600; font-family: "JetBrains Mono", monospace; margin: 2px 0 4px; }
.inv-customer { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 16px 0; border-bottom: 1px solid #e2e8f0; }
.inv-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; color: #94a3b8; text-transform: uppercase; margin-bottom: 4px; }
.inv-name { font-size: 14px; font-weight: 600; color: #0f172a; }
.inv-table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 12.5px; color: #0f172a; }
.inv-table thead th { text-align: left; padding: 8px 6px; border-bottom: 1px solid #0f172a; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.inv-table tbody td { padding: 8px 6px; border-bottom: 1px solid #e2e8f0; }
.inv-table .num { text-align: right; }
.inv-totals { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; margin-left: auto; width: 260px; font-size: 13px; color: #0f172a; }
.inv-totals > div { display: flex; justify-content: space-between; color: #64748b; }
.inv-total { padding-top: 10px; border-top: 2px solid #0f172a; font-size: 15px; font-weight: 600; color: #0f172a !important; }
.inv-foot { margin-top: 18px; padding-top: 16px; border-top: 1px dashed #e2e8f0; text-align: center; font-size: 12px; color: #64748b; }
.inv-foot div:first-child { font-weight: 500; margin-bottom: 4px; color: #0f172a; }
.inv-foot-actions { flex-wrap: wrap; }

/* ══════════════════════════════════════
   DAY CLOSE
══════════════════════════════════════ */
.dayclose-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.dc-section { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-mute); margin-bottom: 12px; font-weight: 600; }
.dc-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dc-stat { padding: 14px; background: var(--bg); border-radius: 10px; }
.dc-label { font-size: 12px; color: var(--ink-mute); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.dc-val { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.dc-recon { display: flex; flex-direction: column; gap: 8px; padding: 16px; background: var(--bg); border-radius: 12px; }
.dc-recon-row { display: flex; justify-content: space-between; font-size: 13.5px; padding: 6px 0; }
.dc-pos { color: var(--green, #10b981); }
.dc-neg { color: var(--red, #ef4444); }
.dc-recon-total { padding-top: 10px; border-top: 1px solid var(--line); font-weight: 600; }
.dc-recon-input { align-items: center; padding-top: 4px; }
.dc-recon-input input { width: 140px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; text-align: right; font-size: 14px; font-weight: 600; outline: none; background: var(--card); color: var(--ink); }
.dc-recon-input input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,0.15); }
.dc-variance { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 14px; border-radius: 10px; }
.dc-variance i { font-size: 22px; }
.dc-var-ok    { background: #d1fae5; color: #047857; }
.dc-var-over  { background: #fef3c7; color: #b45309; }
.dc-var-short { background: #fee2e2; color: #b91c1c; }
.dc-var-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.dc-var-amt   { font-size: 18px; font-weight: 600; }

/* Responsive — new screens */
@media (max-width: 1100px) {
  .khata-layout { grid-template-columns: 1fr; }
  .dayclose-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .kpi-row-3 { grid-template-columns: 1fr; }
  .scan-modal { width: 100%; }
  .invoice-modal { width: 100%; }
  .inv-customer { grid-template-columns: 1fr; }
  .inv-totals { width: 100%; }
}

/* ═══════════════════════════════════════════════════════
   LABELS — Barcode Generator (Batch 3)
   ═══════════════════════════════════════════════════════ */

/* Template strip */
.labels-templates {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 20px;
    background: var(--card);
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}
.tpl-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: background .15s, border-color .15s;
    background: var(--bg);
}
.tpl-card:hover { background: var(--hover); }
.tpl-card.tpl-active { border-color: var(--primary); background: var(--primary-light); }
.tpl-icon { width: 32px; height: 42px; color: var(--text-muted); flex-shrink: 0; }
.tpl-icon svg { width: 100%; height: 100%; }
.tpl-active .tpl-icon { color: var(--primary); }
.tpl-name { font-size: 13px; font-weight: 600; white-space: nowrap; }
.tpl-avery { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* Layout — two columns */
.labels-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
    align-items: start;
}

/* Left picker panel */
.labels-picker { display: flex; flex-direction: column; gap: 0; overflow: hidden; }
.labels-picker .panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border);
}
.labels-picker .panel-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.labels-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.labels-search i { color: var(--text-muted); font-size: 13px; }
.labels-search input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    color: var(--text);
}
.labels-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}
.opt-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}
.opt-pill input { accent-color: var(--primary); cursor: pointer; }
.labels-product-list {
    flex: 1;
    overflow-y: auto;
    max-height: 520px;
}
.labels-prod-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    gap: 8px;
}
.labels-prod-row:hover { background: var(--hover); }
.lprod-info { flex: 1; min-width: 0; }
.lprod-name { display: block; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lprod-sku  { font-size: 11px; }
.lprod-qty  { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.qty-btn    { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text); line-height: 1; transition: background .12s; display: flex; align-items: center; justify-content: center; }
.qty-btn:hover:not(:disabled) { background: var(--primary); color: #fff; border-color: var(--primary); }
.qty-btn:disabled { opacity: .35; cursor: default; }
.qty-val    { width: 24px; text-align: center; font-size: 13px; font-weight: 600; }

/* Right preview area */
.labels-preview-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 2px;
}
.preview-zoom { font-size: 12px; background: var(--card); border: 1px solid var(--border); padding: 4px 10px; border-radius: 20px; }
.sheet-stack {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 16px;
}

/* The sheet itself */
.sheet {
    display: grid;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
    transform-origin: top left;
    transform: scale(0.62);
    margin-bottom: -375px; /* compensate for scale shrinkage */
    flex-shrink: 0;
}

/* Individual label cells */
.label-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 6px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    gap: 2px;
    background: #fff;
}
.label-cell.label-empty { background: #fafafa; }
.label-name  { font-size: 10px; font-weight: 600; text-align: center; color: #111; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label-price { font-size: 10px; font-weight: 700; color: #111; text-align: center; }
.label-cell svg.barcode-el { max-width: 100%; height: auto; }

/* Shelf strip variant */
.label-shelf {
    flex-direction: row;
    justify-content: flex-start;
    gap: 8px;
    padding: 4px 8px;
}
.label-shelf .label-name  { font-size: 11px; white-space: nowrap; }
.label-shelf .label-price { font-size: 11px; }

/* Price-tag variant */
.label-price-tag { justify-content: center; }
.label-price-big { font-size: 22px; font-weight: 800; color: #111; line-height: 1; }

/* Hidden print target — rendered at full scale */
.print-area { display: none; }
.print-sheet {
    display: grid;
    background: #fff;
    page-break-after: always;
    break-after: page;
}
.print-sheet .label-cell { border: 0.5pt solid #ccc; }

/* Print media: hide everything except print-area */
@media print {
    body.printing * { visibility: hidden; }
    body.printing .print-area,
    body.printing .print-area * { visibility: visible; }
    body.printing .print-area {
        display: block !important;
        position: fixed;
        top: 0; left: 0;
        width: 100vw;
    }
    .print-sheet { page-break-after: always; break-after: page; }
    @page { margin: 0; size: A4; }
}

/* Dark-theme overrides */
[data-theme="dark"] .tpl-card { background: var(--card); }
[data-theme="dark"] .tpl-card.tpl-active { background: rgba(99,102,241,.12); }
[data-theme="dark"] .sheet { background: #1e1e2e; border-color: var(--border); }
[data-theme="dark"] .label-cell { background: #1e1e2e; border-color: var(--border); }
[data-theme="dark"] .label-cell.label-empty { background: #16161e; }
[data-theme="dark"] .label-name, [data-theme="dark"] .label-price, [data-theme="dark"] .label-price-big { color: #e2e8f0; }

/* Responsive */
@media (max-width: 1100px) {
    .labels-layout { grid-template-columns: 1fr; }
    .labels-picker { max-width: 100%; }
    .labels-product-list { max-height: 280px; }
    .sheet { transform: scale(0.45); margin-bottom: -540px; }
}
@media (max-width: 640px) {
    .labels-templates { gap: 6px; padding: 10px; }
    .tpl-card { padding: 6px 10px; }
    .sheet { transform: scale(0.32); margin-bottom: -675px; }
}

/* ═══════════════════════════════════════════════════════
   OWNER VIEW — owner-panel-grid, sparkline, rank extras
   ═══════════════════════════════════════════════════════ */

.owner-panel-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 18px;
    margin-top: 2px;
}

.owner-trend-panel  { padding: 20px; }
.owner-movers-panel { padding: 20px; }

.owner-chart-wrap {
    margin-top: 12px;
    width: 100%;
    overflow: hidden;
}
.sparkline {
    width: 100%;
    height: 180px;
    display: block;
    overflow: visible;
}

/* Rank extras (bar + qty — the base .rank-* rules live in the main block above) */
.rank-bar-wrap { height: 4px; background: var(--bg); border-radius: 99px; margin-top: 5px; overflow: hidden; }
.rank-bar   { height: 100%; background: var(--primary); border-radius: 99px; transition: width .4s ease; }
.rank-right { text-align: right; flex-shrink: 0; }
.rank-qty   { font-size: 11px; color: var(--ink-mute); margin-top: 2px; }
.owner-movers-panel .rank-row:first-child .rank-num { background: var(--accent); color: #fff; }

/* Owner view responsive */
@media (max-width: 1100px) {
    .owner-panel-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════
   APPEARANCE SETTINGS — accent swatches, toggles
   ═══════════════════════════════════════════════════════ */

.appearance-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.appearance-label {
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
}

/* Accent swatches */
.accent-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch-btn {
    width: 30px; height: 30px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform .12s, box-shadow .12s;
    outline: none;
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.swatch-btn:hover { transform: scale(1.15); }
.swatch-btn.swatch-active {
    border-color: #fff;
    box-shadow: 0 0 0 2px currentColor, 0 2px 6px rgba(0,0,0,.2);
    transform: scale(1.1);
}

/* Toggle switch */
.toggle-switch { display: inline-flex; align-items: center; cursor: pointer; }
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
    width: 44px; height: 24px;
    background: var(--border);
    border-radius: 999px;
    position: relative;
    transition: background .2s;
}
.toggle-switch input:checked + .toggle-track { background: var(--primary); }
.toggle-thumb {
    position: absolute;
    top: 3px; left: 3px;
    width: 18px; height: 18px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
    transition: transform .2s;
}
.toggle-switch input:checked + .toggle-track .toggle-thumb { transform: translateX(20px); }

/* Compact density */
.compact .kpi-row   { gap: 10px; }
.compact .vpm-card  { padding: 14px 16px; }
.compact .action-bar{ padding: 10px 0; }
.compact td, .compact th { padding: 8px 12px; }

/* Dark theme — owner view */
[data-theme="dark"] .rank-bar-wrap { background: rgba(255,255,255,.06); }
[data-theme="dark"] .toggle-track  { background: #3f3f50; }
[data-theme="dark"] .swatch-btn.swatch-active { border-color: #1e1e2e; }

/* ═══════════════════════════════════════════════════════
   POS IMPROVEMENTS (Batch 5)
   ═══════════════════════════════════════════════════════ */

/* 3-column payment toggle */
.method-toggle-3 { grid-template-columns: 1fr 1fr 1fr; }

/* Cart discount row */
.discount-row { align-items: center; }
.discount-input-wrap { display: flex; align-items: center; gap: 4px; }
.discount-input-wrap input {
    width: 80px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px;
    font-size: 13px; outline: none; text-align: right;
    background: #fff; color: var(--ink);
}
.discount-input-wrap input:focus { border-color: var(--accent); }
.disc-type-btn {
    width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line);
    background: var(--bg); font-size: 12px; font-weight: 700; cursor: pointer;
    color: var(--ink-soft);
}
.disc-type-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Product card: in-cart state + badge */
.prod-in-cart { border-color: var(--accent) !important; background: var(--accent-50) !important; }
.cart-badge {
    position: absolute; top: -6px; right: -6px;
    background: var(--accent); color: #fff;
    width: 20px; height: 20px; border-radius: 50%;
    font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.prod-card { position: relative; }
.prod-qty-ctrl {
    display: inline-flex; align-items: center; gap: 2px;
    background: var(--accent); border-radius: 8px; overflow: hidden;
}
.prod-qty-btn {
    width: 28px; height: 28px; background: transparent; border: none;
    color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
}
.prod-qty-btn:hover { background: rgba(0,0,0,.15); }
.prod-qty-ctrl span { color: #fff; font-size: 13px; font-weight: 700; min-width: 20px; text-align: center; }

/* Mobile floating cart FAB */
.mobile-cart-fab {
    display: none; /* shown via JS on mobile */
    position: fixed; bottom: 24px; right: 20px; z-index: 400;
    width: 58px; height: 58px; border-radius: 50%;
    background: var(--accent); color: #fff; border: none;
    font-size: 22px; cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,0,0,.25);
    align-items: center; justify-content: center;
}
.mobile-cart-badge {
    position: absolute; top: -4px; right: -4px;
    background: #ef4444; color: #fff;
    min-width: 20px; height: 20px; border-radius: 99px; padding: 0 4px;
    font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}

/* Mobile cart overlay */
.mobile-cart-overlay {
    display: none; position: fixed; inset: 0; z-index: 398;
    background: rgba(0,0,0,.4);
}
.mobile-cart-overlay.active { display: block; }

/* Invoice WhatsApp row */
.inv-wa-row {
    display: flex; gap: 8px; align-items: center;
    padding: 12px 20px; border-top: 1px solid var(--line-soft);
    background: var(--bg); flex-wrap: wrap;
}

/* Invoice edit section */
.inv-edit-section { padding: 16px 0; }

/* ── Mobile POS overrides ── */
@media (max-width: 768px) {
    /* POS: products take full width; cart becomes a slide-up panel */
    .pos-screen { grid-template-columns: 1fr !important; }

    /* Product grid: 2 cols on phone */
    .product-grid { grid-template-columns: repeat(2, 1fr) !important; }

    /* Cart: hidden by default on mobile, shown when .mobile-cart-open */
    .pos-right {
        position: fixed !important;
        bottom: 0; left: 0; right: 0; top: auto !important;
        z-index: 399;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 32px rgba(0,0,0,.2);
        transform: translateY(100%);
        transition: transform .3s cubic-bezier(.32,.72,0,1);
        max-height: 85vh;
        overflow-y: auto;
    }
    .pos-right.mobile-cart-open {
        transform: translateY(0);
    }

    /* Show FAB only on mobile */
    .mobile-cart-fab { display: flex; }

    /* Cart card height on mobile */
    .cart-card { max-height: none; }

    /* Close handle at top of mobile cart */
    .pos-right::before {
        content: '';
        display: block;
        width: 36px; height: 4px;
        background: var(--line);
        border-radius: 99px;
        margin: 10px auto 6px;
    }

    /* Topbar compact on mobile */
    .topbar { gap: 10px; }
    .topbar-left { flex: 1; min-width: 0; }
    .topbar-left > div { min-width: 0; flex: 1; }
    .page-title { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .page-date { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .topbar-actions { gap: 8px; flex-shrink: 0; }
    .topbar-actions > .btn { padding: 8px 10px; font-size: 12px; }
    .topbar-actions > .btn span:not(.spinner) { display: none; }
    .topbar-actions > .btn i { margin: 0; }

    /* Table scroll on mobile */
    .table-card { overflow-x: auto; }
    .data-table { min-width: 540px; }

    /* Modals full-width on mobile */
    .modal { width: 95vw !important; max-width: none !important; border-radius: 16px; }
    .invoice-modal { width: 100vw !important; border-radius: 16px 16px 0 0; margin-top: auto; }

    /* Action bar wrap on mobile */
    .action-bar { flex-wrap: wrap; gap: 10px; }
    .action-bar .actions { flex-wrap: wrap; }

    /* Khata layout single col */
    .khata-layout { grid-template-columns: 1fr !important; }
    .labels-layout { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
    .content { padding: 12px; }
    .topbar  { padding: 12px 14px; }
    .kpi-row { grid-template-columns: 1fr 1fr; }
    .kpi-value { font-size: 20px; }
    .product-grid { grid-template-columns: 1fr 1fr !important; gap: 8px; }
    .prod-card { padding: 10px; min-height: 110px; }
    .prod-name { font-size: 12px; }
    .prod-price { font-size: 14px; }
    .method-toggle-3 { grid-template-columns: 1fr 1fr 1fr; }
    .method-toggle button { padding: 8px 4px; font-size: 11px; gap: 3px; }
    .method-toggle button i { display: none; }
    .inv-foot-actions { flex-wrap: wrap; gap: 6px; }
    .inv-foot-actions .btn { flex: 1; font-size: 12px; padding: 8px; }
}

[data-theme="dark"] .discount-input-wrap input { background: var(--card); }
[data-theme="dark"] .prod-in-cart { background: rgba(99,102,241,.1) !important; }

/* ══════════════════════════════════════════════════════
   INVENTORY — MOBILE (M3 drill-down)
══════════════════════════════════════════════════════ */
#invMobileView { padding: 4px 0; }

.invm-cat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 4px 0 8px;
}
.invm-cat-tile {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
  cursor: pointer; transition: box-shadow 0.15s, border-color 0.15s;
  min-height: 130px;
}
.invm-cat-tile:active { box-shadow: 0 4px 14px rgba(0,0,0,0.1); border-color: var(--accent); }
.invm-tile-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; font-size: 15px; flex-shrink: 0;
}
.invm-tile-name { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.3; margin-top: 10px; }
.invm-tile-meta { font-size: 11.5px; color: var(--ink-mute); }
.invm-tile-foot {
  display: flex; justify-content: space-between; align-items: center; margin-top: auto;
}
.invm-tile-ok   { font-size: 12px; color: var(--ink-mute); font-weight: 500; }
.invm-tile-warn { font-size: 11px; font-weight: 600; color: #b45309; background: #fef3c7; padding: 2px 8px; border-radius: 999px; }
.invm-tile-bad  { font-size: 11px; font-weight: 600; color: #b91c1c; background: #fee2e2; padding: 2px 8px; border-radius: 999px; }
.invm-tile-chevron { font-size: 11px; color: var(--ink-mute); }

/* Drill bar */
.invm-drill-bar {
  display: flex; align-items: center; gap: 12px; padding: 0 0 12px;
}
.invm-drill-back {
  width: 36px; height: 36px; border-radius: 12px; background: var(--bg);
  display: grid; place-items: center; color: var(--ink-soft); flex-shrink: 0;
}
.invm-drill-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.invm-drill-sub   { font-size: 12px; color: var(--ink-mute); margin-top: 2px; }

/* Segmented control */
.invm-seg-wrap {
  background: var(--bg); border-radius: 12px; padding: 3px;
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 2px; margin-bottom: 12px;
}
.invm-seg {
  padding: 8px 4px; border-radius: 9px; font-size: 13px; font-weight: 500;
  color: var(--ink-soft); text-align: center; cursor: pointer;
}
.invm-seg.active {
  background: var(--card); color: var(--ink);
  box-shadow: 0 1px 3px rgba(15,23,42,0.08);
}
.invm-seg-c { font-size: 11px; color: var(--ink-mute); margin-left: 3px; }

/* Product row in drill-down list */
.invm-list { display: flex; flex-direction: column; }
.invm-prow {
  padding: 12px 0; display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.invm-prow:last-child { border-bottom: 0; }
.invm-pname { font-size: 14px; font-weight: 500; color: var(--ink); }
.invm-pmeta { font-size: 11.5px; color: var(--ink-mute); margin-top: 3px; display: flex; gap: 8px; }
.invm-pbc   { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.02em; }
.invm-stock-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; height: 26px; padding: 0 9px; border-radius: 8px;
  font-size: 12.5px; font-weight: 600; flex-shrink: 0;
}
.invm-stock-ok  { background: #ecfdf5; color: #047857; }
.invm-stock-low { background: #fef3c7; color: #b45309; }
.invm-stock-out { background: #fee2e2; color: #b91c1c; }

.invm-empty { text-align: center; padding: 36px 0; color: var(--ink-mute); font-size: 13.5px; }
.invm-empty i { font-size: 26px; margin-bottom: 10px; display: block; color: #10b981; }

/* Mobile-only: hide import label, shrink action bar */
@media (max-width: 640px) {
  .inv-btn-label { display: none; }
  #invSearchWrap  { display: none; }
  #invActionBar   { justify-content: flex-end; padding-bottom: 8px; }
}

/* ══════════════════════════════════════════════════════
   INVENTORY — TABLET (T2 master-detail)
══════════════════════════════════════════════════════ */

/* Integrated topbar (replaces the generic #invActionBar on tablet) */
.invt-topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding-bottom: 14px; flex-wrap: wrap;
}
.invt-topbar-l { flex: 1; min-width: 0; }
.invt-topbar-title { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.invt-topbar-sub   { font-size: 13px; color: var(--ink-mute); margin-top: 3px; }
.invt-topbar-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.invt-search-box {
  width: 280px; background: var(--card); border-radius: 10px;
  padding: 0 14px; height: 40px;
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line);
}
.invt-search-box i { color: var(--ink-mute); font-size: 13px; flex-shrink: 0; }
.invt-search-box input {
  border: none; background: transparent; flex: 1;
  font-size: 14px; color: var(--ink); font-family: inherit;
}
.invt-search-box input:focus { outline: none; }
[data-theme="dark"] .invt-search-box { background: var(--card); }

/* Hide the generic action bar when tablet view is active */
@media (min-width: 641px) and (max-width: 1280px) {
  #invActionBar { display: none; }
}

/* Master-detail body — fills remaining viewport, rail+detail scroll independently */
.invt-body {
  display: grid; grid-template-columns: 240px 1fr;
  border-radius: 14px; border: 1px solid var(--line); overflow: hidden;
  /* 1025-1280px: app topbar ~78px + content pad 24px + invt-topbar ~70px + buffer */
  height: calc(100vh - 205px);
  min-height: 400px;
}
/* At ≤1024px the topbar is shorter and padding is smaller */
@media (max-width: 1024px) {
  .invt-body { height: calc(100vh - 165px); }
}
.invt-rail {
  border-right: 1px solid var(--line); padding: 12px 10px;
  overflow-y: auto; background: var(--card);
  /* must have overflow-y:auto + height from grid parent to actually scroll */
  min-height: 0;
}
.invt-rail-head {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-mute); padding: 4px 10px 8px;
}
.invt-rail-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 9px;
  font-size: 13.5px; color: var(--ink-soft);
  cursor: pointer; transition: background 0.12s; width: 100%;
}
.invt-rail-item:hover { background: var(--bg); }
.invt-rail-item.active { background: var(--accent-50) !important; color: var(--accent) !important; }
.invt-rail-name { flex: 1; font-weight: 500; text-align: left; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invt-rail-count { font-size: 12px; color: var(--ink-mute); flex-shrink: 0; }
.invt-rail-item.active .invt-rail-count { color: var(--accent); opacity: 0.8; }
.invt-rail-warn { color: var(--amber); font-size: 9px; flex-shrink: 0; }

.invt-detail { padding: 20px 22px; overflow-y: auto; background: var(--bg); min-height: 0; }
.invt-detail-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 14px; gap: 12px; flex-wrap: wrap;
}
.invt-detail-title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.invt-detail-sub   { font-size: 12.5px; color: var(--ink-mute); margin-top: 3px; }
.invt-detail-stats { display: flex; gap: 22px; flex-shrink: 0; }
.invt-stat-l { font-size: 10.5px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.invt-stat-v { font-size: 17px; font-weight: 600; color: var(--ink); margin-top: 2px; }
.invt-stat-v.warn { color: var(--amber); }
.invt-stat-v.bad  { color: #b91c1c; }

.invt-table { background: var(--card); border-radius: 12px; border: 1px solid var(--line); overflow: hidden; }
.invt-thead {
  display: grid; grid-template-columns: 2.4fr 1.2fr 0.8fr 90px;
  padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line);
  font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-mute);
}
.invt-trow {
  display: grid; grid-template-columns: 2.4fr 1.2fr 0.8fr 90px;
  padding: 11px 16px; align-items: center; border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px; cursor: pointer; transition: background 0.1s;
}
.invt-trow:last-child { border-bottom: 0; }
.invt-trow:hover { background: var(--bg); }
.invt-tname { font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invt-tbc   { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--ink-mute); margin-top: 2px; }
.invt-tprice { font-weight: 500; color: var(--ink-soft); font-size: 13px; }

[data-theme="dark"] .invt-table  { background: var(--card); }
[data-theme="dark"] .invt-detail { background: rgba(0,0,0,.15); }
[data-theme="dark"] .invt-rail   { background: var(--card); }

/* ══════════════════════════════════════
   Multi-location stock & Transfer modal
══════════════════════════════════════ */
.loc-stock { line-height: 1.3; }
.loc-stock-total { font-size: 14px; font-weight: 600; color: var(--ink); }
.loc-stock-breakdown { font-size: 11px; color: var(--ink-mute); margin-top: 2px; font-family: 'JetBrains Mono', monospace; }
.loc-stock-shop { color: var(--accent); font-weight: 600; }

.xfer-locgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.xfer-loc-card {
    border: 1px solid var(--line); border-radius: 12px; padding: 14px;
    background: var(--bg);
}
.xfer-loc-card .xfer-loc-label { font-size: 11px; font-weight: 600; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.04em; }
.xfer-loc-card select { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); margin-top: 6px; background: #fff; font-size: 13.5px; }
.xfer-loc-qty { font-size: 12px; color: var(--ink-mute); margin-top: 6px; }
.xfer-loc-qty strong { color: var(--ink); }

.xfer-arrow {
    display: grid; place-items: center; padding: 12px 0;
    color: var(--accent); font-size: 20px;
}

/* Bell popover */
.bell-wrap { position: relative; }
.bell-pop {
    display: none;
    position: absolute; top: calc(100% + 8px); right: 0;
    width: 340px; max-width: 90vw;
    background: #fff; border: 1px solid var(--line);
    border-radius: 14px; box-shadow: 0 20px 40px rgba(15,23,42,0.18);
    z-index: 90; overflow: hidden;
}
.bell-wrap.open .bell-pop { display: block; }
.bell-pop-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.bell-pop-head h4 { font-size: 14px; margin: 0; }
.bell-pop-body { max-height: 360px; overflow-y: auto; }
.bell-pop-empty { padding: 24px 16px; text-align: center; color: var(--ink-mute); font-size: 13px; }
.bell-section-title { padding: 10px 16px 6px; font-size: 11px; font-weight: 600; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.04em; background: var(--bg); }
.bell-item { padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line-soft); }
.bell-item:last-child { border-bottom: 0; }
.bell-item-name { font-size: 13px; color: var(--ink); }
.bell-item-cat { font-size: 11px; color: var(--ink-mute); }
.bell-item-qty { font-size: 12px; font-weight: 600; }
.bell-item-qty.out { color: #b91c1c; }
.bell-item-qty.low { color: #b45309; }

[data-theme="dark"] .bell-pop { background: var(--card); }
[data-theme="dark"] .bell-section-title { background: rgba(255,255,255,0.04); }

/* ══════════════════════════════════════
   Inventory: location overview & header
══════════════════════════════════════ */
.invloc-header { margin-bottom: 18px; }
.invloc-title { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.invloc-sub   { font-size: 13.5px; color: var(--ink-mute); margin-top: 4px; }

.invloc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}
.invloc-tile {
    background: var(--card); border: 1px solid var(--line); border-radius: 16px;
    padding: 22px 20px; cursor: pointer; min-height: 180px;
    display: flex; flex-direction: column; gap: 10px;
    transition: transform 0.12s, box-shadow 0.15s, border-color 0.15s;
    position: relative;
}
.invloc-tile:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15,23,42,0.08); border-color: var(--loc-color); }
.invloc-icon {
    width: 48px; height: 48px; border-radius: 14px;
    display: grid; place-items: center; font-size: 20px;
}
.invloc-name { font-size: 17px; font-weight: 600; color: var(--ink); }
.invloc-stats { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.invloc-line { font-size: 12.5px; color: var(--ink-mute); display: flex; align-items: center; gap: 8px; }
.invloc-line i { color: var(--loc-color); width: 14px; font-size: 11px; }
.invloc-foot {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: auto; gap: 8px; flex-wrap: wrap;
}
.invloc-badge { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; }
.invloc-badge-low { color: #b45309; background: #fef3c7; }
.invloc-badge-out { color: #b91c1c; background: #fee2e2; }
.invloc-arrow { color: var(--loc-color); font-size: 14px; margin-left: auto; }

/* Location breadcrumb header (above table) */
.invloc-bar {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 14px; padding: 12px 16px;
    background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
}
.invloc-back {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 8px;
    background: var(--card); border: 1px solid var(--line);
    font-size: 12.5px; font-weight: 500; color: var(--ink-soft);
    cursor: pointer; transition: background 0.12s, color 0.12s;
}
.invloc-back:hover { background: var(--accent-50); color: var(--accent); border-color: var(--accent); }
.invloc-crumb { display: flex; align-items: center; gap: 10px; }
.invloc-crumb-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 14px; }
.invloc-crumb-name { font-size: 15px; font-weight: 600; color: var(--ink); }

/* POS: "Available in" hint when shop is out */
.pos-elsewhere {
    margin-top: 8px; padding: 8px 10px;
    background: #fef3c7; color: #92400e;
    font-size: 11.5px; border-radius: 8px;
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.pos-elsewhere i { color: #b45309; font-size: 11px; }
.pos-xfer-btn {
    margin-left: auto; padding: 3px 10px; border-radius: 999px;
    background: #b45309; color: #fff; font-size: 11px; font-weight: 600;
    cursor: pointer; border: 0;
}
.pos-xfer-btn:hover { background: #92400e; }

@media (max-width: 640px) {
    .invloc-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .invloc-tile { padding: 16px 14px; min-height: 160px; }
    .invloc-name { font-size: 15px; }
    .invloc-icon { width: 40px; height: 40px; font-size: 18px; }
}

/* ══════════════════════════════════════
   Stock shortage modal (POS overstock)
══════════════════════════════════════ */
.short-head { margin-bottom: 14px; }
.short-prod { font-size: 17px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.short-line { font-size: 13px; color: var(--ink-mute); }
.short-line strong { color: var(--ink); }

.short-godowns {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
    margin-bottom: 16px;
}
.short-godown {
    text-align: center; padding: 14px 8px;
    background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
}
.short-godown.has-stock { background: #ecfdf5; border-color: #a7f3d0; }
.short-godown.empty     { opacity: 0.55; }
.short-godown i { color: var(--ink-mute); font-size: 18px; margin-bottom: 6px; display: block; }
.short-godown.has-stock i { color: #059669; }
.short-godown-name { font-size: 11.5px; color: var(--ink-soft); font-weight: 500; margin-bottom: 4px; }
.short-godown-qty  { font-size: 20px; font-weight: 700; color: var(--ink); }

.short-transfer-card {
    background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
    padding: 14px; margin-bottom: 14px;
}
.short-section-title { font-size: 12px; font-weight: 600; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 10px; }
.short-hint { font-size: 12px; margin-top: 6px; }
.short-warn {
    padding: 10px 12px; background: #fef3c7; color: #92400e;
    font-size: 12.5px; border-radius: 8px; margin-bottom: 12px;
    display: flex; align-items: center; gap: 8px;
}
.short-empty {
    text-align: center; padding: 24px 16px;
    background: var(--bg); border-radius: 12px; margin-bottom: 14px;
}
.short-empty i { font-size: 28px; color: var(--ink-mute); display: block; margin-bottom: 10px; }
.short-empty small { display: block; margin-top: 6px; color: var(--ink-mute); font-size: 12px; }
.short-actions .field { margin-bottom: 10px; }

/* Reorder list */
.reorder-list { display: flex; flex-direction: column; gap: 10px; }
.reorder-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; background: var(--bg);
    border: 1px solid var(--line); border-radius: 10px;
}
.reorder-main { flex: 1; min-width: 0; }
.reorder-name { font-weight: 600; color: var(--ink); font-size: 14px; }
.reorder-meta { font-size: 12px; color: var(--ink-mute); margin-top: 2px; }
.reorder-note { font-size: 12px; color: var(--ink-soft); margin-top: 4px; font-style: italic; }
.reorder-qty { text-align: right; padding: 0 8px; }
.reorder-qty-label { font-size: 10.5px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.04em; display: block; }
.reorder-qty strong { font-size: 18px; color: var(--accent); }

[data-theme="dark"] .short-godown.has-stock { background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.3); }
[data-theme="dark"] .short-warn  { background: rgba(245,158,11,0.12); color: #fbbf24; }

/* ══════════════════════════════════════
   Typeable quantity inputs (POS / labels / cart)
══════════════════════════════════════ */
.prod-qty-input, .cart-qty-input, .qty-input {
    width: 48px; text-align: center;
    border: 1px solid var(--line); border-radius: 6px;
    padding: 4px 0; font-size: 13px; font-weight: 600;
    background: #fff; color: var(--ink);
    -moz-appearance: textfield;
}
.prod-qty-input::-webkit-outer-spin-button,
.cart-qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-outer-spin-button,
.prod-qty-input::-webkit-inner-spin-button,
.cart-qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.prod-qty-input:focus, .cart-qty-input:focus, .qty-input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(79,70,229,0.18);
}
.prod-qty-input { width: 40px; padding: 2px 0; }
.cart-qty-input { width: 52px; }

/* ══════════════════════════════════════
   Inline-editable inventory cells (admin)
══════════════════════════════════════ */
.inv-edit-cell {
    cursor: text; padding: 4px 8px; border-radius: 6px;
    transition: background 0.12s, box-shadow 0.12s;
    display: inline-block; min-width: 60px;
}
.inv-edit-cell:hover { background: var(--accent-50); box-shadow: inset 0 0 0 1px var(--accent-100); }
.inv-edit-cell.editing { background: #fff; box-shadow: inset 0 0 0 2px var(--accent); padding: 2px 6px; }
.inv-edit-cell input {
    border: 0; outline: 0; background: transparent;
    width: 100%; font: inherit; color: inherit; padding: 2px 0;
}
.inv-edit-saved { animation: inv-edit-flash 0.6s ease; }
@keyframes inv-edit-flash {
    0%   { background: #d1fae5; }
    100% { background: transparent; }
}

[data-theme="dark"] .prod-qty-input,
[data-theme="dark"] .cart-qty-input,
[data-theme="dark"] .qty-input { background: var(--card); color: var(--ink); }
