:root {
  --bg: #101114;
  --surface: #181a1f;
  --surface-2: #202329;
  --line: #30343d;
  --text: #eef0f2;
  --muted: #9aa2ad;
  --soft: #6f7784;
  --accent: #35b8a6;
  --accent-2: #d7a84f;
  --danger: #e16f6f;
  --ok: #75c06b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0 20px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  font-size: 26px;
}

h2 {
  font-size: 16px;
}

p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

nav {
  display: flex;
  gap: 10px;
}

nav a,
.button-link {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
}

nav a:hover,
.button-link:hover {
  border-color: var(--accent);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(330px, 0.75fr);
  gap: 18px;
  padding-top: 18px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.market-panel {
  min-height: 520px;
}

.controls-panel {
  align-self: start;
}

.output-panel {
  grid-column: 1 / -1;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-head.compact {
  margin-bottom: 18px;
}

.actions {
  display: flex;
  gap: 10px;
}

.actions.slim {
  align-items: center;
}

button,
.button-link {
  min-height: 38px;
  border: 1px solid #247d73;
  background: var(--accent);
  color: #08110f;
  border-radius: 6px;
  padding: 8px 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

button:hover,
.button-link:hover {
  filter: brightness(1.08);
}

button:disabled,
.button-link.disabled {
  opacity: 0.45;
  pointer-events: none;
}

button.secondary,
.button-link.secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metrics div {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.metrics span {
  display: block;
  color: var(--soft);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
}

.metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-wrap {
  max-height: 390px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  background: #15171b;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

tbody tr:hover {
  background: rgba(53, 184, 166, 0.07);
}

form {
  display: grid;
  gap: 10px;
}

label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

select,
input {
  width: 100%;
  color: var(--text);
  background: #111317;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  outline: none;
}

select:focus,
input:focus {
  border-color: var(--accent);
}

.status-box {
  margin-top: 16px;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 12px;
  font-size: 13px;
  white-space: pre-wrap;
}

.status-box.ok {
  border-color: rgba(117, 192, 107, 0.55);
  color: var(--ok);
}

.status-box.warn {
  border-color: rgba(215, 168, 79, 0.6);
  color: var(--accent-2);
}

.status-box.error {
  border-color: rgba(225, 111, 111, 0.6);
  color: var(--danger);
}

pre {
  margin: 0;
  min-height: 420px;
  max-height: 680px;
  overflow: auto;
  background: #0c0d10;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #dce1e7;
  padding: 16px;
  line-height: 1.45;
  font-size: 13px;
  white-space: pre-wrap;
}

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

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

  nav {
    width: 100%;
  }
}
