:root {
  color-scheme: light;
  --ink: #11130f;
  --muted: #5c625a;
  --line: #d9dfd1;
  --paper: #fbfcf6;
  --panel: #ffffff;
  --accent: #91e23e;
  --accent-2: #15aa93;
  --warn: #b05222;
  --shadow: 0 18px 60px rgba(16, 22, 12, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

a {
  color: inherit;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(251, 252, 246, 0.9);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
}

.mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: var(--accent);
}

.topbar p,
footer {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

nav a {
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
}

main {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: stretch;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent-2);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: clamp(42px, 8vw, 86px);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  font-size: 26px;
  margin-bottom: 8px;
}

h3 {
  font-size: 18px;
  margin-bottom: 14px;
}

.lede {
  max-width: 720px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.status-card,
.panel,
.stats article {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  border-radius: 8px;
}

.status-card {
  padding: 20px;
  display: grid;
  gap: 14px;
  align-content: center;
}

.status-row,
.allocation dl div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.status-row span,
.stats span,
dt {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 800;
}

.primary {
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-weight: 800;
}

.primary:hover {
  background: #2b3027;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 30px 0;
}

.stats article {
  padding: 18px;
}

.stats strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.panel {
  padding: 24px;
  margin: 18px 0;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
}

.panel p,
.allocation p {
  color: var(--muted);
  line-height: 1.5;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfcf8;
  color: var(--ink);
  border-radius: 8px;
  padding: 12px;
  min-height: 44px;
}

textarea {
  resize: vertical;
}

.save-status {
  align-self: center;
  color: var(--accent-2);
  font-weight: 800;
  font-size: 13px;
}

.allocation {
  border-left: 1px solid var(--line);
  padding-left: 24px;
}

.allocation dl {
  margin: 0 0 16px;
  display: grid;
  gap: 12px;
}

dd {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

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

.filter {
  max-width: 320px;
}

.basket {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.basket-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcf8;
}

.token-title {
  display: flex;
  gap: 10px;
  min-width: 0;
  align-items: center;
}

.token-title img {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--line);
}

.token-title strong,
.token-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.token-title span {
  color: var(--muted);
  font-size: 13px;
}

.basket-card dl {
  margin: 14px 0 0;
  display: grid;
  gap: 8px;
}

.basket-card div,
.ledger-item {
  min-width: 0;
}

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

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

th,
td {
  text-align: left;
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

td {
  font-size: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  white-space: nowrap;
}

.ledger-list {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
}

.ledger-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcf8;
}

.ledger-item strong,
.ledger-item span {
  display: block;
}

.ledger-item span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

footer {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.error {
  color: var(--warn);
}

@media (max-width: 920px) {
  .hero,
  .two-col,
  .stats,
  .basket {
    grid-template-columns: 1fr;
  }

  .allocation {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 20px 0 0;
  }

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

@media (max-width: 640px) {
  main {
    width: min(100% - 24px, 1220px);
    padding-top: 28px;
  }

  .form-grid,
  .section-head {
    grid-template-columns: 1fr;
    display: grid;
  }

  .filter {
    max-width: none;
  }

  h1 {
    font-size: 42px;
  }
}
