:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --text: #1d2520;
  --muted: #667168;
  --line: #cbd3cc;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --danger: #a33b2f;
  --code-bg: #17201b;
  --code-text: #e8f2ec;
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 650;
  min-height: 40px;
  padding: 0 14px;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  border-color: var(--line);
  background: #d8dfd9;
  color: var(--muted);
  cursor: not-allowed;
}

input {
  border: 1px solid var(--line);
  color: var(--text);
  min-height: 40px;
  padding: 8px 10px;
  width: 100%;
}

input:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 22%, transparent);
  outline-offset: 1px;
}

.app-shell {
  margin: 0 auto;
  max-width: 1180px;
  min-height: 100vh;
  padding: 24px;
}

.toolbar,
.status-band,
.manifest-section,
.orders-section {
  background: var(--panel);
  border: 1px solid var(--line);
  margin-bottom: 16px;
  padding: 18px;
}

.toolbar {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(220px, 0.8fr) minmax(420px, 1.4fr);
}

.brand h1,
.section-heading h2 {
  font-size: 1.15rem;
  letter-spacing: 0;
  line-height: 1.25;
  margin: 0;
}

.brand p,
.section-heading span {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}

.controls {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(170px, 1fr) minmax(170px, 1fr) auto;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 0.78rem;
  font-weight: 700;
  gap: 6px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status-band {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr auto;
}

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

.status-table th,
.status-table td {
  border-bottom: 1px solid var(--line);
  line-height: 1.35;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.status-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  width: 140px;
}

.status-table td {
  overflow-wrap: anywhere;
}

.state-failed {
  color: var(--danger);
  font-weight: 700;
}

.state-complete {
  color: var(--accent-dark);
  font-weight: 700;
}

.actions {
  display: grid;
  gap: 10px;
  min-width: 160px;
}

.actions button {
  background: #fff;
  color: var(--accent-dark);
}

.action-status {
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.section-heading {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

#manifest-json,
#orders-json {
  background: var(--code-bg);
  color: var(--code-text);
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, ui-monospace,
    monospace;
  font-size: 0.86rem;
  line-height: 1.5;
  margin: 0;
  min-height: 360px;
  overflow: auto;
  padding: 16px;
  white-space: pre-wrap;
}

#orders-json {
  min-height: 420px;
}

@media (max-width: 860px) {
  .app-shell {
    padding: 12px;
  }

  .toolbar,
  .status-band,
  .controls {
    grid-template-columns: 1fr;
  }

  .actions {
    grid-template-columns: 1fr 1fr;
    min-width: 0;
  }
}
