:root {
  --ink: #162129;
  --muted: #68767a;
  --line: #d9e0dc;
  --paper: #f7f8f4;
  --panel: #ffffff;
  --accent: #e8663d;
  --accent-dark: #b94727;
  --teal: #197d76;
  --green: #237957;
  --red: #b94c45;
  --shadow: 0 18px 50px rgba(22, 33, 41, .08);
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); }
body { margin: 0; min-width: 320px; font-family: "Avenir Next", Avenir, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid rgba(25, 125, 118, .35); outline-offset: 3px; }

.shell { width: min(1100px, calc(100% - 40px)); margin: 0 auto; }
.topbar { height: 84px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 750; letter-spacing: -.02em; }
.brand-mark { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 9px; background: var(--ink); color: #fff; font-size: 19px; line-height: 1; }
.service-state { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.state-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(35, 121, 87, .12); }

.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, .9fr); gap: clamp(48px, 9vw, 120px); align-items: end; padding: 88px 0 76px; }
.hero-label, .eyebrow { margin: 0 0 15px; color: var(--teal); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { max-width: 620px; margin-bottom: 22px; font-size: clamp(42px, 6vw, 72px); line-height: .98; letter-spacing: -.065em; font-weight: 780; }
h1 em { color: var(--accent); font-style: normal; }
.hero-description { max-width: 510px; margin-bottom: 0; color: var(--muted); font-size: 16px; line-height: 1.65; }
.search-form { padding: 25px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); }
.search-form label { display: block; margin-bottom: 10px; font-size: 13px; font-weight: 750; }
.input-row { display: flex; gap: 9px; }
.input-row input { min-width: 0; flex: 1; height: 48px; padding: 0 14px; border: 1px solid #cbd4d0; border-radius: 9px; color: var(--ink); background: #fbfcfa; font-size: 13px; }
.input-row input::placeholder { color: #9aa7a5; }
.input-row input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(25, 125, 118, .1); outline: none; }
.input-row button { display: inline-flex; align-items: center; gap: 12px; flex: 0 0 auto; height: 48px; padding: 0 15px 0 17px; border: 0; border-radius: 9px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 750; transition: background .18s ease, transform .18s ease; }
.input-row button:hover { background: var(--accent-dark); transform: translateY(-1px); }
.input-row button[disabled] { cursor: wait; opacity: .65; transform: none; }
.button-arrow { font-size: 18px; }
.form-hint { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.form-error { margin: 12px 0 0; color: var(--red); font-size: 12px; line-height: 1.45; }

.run-panel, .results-panel { margin-bottom: 28px; padding: clamp(24px, 4vw, 38px); border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
h2 { margin-bottom: 0; font-size: clamp(24px, 3vw, 33px); line-height: 1.05; letter-spacing: -.045em; }
.run-badge, .overall-badge { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 99px; background: #edf1ef; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.run-badge.running { background: #fff0e8; color: var(--accent-dark); }
.run-badge.done { background: #e6f2ec; color: var(--green); }
.run-badge.failed { background: #fbe9e7; color: var(--red); }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 31px; }
.step { color: #9aa7a5; font-size: 11px; font-weight: 700; }
.step::before { display: block; width: 9px; height: 9px; margin-bottom: 9px; border: 2px solid #cbd4d0; border-radius: 50%; content: ""; }
.step.active { color: var(--ink); }
.step.active::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px rgba(232, 102, 61, .14); }
.step.done { color: var(--green); }
.step.done::before { border-color: var(--green); background: var(--green); }
.activity-wrap { border-top: 1px solid var(--line); padding-top: 21px; }
.activity-heading { display: flex; justify-content: space-between; margin-bottom: 10px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.event-count { font-variant-numeric: tabular-nums; }
.latest-activity { min-height: 24px; color: var(--ink); font-size: 14px; font-weight: 650; }
.logs { margin-top: 18px; }
.logs summary { width: fit-content; color: var(--teal); cursor: pointer; font-size: 12px; font-weight: 750; }
.logs ol { max-height: 270px; margin: 14px 0 0; padding: 0 0 0 24px; overflow: auto; border-top: 1px solid var(--line); }
.logs li { padding: 10px 0 10px 4px; border-bottom: 1px solid #edf0ed; color: var(--muted); font-size: 12px; line-height: 1.45; }
.logs li time { display: inline-block; width: 52px; color: #9aa7a5; font-variant-numeric: tabular-nums; }

.results-heading { margin-bottom: 22px; }
.overall-badge.in-stock { background: #e6f2ec; color: var(--green); }
.overall-badge.out-of-stock { background: #fff0e8; color: var(--accent-dark); }
.overall-badge.not-found, .overall-badge.could-not-verify, .overall-badge.error { background: #fbe9e7; color: var(--red); }
.source-summary { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-size: 13px; }
.source-summary strong { color: var(--ink); }
.marketplace-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.marketplace-card { display: flex; min-height: 175px; flex-direction: column; justify-content: space-between; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfa; }
.marketplace-card header { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.marketplace-name { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.result-status { color: var(--muted); font-size: 13px; line-height: 1.5; }
.result-status strong { display: block; margin-bottom: 5px; color: var(--ink); font-size: 18px; letter-spacing: -.03em; }
.result-status strong.in-stock { color: var(--green); }
.result-status strong.out-of-stock { color: var(--accent-dark); }
.result-status strong.not-found, .result-status strong.could-not-verify, .result-status strong.error { color: var(--red); }
.marketplace-card a { color: var(--teal); font-size: 12px; font-weight: 750; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.closest-match { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.45; }
.closest-match summary { color: var(--teal); cursor: pointer; font-weight: 750; }
.closest-match p { margin: 9px 0 0; }
.closest-match .closest-title { color: var(--ink); font-weight: 650; }
.closest-match a { display: inline-block; margin-top: 10px; }
.secondary-button { margin-top: 23px; padding: 11px 15px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--ink); font-size: 12px; font-weight: 750; }
.secondary-button:hover { border-color: var(--teal); color: var(--teal); }
.footer { display: flex; justify-content: space-between; padding: 20px 0 34px; color: #8b9794; font-size: 11px; }

@media (max-width: 760px) {
  .shell { width: min(100% - 28px, 560px); }
  .topbar { height: 70px; }
  .service-state { font-size: 10px; }
  .hero { display: block; padding: 56px 0 45px; }
  h1 { font-size: clamp(42px, 12vw, 62px); }
  .hero-description { margin-bottom: 31px; font-size: 15px; }
  .search-form { padding: 19px; }
  .input-row { display: block; }
  .input-row input, .input-row button { width: 100%; }
  .input-row button { justify-content: space-between; margin-top: 9px; }
  .steps { gap: 6px; }
  .step { font-size: 10px; }
  .marketplace-results { grid-template-columns: 1fr; }
  .footer { display: block; line-height: 1.8; }
  .footer span { display: block; }
}
