:root {
  color-scheme: light;
  --ink: #172033;
  --paper: #eaf2f4;
  --panel: #f8fbf8;
  --panel-alt: #dbe7e5;
  --line: #172033;
  --muted: #5e6b78;
  --sage: #79b8c6;
  --amber: #f1c35b;
  --coral: #8fa4d8;
  --cream: #f4ead0;
  --red: #d74343;
  --green: #13865b;
  font-family:
    "Courier New", Courier, ui-monospace, SFMono-Regular, Menlo, Consolas,
    monospace;
  color: var(--ink);
  background:
    linear-gradient(rgba(23, 32, 51, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 32, 51, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, #cfe6ec 0%, #eaf2f4 58%, #d7dfed 100%);
  background-size: 16px 16px, 16px 16px, auto;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  image-rendering: pixelated;
}

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

.shell {
  width: min(100%, 1240px);
  margin: 0 auto;
  padding: 22px 18px 44px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  border: 3px solid var(--line);
  background: var(--panel);
  box-shadow: 6px 6px 0 var(--line);
  padding: 18px;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 10px;
  border: 2px solid var(--line);
  background: var(--sage);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  padding: 3px 8px;
  text-transform: uppercase;
}

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

h1 {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: clamp(1.9rem, 4vw, 3.45rem);
  font-weight: 900;
  line-height: 1;
}

h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
}

.refresh-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 3px solid var(--line);
  border-radius: 0;
  background: var(--amber);
  box-shadow: 4px 4px 0 var(--line);
  color: var(--ink);
  cursor: pointer;
  padding: 0 16px;
  font-weight: 900;
}

.refresh-button:active {
  box-shadow: 0 0 0 var(--line);
  transform: translate(4px, 4px);
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.metric {
  min-width: 0;
  border: 3px solid var(--line);
  background: var(--panel);
  box-shadow: 5px 5px 0 var(--line);
  padding: 14px 15px;
}

.metric:nth-child(1) {
  background: #f4ead0;
}

.metric:nth-child(2) {
  background: #d9eef2;
}

.metric:nth-child(3) {
  background: #e1e8fb;
}

.metric:nth-child(4) {
  background: #eef3e2;
}

.metric span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  margin-bottom: 10px;
}

.metric strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: clamp(1.08rem, 2.2vw, 1.62rem);
  font-weight: 900;
  line-height: 1.15;
}

.section {
  margin-top: 26px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 3px solid var(--line);
  border-bottom: 0;
  background: var(--sage);
  color: var(--ink);
  padding: 10px 12px;
}

.section:nth-of-type(3) .section-head {
  background: var(--amber);
}

.section:nth-of-type(4) .section-head {
  background: var(--coral);
}

.section-head span {
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 900;
}

.table-wrap {
  overflow-x: auto;
  border: 3px solid var(--line);
  background: var(--panel);
  box-shadow: 5px 5px 0 var(--line);
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  border-right: 2px solid rgba(29, 27, 47, 0.25);
  border-bottom: 2px solid rgba(29, 27, 47, 0.2);
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th:last-child,
td:last-child {
  border-right: 0;
}

th {
  background: #e7d39b;
  border-bottom: 3px solid var(--line);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 900;
}

tbody tr:nth-child(even) {
  background: var(--panel-alt);
}

tbody tr:hover {
  background: #e7efd5;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.positive {
  color: var(--red);
  font-weight: 900;
}

.negative {
  color: var(--green);
  font-weight: 900;
}

.empty {
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

.pixel-badge {
  display: inline-flex;
  min-width: 34px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--line);
  background: var(--cream);
  box-shadow: 3px 3px 0 var(--line);
  color: var(--ink);
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
}

.pixel-badge.small {
  min-width: 26px;
  height: 22px;
  border-width: 2px;
  box-shadow: 2px 2px 0 var(--line);
  font-size: 0.68rem;
}

.pixel-badge.mini {
  min-width: 20px;
  height: 18px;
  border-width: 2px;
  box-shadow: 2px 2px 0 var(--line);
  font-size: 0.62rem;
}

@media (max-width: 780px) {
  .shell {
    padding: 16px 12px 34px;
  }

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

  .refresh-button {
    width: 100%;
  }

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

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