:root {
  --bg: #f6f2e8;
  --panel: #fffaf1;
  --panel-soft: #f1e7d4;
  --ink: #1f2924;
  --muted: #667169;
  --line: rgba(31, 41, 36, 0.12);
  --accent: #a94f2a;
  --accent-dark: #813612;
  --ok: #245b45;
  --idle: #8d5a1c;
  --shadow: 0 18px 48px rgba(72, 43, 15, 0.09);
  --font-ui: "Trebuchet MS", "Aptos", Verdana, sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-size: 14px;
  background:
    radial-gradient(circle at top left, rgba(169, 79, 42, 0.16), transparent 25%),
    linear-gradient(180deg, #faf5ec 0%, #efe5d2 100%);
  color: var(--ink);
  font-family: var(--font-ui);
}

html {
  zoom: 0.8;
}

body {
  padding: 6px;
}

.shell {
  max-width: none;
  width: 100%;
  margin: 0 auto;
  display: grid;
  gap: 8px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 250, 241, 0.94);
  box-shadow: var(--shadow);
  padding: 10px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.topbar h1,
.results h2 {
  margin: 0;
  font-family: var(--font-display);
}

.topbar h1 {
  font-size: clamp(1.05rem, 1.4vw, 1.45rem);
  line-height: 1.08;
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--accent-dark);
}

.lede {
  margin: 2px 0 0;
  max-width: 64ch;
  color: var(--muted);
  line-height: 1.2;
  font-size: 0.82rem;
}

.top-actions,
.button-row,
.results-meta,
.simple-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.top-actions {
  justify-content: end;
}

.status-badge {
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  background: rgba(141, 90, 28, 0.12);
  color: var(--idle);
  font-size: 0.9rem;
}

.status-badge.running {
  background: rgba(36, 91, 69, 0.14);
  color: var(--ok);
}

.status-badge.off {
  background: rgba(31, 41, 36, 0.09);
  color: var(--muted);
}

.button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 7px 11px;
  font-size: 0.9rem;
}

.button.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: white;
}

.button.ghost {
  background: transparent;
  border-color: var(--line);
}

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

.controls form {
  display: grid;
  gap: 8px;
}

.simple-grid {
  justify-content: space-between;
}

.run-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.switch-card,
.mini-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--panel-soft);
  min-width: 130px;
}

.mini-stat {
  flex-direction: column;
  align-items: start;
  min-height: 62px;
}

.mini-stat.wide {
  grid-column: span 2;
}

.mini-stat strong {
  word-break: break-word;
}

.mini-stat span,
.switch-card small,
.results-meta,
.flash-message,
.inline-link {
  color: var(--muted);
}

.mini-stat strong {
  font-size: 0.92rem;
}

.switch-card input {
  width: 18px;
  height: 18px;
  margin-left: auto;
}

.field label {
  display: block;
  margin-bottom: 4px;
  font-weight: 700;
  font-size: 0.84rem;
}

.industry-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.industry-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  background: white;
  cursor: pointer;
  font-size: 0.82rem;
}

.industry-chip input {
  width: 15px;
  height: 15px;
}

.inline-link {
  text-decoration: none;
  font-weight: 700;
}

.inline-link.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.flash-message {
  min-height: 1.2rem;
  margin: 0;
}

.advanced {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.advanced summary,
.logs summary {
  cursor: pointer;
  font-weight: 700;
}

.advanced-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 8px;
}

input[type="text"],
input[type="number"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 9px;
  font: inherit;
  background: white;
  color: var(--ink);
  font-size: 0.9rem;
}

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

.results-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  margin-bottom: 6px;
}

.results-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
}

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

.results-table th,
.results-table td {
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
  padding: 6px 8px;
  font-size: 0.78rem;
}

.results-table th {
  position: sticky;
  top: 0;
  background: #f7efe0;
  color: var(--accent-dark);
  text-transform: lowercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.results-table tr:last-child td {
  border-bottom: 0;
}

.cell-single,
.cell-multiline,
.empty-cell {
  line-height: 1.25;
}

.cell-single {
  white-space: nowrap;
}

.cell-multiline {
  min-width: 180px;
  white-space: normal;
}

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

.log-output {
  margin: 10px 0 0;
  max-height: 180px;
  overflow: auto;
  border-radius: 14px;
  background: #202621;
  color: #edf3ea;
  padding: 8px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.74rem;
  line-height: 1.25;
}

@media (max-width: 860px) {
  html {
    zoom: 1;
  }

  body {
    padding: 8px;
  }

  .topbar,
  .results-head {
    flex-direction: column;
  }

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

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

  .mini-stat.wide {
    grid-column: span 2;
  }

  .switch-card,
  .mini-stat {
    min-width: 0;
    flex: 1 1 140px;
  }

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