/* Shared components and the shell. One look everywhere: screens use these classes and add only layout. */

/* ---- shell: sidebar, phone top bar, page column, footer ------------------------------------------ */
.side {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: 64px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 18px 0 16px;
  background: var(--bg);
}
/* the white mark on a crimson tile, so it reads in both themes */
.logo-tile { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--brand); }
.logo-tile img { width: 31px; height: 31px; }
.side-logo { margin-bottom: 14px; }
/* hidden until a keyboard user tabs onto it */
.skip { position: fixed; left: 12px; top: 12px; z-index: 100; padding: 10px 16px; border: 0; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 600; transform: translateY(-300%); }
.skip:focus { transform: none; }
.side-gap { flex: 1; }
.side-btn {
  position: relative;
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 12px;
  border: 0; background: transparent; color: var(--muted);
  transition: background-color .15s, color .15s;
}
.side-btn:hover { background: var(--hover); color: var(--text); }
.side-btn[aria-current="page"] { background: var(--active); color: var(--text); }
.side-btn[aria-current="page"]::before {
  content: ""; position: absolute; left: -10px; top: 10px; bottom: 10px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.side-btn.is-search { background: var(--surface-2); color: var(--text); }
.side-btn .dot, .top-btn .dot {
  position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--up); box-shadow: 0 0 0 2px var(--bg);
}

.main { margin-left: 64px; min-height: 100vh; display: flex; flex-direction: column; }
.page { width: 100%; max-width: 1216px; margin: 0 auto; padding: 40px 32px 72px; flex: 1; }
.page:focus { outline: none; }

.top { display: none; }
.top-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.top-brand .logo-tile { width: 34px; height: 34px; border-radius: 10px; }
.top-brand .logo-tile img { width: 25px; height: 25px; }
.top-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.top-btn {
  position: relative; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 999px;
  border: 0; background: transparent; color: var(--text);
}
.top-btn:hover { background: var(--hover); }
.top-btn.is-search { background: var(--surface-2); }

.foot {
  width: 100%; max-width: 1216px; margin: 0 auto;
  padding: 24px 32px 40px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 32px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted); font-size: 13px;
}
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.foot a:hover { color: var(--text); }

@media (max-width: 767px) {
  .side { display: none; }
  .top {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: 12px;
    height: 60px; padding: 0 12px 0 20px;
    background: var(--bg);
  }
  .main { margin-left: 0; min-height: calc(100vh - 60px); }
  .page { padding: 16px 20px 56px; }
  .foot { padding: 20px 20px 32px; }
}

/* ---- page head ------------------------------------------------------------------------------------ */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 32px; }
.page-head-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.back-link:hover { color: var(--text); }

/* ---- buttons -------------------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px;
  border-radius: 12px; border: 1px solid transparent;
  font-size: 15px; font-weight: 600; line-height: 1; white-space: nowrap;
  text-decoration: none; user-select: none;
  transition: background-color .15s, color .15s, border-color .15s, opacity .15s;
}
.btn-brand { background: var(--brand); color: var(--on-brand); }
.btn-brand:hover { background: var(--brand-hover); }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: color-mix(in srgb, var(--text) 86%, var(--bg)); }
.btn-neutral { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn-neutral:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--hover); }
.btn-buy { background: var(--up); color: var(--on-up); }
.btn-buy:hover { background: color-mix(in srgb, var(--up) 88%, var(--text)); }
.btn-sell { background: var(--down); color: var(--on-down); }
.btn-sell:hover { background: color-mix(in srgb, var(--down) 88%, var(--text)); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn-block { display: flex; width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn-icon.btn-sm { width: 36px; }
.btn-round { border-radius: 999px; }

.link { color: var(--text); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.link:hover { text-decoration-color: currentColor; }
.icon-btn {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  border: 0; background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }

/* ---- fields --------------------------------------------------------------------------------------- */
.field { display: grid; gap: 8px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.input, .textarea, .select {
  width: 100%; height: 44px; padding: 0 14px;
  border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text);
  font-size: 15px;
  transition: border-color .15s;
}
.textarea { height: auto; min-height: 96px; padding: 12px 14px; line-height: 1.5; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .textarea:hover { border-color: color-mix(in srgb, var(--line) 50%, var(--muted)); }
.input:focus-visible, .textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; border-radius: 14px; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--down); }
.field-foot { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); }
.field-error { color: var(--down); }

/* ---- pay box -------------------------------------------------------------------------------------- */
.paybox {
  display: grid; gap: 12px;
  padding: 14px 16px 16px;
  border-radius: 14px; border: 1px solid var(--line-soft);
  background: var(--surface-2);
  transition: border-color .15s;
}
.paybox:focus-within { border-color: var(--muted); }
.paybox-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.paybox-row { display: flex; align-items: center; gap: 12px; }
.paybox-input {
  flex: 1; min-width: 0; padding: 0; border: 0; background: none;
  font-size: 30px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums;
}
.paybox-input:focus-visible { outline: none; }
.paybox-input::placeholder { color: var(--faint); }
.paybox-unit { font-size: 18px; font-weight: 600; white-space: nowrap; }
.paybox-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 28px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 500;
  transition: background-color .15s, color .15s, border-color .15s;
}
.chip:hover { color: var(--text); background: var(--hover); }
.chip[aria-pressed="true"] { color: var(--text); border-color: var(--text); }

/* ---- cards ---------------------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--card-line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 24px;
}
.card-tight { padding: 16px; }
a.card { display: block; transition: border-color .15s, background-color .15s; }
a.card:hover { border-color: var(--muted); }
[data-theme="light"] a.card:hover { box-shadow: 0 1px 2px rgba(22,18,19,.05), 0 12px 32px rgba(22,18,19,.1); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 16px 24px; }
.stat { display: grid; gap: 4px; min-width: 0; }
.stat-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ---- segmented control and tabs ------------------------------------------------------------------- */
.seg {
  display: inline-flex; gap: 2px; padding: 4px;
  border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-soft);
}
.seg-btn {
  min-height: 34px; padding: 0 14px;
  border: 0; border-radius: 9px; background: transparent; color: var(--muted);
  font-size: 14px; font-weight: 500; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background-color .15s, color .15s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed="true"], .seg-btn[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
[data-theme="dark"] .seg-btn[aria-pressed="true"], [data-theme="dark"] .seg-btn[aria-selected="true"] { background: var(--line); }
.seg-full { display: flex; width: 100%; }
.seg-full .seg-btn { flex: 1; min-height: 40px; font-size: 15px; }
.seg-btn.is-buy[aria-pressed="true"] { color: var(--up); }
.seg-btn.is-sell[aria-pressed="true"] { color: var(--down); }
.seg-icon .seg-btn { width: 34px; padding: 0; }

.tabs {
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--line);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; flex: none;
  height: 44px; padding: 0 10px;
  border: 0; background: none; color: var(--muted);
  font-size: 15px; font-weight: 500; white-space: nowrap;
  transition: color .15s;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--text); }

/* ---- pills, ticker, rank -------------------------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap;
}
.pill-brand { border-color: color-mix(in srgb, var(--brand) 40%, transparent); background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand-text); }
.pill-up { border-color: transparent; background: color-mix(in srgb, var(--up) 14%, transparent); color: var(--up); }
.tk { color: var(--muted); font-weight: 400; }

.rk-0 { --rk: var(--muted); }
.rk-1 { --rk: var(--text); }
.rk-2 { --rk: var(--lord); }
.rk-3 { --rk: var(--brand); }
.rank {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--rk) 40%, transparent);
  background: color-mix(in srgb, var(--rk) 9%, transparent);
  color: var(--rk);
  font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap;
}
.rank.rk-0 { border-color: var(--line); background: transparent; }
.rank.rk-3 { color: var(--brand-text); }
.rank b { font-weight: 600; opacity: .75; }

.rankprog { display: grid; gap: 6px; min-width: 0; }
.rankbar { height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; }
.rankbar > i { display: block; height: 100%; width: calc(var(--k, 0) * 100%); border-radius: inherit; background: var(--rk, var(--text)); transition: width .15s; }
.rankprog.rk-0 .rankbar > i { background: var(--muted); }
.rankprog-text { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ---- tables and list rows ------------------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  padding: 10px 8px; text-align: left; white-space: nowrap;
  font-size: 13px; font-weight: 500; color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.table td { padding: 12px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr { transition: background-color .15s; }
.table tbody tr:hover { background: var(--hover); }
.table-wrap { overflow-x: auto; }

.lrow {
  display: flex; align-items: center; gap: 14px;
  min-height: 64px; padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  color: inherit; text-decoration: none;
  transition: background-color .15s;
}
.lrow:hover { background: var(--hover); }
.lrow-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.lrow-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 16px; font-weight: 500; }
.lrow-title > :first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow-sub { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--muted); }
.lrow-end { text-align: right; font-variant-numeric: tabular-nums; }

.creator { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.creator span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- images: token tiles, identicons, sparklines -------------------------------------------------- */
.av {
  --s: 40px;
  width: var(--s); height: var(--s); flex: none;
  border-radius: 12px; overflow: hidden; object-fit: cover;
  background: var(--surface-2);
}
.av-letter {
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: calc(var(--s) * .42); line-height: 1;
  user-select: none;
}
.ident { flex: none; border-radius: 3px; }
.spark { display: block; overflow: visible; }
.spark path { fill: none; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark.is-up path { stroke: var(--up); }
.spark.is-down path { stroke: var(--down); }

/* ---- toasts --------------------------------------------------------------------------------------- */
.toasts {
  position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translateX(-50%);
  display: grid; justify-items: center; gap: 8px; pointer-events: none;
  width: max-content; max-width: calc(100vw - 32px);
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 14px;
  background: var(--text); color: var(--bg);
  font-size: 14px; font-weight: 500;
  box-shadow: var(--pop-shadow);
  opacity: 0; transition: opacity .15s;
  pointer-events: auto;
}
.toast.on { opacity: 1; }
.toast .ok { color: var(--up); }
[data-theme="dark"] .toast .ok { color: #11a85a; }
.toast .err { color: var(--down); }
[data-theme="dark"] .toast .err { color: #e5484d; }

/* ---- modal panel ---------------------------------------------------------------------------------- */
.scrim {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px;
  background: var(--scrim);
  opacity: 0; transition: opacity .15s;
}
.scrim.on { opacity: 1; }
.modal {
  width: min(560px, 100%); max-height: 76vh;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--pop-shadow);
}
.modal-body { padding: 20px 24px 24px; overflow: auto; }
@media (max-width: 767px) {
  .scrim.full { padding: 0; }
  .scrim.full .modal { width: 100%; height: 100%; max-height: none; border-radius: 0; border: 0; }
}

/* ---- search panel --------------------------------------------------------------------------------- */
.search-bar { display: flex; align-items: center; gap: 10px; padding: 0 12px 0 18px; height: 60px; border-bottom: 1px solid var(--line-soft); color: var(--muted); }
.search-input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; font-size: 17px; color: var(--text); }
.search-input:focus-visible { outline: none; }
.search-input::placeholder { color: var(--faint); }
.kbd { display: inline-grid; place-items: center; min-width: 26px; height: 24px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.search-results { overflow-y: auto; padding: 8px; }
.search-note { padding: 8px 12px 6px; font-size: 13px; color: var(--muted); }
.search-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 8px 12px; min-height: 52px;
  border: 0; border-radius: 12px; background: transparent; text-align: left;
}
.search-item[aria-selected="true"] { background: var(--active); }
.search-item .lrow-title { font-size: 15px; }
.search-empty { padding: 28px 12px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---- menus and tooltips --------------------------------------------------------------------------- */
.menu {
  position: fixed; z-index: 90;
  min-width: 260px; max-width: calc(100vw - 24px);
  padding: 6px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--pop-shadow);
  opacity: 0; transition: opacity .15s;
}
.menu.on { opacity: 1; }
.menu-head { padding: 12px 12px 10px; display: grid; gap: 4px; }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 44px; padding: 8px 12px;
  border: 0; border-radius: 10px; background: none; color: var(--text);
  font-size: 14px; font-weight: 500; text-align: left; text-decoration: none;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); outline-offset: -2px; }
.menu-item:disabled { opacity: .5; cursor: not-allowed; }
.menu-item:disabled:hover { background: none; }
.menu-item > svg { flex: none; color: var(--muted); }
.menu-item small { display: block; margin-top: 1px; font-size: 12px; font-weight: 400; color: var(--muted); }
.menu-sep { height: 1px; margin: 6px 6px; background: var(--line-soft); }

[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%); z-index: 60;
  padding: 7px 10px; border-radius: 8px;
  background: var(--text); color: var(--bg);
  font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; }
[data-tip][data-tip-pos="top"]::after { left: 50%; top: auto; bottom: calc(100% + 8px); transform: translateX(-50%); }
[data-tip][data-tip-pos="bottom"]::after { left: 50%; top: calc(100% + 8px); transform: translateX(-50%); }
[data-tip][data-tip-pos="left"]::after { left: auto; right: calc(100% + 10px); }
@media (hover: none) { [data-tip]::after { display: none; } }

/* ---- loading and empty ---------------------------------------------------------------------------- */
.skel { display: block; border-radius: 8px; background: var(--surface-2); color: transparent; user-select: none; }
.skel-line { height: 14px; }
.skel-row { height: 64px; border-radius: 0; border-bottom: 1px solid var(--line-soft); background: transparent; display: flex; align-items: center; gap: 14px; padding: 0 12px; }
.skel-row::before { content: ""; width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); }
.skel-row::after { content: ""; width: 38%; height: 14px; border-radius: 6px; background: var(--surface-2); }

.empty {
  display: grid; justify-items: center; gap: 10px;
  padding: 64px 16px; text-align: center; color: var(--muted);
}
.empty-title { color: var(--text); font-size: 20px; font-weight: 600; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; }

/* ---- contract address chip in the footer (value from the admin, see src/siteconfig.js) -------------- */
.ca-chip {
  display: inline-flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px 0 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  color: var(--text); font: 500 13px/1 "Geist Mono", ui-monospace, monospace; cursor: pointer;
}
.ca-chip b { color: var(--brand-text); font-weight: 500; letter-spacing: .08em; }
.ca-chip svg { width: 16px; height: 16px; color: var(--muted); }
.ca-chip:hover:not(:disabled) { border-color: var(--text); }
.ca-chip:hover:not(:disabled) svg { color: var(--text); }
.ca-chip:disabled { cursor: default; }
.ca-chip.is-soon .ca-v { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.ca-chip.is-soon svg { display: none; }
