:root {
  --navy-1: #020b3a;
  --navy-2: #01052a;
  --navy-3: #06114f;
  --purple: #4318ff;
  --purple-2: #601cff;
  --purple-soft: #f3edff;
  --text: #09114a;
  --text-soft: #5c689a;
  --line: #e8ebf4;
  --panel: #ffffff;
  --bg: #fbfcff;
  --green: #16a34a;
  --green-soft: #ebf8ef;
  --orange: #ff7a00;
  --orange-soft: #fff2e8;
  --red: #ff2f2f;
  --red-soft: #fdeaea;
  --blue: #2563eb;
  --blue-soft: #eaf3ff;
  --shadow: 0 12px 28px rgba(13, 19, 64, 0.04);
  --sidebar-w: 224px;
  --sidebar-collapsed: 92px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; border: 0; background: transparent; }
svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }

.inventory-app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}
body.sidebar-collapsed .inventory-app {
  grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr);
}

.inventory-sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: 16px 14px 18px;
  background: radial-gradient(circle at 22px 22px, rgba(96, 32, 255, 0.3), transparent 84px), linear-gradient(180deg, var(--navy-3) 0%, var(--navy-2) 54%, #000b33 100%);
  box-shadow: 18px 0 44px rgba(4, 11, 51, 0.16);
}
.sidebar-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 8px 10px 18px;
}
.sidebar-brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #3200ef 0%, #651dff 100%);
  box-shadow: 0 12px 24px rgba(68, 24, 255, 0.32);
  flex: 0 0 44px;
}
.sidebar-brand-icon svg { width: 24px; height: 24px; stroke-width: 2; }
.brand-copy strong {
  display: block;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.brand-copy small {
  display: block;
  margin-top: 2px;
  color: rgba(255,255,255,0.92);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.sidebar-toggle {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,0.86);
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
}
.sidebar-toggle svg { width: 18px; height: 18px; stroke-width: 2.2; transition: transform .2s ease; }

.inventory-nav {
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.nav-item,
.logout-link {
  height: 46px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px;
  margin-bottom: 5px;
  border-radius: 10px;
  color: rgba(255,255,255,0.96);
  font-size: 14px;
  font-weight: 600;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.nav-item:hover,
.logout-link:hover { background: rgba(255,255,255,0.05); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, #3500ee 0%, #5e1cff 100%);
  box-shadow: 0 14px 26px rgba(67, 14, 255, 0.26);
}
.nav-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 28px;
}
.nav-icon svg { width: 21px; height: 21px; stroke-width: 1.9; }
.nav-text { white-space: nowrap; }

.assist-card {
  margin: 18px 4px 18px;
  padding: 18px 16px 16px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(81, 20, 255, 0.28) 0%, rgba(63, 18, 180, 0.66) 100%);
  border: 1px solid rgba(255,255,255,0.08);
  color: #fff;
}
.assist-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 800;
}
.assist-card p {
  margin: 0 0 18px;
  color: rgba(255,255,255,0.96);
  font-size: 14px;
}
.assist-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.assist-bottom-row button {
  min-width: 104px;
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, #3500ee 0%, #5d1cff 100%);
  font-size: 13px;
  font-weight: 700;
}
.assist-bot {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.12);
}
.assist-bot svg { width: 22px; height: 22px; stroke-width: 1.8; }
.logout-link { margin-top: 8px; }

.inventory-main {
  min-width: 0;
  padding: 22px 22px 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.stat-card {
  min-height: 126px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.stat-icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 64px; }
.stat-icon svg { width: 34px; height: 34px; stroke-width: 1.9; }
.soft-purple { color: var(--purple); background: #f0eaff; }
.soft-orange { color: var(--orange); background: #ffefe2; }
.soft-red { color: var(--red); background: #fde9e9; }
.soft-blue { color: var(--blue); background: #eaf3ff; }
.stat-label { display: block; color: #29346f; font-size: 15px; font-weight: 600; }
.stat-card h2 { margin: 6px 0 6px; color: var(--text); font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.stat-card p { margin: 0; color: var(--text-soft); font-size: 14px; }

.inventory-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.toolbar-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.45fr) repeat(3, minmax(140px, .82fr)) minmax(110px, .5fr) minmax(140px, .72fr);
  align-items: center;
  gap: 14px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}
.inventory-search {
  min-width: 0;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border: 1px solid #dde2f0;
  border-radius: 12px;
  background: #fff;
}
.inventory-search svg,
.filter-btn svg,
.ghost-btn svg,
.primary-btn svg,
.per-page-btn svg { width: 20px; height: 20px; stroke-width: 1.9; }
.inventory-search svg { color: #485392; flex: 0 0 20px; }
.inventory-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
}
.inventory-search input::placeholder { color: #6672a5; }
.filter-btn,
.ghost-btn,
.primary-btn,
.per-page-btn {
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 650;
  white-space: nowrap;
}
.filter-btn {
  min-width: 0;
  padding: 0 16px;
  color: #1c265f;
  border: 1px solid #dde2f0;
  background: #fff;
}
.ghost-btn {
  min-width: 0;
  color: #172359;
  border: 1px solid #dde2f0;
  background: #fff;
}
.primary-btn {
  min-width: 0;
  color: #fff;
  background: linear-gradient(135deg, #3500ee 0%, #5d1cff 100%);
  box-shadow: 0 14px 30px rgba(67, 14, 255, 0.2);
}

.table-shell { overflow-x: auto; }
.inventory-table {
  min-width: 1080px;
  display: grid;
  grid-template-columns: 48px minmax(220px, 2.2fr) minmax(110px, 1.05fr) minmax(105px, 1fr) minmax(110px, 1fr) minmax(110px, 1fr) 78px 108px 118px;
  align-items: center;
}
.inventory-header {
  min-height: 56px;
  padding: 0 14px;
  color: #141f5a;
  font-size: 13px;
  font-weight: 800;
  border-bottom: 1px solid var(--line);
}
.sort-arrow { color: #7380b2; font-size: 12px; }
.inventory-row {
  min-height: 86px;
  padding: 0 14px;
  color: #1d255f;
  font-size: 14px;
  border-bottom: 1px solid #edf0f7;
}
.check-col { display: flex; align-items: center; justify-content: center; }
.check-col input { width: 20px; height: 20px; accent-color: var(--purple); }
.product-cell { display: flex; align-items: center; gap: 14px; }
.product-cell img,
.placeholder-product {
  width: 48px; height: 48px; border-radius: 10px; border: 1px solid #eef1f7; background: #fff; object-fit: contain; padding: 4px;
}
.placeholder-product { display: grid; place-items: center; font-size: 20px; font-weight: 800; }
.placeholder-product.margarine { color: #2235b8; background: linear-gradient(180deg, #ffe77b 0%, #f9c934 100%); }
.product-cell strong { display: block; font-size: 15px; font-weight: 800; line-height: 1.2; }
.product-cell span { display: block; margin-top: 4px; color: #556091; font-size: 13px; }
.stock-number { font-weight: 800; font-size: 16px; }
.stock-number.green { color: var(--green); }
.stock-number.orange { color: var(--orange); }
.stock-number.red { color: var(--red); }
.status-badge {
  min-width: 90px; height: 30px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; font-size: 13px; font-weight: 700;
}
.status-badge.in { color: var(--green); background: var(--green-soft); }
.status-badge.low { color: var(--orange); background: var(--orange-soft); }
.status-badge.out { color: var(--red); background: var(--red-soft); }
.action-group { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: #fff; border: 1px solid #dfe4f1;
}
.icon-btn svg { width: 18px; height: 18px; stroke-width: 1.9; }
.icon-btn.view { color: var(--purple); }
.icon-btn.edit { color: #1b2c7b; }
.icon-btn.delete { color: var(--red); border-color: #ffc5c5; }

.table-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 16px 16px;
}
.table-footer p { margin: 0; color: #223066; font-size: 14px; font-weight: 550; }
.pagination { display: flex; align-items: center; gap: 12px; }
.page-btn {
  width: 42px; height: 42px; border-radius: 10px; color: #202a62; background: #fff; border: 1px solid #dfe4f1; font-size: 15px; font-weight: 700;
}
.page-btn.active { color: #fff; border-color: transparent; background: linear-gradient(135deg, #3500ee 0%, #5d1cff 100%); box-shadow: 0 14px 26px rgba(67, 14, 255, 0.22); }
.page-btn.muted { color: #8d96bc; }
.per-page-btn { min-width: 148px; padding: 0 18px; color: #202a62; border: 1px solid #dfe4f1; background: #fff; }

body.sidebar-collapsed .inventory-sidebar { padding-left: 10px; padding-right: 10px; }
body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .assist-copy,
body.sidebar-collapsed .assist-bottom-row button,
body.sidebar-collapsed .logout-link .nav-text { display: none; }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding-right: 0; padding-left: 0; }
body.sidebar-collapsed .sidebar-brand-row { flex-direction: column; align-items: center; gap: 12px; }
body.sidebar-collapsed .sidebar-toggle svg { transform: rotate(180deg); }
body.sidebar-collapsed .nav-item,
body.sidebar-collapsed .logout-link {
  justify-content: center;
  padding: 0;
}
body.sidebar-collapsed .assist-card {
  padding: 12px;
  display: grid;
  place-items: center;
}
body.sidebar-collapsed .assist-bottom-row { justify-content: center; }

@media (max-width: 1360px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar-row {
    grid-template-columns: minmax(220px, 1.5fr) repeat(3, minmax(140px, 1fr));
  }
  .toolbar-row .ghost-btn,
  .toolbar-row .primary-btn { min-width: 0; }
}

@media (max-width: 1180px) {
  .toolbar-row {
    grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(150px, 1fr));
  }
}

@media (max-width: 980px) {
  .inventory-app { grid-template-columns: 1fr; }
  body.sidebar-collapsed .inventory-app { grid-template-columns: 1fr; }
  .inventory-sidebar { min-height: auto; }
  .inventory-main { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .toolbar-row { grid-template-columns: 1fr; padding: 18px 16px; }
  .filter-btn, .ghost-btn, .primary-btn, .per-page-btn { width: 100%; }
  .table-footer { flex-direction: column; align-items: flex-start; }
}
