:root {
  --ink: #1e2430;
  --muted: #667085;
  --line: #d8dee8;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --blue: #265dff;
  --green: #168a5b;
  --amber: #b46a00;
  --red: #c73535;
  --teal: #0f7c86;
  --violet: #6154a8;
  --shadow: 0 16px 42px rgba(31, 42, 68, 0.1);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

.topbar {
  min-height: 82px;
  padding: 18px 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
}

h3 {
  margin-bottom: 0;
  font-size: 16px;
}

.session-panel {
  display: grid;
  gap: 6px;
  min-width: 210px;
}

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--ink);
}

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

.sidebar {
  padding: 18px;
  background: #ffffff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-button {
  border: 0;
  background: transparent;
  color: #344054;
  border-radius: 6px;
  min-height: 42px;
  padding: 0 12px;
  text-align: left;
  cursor: pointer;
  font-weight: 800;
}

.nav-button:hover,
.nav-button.active {
  background: #e9efff;
  color: #183fbd;
}

.workspace {
  padding: 26px;
}

.view {
  display: none;
}

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

.section-heading,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading span,
.danger-zone p {
  color: var(--muted);
  font-size: 13px;
}

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

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
  min-height: 112px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
  line-height: 1;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric.blue {
  border-top: 4px solid var(--blue);
}

.metric.green {
  border-top: 4px solid var(--green);
}

.metric.amber {
  border-top: 4px solid var(--amber);
}

.metric.red {
  border-top: 4px solid var(--red);
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
}

.panel,
.entry-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

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

.form-grid.dense {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.primary-action,
.secondary-action {
  border: 0;
  border-radius: 6px;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 900;
  cursor: pointer;
}

.primary-action {
  margin-top: 16px;
  background: var(--blue);
  color: #ffffff;
}

.secondary-action {
  background: #eef2f7;
  color: #344054;
}

.secondary-action.danger {
  background: #ffe8e8;
  color: var(--red);
}

.primary-action:disabled,
.secondary-action:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.inventory-bars {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.stock-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.stock-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcff;
}

.stock-box h4 {
  margin: 0 0 10px;
  font-size: 13px;
}

.stock-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid #edf1f7;
  font-size: 13px;
  font-weight: 800;
}

.bar-row {
  display: grid;
  gap: 7px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  font-weight: 800;
}

.bar-track {
  height: 12px;
  background: #edf1f7;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--teal);
}

.task-list {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.task-list li,
.approval-item,
.ai-copy p {
  border: 1px solid var(--line);
  background: #fbfcff;
  border-radius: 8px;
  padding: 12px;
}

.task-list strong {
  display: block;
  margin-bottom: 4px;
}

.task-list span,
.ai-copy span {
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  margin-top: 16px;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

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

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

.status.pending {
  background: #fff4db;
  color: var(--amber);
}

.status.approved {
  background: #def7ec;
  color: var(--green);
}

.status.alert {
  background: #ffe8e8;
  color: var(--red);
}

.approval-list,
.ai-copy,
.module-grid {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.approval-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.approval-item p {
  margin-bottom: 4px;
}

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

.module {
  min-height: 74px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px dashed #adb7c7;
  border-radius: 8px;
  color: #475467;
  font-weight: 900;
  padding: 12px;
}

.module.enabled {
  border-style: solid;
  background: #e7f8f5;
  color: #0f655f;
}

.danger-zone {
  border-color: #ffd0d0;
}

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

  .sidebar {
    position: sticky;
    top: 82px;
    z-index: 8;
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-button {
    white-space: nowrap;
  }

  .metric-grid,
  .split-layout,
  .form-grid,
  .form-grid.dense,
  .stock-detail,
  .module-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 14px;
  }

  .workspace {
    padding: 14px;
  }

  .section-heading,
  .panel-heading,
  .approval-item {
    align-items: stretch;
    flex-direction: column;
    display: flex;
  }

  h1,
  h2 {
    font-size: 21px;
  }
}
