:root {
  --bg: #f5f7f4;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #667085;
  --line: #dfe5dc;
  --green: #008060;
  --green-dark: #00684f;
  --blue: #2563eb;
  --amber: #b7791f;
  --red: #c2410c;
  --shadow: 0 18px 45px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  width: 280px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 28px 20px;
  background: #10231d;
  color: #eef8f3;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand__mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 3px;
  color: #9fb8ad;
  font-size: 12px;
}

.nav-menu {
  display: grid;
  gap: 6px;
}

.nav-menu__item {
  padding: 12px 14px;
  border-radius: 8px;
  color: #cad9d3;
  text-decoration: none;
  font-weight: 600;
}

.nav-menu__item:hover,
.nav-menu__item--active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.sidebar-card {
  margin-top: auto;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-card__label,
.metric-card__label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.sidebar-card__label {
  color: #a7bdb5;
}

.sidebar-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.sidebar-card p {
  margin: 10px 0 0;
  color: #b8cbc4;
  font-size: 13px;
}

.progress {
  height: 8px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.15);
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #7ee2bd;
}

.main-content {
  width: calc(100% - 280px);
  padding: 28px;
}

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

.eyebrow {
  margin: 0 0 5px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

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

.search-field,
.select-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search-field input,
.select-field select {
  width: 230px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.select-field select {
  width: 150px;
}

.button,
.icon-button,
.segmented-control button {
  border: 0;
  cursor: pointer;
  font-weight: 800;
}

.button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
}

.button--primary {
  background: var(--green);
  color: #ffffff;
}

.button--primary:hover {
  background: var(--green-dark);
}

.button--secondary,
.button--ghost {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.button--ghost {
  min-height: 36px;
}

.menu-button {
  display: none;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
}

.menu-button span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 2px auto;
  background: var(--ink);
}

.filter-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.segmented-control {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.segmented-control button {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.segmented-control button.is-active {
  background: #dff4eb;
  color: var(--green-dark);
}

.metrics-grid,
.dashboard-grid {
  display: grid;
  gap: 18px;
}

.metrics-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

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

.metric-card {
  padding: 20px;
}

.metric-card strong {
  display: block;
  margin: 10px 0 8px;
  font-size: 30px;
}

.trend {
  font-weight: 700;
}

.trend--up {
  color: var(--green);
}

.trend--down {
  color: var(--red);
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.75fr) minmax(280px, 0.8fr);
  margin-bottom: 18px;
}

.dashboard-grid--tables {
  align-items: start;
}

.panel {
  min-width: 0;
  padding: 20px;
}

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

.panel__header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.pill {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  background: #eef7f3;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
}

.chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(22px, 1fr));
  align-items: end;
  gap: 10px;
  height: 260px;
  padding-top: 8px;
}

.bar {
  position: relative;
  min-height: 34px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #21a67a 0%, #00775a 100%);
}

.bar span {
  position: absolute;
  right: 50%;
  bottom: -24px;
  transform: translateX(50%);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.channel-list,
.inventory-list {
  display: grid;
  gap: 14px;
}

.channel-item,
.inventory-item {
  display: grid;
  gap: 8px;
}

.channel-item__row,
.inventory-item__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
}

.channel-item small,
.inventory-item small {
  color: var(--muted);
}

.mini-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: #edf1ec;
}

.mini-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.inventory-item {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.inventory-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.stock-low {
  color: var(--red);
}

.stock-medium {
  color: var(--amber);
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td {
  font-weight: 600;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status--paid {
  background: #dff4eb;
  color: var(--green-dark);
}

.status--pending {
  background: #fff4dc;
  color: #8a5a00;
}

.status--fulfilled {
  background: #e7efff;
  color: #1d4ed8;
}

.overlay {
  display: none;
}

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

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

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

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

  .overlay.is-open {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: block;
    background: rgba(16, 35, 29, 0.42);
  }

  .main-content {
    width: 100%;
    padding: 20px;
  }

  .menu-button {
    display: block;
    flex: 0 0 auto;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar__actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .search-field {
    order: 3;
    width: 100%;
  }

  .search-field input {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .topbar,
  .filter-bar,
  .panel__header {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar__actions {
    justify-content: stretch;
  }

  .button {
    flex: 1 1 auto;
  }

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

  .segmented-control,
  .select-field {
    width: 100%;
  }

  .segmented-control button {
    flex: 1;
  }

  .chart {
    gap: 6px;
    height: 220px;
  }
}
