/* ═══════════════════════════════════════════════════════════
   QUICK INVENTORY — Styles
   Design: Sober, professional, minimalist
   ═══════════════════════════════════════════════════════════ */

/* ── Tokens ── */
:root {
  --bg:          #111318;
  --surface:     #1a1d27;
  --surface-2:   #232733;
  --surface-3:   #2b3040;
  --border:      #2e3340;
  --border-light:#3a3f50;

  --text:        #e5e7eb;
  --text-2:      #9ca3af;
  --text-3:      #6b7280;

  --accent:      #3b82f6;
  --accent-dim:  rgba(59,130,246,0.12);
  --accent-hover:#2563eb;

  --success:     #22c55e;
  --success-dim: rgba(34,197,94,0.12);
  --warning:     #f59e0b;
  --warning-dim: rgba(245,158,11,0.12);
  --error:       #ef4444;
  --error-dim:   rgba(239,68,68,0.12);

  --radius:      8px;
  --radius-lg:   12px;
  --radius-xl:   16px;

  --font:        'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', monospace;

  --shadow:      0 4px 24px rgba(0,0,0,0.3);
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.2);
}

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

/* ── Global scrollbar ── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(59,130,246,0.35);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(59,130,246,0.6);
}
::-webkit-scrollbar-corner { background: transparent; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ── */
h1 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); }
h4 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); }


/* ═══════════ HEADER ═══════════ */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

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

.header__logo {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all 0.15s;
}
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-icon.active { background: var(--accent-dim); color: var(--accent); border-color: rgba(59,130,246,0.3); }


/* ═══════════ MAIN LAYOUT ═══════════ */
.main {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}


/* ═══════════ CAMERA SECTION ═══════════ */
.camera {
  flex: 1;
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.camera video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera canvas { display: none; }

/* Status bar */
.status {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(12px);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  z-index: 5;
  white-space: nowrap;
  border: 1px solid rgba(255,255,255,0.06);
}

.status__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.2s;
}
.status__dot--idle    { background: var(--text-3); }
.status__dot--detecting { background: var(--warning); animation: blink 0.8s infinite; }
.status__dot--analyzing { background: var(--accent); animation: blink 0.5s infinite; }
.status__dot--ready   { background: var(--success); }
.status__dot--error   { background: var(--error); }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Scan zone */
.scan-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scan-zone {
  width: 65%;
  height: 50%;
  border: 1.5px dashed rgba(255,255,255,0.15);
  border-radius: var(--radius-xl);
  transition: all 0.3s;
  position: relative;
}

.scan-zone--detecting {
  border-color: rgba(245,158,11,0.5);
}

.scan-zone--analyzing {
  border-color: rgba(59,130,246,0.6);
  animation: pulse-border 1.2s ease infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: rgba(59,130,246,0.6); }
  50% { border-color: rgba(59,130,246,0.2); }
}

/* Stability progress ring */
.stability-ring {
  position: absolute;
  bottom: 170px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  opacity: 0;
  transition: opacity 0.3s;
}
.scan-zone--detecting ~ .stability-ring { opacity: 1; }

.stability-ring__circle {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-dasharray: 113;
  stroke-dashoffset: 113;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 0.3s;
}

/* Camera controls */
.camera-controls {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 8;
}

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

.toggle-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(12px);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  border: 1px solid rgba(255,255,255,0.06);
  transition: all 0.2s;
}
.toggle-pill:hover { border-color: rgba(255,255,255,0.12); }

.toggle-switch {
  width: 28px;
  height: 16px;
  border-radius: 8px;
  background: var(--surface-3);
  position: relative;
  transition: background 0.2s;
}
.toggle-pill.active .toggle-switch { background: var(--accent); }

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}
.toggle-pill.active .toggle-switch::after { transform: translateX(12px); }

/* Capture button */
.capture-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(8px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.capture-btn:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.5);
}
.capture-btn:active { transform: scale(0.92); }

.capture-btn__inner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: white;
  transition: all 0.15s;
}

.capture-btn.processing .capture-btn__inner {
  background: var(--accent);
  animation: pulse-capture 0.8s ease infinite;
}

@keyframes pulse-capture {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.85); }
}

/* Auto-confirm timer */
.auto-confirm-timer {
  position: absolute;
  bottom: 200px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(34,197,94,0.15);
  border: 1px solid rgba(34,197,94,0.3);
  color: var(--success);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  z-index: 9;
  display: none;
  font-family: var(--font-mono);
}
.auto-confirm-timer.visible { display: block; }

/* Keyboard hints */
.kbd-hints {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
  z-index: 5;
}

.kbd-hint {
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 10px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.kbd-hint kbd {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 4px;
  font-size: 9px;
  color: var(--text-2);
}


/* ═══════════ RESULT OVERLAY ═══════════ */
.result-overlay {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17,19,24,0.92);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 16px 20px;
  z-index: 10;
  width: calc(100% - 32px);
  max-width: 420px;
  display: none;
  animation: slide-up 0.2s ease;
}

.result-overlay.visible { display: block; }

.burst-overlay {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17,19,24,0.92);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 0;
  z-index: 10;
  width: calc(100% - 32px);
  max-width: 420px;
  max-height: 340px;
  display: none;
  animation: slide-up 0.2s ease;
  flex-direction: column;
  overflow: hidden;
}

.burst-overlay.visible { display: flex; }

@keyframes slide-up {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.result__name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.result__name-edit {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font);
  background: var(--surface-2);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--text);
  padding: 3px 8px;
  width: 100%;
  outline: none;
  display: none;
}

.result__confidence {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
}
.result__confidence--high   { background: var(--success-dim); color: var(--success); }
.result__confidence--medium { background: var(--warning-dim); color: var(--warning); }
.result__confidence--low    { background: var(--error-dim); color: var(--error); }

.result__details {
  font-size: 12px;
  color: var(--text-2);
  margin: 6px 0 14px;
  line-height: 1.5;
}

.result__actions {
  display: flex;
  gap: 8px;
}

/* Burst list */
.burst-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
}
.burst-item:last-child { border: none; }

.burst-item input[type=checkbox] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.burst-item__name { font-weight: 600; flex: 1; }
.burst-item__meta { color: var(--text-3); font-size: 11px; }

.burst-actions {
  padding: 10px 20px;
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}


/* ═══════════ BUTTONS ═══════════ */
.btn {
  flex: 1;
  padding: 9px 14px;
  border-radius: var(--radius);
  border: none;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

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

.btn--reject {
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn--reject:hover { background: var(--surface-3); color: var(--text); }

.btn--edit {
  background: transparent;
  color: var(--text-3);
  border: 1px solid var(--border);
  flex: 0;
  padding: 9px 11px;
}
.btn--edit:hover { background: var(--surface-2); color: var(--text-2); }


/* ═══════════ INVENTORY PANEL ═══════════ */
.panel {
  width: 360px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: 0;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.panel__header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Tabs */
.panel__tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  padding: 9px 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.15s;
}
.tab-btn:hover { color: var(--text-2); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Panel contents */
.panel-content { display: none; flex-direction: column; flex: 1; overflow: hidden; min-height: 0; }
.panel-content.active { display: flex; }

/* Search */
.panel__search {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.panel__search input {
  width: 100%;
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
}
.panel__search input:focus { border-color: var(--accent); }
.panel__search input::placeholder { color: var(--text-3); }

/* Inventory list */
.panel__list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
}

.inv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  transition: background 0.12s;
  animation: fade-in 0.25s ease;
}
.inv-item:hover { background: var(--surface-2); }

@keyframes fade-in {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.inv-item__thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-3);
  cursor: pointer;
  transition: border-color 0.12s, transform 0.12s;
}
.inv-item__thumb:hover { border-color: var(--accent); transform: scale(1.08); }
.inv-item__thumb img { width: 100%; height: 100%; object-fit: cover; }

.inv-item__body { flex: 1; min-width: 0; }

.inv-item__top {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.inv-item__name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inv-item__code {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  flex-shrink: 0;
}

.inv-item__meta {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 2px;
  display: flex;
  gap: 4px;
}
.inv-item__meta span::after { content: '·'; margin-left: 4px; }
.inv-item__meta span:last-child::after { content: ''; }

.inv-item__tags {
  display: flex;
  gap: 3px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.tag {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent-dim);
  color: var(--accent);
}

.inv-item__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.inv-item__qty {
  display: flex;
  align-items: center;
  gap: 2px;
}

.qty-btn {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
.qty-btn:hover { background: var(--surface-3); color: var(--text); }

.qty-val {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  min-width: 22px;
  text-align: center;
}

.inv-item__del {
  opacity: 0;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: var(--error);
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
}
.inv-item:hover .inv-item__del { opacity: 0.6; }
.inv-item__del:hover { opacity: 1 !important; }


/* Footer */
.panel__footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 6px;
}

.btn-footer {
  flex: 1;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
  text-align: center;
}
.btn-footer:hover { background: var(--surface-3); color: var(--text); }

.btn-footer--danger {
  border-color: rgba(239,68,68,0.25);
  color: var(--error);
  background: var(--error-dim);
  flex: 0;
  padding: 7px 12px;
}
.btn-footer--danger:hover { background: rgba(239,68,68,0.2); }


/* ═══════════ EMPTY STATE ═══════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-3);
  font-size: 12px;
  gap: 6px;
  padding: 40px 20px;
  text-align: center;
}
.empty-state__icon { font-size: 28px; margin-bottom: 4px; opacity: 0.4; }
.empty-state__title { font-weight: 600; color: var(--text-2); }


/* ═══════════ SETTINGS ═══════════ */
.settings-form {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.settings-form label.field-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  margin-bottom: 5px;
  margin-top: 14px;
}
.settings-form label.field-label:first-child { margin-top: 0; }

.settings-form input[type=text],
.settings-form select {
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
}
.settings-form input:focus,
.settings-form select:focus { border-color: var(--accent); }

.settings-form select { cursor: pointer; }

.field-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
}
.field-toggle input { accent-color: var(--accent); }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
}
.checkbox-row input { accent-color: var(--accent); }

.settings-form .btn--save {
  width: 100%;
  margin-top: 20px;
  padding: 9px;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.settings-form .btn--save:hover { background: var(--accent-hover); }

.field-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  margin-top: 16px;
  margin-bottom: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}


/* ═══════════ SESSIONS ═══════════ */
.sessions-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.session-item {
  padding: 10px 12px;
  border-radius: var(--radius);
  border-bottom: 1px solid var(--border);
}
.session-item:last-child { border: none; }

.session-item__date {
  font-size: 12px;
  font-weight: 600;
}

.session-item__meta {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}


/* ═══════════ SUMMARY ═══════════ */
.summary-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.summary-stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}

.summary-stat__value {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.summary-stat__label {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.summary-section-title {
  margin-top: 16px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px solid rgba(46,51,64,0.4);
}
.summary-row:last-child { border: none; }

.summary-row__qty {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-2);
}


/* ═══════════ NOTIFICATIONS ═══════════ */
.notifications {
  position: fixed;
  top: 56px;
  left: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.notification {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  backdrop-filter: blur(12px);
  border: 1px solid;
  transform: translateX(-120%);
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: auto;
  max-width: 340px;
}

.notification--visible {
  transform: translateX(0);
  opacity: 1;
}

.notification--info {
  background: rgba(59,130,246,0.2);
  border-color: rgba(59,130,246,0.35);
  color: var(--accent);
}
.notification--success {
  background: rgba(34,197,94,0.2);
  border-color: rgba(34,197,94,0.35);
  color: var(--success);
}
.notification--warning {
  background: rgba(245,158,11,0.2);
  border-color: rgba(245,158,11,0.35);
  color: var(--warning);
}
.notification--error {
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.35);
  color: var(--error);
}

.notification__icon {
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}


/* ═══════════ QR MODAL ═══════════ */
.qr-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.qr-modal.visible { display: flex; }

.qr-modal__inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  text-align: center;
  max-width: 320px;
}

.qr-modal__canvas {
  margin: 16px auto;
  background: white;
  border-radius: var(--radius);
  padding: 12px;
  display: inline-block;
}

.qr-modal__label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 16px;
}

.qr-modal__actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}


/* ═══════════ CONDITION SELECTOR ═══════════ */
.result__condition {
  display: flex;
  gap: 4px;
  margin: 8px 0;
}

.condition-opt {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.condition-opt input[type="radio"] {
  display: none;
}

.condition-opt span {
  display: block;
  width: 100%;
  text-align: center;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  transition: all 0.15s;
}

.condition-opt input:checked + span {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.condition-opt:first-child input:checked + span {
  border-color: var(--error);
  background: rgba(239,68,68,0.1);
  color: var(--error);
}

.condition-opt:nth-child(2) input:checked + span {
  border-color: var(--warning);
  background: rgba(245,158,11,0.1);
  color: var(--warning);
}

.condition-opt:last-child input:checked + span {
  border-color: var(--success);
  background: rgba(34,197,94,0.1);
  color: var(--success);
}


/* ═══════════ MERGE MODE ═══════════ */
.merge-cb {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
}

.inv-item--selectable {
  cursor: pointer;
}

.inv-item--selected {
  background: var(--accent-dim) !important;
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: var(--radius);
}

.inv-item__merge-qty {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  flex-shrink: 0;
  padding: 0 4px;
}

.merge-bar {
  padding: 8px 16px;
  border-top: 1px solid var(--accent);
  background: var(--accent-dim);
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
}
.merge-bar.visible { display: flex; }
.merge-bar span { flex: 1; }

#mergeToggleBtn.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(59,130,246,0.3);
}

/* Merge modal */
.merge-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.merge-modal.visible { display: flex; }

.merge-modal__inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  max-width: 380px;
  width: 100%;
}

.merge-modal__summary {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 12px;
}

.merge-modal__items {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.merge-preview-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.merge-preview-item:hover { background: var(--surface-2); }
.merge-preview-item:last-child { border: none; }

.merge-preview-item--active {
  background: var(--accent-dim) !important;
  color: var(--accent);
}

.merge-preview-qty {
  font-family: var(--font-mono);
  color: var(--text-2);
  font-size: 11px;
}

.merge-modal__input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  outline: none;
  margin-bottom: 16px;
}
.merge-modal__input:focus { border-color: var(--accent); }

.merge-modal__actions {
  display: flex;
  gap: 8px;
}


/* ═══════════ EXPORT MODAL ═══════════ */
.export-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 110;
  align-items: center;
  justify-content: center;
}
.export-modal.visible { display: flex; }

.export-modal__inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  width: 340px;
  max-width: 90vw;
}

.export-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.export-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  transition: all 0.12s;
  text-align: center;
}
.export-opt:hover {
  background: var(--surface-3);
  border-color: var(--accent);
}
.export-opt--wide {
  grid-column: 1 / -1;
  flex-direction: row;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border-color: var(--accent-dim);
  background: rgba(59,130,246,0.05);
}
.export-opt--wide:hover {
  background: rgba(59,130,246,0.12);
}

.export-opt__icon {
  font-size: 22px;
  line-height: 1;
}

.export-opt__label {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.export-opt__desc {
  font-family: var(--font);
  font-size: 9px;
  color: var(--text-3);
}


/* ═══════════ EDITOR OVERLAY ═══════════ */
.editor-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 105;
  flex-direction: column;
}
.editor-overlay.visible { display: flex; }

.editor-overlay__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
}

.editor-overlay__actions {
  display: flex;
  gap: 6px;
}

.editor-overlay__table-wrap {
  flex: 1;
  overflow: auto;
  padding: 8px;
}

.editor-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--font);
  font-size: 11px;
}

.editor-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.editor-table th {
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 7px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}

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

.editor-table tr:hover td {
  background: rgba(59,130,246,0.04);
}

.editor-table .ed-cell {
  width: 100%;
  padding: 6px 8px;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 11px;
  outline: none;
  transition: background 0.12s;
}

.editor-table .ed-cell:focus {
  background: var(--accent-dim);
}

.editor-table .ed-cell--mono {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-2);
}

.editor-table .ed-cell--qty {
  font-family: var(--font-mono);
  font-size: 11px;
  width: 50px;
  text-align: center;
}

.editor-table .ed-cell--select {
  padding: 5px 6px;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 11px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 20px;
}
.editor-table .ed-cell--select:focus {
  background-color: var(--accent-dim);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}
.editor-table .ed-cell--select option {
  background: #232733;
  color: #e5e7eb;
  padding: 4px 8px;
}
.editor-table .ed-cell--select option:checked {
  background: #1a2744;
}

.editor-table .ed-row-num {
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 6px 8px;
  text-align: center;
  min-width: 32px;
}

.editor-table .ed-del {
  width: 28px;
  text-align: center;
  cursor: pointer;
  color: var(--error);
  opacity: 0;
  transition: opacity 0.12s;
  padding: 6px 4px;
  background: none;
  border: none;
  font-size: 12px;
}
.editor-table tr:hover .ed-del { opacity: 0.5; }
.editor-table .ed-del:hover { opacity: 1 !important; }


/* ═══════════ IMAGE DETAIL MODAL ═══════════ */
.img-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  z-index: 115;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.img-modal.visible { display: flex; }

.img-modal__inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.img-modal__canvas-wrap {
  position: relative;
  background: #000;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 50vh;
  overflow: hidden;
}

.img-modal__canvas-wrap canvas {
  max-width: 100%;
  max-height: 50vh;
  display: block;
}

.img-modal__info {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

.img-modal__name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.img-modal__code {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  margin-bottom: 12px;
}

.img-modal__fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}

.img-modal__field-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
}

.img-modal__field-value {
  font-size: 12px;
  color: var(--text);
  margin-top: 1px;
}

.img-modal__footer {
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ═══════════ MOBILE ═══════════ */
.toggle-panel-btn { display: none; }

@media (max-width: 768px) {
  .panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 20;
    transform: translateX(100%);
    width: 300px;
    box-shadow: -4px 0 20px rgba(0,0,0,0.5);
  }
  .panel.open { transform: translateX(0); }
  .toggle-panel-btn { display: flex; }

  .scan-zone { width: 82%; height: 45%; }

  .result-overlay,
  .burst-overlay {
    bottom: 80px;
    max-width: calc(100% - 24px);
  }

  .kbd-hints { display: none; }
}

@media (max-width: 480px) {
  .header h1 { font-size: 13px; }
  .panel { width: 100%; }
}
