:root {
  color-scheme: light;
  --bg: #f6f7f3;
  --panel: #ffffff;
  --ink: #1d2724;
  --muted: #5f6f69;
  --border: #d8ded7;
  --accent: #117a64;
  --accent-dark: #075a49;
  --accent-soft: #e2f1ec;
  --shadow: 0 18px 50px rgba(29, 39, 36, 0.10);
}

* {
  box-sizing: border-box;
}

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

button,
select {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
  display: grid;
  gap: 20px;
}

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

.query-panel {
  padding: 28px;
  display: grid;
  gap: 24px;
}

.section-label {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 780px;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 0.96;
}

.transfer-explorer h1 {
  max-width: 1060px;
  font-size: 2.7rem;
  line-height: 1.02;
}

h2 {
  font-size: 1.4rem;
}

.lede {
  max-width: 760px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
}

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

.query-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.query-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) auto;
  gap: 12px;
  align-items: end;
}

.transfer-filter-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr) minmax(0, 0.9fr) auto;
}

select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 42px 0 14px;
  color: var(--ink);
  background: #fbfcfa;
  line-height: 1.2;
}

select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(17, 122, 100, 0.16);
}

button {
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  min-height: 44px;
  background: var(--accent);
  color: white;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

.form-error {
  min-height: 20px;
  margin: -8px 0 0;
  color: #b42318;
  font-size: 0.92rem;
  font-weight: 800;
}

.results-panel {
  overflow: hidden;
}

.results-header {
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.row-count {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.parsed-summary {
  min-height: 56px;
  padding: 14px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.parsed-summary span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.summary-cards {
  padding: 18px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.summary-card {
  min-height: 86px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  align-content: space-between;
  background: #fbfcfa;
}

.summary-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-card strong {
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
}

.summary-card-fees strong {
  white-space: pre-line;
  font-size: 0.98rem;
  line-height: 1.35;
}

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

.transfer-table-wrap {
  max-height: 68vh;
  overflow: auto;
}

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

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--muted);
  background: #fbfcfa;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.transfer-table-wrap th {
  position: sticky;
  top: 0;
  z-index: 1;
}

td {
  font-size: 0.95rem;
}

.fee {
  font-weight: 900;
  color: var(--accent-dark);
}

.direction-pill {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.direction-in {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.direction-out {
  background: #f4e9e2;
  color: #8a3f19;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 34px 16px;
}

.load-more-cell {
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.load-more-button {
  margin-left: 12px;
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.85rem;
}

.sql-details {
  padding: 18px 24px 24px;
}

.sql-details summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 800;
}

pre {
  white-space: pre-wrap;
  overflow-x: auto;
  margin: 12px 0 0;
  border-radius: 8px;
  padding: 14px;
  background: #17201d;
  color: #dcf4eb;
  font-size: 0.84rem;
  line-height: 1.5;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 20px 0;
  }

  .query-panel {
    padding: 20px;
  }

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

  .transfer-explorer h1 {
    font-size: 2.35rem;
    line-height: 1.04;
  }

  .transfer-explorer h1 span {
    display: block;
  }

  .summary-cards {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }

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