:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #61708a;
  --line: #dce5f2;
  --accent: #2563eb;
  --accent-strong: #1745b5;
  --danger: #a13a3a;
  --shadow: 0 16px 42px rgba(20, 37, 64, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
  gap: 20px;
  align-items: start;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 5rem);
  line-height: 0.96;
}

.lede {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.65;
}

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

.hero-card {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.metric {
  padding: 13px 14px;
  border-radius: 8px;
  background: #f5f8fd;
}

.label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric strong {
  overflow-wrap: anywhere;
}

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

.card {
  padding: 20px;
}

.primary-card {
  grid-row: span 2;
}

.status-card,
.output-card {
  grid-column: 1 / -1;
}

.card h2 {
  margin: 0 0 8px;
  font-size: 1.24rem;
}

.card p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.55;
}

form {
  display: grid;
  gap: 13px;
}

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

.compact-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  margin-bottom: 11px;
}

label {
  display: grid;
  gap: 7px;
  color: #263448;
  font-size: 0.94rem;
  font-weight: 700;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

input,
select {
  min-height: 42px;
  padding: 10px 12px;
}

textarea {
  min-height: 220px;
  resize: vertical;
  padding: 12px;
  line-height: 1.5;
}

button {
  justify-self: start;
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

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

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

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.actions,
.loader {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.loader {
  color: var(--muted);
  font-size: 0.92rem;
}

.hidden {
  display: none;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(37, 99, 235, 0.2);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin 800ms linear infinite;
}

.output {
  min-height: 260px;
  margin: 0;
  overflow: auto;
  border-radius: 8px;
  background: #111827;
  color: #dbeafe;
  padding: 14px;
  font: 0.86rem/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
}

.small-output {
  min-height: 108px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .hero,
  .grid,
  .form-row {
    grid-template-columns: 1fr;
  }

  .primary-card {
    grid-row: auto;
  }
}

@media (max-width: 560px) {
  .compact-form,
  .status-row {
    grid-template-columns: 1fr;
    display: grid;
  }
}
