:root {
  --green-900: #173d2c;
  --green-800: #285a40;
  --green-700: #377554;
  --green-100: #e9f2ed;
  --gold-500: #d9b13b;
  --orange-500: #f49a3d;
  --ink: #1d2520;
  --muted: #67746d;
  --line: #d7ded9;
  --paper: #fbfcfb;
  --white: #ffffff;
  --danger: #a93535;
  --warning: #7d5a12;
  --radius: 8px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.sidebar {
  min-height: 100vh;
  background: var(--green-900);
  color: var(--white);
  padding: 20px 16px;
  position: sticky;
  top: 0;
}

.brand {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 700;
}

.brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: var(--white);
  border-radius: 50%;
  padding: 3px;
}

.nav {
  display: grid;
  gap: 3px;
  margin-top: 22px;
}

.nav a {
  text-decoration: none;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: #eef6f1;
}

.nav a:hover,
.nav a.active {
  background: rgba(255, 255, 255, 0.12);
}

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

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
  margin-bottom: 22px;
}

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

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 26px;
}

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

h3 {
  font-size: 15px;
  margin-bottom: 8px;
}

.viewer {
  display: grid;
  gap: 4px;
  min-width: 260px;
  color: var(--muted);
}

select,
input,
textarea,
button {
  font: inherit;
}

select,
input,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--white);
  color: var(--ink);
}

textarea {
  min-height: 90px;
  resize: vertical;
}

button,
.button {
  border: 0;
  border-radius: 6px;
  background: var(--green-800);
  color: var(--white);
  padding: 9px 12px;
  min-height: 38px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

button.secondary,
.button.secondary {
  background: var(--green-100);
  color: var(--green-900);
}

button.warning {
  background: var(--warning);
}

button.danger {
  background: var(--danger);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.alerts {
  display: grid;
  gap: 8px;
}

.alert {
  padding: 10px 12px;
  background: #fff8e5;
  border: 1px solid #ead79d;
  border-radius: var(--radius);
  color: #533e0d;
}

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

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

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

.panel,
.stat,
.table-wrap {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.stat strong {
  display: block;
  font-size: 26px;
  color: var(--green-800);
}

.stat span {
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

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

.form-grid .wide {
  grid-column: span 2;
}

.form-grid .full {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

label span {
  font-weight: 650;
  color: var(--ink);
}

table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap table {
  min-width: 720px;
}

.table-wrap table.compact-table {
  min-width: 0;
}

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

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

td.actions {
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--green-100);
  color: var(--green-900);
  font-weight: 700;
  font-size: 12px;
}

.status.rejected {
  background: #f8e8e8;
  color: var(--danger);
}

.status.returned_for_correction {
  background: #fff0d2;
  color: var(--warning);
}

.status.fully_approved,
.status.completed {
  background: #e2f5e8;
  color: #225b38;
}

.timeline {
  display: grid;
  gap: 8px;
}

.timeline-item {
  border-left: 3px solid var(--line);
  padding-left: 12px;
}

.timeline-item.pending {
  border-color: var(--orange-500);
}

.timeline-item.approved {
  border-color: var(--green-700);
}

.timeline-item.rejected,
.timeline-item.returned {
  border-color: var(--danger);
}

.muted {
  color: var(--muted);
}

.empty {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

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

  .sidebar {
    position: static;
    min-height: auto;
  }

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

  .topbar,
  .grid.two,
  .grid.three {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .form-grid .wide {
    grid-column: auto;
  }

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