:root {
  color-scheme: light;
  --ink: #17211b;
  --muted: #68736c;
  --faint: #8c9690;
  --line: #dfe4df;
  --line-strong: #c9d0ca;
  --paper: #f6f7f4;
  --surface: #ffffff;
  --surface-muted: #f0f3ef;
  --forest: #184f3c;
  --forest-hover: #103d2d;
  --mint: #dcecdf;
  --lime: #c9ef72;
  --amber: #b76f11;
  --amber-bg: #fff2d6;
  --red: #a33a32;
  --red-bg: #fbe8e5;
  --blue: #2c5d80;
  --blue-bg: #e7f0f6;
  --shadow: 0 14px 40px rgba(28, 48, 36, 0.07);
  --radius: 12px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 74% 7%, rgba(201, 239, 114, 0.14), transparent 20rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.shell { min-height: 100vh; }

.topbar {
  height: 68px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 244, 0.9);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 720;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--forest);
  transform: rotate(-5deg);
}

.brand-mark span {
  width: 10px;
  height: 10px;
  border: 2px solid var(--lime);
  border-top-color: transparent;
  border-radius: 50%;
}

.topbar-actions, .connection { display: flex; align-items: center; }
.topbar-actions { gap: 10px; }
.connection {
  gap: 7px;
  color: var(--muted);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 650;
}

.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.connection.is-online .pulse { background: #3c9a63; box-shadow: 0 0 0 4px rgba(60, 154, 99, 0.11); }
.connection.is-error .pulse { background: var(--red); }

.layout { display: grid; grid-template-columns: 292px minmax(0, 1fr); min-height: calc(100vh - 68px); }

.sidebar {
  border-right: 1px solid var(--line);
  padding: 28px 18px;
  background: rgba(240, 243, 239, 0.54);
}

.sidebar-heading, .section-title, .submit-row, .detail-heading, .detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.sidebar-heading { padding: 0 8px 18px; }
.sidebar h2 { margin: 2px 0 0; font-size: 16px; letter-spacing: -0.02em; }
.eyebrow { margin: 0; color: var(--forest); font-size: 10px; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  font-size: 20px;
}
.icon-button:hover, .icon-button:focus-visible { background: var(--surface); border-color: var(--line); }

.job-list { display: grid; gap: 7px; }
.empty-list { padding: 32px 12px; color: var(--faint); font-size: 13px; text-align: center; }

.job-card {
  width: 100%;
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  gap: 11px;
  padding: 13px 12px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}
.job-card:hover { background: rgba(255, 255, 255, 0.62); }
.job-card.is-active { background: var(--surface); border-color: var(--line); box-shadow: 0 3px 12px rgba(28, 48, 36, 0.04); }
.status-dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--faint); }
.status-dot.running, .status-dot.queued, .status-dot.canceling { background: var(--blue); }
.status-dot.succeeded { background: #3c9a63; }
.status-dot.needs_input { background: var(--amber); }
.status-dot.failed, .status-dot.canceled { background: var(--red); }
.job-name { display: block; overflow: hidden; font-size: 13px; font-weight: 720; text-overflow: ellipsis; white-space: nowrap; }
.job-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 3px; color: var(--faint); font-size: 11px; text-transform: capitalize; }

.workspace { min-width: 0; }
.workspace-nav { height: 54px; padding: 0 clamp(24px, 5vw, 76px); display: flex; gap: 26px; align-items: stretch; border-bottom: 1px solid var(--line); }
.nav-tab { position: relative; border: 0; padding: 0; background: transparent; color: var(--faint); font-size: 13px; font-weight: 700; cursor: pointer; }
.nav-tab.is-active { color: var(--ink); }
.nav-tab.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--forest); }
.nav-tab:disabled { cursor: default; opacity: 0.45; }

.view { max-width: 980px; margin: 0 auto; padding: 62px clamp(24px, 5vw, 76px) 80px; }
.intro { max-width: 700px; margin-bottom: 52px; }
.intro h1 { margin: 10px 0 18px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(42px, 6vw, 66px); line-height: 0.99; font-weight: 400; letter-spacing: -0.045em; }
.intro h1 span { color: var(--forest); font-style: italic; }
.intro > p:last-child { max-width: 590px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.65; }

.launch-form { border-top: 1px solid var(--line-strong); }
.form-section { display: grid; grid-template-columns: 52px minmax(0, 1fr); padding: 30px 0 34px; border-bottom: 1px solid var(--line); }
.section-number { padding-top: 4px; color: var(--forest); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; font-weight: 700; }
.section-body { display: grid; gap: 16px; }
.section-title { align-items: flex-start; margin-bottom: 3px; }
.section-title h2 { margin: 0; font-size: 19px; letter-spacing: -0.025em; }
.section-title p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.segmented { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-muted); }
.segment { border: 0; border-radius: 6px; padding: 6px 11px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.segment.is-active { color: var(--ink); background: var(--surface); box-shadow: 0 1px 3px rgba(28, 48, 36, 0.08); }

label { display: block; margin-bottom: 7px; color: var(--ink); font-size: 12px; font-weight: 720; }
label span { color: var(--faint); font-weight: 500; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
  color: var(--ink);
  background: var(--surface);
  transition: border-color 120ms, box-shadow 120ms;
}
input { height: 44px; padding: 0 13px; }
textarea { padding: 12px 13px; line-height: 1.55; resize: vertical; min-height: 132px; }
input:focus, textarea:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(24, 79, 60, 0.11); }
input::placeholder, textarea::placeholder { color: #9aa29d; }

.input-with-icon { position: relative; }
.input-with-icon > span { position: absolute; left: 13px; top: 12px; color: var(--faint); font-size: 12px; }
.input-with-icon input { padding-left: 38px; }
.field-help { margin: 6px 0 0; color: var(--faint); font-size: 11px; }
.section-body > .field-help { margin-top: -8px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.domain-input { display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); overflow: hidden; }
.domain-input:focus-within { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(24, 79, 60, 0.11); }
.domain-input input { min-width: 90px; border: 0; border-radius: 0; box-shadow: none; }
.domain-input > span { padding-right: 12px; color: var(--faint); font-size: 12px; white-space: nowrap; }

.dropzone { min-height: 132px; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: rgba(255, 255, 255, 0.45); cursor: pointer; transition: border-color 120ms, background 120ms; }
.dropzone:hover, .dropzone:focus-within { border-color: var(--forest); background: rgba(220, 236, 223, 0.35); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone strong { font-size: 13px; }
.dropzone > span:last-child { color: var(--faint); font-size: 11px; font-weight: 500; }
.dropzone-icon { width: 30px; height: 30px; margin-bottom: 5px; display: grid; place-items: center; border-radius: 50%; background: var(--mint); color: var(--forest) !important; font-size: 17px !important; }
.dropzone-compact { min-height: 112px; }

.submit-row { padding: 28px 0 0 52px; }
.permission-note { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; }
.permission-note strong { color: var(--ink); }
.shield { width: 25px; height: 25px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px 8px 11px 11px; background: var(--mint); color: var(--forest); font-weight: 900; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 16px; min-height: 42px; border: 1px solid transparent; border-radius: 9px; padding: 0 16px; cursor: pointer; font-weight: 750; transition: transform 120ms, background 120ms, border-color 120ms; }
.button:active { transform: translateY(1px); }
.button:disabled { cursor: wait; opacity: 0.55; }
.button-primary { min-width: 164px; background: var(--forest); color: white; box-shadow: 0 8px 22px rgba(24, 79, 60, 0.18); }
.button-primary:hover { background: var(--forest-hover); }
.button-quiet { border-color: var(--line); background: rgba(255, 255, 255, 0.54); }
.button-quiet:hover { border-color: var(--line-strong); background: var(--surface); }
.button-small { min-height: 34px; padding: 0 11px; font-size: 11px; }
.button-danger { color: var(--red); border-color: #ebc9c4; background: var(--red-bg); }
.form-error { margin: 20px 0 0 52px; padding: 11px 13px; border-radius: 8px; background: var(--red-bg); color: var(--red); font-size: 12px; }

.detail-heading { align-items: flex-start; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.detail-heading h1 { margin: 7px 0 5px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(34px, 5vw, 52px); font-weight: 400; letter-spacing: -0.04em; }
.detail-domain { color: var(--muted); font-size: 13px; }
.status-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 10px; font-size: 11px; font-weight: 800; text-transform: capitalize; }
.status-badge.running, .status-badge.queued, .status-badge.canceling { color: var(--blue); background: var(--blue-bg); }
.status-badge.succeeded { color: var(--forest); background: var(--mint); }
.status-badge.needs_input { color: var(--amber); background: var(--amber-bg); }
.status-badge.failed, .status-badge.canceled { color: var(--red); background: var(--red-bg); }

.result-card { margin: 28px 0; padding: 24px; border: 1px solid #bfd6c4; border-radius: var(--radius); background: linear-gradient(135deg, #f5fbf5, #edf6ef); box-shadow: var(--shadow); }
.result-card .eyebrow { margin-bottom: 7px; }
.live-url { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.live-url a { overflow: hidden; color: var(--forest); font-family: Georgia, "Times New Roman", serif; font-size: clamp(20px, 3vw, 29px); text-overflow: ellipsis; white-space: nowrap; }
.result-meta { display: flex; gap: 22px; margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(24, 79, 60, 0.13); color: var(--muted); font-size: 11px; }
.result-meta code { color: var(--ink); }

.question-card { margin: 28px 0; padding: 22px; border: 1px solid #eed29c; border-radius: var(--radius); background: var(--amber-bg); }
.question-card h2 { margin: 0 0 7px; font-size: 18px; }
.question-card p { margin: 0 0 16px; color: #75511d; }
.answer-row { display: flex; gap: 10px; }
.answer-row input { background: rgba(255,255,255,0.75); }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(220px, .6fr); gap: 28px; margin-top: 32px; }
.panel { min-width: 0; }
.panel h2 { margin: 0 0 16px; font-size: 14px; letter-spacing: -0.01em; }
.timeline { display: grid; }
.timeline-item { position: relative; display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 12px; padding-bottom: 20px; }
.timeline-item::before { content: ""; position: absolute; left: 4px; top: 12px; bottom: -2px; width: 1px; background: var(--line); }
.timeline-item:last-child::before { display: none; }
.timeline-node { position: relative; z-index: 1; width: 9px; height: 9px; margin-top: 5px; border: 2px solid var(--paper); border-radius: 50%; background: var(--forest); box-shadow: 0 0 0 1px var(--forest); }
.timeline-message { color: var(--ink); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.timeline-time { margin-top: 3px; color: var(--faint); font-size: 10px; }
.fact-list { display: grid; gap: 1px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--line); }
.fact { padding: 11px 12px; background: var(--surface); }
.fact span { display: block; color: var(--faint); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.fact strong, .fact code { display: block; margin-top: 3px; overflow-wrap: anywhere; font-size: 11px; }
.check-list { display: grid; gap: 8px; margin-top: 22px; }
.check { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; color: var(--muted); font-size: 11px; }
.check-mark { color: var(--forest); font-weight: 900; }
.check.failed .check-mark { color: var(--red); }
.detail-actions { margin-top: 28px; justify-content: flex-start; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { order: 2; border-top: 1px solid var(--line); border-right: 0; }
  .workspace { order: 1; }
  .job-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view { padding-top: 44px; }
}

@media (max-width: 580px) {
  .topbar { height: 60px; padding: 0 16px; }
  .connection > span:last-child { display: none; }
  .layout { min-height: calc(100vh - 60px); }
  .workspace-nav { height: 50px; padding: 0 20px; }
  .view { padding: 38px 20px 54px; }
  .intro { margin-bottom: 36px; }
  .intro h1 { font-size: 40px; }
  .form-section { grid-template-columns: 34px minmax(0, 1fr); }
  .section-title { display: grid; }
  .segmented { width: max-content; }
  .field-grid, .detail-grid { grid-template-columns: 1fr; }
  .submit-row { padding-left: 34px; align-items: stretch; flex-direction: column; }
  .button-primary { width: 100%; }
  .form-error { margin-left: 34px; }
  .answer-row, .live-url { align-items: stretch; flex-direction: column; }
  .job-list { grid-template-columns: 1fr; }
}

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