/* ================================================================
   BuildMart POS — Main Stylesheet
   Design: Industrial dark-on-dark, amber accent
   Font: IBM Plex Sans + IBM Plex Mono
   ================================================================ */

/* ── CSS Variables ──────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-base:    #0d1117;
  --bg-surface: #161b22;
  --bg-raised:  #1c2230;
  --bg-card:    #161b22;
  --bg-input:   #1a2030;
  --bg-hover:   #21283a;
  --bg-active:  #253048;

  /* Borders */
  --border-dim:    rgba(255,255,255,0.06);
  --border-soft:   rgba(255,255,255,0.10);
  --border-medium: rgba(255,255,255,0.15);
  --border-strong: rgba(255,255,255,0.25);

  /* Text */
  --text-primary:   #e6edf3;
  --text-secondary: #7d8590;
  --text-muted:     #484f58;
  --text-inverse:   #0d1117;

  /* Brand / Amber */
  --amber:       #f5a623;
  --amber-light: #fbc65a;
  --amber-dim:   rgba(245,166,35,0.12);
  --amber-border:rgba(245,166,35,0.30);

  /* Semantic */
  --success:     #3fb950;
  --success-dim: rgba(63,185,80,0.12);
  --warning:     #d29922;
  --warning-dim: rgba(210,153,34,0.12);
  --danger:      #f85149;
  --danger-dim:  rgba(248,81,73,0.12);
  --info:        #58a6ff;
  --info-dim:    rgba(88,166,255,0.12);

  /* Spacing */
  --sidebar-w: 240px;
  --topbar-h:  56px;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow:    0 4px 16px rgba(0,0,0,.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.6);
  --shadow-xl: 0 16px 64px rgba(0,0,0,.7);

  /* Typography */
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

/* ── Reset & Base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body.modal-open {
  overflow: hidden;
}

a { color: var(--amber); text-decoration: none; }
a:hover { color: var(--amber-light); text-decoration: none; }

img { max-width: 100%; display: block; }
hr { border: none; border-top: 1px solid var(--border-dim); margin: 1rem 0; }

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-dim);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .25s ease;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
  display: block;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 16px 14px 14px;
  border-bottom: 1px solid var(--border-dim);
  flex-shrink: 0;
}
.sidebar-brand-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  color: inherit;
}
.sidebar-brand-link:hover {
  color: inherit;
}
.sidebar-brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  overflow: hidden;
  border: 1px solid rgba(245,166,35,.18);
  box-shadow: 0 12px 28px rgba(0,0,0,.25);
  flex-shrink: 0;
}
.brand-mark-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.8);
  transform-origin: center;
  display: block;
}
.sidebar-brand-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.sidebar-brand-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.03em;
  line-height: 1.05;
}
.sidebar-brand-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
  cursor: pointer;
}
.nav-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-link.active { background: var(--amber-dim); color: var(--amber); border: 1px solid var(--amber-border); }
.nav-icon { display: flex; align-items: center; flex-shrink: 0; }
.nav-divider { border-top: 1px solid var(--border-dim); margin: 8px 6px; }

.nav-link-action {
  width: 100%;
  background: transparent;
  border: 0;
  outline: none;
  font: inherit;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
}



/* Sidebar footer */
.sidebar-footer {
  display: grid;
  gap: 10px;
  padding: 14px 12px;
  border-top: 1px solid var(--border-dim);
  flex-shrink: 0;
}
.lang-btn {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--text-secondary);
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  transition: all .15s;
}
.lang-btn:hover, .lang-btn.active {
  background: var(--amber-dim);
  border-color: var(--amber-border);
  color: var(--amber);
}
.sidebar-user {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border: 1px solid var(--border-dim);
}
.user-avatar {
  width: 32px; height: 32px;
  background: var(--amber);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-inverse);
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12.5px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-muted); }
.user-meta {
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.user-action-link {
  justify-content: center;
}
.user-action-logout:hover {
  color: var(--danger);
  background: var(--danger-dim);
}

/* Main wrap */
.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* Topbar */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-dim);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 320;
  isolation: isolate;
  flex-shrink: 0;
  overflow: visible;
}
.topbar-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
}
.topbar-menu-btn:hover { background: var(--bg-hover); }
.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: visible;
  flex-shrink: 0;
  z-index: 330;
}
.topbar-badge {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  background: var(--warning-dim);
  border: 1px solid rgba(210,153,34,.3);
  border-radius: 20px;
  color: var(--warning);
  font-size: 12px;
  font-weight: 600;
}
.topbar-badge:hover { color: var(--warning); }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.bc-sep { color: var(--text-muted); }
.bc-link { color: var(--text-secondary); }
.bc-link:hover { color: var(--amber); }
.bc-current { color: var(--text-primary); font-weight: 500; }

/* Flash messages */
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 18px;
  margin: 12px 20px 0;
  border-radius: var(--radius);
  font-size: 13.5px;
  border: 1px solid transparent;
  animation: flashIn .2s ease;
}
@keyframes flashIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.flash-icon { display: flex; flex-shrink: 0; }
.flash-close { margin-left: auto; background: none; border: none; font-size: 18px; cursor: pointer; opacity: .5; line-height: 1; color: inherit; }
.flash-close:hover { opacity: 1; }
.flash-success { background: var(--success-dim); border-color: rgba(63,185,80,.25); color: var(--success); }
.flash-error   { background: var(--danger-dim);  border-color: rgba(248,81,73,.25);  color: var(--danger); }
.flash-warning { background: var(--warning-dim); border-color: rgba(210,153,34,.25); color: var(--warning); }
.flash-info    { background: var(--info-dim);    border-color: rgba(88,166,255,.25);  color: var(--info); }

/* Page content */
.page-content {
  flex: 1;
  padding: 24px;
  min-width: 0;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-width: 0;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-dim);
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border-dim); }

/* ── Grid ────────────────────────────────────────────────────── */
.grid { display: grid; }
.grid-2 { grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); gap: 16px; }
.content-split {
  display: grid;
  gap: 20px;
  align-items: start;
}
.content-split-sidebar {
  grid-template-columns: minmax(0, 1fr) 300px;
}

.content-split-sidebar-wide {
  grid-template-columns: minmax(0, 1fr) 340px;
}

.content-split-sidebar-xl {
  grid-template-columns: minmax(0, 1fr) 380px;
}

/* ── Stat cards ──────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon-amber  { background: var(--amber-dim);   color: var(--amber);   border: 1px solid var(--amber-border); }
.stat-icon-green  { background: var(--success-dim); color: var(--success); }
.stat-icon-red    { background: var(--danger-dim);  color: var(--danger);  }
.stat-icon-blue   { background: var(--info-dim);    color: var(--info);    }
.stat-value { font-size: 26px; font-weight: 700; font-family: var(--font-mono); line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn i[data-feather] { flex-shrink: 0; }

.btn-primary { background: var(--amber); border-color: var(--amber); color: var(--text-inverse); font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--amber-light); border-color: var(--amber-light); color: var(--text-inverse); }

.btn-secondary { background: var(--bg-raised); border-color: var(--border-medium); color: var(--text-primary); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--border-strong); color: var(--text-primary); }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { opacity: .9; color: #fff; }

.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { opacity: .9; color: #fff; }

.btn-warning { background: var(--warning); border-color: var(--warning); color: var(--text-inverse); }
.btn-warning:hover:not(:disabled) { opacity: .92; color: var(--text-inverse); }

.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover:not(:disabled) {
  background: rgba(248,81,73,0.12);
  color: var(--danger);
}

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }
.btn-ghost.active {
  background: linear-gradient(180deg, rgba(255, 176, 32, 0.2), rgba(255, 176, 32, 0.12));
  border-color: rgba(255, 176, 32, 0.45);
  color: var(--amber);
  box-shadow: inset 0 0 0 1px rgba(255, 176, 32, 0.2);
}

.btn-outline { background: transparent; border-color: var(--border-medium); color: var(--text-secondary); }
.btn-outline:hover:not(:disabled) { border-color: var(--amber); color: var(--amber); }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 15px; }
.btn-xl { padding: 14px 28px; font-size: 17px; font-weight: 700; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 7px; }

.inline-action-form {
  display: inline-flex;
}

.inline-action-form .btn {
  width: 100%;
}

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
}
.form-label .req { color: var(--danger); margin-left: 2px; }

.form-control {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-dim); }
.form-control:disabled { opacity: .5; cursor: not-allowed; }
.form-control.mono { font-family: var(--font-mono); }
.form-control-sm { padding: 6px 10px; font-size: 12.5px; min-height: 34px; }
input.category-color-control.form-control {
  min-height: 42px;
  padding: 4px;
  cursor: pointer;
}
input.category-color-control.form-control::-webkit-color-swatch-wrapper {
  padding: 0;
}
input.category-color-control.form-control::-webkit-color-swatch {
  border: 0;
  border-radius: calc(var(--radius-sm) - 4px);
}
input.category-color-control.form-control::-moz-color-swatch {
  border: 0;
  border-radius: calc(var(--radius-sm) - 4px);
}

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint  { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input[type=checkbox],
.form-check input[type=radio] {
  width: 16px; height: 16px;
  accent-color: var(--amber);
  cursor: pointer;
  flex-shrink: 0;
}
.form-check-label { font-size: 13.5px; color: var(--text-primary); }

.form-row { display: grid; gap: 16px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-4 { grid-template-columns: repeat(4, 1fr); }

.split-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 10px;
}

.stacked-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stacked-actions > * {
  min-width: 0;
}

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-table-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead tr { border-bottom: 1px solid var(--border-soft); }
.table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  white-space: nowrap;
}
.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-dim);
  color: var(--text-primary);
  vertical-align: middle;
}
.table tbody tr:hover td { background: var(--bg-hover); }
.table tbody tr:last-child td { border-bottom: none; }
.table .col-num { text-align: right; font-family: var(--font-mono); }
.table .col-actions { text-align: right; white-space: nowrap; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-success { background: var(--success-dim); color: var(--success); }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-danger  { background: var(--danger-dim);  color: var(--danger);  }
.badge-info    { background: var(--info-dim);    color: var(--info);    }
.badge-secondary { background: var(--bg-hover); color: var(--text-secondary); border: 1px solid var(--border-soft); }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.page-link {
  display: flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  transition: all .15s;
}
.page-link:hover { border-color: var(--amber); color: var(--amber); }
.page-link.active { background: var(--amber); border-color: var(--amber); color: var(--text-inverse); font-weight: 700; }
.page-link:disabled, .page-link[disabled] { opacity: .35; pointer-events: none; }

/* ── Modals ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 16px;
  backdrop-filter: blur(3px);
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg-raised);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.95) translateY(-10px); } }
.modal-sm { max-width: 360px; }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-dim);
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  padding: 4px; border-radius: var(--radius-sm);
  display: flex;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: 22px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px; border-top: 1px solid var(--border-dim); }

/* ── POS Layout ──────────────────────────────────────────────── */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  height: calc(100vh - var(--topbar-h) - 24px);
  max-height: 900px;
}

/* Left pane */
.pos-left {
  display: flex; flex-direction: column; gap: 12px;
  overflow: hidden;
}
.pos-search-bar { display: flex; gap: 8px; }
.pos-search-bar .form-control { font-size: 15px; padding: 10px 14px; }

.category-tabs {
  display: flex; gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
  flex-shrink: 0;
}
.cat-tab:hover { border-color: var(--border-medium); color: var(--text-primary); }
.cat-tab.active { background: var(--amber-dim); border-color: var(--amber-border); color: var(--amber); }

.products-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  overflow-y: auto;
  align-content: start;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-soft) transparent;
}
.product-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  min-height: 236px;
  gap: 2px;
}
.product-card:hover { border-color: var(--amber-border); background: var(--bg-raised); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.product-card.out-of-stock {
  opacity: .78;
  border-color: rgba(239, 68, 68, .28);
}
.product-thumb {
  width: 100%; aspect-ratio: 1;
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 9px;
  overflow: hidden;
  flex-shrink: 0;
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-thumb-placeholder { color: var(--text-muted); }
.product-card-name {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text-primary);
  margin-bottom: 6px;
  min-height: 32px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card-sku  {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-top: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.product-card-price {
  display: block;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--amber);
  margin-top: 6px;
  line-height: 1.2;
  white-space: nowrap;
}
.product-card-stock-badge { position: absolute; top: 6px; right: 6px; font-size: 10px; }

/* Right pane - Cart */
.pos-right {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cart-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-dim);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.cart-title { font-size: 14px; font-weight: 600; }
.cart-items-wrap { flex: 1; overflow-y: auto; padding: 8px; scrollbar-width: thin; }
.cart-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  gap: 10px;
}
.cart-empty-icon { opacity: .3; }
.cart-empty-text { font-size: 13px; }

.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.cart-item-info {}
.cart-item-name { font-size: 12.5px; font-weight: 500; line-height: 1.3; margin-bottom: 2px; }
.cart-item-sku  { font-size: 11px; font-family: var(--font-mono); color: var(--text-muted); }
.cart-item-controls {
  display: flex; align-items: center; gap: 5px; margin-top: 7px;
}
.qty-btn {
  width: 26px; height: 26px;
  background: var(--bg-hover);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 300;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .12s;
  line-height: 1;
}
.qty-btn:hover { background: var(--amber-dim); border-color: var(--amber-border); color: var(--amber); }
.qty-btn-discount {
  width: 30px;
  min-width: 30px;
  font-size: 12px;
  font-weight: 700;
  color: var(--amber);
  border-color: rgba(255, 176, 32, 0.28);
  background: linear-gradient(180deg, rgba(255, 176, 32, 0.16), rgba(255, 176, 32, 0.08));
}
.qty-btn-discount:hover {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--text-inverse);
}
.qty-btn-discount.active {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--text-inverse);
}
.qty-input {
  width: 56px;
  padding: 3px 6px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  color: var(--text-primary);
  outline: none;
}
.qty-input:focus { border-color: var(--amber); }
.cart-item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.cart-item-total { font-family: var(--font-mono); font-weight: 600; font-size: 14px; color: var(--amber); }
.cart-item-remove {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 2px; border-radius: 3px;
  display: flex;
}
.cart-item-remove:hover { color: var(--danger); background: var(--danger-dim); }

.toast-host {
  position: fixed;
  top: 72px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 500;
  pointer-events: none;
}

.toast {
  min-width: 240px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: var(--bg-raised);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-8px);
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-success { border-color: rgba(63,185,80,.28); background: rgba(20,34,22,.96); color: #9be9a8; }
.toast-error   { border-color: rgba(248,81,73,.32); background: rgba(40,20,22,.96); color: #ffb2ad; }
.toast-warning { border-color: rgba(210,153,34,.32); background: rgba(45,32,10,.96); color: #ffd38d; }
.toast-info    { border-color: rgba(88,166,255,.28); background: rgba(16,30,48,.96); color: #b4d6ff; }

.cart-item-group {
  display: block;
  padding: 12px;
  border-radius: var(--radius);
}

.cart-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.cart-item-header-main {
  min-width: 0;
  flex: 1;
}

.cart-item-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cart-item-stock {
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-secondary);
}

.cart-item-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-item-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.cart-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
}

.cart-line-main {
  min-width: 0;
}

.cart-line-controls {
  margin-top: 0;
  flex-wrap: wrap;
  gap: 6px;
}

.cart-line-unit-select {
  flex: 1;
  min-width: 116px;
  max-width: 170px;
  font-size: 12px;
  padding: 5px 10px;
}

.cart-line-remove {
  width: 28px;
  height: 28px;
  min-width: 28px;
  justify-content: center;
  align-items: center;
}

.cart-line-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  min-width: 96px;
}

.cart-line-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.cart-line-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.cart-line-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  color: var(--amber-light);
  background: rgba(245,166,35,.12);
  border: 1px solid rgba(245,166,35,.18);
}

.cart-add-unit {
  margin-top: 10px;
  width: 100%;
  justify-content: center;
  gap: 6px;
}

.cart-unit-info-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.cart-unit-info-trigger {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.cart-unit-tooltip {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  display: none;
  min-width: 220px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: rgba(13,17,23,.98);
  box-shadow: var(--shadow-lg);
  z-index: 5;
}

.cart-unit-info-wrap:hover .cart-unit-tooltip,
.cart-unit-info-wrap:focus-within .cart-unit-tooltip {
  display: block;
}

.cart-unit-tooltip-title {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--amber-light);
}

.cart-unit-tooltip-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  font-size: 11px;
  color: var(--text-primary);
}

/* Cart footer */
.cart-footer { padding: 14px 16px; border-top: 1px solid var(--border-dim); flex-shrink: 0; }
.cart-customer { margin-bottom: 10px; }
.cart-discount { display: flex; gap: 6px; margin-bottom: 10px; }
.cart-discount .form-control { font-family: var(--font-mono); }
.view-switcher {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-soft);
  gap: 4px;
}
.view-switcher .btn {
  min-width: 42px;
  justify-content: center;
  border-radius: 8px;
  border-color: transparent;
  font-weight: 700;
  transition: all .16s ease;
}
.view-switcher .btn:not(.active) {
  color: var(--text-muted);
  opacity: .9;
}
.view-switcher .btn.active {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--text-inverse);
  box-shadow: 0 8px 18px rgba(255, 176, 32, 0.22);
}
.view-switcher .btn:hover:not(.active) {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.cart-totals { margin-bottom: 12px; }
.totals-row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; font-size: 13px; color: var(--text-secondary); }
.totals-row.grand { font-size: 18px; font-weight: 700; color: var(--text-primary); padding-top: 8px; border-top: 1px solid var(--border-soft); margin-top: 6px; }
.totals-row .mono { font-family: var(--font-mono); }

/* Payment modal */
.payment-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.pay-method-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 12px 8px;
  background: var(--bg-surface);
  border: 2px solid var(--border-soft);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .15s;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.pay-method-btn:hover { border-color: var(--border-medium); color: var(--text-primary); }
.pay-method-btn.active { background: var(--amber-dim); border-color: var(--amber); color: var(--amber); }

/* ── Receipt ─────────────────────────────────────────────────── */
.receipt {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  max-width: 300px;
  margin: 0 auto;
}
.receipt-center { text-align: center; }
.receipt-divider { border: none; border-top: 1px dashed var(--border-medium); margin: 8px 0; }
.receipt-row { display: flex; justify-content: space-between; }
.receipt-bold { font-weight: 700; }
.receipt-total { font-size: 16px; font-weight: 700; }

/* ── Misc Utilities ──────────────────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-end { display: flex; justify-content: flex-end; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 12px; }
.gap-3 { gap: 18px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--text-primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-amber { color: var(--amber); }
.font-mono { font-family: var(--font-mono); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-xs { font-size: 11px; }
.fs-md { font-size: 13.5px; }
.fs-sm { font-size: 12px; }
.fs-lg { font-size: 16px; }
.text-nowrap { white-space: nowrap; }
.text-uppercase { text-transform: uppercase; }
.d-none { display: none !important; }
.w-full { width: 100%; }

/* Page header row */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-heading { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-subtitle { margin-top: 4px; font-size: 13px; color: var(--text-secondary); }

.status-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.detail-list {
  display: grid;
  gap: 10px;
}

.detail-item {
  display: grid;
  grid-template-columns: minmax(120px, 44%) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.detail-label {
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.detail-value {
  min-width: 0;
  color: var(--text-primary);
  font-size: 13.5px;
  word-break: break-word;
}

.detail-value .text-muted {
  font-size: 11px;
}

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

.detail-table td {
  padding: 4px 0;
  vertical-align: top;
}

.detail-table td:first-child {
  width: 45%;
  color: var(--text-muted);
}

.detail-definition {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin: 0;
  font-size: 14px;
}

.detail-definition dt {
  color: var(--text-secondary);
}

.detail-definition dd {
  margin: 0;
}

.desktop-only,
.hide-on-mobile { display: block; }
.mobile-only,
.show-on-mobile { display: none !important; }

.mobile-card-list,
.mobile-list {
  display: none;
  gap: 12px;
}

.mobile-record-card,
.mobile-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
}

.mobile-record-header,
.mobile-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.mobile-record-main {
  min-width: 0;
}

.mobile-record-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  word-break: break-word;
}

.mobile-record-subtitle {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-secondary);
  word-break: break-word;
}

.mobile-record-thumb {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-dim);
  background: var(--bg-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.mobile-record-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mobile-meta-grid,
.mobile-card__meta {
  display: grid;
  gap: 8px;
}

.mobile-meta-row,
.mobile-card__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.mobile-meta-row-label,
.mobile-card__row-label {
  color: var(--text-secondary);
  font-size: 12px;
}

.mobile-meta-row-value,
.mobile-card__row-value {
  min-width: 0;
  color: var(--text-primary);
  font-size: 12.5px;
  text-align: right;
  font-weight: 500;
  word-break: break-word;
}

.mobile-meta-row-value.text-left {
  text-align: left;
}

.mobile-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mobile-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mobile-form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mobile-actions > .btn,
.mobile-actions > a,
.mobile-actions > button,
.mobile-actions > form,
.mobile-form-actions > * {
  flex: 1 1 calc(50% - 4px);
  min-width: 0;
}

.mobile-actions form .btn,
.mobile-actions > .btn,
.mobile-actions > a,
.mobile-actions > button,
.mobile-form-actions .btn,
.mobile-form-actions > a,
.mobile-form-actions > button {
  width: 100%;
  justify-content: center;
}

.mobile-stack {
  display: grid;
  gap: 12px;
}

.mobile-form,
.mobile-form-stack {
  display: grid;
  gap: 10px;
  align-items: end;
}

.category-visual {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--bg-raised);
  max-width: 100%;
}

.category-visual-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mobile-user-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mobile-user-head .user-avatar {
  flex-shrink: 0;
}

.mobile-user-email {
  overflow-wrap: anywhere;
}

.dashboard-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.dashboard-side-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.dashboard-quick-actions-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Auth pages */
.auth-shell {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(circle at 18% 16%, rgba(245,166,35,.10), transparent 30%),
    radial-gradient(circle at 82% 16%, rgba(88,166,255,.08), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(245,166,35,.05), transparent 28%),
    var(--bg-base);
}
.auth-card {
  width: 100%;
  max-width: 460px;
  margin-inline: auto;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)), var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: 24px;
  padding: 34px 34px 28px;
  box-shadow: var(--shadow-xl);
}
.auth-card.auth-card-wide {
  max-width: 520px;
}
.auth-brand {
  width: fit-content;
  max-width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin: 0 auto 18px;
}
.auth-brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(245,166,35,.22);
  box-shadow: 0 16px 34px rgba(0,0,0,.30);
  flex-shrink: 0;
}
.auth-brand-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.auth-brand-name {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.05;
  color: var(--text-primary);
}
.auth-brand-sub {
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--text-secondary);
}
.auth-heading {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: 6px;
}
.auth-subtitle {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 24px;
}
.auth-mode-switcher {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.auth-mode-btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  background: rgba(255,255,255,0.02);
  font-size: 12.5px;
  font-weight: 600;
  transition: color .15s, border-color .15s, background .15s, box-shadow .15s;
}
.auth-mode-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
}
.auth-mode-btn.active {
  color: var(--amber);
  background: var(--amber-dim);
  border-color: var(--amber-border);
  box-shadow: inset 0 0 0 1px rgba(245,166,35,.08);
}
.auth-actions {
  display: grid;
  gap: 12px;
}
.auth-pin-field {
  text-align: center;
  letter-spacing: .26em;
  font-size: 18px;
}
.auth-meta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}
.auth-link-muted {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  background: rgba(255,255,255,0.02);
}
.auth-link-muted[aria-disabled="true"] {
  cursor: default;
  opacity: .8;
}
.auth-link-muted:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
}
.auth-lang-switcher {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 18px;
}
.auth-lang-switcher .lang-btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

/* Profile */
.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, .9fr);
  gap: 16px;
  align-items: start;
}
.profile-summary {
  display: grid;
  gap: 14px;
}
.profile-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
}
.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--amber);
  color: var(--text-inverse);
  font-size: 22px;
  font-weight: 700;
}
.profile-title {
  font-size: 18px;
  font-weight: 700;
}
.profile-meta {
  display: grid;
  gap: 10px;
}
.profile-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-dim);
  font-size: 13px;
}
.profile-meta-row:last-child {
  border-bottom: 0;
}
.profile-meta-label {
  color: var(--text-secondary);
}
.profile-meta-value {
  text-align: right;
  color: var(--text-primary);
}
.profile-security-stack {
  display: grid;
  gap: 18px;
}
.profile-security-section + .profile-security-section {
  padding-top: 18px;
  border-top: 1px solid var(--border-dim);
}
.permission-matrix {
  display: grid;
  gap: 16px;
}
.permission-group-card {
  border: 1px solid var(--border-dim);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}
.permission-group-heading {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid var(--border-dim);
}
.permission-group-table {
  display: grid;
}
.permission-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.permission-row:last-child {
  border-bottom: 0;
}
.permission-row-label {
  font-size: 13px;
  color: var(--text-primary);
}
.permission-row-control .form-control {
  min-width: 0;
}

/* Filter bar */
.filter-bar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}
.filter-bar .form-control { font-size: 13px; }
.filter-bar > * { min-width: 0; }

.filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-bar-card {
  padding: 0;
  border: 0;
  background: transparent;
}

.filter-field-xs { max-width: 140px; }
.filter-field-sm { max-width: 150px; }
.filter-field-md { max-width: 180px; }
.filter-field-lg { max-width: 220px; }
.filter-field-xl { max-width: 240px; }
.filter-field-xxl { max-width: 300px; }

.table-empty-cell { padding: 40px !important; }

.flash-action { margin-left: auto; }

.auto-fit-grid-sm {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.section-divider {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-dim);
}

.form-control-static {
  display: flex;
  align-items: center;
  min-height: 40px;
  background: var(--bg-raised);
  cursor: default;
}

.image-preview-square {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 12px;
  border: 1px solid var(--border-soft);
}

.image-placeholder-square {
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg-raised);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 12px;
  border: 1px dashed var(--border-soft);
}

.file-input-sm { font-size: 12px; }

.option-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.confirm-change-card {
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg-raised);
}

.confirm-change-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.confirm-change-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  color: var(--text-muted);
  font-size: 13px;
}

.confirm-change-arrow {
  color: var(--warning);
}

.warehouse-balance-list {
  display: grid;
  gap: 6px;
}

.unit-builder-row {
  display: grid;
  grid-template-columns: 1.3fr .9fr auto;
  gap: 10px;
  align-items: end;
}

.unit-price-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) repeat(var(--unit-price-columns, 1), minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
}

.unit-matrix-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.unit-matrix-card {
  display: grid;
  grid-template-columns: auto minmax(120px, 1.2fr) minmax(110px, 1fr);
  gap: 8px;
  align-items: end;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--bg-raised);
}

.unit-matrix-card-extended {
  grid-template-columns: auto minmax(120px, 1.2fr) minmax(110px, 1fr) minmax(150px, 1fr);
}

.unit-matrix-radio {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
}

.receipt-row-product-cell {
  min-width: 240px;
}

.receipt-row-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.receipt-row-toolbar .row-product-select {
  flex: 1 1 auto;
  min-width: 0;
}

.receipt-row-toolbar-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.receipt-row-auto-btn {
  display: none;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 10px;
  flex-shrink: 0;
}

.receipt-row-side-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
}

.receipt-row-selected-unit {
  font-size: 12px;
}

.receipt-row-tax {
  min-width: 96px;
}

.row-unit-matrix {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.products-folder-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
}

.products-folder-switcher {
  flex-wrap: wrap;
}

.products-folder-switcher .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: auto;
}

.products-folder-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: inherit;
  font-size: 11px;
  font-family: var(--font-mono);
}

.products-folder-summary {
  min-width: 220px;
}

.products-folder-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.products-folder-hint {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-secondary);
}

.product-row-inactive {
  opacity: 0.78;
}

.product-row-inactive td {
  background: rgba(255,255,255,0.015);
}

.product-row-inactive:hover td {
  opacity: 1;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon { margin: 0 auto 14px; opacity: .3; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state-text  { font-size: 13px; }
.hidden { display: none !important; }

.inventory-count-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(360px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.inventory-count-main,
.inventory-count-side {
  min-width: 0;
}

.inventory-count-search-input {
  min-height: 50px;
  font-size: 16px;
  padding-inline: 16px;
}

.inventory-count-status-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  margin-top: 14px;
  border: 1px solid var(--border-dim);
  border-radius: 16px;
  background: rgba(255,255,255,0.02);
}

.inventory-count-status-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.inventory-count-status-text {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-secondary);
}

.inventory-count-not-found {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  margin-top: 14px;
  border-radius: 16px;
  border: 1px dashed rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.08);
}

.inventory-count-not-found-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 12.5px;
}

.inventory-count-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.inventory-count-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border-dim);
  background: rgba(255,255,255,0.015);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, transform .15s, background .15s;
}

.inventory-count-result:hover {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.06);
  transform: translateY(-1px);
}

.inventory-count-result-main {
  min-width: 0;
}

.inventory-count-result-name-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.inventory-count-result-meta,
.inventory-count-result-aliases {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.inventory-count-result-action {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--amber);
}

.inventory-count-queue-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.inventory-count-queue-buttons {
  display: flex;
  gap: 8px;
}

.inventory-count-queue-empty {
  padding: 26px 14px;
  text-align: center;
  border: 1px dashed var(--border-dim);
  border-radius: 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.inventory-count-queue-table-wrap {
  max-height: calc(100vh - 250px);
  overflow: auto;
}

.inventory-count-row-product {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.inventory-count-row-meta {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.inventory-count-diff {
  font-weight: 700;
}

.inventory-count-diff.positive {
  color: var(--success);
}

.inventory-count-diff.negative {
  color: var(--danger);
}

.inventory-count-note-input,
.inventory-count-qty-input {
  min-width: 120px;
}

.inventory-count-qty-editor {
  display: grid;
  gap: 8px;
  min-width: 156px;
}

.inventory-count-unit-select {
  min-width: 156px;
}

.inventory-count-queue-card {
  border-radius: 16px;
}

.inventory-count-queue-card-fields {
  display: grid;
  gap: 10px;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .pos-layout { grid-template-columns: 1fr 340px; }
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .inventory-count-shell { grid-template-columns: 1fr; }
  .content-split-sidebar { grid-template-columns: minmax(0, 1fr) 260px; }
  .content-split-sidebar-wide { grid-template-columns: minmax(0, 1fr) 280px; }
  .content-split-sidebar-xl { grid-template-columns: minmax(0, 1fr) 320px; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-240px); width: 240px; z-index: 360; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { z-index: 350; }
  .main-wrap { margin-left: 0; }
  .topbar-menu-btn { display: flex; }
  .topbar {
    height: auto;
    min-height: var(--topbar-h);
    padding: 10px 14px;
    flex-wrap: wrap;
    align-items: center;
  }
  .breadcrumb,
  .topbar-title {
    min-width: 0;
    flex: 1 1 auto;
    flex-wrap: wrap;
  }
  .topbar-right {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .wh-selector {
    width: 100%;
    max-width: 100%;
  }
  .wh-selector-btn {
    width: 100%;
    max-width: none;
    min-width: 0;
  }
  .wh-selector-drop {
    left: 0;
    right: auto;
    width: 100%;
    max-width: none;
  }
  .content-split-sidebar,
  .content-split-sidebar-wide,
  .content-split-sidebar-xl,
  .detail-item,
  .mobile-form-stack {
    grid-template-columns: 1fr;
  }
  .dashboard-main-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-side-column {
    order: 1;
  }
  .dashboard-recent-sales-card {
    order: 2;
  }
  .detail-table,
  .detail-table tbody,
  .detail-table tr,
  .detail-table td {
    display: block;
    width: 100%;
  }
  .detail-table tr {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-dim);
  }
  .detail-table tr:last-child {
    border-bottom: 0;
  }
  .detail-table td:first-child {
    width: 100%;
    padding-bottom: 2px;
  }
  .detail-definition {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .page-header {
    align-items: flex-start;
  }
  .page-actions {
    width: 100%;
  }
  .page-actions > * {
    min-width: 0;
  }
  .page-actions form {
    display: flex;
  }
  .page-actions form .btn {
    width: 100%;
  }
  .filter-bar {
    align-items: stretch;
    flex-direction: column;
  }
  .filter-bar .form-control,
  .filter-bar .btn,
  .filter-actions,
  .filter-field-xs,
  .filter-field-sm,
  .filter-field-md,
  .filter-field-lg,
  .filter-field-xl,
  .filter-field-xxl {
    width: 100%;
    max-width: none;
  }
  .filter-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .auto-fit-grid-sm,
  .confirm-change-row {
    grid-template-columns: 1fr;
  }
  .section-toolbar {
    align-items: stretch;
  }
  .desktop-only,
  .hide-on-mobile {
    display: none !important;
  }
  .mobile-only,
  .show-on-mobile {
    display: block !important;
  }
  .mobile-card-list,
  .mobile-list {
    display: grid;
  }
  .mobile-order-first {
    order: -1;
  }
  .mobile-order-last {
    order: 1;
  }
  .card-footer.flex-between {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .stacked-actions,
  .modal-footer,
  .qc-modal-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .stacked-actions > *,
  .modal-footer > *,
  .qc-modal-footer > * {
    width: 100%;
  }
  .unit-builder-row,
  .unit-matrix-card,
  .unit-matrix-card-extended,
  .split-input-row,
  .unit-price-row {
    grid-template-columns: 1fr;
  }
  .receipt-row-product-cell {
    min-width: 280px;
  }
  .receipt-row-toolbar {
    flex-wrap: wrap;
  }
  .receipt-row-toolbar .row-product-select {
    flex-basis: 100%;
  }
  .receipt-row-toolbar-actions {
    width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
  }
  .receipt-row-auto-btn {
    flex: 1 1 100%;
  }
  .unit-matrix-toolbar {
    justify-content: stretch;
  }
  .unit-matrix-toolbar .btn {
    width: 100%;
  }
  .pos-layout { grid-template-columns: 1fr; height: auto; }
  .pos-right { order: -1; }
  .pos-left { order: 1; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .inventory-count-toolbar {
    grid-template-columns: 1fr;
  }
  .inventory-count-note-input,
  .inventory-count-qty-input,
  .inventory-count-unit-select,
  .inventory-count-qty-editor {
    width: 100%;
    min-width: 0;
  }
  .inventory-count-queue-actions,
  .inventory-count-status-row,
  .inventory-count-not-found {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .page-content { padding: 14px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-row-2, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
  .card-header {
    padding: 14px 16px;
    gap: 10px;
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .card-body {
    padding: 16px;
  }
  .card-footer {
    padding: 12px 16px;
  }
  .form-group {
    margin-bottom: 14px;
  }
  .form-row {
    gap: 12px;
  }
  input[type="color"].form-control {
    min-height: 42px;
    padding: 4px;
  }
  .sidebar-user-actions,
  .auth-meta-row,
  .auth-lang-switcher {
    grid-template-columns: 1fr;
  }
  .auth-card {
    padding: 26px 20px 22px;
    border-radius: 20px;
  }
  .sidebar-brand-link {
    gap: 10px;
  }
  .sidebar-brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }
  .sidebar-brand-name {
    font-size: 16px;
  }
  .sidebar-brand-sub {
    font-size: 10.5px;
  }
  .auth-brand {
    gap: 12px;
    margin-bottom: 16px;
  }
  .auth-brand-mark {
    width: 56px;
    height: 56px;
    border-radius: 18px;
  }
  .auth-brand-name {
    font-size: 21px;
  }
  .auth-brand-sub {
    font-size: 11.5px;
  }
  .profile-hero {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
  }
  .permission-row {
    grid-template-columns: 1fr;
  }
  .profile-meta-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .profile-meta-value {
    text-align: left;
  }
  .topbar-right {
    align-items: stretch;
  }
  .breadcrumb {
    font-size: 12px;
  }
  .page-heading {
    font-size: 18px;
  }
  .page-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .page-actions > *,
  .page-actions form {
    width: 100%;
  }
  .page-actions .btn {
    width: 100%;
    min-height: 42px;
    justify-content: center;
  }
  .filter-actions {
    grid-template-columns: 1fr;
  }
  .filter-bar {
    gap: 12px;
    padding: 14px;
  }
  .filter-actions > * {
    min-width: 0;
  }
  .filter-actions .btn,
  .filter-actions a {
    min-height: 42px;
    justify-content: center;
  }
  .mobile-record-header,
  .mobile-meta-row {
    flex-direction: column;
  }
  .mobile-meta-row-value {
    text-align: left;
  }
  .mobile-actions > .btn,
  .mobile-actions > a,
  .mobile-actions > button,
  .mobile-actions > form,
  .mobile-form-actions > * {
    flex-basis: 100%;
  }
  .stat-card {
    padding: 16px;
    gap: 12px;
  }
  .stat-icon {
    width: 38px;
    height: 38px;
  }
  .stat-value {
    font-size: 22px;
  }
  .stat-label {
    font-size: 11px;
  }
  .page-link {
    min-width: 40px;
    height: 40px;
  }
  .inventory-count-result {
    flex-direction: column;
    align-items: flex-start;
  }
  .inventory-count-queue-buttons {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 389px) {
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .topbar-right {
    gap: 6px;
  }
  .wh-selector-btn {
    min-width: 168px;
    width: 190px;
    max-width: 190px;
    padding: 8px 12px;
  }
}

/* ── Print ───────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .page-header .btn, .flash, .no-print { display: none !important; }
  .main-wrap { margin-left: 0; }
  .page-content { padding: 0; }
  body { background: white; color: black; }
}

/* ── Global Warehouse Selector (Topbar) ─────────────────────────── */
.wh-selector {
  position: relative;
  flex-shrink: 0;
  z-index: 340;
}
.wh-selector-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  min-height: 40px;
  padding: 9px 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.00)), var(--bg-elevated, #1e2229);
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s, transform .15s, box-shadow .15s;
  white-space: nowrap;
  min-width: 190px;
  max-width: 260px;
  width: 220px;
  position: relative;
  z-index: 205;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.wh-selector-btn:hover {
  border-color: rgba(245, 158, 11, .55);
  color: var(--amber);
  transform: translateY(-1px);
}
.wh-selector-btn:focus-visible {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .16);
}
.wh-selector-btn svg { flex-shrink: 0; }
.wh-selector-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.wh-selector-drop {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 260px;
  width: max-content;
  max-width: min(320px, calc(100vw - 24px));
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0)), var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: 14px;
  box-shadow: 0 18px 38px rgba(0,0,0,.42);
  z-index: 9999;
  opacity: 1;
  overflow: hidden;
  padding: 6px;
}
.wh-selector-drop.open { display: block; }
.wh-drop-title {
  padding: 9px 12px 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border-dim);
  margin-bottom: 4px;
}
.wh-drop-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 11px 12px;
  background: none;
  border: none;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background .12s, color .12s;
}
.wh-drop-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.wh-drop-item.active {
  background: rgba(245, 158, 11, .10);
  color: var(--amber);
  font-weight: 600;
}
.wh-drop-item svg:last-child { margin-left: auto; color: var(--amber); }

/* ── POS warehouse indicator (read-only, above search) ──────────── */
.pos-wh-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-elevated, #1e2229);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.pos-wh-indicator svg { color: var(--amber); }


/* Fix warehouse dropdown layering above page actions */
.wh-selector-drop,
.wh-selector-drop * {
  backface-visibility: hidden;
}
.wh-selector-drop::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: transparent;
  pointer-events: none;
}

.product-search-field {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  min-width: 0;
}

.product-search-main {
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
}

.product-field-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.product-field-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
  padding: 0;
}

.product-field-icon:hover,
.product-field-icon:focus-visible {
  border-color: var(--amber-border);
  color: var(--amber);
  background: var(--amber-dim);
}

.product-field-icon:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.barcode-camera-field {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.barcode-camera-field .form-control {
  flex: 1 1 auto;
  min-width: 0;
}

.filter-bar .barcode-camera-field {
  width: 100%;
  min-width: 0;
}

.filter-bar .barcode-camera-field .product-camera-trigger,
.filter-bar .barcode-camera-field .product-camera-trigger.is-visible {
  width: 40px;
  min-width: 40px;
  height: 40px;
  flex: 0 0 40px;
  padding: 0;
  justify-content: center;
}

.product-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 36;
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--border-medium);
  background: color-mix(in srgb, var(--bg-surface) 92%, #000 8%);
  box-shadow: var(--shadow-xl);
  max-height: min(320px, 56vh);
  overflow-y: auto;
}

.product-search-results.hidden {
  display: none;
}

.product-search-result {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--bg-elevated);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}

.product-search-result:hover,
.product-search-result.is-active {
  border-color: var(--amber-border);
  background: color-mix(in srgb, var(--amber-dim) 55%, var(--bg-elevated) 45%);
}

.product-search-result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.product-search-result-name {
  font-weight: 600;
  color: var(--text-primary);
}

.product-search-result-meta,
.product-search-result-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.product-search-inline-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.product-picker-modal .qc-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-picker-list {
  display: grid;
  gap: 8px;
  max-height: min(420px, 62vh);
  overflow-y: auto;
}

.product-picker-empty {
  padding: 14px 16px;
  border: 1px dashed var(--border-medium);
  border-radius: 14px;
  color: var(--text-muted);
  font-size: 13px;
}

.product-camera-trigger {
  display: none;
}

.product-camera-trigger.is-visible {
  display: inline-flex;
}

.mobile-scroll-top-btn {
  display: none;
  position: fixed;
  right: 16px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--amber-border);
  background: rgba(24, 28, 38, 0.94);
  color: var(--amber);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  z-index: 180;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease, border-color .18s ease, background .18s ease;
}

.mobile-scroll-top-btn:hover {
  color: var(--amber);
  border-color: rgba(245, 158, 11, 0.7);
  background: rgba(34, 39, 52, 0.96);
}

.mobile-scroll-top-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16), 0 10px 28px rgba(0, 0, 0, 0.28);
}

.mobile-scroll-top-btn.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@media (max-width: 900px) {
  .mobile-scroll-top-btn {
    display: inline-flex;
    right: 14px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
}

.product-camera-modal {
  width: min(520px, calc(100vw - 28px));
}

.product-camera-modal-overlay {
  z-index: 1400;
}

.product-camera-preview-wrap {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  min-height: min(62vw, 360px);
}

.product-camera-preview {
  width: 100%;
  height: min(62vw, 360px);
  display: block;
  object-fit: cover;
  background: #000;
}

.product-camera-overlay-frame {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 50%;
  height: min(22vw, 112px);
  transform: translateY(-50%);
  border: 2px solid rgba(255, 184, 77, .95);
  border-radius: 22px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .24);
  pointer-events: none;
}

.product-camera-status {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

@media (max-width: 480px) {
  .product-camera-overlay-frame {
    height: min(24vw, 104px);
    left: 8%;
    right: 8%;
  }
}

.inventory-create-modal-overlay {
  z-index: 1200;
}

.inventory-create-modal {
  max-width: min(1380px, calc(100vw - 28px));
  overflow: hidden;
}

.inventory-create-modal-body {
  padding: 0;
  background: var(--bg-surface);
  height: min(86vh, 980px);
}

.inventory-create-modal-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 560px;
  border: 0;
  background: var(--bg-base);
}

@media (max-width: 900px) {
  .inventory-create-modal {
    max-width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
  }

  .inventory-create-modal-body {
    height: calc(100vh - 92px);
  }

  .inventory-create-modal-frame {
    min-height: 420px;
  }

  .barcode-camera-field {
    align-items: stretch;
  }
}

.receipt-row-product-cell {
  position: relative;
  overflow: visible;
}

.receipt-product-search {
  width: 100%;
}

.receipt-row-toolbar {
  align-items: flex-start;
}

.receipt-row-toolbar-actions {
  flex-shrink: 0;
}

.receipt-row-side-btn {
  width: 30px;
  height: 30px;
}

.receipt-product-search-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

@media (max-width: 900px) {
  .product-field-actions {
    flex-wrap: wrap;
  }

  .product-field-icon {
    min-width: 40px;
    min-height: 40px;
  }

  .product-search-results {
    position: static;
    margin-top: 8px;
    max-height: 300px;
  }

  .product-camera-modal {
    width: calc(100vw - 20px);
  }

  .product-camera-preview-wrap,
  .product-camera-preview {
    height: min(78vw, 420px);
  }

  .receipt-product-search {
    flex-wrap: wrap;
  }

  .receipt-row-toolbar-actions {
    width: 100%;
  }
}
