:root {
  color-scheme: dark;
  --bg: #090d11;
  --panel: rgba(15, 22, 27, 0.94);
  --panel-strong: #121b21;
  --ink: #eef5f2;
  --muted: #98aaa6;
  --line: #26363b;
  --line-strong: #34525a;
  --accent: #72d0ad;
  --accent-strong: #b7f1d5;
  --button: #2aa06f;
  --button-hover: #39b981;
  --field: #0b1217;
  --field-focus: rgba(114, 208, 173, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(114, 208, 173, 0.13), transparent 30rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%) 0 0 / 24px 24px,
    linear-gradient(225deg, rgba(255, 255, 255, 0.025) 25%, transparent 25%) 0 0 / 24px 24px,
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1280px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0;
}

.panel {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(16px, 3vw, 28px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
}

.top-nav {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  font-size: 0.9rem;
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  margin-bottom: 16px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-link,
.secondary-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 0 14px;
}

.primary-link {
  background: var(--button);
  color: #04100c;
}

.secondary-link {
  border: 1px solid var(--line-strong);
  color: var(--accent-strong);
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 4.1rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  font-size: 1.05rem;
}

.lede {
  max-width: 720px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.45;
}

.hero-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 18px 0 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  overflow: hidden;
}

.hero-strip div {
  display: grid;
  gap: 5px;
  min-height: 90px;
  padding: 16px;
  background: rgba(11, 18, 23, 0.88);
}

.hero-strip strong {
  color: var(--ink);
}

.hero-strip span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.section-head {
  display: grid;
  gap: 8px;
  margin: 34px 0 14px;
}

.section-head h2 {
  font-size: clamp(1.25rem, 2vw, 1.8rem);
}

.section-head p:not(.eyebrow) {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.5;
}

.workbench {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.product-grid,
.pager-grid,
.contact-panel,
.contract-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.pager-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.product-card,
.pager-card,
.contact-panel > div,
.contract-grid > article {
  display: grid;
  gap: 10px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 27, 33, 0.82);
  padding: 16px;
}

.product-card.commercial {
  border-color: rgba(114, 208, 173, 0.48);
  background: rgba(32, 55, 49, 0.46);
}

.product-card span,
.pager-card span,
.contact-panel span,
.contract-grid span {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.product-card h3,
.pager-card h3,
.contact-panel h3,
.contract-grid h3 {
  margin: 0;
  font-size: 1.2rem;
}

.product-card p,
.pager-card p,
.contact-panel p {
  color: var(--muted);
  line-height: 1.45;
}

.contract-grid ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.contract-grid code,
.section-head code {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--field);
  color: var(--accent-strong);
  padding: 1px 5px;
  font: 0.86em/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.paid-status,
.search-profile,
.palmer-panel,
.paid-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.paid-status,
.search-profile,
.palmer-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 27, 33, 0.82);
  padding: 16px;
}

.paid-status > strong {
  color: var(--accent-strong);
  font-size: 1.05rem;
}

.paid-status p {
  color: var(--muted);
  line-height: 1.45;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.account-grid div {
  display: grid;
  gap: 6px;
  min-width: 0;
  background: rgba(9, 14, 18, 0.72);
  padding: 12px;
}

.account-grid span {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.account-grid strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 1rem;
}

.billing-load {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.35fr);
  gap: 12px;
  align-items: end;
}

.billing-load > div {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 14, 18, 0.56);
  padding: 12px;
}

.billing-load span,
.billing-load small {
  color: var(--muted);
  font-size: 0.84rem;
}

.billing-load strong {
  color: var(--accent-strong);
  font-size: 1.15rem;
}

.section-head.compact {
  margin: 0;
}

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

.palmer-scale span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 14, 18, 0.56);
  color: var(--muted);
  padding: 10px;
  font-size: 0.84rem;
  line-height: 1.35;
}

.search-profile {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.search-profile div {
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
}

.search-profile span,
.file-field span {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.search-profile strong {
  color: var(--ink);
  font-size: 1rem;
}

.search-profile small,
.file-field {
  color: var(--muted);
  line-height: 1.35;
}

.file-field {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 14, 18, 0.56);
  padding: 12px;
}

.file-field input {
  max-width: 100%;
  color: var(--muted);
}

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

.metrics-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: rgba(11, 18, 23, 0.86);
}

.metrics-table th,
.metrics-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.metrics-table th {
  color: var(--accent-strong);
  font-size: 0.86rem;
  text-transform: uppercase;
}

.metrics-table tr:last-child td {
  border-bottom: 0;
}

.site-footer {
  display: grid;
  gap: 8px;
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.status-panel {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 14, 18, 0.74);
  padding: 14px;
}

.status-title {
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.stepper {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.stepper li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px;
  color: var(--muted);
}

.stepper li > span {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 900;
}

.stepper strong {
  display: block;
  color: var(--ink);
  font-size: 0.9rem;
}

.stepper small {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
}

.stepper li.is-active {
  border-color: var(--line-strong);
  background: rgba(114, 208, 173, 0.08);
}

.stepper li.is-active > span {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.stepper li.is-done > span {
  border-color: var(--button-hover);
  background: rgba(57, 185, 129, 0.16);
  color: var(--accent-strong);
}

.sample-card {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.sample-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 0.9rem;
}

.sample-card p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

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

.step {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 27, 33, 0.82);
  padding: 16px;
}

.step[data-step="1"],
.step[data-step="2"],
.step[data-step="3"],
.step[data-step="4"] {
  min-width: 0;
}

.step[data-step="1"],
.step[data-step="2"] {
  grid-column: span 1;
}

.step[data-step="3"],
.step[data-step="4"] {
  grid-column: span 1;
}

.step-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.step-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.step-number {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--accent-strong);
  background: #0c1519;
  font-weight: 900;
}

.source-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

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

.field span {
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 800;
}

.char-count {
  justify-self: end;
  color: var(--muted);
  font-size: 0.78rem;
}

.query-tools {
  display: grid;
  gap: 8px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 14, 18, 0.56);
  padding: 12px;
}

.is-hidden {
  display: none;
}

.live-card {
  display: grid;
  gap: 8px;
  align-content: start;
  border: 1px solid rgba(114, 208, 173, 0.36);
  border-radius: 8px;
  background: rgba(32, 55, 49, 0.38);
  padding: 12px;
}

.live-card > span {
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 900;
}

.live-card p,
.live-card small {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.query-tools > span {
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 800;
}

.query-tools div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.query-tools p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  padding: 12px;
  font: 0.88rem/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  outline: none;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  padding: 0 12px;
  font: inherit;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--field-focus);
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--field-focus);
}

textarea[readonly] {
  color: #d4ebe4;
}

.field-actions,
.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-slot {
  min-height: 0;
}

.actions {
  margin-bottom: 2px;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--button);
  color: #04100c;
  padding: 0 18px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

button:hover {
  background: var(--button-hover);
}

.secondary-button {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  background: #0c1519;
  color: var(--accent-strong);
}

.chip-button {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  background: #0c1519;
  color: var(--accent-strong);
  padding: 0 12px;
  font-size: 0.86rem;
}

.secondary-button:hover,
.chip-button:hover {
  background: #102027;
}

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

a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

#output {
  min-height: 278px;
}

#decode-output {
  min-height: 278px;
  color: var(--accent-strong);
}

.result-step {
  border-color: rgba(114, 208, 173, 0.36);
}

@media (max-width: 980px) {
  .masthead,
  .workbench,
  .core-form,
  .hero-strip,
  .product-grid,
  .pager-grid,
  .contact-panel,
  .contract-grid,
  .account-grid,
  .billing-load,
  .palmer-scale,
  .search-profile {
    grid-template-columns: 1fr;
  }

  .status-panel {
    position: static;
  }

  .hero-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1120px);
    padding: 10px 0;
  }

  .panel {
    padding: 18px;
  }

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

  .field-actions,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  button {
    width: 100%;
  }
}
