:root {
  --bg: #efe7d8;
  --paper: #fbf7ef;
  --ink: #14120f;
  --muted: #685f55;
  --accent: #9d3a26;
  --accent-soft: #f3d6c9;
  --ok: #1f7a4c;
  --warn: #ba6e14;
  --line: rgba(20, 18, 15, 0.12);
  --shadow: 0 16px 40px rgba(20, 18, 15, 0.08);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(157, 58, 38, 0.08), transparent 30%),
    linear-gradient(180deg, #f7efe3 0%, #efe7d8 100%);
  color: var(--ink);
  font-family: var(--sans);
}

.page {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
}

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

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 3vw, 3rem);
}

.lede {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: transform 160ms ease, opacity 160ms ease;
}

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

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

.button-primary {
  background: var(--accent);
  color: white;
}

.button-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.button-danger {
  background: #7f2618;
  color: white;
}

.hero-note {
  margin: 0 0 20px;
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

.layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.35fr;
  gap: 20px;
  align-items: start;
}

.panel {
  padding: 22px;
  min-width: 0;
}

.panel-heading p {
  color: var(--muted);
}

.component-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.component-card {
  border-radius: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  background: white;
}

.component-card h3 {
  margin-bottom: 6px;
  font-size: 1rem;
}

.component-card p {
  color: var(--muted);
  margin-bottom: 10px;
}

.component-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
}

.component-state::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #b9ada0;
}

.component-card.running .component-state::before,
.component-card.active .component-state::before {
  background: var(--ok);
}

.component-card.warning .component-state::before {
  background: var(--warn);
}

.snapshots {
  display: grid;
  gap: 14px;
}

.snapshot,
.logs > div {
  min-width: 0;
}

.snapshot pre,
.logs pre {
  margin: 0;
  min-height: 160px;
  max-height: 240px;
  max-width: 100%;
  overflow: auto;
  padding: 14px;
  border-radius: 16px;
  background: #191613;
  color: #f4ede2;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.iproov-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.iproov-meta {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--muted);
}

.iproov-meta p {
  margin: 0;
}

.iproov-mount {
  min-height: 280px;
  border-radius: 18px;
  border: 1px dashed var(--line);
  background: rgba(247, 240, 229, 0.7);
  padding: 16px;
}

.iproov-placeholder {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

iproov-me {
  display: block;
  width: 100%;
  min-height: 420px;
}

.step-list {
  display: grid;
  gap: 12px;
}

.step-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: white;
}

.step-card.running {
  border-color: rgba(157, 58, 38, 0.5);
  box-shadow: inset 0 0 0 1px rgba(157, 58, 38, 0.2);
}

.step-card.completed {
  border-color: rgba(31, 122, 76, 0.4);
  background: rgba(31, 122, 76, 0.06);
}

.step-card.failed {
  border-color: rgba(157, 58, 38, 0.4);
  background: rgba(157, 58, 38, 0.06);
}

.step-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.step-card p {
  color: var(--muted);
}

.step-meta {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.status-banner {
  min-height: 52px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #181511;
  color: #fff9f0;
  margin-bottom: 14px;
  line-height: 1.45;
}

.evidence-list {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.evidence-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: white;
}

.evidence-card h3 {
  margin-bottom: 6px;
  font-size: 1rem;
}

.evidence-card p {
  color: var(--muted);
  margin-bottom: 10px;
}

.payload {
  margin: 0;
  padding: 12px;
  border-radius: 14px;
  background: #f7f0e5;
  font-family: var(--mono);
  font-size: 0.74rem;
  overflow: auto;
  max-height: 220px;
  white-space: pre-wrap;
  word-break: break-word;
}

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

.relay-events {
  display: grid;
  gap: 10px;
}

.relay-event {
  padding: 12px;
  border-radius: 14px;
  background: #f7f0e5;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.takeaway {
  margin-top: 20px;
  padding: 22px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
}

.script-page {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px;
}

.script-shell {
  display: grid;
  gap: 18px;
}

.script-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.script-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 12px;
}

.script-list li {
  padding-left: 4px;
}

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

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

.repo-url {
  font-family: var(--mono);
  font-size: 0.9rem;
}

.qr-wrapper {
  width: 200px;
  height: 200px;
  display: grid;
  place-items: center;
  background: #f6f2e8;
  border-radius: 20px;
  border: 1px solid var(--line);
}

.qr-wrapper svg {
  width: 180px;
  height: 180px;
}

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

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

  .takeaway,
  .hero {
    flex-direction: column;
  }

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