:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-soft: #f8f9fa;
  --text: #17191c;
  --muted: #686d73;
  --border: #d9dde2;
  --border-strong: #afb5bd;
  --accent: #d8263f;
  --accent-dark: #af172c;
  --success: #137a55;
  --success-soft: #e8f5ef;
  --warning: #9b6400;
  --warning-soft: #fff5dc;
  --danger-soft: #fff0f2;
  --focus: #1f6feb;
  --shadow: 0 10px 28px rgba(30, 34, 40, 0.08);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  letter-spacing: 0;
}

.topbar {
  min-height: 58px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: #17191c;
  color: #fff;
}

.brand,
.topbar-status {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #fff;
  font-size: 14px;
}

.topbar-status {
  gap: 8px;
  color: #d8dce1;
  font-size: 13px;
}

.environment-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f5a623;
  box-shadow: 0 0 0 4px rgba(245, 166, 35, 0.18);
}

.app-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 38px 0 52px;
}

.intro-band {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  align-items: end;
  gap: 48px;
  padding-bottom: 26px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 620px;
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.18;
  letter-spacing: 0;
}

.intro-copy {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.safety-banner {
  min-height: 46px;
  margin-bottom: 18px;
  padding: 11px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #b9dccd;
  border-radius: 6px;
  background: var(--success-soft);
  color: #185f46;
  font-size: 13px;
  line-height: 1.5;
}

.safety-banner.warning {
  border-color: #ecd397;
  background: var(--warning-soft);
  color: #785000;
}

.safety-banner.danger {
  border-color: #efb4bc;
  background: var(--danger-soft);
  color: #912035;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 700px);
  gap: 18px;
  align-items: start;
  justify-content: center;
}

.advanced-only {
  display: none !important;
}

.control-panel,
.inspector {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.control-panel {
  padding: 24px;
}

.inspector {
  overflow: hidden;
}

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

.section-heading > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-heading .wallet-actions {
  display: flex;
  gap: 8px;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

.step-index {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.wallet-summary {
  min-height: 66px;
  margin-bottom: 22px;
  padding: 13px 15px;
  display: grid;
  grid-template-columns: 0.75fr 1.1fr 0.65fr;
  gap: 20px;
  border-left: 3px solid var(--accent);
  background: var(--surface-soft);
}

.wallet-summary > div {
  min-width: 0;
}

.wallet-summary .label,
.field-note {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.fixed-summary {
  min-height: 52px;
  margin: -2px 0 18px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}

.fixed-summary strong {
  color: #353a40;
  font-size: 12px;
  text-align: right;
}

.wallet-summary strong {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: #30343a;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-group {
  margin-bottom: 18px;
}

.field-group > label,
.field-group > legend {
  display: block;
  margin-bottom: 7px;
  color: #363a40;
  font-size: 13px;
  font-weight: 700;
}

.network-fieldset {
  padding: 0;
  border: 0;
}

.network-fieldset {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  column-gap: 10px;
}

.network-fieldset legend {
  grid-column: 1 / -1;
}

.segmented-control {
  height: 40px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #eceff2;
}

.segmented-control label {
  position: relative;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
}

.segmented-control span {
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.segmented-control input:checked + span {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 5px rgba(30, 34, 40, 0.13);
}

input[type="text"],
input[type="number"] {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  outline: none;
  background: #fff;
  color: var(--text);
  font-size: 14px;
}

input[type="text"]:focus,
input[type="number"]:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
}

.field-note {
  margin-top: 6px;
  line-height: 1.45;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 0.8fr;
  gap: 14px;
}

.input-suffix {
  position: relative;
}

.input-suffix input {
  padding-right: 54px;
}

.input-suffix span {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.consent-row {
  min-height: 48px;
  margin: 2px 0 18px;
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid #efc1c8;
  border-radius: 6px;
  background: #fff7f8;
  color: #5d3339;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.5;
}

.consent-row input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.action-row,
.secondary-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.action-row {
  grid-template-columns: 1fr;
}

.button {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

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

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button-primary {
  background: #fff;
  border-color: #22262b;
  color: #22262b;
}

.button-primary:hover:not(:disabled) {
  background: #22262b;
  color: #fff;
}

.button-secondary {
  border-color: var(--border-strong);
  background: #fff;
  color: #30343a;
}

.button-secondary:hover:not(:disabled),
.button-quiet:hover:not(:disabled) {
  border-color: #757c85;
  background: #f5f6f7;
}

.button-danger {
  background: var(--accent);
  color: #fff;
}

.button-danger:hover:not(:disabled) {
  background: var(--accent-dark);
}

.inspector-heading {
  margin-bottom: 0;
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--border);
}

.readiness-badge {
  min-width: 78px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eceff2;
  color: #60666d;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.readiness-badge.ready {
  background: var(--success-soft);
  color: var(--success);
}

.preview-list {
  margin: 0;
  padding: 6px 22px;
}

.preview-list > div {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #eceef0;
}

.preview-list dt {
  color: var(--muted);
  font-size: 12px;
}

.preview-list dd {
  max-width: 65%;
  margin: 0;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.resource-section,
.activity-section {
  padding: 18px 22px;
}

.resource-section {
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
}

.subheading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.subheading-row h3 {
  margin: 0;
  font-size: 13px;
}

.subheading-row > span {
  color: var(--muted);
  font-size: 11px;
}

.resource-meter {
  height: 8px;
  margin: 15px 0 12px;
  overflow: hidden;
  border-radius: 4px;
  background: #dfe3e7;
}

.resource-meter span {
  width: 0;
  height: 100%;
  display: block;
  background: var(--success);
  transition: width 250ms ease;
}

.resource-values {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.resource-values strong {
  color: var(--text);
}

.resource-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.secondary-actions {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}

.button-quiet {
  border-color: var(--border);
  background: #fff;
  color: #41464d;
}

.button-revoke {
  color: var(--accent-dark);
}

.text-button {
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.wallet-dialog {
  width: min(520px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
}

.wallet-dialog::backdrop {
  background: rgba(23, 25, 28, 0.58);
}

.dialog-shell {
  max-height: calc(100dvh - 28px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 64px rgba(17, 20, 24, 0.24);
  overflow-y: auto;
}

.dialog-heading {
  padding: 20px 22px 17px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.dialog-heading h2 {
  margin: 5px 0 0;
  font-size: 19px;
}

.wallet-dialog-note {
  margin: 0;
  padding: 11px 22px;
  border-bottom: 1px solid #eceef0;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.wallet-filter {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  margin: 12px 22px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #eceff2;
}

.wallet-filter button {
  min-height: 34px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.wallet-filter button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(30, 34, 40, 0.1);
}

.wallet-options {
  max-height: min(410px, 48dvh);
  overflow-y: auto;
  border-top: 1px solid #eceef0;
}

.icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #fff;
  color: #4b5057;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.icon-button:hover {
  border-color: var(--border-strong);
  background: var(--surface-soft);
}

.wallet-option {
  min-height: 82px;
  padding: 16px 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid #eceef0;
}

.wallet-option > div,
.hardware-note {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.wallet-option .wallet-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-direction: row;
  gap: 12px;
}

.wallet-identity > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wallet-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: #3f454c;
  font-size: 13px;
  font-weight: 800;
  object-fit: contain;
}

.wallet-connect-button {
  min-width: 88px;
  white-space: nowrap;
}

.wallet-option .wallet-option-actions {
  display: flex;
  align-items: center;
  flex-direction: row;
  gap: 8px;
}

.wallet-option-actions .button {
  min-width: 72px;
  white-space: nowrap;
}

.wallet-option strong,
.hardware-note strong {
  font-size: 13px;
}

.wallet-option span,
.hardware-note span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.hardware-note {
  margin: 16px 22px 0;
  padding: 13px 14px;
  border-left: 3px solid var(--warning);
  background: var(--warning-soft);
}

.dialog-footnote {
  margin: 0;
  padding: 16px 22px 20px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.activity-log {
  max-height: 166px;
  margin: 14px 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.activity-log li {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid #eceef0;
  color: #464b52;
  font-size: 11px;
  line-height: 1.45;
}

.activity-log time {
  color: #8b9198;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.activity-log a {
  color: var(--focus);
  overflow-wrap: anywhere;
}

footer {
  padding: 18px 20px 30px;
  color: #7b8188;
  font-size: 11px;
  text-align: center;
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 28px, 700px);
    padding-top: 28px;
  }

  .intro-band,
  .workspace {
    grid-template-columns: 1fr;
  }

  .intro-band {
    gap: 14px;
  }

  .intro-copy {
    max-width: 580px;
  }
}

@media (max-width: 560px) {
  .topbar {
    min-height: 54px;
    padding: 0 14px;
  }

  .topbar-status {
    font-size: 11px;
  }

  .app-shell {
    width: calc(100% - 20px);
    padding-top: 22px;
  }

  h1 {
    font-size: 27px;
  }

  input[type="text"],
  input[type="number"] {
    font-size: 16px;
  }

  .intro-band {
    padding-bottom: 20px;
  }

  .safety-banner {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .control-panel {
    padding: 18px;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .section-heading .wallet-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .inspector-heading {
    align-items: center;
    flex-direction: row;
    padding: 18px;
  }

  .wallet-summary,
  .field-row,
  .network-fieldset {
    grid-template-columns: 1fr;
  }

  .network-fieldset legend {
    grid-column: auto;
  }

  .network-fieldset .button {
    margin-top: 9px;
  }

  .action-row {
    grid-template-columns: 1fr;
  }

  .fixed-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .fixed-summary strong {
    text-align: left;
  }

  .wallet-option {
    grid-template-columns: 1fr;
  }

  .wallet-option .button {
    width: 100%;
  }

  .wallet-option .wallet-option-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preview-list,
  .resource-section,
  .activity-section,
  .secondary-actions {
    padding-left: 18px;
    padding-right: 18px;
  }
}
