:root {
  color-scheme: light;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto,
    "Helvetica Neue", sans-serif;
  --font-mono: "JetBrains Mono", Monaco, Consolas, "Lucida Console", monospace;
  --shopify-green: #95bf47;
  --shopify-green-deep: #008060;
  --shopify-green-ink: #004c3f;
  --control-height: 32px;
  --control-height-small: 24px;
  --topbar-height: 56px;
  --statusbar-height: 38px;
  --radius-small: 5px;
  --radius-medium: 8px;
  --bg: #f6f6f3;
  --panel: #ffffff;
  --panel-alt: #f0f1ee;
  --surface-subtle: #fafaf8;
  --border: #d8d9d4;
  --border-strong: #b4bbb2;
  --text: #202522;
  --muted: #667067;
  --accent: var(--shopify-green-deep);
  --accent-strong: var(--shopify-green-ink);
  --accent-soft: #e4f1e8;
  --code-bg: #eef5ef;
  --code-text: #174b3d;
  --success: var(--shopify-green-deep);
  --success-soft: #e4f1e8;
  --danger: #b42318;
  --shadow: 0 14px 34px rgba(32, 37, 34, 0.1);
  --brand-logo-filter: none;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1310;
  --panel: #151b16;
  --panel-alt: #1d251f;
  --surface-subtle: #111713;
  --border: #3a4438;
  --border-strong: #66725f;
  --text: #eef2eb;
  --muted: #b8c3b5;
  --accent: var(--shopify-green);
  --accent-strong: #d0e9a2;
  --accent-soft: #1f3326;
  --code-bg: #1e3025;
  --code-text: #c7e99b;
  --success: var(--shopify-green);
  --success-soft: #1f3326;
  --danger: #ff8a7a;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.32);
  --brand-logo-filter: invert(1) brightness(1.25);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
summary,
input,
select {
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

code {
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--code-bg);
  color: var(--code-text);
  font-family: var(--font-mono);
  font-size: 12px;
}

.icon {
  display: inline-block;
  flex: 0 0 auto;
  pointer-events: none;
  vertical-align: middle;
}

.control {
  display: inline-flex;
  width: 100%;
  height: var(--control-height);
  min-height: var(--control-height);
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-small);
  background: var(--surface-subtle);
  color: var(--text);
}

.control:focus,
.control:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
  outline: none;
}

.control--icon {
  width: var(--control-height);
  min-width: var(--control-height);
  justify-content: center;
  padding: 0;
}

.control--sm {
  width: var(--control-height-small);
  min-width: var(--control-height-small);
  height: var(--control-height-small);
  min-height: var(--control-height-small);
}

.control--sm .icon {
  width: 13px;
  height: 13px;
}

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  grid-template-columns: minmax(250px, auto) minmax(360px, 640px);
  min-height: var(--topbar-height);
  gap: 18px;
  align-items: center;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  display: block;
  width: 22px;
  height: 25px;
}

.topbar h1 {
  margin: 0;
  overflow: hidden;
  font-size: 16px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-tools {
  display: grid;
  grid-template-columns: minmax(220px, 320px) auto auto;
  gap: 8px;
  align-items: center;
  justify-content: end;
}

.search {
  position: relative;
}

.search::before {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 13px;
  width: 9px;
  height: 9px;
  border: 1.4px solid var(--muted);
  border-radius: 50%;
  content: "";
  pointer-events: none;
  transform: translateY(-60%);
}

.search::after {
  position: absolute;
  z-index: 1;
  top: 19px;
  left: 20px;
  width: 5px;
  height: 1.4px;
  border-radius: 999px;
  background: var(--muted);
  content: "";
  pointer-events: none;
  transform: rotate(45deg);
  transform-origin: left center;
}

.search-input {
  padding: 5px 80px 5px 32px;
}

.search-shortcuts {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.search.is-loading .search-shortcuts {
  opacity: 0;
}

.search.is-loading .search-input {
  padding-right: 44px;
}

.search.is-loading::after {
  top: 50%;
  right: 14px;
  left: auto;
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  background: transparent;
  animation: spin 700ms linear infinite;
  transform: translateY(-50%);
}

.search-shortcuts kbd {
  min-width: 18px;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel-alt);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 10px;
  line-height: 1.4;
  text-align: center;
}

.select-wrap {
  position: relative;
  display: inline-flex;
}

.select-wrap::after {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 5px;
  height: 5px;
  border-right: 1.3px solid var(--muted);
  border-bottom: 1.3px solid var(--muted);
  content: "";
  pointer-events: none;
  transform: translateY(-65%) rotate(45deg);
}

.language-select {
  width: 168px;
  min-width: 112px;
  appearance: none;
  padding: 5px 32px 5px 10px;
}

.search-results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  max-height: min(520px, calc(100vh - 150px));
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  background: var(--panel);
  box-shadow: var(--shadow);
  animation: pop-in 120ms ease;
}

.search-result {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.search-result:hover,
.search-result:focus,
.search-result.active {
  background: var(--accent-soft);
  outline: none;
}

.result-label {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  font-weight: 650;
}

.result-type {
  align-self: start;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef1f5;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.result-type--category {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.result-type--attribute {
  background: var(--success-soft);
  color: var(--accent-strong);
}

.result-type--returnReason {
  background: var(--panel-alt);
  color: var(--muted);
}

.result-subtitle {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result:hover .result-subtitle,
.search-result:focus .result-subtitle,
.search-result.active .result-subtitle {
  color: var(--text);
}

.search-empty {
  padding: 12px;
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(420px, 1.25fr) minmax(360px, 0.75fr);
  height: calc(100vh - var(--topbar-height) - var(--statusbar-height));
  min-height: 0;
}

.browser-pane,
.detail-pane {
  min-width: 0;
  min-height: 0;
  background: var(--panel);
}

.browser-pane {
  border-right: 1px solid var(--border);
}

.pane-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-alt);
}

.pane-header h2 {
  margin: 0;
  font-size: 15px;
}

.subtle {
  color: var(--muted);
  font-size: 12px;
}

.column-browser {
  display: grid;
  grid-auto-columns: minmax(220px, 280px);
  grid-auto-flow: column;
  height: calc(100vh - var(--topbar-height) - var(--statusbar-height) - 46px);
  overflow: auto;
}

.category-column {
  min-width: 0;
  overflow: auto;
  border-right: 1px solid var(--border);
}

.category-column h3 {
  position: sticky;
  z-index: 1;
  top: 0;
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.category-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  align-items: center;
  padding: 7px 10px 7px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.category-option:hover,
.category-option:focus {
  background: var(--accent-soft);
  outline: none;
}

.category-option:focus-visible {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent);
}

.category-option:hover {
  transform: translateX(1px);
}

.category-option.selected {
  background: var(--accent);
  color: var(--panel);
}

.chevron {
  display: inline-flex;
  align-items: center;
  color: currentColor;
  opacity: 0.8;
}

.detail-content {
  height: calc(100vh - var(--topbar-height) - var(--statusbar-height) - 46px);
  overflow: auto;
  padding: 16px;
}

.detail-section {
  padding: 0 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.detail-section h3 {
  margin: 0;
  font-size: 14px;
}

.detail-section h4 {
  margin: 8px 0;
  font-size: 14px;
}

.breadcrumb {
  margin: 0 0 12px;
  color: var(--muted);
}

.copyable-text {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  margin-bottom: 10px;
}

.copyable-text .breadcrumb {
  margin-bottom: 0;
}

.copyable-text .copy-button {
  margin-top: 1px;
}

.id-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.id-row code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-button:hover,
.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.copy-button:active,
.icon-button:active {
  transform: translateY(1px);
}

.copy-button .icon:last-child {
  display: none;
}

.copy-button.copied {
  border-color: var(--accent);
  background: var(--success-soft);
  color: var(--success);
}

.copy-button.copied .icon:first-child,
.copy-button.copied .copy-label {
  display: none;
}

.copy-button.copied .icon:last-child {
  display: inline-block;
}

.copy-button .copy-label {
  display: none;
}

.copy-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.reference-detail {
  padding: 0;
  border-top: 1px solid var(--border);
}

.reference-detail summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 7px 0;
  cursor: pointer;
  list-style: none;
}

.reference-detail summary::-webkit-details-marker {
  display: none;
}

.reference-detail summary:hover {
  color: var(--accent);
}

.summary-title {
  min-width: 0;
}

.summary-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.summary-meta .icon {
  color: var(--muted);
  transition: transform 160ms ease;
}

.reference-detail[open] .summary-meta .icon {
  transform: rotate(45deg);
}

.accordion-body {
  padding: 0 0 12px;
  animation: accordion-in 140ms ease;
}

.reference-detail p,
.reason-row p {
  margin: 8px 0 0;
  color: var(--muted);
}

.value-preview {
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

.value-toggle {
  padding: 0;
  border: 0;
  margin-top: 6px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
}

.value-toggle:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.reason-row {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.reason-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.focus-section {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-medium);
  padding: 12px;
  background: var(--accent-soft);
}

.empty {
  color: var(--muted);
}

.load-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--danger);
}

.load-error p {
  margin: 0;
}

.load-error-retry {
  width: auto;
  flex: 0 0 auto;
  padding-inline: 10px;
}

.search-results > .load-error {
  padding: 12px;
}

.pill {
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
}

.statusbar {
  position: sticky;
  z-index: 35;
  bottom: 0;
  display: flex;
  min-height: var(--statusbar-height);
  align-items: center;
  gap: 10px;
  padding: 4px 12px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
}

.statusbar-main {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  gap: 10px;
}

.statusbar-debug {
  display: flex;
  min-width: 0;
  flex: 0 1 auto;
  align-items: center;
  gap: 8px;
}

#footer-version,
#footer-meta,
#perf-status {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.footer-chip,
#footer-version > .footer-popover > summary,
#ready-status,
#load-status {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#footer-meta {
  flex: 1 1 auto;
  color: var(--muted);
}

.footer-link,
.footer-popover summary,
.footer-popover-body a {
  color: inherit;
  text-decoration: none;
}

.footer-link:hover,
.footer-popover summary:hover,
.footer-popover-body a:hover {
  color: var(--text);
}

#perf-status {
  flex: 0 1 auto;
  justify-content: flex-end;
}

.debug-panel,
.footer-popover {
  flex: 0 0 auto;
  position: relative;
}

.footer-popover summary {
  cursor: pointer;
  list-style: none;
}

.footer-popover summary::-webkit-details-marker {
  display: none;
}

.footer-popover-body {
  position: absolute;
  bottom: calc(100% + 16px);
  left: 0;
  width: min(300px, calc(100vw - 24px));
  overflow: visible;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--muted);
  overflow-wrap: anywhere;
  white-space: normal;
}

.about-panel .footer-popover-body {
  position: fixed;
  bottom: calc(var(--statusbar-height) + 16px);
  left: 12px;
}

.about-panel[open] .footer-popover-body {
  box-shadow: 0 22px 58px 16px rgba(32, 37, 34, 0.16);
}

:root[data-theme="dark"] .about-panel[open] .footer-popover-body {
  box-shadow: 0 22px 58px 16px rgba(0, 0, 0, 0.46);
}

.footer-popover-body strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.footer-popover-body p {
  margin: 6px 0 0;
}

.about-source,
.about-credit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.about-credit {
  justify-content: flex-start;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.inline-logo-link {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  overflow-wrap: anywhere;
}

.about-logo {
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
}

.about-logo-shopify {
  width: 15px;
  height: 13px;
}

.about-logo-company {
  width: 20px;
  height: 12px;
  filter: var(--brand-logo-filter);
  opacity: 0.82;
}

.debug-panel summary {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-subtle);
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}

.debug-panel summary::-webkit-details-marker {
  display: none;
}

.statusbar .footer-popover[open] > summary,
.statusbar .debug-panel[open] > summary {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px rgba(0, 128, 96, 0.22);
  color: var(--accent-strong);
}

.status-history {
  position: fixed;
  bottom: calc(var(--statusbar-height) + 16px);
  right: 12px;
  width: min(320px, calc(100vw - 24px));
  max-height: 280px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  margin: 0;
  background: var(--panel);
  box-shadow: var(--shadow);
  list-style: none;
}

.debug-panel[open] .status-history {
  box-shadow: 0 22px 58px 16px rgba(32, 37, 34, 0.16);
}

:root[data-theme="dark"] .debug-panel[open] .status-history {
  box-shadow: 0 22px 58px 16px rgba(0, 0, 0, 0.46);
}

.status-history li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding: 5px 6px;
  border-radius: var(--radius-small);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
}

.status-history time {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  opacity: 0.82;
  word-spacing: -2px;
}

#ready-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  transition: color 140ms ease;
}

#load-status {
  display: inline-block;
  color: var(--muted);
  transition: color 140ms ease;
}

#ready-status::before {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--danger);
  content: "";
}

#ready-status[data-tone="success"] {
  color: var(--muted);
}

#ready-status[data-tone="success"]::before {
  background: var(--success);
}

#ready-status[data-tone="error"] {
  color: var(--danger);
}

.latest-log {
  animation: latest-log-highlight 1100ms ease-out;
}

@keyframes pop-in {
  from {
    transform: translateY(-3px);
  }

  to {
    transform: translateY(0);
  }
}

@keyframes accordion-in {
  from {
    transform: translateY(-2px);
  }

  to {
    transform: translateY(0);
  }
}

@keyframes latest-log-highlight {
  0% {
    background: var(--accent-soft);
    color: var(--accent-strong);
  }

  100% {
    background: transparent;
    color: inherit;
  }
}

@keyframes spin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

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

@media (max-width: 900px) {
  .topbar,
  .workspace {
    grid-template-columns: 1fr;
  }

  .topbar-tools {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .language-select {
    width: 124px;
    min-width: 96px;
  }

  .search-results {
    position: fixed;
    top: 96px;
    right: 12px;
    left: 12px;
    max-height: min(420px, calc(100vh - 116px));
  }

  .workspace {
    height: auto;
    overflow-x: hidden;
  }

  .browser-pane {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .detail-pane {
    min-height: 50svh;
  }

  .browser-pane,
  .detail-pane,
  .column-browser {
    max-width: 100%;
  }

  .column-browser,
  .detail-content {
    max-height: none;
  }

  .column-browser {
    grid-auto-columns: minmax(190px, 72vw);
    height: clamp(300px, 38vh, 360px);
    min-height: 0;
    overscroll-behavior: contain;
  }

  .detail-content {
    height: auto;
  }

  .statusbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    padding: 8px 16px;
  }

  .statusbar-main {
    width: 100%;
    flex-wrap: wrap;
  }

  .statusbar-debug {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  #perf-status {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

}

@media (max-width: 560px) {
  .search-input {
    padding-right: 36px;
  }

  .search-shortcuts kbd:last-child {
    display: none;
  }
}

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