:root {
  --bg: #0a0714;
  --bg-soft: #130d24;
  --panel: rgba(21, 14, 39, 0.86);
  --panel-strong: rgba(32, 21, 59, 0.92);
  --line: rgba(174, 134, 255, 0.16);
  --line-strong: rgba(186, 147, 255, 0.34);
  --text: #f8f5ff;
  --muted: #b6adc9;
  --purple: #8f5bff;
  --purple-2: #b57cff;
  --purple-3: #5f2dd8;
  --rose: #ff7fe0;
  --green: #73d8ad;
  --amber: #ffcf76;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, system-ui, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(143, 91, 255, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 127, 224, 0.14), transparent 25%),
    linear-gradient(180deg, #0b0815 0%, #090612 100%);
  color: var(--text);
}

.shell {
  max-width: 1520px;
  margin: 0 auto;
  padding: 28px;
  position: relative;
}

.glow {
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 999px;
  filter: blur(90px);
  opacity: 0.18;
  pointer-events: none;
}
.glow-a { top: -80px; left: -60px; background: var(--purple); }
.glow-b { right: -80px; top: 30%; background: var(--rose); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  margin-bottom: 18px;
  background:
    linear-gradient(135deg, rgba(143, 91, 255, 0.22), rgba(255, 127, 224, 0.10)),
    var(--panel-strong);
}

.eyebrow, .section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 11px;
  font-weight: 700;
  color: var(--purple-2);
}

.hero h1 {
  margin: 8px 0 10px;
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1;
}
.hero p {
  margin: 0;
  max-width: 680px;
  color: var(--muted);
  font-size: 15px;
}
.hero-actions {
  display: flex;
  align-items: stretch;
  gap: 14px;
  flex-wrap: wrap;
}
.hero-stat {
  min-width: 160px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
}
.hero-stat-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}
.hero-stat strong {
  font-size: 1.35rem;
}

.toolbar {
  padding: 18px;
  margin-bottom: 18px;
}
.search-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(180px, .6fr) auto;
  gap: 14px;
  align-items: end;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 18px;
}

.results, .editor { padding: 20px; }
.results { min-height: 720px; }
.editor { min-height: 720px; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}
.section-head h2 {
  margin: 6px 0 0;
  font-size: 1.35rem;
}
.form-head { align-items: center; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.results-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 860px;
  overflow: auto;
  padding-right: 4px;
}
.results-list::-webkit-scrollbar { width: 10px; }
.results-list::-webkit-scrollbar-thumb {
  background: rgba(181, 124, 255, 0.22);
  border-radius: 999px;
}

.result-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
  border-radius: 18px;
  padding: 15px;
  cursor: pointer;
  color: var(--text);
  transition: .18s ease;
}
.result-item:hover,
.result-item.active {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 18px 30px rgba(111, 58, 212, 0.18);
  background: linear-gradient(180deg, rgba(143, 91, 255, 0.16), rgba(255,255,255,0.03));
}
.result-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.result-item h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}
.result-barcode {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}
.result-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.result-meta strong { color: #e7dcff; font-weight: 600; }

.form-block {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,0.02);
  margin-bottom: 16px;
}
.form-block h3 {
  margin: 0 0 14px;
  font-size: 15px;
}

.grid {
  display: grid;
  gap: 14px;
}
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.full { grid-column: 1 / -1; }

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.field > span,
label.field {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(198, 168, 255, 0.14);
  background: rgba(9, 7, 19, 0.72);
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
  outline: none;
  transition: .16s ease;
}
.field input::placeholder,
.field textarea::placeholder { color: #8b81a6; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(181, 124, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(143, 91, 255, 0.15);
}
.field textarea { resize: vertical; min-height: 88px; }
.emphasis input { font-weight: 600; }

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.sticky-actions {
  position: sticky;
  bottom: 0;
  padding-top: 8px;
}

.button {
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary {
  background: linear-gradient(135deg, var(--purple), var(--rose));
  color: white;
  box-shadow: 0 16px 30px rgba(143, 91, 255, 0.28);
}
.button.secondary {
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-color: rgba(255,255,255,0.08);
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(143, 91, 255, 0.16);
  color: #f1e8ff;
  border: 1px solid rgba(181, 124, 255, 0.18);
}
.chip.subtle {
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  border-color: rgba(255,255,255,0.08);
}
.status {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
}
.status.ok { color: var(--green); }
.status.warn { color: var(--amber); }
.empty-state {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
}
.badge-active { background: rgba(115, 216, 173, 0.18); color: #bff2d9; border-color: rgba(115, 216, 173, 0.25); }
.badge-inactive { background: rgba(255,255,255,0.06); color: #d3cadf; border-color: rgba(255,255,255,0.08); }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .results, .editor { min-height: auto; }
  .results-list { max-height: 420px; }
}

@media (max-width: 720px) {
  .shell { padding: 16px; }
  .hero {
    padding: 20px;
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-actions,
  .search-wrap,
  .section-head,
  .form-head,
  .result-top {
    width: 100%;
  }
  .search-wrap,
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .button { width: 100%; }
  .hero-actions { width: 100%; }
  .hero-stat { width: 100%; }
  .result-meta { grid-template-columns: 1fr; }
}
