:root {
  --paper: #f7f8f4;
  --surface: #ffffff;
  --ink: #1f2523;
  --muted: #69736e;
  --line: #dfe4dc;
  --teal: #167c70;
  --teal-dark: #0f6259;
  --amber: #b7791f;
  --red: #b83245;
  --green: #2f855a;
  --violet: #5a4fcf;
  --shadow: 0 16px 50px rgba(31, 37, 35, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #fbfcf8;
  border-right: 1px solid var(--line);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand-block,
.topbar,
.wallet-panel,
.panel-heading,
.risk-strip,
.readiness-list div {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--ink);
  color: #f7f8f4;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 1.05rem;
}

h2 {
  max-width: 760px;
  font-size: clamp(1.4rem, 2vw, 2rem);
  line-height: 1.12;
}

h3 {
  font-size: 1.05rem;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-link {
  display: block;
  padding: 10px 12px;
  margin-bottom: 8px;
  color: var(--teal);
  font-weight: 700;
  font-size: 0.88rem;
}

.chain-guard {
  margin: 0 0 16px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid #f0c36d;
  background: #fff8eb;
  color: #7a4e00;
}

.chain-guard p {
  margin: 0 0 12px;
}

#tokenomicsPanel table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.9rem;
}

#tokenomicsPanel th,
#tokenomicsPanel td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

#tokenomicsPanel th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.nav-button {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 11px 12px;
  text-align: left;
}

.nav-button.active,
.nav-button:hover {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.risk-strip {
  margin-top: auto;
  gap: 9px;
  padding: 12px;
  border: 1px solid #ead8b5;
  border-radius: 8px;
  background: #fff8ea;
  color: #6f4c14;
  font-size: 0.86rem;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.wallet-panel {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.network-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px 12px;
  color: var(--muted);
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--muted);
}

.status-dot.ok {
  background: var(--green);
}

.status-dot.warn {
  background: var(--amber);
}

.status-dot.danger {
  background: var(--red);
}

.primary-action,
.ghost-action,
.danger-action {
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  min-height: 40px;
  padding: 9px 13px;
  font-weight: 750;
}

.primary-action {
  background: var(--teal);
  color: white;
}

.primary-action:hover {
  background: var(--teal-dark);
}

.ghost-action {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.danger-action {
  background: #fff4f2;
  border-color: #f2c5bf;
  color: var(--red);
}

.alert-row {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.alert {
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  background: var(--surface);
  padding: 11px 13px;
  color: var(--muted);
}

.alert.error {
  border-left-color: var(--red);
}

.alert.success {
  border-left-color: var(--green);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

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

.metric-card {
  min-height: 116px;
  padding: 16px;
  display: grid;
  align-content: space-between;
}

.metric-label,
.metric-card span:last-child,
.form-note,
.plain-copy,
.state-list dt {
  color: var(--muted);
}

.metric-card strong {
  font-size: 1.36rem;
  overflow-wrap: anywhere;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 14px;
  margin-top: 14px;
}

.panel {
  padding: 16px;
}

.panel-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.address-list,
.state-list,
.readiness-list,
.action-stack {
  display: grid;
  gap: 10px;
}

.address-row,
.state-list div {
  display: grid;
  grid-template-columns: 165px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.address-row code,
.state-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.section-title {
  margin-bottom: 14px;
}

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

.tx-form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdf9;
  color: var(--ink);
  min-height: 40px;
  padding: 9px 11px;
}

.check-row {
  grid-template-columns: 18px 1fr;
  align-items: center;
}

.check-row input {
  min-height: auto;
}

canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdf9;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.readiness-list div {
  gap: 10px;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .two-column {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .wallet-panel {
    justify-content: flex-start;
    width: 100%;
  }

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

@media (max-width: 680px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .nav-list,
  .metric-grid,
  .form-grid,
  .legend-grid {
    grid-template-columns: 1fr;
  }

  .address-row,
  .state-list div {
    grid-template-columns: 1fr;
  }
}
