:root {
  color-scheme: light;
  --bg: #ffd73a;
  --panel: #1f5ea8;
  --panel-strong: #17477f;
  --line: #2c3945;
  --text: #1e252b;
  --muted: #53606b;
  --green: #1f9d73;
  --red: #d33f49;
  --amber: #ffcf33;
  --blue: #1f5ea8;
  --cream: #fff6cf;
  --goggle: #5e6873;
  --shadow: 0 22px 54px rgba(44, 57, 69, 0.24);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 246, 207, 0.86), transparent 24%),
    linear-gradient(135deg, rgba(31, 94, 168, 0.24), transparent 42%),
    linear-gradient(315deg, rgba(94, 104, 115, 0.22), transparent 34%),
    var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

body.locked {
  overflow: hidden;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 246, 207, 0.92), transparent 22%),
    rgba(255, 215, 58, 0.96);
}

.gate.hidden {
  display: none;
}

.gate-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.gate-panel h2 {
  color: #ffffff;
  font-size: 28px;
}

.gate-panel .eyebrow,
.gate-note {
  color: var(--cream);
}

.gate-note {
  min-height: 18px;
  font-size: 13px;
  font-weight: 700;
}

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

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--panel-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(34px, 5vw, 72px);
  line-height: 0.95;
  letter-spacing: 0;
  color: var(--text);
  text-shadow: 0 3px 0 rgba(255, 246, 207, 0.55);
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

.status-pill {
  min-width: 108px;
  padding: 10px 14px;
  border: 2px solid var(--goggle);
  border-radius: 999px;
  background: var(--cream);
  color: var(--line);
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
}

.status-pill.live {
  color: var(--green);
  border-color: var(--green);
}

.status-pill.error {
  color: var(--red);
  border-color: var(--red);
}

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

.panel {
  border: 2px solid var(--line);
  border-radius: 8px;
  background: rgba(31, 94, 168, 0.95);
  box-shadow: var(--shadow);
}

.controls {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
  padding: 18px;
}

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

.field.full {
  grid-column: 1 / -1;
}

label {
  color: #eef5ff;
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  height: 42px;
  border: 2px solid #183c68;
  border-radius: 6px;
  outline: 0;
  background: var(--cream);
  color: var(--text);
  padding: 0 12px;
}

input:focus,
select:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 4px rgba(255, 207, 51, 0.34);
}

.input-unit {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  border: 2px solid #183c68;
  border-radius: 6px;
  background: var(--cream);
}

.input-unit:focus-within {
  border-color: var(--amber);
  box-shadow: 0 0 0 4px rgba(255, 207, 51, 0.34);
}

.input-unit input {
  border: 0;
  box-shadow: none;
}

.input-unit span {
  padding-right: 12px;
  color: var(--goggle);
  font-size: 13px;
}

.primary,
.secondary {
  height: 44px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
}

.primary {
  margin-top: 4px;
  background: var(--amber);
  color: #1e252b;
  border: 2px solid #a37a00;
}

.primary:disabled,
.secondary:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.secondary {
  min-width: 108px;
  padding: 0 14px;
  border: 2px solid var(--line);
  background: var(--cream);
  color: var(--text);
}

.action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.results-wrap {
  display: grid;
  gap: 18px;
  min-width: 0;
}

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

.metric {
  min-height: 94px;
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 246, 207, 0.95);
}

.metric span {
  display: block;
  color: var(--panel-strong);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 12px;
  font-size: 32px;
  line-height: 1;
  color: var(--text);
}

.table-panel {
  min-width: 0;
  overflow: hidden;
}

.table-actions {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border-bottom: 2px solid #183c68;
}

#resultNote {
  margin-top: 5px;
  color: #dcecff;
  font-size: 13px;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(24, 60, 104, 0.35);
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-strong);
  color: #f8df52;
  font-size: 12px;
  font-weight: 800;
}

td {
  color: #17212b;
  font-size: 14px;
}

tbody tr:hover {
  background: rgba(255, 207, 51, 0.22);
}

.empty {
  height: 280px;
  color: var(--muted);
  text-align: center;
  background: var(--cream);
}

.wallet-link {
  display: block;
  max-width: 190px;
  overflow: hidden;
  color: #123e72;
  font-weight: 800;
  text-decoration: none;
  text-overflow: ellipsis;
}

.wallet-link:hover {
  color: #0d6fb8;
}

.labels {
  display: inline-block;
  max-width: 220px;
  overflow: hidden;
  margin-top: 6px;
  padding: 3px 7px;
  border: 1px solid rgba(255, 246, 207, 0.9);
  border-radius: 6px;
  background: #1f5ea8;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
}

.good {
  color: var(--green);
}

.bad {
  color: var(--red);
}

.warn {
  color: var(--amber);
}

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

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

  .primary {
    grid-column: 1 / -1;
  }
}

@media (max-width: 660px) {
  .shell {
    width: min(100% - 20px, 1480px);
    padding-top: 18px;
  }

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

  .action-buttons {
    justify-content: stretch;
  }

  .action-buttons .secondary {
    flex: 1;
  }

  .controls,
  .metrics {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 82px;
  }
}
