/* Envelope — light, document-like. A payroll artefact, not a crypto dashboard. */

:root {
  --bg:        #f6f7f9;
  --surface:   #ffffff;
  --ink:       #101828;
  --ink-soft:  #475467;
  --ink-faint: #98a2b3;
  --line:      #e4e7ec;
  --line-soft: #f0f2f5;

  --accent:      #1f4fd8;
  --accent-ink:  #123a9e;
  --accent-soft: #eef3fe;

  --good:      #067647;
  --good-soft: #ecfdf3;
  --good-line: #c7ebd8;
  --warn:      #b54708;
  --warn-soft: #fffaeb;
  --warn-line: #fde3bd;
  --info-line: #d3e0fb;
  --danger:    #912018;

  /* Two radii, deliberately: surfaces that hold data are near-square, controls are rounded.
     A single radius everywhere is what makes a page read as assembled from a kit. */
  --radius-surface: 3px;
  --radius-control: 8px;

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 40px;
}

.mono { font-family: var(--mono); font-size: 0.86em; }
.wrap { word-break: break-all; }
.hidden { display: none !important; }

/* ── top bar ─────────────────────────────────────────────── */

.topbar {
  display: flex; flex-wrap: wrap; gap: 14px;
  align-items: center; justify-content: space-between;
  padding: 16px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; }

.mark {
  width: 38px; height: 38px; flex: none;
  stroke: var(--accent); stroke-width: 1.6;
  fill: none; stroke-linecap: round; stroke-linejoin: round;
  background: var(--accent-soft); border-radius: var(--radius-control); padding: 6px;
}

.brand h1 { margin: 0; font-size: 17px; letter-spacing: -0.01em; }

.wallet { display: flex; align-items: center; gap: 8px; }

.badge {
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.01em;
  padding: 4px 9px; border-radius: 999px; white-space: nowrap;
}
.badge-muted { background: var(--line-soft); color: var(--ink-faint); }
.badge-ok    { background: var(--good-soft); color: var(--good); }
.badge-bad   { background: var(--warn-soft); color: var(--warn); }

/* ── tabs ────────────────────────────────────────────────── */

.tabs {
  display: flex; gap: 4px;
  padding: 10px 20px 0;
  max-width: 940px; margin: 0 auto;
  overflow-x: auto;
}

.tab {
  appearance: none; border: 0; background: none;
  font: inherit; font-weight: 550; font-size: 14px;
  color: var(--ink-soft);
  padding: 9px 14px; border-radius: var(--radius-control) var(--radius-control) 0 0;
  cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--ink); background: var(--line-soft); }
.tab.is-active { color: var(--accent-ink); border-bottom-color: var(--accent); }

/* ── layout ──────────────────────────────────────────────── */

main { max-width: 940px; margin: 0 auto; padding: 20px; }

.view { display: none; }
.view.is-active { display: block; animation: fade 0.18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; } }

.lede { margin-bottom: 20px; }
.lede h2 { margin: 0 0 8px; font-size: 22px; letter-spacing: -0.02em; }
.lede p { margin: 0 0 6px; color: var(--ink-soft); max-width: 68ch; }

.fine { font-size: 12.5px; color: var(--ink-faint); margin: 8px 0 0; }
.sub  { font-size: 15px; margin: 26px 0 10px; }

/* ── cards ───────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-surface);
  padding: 18px;
  margin-bottom: 16px;
}

/* ── hero: the one loud element on the public view ──────────
   Deliberately NOT a card. It sits open on the page, separated by a rule,
   so the money reads as the subject rather than as one more panel. */

.hero {
  padding: 4px 0 22px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.hero-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}

.run-ref { font-size: 13px; color: var(--ink-soft); }
.run-num { font-family: var(--mono); font-weight: 620; color: var(--ink); }

.hero-figure {
  display: flex; align-items: baseline; gap: 8px;
  line-height: 1;
}
.hero-amount {
  font-size: 58px; font-weight: 660; letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums; color: var(--accent);
}
.hero-unit { font-size: 15px; font-weight: 600; color: var(--ink-faint); }

.hero-context {
  margin: 10px 0 0;
  font-size: 16px; color: var(--ink-soft);
}
.hero-context strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.hero-note {
  margin: 9px 0 0; font-size: 13px; color: var(--ink-soft);
}
.hero-note strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.progress {
  height: 8px; border-radius: 999px;
  background: var(--line-soft); overflow: hidden;
  margin: 20px 0 0;
}
.progress-bar {
  height: 100%; border-radius: 999px;
  background: var(--accent); width: 0;
  transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.pill {
  font-size: 11.5px; font-weight: 620; padding: 3px 9px;
  border-radius: 999px; background: var(--line-soft); color: var(--ink-soft);
}

/* ── facts list ──────────────────────────────────────────── */

/* Facts read as a record rather than a panel: hairlines only, no box.
   Deliberately a different surface treatment from .card. */
.facts {
  margin: 0 0 20px;
  border-top: 1px solid var(--line);
}
.facts > div {
  display: flex; gap: 16px; justify-content: space-between; align-items: baseline;
  padding: 10px 0; border-bottom: 1px solid var(--line-soft);
}
.facts dt { color: var(--ink-faint); font-size: 13px; flex: none; }
.facts dd {
  margin: 0; text-align: right; font-weight: 550;
  min-width: 0; overflow-wrap: anywhere;
}

/* ── notices ─────────────────────────────────────────────── */

/* Notices are marked by a rule on the leading edge and a soft fill — not by a full box,
   so they don't read as one more card. */
.notice {
  border-radius: 0;
  padding: 11px 14px;
  font-size: 13.5px;
  border-left: 3px solid transparent;
  margin: 0 0 16px;
}
.notice-info { background: var(--accent-soft); color: var(--accent-ink); border-left-color: var(--accent); }
.notice-warn { background: var(--warn-soft); color: var(--warn); border-left-color: var(--warn-line); }
.notice-good { background: var(--good-soft); color: var(--good); border-left-color: var(--good-line); }
.notice strong { font-weight: 650; }

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius-surface);
  padding: 30px 20px;
  text-align: center; color: var(--ink-faint); font-size: 13.5px;
}

/* ── inputs & buttons ────────────────────────────────────── */

.input {
  font: inherit; font-size: 14px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface); color: var(--ink);
  width: 100%;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.input-sm { width: 92px; }
textarea.input { resize: vertical; line-height: 1.5; }

.field-label {
  display: block; font-size: 12.5px; font-weight: 620;
  color: var(--ink-soft); margin-bottom: 7px;
}

.btn {
  appearance: none; font: inherit; font-size: 14px; font-weight: 570;
  padding: 9px 15px; border-radius: var(--radius-control);
  border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  cursor: pointer; white-space: nowrap;
  transition: background 0.13s, border-color 0.13s, transform 0.06s;
}
.btn:hover:not(:disabled) { background: var(--line-soft); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-ink); border-color: var(--accent-ink); }

.btn-ghost { background: none; }
.btn-block { width: 100%; margin-top: 14px; }
.btn-sm { font-size: 13px; padding: 7px 12px; }

.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-wrap { margin: 14px 0; }
.row-between {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.row-between .field-label { margin: 0; }

.deadline-field { display: flex; flex-direction: column; }
.deadline-field .input { width: auto; }

.two-step { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }

/* ── roster rows ─────────────────────────────────────────── */

.rows { display: flex; flex-direction: column; gap: 8px; }

.row {
  display: grid; grid-template-columns: 1fr 128px 34px;
  gap: 8px; align-items: center;
}
.row .del {
  border: 0; background: none; cursor: pointer;
  color: var(--ink-faint); font-size: 18px; line-height: 1;
  padding: 6px; border-radius: var(--radius-control);
}
.row .del:hover { color: var(--warn); background: var(--warn-soft); }

.sumline {
  display: flex; justify-content: space-between; align-items: baseline;
  border-top: 1px solid var(--line-soft);
  margin-top: 14px; padding-top: 12px;
  font-size: 14px; color: var(--ink-soft);
}
.sumline strong { font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; }

.commit-empty {
  border: 1px dashed var(--line); border-radius: var(--radius-surface);
  padding: 22px 16px; text-align: center;
  color: var(--ink-faint); font-size: 13px;
}

.commit-list { display: flex; flex-direction: column; gap: 7px; }
.commit-line {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 13px; padding: 7px 0; border-bottom: 1px solid var(--line-soft);
}
.commit-line:last-child { border-bottom: 0; }
.commit-line .who { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); }
.commit-line .amt { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── entitlement ─────────────────────────────────────────── */

.card-entitlement { border-color: var(--info-line); background: var(--accent-soft); }
.entitlement-label {
  display: block; font-size: 13.5px; font-weight: 600;
  color: var(--accent-ink); margin-bottom: 6px;
}
.entitlement {
  font-size: 40px; font-weight: 680; letter-spacing: -0.025em;
  color: var(--accent-ink); line-height: 1.1;
  font-variant-numeric: tabular-nums;
  margin: 2px 0 4px;
}
.card-entitlement .fine { color: var(--accent-ink); opacity: 0.75; }

/* ── runs list ───────────────────────────────────────────── */

.runs { display: flex; flex-direction: column; gap: 9px; }
.run-item {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-surface); padding: 13px 15px;
}
.run-item .id { font-family: var(--mono); font-weight: 650; }
.run-item .nums { font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ── footer ──────────────────────────────────────────────── */

.footer {
  max-width: 940px; margin: 34px auto 0; padding: 20px;
  border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-faint);
}
.footer p { margin: 0 0 12px; }

.limits summary {
  cursor: pointer; font-weight: 620; color: var(--ink-soft);
  padding: 6px 0; font-size: 13px;
}
.limits summary:hover { color: var(--ink); }
.limits ul { margin: 6px 0 0; padding-left: 20px; }
.limits li { margin-bottom: 8px; max-width: 78ch; }
.limits strong { color: var(--ink-soft); }

/* ── toast ───────────────────────────────────────────────── */

.toast {
  position: fixed; left: 50%; bottom: 22px;
  transform: translate(-50%, 14px);
  opacity: 0; visibility: hidden; pointer-events: none;
  background: var(--ink); color: #fff;
  padding: 11px 17px; border-radius: var(--radius-control);
  font-size: 13.5px; font-weight: 520;
  max-width: min(92vw, 520px);
  box-shadow: 0 8px 26px rgba(16, 24, 40, 0.22);
  transition: opacity 0.22s ease, transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0.26s;
  z-index: 60;
}
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.toast.bad { background: var(--danger); }
/* an empty toast must render nothing at all */
.toast:empty { display: none; }

@media (max-width: 560px) {
  .row { grid-template-columns: 1fr 104px 30px; }
  .entitlement { font-size: 33px; }
  .hero-amount { font-size: 46px; }
  .topbar { padding: 13px 16px; }
  main { padding: 16px; }

  /* Stack label over value so a 42-character address can never squeeze or overflow. */
  .facts > div { flex-direction: column; align-items: flex-start; gap: 3px; }
  .facts dd { text-align: left; }
  .two-step { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
