/* The yRisk dashboard's tokens, type and tones on the stYFI page's single-page shape. */
:root {
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SF Mono", SFMono-Regular, ui-monospace, Menlo, Consolas, monospace;
  --bg: #f5f4f0; --surface: #fff; --hover: #f1f0eb; --selected: #e9e7e0; --inset: #f8f7f4;
  --ink: #090909; --text: #1a1a18; --text-2: #46453f; --muted: #6e6c64; --faint: #a19e95;
  --border: #e2e0d8; --border-soft: #edebe5; --border-strong: #c8c5bb; --focus: #0657f9;
  --shadow: 0 8px 24px #0909090d;
  --ok: #356447; --warn: #805d20; --bad: #a23f3b;
  /* Status at dot size: the brand values read near-black that small on paper. */
  --ok-mark: #4f9a6b; --warn-mark: #c4912f; --bad-mark: #c9534d;
  --accent: #0657f9;
  --top: 52px; --content: 1140px; --gutter: 28px;
  /* Level 1 depth: a hairline, a contact shadow and a soft ambient one; the card catches light at its top edge. */
  --card: 0 0 0 1px #09090912, 0 1px 1px #0909090a, 0 2px 4px -2px #0909090f, 0 14px 32px -18px #09090929;
  --card-top: #fff; --card-bottom: #fbfaf7; --card-shine: inset 0 1px 0 #fff;
  --track: #e8e7e3; --key: var(--surface); --key-edge: 0 0 0 1px #0909090d, 0 1px 2px #0909091f;
  --skeleton: #ecebe5; --skeleton-shine: #f6f5f1;
  font-family: var(--sans); font-size: 13px; font-synthesis: none; -webkit-font-smoothing: antialiased;
  color-scheme: light; color: var(--ink); background: var(--bg);
}
:root[data-theme=dark] {
  color-scheme: dark;
  --bg: #0c0c0b; --surface: #151514; --hover: #1d1d1b; --selected: #262624; --inset: #111110;
  --ink: #f5f4f0; --text: #ebeae5; --text-2: #bdbbb3; --muted: #97958c; --faint: #6c6a63;
  --border: #282826; --border-soft: #1f1f1d; --border-strong: #3e3d39; --focus: #7ba4fc;
  --shadow: 0 8px 28px #00000066;
  --ok: #6fbf8f; --warn: #d9a955; --bad: #e08a84;
  --ok-mark: #6fbf8f; --warn-mark: #d9a955; --bad-mark: #e08a84;
  --accent: #5b8ffb;
  --card: 0 0 0 1px #ffffff0a, 0 1px 2px #00000080, 0 16px 36px -18px #000000e6;
  --card-top: #1a1a19; --card-bottom: #151514; --card-shine: inset 0 1px 0 #ffffff12;
  --track: #1c1c1b; --key: #2c2c2a; --key-edge: inset 0 1px 0 #ffffff14, 0 1px 2px #00000080;
  --skeleton: #1e1e1c; --skeleton-shine: #2a2a27;
}
* { box-sizing: border-box; }
html { overflow-y: scroll; }
body { margin: 0; font-size: 13px; background: var(--bg); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, tr:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
svg { flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Top bar: brand on the left; data age and theme on the right, on the content column's edges. */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--top); padding: 0 max(var(--gutter), calc((100% - var(--content)) / 2));
  display: flex; align-items: center; gap: 16px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  transition: box-shadow .2s, border-color .2s;
}
.topbar.lifted { border-bottom-color: transparent; box-shadow: 0 1px 0 var(--border), 0 8px 20px -12px #09090933; }
:root[data-theme=dark] .topbar.lifted { box-shadow: 0 1px 0 var(--border), 0 10px 24px -12px #000000cc; }
.brand { display: inline-flex; gap: 5px; font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.brand-slash { color: var(--faint); font-weight: 400; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.freshness { display: flex; align-items: center; gap: 7px; height: 30px; padding: 0 8px; border-radius: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; cursor: default; }
.freshness:hover, .freshness[aria-expanded=true] { background: var(--hover); color: var(--text); }
/* The data-age menu: the snapshot's time, then the block each chain was read at. */
.pop-anchor { position: relative; }
.menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 45; min-width: 250px; padding: 6px; border: 1px solid var(--border); border-radius: 8px; background: color-mix(in srgb, var(--surface) 98%, transparent); backdrop-filter: saturate(1.6) blur(24px); -webkit-backdrop-filter: saturate(1.6) blur(24px); box-shadow: var(--shadow), 0 2px 6px #0909090f, var(--card-shine); animation: pop .12s ease-out; }
.menu[hidden] { display: none; }
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 5px 8px; border-radius: 5px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
a.menu-row:hover { background: var(--hover); color: var(--ink); }
.menu-row strong { font: 500 12px var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }
.menu-chain { display: inline-flex; align-items: center; gap: 8px; }
.menu-group { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--border-soft); }
.menu-label { padding: 2px 8px 3px; color: var(--muted); font-size: 11px; }
.menu-note { max-width: 260px; padding: 0 8px 5px 31px; font-size: 11px; line-height: 15px; white-space: normal; }
.menu-group > .menu-note:first-child { padding-left: 8px; padding-top: 3px; }
.live-dot { position: relative; width: 6px; height: 6px; border-radius: 50%; background: var(--ok-mark); }
.live-dot::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; background: var(--ok-mark); opacity: 0; }
.freshness.fresh .live-dot::after { animation: pulse 2.8s ease-out 3; }
.freshness.late .live-dot, .freshness.late .live-dot::after { background: var(--warn-mark); }
.freshness.down .live-dot { background: none; box-shadow: inset 0 0 0 1.5px var(--faint); }
@keyframes pulse { 0% { transform: scale(.6); opacity: .45; } 70%, 100% { transform: scale(1.9); opacity: 0; } }
.icon-button { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 5px; color: var(--muted); transition: background .15s, color .15s; }
.icon-button:hover { background: var(--hover); color: var(--text); }
.icon-sun, :root[data-theme=dark] .icon-moon { display: none; }
:root[data-theme=dark] .icon-sun { display: block; }

.shell { container: shell / inline-size; max-width: calc(var(--content) + 2 * var(--gutter)); margin: auto; padding: 0 var(--gutter) 48px; }

/* Strip: four plain figures, each label above its figure as a column header is. */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 20px; padding: 6px; border-radius: 10px; background: linear-gradient(var(--card-top), var(--card-bottom)); box-shadow: var(--card-shine), var(--card); }
.stat { position: relative; display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 10px 14px 9px; }
.stat + .stat::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 1px; background: var(--border-soft); }
.stat-label { font-size: 11px; line-height: 15px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat > strong { font: 500 20px/26px var(--mono); letter-spacing: -.5px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.stat > strong small { margin-left: 6px; font: 400 11px var(--sans); letter-spacing: 0; }

/* Tabs choose the table. A count is a plain figure. */
.toolbar { margin: 14px 0 10px; }
.view-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--border); }
.view-tabs button { margin-bottom: -1px; padding: 8px 0 9px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 13px; white-space: nowrap; transition: color .15s; }
.view-tabs button:hover { color: var(--text); }
.view-tabs button[aria-selected=true] { border-color: var(--accent); color: var(--ink); font-weight: 500; }
.tab-count { margin-left: 6px; color: var(--muted); font: 400 11px var(--mono); font-variant-numeric: tabular-nums; }

/* The table card. It never scrolls sideways: columns drop by priority instead, so the header can stick. */
.table-card { width: 100%; overflow: clip; border-radius: 10px; background: linear-gradient(var(--card-top), var(--surface) 64px); box-shadow: var(--card-shine), var(--card); }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { position: sticky; top: var(--top); z-index: 2; text-align: left; padding: 11px 8px 9px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--card-top) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: var(--muted); font-size: 11px; font-weight: 500; }
th.numeric { text-align: right; }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }
.sort-button { position: relative; display: inline-flex; align-items: center; font-weight: inherit; text-align: inherit; white-space: nowrap; }
th.numeric .sort-button { display: flex; justify-content: flex-end; width: 100%; }
.sort-button:hover, th[aria-sort] .sort-button { color: var(--text); }
.sort-indicator { position: absolute; left: 100%; margin-left: 3px; color: var(--faint); font-size: 11px; line-height: 10px; }
th.numeric .sort-indicator { position: static; order: -1; margin: 0 3px 0 0; }
th:not([aria-sort]) .sort-button:not(:hover) .sort-indicator { visibility: hidden; }
th[aria-sort] .sort-indicator { color: var(--accent); }
/* A header with a definition carries a small (i); the definition shows in a tip. */
.info { display: inline-flex; align-items: center; margin-left: 4px; color: var(--faint); cursor: help; transition: color .12s; }
.info svg { stroke-width: 1.3; }
.info .dot { fill: currentColor; stroke-width: 1.2; }
th:hover .info { color: var(--muted); }
.info:hover { color: var(--text); }
td { border-bottom: 1px solid var(--border-soft); padding: 6px 8px; font-size: 12px; height: 38px; color: var(--text); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.row { cursor: pointer; transition: background .12s; }
tbody tr.row:hover { background: var(--inset); }
tbody tr.is-open { background: var(--hover); }
tbody tr.is-open td:first-child, tr.detail td { box-shadow: inset 2px 0 var(--accent); }
td.numeric { text-align: right; font: 12px var(--mono); font-variant-numeric: tabular-nums; }
td.strong > .fig { font-weight: 600; color: var(--ink); }
.note { display: block; margin-top: 1px; color: var(--muted); font: 11px/14px var(--mono); }
.zero { color: var(--faint); font-weight: 400; }
/* Token icons sit in a side's token line, before the amount; several tokens overlap, each ringed by the row. */
.tk { display: inline-block; flex: none; width: 13px; height: 13px; margin-right: 5px; border-radius: 50%; object-fit: cover; vertical-align: -2px; background: var(--surface); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 8%, transparent); }
.tk-none { display: inline-grid; place-items: center; background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--text-2); font: 600 7.5px/1 var(--sans); box-shadow: none; }
.tk-stack { display: inline-flex; margin-right: 5px; vertical-align: -2px; cursor: default; }
.tk-stack .tk { margin-right: 0; box-shadow: 0 0 0 1.5px var(--surface); }
.tk-stack .tk + .tk { margin-left: -4px; }
tr.row:hover .tk-stack .tk { box-shadow: 0 0 0 1.5px var(--inset); }
tr.is-open .tk-stack .tk { box-shadow: 0 0 0 1.5px var(--hover); }
.word { color: var(--muted); font-family: var(--sans); font-weight: 400; }
.unit { margin-left: 4px; color: var(--muted); font-size: 11px; font-weight: 400; }
.t-bad { color: var(--bad); } .t-warn { color: var(--warn); }
.open-col, td.open-cell { width: 34px; padding: 0 12px 0 0; text-align: right; }
.open-cell svg { display: block; margin-left: auto; color: var(--faint); transition: color .12s, transform .15s; }
tr.row:hover .open-cell svg { color: var(--text); }
tr.is-open .open-cell svg { color: var(--text); transform: rotate(90deg); }
.empty { padding: 35px 8px; text-align: center; color: var(--muted); white-space: normal; }
.empty .retry { margin-left: 8px; padding: 3px 10px; border: 1px solid var(--border-strong); border-radius: 5px; color: var(--text); font-size: 12px; }

/* A loan is its chain, its pair and its protocol; its wallet moves under it once the wallet column has gone. */
.mk { display: flex; align-items: center; gap: 9px; min-width: 0; }
.mk-name { font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; }
.kind { color: var(--muted); font-size: 11px; white-space: nowrap; }
/* How many more tokens a side holds: a quiet neutral pill (an outline is a type mark), its tip naming them. */
.more { display: inline-block; margin: 0 1px 0 4px; padding: 0 5px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--muted); font: 500 10.5px/16px var(--mono); vertical-align: 1px; cursor: default; }
.sub-line .more { padding: 0 4px; font-size: 10px; line-height: 14px; vertical-align: 0; }
.cl { width: 15px; height: 15px; flex: none; }
.sub-line { display: none; margin-top: 1px; padding-left: 24px; color: var(--muted); font-size: 11px; line-height: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub-line.always { display: block; padding-left: 0; }
.sub-kind { display: none; }
.sd { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--warn-mark); }
.dot-tip { display: inline-flex; flex: none; padding: 5px; margin: -5px; cursor: default; }
.address-link { font: 12px var(--mono); color: var(--text); }
.address-link.named { font-family: var(--sans); }
a.address-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.address-line { display: inline-flex; align-items: center; max-width: 100%; white-space: nowrap; }
/* Copy sits beside an address: shown with its row under a mouse, always on touch. */
.copy-trigger { position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-left: 4px; color: var(--faint); }
.copy-trigger:hover, .copy-trigger:focus-visible { color: var(--text); }
tbody .copy-trigger { opacity: 0; transition: opacity .12s; }
tbody tr:hover .copy-trigger, tbody .copy-trigger:focus-visible, tbody .copy-trigger.is-copied { opacity: 1; }
.copy-icon { position: relative; display: block; width: 14px; height: 14px; }
.copy-glyph, .check-glyph { position: absolute; inset: 0; width: 14px; height: 14px; stroke-width: 1.4; transition: opacity .15s, transform .15s; }
.copy-front { fill: var(--surface); }
tr:hover .copy-front { fill: var(--inset); }
.check-glyph { opacity: 0; transform: scale(.8); }
.copy-trigger.is-copied { color: var(--ok); }
.copy-trigger.is-copied .copy-glyph { opacity: 0; transform: scale(.8); }
.copy-trigger.is-copied .check-glyph { opacity: 1; transform: scale(1); }
/* The protocol's own page for the position: the one outbound mark in a row. */
.app-link { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 18px; height: 18px; margin-left: -5px; border-radius: 4px; color: var(--faint); transition: color .12s, background .12s; }
.app-link svg { stroke-width: 1.5; }
.app-link:hover, .app-link:focus-visible { color: var(--accent); background: var(--hover); }
.via { margin-left: 6px; color: var(--muted); font-size: 11px; }

/* A loan's detail opens under its row: each token on one line, and why anything is missing. */
tr.detail td { height: auto; padding: 0; background: var(--inset); white-space: normal; cursor: default; }
.detail-body { display: flex; flex-wrap: wrap; gap: 10px 56px; padding: 10px 16px 12px 52px; }
.side h3 { margin: 0 0 3px; color: var(--muted); font-size: 11px; font-weight: 500; }
.tok-list { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; column-gap: 12px; row-gap: 2px; align-items: baseline; font: 12px/18px var(--mono); font-variant-numeric: tabular-nums; }
.tok-list .amt { text-align: right; color: var(--text); }
.tok-list .sym { font-family: var(--sans); color: var(--text); }
.tok-list .val { text-align: right; color: var(--text-2); padding-left: 8px; }
.tok-list .meta { color: var(--muted); font-size: 11px; }
.crumbs { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.reasons { flex-basis: 100%; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 11px; line-height: 16px; }
.reasons.t-warn { color: var(--warn); }

/* Under the table: a checkbox that adds the rows hidden by default, with what it would add. */
.table-foot { display: flex; min-height: 26px; margin-top: 8px; padding-left: 11px; }
.check { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 8px 0 6px; border-radius: 5px; color: var(--muted); font-size: 12px; white-space: nowrap; transition: background .15s, color .15s; }
.check:hover { background: var(--hover); color: var(--text); }
.check[aria-checked=true] { color: var(--ink); }
.check i { display: grid; place-items: center; width: 13px; height: 13px; border: 1px solid var(--border-strong); border-radius: 3.5px; }
.check i::after { content: ""; width: 7px; height: 3.5px; margin-top: -2px; border: solid var(--ink); border-width: 0 0 1.5px 1.5px; opacity: 0; transform: rotate(-45deg); }
.check[aria-checked=true] i { background: var(--selected); }
.check[aria-checked=true] i::after { opacity: 1; }
.check-n { color: var(--faint); font: 11px var(--mono); }


/* A tip: a definition, or what a mark means. A surface of the theme, like a menu. */
.tip { position: fixed; z-index: 60; max-width: min(260px, calc(100vw - 24px)); padding: 6px 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); font-size: 12px; line-height: 16px; white-space: pre-line; box-shadow: var(--shadow), 0 2px 6px #0909090f; pointer-events: none; animation: pop .12s ease-out; }
.tip::after { content: ""; position: absolute; left: var(--ax, 50%); width: 9px; height: 9px; margin-left: -4.5px; border: 1px solid var(--border); border-radius: 0 0 2px 0; background: inherit; transform: rotate(45deg); }
.tip.over::after { bottom: -5.5px; border-top-color: transparent; border-left-color: transparent; }
.tip.under::after { top: -5.5px; border-bottom-color: transparent; border-right-color: transparent; border-radius: 2px 0 0 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }

/* Placeholder rows shimmer while the snapshot loads. */
tr.skeleton td { height: 38px; }
tr.skeleton td:nth-child(n+2) span { width: 55%; margin-left: auto; }
tr.skeleton span { display: block; height: 7px; border-radius: 4px; background: linear-gradient(100deg, var(--skeleton) 40%, var(--skeleton-shine) 50%, var(--skeleton) 60%) 0 0 / 300% 100% fixed; animation: shimmer 1.8s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }

/* Columns drop by priority to the room the list has: md first, then lo, then xs. */
@container shell (max-width: 900px) { .md { display: none !important; } }
@container shell (max-width: 660px) { .lo { display: none !important; } .sub-line { display: block; } }
/* A phone keeps the loan (its wallet and protocol under it), debt and price buffer. */
@container shell (max-width: 480px) {
  .xs, .mk .kind, td.numeric .note { display: none !important; }
  .sub-kind { display: inline; }
  th .sort-button { white-space: normal; line-height: 13px; }
  th.numeric .sort-button { text-align: right; }
  .mk-name, .sub-line { white-space: normal; overflow-wrap: anywhere; }
  td:first-child { width: 100%; }
}
@media (max-width: 1250px) { :root { --gutter: 20px; } }
@media (max-width: 700px) {
  :root { --gutter: 16px; }
  .topbar { padding: 0 10px 0 16px; gap: 8px; }
  .freshness { padding: 0 6px; }
  .stats { margin-top: 14px; padding: 3px; }
  .stat { padding: 7px 10px 6px; }
  .stat > strong { font-size: 17px; line-height: 22px; }
  th, td { padding-left: 6px; padding-right: 6px; }
  th:first-child, td:first-child { padding-left: 12px; }
  td { height: 44px; }
  .open-col, td.open-cell { width: 24px; padding-right: 8px; }
  .detail-body { padding: 10px 12px 12px 14px; gap: 10px; }
  .menu { position: fixed; top: 52px; right: 8px; }
  .table-foot { padding-left: 5px; }
}
@media (hover: none) { .freshness:hover { background: none; } tbody .copy-trigger { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
