:root {
  color-scheme: light;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #18231e;
  background: #f4f6f4;
  --tl-bg: #f4f6f4;
  --tl-surface: #ffffff;
  --tl-surface-soft: #f0f4f1;
  --tl-text: #18231e;
  --tl-muted: #5b6b61;
  --tl-border: #d8e1db;
  --tl-border-strong: #b7c6bc;
  --tl-accent: #176047;
  --tl-accent-strong: #0d4936;
  --tl-accent-soft: #e0f1e9;
  --tl-warning: #8a5008;
  --tl-warning-soft: #fff3df;
  --tl-danger: #a02f35;
  --tl-danger-soft: #fbeaec;
  --tl-control-min: 44px;
  --tl-focus-ring: 3px solid #2b765f;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  overflow-x: hidden;
}

body {
  display: flex;
  min-width: 320px;
  min-height: 100vh;
  flex-direction: column;
  margin: 0;
  overflow-x: hidden;
  background: var(--tl-bg);
  color: var(--tl-text);
  font-size: 15px;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
input,
select,
a {
  min-height: var(--tl-control-min);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: var(--tl-focus-ring);
  outline-offset: 2px;
}

button {
  touch-action: manipulation;
}

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

.skip-link {
  position: fixed;
  z-index: 20;
  top: 8px;
  left: 8px;
  min-height: 0;
  padding: 10px 14px;
  border: 2px solid var(--tl-accent);
  border-radius: 8px;
  background: var(--tl-surface);
  color: var(--tl-accent-strong);
  font-weight: 750;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  display: flex;
  width: 100%;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px max(16px, calc((100vw - 1080px) / 2));
  border-bottom: 1px solid var(--tl-border);
  background: var(--tl-surface);
}

.brand,
.topbar-actions,
.selected-heading,
.outcome-heading,
.outcome-actions,
.pressure-row {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
}

.brand > span:last-child,
.brand strong,
.brand small {
  display: block;
}

.brand strong {
  line-height: 1.1;
}

.brand small {
  margin-top: 2px;
  color: var(--tl-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: var(--tl-accent);
  color: white;
  font-size: 15px;
  font-weight: 900;
}

.topbar-actions {
  justify-content: end;
  gap: 8px;
}

.network,
.technical-mode,
.status-pill,
.status-dot {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-weight: 750;
}

.network {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--tl-border);
  background: var(--tl-surface-soft);
  color: var(--tl-muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.language select,
input {
  width: 100%;
  min-height: var(--tl-control-min);
  border: 1px solid var(--tl-border-strong);
  border-radius: 10px;
  padding: 9px 11px;
  background: var(--tl-surface);
  color: var(--tl-text);
}

.language select {
  width: auto;
  min-width: 64px;
  border: 1px solid var(--tl-border);
  border-radius: 10px;
  padding: 8px 28px 8px 10px;
  background: var(--tl-surface);
  color: var(--tl-text);
  font-weight: 750;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border: 1px solid var(--tl-border);
  border-radius: 12px;
  background: var(--tl-surface);
  color: var(--tl-accent-strong);
  cursor: pointer;
  font-size: 18px;
  font-weight: 850;
}

.icon-button:disabled,
.primary-button:disabled,
.text-button:disabled {
  cursor: wait;
  opacity: 0.56;
}

main {
  width: min(1080px, calc(100% - 32px));
  flex: 1;
  margin: 0 auto;
  padding-bottom: 40px;
}

.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 2px 18px;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

h3 {
  margin: 0;
  font-size: 15px;
}

.intro p,
.selection-empty p,
.outcome-heading p,
.help-panel p {
  margin: 5px 0 0;
  color: var(--tl-muted);
}

.technical-mode {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--tl-border-strong);
  background: var(--tl-surface);
  color: var(--tl-muted);
  font-size: 12px;
}

.help-panel {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
  padding: 16px 18px;
  border: 1px solid var(--tl-border);
  border-left: 4px solid var(--tl-accent);
  border-radius: 12px;
  background: var(--tl-surface);
}

.state-message {
  min-height: 24px;
  margin: 0 2px 10px;
  color: var(--tl-muted);
  font-size: 13px;
}

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

body[data-state="TRANSPORT_ERROR"] .state-message,
body[data-state="ADDRESS_INVALID"] .state-message,
body[data-state="QUOTE_DENIED"] .state-message,
body[data-state="GRANT_DENIED"] .state-message {
  color: var(--tl-danger);
}

body[data-state="QUOTA_EXHAUSTED"] .state-message,
body[data-state="RESERVE_FLOOR"] .state-message,
body[data-state="QUOTE_EXPIRED"] .state-message {
  color: var(--tl-warning);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.84fr) minmax(0, 1.16fr);
  gap: 18px;
  align-items: start;
}

.workspace.single-panel {
  grid-template-columns: minmax(280px, 445px);
}

.catalog-panel,
.request-panel {
  min-width: 0;
  border: 1px solid var(--tl-border);
  border-radius: 18px;
  background: var(--tl-surface);
}

.catalog-panel {
  padding: 18px;
}

.request-panel {
  padding: 22px;
}

.panel-heading,
.selected-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading small {
  display: block;
  margin-top: 4px;
  color: var(--tl-muted);
  font-size: 12px;
}

.search-field {
  display: grid;
  gap: 6px;
  margin: 16px 0 10px;
  color: var(--tl-muted);
  font-size: 12px;
  font-weight: 750;
}

.asset-list {
  display: grid;
  max-height: 560px;
  gap: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.asset-option {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--tl-text);
  cursor: pointer;
  text-align: left;
}

.asset-option:hover,
.asset-option.selected {
  border-color: var(--tl-border-strong);
  background: var(--tl-surface-soft);
}

.asset-option.selected {
  border-left: 4px solid var(--tl-accent);
  padding-left: 7px;
}

.asset-option-copy,
.asset-option-copy strong,
.asset-option-copy small {
  display: block;
  min-width: 0;
}

.asset-option-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-option-copy small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--tl-muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot,
.status-pill {
  flex: 0 0 auto;
  font-size: 11px;
}

.status-dot {
  gap: 5px;
  color: var(--tl-muted);
}

.status-dot::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tl-border-strong);
  content: "";
}

.status-dot.available::before {
  background: var(--tl-accent);
}

.status-dot.unavailable::before {
  background: var(--tl-warning);
}

.empty-list,
.selection-empty {
  margin: 0;
  padding: 20px 6px;
  color: var(--tl-muted);
}

.selection-empty {
  min-height: 170px;
}

.selected-heading {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--tl-border);
}

.selected-heading h2 {
  margin-top: 7px;
}

.short-id {
  display: block;
  max-width: 100%;
  margin-top: 4px;
  overflow: hidden;
  color: var(--tl-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  min-height: 27px;
  padding: 4px 8px;
  background: var(--tl-surface-soft);
  color: var(--tl-muted);
}

.status-pill.available {
  background: var(--tl-accent-soft);
  color: var(--tl-accent-strong);
}

.status-pill.unavailable {
  background: var(--tl-warning-soft);
  color: var(--tl-warning);
}

.essential-facts,
.fact-list {
  margin: 0;
}

.essential-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 0;
}

.essential-facts > div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--tl-border);
  border-radius: 10px;
  background: var(--tl-surface-soft);
}

.essential-facts dt,
.fact-list dt {
  color: var(--tl-muted);
  font-size: 11px;
  font-weight: 750;
}

.essential-facts dd {
  margin: 3px 0 0;
  font-size: 16px;
  font-weight: 800;
}

.text-button,
.disclosure-button {
  min-height: 44px;
  padding: 8px 4px;
  border: 0;
  background: transparent;
  color: var(--tl-accent-strong);
  cursor: pointer;
  font-weight: 750;
  text-decoration: underline;
  text-decoration-color: var(--tl-border-strong);
  text-underline-offset: 3px;
}

.disclosure-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.disclosure-button::after {
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentcolor;
  border-bottom: 1.5px solid currentcolor;
  content: "";
  transform: rotate(45deg) translateY(-2px);
  text-decoration: none;
}

.disclosure-button[aria-expanded="true"]::after {
  transform: rotate(225deg) translate(-1px, -1px);
}

.disclosure-button.secondary {
  color: var(--tl-muted);
  font-size: 13px;
}

.detail-panel,
.protocol-panel {
  min-width: 0;
  margin-top: 8px;
  padding: 14px;
  border: 1px solid var(--tl-border);
  border-radius: 12px;
  background: var(--tl-surface-soft);
}

.protocol-panel {
  border-left: 4px solid var(--tl-border-strong);
  background: var(--tl-surface);
}

.detail-panel h3,
.protocol-panel h3 {
  margin-bottom: 10px;
}

.fact-list {
  display: grid;
  gap: 0;
}

.fact-list > div {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid var(--tl-border);
}

.fact-list > div:last-child {
  border-bottom: 0;
}

.fact-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.fact-list code,
.outcome-facts code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.supporting-fact {
  margin: 10px 0 0;
  color: var(--tl-muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--tl-border);
}

form label {
  display: grid;
  gap: 6px;
  color: var(--tl-muted);
  font-size: 12px;
  font-weight: 750;
}

input[aria-invalid="true"] {
  border-color: var(--tl-danger);
}

.field-error {
  margin: -6px 0 0;
  color: var(--tl-danger);
  font-size: 12px;
}

.primary-button {
  min-height: var(--tl-control-min);
  border: 1px solid var(--tl-accent);
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--tl-accent);
  color: white;
  cursor: pointer;
  font-weight: 800;
}

.primary-button.compact {
  width: fit-content;
}

.outcome-panel {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--tl-border);
  border-radius: 14px;
  background: var(--tl-surface-soft);
}

.outcome-panel.error {
  border-color: #d8a7aa;
  background: var(--tl-danger-soft);
}

.outcome-panel.success {
  border-color: #a7c9b9;
  background: var(--tl-accent-soft);
}

.outcome-heading {
  align-items: start;
  gap: 12px;
}

.outcome-heading h2 {
  font-size: 18px;
}

.outcome-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--tl-danger);
  color: white;
  font-weight: 900;
}

.outcome-icon.success {
  background: var(--tl-accent);
}

.outcome-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentcolor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.outcome-facts {
  margin-top: 12px;
  padding-bottom: 8px;
}

.outcome-actions {
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 10px;
}

.pressure-row {
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: var(--tl-muted);
  font-size: 12px;
}

progress {
  width: 100%;
  height: 8px;
  margin-top: 6px;
  accent-color: var(--tl-accent);
}

.inline-outcome {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--tl-border);
  border-radius: 12px;
}

.inline-outcome.error {
  border-color: #d8a7aa;
  background: var(--tl-danger-soft);
}

footer {
  display: flex;
  width: min(1080px, calc(100% - 32px));
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto;
  border-top: 1px solid var(--tl-border);
  color: var(--tl-muted);
  font-size: 12px;
}

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

  body:is(
    [data-state="ASSET_SELECTED"],
    [data-state="ADDRESS_INVALID"],
    [data-state="QUOTE_PENDING"],
    [data-state="QUOTE_READY"],
    [data-state="QUOTE_EXPIRED"],
    [data-state="QUOTE_DENIED"],
    [data-state="GRANT_PENDING"],
    [data-state="GRANT_SUCCESS"],
    [data-state="GRANT_DENIED"],
    [data-state="QUOTA_EXHAUSTED"],
    [data-state="RESERVE_FLOOR"]
  ) .catalog-panel,
  body[data-state="CATALOG_READY"] .request-panel {
    display: none;
  }

  body:is(
    [data-state="QUOTE_READY"],
    [data-state="QUOTE_EXPIRED"],
    [data-state="QUOTE_DENIED"],
    [data-state="GRANT_PENDING"],
    [data-state="GRANT_SUCCESS"],
    [data-state="GRANT_DENIED"],
    [data-state="QUOTA_EXHAUSTED"],
    [data-state="RESERVE_FLOOR"]
  ) :is(.selected-heading, #asset-summary > .essential-facts, #asset-details-toggle) {
    display: none;
  }

  body:is(
    [data-state="QUOTE_READY"],
    [data-state="QUOTE_EXPIRED"],
    [data-state="QUOTE_DENIED"],
    [data-state="GRANT_PENDING"],
    [data-state="GRANT_SUCCESS"],
    [data-state="GRANT_DENIED"],
    [data-state="QUOTA_EXHAUSTED"],
    [data-state="RESERVE_FLOOR"]
  ) .outcome-panel {
    margin-top: 0;
  }

  .asset-list {
    max-height: 390px;
  }

  .selection-empty {
    min-height: 90px;
  }
}

@media (max-width: 520px) {
  .topbar {
    align-items: start;
    padding: 10px 12px;
  }

  .topbar-actions {
    min-width: 0;
  }

  .network {
    max-width: 116px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  main,
  footer {
    width: min(100% - 24px, 1080px);
  }

  .intro {
    align-items: start;
    padding-top: 22px;
  }

  .help-panel,
  .selected-heading {
    align-items: start;
  }

  .help-panel {
    flex-direction: column;
    gap: 4px;
  }

  .catalog-panel,
  .request-panel {
    padding: 16px;
    border-radius: 14px;
  }

  .asset-list {
    max-height: 330px;
  }

  .asset-option {
    gap: 8px;
  }

  .essential-facts,
  .fact-list > div {
    grid-template-columns: 1fr;
  }

  .fact-list > div {
    gap: 3px;
  }

  .fact-list dd {
    text-align: left;
  }

  .outcome-actions .primary-button,
  .outcome-actions .text-button {
    width: 100%;
  }
}

@media (max-width: 360px) {
  .brand > span:last-child {
    display: none;
  }
}

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

@media (forced-colors: active) {
  .mark,
  .primary-button,
  .outcome-icon {
    border: 1px solid ButtonText;
    background: ButtonFace;
    color: ButtonText;
  }

  .status-dot::before {
    border: 1px solid CanvasText;
    background: CanvasText;
  }

  .status-dot.available::before,
  .asset-option.selected .status-dot::before {
    border-color: Highlight;
    background: Highlight;
  }

  .asset-option.selected,
  .help-panel,
  .protocol-panel {
    border-left-color: Highlight;
  }
}
