*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* ── Core Palette ─────────────────────────────────────────────
         Anchored in deep navy + warm off-white.
         Accent: a precise Persian blue — not teal, not indigo.
         Status colours are desaturated enough to feel documentary,
         not traffic-light loud.
      ──────────────────────────────────────────────────────────── */
  --ink: #0F1923;
  /* near-black with blue undertone     */
  --ink2: #1C2B3A;
  --ink3: #2C3E50;
  --ink4: #4A5568;
  --muted: #6B7A8D;
  --ghost: #96A3B0;
  --rule: #D8DFE6;

  --surface: #FFFFFF;
  --surface2: #F7F9FC;
  --surface3: #EEF2F7;

  /* Persian blue accent */
  --accent: #1E4DD8;
  --accent2: #1640B8;
  --accent3: #4A72E8;
  --accent-pale: #EBF0FD;
  --accent-light: #C5D2F8;

  /* Status */
  --emerald: #0F6B3A;
  --emerald-light: #D2F0E2;
  --amber: #8A5A00;
  --amber-light: #FFF0CC;
  --rose: #B91C3A;
  --rose-light: #FDE8EC;
  --sky: #0B5394;
  --sky-light: #D0E4F7;
  --indigo: #4338CA;
  --indigo-light: #E0E7FF;
  --teal: #0E7490;
  --teal-light: #CFFAFE;

  /* Geometry */
  --sidebar-w: 248px;
  --header-h: 56px;
  --radius: 5px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(15, 25, 35, .05);
  --shadow-sm: 0 1px 4px rgba(15, 25, 35, .08);
  --shadow: 0 4px 12px rgba(15, 25, 35, .10);
  --shadow-lg: 0 12px 32px rgba(15, 25, 35, .16);

  /* Type — Inter for data, Sora for headings */
  --ff-display: 'Sora', 'Inter', system-ui, sans-serif;
  --ff-sans: 'Inter', system-ui, sans-serif;
  --ff-mono: 'JetBrains Mono', 'Fira Code', 'IBM Plex Mono', monospace;
}

html,
body {
  font-family: var(--ff-sans);
  font-size: 13.5px;
  background: var(--surface2);
  color: var(--ink);
  display: flex;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -.01em;
}

/* ═══════════════════════════════════════════
       SIDEBAR
    ═══════════════════════════════════════════ */
#sidebar {
  width: var(--sidebar-w);
  background: var(--ink);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  border-right: none;
}

.sidebar-logo {
  padding: 22px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-logo .brand-word {
  font-family: var(--ff-display);
  font-size: 17px;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -.4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .brand-sub {
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .35);
  margin-top: 5px;
  padding-left: 30px;
}

.sidebar-section {
  padding: 18px 18px 5px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .28);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 1px 8px;
  cursor: pointer;
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, .55);
  font-size: 13px;
  font-weight: 400;
  transition: all .15s;
  user-select: none;
}

.nav-item:hover {
  background: rgba(255, 255, 255, .07);
  color: rgba(255, 255, 255, .9);
}

.nav-item.active {
  background: var(--accent);
  color: #FFFFFF;
  font-weight: 500;
}

.nav-item .icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  opacity: .8;
}

.nav-item.active .icon {
  opacity: 1;
}

.nav-group-toggle {
  justify-content: space-between;
}

.nav-group-toggle .toggle-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-group-toggle .nav-chevron {
  font-size: 12px;
  opacity: .5;
  transition: transform .32s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
}

.nav-group.open .nav-group-toggle .nav-chevron {
  transform: rotate(180deg);
}

.nav-group-toggle {
  transition: color .2s ease, background .2s ease;
}

.nav-group.open .nav-group-toggle {
  color: rgba(255, 255, 255, .95);
  background: rgba(255, 255, 255, .05);
}

.nav-group-items {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  transition: grid-template-rows .32s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-group.open .nav-group-items {
  grid-template-rows: 1fr;
}

.nav-group-items-inner {
  overflow: hidden;
  min-height: 0;
}

.nav-group-items .nav-item {
  padding-left: 34px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .18s ease, transform .18s ease;
}

.nav-group.open .nav-group-items .nav-item {
  opacity: 1;
  transform: translateY(0);
}

.nav-group.open .nav-group-items-inner .nav-item:nth-child(1) { transition-delay: .04s; }
.nav-group.open .nav-group-items-inner .nav-item:nth-child(2) { transition-delay: .08s; }
.nav-group.open .nav-group-items-inner .nav-item:nth-child(3) { transition-delay: .12s; }
.nav-group.open .nav-group-items-inner .nav-item:nth-child(4) { transition-delay: .16s; }
.nav-group.open .nav-group-items-inner .nav-item:nth-child(5) { transition-delay: .2s; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 8px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
}

.avatar {
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ff-display);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-info strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, .88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info span {
  font-size: 11px;
  color: rgba(255, 255, 255, .38);
  text-transform: capitalize;
  letter-spacing: .5px;
}

.logout-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, .3);
  font-size: 15px;
  padding: 5px;
  border-radius: var(--radius);
  transition: color .14s;
}

.logout-btn:hover {
  color: var(--rose-light);
}

/* ═══════════════════════════════════════════
       MAIN
    ═══════════════════════════════════════════ */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface2);
  min-width: 0;
  width: calc(100% - var(--sidebar-w));
}

#topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}

#page-title {
  font-family: var(--ff-display);
  font-size: 16px;
  font-weight: 600;
  flex: 1;
  color: var(--ink);
  letter-spacing: -.3px;
}

#content {
  flex: 1;
  overflow: hidden;
  padding: 24px;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ═══════════════════════════════════════════
       LOGIN
    ═══════════════════════════════════════════ */
#login-page {
  position: fixed;
  inset: 0;
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 380px;
  box-shadow: var(--shadow-lg);
}

.login-card h1 {
  font-family: var(--ff-display);
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--ink);
  letter-spacing: -.6px;
}

.login-card .login-sub {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--ghost);
  margin-bottom: 28px;
}

/* ═══════════════════════════════════════════
       FORMS
    ═══════════════════════════════════════════ */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .9px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
  background: var(--surface);
  color: var(--ink);
  transition: border .13s, box-shadow .13s;
  font-family: var(--ff-sans);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-pale);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--ghost);
}

.form-group small {
  color: var(--ghost);
  font-size: 11px;
  margin-top: 3px;
  display: block;
}

/* ═══════════════════════════════════════════
       BUTTONS
    ═══════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all .14s;
  font-family: var(--ff-sans);
  letter-spacing: -.01em;
}

button:disabled,
.btn:disabled,
.btn[disabled] {
  opacity: .45;
  filter: blur(.4px) saturate(70%);
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent2);
  border-color: var(--accent2);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink3);
  border-color: var(--rule);
}

.btn-secondary:hover {
  background: var(--surface3);
  border-color: #C8D0DA;
}

.btn-danger {
  background: var(--rose);
  color: #fff;
  border-color: var(--rose);
}

.btn-danger:hover {
  filter: brightness(1.08);
}

.btn-success {
  background: var(--emerald);
  color: #fff;
  border-color: var(--emerald);
}

.btn-success:hover {
  filter: brightness(1.08);
}

.btn-warning {
  background: var(--amber-light);
  color: var(--amber);
  border: 1.5px solid #D4A017;
}

.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: var(--radius);
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* ═══════════════════════════════════════════
       STAT GRID
    ═══════════════════════════════════════════ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(162px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}

/* Subtle left-edge accent bar */
.stat-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--rule);
}

.stat-card.blue::before {
  background: var(--accent);
}

.stat-card.green::before {
  background: var(--emerald);
}

.stat-card.orange::before {
  background: var(--amber);
}

.stat-card.red::before {
  background: var(--rose);
}

.stat-card.purple::before {
  background: var(--indigo);
}

.stat-card.teal::before {
  background: var(--teal);
}

.stat-card .label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.3px;
  color: var(--ghost);
  margin-bottom: 10px;
}

.stat-card .value {
  font-family: var(--ff-mono);
  font-size: 26px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
}

.stat-card .sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 6px;
}

.stat-card.blue .value {
  color: var(--accent);
}

.stat-card.green .value {
  color: var(--emerald);
}

.stat-card.orange .value {
  color: var(--amber);
}

.stat-card.red .value {
  color: var(--rose);
}

.stat-card.purple .value {
  color: var(--indigo);
}

.stat-card.teal .value {
  color: var(--teal);
}

.stat-card .sub-detail {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-card .sub-detail span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.dash-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ghost);
  margin: 20px 0 10px;
}

.dash-view-all {
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  font-weight: 500;
  background: none;
  border: none;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dash-view-all:hover {
  color: var(--accent2);
}

.product-thumb {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  object-fit: cover;
  background: var(--surface3);
  display: inline-block;
  vertical-align: middle;
  border: 1px solid var(--rule);
}

.product-no-img {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  background: var(--surface3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  vertical-align: middle;
  border: 1px solid var(--rule);
}

#page-suppliers .inline-search {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.supplier-detail-row td {
  background: var(--surface2) !important;
  padding: 12px 16px !important;
  font-size: 12px;
  color: var(--muted);
}

/* ═══════════════════════════════════════════
       TABLE CARD
    ═══════════════════════════════════════════ */
.table-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
  width: 100%;
}

.table-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--surface);
}

.table-header h3 {
  font-family: var(--ff-display);
  font-size: 14.5px;
  font-weight: 600;
  flex: 1;
  color: var(--ink);
  letter-spacing: -.3px;
}

.table-header h4 {
  font-family: var(--ff-display);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.25px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--surface2);
  padding: 9px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .9px;
  color: var(--ghost);
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--surface3);
  transition: background .1s;
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--accent-pale);
}

tbody td {
  padding: 10px 14px;
  font-size: 13px;
  vertical-align: middle;
}

.td-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

code {
  font-family: var(--ff-mono);
  font-size: 12px;
  background: var(--surface3);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--ink3);
}

/* ═══════════════════════════════════════════
       BADGES
    ═══════════════════════════════════════════ */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
  font-family: var(--ff-sans);
}

.badge-green {
  background: var(--emerald-light);
  color: var(--emerald);
}

.badge-red {
  background: var(--rose-light);
  color: var(--rose);
}

.badge-blue {
  background: var(--accent-pale);
  color: var(--accent2);
}

.badge-orange {
  background: var(--amber-light);
  color: var(--amber);
}

.badge-gray {
  background: var(--surface3);
  color: var(--muted);
}

.badge-teal {
  background: var(--teal-light);
  color: var(--teal);
}

.badge-purple {
  background: var(--indigo-light);
  color: var(--indigo);
}

/* ═══════════════════════════════════════════
       CATEGORY GROUPED VIEW
    ═══════════════════════════════════════════ */
.cat-view-toggle {
  display: flex;
  gap: 4px;
}

.cat-view-toggle button {
  padding: 5px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--rule);
  background: var(--surface);
  color: var(--muted);
  transition: all .13s;
  font-family: var(--ff-sans);
}

.cat-view-toggle button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

#cat-grouped-view {
  padding: 18px;
  display: none;
}

#cat-grouped-view.active {
  display: block;
}

#cat-table-view.active {
  display: block;
}

#cat-table-view {
  display: none;
}

.group-block {
  margin-bottom: 22px;
}

.group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

.group-icon {
  font-size: 18px;
}

.group-title {
  font-family: var(--ff-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.2px;
}

.group-count {
  font-size: 11px;
  color: var(--muted);
  background: var(--surface3);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1px 7px;
  font-family: var(--ff-mono);
}

.group-block.group-verified .group-header {
  border-bottom-color: rgba(15, 107, 58, 0.3);
}
.group-block.group-verified .group-title {
  color: var(--emerald);
}
.group-block.group-verified .group-count {
  background: var(--emerald-light);
  color: var(--emerald);
  border-color: rgba(15, 107, 58, 0.25);
}

.group-block.group-unverified .group-header {
  border-bottom-color: rgba(138, 90, 0, 0.3);
}
.group-block.group-unverified .group-title {
  color: var(--amber);
}
.group-block.group-unverified .group-count {
  background: var(--amber-light);
  color: var(--amber);
  border-color: rgba(138, 90, 0, 0.25);
}

.cat-group-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink3);
  cursor: pointer;
  user-select: none;
  padding: 4px 8px;
  border-radius: var(--radius-md, 6px);
  border: 1px solid var(--rule);
  background: var(--surface);
  transition: all 0.15s ease;
}

.cat-group-checkbox:hover {
  background: var(--surface2);
  border-color: var(--ghost);
}

.cat-group-checkbox input[type="checkbox"] {
  accent-color: var(--emerald);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 8px;
}

.cat-card {
  background: var(--surface2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  transition: border-color .13s, box-shadow .13s;
}

.cat-card:hover {
  border-color: var(--accent3);
  box-shadow: var(--shadow-xs);
}

.cat-card-info {
  flex: 1;
  min-width: 0;
}

.cat-card-name {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}

.cat-card-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cat-card-stock {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 8px;
  line-height: 1;
}

.cat-card-stock-value {
  color: var(--ink);
  font-family: var(--ff-mono);
  font-size: 19px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

.cat-card-stock-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.cat-card-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.cat-card-actions button {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--muted);
  transition: all .13s;
  white-space: nowrap;
  font-family: var(--ff-sans);
}

.cat-card-actions button:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.cat-card-actions button.danger:hover {
  background: var(--rose);
  border-color: var(--rose);
  color: #fff;
}

.cat-card-actions button.success-btn:hover {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #fff;
}

.cat-card.inactive {
  opacity: .52;
}

.cat-card.inactive .cat-card-name {
  text-decoration: line-through;
  color: var(--muted);
}

/* ── Verified category card ──────────────────────────────── */
.cat-card.verified {
  border-color: var(--emerald);
  box-shadow: 0 0 0 1.5px var(--emerald-light), 0 4px 12px rgba(15, 107, 58, .10);
}

.cat-card.verified .cat-card-name::after {
  content: '';
}

/* Verified badge pill — used on cards and table rows */
.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  background: var(--emerald-light);
  color: var(--emerald);
  border: 1px solid rgba(15, 107, 58, .25);
  white-space: nowrap;
  user-select: none;
}

.verified-badge svg,
.verified-badge i[data-lucide] {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

/* Verify / Unverify button on cards */
.btn-verify {
  background: var(--emerald-light);
  color: var(--emerald);
  border: 1px solid rgba(15, 107, 58, .3);
  font-weight: 600;
}

.btn-verify:hover {
  background: #b7e8ce;
}

.btn-unverify {
  background: var(--amber-light);
  color: var(--amber);
  border: 1px solid rgba(138, 90, 0, .3);
  font-weight: 600;
}

.btn-unverify:hover {
  background: #ffe4a0;
}


/* ═══════════════════════════════════════════
       MODAL
    ═══════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 25, 35, .55);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  width: 460px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s cubic-bezier(.4, 0, .2, 1);
}

@keyframes modalIn {
  from {
    transform: translateY(14px);
    opacity: 0
  }

  to {
    transform: none;
    opacity: 1
  }
}

.modal-head {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
}

.modal-head h4 {
  flex: 1;
  font-family: var(--ff-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.25px;
}

.modal-close {
  background: var(--surface3);
  border: none;
  cursor: pointer;
  font-size: 15px;
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .13s;
}

.modal-close:hover {
  background: var(--rule);
}

.modal-body {
  padding: 18px 20px;
}

.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--rule);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Direct category reassignment: a scan rail above a two-pane pick list. */
.category-transfer-modal.modal {
  width: min(1080px, 96vw);
  max-width: 96vw;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.category-transfer-head {
  flex-shrink: 0;
}

.category-transfer-head > div:first-child {
  flex: 1;
}

.category-transfer-head h4 {
  margin: 0;
}

.category-transfer-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.category-transfer-body {
  overflow-y: auto;
}

.category-transfer-scope {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px minmax(0, 1fr);
  align-items: end;
  gap: 10px;
}

.category-transfer-scope .form-group {
  margin-bottom: 0;
}

.category-transfer-arrow {
  display: grid;
  place-items: center;
  height: 38px;
  color: var(--accent);
}

.category-transfer-scan {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--accent3);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--surface2);
}

.category-transfer-scan-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.category-transfer-scan-row {
  display: flex;
  gap: 8px;
}

.category-transfer-scan-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--accent3);
  border-radius: var(--radius-md);
  outline: none;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--ff-mono);
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.category-transfer-scan-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.category-transfer-feedback {
  display: none;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
}

.category-transfer-feedback.success {
  display: block;
  color: var(--emerald);
}

.category-transfer-feedback.error {
  display: block;
  color: var(--rose);
}

.category-transfer-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
  gap: 12px;
  margin-top: 14px;
}

.category-transfer-pane {
  min-width: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}

.category-transfer-pane-head {
  min-height: 58px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface2);
}

.category-transfer-pane-head strong,
.category-transfer-pane-head span {
  display: block;
}

.category-transfer-pane-head strong {
  color: var(--ink);
  font-size: 12px;
}

.category-transfer-pane-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.category-transfer-pane-head input[type="search"] {
  width: min(210px, 48%);
  padding: 7px 9px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 11px;
  outline: none;
}

.category-transfer-table-wrap {
  height: 290px;
  overflow: auto;
}

.category-transfer-table {
  font-size: 11px;
}

.category-transfer-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}

.category-transfer-check {
  width: 32px;
  text-align: center;
}

.category-transfer-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 19px;
  height: 19px;
  margin: 0;
  border: 2px solid var(--ghost);
  border-radius: 5px;
  background: var(--surface);
  vertical-align: middle;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.category-transfer-check input[type="checkbox"]:checked {
  border-color: var(--emerald);
  background-color: var(--emerald);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2 7l3 3 7-7' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 14px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--emerald) 18%, transparent);
}

.category-transfer-check input[type="checkbox"]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--emerald) 28%, transparent);
  outline-offset: 2px;
}

.category-transfer-check input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.category-transfer-table tbody tr:has(.category-transfer-check input[type="checkbox"]:checked) {
  background: var(--emerald-light);
  box-shadow: inset 3px 0 0 var(--emerald);
}

.category-transfer-table tbody tr:has(.category-transfer-check input[type="checkbox"]:checked) .category-transfer-product-name {
  color: var(--emerald);
}

.category-transfer-product-name {
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
}

.category-transfer-product-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.category-transfer-product-barcode {
  margin-top: 5px;
  color: var(--emerald);
  font-family: var(--ff-mono);
  font-size: 10px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.category-transfer-pagination {
  padding: 8px 10px;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
}

.category-transfer-selected-pane {
  display: flex;
  flex-direction: column;
}

.category-transfer-clear {
  border: 0;
  background: transparent;
  color: var(--rose);
  cursor: pointer;
  font-size: 10px;
  font-weight: 650;
}

.category-transfer-selected-list {
  height: 333px;
  overflow-y: auto;
  padding: 8px;
}

.category-transfer-empty {
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 20px;
  color: var(--ghost);
  text-align: center;
  font-size: 11px;
  line-height: 1.4;
}

.category-transfer-selected-item {
  padding: 9px 10px;
  border: 1px solid color-mix(in srgb, var(--emerald) 28%, var(--rule));
  border-left: 3px solid var(--emerald);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--emerald-light) 55%, var(--surface));
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-transfer-selected-item + .category-transfer-selected-item {
  margin-top: 6px;
}

.category-transfer-selected-item > div {
  flex: 1;
  min-width: 0;
}

.category-transfer-selected-item button {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: var(--surface3);
  color: var(--muted);
  cursor: pointer;
}

.category-transfer-foot {
  align-items: center;
  flex-shrink: 0;
}

.category-transfer-foot > span {
  flex: 1;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 780px) {
  .category-transfer-modal.modal {
    max-height: 96vh;
  }

  .category-transfer-scope {
    grid-template-columns: 1fr;
  }

  .category-transfer-arrow {
    display: none;
  }

  .category-transfer-workspace {
    grid-template-columns: 1fr;
  }

  .category-transfer-table-wrap,
  .category-transfer-selected-list {
    height: 240px;
  }

  .category-transfer-foot {
    flex-wrap: wrap;
  }

  .category-transfer-foot > span {
    flex-basis: 100%;
  }
}

/* STV transfer desk: keep product entry attached to the selected voucher. */
.stv-editor-overlay {
  padding: 20px;
}

.stv-editor-modal.modal {
  width: min(1180px, 96vw);
  max-width: 96vw;
  max-height: 94vh;
  overflow: hidden;
}

.stv-editor-layout {
  display: grid;
  grid-template-columns: minmax(340px, 400px) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  padding: 14px;
  max-height: 94vh;
  overflow: auto;
}

.stv-editor-layout.is-readonly {
  grid-template-columns: minmax(0, 1fr);
}

.stv-editor-layout > .table-card {
  margin: 0;
  min-width: 0 !important;
}

#stv-products-section {
  position: sticky;
  top: 0;
  align-self: start;
}

.stv-editor-layout > .table-card:last-child {
  align-self: start;
}

/* ═══════════════════════════════════════════
       TOAST
    ═══════════════════════════════════════════ */
#toast {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.toast-item {
  padding: 11px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn .2s ease;
  min-width: 220px;
  font-family: var(--ff-sans);
  letter-spacing: -.01em;
}

.toast-success {
  background: var(--emerald);
  color: #fff;
}

.toast-error {
  background: var(--rose);
  color: #fff;
}

.toast-info {
  background: var(--accent);
  color: #fff;
}

.toast-warning {
  background: var(--amber-light);
  color: var(--amber);
  border: 1px solid #D4A017;
}

@keyframes slideIn {
  from {
    transform: translateX(28px);
    opacity: 0
  }

  to {
    transform: none;
    opacity: 1
  }
}

/* ═══════════════════════════════════════════
       PRODUCTS PAGE — SCROLLABLE TABLE BODY
    ═══════════════════════════════════════════ */
#page-products {
  display: none;
  flex-direction: column;
  min-height: 0;
}

#page-products.active {
  display: flex;
  overflow: hidden;
}

#page-products > .table-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  margin-bottom: 0;
}

#page-products .table-scroll-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

#page-products .table-scroll-body thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

#page-products .pag-row {
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════
       CATEGORIES PAGE — SCROLLABLE
    ═══════════════════════════════════════════ */
#page-categories {
  display: none;
  flex-direction: column;
  min-height: 0;
}

#page-categories.active {
  display: flex;
  overflow: hidden;
}

#page-categories > .table-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  margin-bottom: 0;
}

#page-categories .table-header {
  flex-shrink: 0;
}

#cat-grouped-view.active {
  display: block;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

#cat-table-view.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#cat-table-view .table-scroll-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

#cat-table-view .table-scroll-body thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

/* ═══════════════════════════════════════════
       GENERIC SCROLLABLE TABLE UTILITY
       (GRN list / GRN items / GRN products, etc.)
    ═══════════════════════════════════════════ */
.scroll-table {
  overflow-y: auto;
}

.scroll-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface2);
}

/* ═══════════════════════════════════════════
       SORTABLE COLUMN HEADERS
    ═══════════════════════════════════════════ */
th.th-sort {
  cursor: pointer;
  user-select: none;
  transition: color .12s, background .12s;
}

th.th-sort .th-sort-inner {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}

th.th-sort .th-sort-sub {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .4px;
  opacity: .65;
}

th.th-sort .th-sort-ind {
  font-size: 8px;
  line-height: 1;
  opacity: .45;
}

th.th-sort:hover {
  color: var(--accent);
  background: var(--accent-pale);
}

th.th-sort:hover .th-sort-ind {
  opacity: .85;
}

th.th-sort.is-sorted {
  color: var(--accent);
}

th.th-sort.is-sorted .th-sort-ind {
  opacity: 1;
}

/* ═══════════════════════════════════════════
       GRN PAGE — FULL-PAGE LIST / DETAIL SWITCH
    ═══════════════════════════════════════════ */
#page-grn {
  display: none;
  flex-direction: column;
  min-height: 0;
}

#page-grn.active {
  display: flex;
  overflow: hidden;
}

#grn-list-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#grn-list-view > .table-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  margin-bottom: 0;
}

#grn-detail-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#grn-detail-panel.active {
  display: flex;
}

.grn-detail-row {
  display: flex;
  gap: 14px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.grn-detail-row > .table-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  margin-bottom: 0;
}

#grn-products-section {
  flex: 1;
  min-width: 360px;
}

#grn-items-card {
  flex: 2;
  min-width: 480px;
}

.grn-detail-row .table-header {
  flex-shrink: 0;
}

.grn-detail-row .scroll-table {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  max-height: none !important;
}

.grn-detail-row .pag-row,
.grn-detail-row #grn-detail-total {
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════
       PAGES
    ═══════════════════════════════════════════ */
.page {
  display: none;
  width: 100%;
  flex: 1;
  min-height: 0;
  animation: fadeIn .18s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px)
  }

  to {
    opacity: 1;
    transform: none
  }
}

.page.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--ghost);
  font-size: 13px;
}

.loading {
  text-align: center;
  padding: 32px;
  color: var(--ghost);
  font-size: 0;
}

.loader,
.loading::before {
  width: fit-content;
  font-weight: bold;
  font-family: sans-serif;
  font-size: 30px;
  line-height: 1;
  padding: 0 5px 8px 0;
  background: repeating-linear-gradient(90deg, currentColor 0 8%, #0000 0 10%) 200% 100% / 200% 3px no-repeat;
  animation: l3 2s steps(6) infinite;
}

.loader {
  display: block;
  margin-inline: auto;
  color: var(--ghost);
}

.loader::before,
.loading::before {
  content: "Loading...";
}

.loading::before {
  display: block;
  margin-inline: auto;
}

.loader.loader--compact {
  font-size: 13px;
  line-height: 1.2;
  padding-bottom: 5px;
  color: inherit;
}

.api-loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 9999;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

@keyframes l3 {
  to {
    background-position: 80% 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loader,
  .loading::before {
    animation: none;
    background-position: 80% 100%;
  }
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.inline-search {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-search input,
.inline-search select {
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-md);
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
  background: var(--surface);
  color: var(--ink);
  transition: border .13s, box-shadow .13s;
  font-family: var(--ff-sans);
}

.inline-search input:focus,
.inline-search select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-pale);
}

.inline-search input::placeholder {
  color: var(--ghost);
}

.dash-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ghost);
  padding: 0 2px;
  margin-bottom: 8px;
  margin-top: 18px;
}

.section-label:first-child {
  margin-top: 0;
}

/* ═══════════════════════════════════════════
       PAGINATION
    ═══════════════════════════════════════════ */
.pag-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border-top: 1px solid var(--rule);
}

/* One chip per distinct selling price in a category + brand group */
.bqr-price-chip {
  display: inline-block;
  margin: 1px 4px 1px 0;
  padding: 1px 6px;
  background: var(--surface2);
  border: 1px solid var(--cream3);
  border-radius: 3px;
  font-family: var(--ff-mono);
  font-size: 11px;
  white-space: nowrap;
}

/* Keeps Prev/Next reachable even if the page scrolls past the card */
.pag-row-sticky {
  position: sticky;
  bottom: 0;
  z-index: 6;
  background: var(--surface);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.pag-info {
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  font-family: var(--ff-mono);
}

/* ═══════════════════════════════════════════
       COLOR REFERENCE
    ═══════════════════════════════════════════ */
.color-reference {
  margin-top: 8px;
  padding: 12px;
  background: var(--surface2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
}

.color-reference-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .8px;
}

.color-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
  gap: 5px;
}

.color-swatch {
  width: 30px;
  height: 30px;
  border-radius: 5px;
  border: 2px solid var(--rule);
  cursor: pointer;
  transition: all .13s;
}

.color-swatch:hover {
  transform: scale(1.12);
  border-color: var(--accent3);
}

.color-swatch.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-pale);
}

.color-preview {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: 8px;
}

.color-preview-box {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid var(--rule);
}

/* ═══════════════════════════════════════════
       CUSTOM DROPDOWN
    ═══════════════════════════════════════════ */
.dropdown-menu {
  box-shadow: var(--shadow);
}

.dropdown-option {
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background .13s;
}

.dropdown-option:hover {
  background: var(--surface2);
}

.dropdown-option.selected {
  background: var(--accent-pale);
  color: var(--accent2);
}

/* Branch sales report: optional field selector */
.bsr-column-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--cream3);
}

.bsr-column-controls__title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .55px;
  text-transform: uppercase;
}

.bsr-column-picker {
  position: relative;
}

.bsr-column-picker>summary {
  list-style: none;
}

.bsr-column-picker>summary::-webkit-details-marker {
  display: none;
}

.bsr-column-picker__trigger {
  cursor: pointer;
  user-select: none;
}

.bsr-column-picker[open] .bsr-column-picker__trigger {
  border-color: var(--accent);
  background: var(--accent-pale);
  color: var(--accent2);
}

.bsr-column-picker__menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 7px);
  right: 0;
  width: 188px;
  padding: 7px;
  border: 1px solid var(--cream3);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.bsr-column-picker__label {
  padding: 5px 8px 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .75px;
  text-transform: uppercase;
}

.bsr-column-picker__option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
}

.bsr-column-picker__option:hover {
  background: var(--surface2);
}

.bsr-column-picker__option input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
}

/* ═══════════════════════════════════════════
       GRN / APPROVE BLOCK
    ═══════════════════════════════════════════ */
.approve-block {
  background: var(--accent-pale);
  border: 1px solid var(--accent-light);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.approve-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

/* ═══════════════════════════════════════════
       BARCODE STATUS
    ═══════════════════════════════════════════ */
.bc-status-avail {
  background: var(--emerald-light);
  color: var(--emerald);
}

.bc-status-used {
  background: var(--amber-light);
  color: var(--amber);
}

/* ═══════════════════════════════════════════
       BARCODE MODAL
    ═══════════════════════════════════════════ */
.bs-bc-barcode-value {
  font-family: var(--ff-mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 1.5px;
  padding: 14px 16px;
  background: var(--surface2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  text-align: center;
  margin: 10px 0;
  word-break: break-all;
}

.bs-bc-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.bs-bc-meta-row span:last-child {
  color: var(--ink3);
  font-family: var(--ff-mono);
  font-size: 11px;
}

.bc-svg-preview {
  width: 100%;
  max-height: 80px;
  margin: 8px 0 4px;
  display: block;
}

.bulk-gen-section {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--accent-pale);
  border: 1px solid var(--accent-light);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--accent2);
  margin-top: 10px;
}

/* ═══════════════════════════════════════════
       RESPONSIVE
    ═══════════════════════════════════════════ */
html,
body {
  width: 100%;
  overflow-x: hidden;
}

.table-card {
  overflow-x: auto;
}

@media (max-width: 768px) {
  #sidebar {
    width: 100%;
    position: relative;
    height: auto;
  }

  #main {
    width: 100%;
    margin-left: 0;
  }

  .modal {
    width: 95% !important;
    max-width: 95% !important;
    left: 2.5% !important;
  }

  table {
    font-size: 12px;
  }

  .table-card table {
    min-width: 600px;
  }

  #grn-detail-panel .grn-detail-row,
  #siv-detail-panel>div,
  #stv-detail-panel>div,
  #sri-detail-panel>div {
    flex-direction: column;
  }

  #grn-products-section,
  #siv-products-section,
  #stv-products-section,
  #sri-products-section {
    min-width: 100%;
    margin-bottom: 14px;
  }

  .stv-editor-overlay {
    padding: 8px;
  }

  .stv-editor-modal.modal {
    max-height: 96vh;
  }

  .stv-editor-layout,
  .stv-editor-layout.is-readonly {
    grid-template-columns: minmax(0, 1fr);
    padding: 10px;
    max-height: 96vh;
  }

  #stv-products-section {
    position: static;
    max-width: none !important;
  }
}

@media (max-width: 480px) {
  .login-card {
    width: 95%;
    padding: 15px;
  }

  .modal {
    width: 98% !important;
    left: 1% !important;
  }

  .btn {
    font-size: 13px;
    padding: 8px 12px;
  }
}

/* ── Lucide icons ─────────────────────────────────────── */
i[data-lucide] { display: inline-block; width: 1em; height: 1em; vertical-align: -0.125em; }
svg.lucide { width: 1em; height: 1em; vertical-align: -0.125em; flex-shrink: 0; }

/* Logout button with label */
.logout-btn, .sb-logout { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }

/* ═══════════════════════════════════════════
       ORDER NOTIFICATIONS  —  topbar bell + panel
    ═══════════════════════════════════════════ */
.notif {
  position: relative;
  flex-shrink: 0;
}

.notif-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--rule);
  border-radius: 9999px;
  background: var(--surface);
  color: var(--ink3);
  font-size: 17px;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}

.notif-btn:hover {
  background: var(--accent-pale);
  border-color: var(--accent-light);
  color: var(--accent);
}

.notif-btn.has-unread {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-light);
}

/* One short shake when a new order lands — no endless motion. */
.notif-btn.ring {
  animation: notif-ring .55s ease-in-out 2;
}

@keyframes notif-ring {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-12deg); }
  75% { transform: rotate(12deg); }
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9999px;
  background: var(--rose);
  color: #fff;
  font-family: var(--ff-mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}

.notif-badge[hidden] {
  display: none;
}

.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 380px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  overflow: hidden;
}

.notif-panel[hidden] {
  display: none;
}

.notif-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface2);
}

.notif-panel-head h4 {
  flex: 1;
  font-family: var(--ff-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.2px;
}

.notif-clear {
  border: none;
  background: none;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius);
}

.notif-clear:hover {
  background: var(--accent-pale);
}

.notif-list {
  max-height: 380px;
  overflow-y: auto;
}

.notif-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--surface3);
  background: var(--surface);
  padding: 11px 14px;
  cursor: pointer;
  transition: background .1s;
}

.notif-item:hover {
  background: var(--surface2);
}

.notif-item.unread {
  background: var(--accent-pale);
}

.notif-item.unread:hover {
  background: var(--accent-light);
}

.notif-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

.notif-item-order {
  font-family: var(--ff-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.notif-item-amount {
  margin-left: auto;
  font-family: var(--ff-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--emerald);
}

.notif-item-meta {
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.notif-item-time {
  font-size: 10.5px;
  color: var(--ghost);
}

.notif-empty {
  padding: 28px 14px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ghost);
}

.notif-panel-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-top: 1px solid var(--rule);
  background: var(--surface2);
}

.notif-updated {
  flex: 1;
  font-size: 10.5px;
  color: var(--ghost);
  white-space: nowrap;
}

.notif-viewall {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius);
}

.notif-viewall:hover {
  background: var(--accent-pale);
}

.notif-status {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .3px;
}

/* ── Active orders table (dashboard) ─────────────────── */
.live-pill {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 9px;
  border-radius: 9999px;
  background: var(--amber-light);
  color: var(--amber);
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

.live-pill[hidden] {
  display: none;
}

/* Rows for orders first seen during this session fade from a highlight. */
tbody tr.row-new {
  animation: row-new-fade 4s ease-out forwards;
}

@keyframes row-new-fade {
  0% { background: var(--amber-light); }
  100% { background: transparent; }
}

.wait-long {
  color: var(--rose);
  font-weight: 700;
}

@media (max-width: 640px) {
  .notif-panel {
    position: fixed;
    top: calc(var(--header-h) + 8px);
    right: 12px;
    left: 12px;
    width: auto;
  }
}
