:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --sidebar: #ffffff;
  --line: #e5e7eb;
  --line-strong: #d5d9e2;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #7c3aed;
  --accent-soft: #f3e8ff;
  --blue: #3b82f6;
  --good: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 10px 25px rgba(15, 23, 42, 0.06);
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #f8fafc 0%, #f4f5f7 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px 18px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, #8b5cf6, #3b82f6);
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy span,
.sidebar-user span {
  font-size: 13px;
  color: var(--muted);
}

.sidebar-nav {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.nav-link {
  padding: 12px 14px;
  border-radius: 12px;
  color: #334155;
  font-weight: 500;
}

.nav-link:hover {
  background: #f8fafc;
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 8px 6px;
  border-top: 1px solid var(--line);
}

.user-badge {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 700;
}

.content {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  background: rgba(244, 245, 247, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.search-wrap {
  flex: 1;
  max-width: 760px;
}

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

.topbar-period {
  white-space: nowrap;
}

.page {
  padding: 28px;
  display: grid;
  gap: 22px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.hero-copy {
  max-width: 720px;
}

.eyebrow,
.section-tag {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.title {
  margin: 0;
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.05;
}

.sub {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}

.status {
  min-width: 220px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
  font-size: 14px;
}

.panel {
  display: grid;
  gap: 16px;
  padding: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
}

.panel-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.panel-overview {
  gap: 24px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 18px;
}

.metric-card,
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.metric-card {
  padding: 24px;
  min-height: 154px;
  display: grid;
  align-content: start;
  gap: 14px;
}

.metric-label {
  margin: 0;
  color: #334155;
  font-size: 14px;
  font-weight: 500;
}

.metric-value {
  margin: 0;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.chart-grid,
.split {
  display: grid;
  gap: 22px;
}

.chart-grid {
  grid-template-columns: 1.1fr 1fr;
}

.split.two {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
}

.card {
  padding: 24px;
}

.chart-card {
  min-height: 100%;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.card-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.card-kicker {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 12px;
}

.stat-item {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface-soft);
  color: #0f172a;
  font-size: 20px;
  font-weight: 700;
}

.stat-item strong {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.chart-wrap {
  margin-top: 16px;
}

.chart-wrap-lg {
  min-height: 280px;
}

.bar-chart {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 12px;
  align-items: center;
  color: #334155;
  font-size: 13px;
}

.bar-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #e8edf5;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8b5cf6 0%, #3b82f6 100%);
}

.stack-list {
  display: grid;
  gap: 10px;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--surface);
  font-size: 14px;
  line-height: 1.45;
}

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

.filters,
.bulk-row,
.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.bulk-row {
  justify-content: space-between;
}

.field {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  box-shadow: var(--shadow-sm);
}

.field:focus {
  outline: none;
  border-color: #c4b5fd;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.search-field {
  width: 100%;
  padding-left: 18px;
  background: #efeff1;
  border-color: transparent;
  box-shadow: none;
}

.field.short {
  min-width: 150px;
}

.field.area {
  min-height: 110px;
  resize: vertical;
}

.label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.category-fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}

.category-fieldset legend {
  padding: 0;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

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

.category-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

.category-option input {
  margin: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 12px;
}

.btn,
.icon-btn {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn {
  padding: 10px 16px;
  background: #111827;
  color: #fff;
}

.btn.secondary,
.icon-btn {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

.icon-btn {
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.bell-btn {
  padding-right: 18px;
}

.bell-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 14px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.table th {
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge.pending {
  background: #fff7ed;
  color: var(--warn);
}

.badge.in_progress,
.badge.in_review {
  background: #dbeafe;
  color: #2563eb;
}

.badge.completed,
.badge.shipped,
.badge.approved {
  background: #dcfce7;
  color: var(--good);
}

.badge.returned,
.badge.rejected {
  background: #fee2e2;
  color: var(--bad);
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 7px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.product-thumb {
  width: 64px;
  height: 64px;
  object-fit: contain;
  flex: 0 0 64px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f8fafc;
  padding: 4px;
}

.order-details-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
}

.detail-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: var(--surface-soft);
  font-size: 14px;
  line-height: 1.5;
}

.detail-block strong {
  display: block;
  margin-bottom: 8px;
}

.print-preview {
  width: 100%;
  height: 120px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  margin-top: 10px;
}

.success {
  color: var(--good);
}

.warning {
  color: var(--warn);
}

.danger {
  color: var(--bad);
}

.quick-links-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 18px;
}

.quick-link-card {
  display: grid;
  gap: 8px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.quick-link-card span {
  color: var(--muted);
  line-height: 1.5;
}

.products-add-btn {
  align-self: center;
  background: linear-gradient(135deg, #7c3aed, #9333ea);
}

.products-summary-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.products-filter-panel {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.products-filter-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 220px 200px;
  gap: 14px;
}

.products-search {
  max-width: none;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(230px, 1fr));
  gap: 22px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.product-card-media {
  position: relative;
  height: 210px;
  background: #f3f4f6;
}

.product-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-status-chip {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.product-status-chip.ok {
  background: #dcfce7;
  color: var(--good);
}

.product-status-chip.low {
  background: #fef3c7;
  color: var(--warn);
}

.product-status-chip.out {
  background: #fee2e2;
  color: var(--bad);
}

.product-card-body {
  display: grid;
  gap: 18px;
  padding: 20px 22px 18px;
}

.product-card-title {
  margin: 0;
  font-size: 18px;
}

.product-card-category {
  margin: 6px 0 0;
  color: var(--muted);
}

.product-stats {
  display: grid;
  gap: 12px;
  margin: 0;
}

.product-stats div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 15px;
}

.product-stats dt {
  color: #475569;
}

.product-stats dd {
  margin: 0;
  font-weight: 600;
}

.product-card-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

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

.metric-good {
  color: var(--good);
}

.metric-warn {
  color: var(--warn);
}

.metric-bad {
  color: var(--bad);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(4px);
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  width: min(100%, 640px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.18);
  padding: 22px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 20px;
}

.modal-title {
  margin: 0;
  font-size: 32px;
  line-height: 1.05;
}

.modal-sub {
  margin: 8px 0 0;
  color: var(--muted);
}

.modal-close {
  border: 0;
  background: transparent;
  color: #475569;
  font: inherit;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.modal-form {
  display: grid;
  gap: 16px;
}

.modal-grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.modal-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
  padding-top: 8px;
}

.add-product-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.9fr);
  gap: 22px;
  align-items: start;
}

.add-product-card,
.add-product-preview {
  padding: 24px;
}

.add-product-title {
  font-size: 24px;
}

.add-product-form {
  display: grid;
  gap: 16px;
}

.add-product-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
  padding-top: 8px;
}

.add-product-preview-card {
  border-radius: 18px;
}

@media (max-width: 1280px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .products-grid,
  .quick-links-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }

  .chart-grid,
  .split.two,
  .order-details-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .products-filter-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar,
  .page {
    padding: 16px;
  }

  .topbar,
  .hero,
  .bulk-row {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .modal-grid-two {
    grid-template-columns: 1fr;
  }

  .add-product-layout {
    grid-template-columns: 1fr;
  }

  .category-checklist {
    grid-template-columns: 1fr;
  }

  .products-grid,
  .quick-links-grid {
    grid-template-columns: 1fr;
  }

  .sidebar-nav {
    grid-template-columns: 1fr 1fr;
  }

  .panel-title,
  .card-title {
    font-size: 22px;
  }

  .sub {
    font-size: 16px;
  }
}
