:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #f0f4f7;
  --text: #15202b;
  --muted: #66727f;
  --line: #d8e0e7;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --ok: #18794e;
  --ok-bg: #edf8f1;
  --shadow: 0 16px 44px rgba(24, 35, 51, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 7px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

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

button.ghost {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

button.ghost:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

button.strong {
  background: #172033;
  border-color: #172033;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.05;
  font-weight: 800;
}

h2 {
  font-size: 16px;
  line-height: 1.2;
  font-weight: 800;
}

p,
span,
td,
th,
textarea,
input {
  font-size: 13px;
}

#sourceLine {
  color: var(--muted);
  margin-top: 8px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.auth,
.exportPanel,
.tableBlock,
.missing {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth {
  padding: 16px;
  margin-bottom: 16px;
}

.auth label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.tokenRow {
  display: flex;
  gap: 8px;
}

.tokenRow input {
  width: 320px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
}

.statusGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

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

.statusBox span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.statusBox strong {
  font-size: 18px;
}

.statusBox.ok {
  background: var(--ok-bg);
  border-color: #b7e4c7;
}

.statusBox.bad {
  background: var(--danger-bg);
  border-color: #ffc8c2;
}

.missing {
  padding: 16px;
  margin-bottom: 16px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.exportPanel {
  padding: 16px;
  margin-bottom: 16px;
}

.sectionHead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.sectionHead span {
  color: var(--muted);
  text-align: right;
}

textarea {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  color: #111827;
  background: #fbfcfd;
  line-height: 1.55;
}

.tables {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(360px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.tableBlock {
  overflow: hidden;
}

.tableBlock .sectionHead {
  padding: 16px 16px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 9px 16px;
  border-top: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #fbfcfd;
}

td.symbol {
  font-weight: 800;
}

td.flags {
  white-space: normal;
  color: var(--muted);
}

.gatePass {
  color: var(--ok);
  font-weight: 800;
}

.gateFail {
  color: var(--danger);
  font-weight: 800;
}

.hidden {
  display: none;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #172033;
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  box-shadow: var(--shadow);
}

@media (max-width: 880px) {
  .topbar,
  .sectionHead {
    flex-direction: column;
    align-items: stretch;
  }

  .actions {
    justify-content: flex-start;
  }

  .statusGrid,
  .tables {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding: 9px 10px;
  }
}
