:root {
  color-scheme: dark;
  --bg: #07110f;
  --panel: rgba(13, 29, 26, 0.86);
  --panel-strong: #10231f;
  --line: rgba(161, 221, 195, 0.14);
  --line-strong: rgba(161, 221, 195, 0.27);
  --text: #edf8f2;
  --muted: #91aaa0;
  --green: #4cf2a1;
  --green-deep: #12b96b;
  --cyan: #6be8e5;
  --amber: #ffc96b;
  --red: #ff7d7d;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(29, 173, 112, 0.18), transparent 27rem),
    radial-gradient(circle at 100% 22%, rgba(30, 136, 145, 0.13), transparent 30rem),
    linear-gradient(180deg, #081411 0%, #06100e 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 34px 34px;
}

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

button {
  color: inherit;
}

.page-shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 58px 0 38px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 34px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 13px;
  font-size: clamp(2rem, 4.6vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 0;
  font-size: 1.3rem;
  letter-spacing: -0.025em;
}

.hero-copy {
  max-width: 800px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.75;
}

.api-badge,
.state-pill {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(10, 25, 21, 0.72);
  color: #c8ded5;
  font-size: 0.8rem;
  font-weight: 750;
  padding: 10px 14px;
  backdrop-filter: blur(16px);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(76, 242, 161, 0.1), 0 0 18px var(--green);
}

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

.metric,
.panel,
.recovery-banner {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.metric {
  display: flex;
  min-height: 116px;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 18px;
  padding: 20px 22px;
}

.metric span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.metric strong {
  font-size: 2rem;
  line-height: 1;
}

.metric-success strong {
  color: var(--green);
}

.metric-danger strong {
  color: var(--red);
}

.panel {
  margin-bottom: 13px;
  border-radius: 20px;
  padding: 26px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.section-heading > p,
.section-heading > span {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.section-heading.compact {
  align-items: center;
  margin-bottom: 18px;
}

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

.field-block,
.settings-grid label {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #d9e9e2;
  font-size: 0.85rem;
  font-weight: 760;
}

.line-count {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 600;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  outline: none;
  background: rgba(2, 10, 8, 0.68);
  color: var(--text);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

textarea {
  min-height: 278px;
  resize: vertical;
  padding: 15px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.72;
  tab-size: 2;
}

input,
select {
  height: 44px;
  padding: 0 12px;
}

textarea::placeholder,
input::placeholder {
  color: #526b61;
}

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(76, 242, 161, 0.7);
  background: rgba(2, 12, 9, 0.86);
  box-shadow: 0 0 0 4px rgba(76, 242, 161, 0.08);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-top: 18px;
}

.settings-grid label > span {
  color: #ccddd6;
  font-size: 0.8rem;
  font-weight: 720;
}

.settings-grid small {
  min-height: 34px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

.allocation-note {
  margin-top: 18px;
  border-left: 3px solid var(--green);
  border-radius: 4px 10px 10px 4px;
  background: rgba(76, 242, 161, 0.055);
  color: #abc4ba;
  padding: 13px 15px;
  font-size: 0.78rem;
  line-height: 1.7;
}

.allocation-note strong {
  color: #dff4e9;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 21px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  padding: 0 18px;
  font-size: 0.82rem;
  font-weight: 780;
  transition: transform 120ms ease, opacity 120ms ease, border-color 120ms ease, background 120ms ease;
}

.button:not(:disabled):hover {
  transform: translateY(-1px);
}

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

.button-primary {
  min-width: 170px;
  background: var(--green);
  color: #062117;
  box-shadow: 0 9px 28px rgba(76, 242, 161, 0.16);
}

.button-primary kbd {
  border: 0;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.12);
  font-size: 0.66rem;
  padding: 3px 6px;
}

.button-secondary {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.035);
}

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

.form-message {
  min-height: 1.4em;
  margin: 12px 0 0;
  color: var(--red);
  font-size: 0.78rem;
}

.progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.055);
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-deep), var(--green), var(--cyan));
  box-shadow: 0 0 18px rgba(76, 242, 161, 0.28);
  transition: width 260ms ease;
}

.progress-text {
  margin-top: 11px;
  color: var(--muted);
  font-size: 0.75rem;
}

.success-lines {
  display: grid;
  gap: 8px;
}

.success-line {
  display: grid;
  grid-template-columns: 88px minmax(180px, 1.5fr) minmax(150px, 0.8fr) 170px;
  gap: 14px;
  align-items: center;
  border: 1px solid rgba(76, 242, 161, 0.15);
  border-radius: 11px;
  background: rgba(76, 242, 161, 0.045);
  padding: 11px 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.74rem;
}

.success-line strong {
  color: var(--green);
}

.success-line span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  font-size: 0.76rem;
}

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

th {
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

td code,
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.clip-cell {
  max-width: 330px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  color: #c8ddd4;
  font-size: 0.68rem;
  font-weight: 750;
  white-space: nowrap;
}

.status-chip.succeeded {
  border-color: rgba(76, 242, 161, 0.3);
  background: rgba(76, 242, 161, 0.08);
  color: var(--green);
}

.status-chip.running {
  border-color: rgba(107, 232, 229, 0.26);
  color: var(--cyan);
}

.status-chip.failed,
.status-chip.uncertain {
  border-color: rgba(255, 125, 125, 0.25);
  color: var(--red);
}

.status-chip.waiting,
.status-chip.skipped {
  color: var(--muted);
}

.legend {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 0.7rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.legend-dot.success { background: var(--green); }
.legend-dot.running { background: var(--cyan); }
.legend-dot.failed { background: var(--red); }

.placeholder-row td,
.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 28px 16px;
}

.log-panel {
  padding: 0;
}

.log-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  padding: 20px 24px;
  font-size: 0.82rem;
  font-weight: 750;
}

.log-panel summary::-webkit-details-marker {
  display: none;
}

.log-panel summary span:last-child {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.log-output {
  max-height: 330px;
  overflow: auto;
  border-top: 1px solid var(--line);
  padding: 14px 20px 20px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.7rem;
  line-height: 1.7;
}

.log-line {
  display: grid;
  grid-template-columns: 82px 70px 1fr;
  gap: 10px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
  padding: 5px 0;
  text-align: left;
}

.log-time { color: #688379; }
.log-level { color: var(--cyan); }
.log-level.error { color: var(--red); }
.log-level.success { color: var(--green); }

.recovery-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 13px;
  border-color: rgba(255, 201, 107, 0.25);
  border-radius: 16px;
  padding: 15px 18px;
}

.recovery-banner > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--amber);
  font-size: 0.8rem;
}

.recovery-banner span {
  color: var(--muted);
  font-size: 0.73rem;
}

.hidden {
  display: none !important;
}

footer {
  color: #617a70;
  font-size: 0.7rem;
  line-height: 1.6;
  text-align: center;
  padding: 10px;
}

footer p {
  margin-bottom: 0;
}

footer code {
  color: #89a99b;
}

@media (max-width: 980px) {
  .metric-grid,
  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .success-line {
    grid-template-columns: 74px minmax(160px, 1fr) minmax(130px, 0.8fr);
  }

  .success-line time {
    display: none;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 22px, 1440px);
    padding-top: 30px;
  }

  .hero,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .api-badge {
    align-self: flex-start;
  }

  .input-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 90px;
  }

  .panel {
    border-radius: 16px;
    padding: 20px 16px;
  }

  .success-line {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .legend {
    display: none;
  }
}

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

  .action-row .button {
    flex: 1 1 calc(50% - 6px);
  }

  .recovery-banner {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
