:root {
  --navy: #0F1729;
  --navy-light: #1B2A4A;
  --orange: #E8772E;
  --orange-dark: #D4651E;
  --bg: #F4F5F7;
  --card-bg: #FFFFFF;
  --border: #E3E5E9;
  --text: #1A1D29;
  --text-muted: #6B7280;
  --text-faint: #9CA3AF;
  --green: #1E8E5A;
  --red-bg: #FDEDEE;
  --red-text: #C0392B;
  --amber-bg: #FFF6E0;
  --radius: 8px;
  --mono: 'SF Mono', 'Consolas', 'Menlo', monospace;
  --rule: #E3E5E9;
  --tl: #F0F4FA;
  --td: #E8772E;
  --tm: #0F1729;
  --grey: #6B7280;
  --danger: #C0392B;
  --warn: #D4651E;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }

/* ── Topbar ── */
.topbar {
  background: var(--tm); color: #fff; display: flex;
  align-items: center; justify-content: space-between;
  padding: 0 20px; min-height: 56px; flex-shrink: 0;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.topbar-brand { font-size: 1.1rem; font-weight: 800; letter-spacing: -.02em; }
.topbar-accent { color: var(--td); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user { color: rgba(255,255,255,.78); font-size: .82rem; font-weight: 600; }

/* ── Hamburger + Dropdown ── */
.hamburger-wrap { position: relative; }
.hamburger-btn {
  background: none; border: 1px solid rgba(255,255,255,.25);
  border-radius: 6px; color: rgba(255,255,255,.7);
  cursor: pointer; font-size: 1.1rem; padding: 6px 10px;
  line-height: 1; transition: all .15s;
}
.hamburger-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.dropdown-menu {
  display: none; position: absolute; right: 0; top: 40px;
  background: #fff; border-radius: 8px; box-shadow: 0 8px 30px rgba(0,0,0,.2);
  min-width: 200px; z-index: 100; overflow: hidden;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  display: block; padding: 11px 18px; font-size: 13.5px; font-weight: 500;
  color: var(--text); transition: background .1s;
}
.dropdown-item:hover { background: #F4F5F7; }
.dropdown-item.active { background: #FDEEDD; color: var(--orange-dark); font-weight: 700; }
.dropdown-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.dropdown-muted { color: var(--text-faint); }

/* ── Tab bar ── */
.tab-bar {
  background: #fff; border-bottom: 2px solid var(--rule);
  display: flex; overflow-x: auto;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
  flex-shrink: 0;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab {
  padding: 10px 16px; font-size: 12px; font-weight: 700;
  cursor: pointer; color: var(--grey);
  border-bottom: 3px solid transparent; margin-bottom: -2px;
  user-select: none; white-space: nowrap; flex-shrink: 0;
  text-align: center; transition: color .15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--td); border-bottom-color: var(--td); }
.tab.admin-tab { color: var(--grey); }
.tab.admin-tab.active { color: var(--td); border-bottom-color: var(--td); }

/* ── Login / Numpad ── */
.login-body { background: var(--navy); display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card { background: #fff; border-radius: 12px; padding: 32px 28px; width: 100%; max-width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,0.35); }
.login-brand { font-weight: 800; font-size: 22px; color: var(--navy); text-align: center; }
.login-sub { text-align: center; color: var(--text-muted); font-size: 13px; margin: 4px 0 18px; }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 16px 0 20px; }
.pin-dot {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border); background: #fff; transition: all .15s;
}
.pin-dot.filled { background: var(--orange); border-color: var(--orange); }
.numpad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px;
}
.numpad button {
  padding: 16px; font-size: 18px; font-weight: 600;
  border: 1px solid var(--rule); border-radius: 8px;
  background: #fff; cursor: pointer; color: var(--text);
  transition: all .15s; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.numpad button:active { background: var(--tl); transform: scale(.96); }
.numpad button.numpad-clear { color: var(--danger); }

/* ── Page content ── */
.page { max-width: 1400px; margin: 0 auto; padding: 24px 20px 80px; }
.page-title { font-size: 24px; font-weight: 800; margin: 0 0 2px; color: var(--text); }
.page-subtitle { color: var(--text-muted); font-size: 14px; margin: 0 0 20px; }

/* ── Cards, forms, tables (kept from original) ── */
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 20px; }
.filter-bar { padding: 20px 24px; display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; }
.filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-group.grow { flex: 1; min-width: 260px; }
.filter-label { font-size: 11px; font-weight: 700; letter-spacing: 0.6px; color: var(--text-faint); text-transform: uppercase; }
.input, .select {
  border: 1px solid var(--border); border-radius: 6px; padding: 9px 12px; font-size: 13.5px;
  background: #fff; color: var(--text); font-family: inherit;
}
.input:focus, .select:focus { outline: 2px solid var(--orange); outline-offset: -1px; }
.input { width: 100%; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: #fff; color: var(--text); font-size: 13px;
  font-weight: 600; padding: 8px 16px; border-radius: 6px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: #F7F8FA; }
.btn-primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); border-color: var(--orange-dark); }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-outline-block { width: 100%; justify-content: center; }

.checkbox-row { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-muted); padding-bottom: 9px; }
.checkbox-row input { width: 15px; height: 15px; accent-color: var(--orange); }

.table-wrap { overflow-x: auto; }
table.price-table { width: 100%; border-collapse: collapse; }
.price-table thead th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.6px; color: var(--text-faint);
  text-transform: uppercase; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.price-table thead th.num { text-align: right; }
.price-table tbody td { padding: 13px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.price-table tbody td.num { text-align: right; font-family: var(--mono); font-size: 13px; }
.price-table tbody tr.product-row { cursor: pointer; transition: background 0.12s; }
.price-table tbody tr.product-row:hover { background: #FAFBFC; }

.product-name { font-weight: 600; }
.product-toggle {
  display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
  border: 1px solid var(--border); border-radius: 4px; font-size: 12px; color: var(--text-muted);
  margin-right: 8px; transition: transform 0.15s;
}
tr.expanded .product-toggle { transform: rotate(90deg); }
.unit-tag { font-size: 11px; color: var(--text-faint); font-style: italic; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 100px; font-size: 11.5px; font-weight: 700; }
.pill-alert { background: #FBE2E4; color: var(--red-text); }
.pill-flag { background: var(--amber-bg); color: #92660C; margin-left: 6px; }
.count-badge { font-size: 12px; color: var(--text-muted); background: #F0F1F4; padding: 2px 9px; border-radius: 100px; font-weight: 600; }

.history-row td { padding: 0; background: #FAFAFB; }
.history-panel { padding: 4px 14px 16px 46px; }
.history-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.history-table th {
  text-align: left; font-size: 10.5px; font-weight: 700; color: var(--text-faint); text-transform: uppercase;
  letter-spacing: 0.5px; padding: 8px 12px; background: #F7F8FA; border-bottom: 1px solid var(--border);
}
.history-table th.num { text-align: right; }
.history-table td { padding: 8px 12px; font-size: 12.5px; border-bottom: 1px solid #F0F1F3; }
.history-table td.num { text-align: right; font-family: var(--mono); }
.history-table tr:last-child td { border-bottom: none; }
.history-loading { padding: 16px; color: var(--text-muted); font-size: 13px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state h3 { color: var(--text); margin-bottom: 6px; }

.form-card { max-width: 560px; padding: 28px; }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.error-banner { background: var(--red-bg); color: var(--red-text); padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; }
.hint { font-size: 12px; color: var(--text-faint); margin-top: 4px; }

.flash-stack { margin-bottom: 18px; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 11px 16px; border-radius: 6px; font-size: 13.5px; font-weight: 500; }
.flash-success { background: #E6F4EC; color: var(--green); }
.flash-error { background: var(--red-bg); color: var(--red-text); }

.role-badge { font-size: 10.5px; font-weight: 700; padding: 2px 9px; border-radius: 100px; text-transform: uppercase; }
.role-admin { background: #FDEEDD; color: var(--orange-dark); }
.role-user { background: #EEF1F8; color: var(--navy-light); }
.status-dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px; }
.status-active { background: var(--green); }
.status-inactive { background: #C7CCD9; }
.activity-row { display: flex; gap: 14px; padding: 10px 14px; border-bottom: 1px solid #F0F1F3; font-size: 12.5px; align-items: baseline; }
.activity-row .time { color: var(--text-faint); width: 140px; flex-shrink: 0; font-family: var(--mono); }
.activity-row .who { font-weight: 600; width: 90px; flex-shrink: 0; }
.activity-row .what { color: var(--text-muted); }
.tag-action { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 100px; background: #EEF1F8; color: var(--navy-light); text-transform: uppercase; }
.admin-nav { display: flex; gap: 6px; margin-bottom: 20px; }
.admin-nav a { padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.admin-nav a.active { background: var(--navy); color: #fff; }
.admin-nav a:hover:not(.active) { background: #F0F1F4; }
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat-card .big-num { font-size: 26px; font-weight: 800; color: var(--navy); font-family: var(--mono); }
.stat-card .label { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.4px; margin-top: 4px; }

@media (max-width: 720px) {
  .tab-bar { display: flex; }  /* visible on mobile */
  .tab { padding: 10px 11px; font-size: 11px; }
  .page { padding: 16px 10px 60px; }
  .form-grid { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: 1fr; }
  .hamburger-btn { display: block; }
}
@media (min-width: 721px) {
  .hamburger-btn { display: block; } /* always show for dropdown access */
}
