:root {
  --bg: #07100d;
  --panel: #101c17;
  --panel2: #15241e;
  --line: #57d98b;
  --line-soft: rgba(87, 217, 139, .35);
  --text: #f3fff8;
  --muted: #b7c7bd;
  --input: #eef4f0;
  --danger: #c4493d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle at top left, rgba(87, 217, 139, .12), transparent 32%), var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(7, 16, 13, .92);
  position: sticky;
  top: 0;
  z-index: 10;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; letter-spacing: 0; }
h2 { font-size: 18px; margin-top: 5px; }
h3 { font-size: 18px; }

main {
  padding: 24px 32px 60px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.eyebrow {
  color: #76ff9f;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .02em;
}

.panel {
  border: 1px solid var(--line-soft);
  border-top: 3px solid var(--line);
  background: linear-gradient(180deg, rgba(21, 36, 30, .96), rgba(12, 23, 18, .98));
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 22px 65px rgba(0, 0, 0, .28);
}

.hero {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 18px;
}

.uploadBox {
  border: 1px dashed var(--line);
  min-height: 170px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(238, 244, 240, .04);
  color: var(--muted);
  text-align: center;
}

.uploadBox strong {
  color: var(--text);
  font-size: 22px;
}

input[type=file] {
  color: var(--muted);
}

.statusBox {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.stat {
  border: 1px solid var(--line-soft);
  padding: 14px;
  background: #0b1612;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.stat strong {
  font-size: 22px;
}

.navigator {
  display: grid;
  grid-template-columns: 120px 1fr 120px;
  align-items: center;
  gap: 18px;
}

.actionRow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  border-top: 1px solid var(--line-soft);
  padding-top: 16px;
}

button {
  border: 1px solid var(--line);
  background: #64db8b;
  color: #03100a;
  border-radius: 6px;
  padding: 11px 14px;
  font-weight: 800;
  cursor: pointer;
}

button.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--line-soft);
}

button.danger {
  background: var(--danger);
  color: #fff;
  border-color: #ff9c92;
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

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

.sectionHead {
  margin-bottom: 12px;
}

.splitHead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.comparisonSummary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.badge {
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
  background: #08150f;
}

.badge.match { color: #79ffa1; }
.badge.different { color: #ffb1a8; border-color: rgba(255, 177, 168, .55); }
.badge.sentBlank { color: #d3c2ff; border-color: rgba(211, 194, 255, .55); }
.badge.payloadOnly { color: #f7d47b; border-color: rgba(247, 212, 123, .55); }
.badge.mjOnly { color: #a9d8ff; border-color: rgba(169, 216, 255, .55); }

.lookupPanel {
  border: 1px solid rgba(255,255,255,.1);
  background: #07130f;
  padding: 14px;
  border-radius: 6px;
}

.lookupEmpty {
  color: var(--muted);
  font-size: 14px;
}

.lookupStatus {
  color: #76ff9f;
  font-weight: 800;
  margin-bottom: 12px;
}

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

.lookupCard {
  border: 1px solid var(--line-soft);
  background: #0c1a14;
  padding: 11px;
  min-height: 72px;
}

.lookupCard span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 7px;
}

.lookupCard strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.table {
  overflow: auto;
  border: 1px solid rgba(255,255,255,.1);
  max-height: 360px;
}

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

th, td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  vertical-align: top;
}

th {
  color: #77ff9e;
  background: #0b1712;
  position: sticky;
  top: 0;
}

.comparisonTable {
  margin-top: 12px;
  max-height: 460px;
}

.comparison-match td:last-child {
  color: #79ffa1;
  font-weight: 800;
}

.comparison-different {
  background: rgba(196, 73, 61, .16);
}

.comparison-different td:last-child {
  color: #ffb1a8;
  font-weight: 800;
}

.comparison-payload-only td:last-child {
  color: #f7d47b;
  font-weight: 800;
}

.comparison-sent-mj-returned-blank td:last-child {
  color: #d3c2ff;
  font-weight: 800;
}

.comparison-mj-only td:last-child {
  color: #a9d8ff;
  font-weight: 800;
}

pre {
  margin: 0;
  max-height: 520px;
  overflow: auto;
  background: #06100c;
  border: 1px solid rgba(255,255,255,.12);
  color: #ddffea;
  padding: 14px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.45;
}

.modal, .loading {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.68);
  display: grid;
  place-items: center;
  z-index: 40;
}

.modalCard, .loaderCard {
  width: min(720px, calc(100vw - 36px));
  background: #07110d;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  position: relative;
}

.modalCard ol {
  color: var(--muted);
  line-height: 1.6;
}

.close {
  position: absolute;
  right: 16px;
  top: 16px;
  width: 34px;
  height: 34px;
  padding: 0;
}

.loaderCard {
  text-align: center;
}

.spinner {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  margin: 0 auto 18px;
  border: 4px solid rgba(118,255,159,.18);
  border-top-color: #76ff9f;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

[hidden] { display: none !important; }

@media (max-width: 900px) {
  .hero, .grid, .navigator, .lookupGrid {
    grid-template-columns: 1fr;
  }
  .topbar {
    align-items: flex-start;
    gap: 16px;
    flex-direction: column;
  }
}
