:root {
  --ink: #18181b;
  --muted: #71717a;
  --line: #e4e4e7;
  --paper: #ffffff;
  --soft: #f4f4f5;
  --softer: #fafafa;
  --yellow: #ffe14d;
  --yellow-strong: #ffd400;
  --green: #23744f;
  --blue: #315f9f;
  --red: #a33a33;
  --ring: rgba(24, 24, 27, 0.1);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-sans-serif, "Aptos", "Segoe UI", sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 750;
}

.brand-logo {
  display: block;
  width: 170px;
  height: auto;
}

.separator {
  width: 1px;
  height: 24px;
  background: var(--line);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
}

.status-pill.ready {
  color: var(--green);
}

.status-pill.busy {
  color: var(--blue);
}

.app-shell {
  display: flex;
  justify-content: center;
  min-height: calc(100dvh - 56px);
  padding: 10vh 20px 56px;
}

.wizard-stage {
  display: grid;
  width: min(100%, 620px);
  align-content: start;
  justify-items: center;
  gap: 20px;
}

.hero-copy {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.app-logo-card {
  display: grid;
  width: 174px;
  height: 46px;
  place-items: center;
  background: var(--ink);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.app-logo-card img {
  display: block;
  width: 132px;
  height: auto;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 900;
  line-height: 1.08;
}

.hero-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.setup-card {
  display: grid;
  width: min(100%, 560px);
  gap: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.form-section {
  display: grid;
  gap: 14px;
  padding: 18px 20px;
  border-top: 1px solid var(--line);
}

.form-section:first-child {
  border-top: 0;
}

.section-title {
  display: grid;
  gap: 4px;
}

.section-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.section-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field span,
.message-input > span,
.status-card-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field input[type="text"] {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  font-size: 14px;
}

.field input[type="text"]:focus,
.message-input textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--ring);
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  padding: 3px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.choice-pill {
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 800;
}

.choice-pill:hover {
  color: var(--ink);
}

.choice-pill.active {
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow);
}

.upload-dropzone {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  min-height: 74px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.upload-dropzone:hover,
.upload-dropzone.dragging,
.upload-dropzone.selected {
  border-color: var(--ink);
  background: var(--softer);
}

.upload-dropzone input {
  display: none;
}

.upload-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #fff;
  background: var(--ink);
  border-radius: 999px;
  font-size: 20px;
  font-weight: 850;
  line-height: 1;
}

.upload-dropzone strong,
.upload-dropzone small {
  display: block;
}

.upload-dropzone strong {
  font-size: 14px;
  font-weight: 800;
}

.upload-dropzone small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.message-input {
  display: grid;
  gap: 8px;
}

.message-input textarea {
  display: block;
  width: 100%;
  min-height: 76px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  resize: vertical;
  font-size: 14px;
  line-height: 1.45;
}

.message-input textarea::placeholder {
  color: #a1a1aa;
  font-weight: 500;
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  background: var(--softer);
  border-top: 1px solid var(--line);
}

.icon-button,
.send-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 999px;
  font-size: 22px;
  font-weight: 850;
  line-height: 1;
}

.icon-button {
  color: #777;
  background: #f1f1ef;
}

.icon-button:hover,
.icon-button.selected {
  color: var(--ink);
  background: var(--yellow);
}

.send-button {
  margin-left: auto;
  color: #9a9a96;
  background: #e4e4e7;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.send-button.ready,
.send-button:hover:not(:disabled) {
  color: #fff;
  background: var(--ink);
}

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

.send-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.check-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  transition: border-color 160ms ease, background 160ms ease;
}

.check-chip input {
  display: grid;
  width: 16px;
  height: 16px;
  margin: 0;
  place-items: center;
  appearance: none;
  background: #fff;
  border: 1px solid #a1a1aa;
  border-radius: 4px;
}

.check-chip input::before {
  width: 8px;
  height: 5px;
  border-bottom: 2px solid #fff;
  border-left: 2px solid #fff;
  content: "";
  transform: rotate(-45deg) scale(0);
  transform-origin: center;
  transition: transform 120ms ease;
}

.check-chip input:checked {
  background: var(--ink);
  border-color: var(--ink);
}

.check-chip input:checked::before {
  transform: rotate(-45deg) scale(1);
}

.check-chip:has(input:focus-visible),
.choice-pill:focus-visible,
.send-button:focus-visible,
.upload-dropzone:has(input:focus-visible) {
  outline: 0;
  box-shadow: 0 0 0 3px var(--ring);
}

.status-card {
  display: grid;
  width: min(100%, 560px);
  gap: 12px;
  margin-top: 4px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.status-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.status-card-header div:first-child {
  display: grid;
  gap: 4px;
}

.status-card-header strong {
  font-size: 15px;
  line-height: 1.18;
}

.metric-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.metric-row span {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.metric-row b {
  color: var(--ink);
}

.progress-stack {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.step {
  position: relative;
  min-height: 38px;
  padding: 12px 14px 12px 38px;
  background: #fff;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.step:first-child {
  border-top: 0;
}

.step::before {
  position: absolute;
  top: 13px;
  left: 14px;
  width: 14px;
  height: 14px;
  border: 2px solid #c8c8c2;
  border-radius: 999px;
  content: "";
}

.step.done {
  color: var(--green);
}

.step.done::before {
  background: var(--green);
  border-color: var(--green);
  box-shadow: inset 0 0 0 3px #fff;
}

.step.active {
  color: var(--ink);
  background: var(--softer);
}

.step.active::before {
  border-color: var(--yellow-strong);
  background: var(--yellow);
}

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

.result-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 750;
}

.result-links a:not(.disabled)::after {
  margin-left: 6px;
  content: "›";
}

.result-links a.disabled {
  color: #a0a09b;
  pointer-events: none;
}

.warnings {
  color: var(--muted);
  font-size: 13px;
}

.warnings summary {
  cursor: pointer;
  font-weight: 900;
}

.warnings ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.messages {
  display: grid;
  width: min(100%, 560px);
  gap: 10px;
  max-height: 220px;
  overflow: auto;
}

.message {
  padding: 10px 12px;
  background: var(--softer);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.message span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.message p {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

.message.user {
  background: #fffdf2;
  border-color: #f0dc74;
}

.message.error {
  border-color: rgba(163, 58, 51, 0.35);
}

@media (max-width: 760px) {
  .app-header {
    padding: 0 14px;
  }

  .brand-lockup {
    gap: 8px;
    font-size: 14px;
  }

  .brand-logo {
    width: 148px;
  }

  .app-shell {
    padding: 56px 14px 36px;
  }

  .setup-card,
  .status-card,
  .messages {
    width: 100%;
  }

  .field-grid,
  .segmented-control,
  .result-links {
    grid-template-columns: 1fr;
  }

  .status-card-header {
    display: grid;
  }

  .metric-row {
    justify-content: start;
  }
}
