:root {
  --bg: #f5f4ef;
  --card: #ffffff;
  --line: #e8e2d7;
  --text: #222832;
  --muted: #7d8490;
  --accent: #d7782f;
  --accent-soft: #fff2e4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: linear-gradient(180deg, #fff5ea 0%, var(--bg) 240px);
  color: var(--text);
}

button,
input,
textarea,
select {
  font: inherit;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 20px;
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 18px 42px rgba(54, 55, 60, 0.08);
  padding: 18px;
  display: grid;
  gap: 10px;
}

.sidebar-title {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 4px;
}

.nav-item {
  border: 0;
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
}

.nav-item.active {
  background: linear-gradient(90deg, #f0b35f, var(--accent));
  color: #fff;
  font-weight: 700;
}

.content-area {
  min-width: 0;
}

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.auth-card,
.panel,
.product-card {
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 18px 42px rgba(54, 55, 60, 0.08);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 28px;
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.auth-card p {
  margin: 0 0 20px;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field label {
  color: var(--muted);
  font-size: 14px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
}

.btn.primary {
  background: linear-gradient(90deg, #f0b35f, var(--accent));
  color: #fff;
  font-weight: 700;
}

.btn.secondary {
  background: var(--accent-soft);
  color: #9a632d;
}

.btn.secondary.danger {
  background: #fff0ec;
  color: #c53c20;
}

.btn.block {
  width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 0;
  font-size: 30px;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.toolbar {
  display: flex;
  gap: 12px;
}

.panel {
  padding: 20px;
  margin-bottom: 18px;
}

.nested-panel {
  margin-top: 16px;
  border: 1px solid var(--line);
  box-shadow: none;
  background: #fffdfa;
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 20px;
}

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

.inline-list {
  display: grid;
  gap: 8px;
}

.inline-list input {
  width: 100%;
}

.product-list {
  display: grid;
  gap: 18px;
}

.product-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.product-tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
}

.product-tab.active {
  border-color: transparent;
  background: linear-gradient(90deg, #f0b35f, var(--accent));
  color: #fff;
  font-weight: 700;
}

.category-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.category-tab {
  border: 1px solid var(--line);
  background: #fffdfa;
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
}

.category-tab.active {
  border-color: #f0b35f;
  background: #fff2e4;
  color: #9a632d;
  font-weight: 700;
}

.product-card {
  padding: 20px;
}

.product-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.product-head h3 {
  margin: 0;
  font-size: 22px;
}

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

.shelf-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffaf3;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
}

.status-badge.online {
  background: #e9f8ee;
  color: #23733a;
}

.status-badge.offline {
  background: #f1f2f4;
  color: #6b7280;
}

.category-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 10px;
}

.category-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.batch-panel {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdfa;
}

.batch-title {
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.batch-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.spec-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.media-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 220px;
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdfa;
}

.preview-small {
  min-height: 120px;
}

.media-actions {
  display: grid;
  gap: 10px;
}

.gallery-row,
.detail-block-row {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdfa;
  margin-top: 12px;
}

.gallery-actions {
  display: flex;
  justify-content: flex-end;
}

.spec-row {
  display: grid;
  grid-template-columns: 1.6fr 0.7fr 0.7fr 0.6fr auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdfa;
}

.compact-row {
  grid-template-columns: 1.2fr 1.6fr auto;
}

.sort-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdfa;
  margin-bottom: 12px;
}

.sort-title {
  font-weight: 700;
  color: var(--text);
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

.empty-box {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: #fffdfa;
}

.preview {
  border: 1px dashed var(--line);
  border-radius: 14px;
  min-height: 180px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fffaf4;
}

.preview img {
  max-width: 100%;
  display: block;
}

.error {
  margin-top: 12px;
  color: #c53c20;
  font-size: 14px;
}

.success {
  margin-top: 12px;
  color: #2f7a37;
  font-size: 14px;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .grid,
  .product-grid,
  .category-head,
  .batch-grid,
  .spec-row,
  .media-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}
