:root {
  --bg: #f4f2fa;
  --surface: #ffffff;
  --surface-alt: #f9f8fd;
  --sidebar-bg: #0b0516;
  --sidebar-hover: #1b0f33;
  --text: #120a24;
  --text-muted: #645c7a;
  --border: #e3ddf2;
  --silver: #cbd5e1;
  --primary: #9333ea;
  --primary-hover: #7e22ce;
  --primary-glow: #c026d3;
  --primary-soft: #faf5ff;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #7c3aed;
  --info-soft: #ede9fe;
  --radius: 12px;
  --shadow-sm: 0 1px 3px rgba(18, 10, 36, 0.06);
  --shadow-md: 0 10px 28px rgba(18, 10, 36, 0.12);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  font-size: 14px;
}

.hidden {
  display: none !important;
}

code, .mono {
  font-family: 'JetBrains Mono', monospace;
}

/* ============================================================================
   LOGIN SCREEN
   ============================================================================ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 18%, rgba(168, 85, 247, 0.30), transparent 52%),
    radial-gradient(circle at 82% 85%, rgba(192, 38, 211, 0.18), transparent 46%),
    linear-gradient(180deg, #0d061b 0%, #06030d 100%);
  padding: 20px;
}

.login-card {
  background: linear-gradient(180deg, #150b2b 0%, #0c0618 100%);
  border: 1px solid rgba(192, 132, 252, 0.30);
  width: 100%;
  max-width: 440px;
  border-radius: 18px;
  padding: 28px 32px 32px;
  box-shadow: 0 28px 65px rgba(0, 0, 0, 0.72), 0 0 42px rgba(147, 51, 234, 0.22);
  color: #f1f5f9;
}

.brand-logo-showcase {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(192, 132, 252, 0.18);
  background: radial-gradient(circle at 50% 48%, rgba(168, 85, 247, 0.22), transparent 68%);
}

.login-hero-logo {
  width: 100%;
  max-width: 320px;
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 22px rgba(168, 85, 247, 0.38));
}

.login-card .form-group label {
  color: #cbd5e1;
}

.login-card input[type="text"],
.login-card input[type="password"] {
  background: rgba(15, 8, 32, 0.85);
  border-color: rgba(168, 85, 247, 0.32);
  color: #ffffff;
}

.login-card input[type="text"]::placeholder,
.login-card input[type="password"]::placeholder {
  color: #7c7296;
}

.login-card input[type="text"]:focus,
.login-card input[type="password"]:focus {
  border-color: #c084fc;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.28);
}

/* ============================================================================
   LAYOUT & SIDEBAR
   ============================================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 265px;
  background: linear-gradient(180deg, #110824 0%, #080411 100%);
  border-right: 1px solid rgba(168, 85, 247, 0.20);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  padding: 14px 14px 18px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 4px 14px;
  border-bottom: 1px solid rgba(192, 132, 252, 0.16);
  background: radial-gradient(circle at 50% 45%, rgba(168, 85, 247, 0.20), transparent 72%);
}

.sidebar-logo-img {
  width: 100%;
  max-width: 222px;
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 14px rgba(168, 85, 247, 0.32));
}

.lot-selector-box {
  margin: 14px 4px;
  background: rgba(168, 85, 247, 0.07);
  border: 1px solid rgba(192, 132, 252, 0.20);
  border-radius: 10px;
  padding: 10px;
}

.lot-selector-box label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #c4b5fd;
  margin-bottom: 6px;
  font-weight: 600;
}

.lot-selector-box select {
  width: 100%;
  background: #190d31;
  color: #fff;
  border: 1px solid rgba(168, 85, 247, 0.34);
  border-radius: 7px;
  padding: 7px 8px;
  font-size: 12.5px;
  font-weight: 600;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  color: #cbd5e1;
  padding: 11px 12px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: linear-gradient(135deg, #9333ea, #c026d3);
  color: #fff;
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.40);
}

.nav-pill {
  margin-left: auto;
  background: rgba(11, 5, 22, 0.45);
  color: #fff;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 99px;
  font-family: 'JetBrains Mono', monospace;
}

.sidebar-batch {
  background: #190d31;
  border: 1px solid rgba(168, 85, 247, 0.30);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 12px;
}

.batch-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  margin-bottom: 6px;
}

.batch-progress-track {
  height: 6px;
  background: #0b0516;
  border-radius: 99px;
  overflow: hidden;
}

.batch-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #9333ea, #d946ef);
  transition: width 0.3s ease;
}

.batch-subtext {
  margin-top: 5px;
  font-size: 11px;
  color: #b8add1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid rgba(192, 132, 252, 0.15);
}

.operator-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.operator-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #9333ea, #6b21a8);
  border: 1px solid rgba(226, 232, 240, 0.35);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.operator-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.operator-role {
  font-size: 11px;
  color: #c4b5fd;
}

.mobile-header {
  display: none;
}

.main-content {
  flex: 1;
  margin-left: 265px;
  padding: 24px 28px 60px;
  max-width: 1560px;
}

/* ============================================================================
   COMMON UI ELEMENTS
   ============================================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-header p {
  color: var(--text-muted);
  margin-top: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 15px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-lg {
  padding: 12px 18px;
  font-size: 14.5px;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
}

.btn-xs {
  padding: 4px 9px;
  font-size: 11.5px;
  border-radius: 6px;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, #9333ea, #7e22ce);
  color: #fff;
  box-shadow: 0 3px 10px rgba(147, 51, 234, 0.28);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #a855f7, #9333ea);
  box-shadow: 0 5px 14px rgba(168, 85, 247, 0.36);
}

.btn-secondary {
  background: #170b2d;
  border-color: rgba(168, 85, 247, 0.32);
  color: #fff;
}
.btn-secondary:hover:not(:disabled) {
  background: #241245;
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover:not(:disabled) {
  background: #15803d;
}

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

.btn-outline {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover:not(:disabled) {
  background: var(--surface-alt);
  border-color: #cbd5e1;
}

.btn-icon {
  background: transparent;
  border: none;
  font-size: 17px;
  cursor: pointer;
  padding: 6px;
  border-radius: 7px;
  color: inherit;
}
.btn-icon:hover {
  background: rgba(148, 163, 184, 0.18);
}

.btn-link-danger {
  background: none;
  border: none;
  color: #f87171;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 12.5px;
  margin-bottom: 5px;
  color: #334155;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="date"],
input[type="file"],
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13.5px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.18);
}

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

.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); font-size: 11.5px; }

.alert-error {
  background: var(--danger-soft);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
}

/* ============================================================================
   SCANNER & WORKBENCH VIEW
   ============================================================================ */
.scanner-hero {
  background:
    radial-gradient(circle at 92% 18%, rgba(192, 38, 211, 0.25), transparent 48%),
    linear-gradient(135deg, #0d061b 0%, #1c0f36 100%);
  border: 1px solid rgba(192, 132, 252, 0.25);
  color: #fff;
  padding: 22px 24px;
  border-radius: 14px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
}

.scanner-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.scanner-hero h2 {
  font-size: 20px;
  font-weight: 800;
}

.scanner-hero p {
  color: #cbd5e1;
  font-size: 13px;
  margin-top: 2px;
}

.scanner-toggles {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 11px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.scan-bar-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.scan-input-wrap {
  flex: 1;
  min-width: 260px;
  position: relative;
  display: flex;
  align-items: center;
}

.scan-prefix {
  position: absolute;
  left: 14px;
  color: var(--primary);
  font-weight: 800;
  letter-spacing: -1px;
  pointer-events: none;
}

#scan-input {
  padding: 13px 38px 13px 48px;
  font-size: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  border-radius: 10px;
  border: 2px solid rgba(192, 132, 252, 0.45);
  background: #fff;
  color: #120a24;
}

#scan-input:focus {
  border-color: #a855f7;
  box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.32);
}

.scan-clear {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  font-size: 15px;
  color: #64748b;
  cursor: pointer;
}

.candidates-bar {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.candidate-chip {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.candidate-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 700;
}

.empty-workbench {
  background: var(--surface);
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  padding: 46px 28px;
  text-align: center;
}

.empty-icon {
  font-size: 44px;
  margin-bottom: 10px;
}

.empty-workbench h3 {
  font-size: 19px;
  font-weight: 700;
}

.empty-workbench p {
  max-width: 620px;
  margin: 8px auto 24px;
  color: var(--text-muted);
}

.quick-tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  max-width: 820px;
  margin: 0 auto;
  text-align: left;
}

.tip-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: 10px;
}

.tip-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.tip-card span {
  font-size: 12.5px;
  color: var(--text-muted);
}

.workbench-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 20px;
  align-items: start;
}

.product-header-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.product-media-row {
  display: flex;
  gap: 16px;
  margin-bottom: 18px;
}

.product-thumb-lg {
  width: 136px;
  height: 136px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.product-thumb-lg img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.no-img-placeholder {
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
  padding: 8px;
}

.wb-product-title {
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 10px;
}

.mono-codes-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.code-tag {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11.5px;
  font-family: 'JetBrains Mono', monospace;
}

.code-tag strong {
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 4px;
}

.market-links-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ext-link-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 6px;
  background: #eff6ff;
  color: #1d4ed8;
  text-decoration: none;
  border: 1px solid #bfdbfe;
}
.ext-link-pill:hover {
  background: #dbeafe;
}

.section-kicker {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
}

.price-intel-panel {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 15px;
  margin-bottom: 18px;
}

.price-intel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
  flex-wrap: wrap;
}

.price-loading-banner {
  background: var(--info-soft);
  color: var(--info);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.price-warning-banner {
  background: var(--warning-soft);
  color: #92400e;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
}

.price-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.price-metric {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
}

.price-metric.highlight {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.pm-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.pm-value {
  display: block;
  font-size: 19px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
}

.pm-value.muted {
  color: #475569;
}

.pm-input-inline {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  font-size: 17px;
}

.pm-input-inline input {
  padding: 4px 7px;
  font-size: 16px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
}

.pm-sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Photos */
.photos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.upload-btn-label {
  cursor: pointer;
}

.photos-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.photo-item {
  width: 82px;
  height: 82px;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  background: #f8fafc;
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.photo-del-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: 11px;
  cursor: pointer;
}

/* Condition Tier Cards */
.helper-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.tier-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  margin-top: 12px;
}

.tier-card {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  background: #fff;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.12s;
  text-align: left;
}

.tier-card:hover {
  border-color: #94a3b8;
  background: var(--surface-alt);
}

.tier-card.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.16);
}

.tier-card.scrap-tier.selected {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.tier-card.repair-tier.selected {
  border-color: var(--warning);
  background: var(--warning-soft);
}

.tier-name {
  font-weight: 700;
  font-size: 13px;
  display: block;
}

.tier-disc {
  font-size: 11px;
  color: var(--text-muted);
}

.tier-price {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 15.5px;
  color: var(--text);
}

.input-price-lg {
  font-size: 19px !important;
  font-weight: 800 !important;
  font-family: 'JetBrains Mono', monospace !important;
  color: var(--success) !important;
}

.margin-preview {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
  font-weight: 600;
}

.channels-quick-box {
  margin-bottom: 16px;
}

.sub-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.channel-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.channel-pill {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 99px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all 0.12s;
}

.channel-pill.active {
  background: #170b2d;
  color: #fff;
  border-color: #9333ea;
}

.workbench-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

#btn-save-scrap {
  grid-column: span 2;
}

/* ============================================================================
   BADGES & INVENTORY TABLE
   ============================================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-pending { background: #e2e8f0; color: #334155; }
.badge-indexed { background: #dbeafe; color: #1d4ed8; }
.badge-listed { background: #f3e8ff; color: #7e22ce; border: 1px solid #d8b4fe; }
.badge-sold { background: #dcfce7; color: #15803d; }
.badge-repair { background: #fef3c7; color: #b45309; }
.badge-scrap { background: #fee2e2; color: #b91c1c; }

.pipeline-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.pipe-tab {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #334155;
}

.pipe-tab span {
  background: #f1f5f9;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 11.5px;
  font-family: 'JetBrains Mono', monospace;
}

.pipe-tab.active {
  background: linear-gradient(135deg, #170b2d, #2b1354);
  color: #fff;
  border-color: #9333ea;
}

.pipe-tab.active span {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.filter-bar {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1.1fr;
  gap: 10px;
  padding: 14px;
  margin-bottom: 16px;
}

.table-card {
  padding: 0;
  overflow: hidden;
}

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

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

.items-table th {
  background: var(--surface-alt);
  text-align: left;
  padding: 12px 14px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.items-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.items-table tr:hover td {
  background: #fafaf9;
}

.row-product-cell {
  display: flex;
  gap: 11px;
  align-items: center;
  max-width: 390px;
}

.row-thumb {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  object-fit: contain;
  flex-shrink: 0;
}

.row-title {
  font-weight: 600;
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.row-subcodes {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface-alt);
}

/* ============================================================================
   DASHBOARD & ROI
   ============================================================================ */
.roi-banner {
  margin-bottom: 20px;
  background:
    radial-gradient(circle at 90% 20%, rgba(192, 38, 211, 0.25), transparent 50%),
    linear-gradient(135deg, #0d061b 0%, #1c0f36 100%);
  color: #fff;
  border: 1px solid rgba(192, 132, 252, 0.25);
}

.roi-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.roi-track {
  height: 14px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 10px;
}

.roi-fill {
  height: 100%;
  background: linear-gradient(90deg, #9333ea, #d946ef, #22c55e);
  transition: width 0.4s ease;
}

.roi-stats-line {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #cbd5e1;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 24px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  margin: 6px 0 3px;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.dashboard-2col,
.lots-layout {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 20px;
  align-items: start;
}

.pallets-list,
.lots-cards-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.pallet-item,
.lot-card-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: var(--surface-alt);
}

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

.mini-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
  margin: 8px 0;
}

.mini-bar-fill {
  height: 100%;
  background: var(--info);
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

.sub-heading {
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 10px;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface-alt);
  border-radius: 8px;
  font-size: 12.5px;
}

/* ============================================================================
   MODALS & TOASTS
   ============================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 500;
}

.modal-card {
  background: #fff;
  width: 100%;
  max-width: 540px;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  max-height: 92vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-item-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  background: var(--surface-alt);
  padding: 8px 11px;
  border-radius: 8px;
  margin-bottom: 14px;
}

.ad-copy-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px;
  margin-bottom: 14px;
}

.ad-copy-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.profit-preview-box {
  background: var(--success-soft);
  color: #14532d;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 14px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 900;
}

.toast {
  background: #120924;
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(168, 85, 247, 0.28);
  border-left: 4px solid var(--primary);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

.spinner-sm {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
}

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

.rule-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.rule-row input {
  width: 95px;
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}

.users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface-alt);
  border-radius: 8px;
}

/* ============================================================================
   RESPONSIVE (TABLET & SMARTPHONE IN WAREHOUSE)
   ============================================================================ */
@media (max-width: 1060px) {
  .workbench-grid,
  .dashboard-2col,
  .lots-layout {
    grid-template-columns: 1fr;
  }
  .filter-bar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 820px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(90deg, #0d061b, #1a0d33);
    border-bottom: 1px solid rgba(168, 85, 247, 0.28);
    color: #fff;
    padding: 9px 14px;
    position: sticky;
    top: 0;
    z-index: 90;
  }
  .mobile-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 16px;
    color: #e2e8f0;
  }
  .mobile-logo-img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(168, 85, 247, 0.45));
  }
  .brand-express-accent {
    color: #c084fc;
  }
  .app-shell {
    flex-direction: column;
  }
  .main-content {
    margin-left: 0;
    padding: 16px 14px 50px;
  }
  .price-metrics-row,
  .tier-cards-grid,
  .form-row-2col,
  .workbench-actions,
  .filter-bar {
    grid-template-columns: 1fr;
  }
  #btn-save-scrap {
    grid-column: span 1;
  }
}
