/* ── RESET & BASE ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

:root {
  --bg:           #0d0d0d;
  --surface:      #151515;
  --surface-2:    #1c1c1c;
  --border:       #2a2a2a;
  --border-soft:  #222;
  --text:         #f0ede8;
  --text-muted:   #888;
  --text-dim:     #555;
  --gold:         #c9a96e;
  --gold-2:       #e2c08a;
  --gold-soft:    rgba(201,169,110,0.12);
  --gold-border:  rgba(201,169,110,0.3);
  --red:          #c0392b;
  --red-soft:     rgba(192,57,43,0.12);
  --green:        #27ae60;
  --green-soft:   rgba(39,174,96,0.12);
  --blue:         #2980b9;
  --blue-soft:    rgba(41,128,185,0.12);
  --sidebar-w:    220px;
  --header-h:     56px;
  --radius:       6px;
  --radius-sm:    4px;
  --shadow:       0 2px 12px rgba(0,0,0,0.4);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.5);
  --transition:   .15s ease;
  --font:         'Inter', system-ui, -apple-system, sans-serif;
}

html { font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
img { display: block; }

/* ── SCROLLBAR ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

/* ── LAYOUT ───────────────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
}
.sidebar__logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar__logo-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold);
}
.sidebar__logo-sub {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: .10em;
  text-transform: uppercase;
  margin-top: 2px;
}
.sidebar__nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}
.nav-section {
  padding: 16px 16px 6px;
  font-size: 9px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.active {
  color: var(--gold);
  background: var(--gold-soft);
  border-left-color: var(--gold);
}
.nav-link__icon {
  width: 16px; height: 16px;
  opacity: .7;
  flex-shrink: 0;
}
.nav-link.active .nav-link__icon { opacity: 1; }
.sidebar__footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar__user {
  font-size: 12px;
  color: var(--text-muted);
}
.sidebar__user strong { color: var(--text); display: block; font-size: 13px; }
.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* Main content area */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar__title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .04em;
}
.topbar__meta {
  font-size: 12px;
  color: var(--text-muted);
}
.page { padding: 28px; flex: 1; }

/* ── CARDS ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.card__title {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ── STAT CARDS ───────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-card__label {
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.stat-card__value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
  line-height: 1;
}
.stat-card__value--gold { color: var(--gold); }
.stat-card__value--red  { color: var(--red); }
.stat-card__value--green{ color: var(--green); }
.stat-card__sub {
  font-size: 11px;
  color: var(--text-dim);
}

/* ── GRID LAYOUTS ─────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.col-span-2 { grid-column: span 2; }

/* ── TABLE ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border-soft);
  transition: background var(--transition);
}
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child { border-bottom: 0; }
tbody td {
  padding: 12px 14px;
  color: var(--text);
  vertical-align: middle;
}
td.muted { color: var(--text-muted); }
td.gold  { color: var(--gold); font-weight: 600; }

/* ── BADGE ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.badge--pending  { background: var(--gold-soft);  color: var(--gold); }
.badge--delivered{ background: var(--green-soft); color: var(--green); }
.badge--cancelled{ background: var(--red-soft);   color: var(--red); }
.badge--low      { background: var(--red-soft);   color: var(--red); }
.badge--ok       { background: var(--green-soft); color: var(--green); }

/* ── BUTTONS ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .04em;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--primary {
  background: var(--gold);
  color: #0d0d0d;
  border-color: var(--gold);
  font-weight: 600;
}
.btn--primary:hover:not(:disabled) { background: var(--gold-2); border-color: var(--gold-2); }
.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.btn--ghost:hover:not(:disabled) { border-color: var(--gold-border); color: var(--text); }
.btn--danger {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red);
}
.btn--danger:hover:not(:disabled) { background: var(--red); color: #fff; }
.btn--sm { padding: 5px 10px; font-size: 11px; }
.btn--icon {
  width: 30px; height: 30px;
  padding: 0;
  justify-content: center;
  border-radius: var(--radius-sm);
}

/* ── FORMS ────────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 11px;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.form-input, .form-select, .form-textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 12px;
  font-size: 13px;
  width: 100%;
  transition: border-color var(--transition);
  outline: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus { border-color: var(--gold-border); }
.form-input::placeholder { color: var(--text-dim); }
.form-select { cursor: pointer; }
.form-select option { background: var(--surface-2); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── CHART ────────────────────────────────────────────────────────────────── */
.chart-wrap {
  position: relative;
  height: 200px;
}

/* ── PRODUCT PICKER ───────────────────────────────────────────────────────── */
.product-search-wrap { position: relative; }
.product-dropdown {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 240px;
  overflow-y: auto;
  z-index: 200;
  display: none;
}
.product-dropdown.open { display: block; }
.product-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border-soft);
}
.product-option:last-child { border-bottom: 0; }
.product-option:hover { background: var(--surface); }
.product-option img {
  width: 36px; height: 36px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--surface);
  flex-shrink: 0;
}
.product-option__name { font-size: 13px; font-weight: 500; }
.product-option__meta { font-size: 11px; color: var(--text-muted); }

/* ── RECEIPT ITEMS ────────────────────────────────────────────────────────── */
.receipt-items { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.receipt-item {
  display: grid;
  grid-template-columns: 40px 1fr 90px 90px 30px;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.receipt-item img {
  width: 40px; height: 40px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.receipt-item__name { font-size: 13px; font-weight: 500; }
.receipt-item__meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.receipt-item__remove {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 16px;
  padding: 0;
  line-height: 1;
  transition: color var(--transition);
}
.receipt-item__remove:hover { color: var(--red); }

/* ── TOTAL BAR ────────────────────────────────────────────────────────────── */
.total-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-top: 16px;
}
.total-bar__label { font-size: 12px; letter-spacing: .10em; text-transform: uppercase; color: var(--text-muted); }
.total-bar__amount { font-size: 22px; font-weight: 700; color: var(--gold); }

/* ── INVENTORY GRID ───────────────────────────────────────────────────────── */
.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.inv-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.inv-card__img {
  width: 100%; height: 160px;
  object-fit: contain;
  background: var(--surface-2);
  padding: 10px;
}
.inv-card__body { padding: 12px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.inv-card__name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.inv-card__meta { font-size: 11px; color: var(--text-muted); }
.inv-card__price { font-size: 13px; color: var(--gold); font-weight: 600; }
.inv-card__stock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}
.stock-label { font-size: 11px; color: var(--text-muted); }
.stock-value { font-size: 15px; font-weight: 700; }
.stock-value--low { color: var(--red); }
.stock-value--ok  { color: var(--green); }
.stock-controls { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.stock-controls input {
  width: 54px;
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 5px;
  font-size: 13px;
  font-weight: 600;
  -moz-appearance: textfield;
}
.stock-controls input::-webkit-outer-spin-button,
.stock-controls input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stock-btn {
  width: 28px; height: 28px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  display: grid; place-items: center;
  transition: all var(--transition);
}
.stock-btn:hover { border-color: var(--gold-border); color: var(--gold); }

/* ── MODAL ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: none;
  place-items: center;
}
.modal-overlay.open { display: grid; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: min(640px, calc(100vw - 32px));
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--surface);
  z-index: 1;
}
.modal__title { font-size: 15px; font-weight: 600; }
.modal__close {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  transition: color var(--transition);
}
.modal__close:hover { color: var(--text); }
.modal__body { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.modal__foot {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── RECEIPT DETAIL ───────────────────────────────────────────────────────── */
.receipt-detail__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}
.receipt-detail__customer strong { display: block; font-size: 15px; margin-bottom: 4px; }
.receipt-detail__customer span { font-size: 12px; color: var(--text-muted); display: block; line-height: 1.8; }

/* ── TOOLBAR ──────────────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.toolbar__left { display: flex; align-items: center; gap: 10px; }
.toolbar__right { display: flex; align-items: center; gap: 10px; }

/* ── SEARCH ───────────────────────────────────────────────────────────────── */
.search-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  width: 240px;
  outline: none;
  transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--gold-border); }
.search-input::placeholder { color: var(--text-dim); }

/* ── TOAST ────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 999;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: slideIn .2s ease;
  display: flex; align-items: center; gap: 10px;
  min-width: 260px;
}
.toast--success { border-left: 3px solid var(--green); }
.toast--error   { border-left: 3px solid var(--red); }
.toast--info    { border-left: 3px solid var(--gold); }
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── EMPTY STATE ──────────────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty__icon { font-size: 40px; margin-bottom: 12px; opacity: .4; }
.empty__title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty__sub { font-size: 13px; }

/* ── SPINNER ──────────────────────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 48px; color: var(--text-muted);
}

/* ── LOGIN PAGE ───────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 16px;
}
.login-box {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 28px;
  box-shadow: var(--shadow-lg);
}
.login-box__logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-box__logo-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
}
.login-box__logo-sub {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-top: 4px;
}
.login-box__title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}
.login-box__sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-error {
  background: var(--red-soft);
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--red);
  display: none;
}
.login-error.visible { display: block; }

/* ── TOP PRODUCT ITEM ─────────────────────────────────────────────────────── */
.top-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}
.top-item:last-child { border-bottom: 0; }
.top-item__rank {
  width: 22px; height: 22px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: grid; place-items: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}
.top-item:first-child .top-item__rank { background: var(--gold-soft); color: var(--gold); }
.top-item__name { flex: 1; font-size: 13px; font-weight: 500; }
.top-item__sold { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.top-item__revenue { font-size: 13px; font-weight: 600; color: var(--gold); white-space: nowrap; }

/* ── LOW STOCK LIST ───────────────────────────────────────────────────────── */
.low-stock-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-soft);
  gap: 10px;
}
.low-stock-item:last-child { border-bottom: 0; }
.low-stock-item__name { font-size: 13px; flex: 1; }
.low-stock-item__qty {
  font-size: 12px;
  font-weight: 700;
  color: var(--red);
  background: var(--red-soft);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

/* ── DATA TABLE ───────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody tr {
  border-bottom: 1px solid var(--border-soft);
  transition: background var(--transition);
}
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child { border-bottom: 0; }
.data-table tbody td {
  padding: 12px 14px;
  color: var(--text);
  vertical-align: middle;
}

/* ── PRODUCT PICKER ───────────────────────────────────────────────────────── */
.product-picker { position: relative; }
.product-picker__dropdown {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 280px;
  overflow-y: auto;
  z-index: 200;
  display: none;
}
.product-picker__dropdown.open { display: block; }
.picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-soft);
  transition: background var(--transition);
}
.picker-item:last-child { border-bottom: 0; }
.picker-item:hover { background: var(--surface); }
.picker-item--empty { color: var(--text-muted); font-size: 12px; cursor: default; }
.picker-item__img {
  width: 36px; height: 36px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--surface);
  flex-shrink: 0;
}
.picker-item__name { font-size: 13px; font-weight: 500; }
.picker-item__meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

/* ── RECEIPT ITEM (new receipt) ───────────────────────────────────────────── */
.receipt-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.receipt-item__img {
  width: 40px; height: 40px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--surface);
  flex-shrink: 0;
}
.receipt-item__name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  min-width: 0;
}
.receipt-item__cat {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 1px;
}
.receipt-item__controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.receipt-item__sub {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  min-width: 60px;
  text-align: right;
}
.btn-remove {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  transition: color var(--transition);
}
.btn-remove:hover { color: var(--red); }

/* ── MODAL WIDE ───────────────────────────────────────────────────────────── */
.modal--wide { width: min(820px, calc(100vw - 32px)); }

/* ── STATUS SELECT ────────────────────────────────────────────────────────── */
.status-select {
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  outline: none;
}
.status-select option { background: var(--surface-2); color: var(--text); }

/* ── HAMBURGER BUTTON ─────────────────────────────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column; justify-content: center; gap: 5px;
  width: 36px; height: 36px; padding: 6px;
  background: transparent; border: none; cursor: pointer;
  flex-shrink: 0;
}
.hamburger span {
  display: block; height: 2px; background: var(--text);
  border-radius: 2px; transition: all .25s ease;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

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

/* ── BOTTOM NAV (mobile) ──────────────────────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 60px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 90;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav__inner {
  display: flex; height: 100%;
}
.bottom-nav__item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--text-muted); font-size: 10px; letter-spacing: .04em;
  text-decoration: none; transition: color var(--transition);
  border: none; background: none; cursor: pointer;
}
.bottom-nav__item svg { width: 20px; height: 20px; }
.bottom-nav__item.active { color: var(--gold); }
.bottom-nav__item:hover { color: var(--text); }

/* ── RESPONSIVE ───────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  /* Sidebar — slides in as overlay */
  .sidebar {
    position: fixed; top: 0; left: 0;
    height: 100vh; z-index: 100;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: flex; }

  /* Main — full width, no left margin, bottom padding for bottom nav */
  .main { margin-left: 0; padding-bottom: 60px; }
  .topbar { padding: 0 16px; gap: 10px; }
  .topbar__title { font-size: 14px; }
  .topbar__meta { display: none; }
  .page { padding: 16px 14px; }

  /* Bottom nav visible */
  .bottom-nav { display: block; }

  /* KPI / stats grids */
  .kpi-grid,
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

  /* Charts */
  .charts-row,
  .bottom-row,
  .grid-2,
  .grid-3 { grid-template-columns: 1fr; gap: 12px; }

  /* Forms */
  .form-row,
  .form-row-3 { grid-template-columns: 1fr; gap: 12px; }

  /* Cards */
  .card { padding: 14px 14px; }
  .card__title { font-size: 10px; margin-bottom: 10px; }

  /* Modals — full screen on mobile */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal,
  .modal--wide {
    width: 100vw;
    max-height: 92vh;
    border-radius: var(--radius) var(--radius) 0 0;
    border-left: none; border-right: none; border-bottom: none;
  }
  .modal__body { padding: 16px; gap: 12px; }
  .modal__head { padding: 14px 16px; }
  .modal__foot { padding: 12px 16px; }

  /* Inventory grid — 2 cols */
  .inv-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .inv-card__img { height: 120px; }
  .inv-card__body { padding: 10px; gap: 5px; }
  .inv-card__name { font-size: 12px; }
  .stock-controls { gap: 4px; flex-wrap: wrap; }
  .stock-btn { width: 26px; height: 26px; }

  /* Receipt controls */
  .receipt-item {
    flex-wrap: wrap;
    gap: 8px;
  }
  .receipt-item__controls {
    width: 100%;
    justify-content: flex-end;
  }

  /* Toolbar */
  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .toolbar__left { flex-direction: column; gap: 8px; }
  .search-input { width: 100%; }
  .form-select[id="categoryFilter"],
  .form-select[id="statusFilter"] { width: 100% !important; }

  /* Table → hide on mobile, replaced by cards */
  .receipts-table-desktop { display: none !important; }
  .receipts-cards-mobile { display: flex !important; }

  /* Alltime bar */
  .alltime-bar { grid-template-columns: 1fr 1fr; }
  .alltime-stat:nth-child(3) { grid-column: 1 / -1; border-right: 0; border-top: 1px solid var(--border); }

  /* Buttons */
  .btn--sm { padding: 6px 10px; }
}

@media (max-width: 430px) {
  .kpi-grid,
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 14px 12px; }
  .kpi__value { font-size: 22px; }
  .kpi__icon { font-size: 16px; margin-bottom: 6px; }
  .page { padding: 12px 10px; }
  .inv-grid { gap: 8px; }
  .alltime-bar { grid-template-columns: 1fr; }
  .alltime-stat { border-right: 0 !important; border-top: 1px solid var(--border); }
  .alltime-stat:first-child { border-top: 0; }
}

/* ── RECEIPT MOBILE CARDS ─────────────────────────────────────────────────── */
.receipts-cards-mobile {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}
.r-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.r-card__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
}
.r-card__name { font-size: 14px; font-weight: 600; }
.r-card__phone { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.r-card__date { font-size: 11px; color: var(--text-dim); text-align: right; white-space: nowrap; }
.r-card__foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 10px; border-top: 1px solid var(--border-soft);
}
.r-card__total { font-size: 16px; font-weight: 700; color: var(--gold); }
.r-card__status-wrap { display: flex; align-items: center; gap: 8px; }

/* Safe area bottom padding for phones with home bar */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .main { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .bottom-nav { padding-bottom: env(safe-area-inset-bottom); height: calc(60px + env(safe-area-inset-bottom)); }
}
