:root {
  --bg: #050915;
  --panel: #0f172a;
  --muted: #9fb0d7;
  --text: #e9f0ff;
  --primary: #6dd3ff;
  --accent: #fdbf60;
  --border: #1b2644;
  --success: #44d399;
  --danger: #ff6b6b;
  --warning: #f3a952;
  --shadow: 0 20px 70px rgba(5, 9, 21, 0.65);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at 20% 20%, rgba(109, 211, 255, 0.12), transparent 30%),
    radial-gradient(circle at 70% 0%, rgba(253, 191, 96, 0.12), transparent 32%),
    radial-gradient(circle at 85% 65%, rgba(92, 123, 255, 0.16), transparent 35%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

h1, h2, h3, h4 { margin: 0; }

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  padding: 48px clamp(16px, 4vw, 56px);
  align-items: center;
}

.hero__content h1 { font-size: clamp(32px, 5vw, 48px); }
.hero__content .subtitle { color: var(--muted); max-width: 620px; }
.hero__stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.hero__panel {
  position: relative;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.9), rgba(9, 12, 27, 0.95));
  border: 1px solid rgba(109, 211, 255, 0.2);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero__panel::after {
  content: '';
  position: absolute;
  inset: -40% auto auto -20%;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(109, 211, 255, 0.18) 0%, transparent 60%);
  transform: rotate(20deg);
  pointer-events: none;
}
.hero__panel::before {
  content: '';
  position: absolute;
  inset: auto -30% -50% auto;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(253, 191, 96, 0.12) 0%, transparent 60%);
  pointer-events: none;
}
.hero__panel h2 { margin: 0; }
.hero__panel .panel__header { padding: 0 0 8px; }

.eyebrow { text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-size: 12px; }
.subtitle { margin: 12px 0 0; }

.pill {
  background: rgba(124, 93, 255, 0.12);
  color: var(--primary);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid rgba(124, 93, 255, 0.2);
}
.pill--accent { background: rgba(253, 191, 96, 0.15); color: var(--accent); border-color: rgba(253, 191, 96, 0.25); }

.layout { padding: 0 clamp(16px, 4vw, 56px) 48px; display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.panel--wide { grid-column: 1 / -1; }
.panel {
  background: rgba(11, 16, 33, 0.8);
  border: 1px solid rgba(155, 182, 255, 0.12);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}
.panel__header { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }

.tabs { display: inline-flex; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); border-radius: 12px; padding: 4px; gap: 6px; }
.tab {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: all 0.15s ease;
}
.tab.is-active { background: rgba(109, 211, 255, 0.12); color: var(--text); border-color: rgba(109, 211, 255, 0.35); box-shadow: 0 10px 30px rgba(109, 211, 255, 0.1); }
.tab-panels { margin-top: 16px; }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { min-width: 240px; }
.toolbar select { cursor: pointer; }
.toolbar__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.barcode-field { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }

.table-wrapper { overflow-x: auto; margin-top: 12px; }

#inventoryTable { width: 100%; border-collapse: collapse; }
#inventoryTable th, #inventoryTable td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
#inventoryTable th { color: var(--muted); font-weight: 600; }
#inventoryTable td { vertical-align: top; }
#inventoryTable tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

.status { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 999px; font-weight: 600; }
.status--ok { background: rgba(68, 211, 153, 0.1); color: var(--success); border: 1px solid rgba(68, 211, 153, 0.4); }
.status--low { background: rgba(255, 107, 107, 0.12); color: var(--danger); border: 1px solid rgba(255, 107, 107, 0.4); }
.status--expiring { background: rgba(243, 169, 82, 0.1); color: var(--warning); border: 1px solid rgba(243, 169, 82, 0.4); }
.status--expired { background: rgba(255, 107, 107, 0.2); color: #ff7b7b; border: 1px solid rgba(255, 107, 107, 0.55); }

.btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  font-weight: 600;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(124, 93, 255, 0.5); }
.btn:active { transform: translateY(0); }
.btn--primary { background: linear-gradient(135deg, #6dd3ff, #5c7bff); border-color: transparent; color: white; box-shadow: 0 10px 30px rgba(109, 211, 255, 0.4); }
.btn--ghost { background: rgba(255, 255, 255, 0.04); }

.form { display: flex; flex-direction: column; gap: 14px; }
.form--inline { margin-top: 8px; }
.form__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.form__field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-weight: 600; font-size: 14px; position: relative; }
.form__field input,
.form__field textarea,
.toolbar input,
.toolbar select {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form__field input:focus,
.form__field textarea:focus,
.toolbar input:focus,
.toolbar select:focus {
  outline: none;
  border-color: rgba(109, 211, 255, 0.8);
  box-shadow: 0 0 0 3px rgba(109, 211, 255, 0.18);
}
.form__field textarea { resize: vertical; }
.form__actions { display: flex; gap: 10px; justify-content: flex-end; }
.dropdown-hint summary { cursor: pointer; color: var(--muted); }
.dropdown-hint {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  max-width: 220px;
}

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

.reorder-list { display: grid; gap: 10px; margin-top: 12px; }
.reorder-card {
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}
.reorder-card h4 { margin: 0 0 4px; }
.reorder-card .muted { margin: 2px 0; }
.pill--inline { display: inline-flex; padding: 6px 10px; margin: 4px 0 0; background: rgba(109, 211, 255, 0.12); color: var(--primary); border: 1px solid rgba(109, 211, 255, 0.35); }
.pill--ok { background: rgba(68, 211, 153, 0.12); color: var(--success); border: 1px solid rgba(68, 211, 153, 0.4); }

.footer { text-align: center; color: var(--muted); padding: 32px; }

.muted { color: var(--muted); }
.smallprint { font-size: 12px; margin-top: 8px; color: var(--muted); }

.empty-row td { text-align: center; color: var(--muted); padding: 24px 0; }

.scanner {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: grid;
  place-items: center;
  z-index: 999;
}
.scanner.hidden { display: none; }
.scanner__frame {
  position: relative;
  width: min(520px, 90vw);
  aspect-ratio: 3 / 4;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.scanner__frame video { width: 100%; height: 100%; object-fit: cover; }
.scanner__controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.65), transparent);
}

@media (max-width: 600px) {
  .form__actions { flex-direction: column; }
  .toolbar input, .toolbar select { min-width: unset; width: 100%; }
}
