:root {
  --bg: #f5f7f4;
  --panel: #ffffff;
  --panel-soft: #eef5ed;
  --ink: #18231f;
  --muted: #69756f;
  --line: #dfe7df;
  --green: #2fbf71;
  --green-dark: #14824c;
  --blue: #2c6cf6;
  --amber: #d58b00;
  --red: #cc3f38;
  --shadow: 0 18px 50px rgba(29, 45, 35, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 268px;
  padding: 22px;
  background: #111c18;
  color: #f4fbf6;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: #07120d;
  font-weight: 900;
}

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

.brand span {
  margin-top: 3px;
  color: #a7bbb1;
  font-size: 13px;
}

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

.nav-item,
.icon-button,
.primary-button,
.secondary-button,
.segment {
  border: 0;
  border-radius: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  background: transparent;
  color: #b8c8bf;
  text-align: left;
}

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

.nav-item svg,
.icon-button svg,
.primary-button svg,
.secondary-button svg,
.workflow-step svg,
.search svg {
  width: 18px;
  height: 18px;
}

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

.card-label,
.eyebrow {
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar-card .card-label {
  color: #77e5aa;
}

.sidebar-card p {
  margin: 8px 0 0;
  color: #b8c8bf;
  font-size: 13px;
  line-height: 1.45;
}

.shell {
  margin-left: 268px;
  padding: 28px;
}

.topbar,
.panel-head,
.toolbar,
.top-actions,
.workflow,
.metrics {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.topbar h1,
.panel h2 {
  margin: 4px 0 0;
}

.topbar h1 {
  font-size: 30px;
  line-height: 1.1;
}

.top-actions {
  gap: 10px;
}

.sync-state {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  white-space: nowrap;
}

.pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(47, 191, 113, 0.12);
}

.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
}

.primary-button,
.secondary-button {
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.primary-button {
  background: var(--green);
  color: #06140d;
  font-weight: 800;
}

.secondary-button {
  background: #edf3ef;
  color: var(--ink);
}

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

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

.metric {
  padding: 18px;
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 28px;
  line-height: 1;
}

.metric.accent {
  background: #10251b;
  color: #ffffff;
  border-color: #10251b;
}

.metric.accent span,
.metric.accent small {
  color: #a7d2ba;
}

.workflow {
  padding: 14px;
  gap: 10px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.workflow-step {
  min-width: 178px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  background: #f6f9f6;
}

.workflow-step svg {
  color: var(--muted);
}

.workflow-step.done svg {
  color: var(--green-dark);
}

.workflow-step.waiting svg {
  color: var(--amber);
}

.workflow-step strong,
.workflow-step span {
  display: block;
}

.workflow-step span {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.workflow-line {
  min-width: 34px;
  height: 1px;
  background: var(--line);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

.panel {
  padding: 18px;
}

.panel-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-head.compact {
  margin-bottom: 12px;
}

.panel h2 {
  font-size: 20px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 8px;
  background: #edf3ef;
}

.segment {
  padding: 8px 12px;
  color: var(--muted);
  background: transparent;
}

.segment.active {
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 1px 8px rgba(32, 48, 39, 0.08);
}

.toolbar {
  gap: 10px;
  margin-bottom: 14px;
}

.search {
  flex: 1;
  min-width: 220px;
  min-height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 8px;
  background: #f6f9f6;
  border: 1px solid var(--line);
  color: var(--muted);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

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

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

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

th {
  background: #f8faf8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

tbody tr:hover {
  background: #fbfdfb;
}

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

.item-title {
  display: grid;
  gap: 4px;
}

.item-title strong {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-title span,
.muted {
  color: var(--muted);
  font-size: 12px;
}

.price {
  font-weight: 800;
  white-space: nowrap;
}

.calc {
  color: var(--green-dark);
  font-weight: 800;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #e9f8ef;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
}

.badge.review {
  background: #fff4d9;
  color: #8b5c00;
}

.side-stack {
  display: grid;
  gap: 16px;
  align-content: start;
}

.rules {
  display: grid;
  gap: 10px;
}

.rule-row {
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 10px;
  border-radius: 8px;
  background: #f6f9f6;
}

.rule-row small {
  color: var(--muted);
}

.queue {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.queue li {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: start;
}

.queue li > span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--green-dark);
  font-weight: 900;
}

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

.queue small {
  margin-top: 2px;
  color: var(--muted);
}

.apply-panel {
  background: #10251b;
  color: #ffffff;
}

.apply-panel .eyebrow,
.apply-panel p {
  color: #a7d2ba;
}

.apply-panel p {
  margin-bottom: 0;
  line-height: 1.45;
}

.switch-line {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.switch-line input {
  position: absolute;
  opacity: 0;
}

.switch-line b {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: var(--green);
}

.switch-line b::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
}

.switch-line input:not(:checked) + b {
  background: #4c5a53;
}

.switch-line input:not(:checked) + b::after {
  right: 24px;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 860px) {
  .sidebar {
    position: static;
    width: auto;
    min-height: auto;
    padding: 14px;
    gap: 14px;
  }

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

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-item {
    min-width: max-content;
    padding: 9px 11px;
  }

  .sidebar-card {
    margin-top: 0;
    padding: 12px;
  }

  .shell {
    margin-left: 0;
    padding: 18px;
  }

  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .metrics,
  .side-stack {
    grid-template-columns: 1fr;
    display: grid;
  }

  .top-actions {
    gap: 8px;
  }

  .sync-state,
  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .metrics {
    gap: 10px;
  }
}
