:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #eef3f1;
  --ink: #1b1f24;
  --muted: #66707d;
  --line: #d9dee5;
  --accent: #0f6b5f;
  --accent-ink: #ffffff;
  --warn: #8a5b00;
  --warn-bg: #fff4d7;
  --ok-bg: #e7f5ed;
  --ok: #19613d;
  --shadow: 0 12px 28px rgba(25, 34, 45, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

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

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

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

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: 0;
}

.stamp {
  display: grid;
  gap: 4px;
  text-align: right;
  color: var(--muted);
  font-size: 13px;
}

.stamp strong {
  color: var(--ink);
  font-weight: 700;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.metric {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  box-shadow: var(--shadow);
}

.metric span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  font-size: 26px;
  line-height: 1.1;
  letter-spacing: 0;
}

.metric.muted {
  background: var(--panel-soft);
}

.controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 160px 190px 110px 72px;
  align-items: end;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

label {
  display: grid;
  gap: 5px;
}

label span {
  color: var(--muted);
  font-size: 12px;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  filter: brightness(0.96);
}

.syncbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
}

.syncbar strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
}

.balance-input {
  width: 128px;
  min-height: 34px;
  text-align: right;
}

.balance-stack {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.balance-hint {
  color: var(--muted);
  font-size: 11px;
}

.notice {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--warn);
  font-size: 13px;
}

.notice p {
  margin: 0;
  border: 1px solid #f1d38a;
  border-radius: 8px;
  background: var(--warn-bg);
  padding: 10px 12px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f9fafb;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

tbody tr:hover {
  background: #f7fbfa;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: var(--ok-bg);
  color: var(--ok);
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
}

.muted-text {
  color: var(--muted);
}

.num {
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .stamp {
    text-align: left;
  }

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

  .controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1480px);
    padding-top: 16px;
  }

  h1 {
    font-size: 28px;
  }

  .metrics {
    grid-template-columns: 1fr;
  }
}
