/* ============================================================
   Active Online — Warehouse Inventory System
   style.css — "Swing Tag" identity
   Design language borrowed from garment swing-tags: indigo denim,
   brass rivet accents, punched holes, dashed stitch-lines.
   ============================================================ */

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

:root {
  /* Brand — pulled directly from the Active Online logo (navy + sky blue) */
  --indigo:       #1c2247;
  --indigo-deep:  #0f1230;
  --indigo-mid:   #171b3d;
  --indigo-soft:  #e9ecf7;
  --brass:        #4a7dbe;   /* now the logo's sky-blue accent */
  --brass-light:  #6f9bd6;
  --brass-soft:   #e6eef9;
  --accent:       #4a7dbe;   /* legacy alias, kept for compatibility */

  /* Status colors — thread colors */
  --green:      #3f7d5c;
  --green-soft: #e2efe7;
  --red:        #b3492f;
  --red-soft:   #f6e2da;
  --yellow:     #b8842a;
  --yellow-soft:#f6ecd8;
  --blue:       #4a7dbe;
  --logo-navy:  #171233;
  --logo-blue:  #4a7dbe;

  /* Surfaces */
  --surface-0: #f6f3ec;   /* canvas */
  --surface-1: #eeeadf;
  --surface-2: #ffffff;

  /* Text */
  --text-primary:   #1c2331;
  --text-secondary: #5c6478;
  --text-muted:     #97a0b3;
  --text-danger:    #b3492f;

  /* Borders */
  --border:        rgba(28, 35, 49, 0.12);
  --border-strong: rgba(28, 35, 49, 0.22);
  --border-dashed: rgba(28, 35, 49, 0.28);

  /* Shape / shadow */
  --radius:     10px;
  --radius-lg:  16px;
  --shadow-sm:  0 1px 2px rgba(22, 29, 51, 0.06);
  --shadow-md:  0 6px 18px rgba(22, 29, 51, 0.10);
  --shadow-lg:  0 20px 44px rgba(22, 29, 51, 0.20);
  --shadow-inset: inset 0 1px 0 rgba(255,255,255,0.06);

  --ease: cubic-bezier(.22,.9,.32,1);

  --font-sans:  'Tajawal', system-ui, -apple-system, sans-serif;
  --font-mono:  'IBM Plex Mono', 'Courier New', monospace;
}

/* ── Base ───────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--surface-0);
  min-height: 100vh;
  direction: rtl;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* subtle canvas weave texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(45deg, rgba(28,35,49,0.015) 0 1px, transparent 1px 6px);
  z-index: 0;
}

/* accessible focus ring, brass-toned, RTL-agnostic */
:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
  border-radius: 4px;
}

/* thin themed scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── App Shell ──────────────────────────────────────────────── */
.app {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── Header (denim label patch) ────────────────────────────── */
.header {
  background:
    radial-gradient(120% 180% at 100% -20%, rgba(193,133,46,0.18), transparent 55%),
    linear-gradient(135deg, var(--indigo-deep), var(--indigo) 75%);
  color: #fff;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-md);
}

.header::after {
  content: '';
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 6px;
  height: 0;
  border-bottom: 1.5px dashed rgba(74, 125, 190, 0.5);
}

.header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 14px 14px;
  border-radius: inherit;
  pointer-events: none;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-mark {
  width: 44px;
  height: 44px;
  background: #fff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.4), var(--shadow-sm);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}

.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.logo:hover .logo-mark { transform: rotate(-6deg) scale(1.06); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.4), 0 0 0 4px rgba(74,125,190,0.25), var(--shadow-md); }

.logo-text {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.logo-sub {
  font-size: 11px;
  color: #b9c1d9;
  margin-top: 1px;
  letter-spacing: 0.2px;
}

.header-stats {
  display: flex;
  gap: 22px;
}

.hstat { text-align: center; }
.hstat-n { font-family: var(--font-mono); font-size: 18px; font-weight: 700; color: #fff; transition: color .2s; }
.hstat-l { font-size: 10px; color: #b9c1d9; text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs {
  display: flex;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 0 6px;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: var(--shadow-sm);
}

.tab {
  padding: 13px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  transition: color .15s var(--ease), border-color .2s var(--ease), background .15s;
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.tab i { font-size: 16px; transition: transform .2s var(--ease); }

.tab.active {
  color: var(--indigo);
  background: var(--brass-soft);
  border-bottom-color: var(--brass);
  border-radius: 8px 8px 0 0;
  font-weight: 700;
}

.tab.active i { transform: translateY(-1px); }

.tab:hover:not(.active) {
  color: var(--text-primary);
  background: var(--surface-0);
}

/* ── Content & Pages ────────────────────────────────────────── */
.content {
  flex: 1;
  padding: 20px 16px 40px;
}

.page { display: none; }
.page.active { display: block; animation: fadeIn .28s var(--ease); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Stat Cards ("swing tags") ──────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--surface-2);
  border: 1.5px dashed var(--border-dashed);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--surface-0);
  box-shadow: inset 0 0 0 1.5px var(--border-strong);
}

.stat-card:hover {
  transform: translateY(-3px) rotate(-0.4deg);
  box-shadow: var(--shadow-md);
  border-color: var(--brass);
}

.stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-bottom: 10px;
}

.stat-n { font-family: var(--font-mono); font-size: 24px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.5px; }
.stat-l { font-size: 11.5px; color: var(--text-secondary); margin-top: 3px; }

/* ── Toolbar ────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 12px;
  height: 38px;
  transition: border-color .15s, box-shadow .15s;
}

.search-box:focus-within { border-color: var(--brass); box-shadow: 0 0 0 3px var(--brass-soft); }

.search-box input {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-primary);
  width: 100%;
}

.search-box i { color: var(--text-muted); font-size: 16px; }

select.filter {
  height: 38px;
  padding: 0 10px;
  font-size: 12.5px;
  font-family: var(--font-sans);
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color .15s;
}

select.filter:hover { border-color: var(--border-strong); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  height: 38px;
  padding: 0 15px;
  border-radius: var(--radius);
  font-size: 12.5px;
  font-family: var(--font-sans);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-primary);
  transition: background .12s var(--ease), border-color .12s, transform .08s, box-shadow .15s;
}

.btn:hover { background: var(--surface-1); }
.btn:active { transform: scale(.96); }

.btn.primary {
  background: linear-gradient(155deg, var(--indigo-mid), var(--indigo));
  color: #fff;
  border-color: var(--indigo);
  box-shadow: var(--shadow-sm);
}

.btn.primary:hover { background: var(--indigo-deep); box-shadow: var(--shadow-md); }

.btn.danger {
  color: var(--red);
  border-color: var(--red-soft);
}
.btn.danger:hover { background: var(--red-soft); }

.btn.icon-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Table ──────────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead { background: var(--indigo-soft); }

th {
  padding: 12px 14px;
  text-align: right;
  font-weight: 700;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--indigo);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr { transition: background .12s; }
tr:hover td { background: var(--surface-0); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2px;
}

.badge.in  { background: var(--green-soft); color: var(--green); }
.badge.out { background: var(--red-soft); color: var(--red); }
.badge.low { background: var(--yellow-soft); color: #8a5f1f; }
.badge.exists { background: var(--brass-soft); color: var(--blue); }

/* ── Size chip ──────────────────────────────────────────────── */
.size-chip {
  background: var(--surface-1);
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 11px;
  font-family: var(--font-mono);
}

/* ── Row action buttons ─────────────────────────────────────── */
.row-actions { display: flex; gap: 4px; }

.row-btn {
  height: 30px;
  padding: 0 9px;
  font-size: 11px;
}

/* ── Scanner ────────────────────────────────────────────────── */
.scanner-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.scanner-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.scanner-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--indigo);
}

.barcode-display {
  background: var(--surface-0);
  border: 1.5px dashed var(--border-dashed);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
  margin-bottom: 16px;
  position: relative;
  transition: border-color .2s;
}

.barcode-display::before {
  content: '';
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1.5px var(--border-strong);
}

.barcode-lines {
  display: flex;
  gap: 2px;
  justify-content: center;
  align-items: flex-end;
  height: 60px;
  margin-bottom: 10px;
}

.barcode-lines div { transition: height .25s var(--ease); }

.barcode-num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--indigo);
  letter-spacing: 3px;
  font-weight: 700;
}

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

.scan-input-row input {
  flex: 1;
  height: 40px;
  padding: 0 12px;
  font-size: 14px;
  font-family: var(--font-mono);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-primary);
  letter-spacing: 2px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.scan-input-row input:focus { border-color: var(--brass); box-shadow: 0 0 0 3px var(--brass-soft); }

.scan-hint {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

.scan-result {
  background: var(--surface-0);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 120px;
}

.scan-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 26px 0;
  font-size: 13px;
}

.scan-empty i {
  font-size: 32px;
  display: block;
  margin-bottom: 8px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.result-row:last-child { border-bottom: none; }
.result-key { color: var(--text-secondary); }
.result-val { font-weight: 700; color: var(--text-primary); }

/* ── Toggle (in/out) ────────────────────────────────────────── */
.toggle-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.toggle-status { display: flex; gap: 6px; }

.toggle-btn {
  padding: 6px 15px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
  transition: all .15s var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.toggle-btn.active-in  { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.toggle-btn.active-out { background: var(--red-soft); color: var(--red); border-color: var(--red); }

/* ── Codebook ───────────────────────────────────────────────── */
.codebook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.code-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-2);
  border: 1.5px dashed var(--border-dashed);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), border-color .15s;
  position: relative;
}

.code-item::before {
  content: '';
  position: absolute;
  top: 9px;
  left: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--surface-0);
  box-shadow: inset 0 0 0 1.5px var(--border-strong);
}

.code-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--brass);
}

.code-top { display: flex; align-items: center; justify-content: space-between; }

.code-bar {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--indigo);
  background: var(--indigo-soft);
  padding: 3px 9px;
  border-radius: 4px;
  letter-spacing: 1px;
  font-weight: 700;
}

.code-name { font-size: 13px; font-weight: 700; }
.code-meta { display: flex; align-items: center; justify-content: space-between; }
.code-qty  { font-size: 11.5px; color: var(--text-secondary); }

.code-barcode-mini { display: flex; justify-content: center; align-items: center; height: 30px; overflow: hidden; }
.code-barcode-mini svg { max-width: 100%; height: 100%; }

.code-actions { display: flex; gap: 6px; }
.code-actions .btn { flex: 1; font-size: 11px; padding: 6px 8px; }

#barcode-svg { max-width: 100%; }

#camera-reader video { border-radius: var(--radius); }

/* ── Movement (timeline) ────────────────────────────────────── */
.movement-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.section-title { font-size: 15px; font-weight: 700; color: var(--indigo); }

.movement-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding-right: 4px;
}

.move-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, transform .15s var(--ease);
}

.move-item:hover { box-shadow: var(--shadow-md); transform: translateX(-2px); }

.move-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.move-icon.in  { background: var(--green-soft); color: var(--green); }
.move-icon.out { background: var(--red-soft); color: var(--red); }

.move-info { flex: 1; }
.move-name   { font-size: 13px; font-weight: 700; }
.move-detail { font-size: 11px; color: var(--text-secondary); margin-top: 2px; font-family: var(--font-mono); }
.move-qty    { font-family: var(--font-mono); font-size: 14px; font-weight: 700; }
.move-qty.in  { color: var(--green); }
.move-qty.out { color: var(--red); }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 27, 49, .58);
  z-index: 100;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}

.modal-overlay.open { display: flex; animation: overlayIn .18s ease; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 22px;
  width: 380px;
  max-width: 95vw;
  box-shadow: var(--shadow-lg);
  animation: modalIn .22s var(--ease);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--indigo);
}

.modal-text { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.6; }

.form-group   { margin-bottom: 13px; }
.form-label   { font-size: 12px; color: var(--text-secondary); margin-bottom: 5px; display: block; font-weight: 600; }
.form-input   { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-0); color: var(--text-primary); font-family: var(--font-sans); font-size: 13px; outline: none; transition: border-color .15s, box-shadow .15s; }
.form-input:focus { border-color: var(--brass); box-shadow: 0 0 0 3px var(--brass-soft); }
.form-row     { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* ── Toast notifications ────────────────────────────────────── */
.toast-stack {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(340px, 92vw);
}

.toast {
  background: var(--indigo-deep);
  color: #fff;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  border-right: 4px solid var(--brass);
  animation: toastIn .25s var(--ease);
}

.toast.success { border-right-color: var(--green); }
.toast.error    { border-right-color: var(--red); }
.toast i { font-size: 16px; flex-shrink: 0; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.toast.leaving { animation: toastOut .2s ease forwards; }
@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px); }
}

/* ── Loading overlay ────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(246, 243, 236, 0.92);
  backdrop-filter: blur(2px);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
}

.loading-overlay.show { display: flex; animation: fadeIn .15s ease; }

.spinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--brass);
  border-right-color: var(--indigo);
  animation: spin .75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 680px) {
  .stats-row        { grid-template-columns: 1fr 1fr; }
  .scanner-wrap     { grid-template-columns: 1fr; }
  .header-stats     { display: none; }
  .tab              { padding: 11px 12px; font-size: 12px; flex: 1; justify-content: center; }
  .tab span         { display: none; }

  /* table → stacked cards on small screens */
  .table-wrap { border: none; background: transparent; box-shadow: none; }
  table, thead, tbody, th, tr { display: block; }
  thead { display: none; }
  tbody { display: flex; flex-direction: column; gap: 10px; }
  tr {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 4px;
    box-shadow: var(--shadow-sm);
  }
  td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 12px;
    border-bottom: none;
  }
  td::before {
    content: attr(data-label);
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
  }
  tr:hover td { background: transparent; }
}


/* ── Category totals + low stock alerts ─────────────────────── */
.inventory-extra {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.summary-panel {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.summary-panel .section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

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

.category-total-card {
  background: var(--surface-0);
  border: 1.5px dashed var(--border-dashed);
  border-radius: var(--radius);
  padding: 10px;
  position: relative;
  transition: border-color .15s, transform .15s var(--ease);
}

.category-total-card:hover { border-color: var(--brass); transform: translateY(-2px); }

.category-total-name {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 700;
  margin-bottom: 6px;
}

.category-total-number {
  font-family: var(--font-mono);
  font-size: 20px;
  color: var(--indigo);
  font-weight: 700;
}

.category-total-label {
  font-size: 11px;
  color: var(--text-muted);
}

.low-stock-alerts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 190px;
  overflow: auto;
  padding-left: 3px;
}

.low-alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--yellow-soft);
  border: 1px solid rgba(193, 133, 46, 0.25);
  border-radius: var(--radius);
  padding: 10px;
}

.low-alert-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-2);
  color: #8a5f1f;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

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

.low-alert-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.low-alert-qty {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #8a5f1f;
  white-space: nowrap;
}

.low-alert-empty,
.category-empty {
  color: var(--text-muted);
  font-size: 13px;
  padding: 16px 8px;
  text-align: center;
}

.low-alert-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* quantity controls */
.qty-btn {
  width: 30px;
  padding: 0;
  justify-content: center;
}

@media (max-width: 680px) {
  .inventory-extra {
    grid-template-columns: 1fr;
  }

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

  .low-stock-alerts {
    max-height: none;
  }
}

/* ── Print (clean inventory printout) ────────────────────────── */
@media print {
  .header, .tabs, .toolbar, .row-actions, .inventory-extra,
  .toast-stack, .loading-overlay, .modal-overlay { display: none !important; }
  body { background: #fff; }
  .table-wrap { box-shadow: none; border: 1px solid #000; }
}

/* ── Settings page ─────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.settings-add-row {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.settings-add-row .form-input {
  flex: 1;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 700;
}

.settings-empty,
.settings-note {
  background: var(--surface-0);
  border: 1px dashed var(--border-dashed);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.7;
}

@media (max-width: 680px) {
  .settings-grid { grid-template-columns: 1fr; }
  .settings-add-row { flex-direction: column; }
}

/* ── Footer ─────────────────────────────────────────────────── */
.app-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  padding: 22px 16px 28px;
  margin-top: 10px;
  border-top: 1px dashed var(--border-dashed);
}

.footer-logo {
  width: 30px;
  height: 30px;
  object-fit: contain;
  opacity: .85;
}

.footer-text { text-align: right; }
.footer-brand { font-size: 13px; font-weight: 800; color: var(--indigo); letter-spacing: .3px; }
.footer-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

@media print { .app-footer { display: none !important; } }

/* ── Loading logo pulse ────────────────────────────────────── */
.loading-logo-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  z-index: 1;
  animation: logoPulse 1.4s ease-in-out infinite;
}

.spinner-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--brass);
  border-right-color: var(--indigo);
  animation: spin .9s linear infinite;
}

@keyframes logoPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(.9); opacity: .75; }
}
