/* ETF desk: an issuance desk on cool paper. Quiet everywhere except the rotation strip,
   which draws a coin's basket as the rounds its holders are paid in. */

@font-face { font-family: 'Plex Sans'; src: url('/fonts/plex-sans.woff2') format('woff2'); font-weight: 100 700; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('/fonts/plex-mono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('/fonts/plex-mono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #f3f5f7;
  --sheet: #ffffff;
  --ink: #15202b;
  --ink-2: #5e6b78;
  --ink-3: #8a96a3;
  --rule: #dce1e7;
  --rule-soft: #eaeef2;
  --blue: #2346c7;
  --blue-deep: #1a37a3;
  --blue-wash: #eef2fd;
  --ok: #1e7a4c;
  --ok-wash: #ecf6f0;
  --bad: #b4590e;
  --bad-wash: #fdf4ea;
  --sans: 'Plex Sans', system-ui, sans-serif;
  --mono: 'Plex Mono', ui-monospace, monospace;
  --r-sheet: 14px;
  --r-ctl: 8px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  font-feature-settings: 'tnum' 1;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--blue-deep); }
.mono { font-family: var(--mono); font-size: 0.875em; letter-spacing: -0.01em; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 820px; margin: 0 auto; padding: 20px 24px 0;
}
.wordmark { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.wordmark-glyph { width: 26px; height: 26px; display: block; }
.who { display: flex; align-items: center; gap: 14px; color: var(--ink-2); font-size: 14px; }
.link-btn { border: 0; background: none; padding: 4px 0; color: var(--ink-2); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--rule); }
.link-btn:hover { color: var(--ink); text-decoration-color: currentColor; }

/* ---------- page ---------- */
.desk { max-width: 820px; margin: 0 auto; padding: 40px 24px 96px; }
.title { margin: 0; font-size: 34px; line-height: 1.15; font-weight: 600; letter-spacing: -0.02em; }
.lede { margin: 12px 0 28px; max-width: 62ch; color: var(--ink-2); font-size: 17px; }
.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); }

/* ---------- fee-sharing address ---------- */
.fee-box {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 16px; padding: 16px 18px; border-radius: var(--r-sheet);
  background: var(--blue-wash); border: 1px solid #d6dffa;
}
.fee-text { min-width: 0; display: grid; gap: 4px; }
.fee-label { margin: 0; font-size: 14px; font-weight: 500; }
.fee-addr { font-family: var(--mono); font-size: 15px; color: var(--ink); overflow-wrap: anywhere; user-select: all; }
.copy-btn { flex: none; min-width: 84px; padding: 9px 14px; }
@media (max-width: 600px) { .fee-box { flex-direction: column; align-items: stretch; } }

/* ---------- form ---------- */
.form { padding: 24px; display: grid; gap: 20px; }
.row { display: grid; gap: 8px; }
.label { font-size: 14px; font-weight: 500; color: var(--ink); }
.label-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field {
  width: 100%; padding: 11px 13px; border: 1px solid var(--rule); border-radius: var(--r-ctl);
  background: var(--sheet); color: var(--ink); font: inherit;
}
.field.mono { font-size: 15px; }
textarea.field { resize: vertical; line-height: 1.45; }
.field::placeholder { color: var(--ink-3); }
.field:hover { border-color: #c7ced6; }
.field:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-wash); }
select.field {
  appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%235e6b78' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.basket-theme, .basket-custom { display: grid; gap: 8px; }
.hint { margin: 0; color: var(--ink-2); font-size: 14px; }

.segs { display: inline-flex; padding: 3px; background: var(--rule-soft); border-radius: 9px; }
.seg { border: 0; background: none; padding: 5px 12px; border-radius: 6px; font: 500 13px/1.3 var(--sans); color: var(--ink-2); cursor: pointer; }
.seg[aria-pressed='true'] { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 2px rgba(21, 32, 43, 0.12); }

.more { border-top: 1px solid var(--rule-soft); padding-top: 16px; }
.more > summary { cursor: pointer; color: var(--ink-2); font-size: 14px; width: fit-content; }
.more > summary:hover { color: var(--ink); }
.more[open] { display: grid; gap: 16px; }

.actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.form-msg { margin: 0; color: var(--bad); font-size: 14px; }
.form-msg:empty { display: none; }

.btn { border: 1px solid transparent; border-radius: var(--r-ctl); padding: 11px 20px; font: 500 15px/1.2 var(--sans); cursor: pointer; }
.btn:disabled { cursor: default; opacity: 0.6; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-deep); }
.btn-quiet { background: var(--sheet); color: var(--ink); border-color: var(--rule); }
.btn-quiet:hover:not(:disabled) { border-color: var(--ink-3); }

/* ---------- term sheet ---------- */
.sheet-slot:not(:empty) { margin-top: 20px; }
.sheet { padding: 28px 24px 24px; display: grid; gap: 24px; }
@media (prefers-reduced-motion: no-preference) {
  .sheet:not(.is-loading) { animation: arrive 260ms ease-out; }
  @keyframes arrive { from { opacity: 0; transform: translateY(6px); } }
}
.loading { margin: 0; color: var(--ink-2); }

.sheet-head { display: flex; align-items: center; gap: 16px; }
.coin-img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; background: var(--rule-soft); flex: none; }
.coin-name { margin: 0; font-size: 24px; line-height: 1.2; font-weight: 600; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.coin-sym { margin: 2px 0 0; color: var(--ink-2); }

.facts {
  margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px;
  padding: 18px 0; border-block: 1px solid var(--rule-soft);
}
.facts dt { color: var(--ink-2); font-size: 14px; padding-top: 1px; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ok { color: var(--ok); font-weight: 500; }
.bad { color: var(--bad); font-weight: 500; }

.sub { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.basket-block { display: grid; }

/* The signature: one segment per payout round, in order. */
.strip {
  list-style: none; margin: 0 0 18px; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 4px;
  counter-reset: round;
}
.strip-seg {
  counter-increment: round;
  position: relative; display: grid; justify-items: center; gap: 8px;
  padding: 14px 6px 10px; background: var(--blue-wash); border-radius: 4px;
  min-width: 0;
}
.strip-seg:first-child { border-radius: 10px 4px 4px 10px; }
.strip-seg:last-child { border-radius: 4px 10px 10px 4px; }
.strip-seg:only-child { border-radius: 10px; }
.strip-seg::before {
  content: counter(round);
  position: absolute; top: 5px; left: 7px;
  font-size: 11px; color: var(--ink-3);
}
.strip-mark { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--sheet); box-shadow: 0 0 0 2px var(--sheet); }
.strip-sym { max-width: 100%; font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mark-text {
  display: inline-grid; place-items: center; color: var(--ink-2);
  font-size: 12px; font-weight: 600; text-transform: uppercase; background: var(--rule-soft);
}

.holdings { width: 100%; border-collapse: collapse; font-size: 15px; }
.holdings th { text-align: left; font-size: 13px; font-weight: 500; color: var(--ink-2); padding: 0 8px 8px; border-bottom: 1px solid var(--rule); }
.holdings td { padding: 9px 8px; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
.holdings tr:last-child td { border-bottom: 0; }
.holdings .num { text-align: right; white-space: nowrap; }
.holdings .round { color: var(--ink-3); width: 1%; text-align: left; }
.holdings th:first-child, .holdings td:first-child { padding-left: 0; }
.holdings th:last-child, .holdings td:last-child { padding-right: 0; text-align: right; }
.tok { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; }
.mark { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; flex: none; }
.mark.mark-text { font-size: 9px; }

.dropped { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--rule-soft); }
.dropped .sub { margin-bottom: 8px; font-size: 14px; color: var(--ink-2); font-weight: 500; }
.dropped ul { margin: 0; padding: 0 0 0 18px; color: var(--ink-2); font-size: 14px; display: grid; gap: 2px; }
.dropped strong { color: var(--ink); font-weight: 500; }

.register { display: grid; gap: 10px; justify-items: start; padding-top: 4px; }
.notice { padding: 14px 16px; border-radius: 10px; background: var(--rule-soft); font-size: 15px; }
.notice.is-bad { background: var(--bad-wash); color: #7a3c08; }
.notice.is-ok { background: var(--ok-wash); color: #155a37; }
.result:empty { display: none; }

/* ---------- recent ---------- */
.recent-block { margin-top: 56px; }
.section-title { margin: 0 0 12px; font-size: 18px; font-weight: 600; }
.recent { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.recent-row { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.recent-img { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; background: var(--rule-soft); }
.recent-main { min-width: 0; }
.recent-name { font-weight: 500; color: var(--ink); text-decoration: none; }
.recent-name:hover { color: var(--blue); text-decoration: underline; }
.recent-basket { margin: 2px 0 0; color: var(--ink-2); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-at { color: var(--ink-3); font-size: 14px; white-space: nowrap; }
.recent-empty { padding: 16px 0; color: var(--ink-2); }

/* ---------- nav ---------- */
.nav { display: flex; gap: 4px; margin-right: auto; margin-left: 28px; }
.nav-link { padding: 6px 12px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 15px; font-weight: 500; }
.nav-link:hover { color: var(--ink); background: var(--rule-soft); }
.nav-link[aria-current='page'] { color: var(--ink); background: var(--sheet); box-shadow: inset 0 0 0 1px var(--rule); }

/* ---------- list builder ---------- */
.desk-wide { max-width: 1120px; }
.top { max-width: 1120px; }
.builder { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.catalog { padding: 18px 0 8px; display: grid; min-width: 0; }
.cat-tools { display: grid; gap: 12px; padding: 0 18px 14px; }
.cat-filters { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.field-sm { width: auto; padding: 7px 36px 7px 11px; font-size: 14px; }
.cat-head, .cat-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) 84px 84px 76px; align-items: center; gap: 12px; padding: 0 18px; }
.cat-head { grid-template-columns: minmax(0, 1fr) 84px 84px 76px; padding-bottom: 8px; border-bottom: 1px solid var(--rule); font-size: 13px; color: var(--ink-2); font-weight: 500; }
.cat-list { list-style: none; margin: 0; padding: 0; max-height: min(64vh, 720px); overflow-y: auto; }
.cat-row { padding-block: 9px; border-bottom: 1px solid var(--rule-soft); }
.cat-row[data-on='true'] { background: var(--blue-wash); }
.cat-row .mark { width: 26px; height: 26px; }
.cat-main { display: grid; min-width: 0; }
.cat-sym { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-name { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-num { text-align: right; font-size: 14px; white-space: nowrap; }
.cat-empty { padding: 24px 18px; color: var(--ink-2); }
.cat-note { padding: 12px 18px 6px; }
.pick { justify-self: end; min-width: 68px; padding: 6px 10px; border-radius: 7px; border: 1px solid var(--rule); background: var(--sheet); color: var(--ink); font: 500 13px/1.2 var(--sans); cursor: pointer; }
.pick:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.pick[aria-pressed='true'] { background: var(--blue); border-color: var(--blue); color: #fff; }
.pick:disabled { opacity: 0.4; cursor: default; }

.tray { position: sticky; top: 16px; padding: 20px; display: grid; gap: 16px; }
.tray-head { display: flex; align-items: baseline; justify-content: space-between; }
.tray-head .sub { margin: 0; }
.tray > .field-sm { width: 100%; }
.tray-count { color: var(--ink-2); font-size: 14px; }
.strip-compact { margin: 0; grid-template-columns: repeat(5, 1fr); }
.strip-compact .strip-seg { padding: 10px 4px 7px; gap: 5px; }
.strip-compact .strip-mark { width: 26px; height: 26px; }
.strip-compact .strip-seg, .strip-compact .strip-seg:first-child, .strip-compact .strip-seg:last-child { border-radius: 6px; }
.tray-list { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1px solid var(--rule-soft); }
.tray-item { display: grid; grid-template-columns: 20px 22px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--rule-soft); }
.tray-round { color: var(--ink-3); font-size: 13px; }
.tray-sym { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tray-tools { display: flex; gap: 2px; }
.icon-btn { width: 30px; height: 30px; border: 0; border-radius: 7px; background: none; color: var(--ink-2); font: 500 15px/1 var(--sans); cursor: pointer; }
.icon-btn:hover:not(:disabled) { background: var(--rule-soft); color: var(--ink); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.tray-empty { padding: 14px 0; color: var(--ink-2); font-size: 14px; }
.tray-actions { display: grid; gap: 10px; }
.tray-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.tray-btns .btn { flex: 1; padding-inline: 14px; }
.saved-block { border-top: 1px solid var(--rule-soft); padding-top: 14px; }
.saved-block .sub { margin-bottom: 6px; font-size: 14px; }
.saved { list-style: none; margin: 0; padding: 0; }
.saved-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule-soft); }
.saved-main { display: grid; min-width: 0; }
.saved-name { font-weight: 500; }
.saved-syms { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-tools { display: flex; gap: 12px; flex: none; font-size: 14px; }
.saved-empty { padding: 8px 0; color: var(--ink-2); font-size: 14px; }

@media (max-width: 900px) {
  .builder { grid-template-columns: 1fr; }
  .tray { position: static; order: -1; }
}
@media (max-width: 600px) {
  .top { flex-wrap: wrap; }
  .nav { order: 3; width: 100%; margin: 6px 0 0; }
  .cat-head, .cat-row { grid-template-columns: 26px minmax(0, 1fr) 74px 70px; padding-inline: 14px; gap: 10px; }
  .cat-head { grid-template-columns: minmax(0, 1fr) 74px 70px; }
  .cat-liq { display: none; }
  .cat-tools { padding-inline: 14px; }
  .tray { padding: 16px; }
}

/* ---------- sign-in gate ---------- */
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.gate-form { width: min(380px, 100%); display: grid; gap: 12px; }
.gate-form .wordmark { font-size: 22px; margin-bottom: 4px; }
.gate-form .wordmark-glyph { width: 32px; height: 32px; }
.gate-lede { margin: 0 0 12px; color: var(--ink-2); }
.gate-btn { width: 100%; padding: 13px 18px; }
.gate-msg { margin: 4px 0 0; color: var(--bad); font-size: 14px; }
.gate-msg:empty { display: none; }

/* ---------- small screens ---------- */
@media (max-width: 600px) {
  .top { padding: 16px 16px 0; }
  .desk { padding: 28px 16px 72px; }
  .title { font-size: 27px; }
  .lede { font-size: 16px; }
  .form, .sheet { padding: 20px 16px; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 10px; }
  .strip { grid-template-columns: repeat(5, 1fr); }
  .strip-seg, .strip-seg:first-child, .strip-seg:last-child { border-radius: 6px; }
  .holdings .addr { display: none; }
  .holdings th:nth-last-child(2), .holdings td:nth-last-child(2) { padding-right: 0; }
}
