.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 74px;
  background: rgba(17, 24, 39, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
}

.site-header .brand { color: #fff; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 14px;
  font-weight: 700;
}

.site-nav a:not(.button) { color: #d1d5db; }

.site-nav a:not(.button):hover {
  color: var(--orange);
}

.mobile-nav-toggle {
  display: none;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: calc(100vh - 42px);
}

.sidebar {
  position: sticky;
  top: 0;
  height: calc(100vh - 42px);
  padding: 24px 18px;
  background: #fff;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.sidebar .brand {
  padding: 0 10px 24px;
}

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

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 10px 13px;
  color: #606a78;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 750;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: var(--orange-hover);
  background: var(--orange-pale);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 25px;
  color: currentColor;
  font-size: 17px;
}

.sidebar-foot {
  margin-top: 30px;
  padding: 16px;
  color: #805025;
  background: var(--orange-pale);
  border: 1px solid #ffdfc2;
  border-radius: 14px;
  font-size: 12px;
}

.main-panel {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px 30px;
  background: rgba(250, 249, 247, 0.94);
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  margin: 0;
  font-size: 16px;
}

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

.admin-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 5px 12px 5px 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
}

.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: #fff;
  background: linear-gradient(145deg, var(--orange-soft), var(--orange));
  border-radius: 50%;
}

.mobile-sidebar-toggle {
  display: none;
}

.content {
  width: min(1380px, 100%);
  margin-inline: auto;
  padding: 28px 30px 48px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 24px;
}

.page-head h1 {
  margin-bottom: 6px;
  font-size: clamp(25px, 3vw, 34px);
}

.page-head p {
  margin-bottom: 0;
}

.grid {
  display: grid;
  gap: 18px;
}

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

.metric-card {
  position: relative;
  min-width: 0;
  padding: 21px;
  overflow: hidden;
}

.metric-card::after {
  position: absolute;
  right: -18px;
  bottom: -28px;
  width: 100px;
  height: 100px;
  content: "";
  background: radial-gradient(circle, rgba(255, 177, 92, 0.2), transparent 68%);
}

.metric-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.metric-value {
  margin: 0;
  color: var(--ink);
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 850;
  letter-spacing: -0.04em;
}

.metric-foot {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--orange);
  background: var(--orange-pale);
  border-radius: 11px;
}

.panel-card {
  padding: 22px;
}

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

.panel-head h2,
.panel-head h3 {
  margin-bottom: 4px;
  font-size: 18px;
}

.chart-shell {
  width: 100%;
  min-height: 240px;
  overflow: hidden;
}

.line-chart {
  display: block;
  width: 100%;
  min-width: 480px;
}

.chart-grid {
  stroke: #eee7e1;
  stroke-width: 1;
}

.chart-label {
  fill: #8a8f98;
  font-size: 11px;
}

.chart-line {
  stroke-dasharray: 1300;
  stroke-dashoffset: 1300;
  animation: chart-draw 800ms ease-out forwards;
}

.chart-point {
  transition: r 150ms ease;
}

.chart-point:hover,
.chart-point:focus {
  r: 5;
}

@keyframes chart-draw {
  to {
    stroke-dashoffset: 0;
  }
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  padding: 12px 14px;
  color: var(--muted);
  background: #fffaf6;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 14px;
  border-bottom: 1px solid #f3ebe5;
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: #fffdfb;
}

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

.product-thumb {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  color: #fff;
  background: linear-gradient(145deg, var(--product-color, var(--orange-soft)), #fff1e5);
  border-radius: 12px;
  font-size: 17px;
  font-weight: 850;
}

.product-name {
  color: var(--ink);
  font-weight: 750;
}

.product-code {
  color: var(--muted);
  font-size: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label,
.field-label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.input,
.select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #e6d9ce;
  border-radius: 11px;
  outline: 0;
}

.input:focus,
.select:focus {
  border-color: var(--orange-2);
  box-shadow: 0 0 0 3px rgba(255, 106, 0, 0.11);
}

.field-help {
  color: var(--muted);
  font-size: 12px;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px 16px;
  border-radius: 13px;
  font-size: 13px;
}

.notice-warning {
  color: #855000;
  background: #fff7df;
  border: 1px solid #ffe1a6;
}

.notice-info {
  color: #1f5d9b;
  background: #eef6ff;
  border: 1px solid #cfe5ff;
}

.notice-danger {
  color: #a52323;
  background: #fff1f1;
  border: 1px solid #ffd2d2;
}

.empty-state,
.error-state,
.loading-state {
  display: grid;
  place-items: center;
  min-height: 280px;
  padding: 38px;
  text-align: center;
}

.state-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 14px;
  color: var(--orange);
  background: var(--orange-pale);
  border-radius: 18px;
  font-size: 25px;
}

.spinner {
  width: 34px;
  height: 34px;
  margin-bottom: 16px;
  border: 3px solid #ffe2c8;
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

  .sidebar {
    position: fixed;
    z-index: 50;
    top: 42px;
    left: 0;
    width: min(88vw, 290px);
    transform: translateX(-105%);
    transition: transform 220ms ease;
    box-shadow: 20px 0 40px rgba(31, 41, 55, 0.16);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .mobile-sidebar-toggle {
    display: inline-grid;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .site-nav {
    position: absolute;
    top: 66px;
    right: 14px;
    left: 14px;
    display: none;
    align-items: stretch;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
  }

  body.site-nav-open .site-nav {
    display: grid;
  }

  .mobile-nav-toggle {
    display: inline-grid;
  }

  .content {
    padding: 22px 14px 42px;
  }

  .topbar {
    padding: 10px 14px;
  }

  .topbar-title,
  .admin-chip span {
    display: none;
  }

  .page-head {
    display: grid;
  }

  .page-head .button {
    width: 100%;
  }

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

  .panel-card {
    padding: 17px;
  }

  .chart-shell {
    overflow-x: auto;
  }
}
