:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #0f172a;
  --primary-hover: #1e293b;
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --emerald: #059669;
  --emerald-bg: #ecfdf5;
  --emerald-border: #a7f3d0;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --amber-border: #fde68a;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --indigo: #4f46e5;
  --indigo-bg: #eef2ff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.22);
}

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

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 18px;
}

/* Header */
.topbar {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.16);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0ea5e9 0%, #10b981 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}

.brand-icon svg {
  width: 24px;
  height: 24px;
}

.brand-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: #94a3b8;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-sm {
  padding: 7px 12px;
  font-size: 0.8rem;
  border-radius: 8px;
}

.btn-compact {
  padding: 9px 12px;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-scan {
  background: #10b981;
  color: #fff;
}

.btn-scan:hover:not(:disabled) {
  background: #059669;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

.modal .btn-secondary,
.products-grid .btn-secondary,
.products-list .btn-secondary,
.upload-card .btn-secondary,
.scanner-alt-actions .btn-secondary {
  background: #f1f5f9;
  color: var(--text);
  border-color: var(--border-strong);
}

.modal .btn-secondary:hover:not(:disabled),
.products-grid .btn-secondary:hover:not(:disabled),
.products-list .btn-secondary:hover:not(:disabled),
.upload-card .btn-secondary:hover:not(:disabled),
.scanner-alt-actions .btn-secondary:hover:not(:disabled) {
  background: #e2e8f0;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-outline:hover:not(:disabled) {
  background: var(--surface-muted);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border-color: transparent;
}

.btn-danger-ghost:hover:not(:disabled) {
  background: var(--danger-bg);
}

.btn-emerald-soft {
  background: var(--emerald-bg);
  color: var(--emerald);
  border-color: var(--emerald-border);
}

.btn-emerald-soft:hover:not(:disabled) {
  background: #d1fae5;
}

.btn-amber-soft {
  background: var(--amber-bg);
  color: #b45309;
  border-color: var(--amber-border);
}

.btn-amber-soft:hover:not(:disabled) {
  background: #fef3c7;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 6px;
}

.btn-link:hover {
  text-decoration: underline;
}

/* Main */
.main-content {
  padding-top: 22px;
  padding-bottom: 96px;
}

/* Alert Banners */
.alert-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  border: 1px solid;
}

.alert-danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: #991b1b;
}

.alert-hint {
  font-size: 0.82rem;
  margin-top: 4px;
  opacity: 0.9;
}

.alert-inline {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  line-height: 1.45;
  margin-bottom: 14px;
  border: 1px solid;
}

.alert-warning {
  background: var(--amber-bg);
  border-color: var(--amber-border);
  color: #92400e;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card-pending {
  border-color: #fed7aa;
  background: linear-gradient(180deg, #ffffff 0%, #fff7ed 100%);
}

.text-orange { color: #ea580c; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: left;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}

.stat-card:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.stat-card-static {
  cursor: default;
}

.stat-card-static:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.stat-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-value {
  display: block;
  margin-top: 6px;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.text-emerald { color: var(--emerald); }
.text-sky { color: var(--accent); }
.text-amber { color: var(--amber); }
.text-slate { color: #475569; }
.text-indigo { color: var(--indigo); }

/* Toolbar */
.toolbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 11px 46px 11px 42px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.94rem;
  color: var(--text);
  background: var(--surface-muted);
  transition: border-color 0.15s, background 0.15s;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.14);
}

.btn-icon-inline {
  position: absolute;
  right: 6px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: #ecfdf5;
  color: #059669;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-icon-inline:hover {
  background: #d1fae5;
}

.filters-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.segmented {
  display: inline-flex;
  background: var(--bg);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 7px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.seg-btn.active {
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text);
  min-height: 38px;
}

.filter-select.full-width {
  width: 100%;
}

.view-toggle {
  margin-left: auto;
  display: inline-flex;
  gap: 4px;
  background: var(--bg);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.icon-toggle {
  width: 34px;
  height: 32px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-toggle.active {
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 2px 12px;
}

.results-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Products Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}

.products-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.product-card.is-inactive {
  opacity: 0.78;
  background: #f8fafc;
  border-style: dashed;
}

.card-media {
  position: relative;
  height: 175px;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-media-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 500;
}

.card-badges-top {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  pointer-events: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}

.badge-active {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.badge-inactive {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

.badge-in-stock {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #bae6fd;
}

.badge-out-stock {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.badge-fds-ok {
  background: #eef2ff;
  color: #4338ca;
  border-color: #c7d2fe;
}

.badge-fds-missing {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.badge-incomplete {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fdba74;
}

.missing-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 9px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 0.76rem;
  font-weight: 600;
}

.product-card.is-incomplete {
  border-color: #fdba74;
}

/* Quick Capture Modal */
.quick-capture-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quick-photo-box {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.quick-photo-preview {
  position: relative;
  width: 100%;
  height: 220px;
  border-radius: 10px;
  overflow: hidden;
  background: #0f172a;
}

.quick-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.quick-photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.84rem;
  padding: 16px 10px;
}

.quick-photo-buttons {
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.quick-photo-buttons .btn {
  flex: 1;
  min-width: 130px;
}

.quick-extras-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.quick-extras-row input[type="text"] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
}

.quick-switch-full {
  text-align: center;
}

.quick-footer {
  gap: 10px;
}

@media (max-width: 540px) {
  .quick-extras-row {
    grid-template-columns: 1fr;
  }
  .quick-footer .modal-footer-right {
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr;
  }
}

.card-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.card-barcode {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-title {
  margin: 0;
  font-size: 1.03rem;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
}

.card-title:hover {
  color: var(--accent);
}

.card-desc {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 0.78rem;
  color: #475569;
  margin-top: auto;
  padding-top: 6px;
}

.card-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.card-actions {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface-muted);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.card-actions .btn-full-span {
  grid-column: 1 / -1;
}

/* List view variant */
.products-list .product-card {
  flex-direction: row;
  align-items: stretch;
}

.products-list .card-media {
  width: 124px;
  height: auto;
  min-height: 112px;
  flex-shrink: 0;
}

.products-list .card-badges-top {
  display: none;
}

.products-list .card-body {
  padding: 12px 16px;
}

.products-list .card-actions {
  border-top: none;
  border-left: 1px solid var(--border);
  width: 245px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

/* Empty State */
.empty-state {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 48px 20px;
  text-align: center;
}

.empty-icon {
  color: #94a3b8;
  margin-bottom: 12px;
}

.empty-state h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.empty-state p {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.empty-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.modal {
  background: var(--surface);
  border-radius: 18px;
  width: 100%;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 0.16s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-md { max-width: 540px; }
.modal-lg { max-width: 820px; }

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
}

.modal-subtitle {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.btn-close {
  border: none;
  background: var(--bg);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-close:hover {
  background: var(--border);
  color: var(--text);
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.modal-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.form-span-2 {
  grid-column: 1 / -1;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
}

.label-hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.req {
  color: var(--danger);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: #fff;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.14);
}

.input-with-btn {
  display: flex;
  gap: 8px;
}

.input-with-btn input {
  flex: 1;
  min-width: 0;
}

.qty-row {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 8px;
}

/* Switches */
.toggles-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.switch-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  cursor: pointer;
  user-select: none;
}

.switch-card input[type="checkbox"] {
  display: none;
}

.switch-slider {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #cbd5e1;
  flex-shrink: 0;
  transition: background 0.18s;
}

.switch-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.switch-card input[type="checkbox"]:checked + .switch-slider {
  background: var(--emerald);
}

.switch-card input[type="checkbox"]:checked + .switch-slider::after {
  transform: translateX(16px);
}

.switch-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

/* Upload Cards */
.upload-card {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--surface-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-height: 146px;
  justify-content: center;
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
}

.image-preview-wrap {
  position: relative;
  width: 100%;
  height: 128px;
  border-radius: 8px;
  overflow: hidden;
  background: #e2e8f0;
}

.image-preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0f172a;
}

.btn-remove-media {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: 1.15rem;
  cursor: pointer;
}

.pdf-preview-wrap {
  width: 100%;
}

.pdf-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--indigo);
}

.pdf-chip-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pdf-chip-info strong {
  font-size: 0.83rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-chip-info a {
  font-size: 0.76rem;
  color: var(--accent);
}

.btn-remove-media-inline {
  border: none;
  background: var(--danger-bg);
  color: var(--danger);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
}

/* Scanner */
.scanner-viewport-wrap {
  background: #0f172a;
  border-radius: var(--radius-sm);
  overflow: hidden;
  min-height: 250px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#barcodeReader {
  width: 100%;
}

.scanner-status {
  padding: 10px 14px;
  text-align: center;
  font-size: 0.83rem;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.9);
}

.scanner-alt-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.manual-barcode-box {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.manual-barcode-box label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Detail Modal */
.detail-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
}

.detail-photo {
  border-radius: 12px;
  overflow: hidden;
  background: #f8fafc;
  border: 1px solid var(--border);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.detail-desc {
  margin: 0 0 14px;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #334155;
  white-space: pre-wrap;
}

.detail-specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.spec-box {
  padding: 10px 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.spec-box span {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-muted);
}

.spec-box strong {
  display: block;
  margin-top: 3px;
  font-size: 0.88rem;
  color: var(--text);
}

/* Compile Modal */
.compile-summary {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  line-height: 1.5;
}

.progress-wrap {
  margin-top: 16px;
}

.progress-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.83rem;
  margin-bottom: 6px;
}

.progress-bar {
  height: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #10b981);
  transition: width 0.2s ease;
}

/* Busy Overlay */
.busy-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.busy-card {
  background: #fff;
  border-radius: 16px;
  padding: 26px 30px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.busy-card strong {
  display: block;
  margin-top: 14px;
  font-size: 1rem;
}

.busy-card p {
  margin: 6px 0 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.spinner {
  width: 38px;
  height: 38px;
  border: 4px solid #e2e8f0;
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 0.8s linear infinite;
}

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

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 250;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}

.toast {
  background: #0f172a;
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 0.86rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: toastIn 0.2s ease-out;
}

.toast.toast-success { border-left: 4px solid #10b981; }
.toast.toast-error { border-left: 4px solid #ef4444; }
.toast.toast-info { border-left: 4px solid #38bdf8; }

.toast-action {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
}

.toast-action:hover {
  background: rgba(255, 255, 255, 0.28);
}

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

/* Mobile Floating Action Bar */
.mobile-fab-bar {
  display: none;
}

/* Responsive */
@media (max-width: 960px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .products-list .product-card {
    flex-direction: column;
  }
  .products-list .card-media {
    width: 100%;
    height: 160px;
  }
  .products-list .card-badges-top {
    display: flex;
  }
  .products-list .card-actions {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .topbar-actions #btnOpenScannerHeader,
  .topbar-actions #btnNewProduct {
    display: none;
  }

  .brand-subtitle {
    display: none;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid,
  .detail-layout,
  .detail-specs,
  .toggles-pair {
    grid-template-columns: 1fr;
  }

  .view-toggle {
    display: none;
  }

  .mobile-fab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 45;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--border);
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    box-shadow: 0 -4px 18px rgba(15, 23, 42, 0.08);
  }

  .toast-container {
    bottom: 78px;
    left: 14px;
    right: 14px;
    max-width: none;
  }
}
