:root {
  --bg: #eef3f8;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: #d8e0ea;
  --navy: #111c33;
  --blue: #2563eb;
  --green: #0f9f6e;
  --amber: #c77d12;
  --red: #d04444;
}

* {
  box-sizing: border-box;
}

body {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  align-content: start;
  gap: 26px;
  padding: 22px;
  color: #d8e4f7;
  background: var(--navy);
}

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

.brand span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--navy);
  background: #9cc4ff;
  border-radius: 8px;
  font-weight: 800;
}

.brand strong {
  font-size: 22px;
}

nav {
  display: grid;
  gap: 8px;
}

nav button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  color: #a9b7d0;
  background: transparent;
  text-align: left;
  font-weight: 800;
}

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

.operator-card {
  padding: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.operator-card span,
.operator-card p {
  color: #9fb0ce;
}

.operator-card strong {
  display: block;
  margin: 7px 0;
}

.operator-card p,
h1,
h2,
h3 {
  margin: 0;
}

.app-shell {
  min-width: 0;
  padding: 26px;
}

.app-topbar,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.app-topbar {
  margin-bottom: 20px;
}

.app-topbar p,
.panel-head p {
  margin: 0 0 4px;
  color: var(--muted);
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 22px;
}

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

select,
.topbar-actions button,
.outline-button,
.segmented button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.topbar-actions button {
  color: #ffffff;
  background: var(--blue);
  border-color: var(--blue);
}

.stats-grid,
.inventory-grid,
.report-grid {
  display: grid;
  gap: 14px;
}

.stats-grid {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 18px;
}

.stats-grid article,
.content-view,
.drawer,
.inventory-card,
.chart-panel,
.leaderboard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stats-grid article {
  min-height: 132px;
  padding: 18px;
}

.stats-grid span,
.stats-grid small,
.table-head,
.inventory-card p,
.drawer span,
.leader-row span {
  color: var(--muted);
}

.stats-grid strong {
  display: block;
  margin: 12px 0 8px;
  font-size: 30px;
}

.content-view {
  display: none;
  padding: 20px;
}

.content-view.active {
  display: block;
}

.panel-head {
  margin-bottom: 18px;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented button.active {
  color: #ffffff;
  background: var(--navy);
  border-color: var(--navy);
}

.table {
  overflow-x: auto;
}

.table-row {
  display: grid;
  grid-template-columns: 130px 1.2fr 120px 120px 120px 80px;
  gap: 12px;
  align-items: center;
  min-width: 760px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.table-head {
  border-top: 0;
  font-size: 13px;
  font-weight: 800;
}

.status {
  width: fit-content;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.status.process {
  color: #8a5a00;
  background: #fff2c7;
}

.status.ready {
  color: #075985;
  background: #dff4ff;
}

.status.done {
  color: #067647;
  background: #dcfae6;
}

.link-button {
  border: 0;
  color: var(--blue);
  background: transparent;
  font-weight: 800;
}

.empty-state {
  padding: 24px 0;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.inventory-grid .empty-state {
  grid-column: 1 / -1;
}

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

.inventory-card {
  padding: 18px;
}

.inventory-card strong {
  display: block;
  margin: 10px 0;
  font-size: 24px;
}

.stock-bar {
  height: 9px;
  overflow: hidden;
  background: #ecf1f6;
  border-radius: 99px;
}

.stock-bar i {
  display: block;
  height: 100%;
  background: var(--green);
}

.inventory-card.low .stock-bar i {
  background: var(--red);
}

.report-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

.chart-panel,
.leaderboard {
  padding: 18px;
}

.chart-head,
.leader-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.chart-head {
  margin-bottom: 18px;
}

.bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(42px, 1fr));
  align-items: stretch;
  gap: 10px;
  height: 240px;
}

.bar-item {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 7px;
  align-items: end;
  text-align: center;
}

.bar-item i {
  width: 100%;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  border-radius: 6px 6px 0 0;
}

.bar-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.bar-item strong {
  font-size: 13px;
}

.leaderboard h3 {
  margin-bottom: 16px;
}

.leader-row {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.drawer {
  position: fixed;
  top: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  width: min(420px, calc(100vw - 36px));
  display: none;
  padding: 20px;
  box-shadow: 0 24px 80px rgba(16, 24, 40, 0.2);
}

.drawer.open {
  display: block;
}

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

.drawer-head button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: #ffffff;
  font-size: 22px;
}

.drawer-body {
  display: grid;
  gap: 12px;
}

.drawer-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.drawer-items {
  display: grid;
}

.drawer-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.drawer-actions button,
.drawer-form button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: var(--blue);
  font-weight: 800;
}

.drawer-form {
  display: grid;
  gap: 12px;
}

.drawer-form label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-weight: 800;
}

.drawer-form input,
.drawer-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
}

@media (max-width: 1060px) {
  body,
  .stats-grid,
  .inventory-grid,
  .report-grid {
    grid-template-columns: 1fr 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  body,
  .stats-grid,
  .inventory-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .app-topbar,
  .panel-head,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .app-shell {
    padding: 16px;
  }
}
