/* =====================================================================================================
   Stillwater: design system and desk shell

   Calm, deep, exact: flat water at night. Dark by default, light through prefers-color-scheme. Colours are
   tokens on :root; page stylesheets (pages-a.css, pages-b.css) use the tokens, never raw colours.
   Serif (--serif) for the wordmark and titles, system sans (--sans) for UI, --mono for addresses, and
   tabular figures wherever numbers line up. 1px hairlines, 10-12px radii, accent used sparingly.

   LAYOUT
     .sw-wrap                  the page column; main#sw-page has it (max 1180px, 16px gutters on phones)
     .sw-page-title            <header class="sw-page-title"><h1>…</h1><p>…</p><div class="sw-actions">…</div></header>
                               (h1 and p may also sit together in one <div>; .sw-actions is optional)
     .sw-kicker                small line above a title
     .sw-section               a block of the page, spaced from the one before
     .sw-section-head          <div class="sw-section-head"><h2 class="sw-h2">…</h2> …links or tools…</div>
     .sw-h2                    section title (serif); <small> inside for a count
     .sw-grid                  main column + rail: <div class="sw-grid"><div>…</div><aside class="sw-rail">…</aside></div>
     .sw-rail                  stacked panels beside the main column (below it under 960px)
     .sw-center                centred block for welcomes, empty states and errors
     .sw-stack / .sw-flex      vertical stack with gaps / a wrapping row with gaps (.sw-spread: space-between)

   PANELS AND STATS
     .sw-panel                 a surface with a hairline border; <h3> inside is its title
     .sw-stats > .sw-stat      <div class="sw-stat"><span class="sw-label">Open offers</span><b>12</b><span>sub line</span></div>
     .sw-lines                 <dl class="sw-lines"><div><dt>You pay</dt><dd>1.2 SOL<small>$115</small></dd></div>…</dl>
     .sw-note                  a quiet tinted note (.sw-note-warn for a caution)
     .sw-steps                 <ol class="sw-steps"><li><b>Title</b> text</li>…</ol>, numbered steps
     .sw-prose                 long-form text (docs): headings, lists, code, tables

   TABLES
     .sw-table-wrap            scroll container with the border; tables scroll inside it on phones
     .sw-table                 cells are right-aligned numbers; add .sw-l to a th/td for left-aligned text
     tr.sw-row                 a clickable row
     td.sw-empty-cell          one cell spanning the table (ui.emptyRow); text in a <span> stays in view when it scrolls
     tr.sw-day                 a group header row: <tr class="sw-day"><td colspan="6">Today</td></tr>
     th > button               a sortable header; th[aria-sort] marks the active one
     .sw-rank                  a faint rank number

   COINS
     .sw-coin                  <a class="sw-coin">logo + .sw-coin-text (.sw-coin-sym with <b>SYM</b> and tags, <small>sub</small>)</a>
     .sw-logo                  a round coin logo (<img> or <svg>); .sw-logo-none is the letter fallback

   TAGS
     .sw-tag                   small caps label; .sw-tag-bid, .sw-tag-ask, .sw-tag-private, .sw-tag-house,
                               .sw-tag-unverified (a coin Jupiter hasn't verified)
     .sw-status                dot + word; .sw-status-open, -filled, -cancelled, -expired

   TEXT
     .sw-hint .sw-faint .sw-mute .sw-up .sw-down .sw-warn .sw-accent .sw-mono .sw-tnum .sw-break
     .sw-two                   a value with a second line: <td class="sw-two">1.2 SOL<small>$115</small></td>
     .sw-link                  accent link (also on a <button>)
     .sw-error                 an error line (hidden while empty)
     .sw-sr                    visually hidden, still read aloud

   CONTROLS
     .sw-btn                   primary button (accent); .sw-btn-line outlined; .sw-btn-quiet bare;
                               .sw-btn-danger; .sw-btn-small; .sw-btn-wide (full width, taller)
     .sw-pills                 <div class="sw-pills"><button class="sw-on" data-v="a">A</button>…</div>; <small> for counts
     .sw-tabs                  underlined tabs, same markup as pills
     .sw-search                <label class="sw-search">SEARCH_ICON<input type="search" placeholder="…"></label>
     .sw-input                 text input, select or textarea
     .sw-input-row             input + button side by side (copy fields, Max buttons)
     .sw-field                 <label class="sw-field"><span>Amount</span><input class="sw-input"></label>
     .sw-check                 <label class="sw-check"><input type="checkbox"> Partial fills</label>
     .sw-tools                 toolbar row above a table; .sw-tools-right pushes its content right
     .sw-pager                 page buttons (ui.pager fills it)

   MODALS (core.openModal)
     #sw-modal-root > .sw-modal-back > .sw-modal (h2, p, pre, .sw-lines, .sw-modal-actions)
     .sw-choices               large choice buttons: <button>icon<span class="sw-choice-text">Title<small>sub</small></span></button>

   THE REST
     .sw-meter                 20-cell meter (ui.meter); .sw-mini life bar (ui.lifeBar); .sw-chart impact chart
                               (ui.impactChart); .sw-loading; .sw-banner; .sw-top (top bar); .sw-foot (footer)
   ===================================================================================================== */

:root {
  color-scheme: dark;
  --bg: #0a1214;
  --surface: #0f1a1d;
  --panel: #12201f;
  --line: #1d2d30;
  --line-2: #2a3e41;
  --ink: #e6eeeb;
  --mute: #9db0ab;
  --faint: #687c78;
  --accent: #7fd1c1;
  --accent-ink: #04201b;
  --up: #6fd49a;
  --down: #ef7b7b;
  --warn: #e6c36a;

  --accent-hover: #98dccf;
  --accent-soft: rgba(127, 209, 193, 0.1);
  --up-soft: rgba(111, 212, 154, 0.12);
  --down-soft: rgba(239, 123, 123, 0.12);
  --warn-soft: rgba(230, 195, 106, 0.1);
  --hover: rgba(230, 238, 235, 0.035);
  --top-bg: rgba(10, 18, 20, 0.86);
  --scrim: rgba(3, 8, 9, 0.7);
  --shadow: 0 24px 56px -24px rgba(0, 0, 0, 0.7);

  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --r: 12px;
  --r-sm: 10px;
  --r-xs: 7px;
  --max: 1180px;
  --gut: 24px;
  --top-h: 60px;
  --top-total: 61px;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f4f3ee;
    --surface: #fbfaf7;
    --panel: #ffffff;
    --line: #e2e0d8;
    --line-2: #cfccc1;
    --ink: #0f1b1d;
    --mute: #4f5f5c;
    --faint: #8a9794;
    --accent: #0e6b60;
    --accent-ink: #ffffff;
    --up: #127a44;
    --down: #b3261e;
    --warn: #8a6a14;

    --accent-hover: #0b5950;
    --accent-soft: rgba(14, 107, 96, 0.08);
    --up-soft: rgba(18, 122, 68, 0.09);
    --down-soft: rgba(179, 38, 30, 0.08);
    --warn-soft: rgba(138, 106, 20, 0.09);
    --hover: rgba(15, 27, 29, 0.03);
    --top-bg: rgba(244, 243, 238, 0.88);
    --scrim: rgba(15, 27, 29, 0.3);
    --shadow: 0 24px 56px -24px rgba(15, 27, 29, 0.3);
  }
}

@media (max-width: 1140px) {
  :root { --top-total: 101px; }
}

@media (max-width: 640px) {
  :root { --gut: 16px; }
}

/* ------------------------------------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--line-2) transparent;
  scrollbar-gutter: stable;
  scroll-padding-top: calc(var(--top-total) + 16px);
}

html.sw-locked { overflow: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* A safety net: nothing on a desk page should ever scroll the page sideways. */
  overflow-x: clip;
}

h1, h2, h3, h4 { margin: 0; font-weight: 500; line-height: 1.2; }
p, ol, ul, dl, figure { margin: 0; }
a { color: inherit; }
img, svg { vertical-align: middle; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
code {
  font: 0.9em/1 var(--mono);
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
}
hr, .sw-hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
::selection { background: rgba(127, 209, 193, 0.28); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

.sw-skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: var(--r-xs);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
}
.sw-skip:focus { top: 12px; }

.sw-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.sw-icon { flex: none; }

/* ----------------------------------------------------------------------------------------- banner */

.sw-banner {
  padding: 8px var(--gut);
  border-bottom: 1px solid var(--line);
  background: var(--warn-soft);
  color: var(--mute);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  text-wrap: balance;
}
.sw-banner b { color: var(--warn); font-weight: 600; }
.sw-banner a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.sw-banner a:hover { color: var(--ink); text-decoration-color: currentColor; }
.sw-banner-live { background: transparent; color: var(--faint); font-size: 12.5px; padding-block: 6px; }
.sw-banner-warn { background: var(--down-soft); color: var(--ink); }

/* -------------------------------------------------------------------------------------------- top bar */

.sw-top {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: var(--top-bg);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
}

.sw-top-in {
  display: flex;
  align-items: center;
  gap: 0 28px;
  max-width: var(--max);
  min-height: var(--top-h);
  margin: 0 auto;
  padding: 0 var(--gut);
}

.sw-brand {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font: 400 20px/1 var(--serif);
  letter-spacing: 0.005em;
  text-decoration: none;
  white-space: nowrap;
}
.sw-brand .sw-mark { color: var(--accent); }

.sw-nav {
  display: flex;
  flex: 1;
  align-self: stretch;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  /* If the links ever outgrow the bar, they scroll rather than run under the wallet button. */
  overflow-x: auto;
  scrollbar-width: none;
}
.sw-nav::-webkit-scrollbar { display: none; }
.sw-nav a {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: var(--mute);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}
.sw-nav a:hover { color: var(--ink); }
.sw-nav a[aria-current="page"] { color: var(--ink); }
.sw-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 0;
  left: 10px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
}
.sw-nav a:focus-visible { outline-offset: -4px; border-radius: var(--r-xs); }

.sw-top-right {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.sw-top .sw-btn { height: 36px; }

.sw-sol {
  color: var(--faint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sw-sol b { color: var(--ink); font-weight: 500; }

.sw-connected { gap: 8px; }
.sw-connected .sw-mono { font-size: 13px; }
.sw-dot {
  display: inline-block;
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.sw-dot-practice { background: var(--warn); }

/* Narrower screens: brand and wallet on one row, the nav on a scrolling row below. A grid rather than a
   wrapping flex row, so a long wallet label shrinks instead of pushing the buttons onto a row of their own. */
@media (max-width: 1140px) {
  .sw-top-in {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "brand right" "nav nav";
    gap: 0 12px;
    min-height: 0;
  }
  .sw-brand { grid-area: brand; height: 56px; }
  .sw-top-right { grid-area: right; justify-content: flex-end; min-width: 0; gap: 8px; }
  .sw-top .sw-connected { flex: 0 1 auto; min-width: 0; }
  .sw-connected .sw-mono { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .sw-nav {
    grid-area: nav;
    height: 44px;
    margin: 0 calc(-1 * var(--gut));
    padding: 0 calc(var(--gut) - 10px);
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 560px) {
  .sw-sol { display: none; }
}

@media (max-width: 440px) {
  .sw-wide-only { display: none; }
  .sw-brand { font-size: 17px; gap: 8px; }
  .sw-top-right, .sw-connected { gap: 6px; }
  .sw-top .sw-btn { padding: 0 10px; font-size: 13px; }
  .sw-connected .sw-mono { font-size: 12.5px; }
}

/* ------------------------------------------------------------------------------------------- layout */

main { flex: 1 0 auto; }
#sw-page:focus { outline: none; }

.sw-wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 40px var(--gut) 80px;
}

/* Moving from one document to the other (the front page and the desk) fades the page being left to the background
   (html.sw-leaving, set by js/leave.js just before the browser moves on). A desk page loaded afresh stays hidden by
   the small style in app.html until its first page is drawn, then appears whole. */
html { background: var(--bg); }
body { transition: opacity 0.15s ease-in; }
html.sw-leaving body { opacity: 0; }

/* A page fades in as it first writes its content (app.js adds .sw-view-in), not when its empty column appears. */
.sw-view-in { animation: sw-fade 0.2s ease-out both; }

.sw-page-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0 24px;
  margin-bottom: 32px;
}
.sw-page-title > :not(.sw-actions) { grid-column: 1; }
.sw-page-title > .sw-actions { grid-column: 2; grid-row: 1 / span 3; align-self: end; }
.sw-page-title h1 {
  font: 400 38px/1.1 var(--serif);
  letter-spacing: -0.012em;
  text-wrap: balance;
}
.sw-page-title p {
  max-width: 64ch;
  margin-top: 10px;
  color: var(--mute);
  font-size: 15.5px;
  text-wrap: pretty;
}
.sw-kicker {
  display: block;
  margin-bottom: 8px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sw-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.sw-section { margin-top: 48px; }
.sw-section:first-child { margin-top: 0; }
.sw-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 14px;
}
.sw-section-head p { color: var(--mute); font-size: 14px; }
.sw-h2 { font: 400 23px/1.25 var(--serif); letter-spacing: -0.005em; }
.sw-h2 small {
  margin-left: 8px;
  color: var(--faint);
  font: 500 13px/1 var(--sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.sw-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: start;
  gap: 24px;
}
.sw-grid > * { min-width: 0; }
.sw-rail { display: flex; flex-direction: column; gap: 16px; }
.sw-rail > .sw-panel + .sw-panel { margin-top: 0; }

.sw-center {
  display: grid;
  justify-items: center;
  gap: 14px;
  max-width: 540px;
  margin: 8vh auto;
  text-align: center;
}
.sw-center h1, .sw-center h2 { font: 400 32px/1.15 var(--serif); letter-spacing: -0.01em; }
.sw-center p { color: var(--mute); text-wrap: pretty; }
.sw-center-mark { color: var(--accent); }

.sw-stack { display: grid; gap: 16px; }
.sw-flex { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sw-spread { justify-content: space-between; }

@media (max-width: 960px) {
  .sw-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .sw-wrap { padding-top: 26px; padding-bottom: 56px; }
  .sw-page-title { grid-template-columns: minmax(0, 1fr); margin-bottom: 24px; }
  .sw-page-title > .sw-actions { grid-column: 1; grid-row: auto; margin-top: 16px; }
  .sw-page-title h1 { font-size: 30px; }
  .sw-section { margin-top: 40px; }
  .sw-h2 { font-size: 21px; }
  .sw-center h1, .sw-center h2 { font-size: 27px; }
}

/* ------------------------------------------------------------------------------------ panels, stats */

.sw-panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}
.sw-panel + .sw-panel { margin-top: 16px; }
.sw-panel > h3, .sw-panel-title {
  margin: 0 0 14px;
  color: var(--ink);
  font: 400 18px/1.3 var(--serif);
}
.sw-panel > p + p { margin-top: 10px; }

.sw-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}
/* Hairlines between cells: each cell draws one above and to its left, and the edges get clipped. */
.sw-stat {
  min-width: 0;
  padding: 16px 18px;
  box-shadow: -1px -1px 0 var(--line);
}
.sw-stat .sw-label { display: block; color: var(--mute); font-size: 12.5px; }
.sw-stat b {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font: 500 22px/1.2 var(--sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.sw-stat > span:not(.sw-label) { display: block; margin-top: 4px; color: var(--faint); font-size: 12.5px; }

.sw-lines { display: grid; }
.sw-lines > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.sw-lines > div:first-child { padding-top: 0; border-top: 0; }
.sw-lines > div:last-child { padding-bottom: 0; }
.sw-lines dt { flex: none; color: var(--mute); font-size: 14px; }
.sw-lines dd {
  min-width: 0;
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  text-align: right;
  overflow-wrap: anywhere;
}
.sw-lines dd small { display: block; color: var(--faint); font-size: 12.5px; font-weight: 400; }

.sw-note {
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.5;
}
.sw-note-warn { background: var(--warn-soft); }

.sw-steps { display: grid; gap: 14px; padding: 0; list-style: none; counter-reset: sw-step; }
.sw-steps > li {
  position: relative;
  padding-left: 40px;
  color: var(--mute);
  counter-increment: sw-step;
}
.sw-steps > li::before {
  content: counter(sw-step);
  position: absolute;
  top: -1px;
  left: 0;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--accent);
  font: 400 14px/1 var(--serif);
}
.sw-steps > li b { display: block; color: var(--ink); font-weight: 600; }

@media (max-width: 640px) {
  .sw-panel { padding: 16px; }
  .sw-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sw-stat { padding: 14px; }
  .sw-stat b { font-size: 19px; }
}

/* --------------------------------------------------------------------------------------------- prose */

.sw-prose { max-width: 70ch; color: var(--mute); font-size: 15.5px; line-height: 1.65; }
.sw-prose h2 { margin: 44px 0 12px; color: var(--ink); font: 400 25px/1.25 var(--serif); }
.sw-prose h3 { margin: 28px 0 8px; color: var(--ink); font: 600 15.5px/1.4 var(--sans); }
.sw-prose > :first-child { margin-top: 0; }
.sw-prose p, .sw-prose ul, .sw-prose ol { margin: 0 0 14px; }
.sw-prose ul, .sw-prose ol { padding-left: 22px; }
.sw-prose li + li { margin-top: 6px; }
.sw-prose strong, .sw-prose b { color: var(--ink); font-weight: 600; }
.sw-prose a { color: var(--accent); text-underline-offset: 3px; }
.sw-prose pre {
  margin: 0 0 16px;
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: 12.5px/1.6 var(--mono);
}
.sw-prose pre code { padding: 0; background: none; box-shadow: none; font-size: inherit; }

/* -------------------------------------------------------------------------------------------- tables */

.sw-table-wrap {
  /* Positioned, so visually hidden header labels (.sw-sr) stay inside the scroll box instead of widening the page. */
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.sw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.sw-table th {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  font-size: 12px;
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
}
.sw-table td {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}
.sw-table tbody tr:first-child td { border-top: 0; }
.sw-table th:first-child, .sw-table td:first-child { padding-left: 18px; }
.sw-table th:last-child, .sw-table td:last-child { padding-right: 18px; }
.sw-table .sw-l { text-align: left; }

.sw-table th button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}
.sw-table th button:hover, .sw-table th[aria-sort] { color: var(--ink); }
.sw-table th[aria-sort="descending"] button::after { content: " \2193"; }
.sw-table th[aria-sort="ascending"] button::after { content: " \2191"; }

.sw-table tr.sw-row { cursor: pointer; }
.sw-table tr.sw-row:hover > td { background: var(--hover); }

.sw-table td.sw-empty-cell {
  padding: 40px 16px;
  color: var(--faint);
  text-align: center;
  white-space: normal;
}
/* In a table wider than the screen, the message stays inside the visible part instead of its far middle. */
.sw-empty-cell > span {
  position: sticky;
  right: 16px;
  left: 16px;
  display: inline-block;
  max-width: min(520px, calc(100vw - 80px));
}

.sw-table tr.sw-day > td {
  padding: 8px 18px;
  background: var(--bg);
  color: var(--mute);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-align: left;
}

.sw-rank { color: var(--faint); font-size: 12px; }

/* --------------------------------------------------------------------------------------------- coins */

.sw-coin {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  min-width: 0;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  vertical-align: middle;
}
.sw-coin-text { display: grid; min-width: 0; line-height: 1.3; }
.sw-coin-sym { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sw-coin-sym b {
  max-width: 14ch;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sw-coin small {
  display: block;
  max-width: 24ch;
  overflow: hidden;
  color: var(--faint);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
a.sw-coin:hover b { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
/* Table cells size to their content and scroll inside .sw-table-wrap, so a coin there never squeezes to its logo. */
.sw-table .sw-coin { max-width: none; }
.sw-table .sw-coin-text { min-width: max-content; }

.sw-logo {
  display: inline-block;
  flex: none;
  border-radius: 50%;
  background: var(--panel);
  object-fit: cover;
  outline: 1px solid var(--line);
  outline-offset: -1px;
  vertical-align: middle;
}
.sw-logo-none {
  display: inline-grid;
  place-items: center;
  outline-color: var(--line-2);
  color: var(--mute);
  font-family: var(--sans);
  font-weight: 600;
  line-height: 1;
  user-select: none;
}
.sw-logo-sol { color: var(--ink); }
/* A logo on its way: its circle pulses until the image arrives, which then fades in. */
.sw-logo-load { overflow: hidden; animation: sw-logo-wait 1.2s ease-in-out infinite; }
.sw-logo-load.sw-logo-ready { animation: none; }
.sw-logo-img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.15s ease-out;
}
.sw-logo-ready .sw-logo-img { opacity: 1; }
@keyframes sw-logo-wait { 50% { background: var(--line-2); } }

/* ---------------------------------------------------------------------------------------------- tags */

.sw-tag {
  display: inline-flex;
  flex: none;
  align-items: center;
  height: 19px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--hover);
  box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--mute);
  font: 600 10.5px/1 var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
  white-space: nowrap;
}
.sw-tag-bid { background: var(--up-soft); box-shadow: none; color: var(--up); }
.sw-tag-ask { background: var(--down-soft); box-shadow: none; color: var(--down); }
.sw-tag-private { background: var(--warn-soft); box-shadow: none; color: var(--warn); }
.sw-tag-house { background: transparent; color: var(--accent); }
.sw-tag-unverified { background: transparent; box-shadow: inset 0 0 0 1px var(--warn); color: var(--warn); }

.sw-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--mute);
  font-size: 13px;
  white-space: nowrap;
}
.sw-status::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.sw-status-open { color: var(--accent); }
.sw-status-filled { color: var(--up); }
.sw-status-cancelled { color: var(--faint); }
.sw-status-expired { color: var(--faint); }
.sw-status-expired::before { background: transparent; box-shadow: inset 0 0 0 1px currentColor; }

/* ---------------------------------------------------------------------------------------------- text */

.sw-hint { color: var(--mute); font-size: 13px; line-height: 1.5; }
.sw-hint:empty { display: none; }
.sw-faint { color: var(--faint); }
.sw-mute { color: var(--mute); }
.sw-up { color: var(--up); }
.sw-down { color: var(--down); }
.sw-warn { color: var(--warn); }
.sw-accent { color: var(--accent); }
.sw-mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0; }
.sw-tnum { font-variant-numeric: tabular-nums; }
.sw-break { overflow-wrap: anywhere; }

.sw-two { line-height: 1.3; }
.sw-two small { display: block; margin-top: 2px; color: var(--faint); font-size: 12px; }

.sw-link {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}
.sw-link:hover { text-decoration: underline; text-underline-offset: 3px; }
button.sw-link { padding: 0; border: 0; background: none; font: inherit; }

.sw-error { color: var(--down); font-size: 13.5px; line-height: 1.45; }
.sw-error:empty { display: none; }

/* ------------------------------------------------------------------------------------------- buttons */

.sw-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 14px/1 var(--sans);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.sw-btn:hover { background: var(--accent-hover); }
.sw-btn:active { transform: translateY(0.5px); }
.sw-btn:disabled, .sw-btn[aria-disabled="true"] { opacity: 0.42; cursor: not-allowed; transform: none; }
.sw-btn:disabled:hover { background: var(--accent); }

.sw-btn-line { border-color: var(--line-2); background: transparent; color: var(--ink); }
.sw-btn-line:hover, .sw-btn-line:disabled:hover { border-color: var(--faint); background: var(--hover); }
.sw-btn-quiet { background: transparent; color: var(--mute); }
.sw-btn-quiet:hover, .sw-btn-quiet:disabled:hover { background: var(--hover); color: var(--ink); }
.sw-btn-danger { border-color: var(--down-soft); background: transparent; color: var(--down); }
.sw-btn-danger:hover, .sw-btn-danger:disabled:hover { border-color: var(--down); background: var(--down-soft); }

.sw-btn-small { height: 30px; padding: 0 11px; border-radius: 8px; font-size: 13px; }
.sw-btn-wide { width: 100%; height: 46px; font-size: 15px; }

/* A button waiting on something: a quiet ring turns beside its label. */
.sw-btn[aria-busy="true"]::after, .sw-choices [aria-busy="true"]::after {
  content: "";
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: sw-turn 0.8s linear infinite;
}

/* ------------------------------------------------------------------------------------------ controls */

.sw-pills {
  display: inline-flex;
  gap: 2px;
  max-width: 100%;
  padding: 3px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  scrollbar-width: none;
  vertical-align: middle;
}
.sw-pills::-webkit-scrollbar { display: none; }
.sw-pills > button, .sw-pills > a {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--mute);
  font: 500 13px/1 var(--sans);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s, background-color 0.15s;
}
.sw-pills > button:hover, .sw-pills > a:hover { color: var(--ink); }
.sw-pills > .sw-on { background: var(--panel); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink); }
.sw-pills small { color: var(--faint); font-size: 11.5px; font-weight: 500; font-variant-numeric: tabular-nums; }

.sw-tabs {
  display: flex;
  gap: 4px;
  max-width: 100%;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.sw-tabs::-webkit-scrollbar { display: none; }
.sw-tabs > button, .sw-tabs > a {
  position: relative;
  flex: none;
  height: 42px;
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--mute);
  font: 500 14.5px/1 var(--sans);
  text-decoration: none;
  white-space: nowrap;
}
.sw-tabs > button:hover, .sw-tabs > a:hover { color: var(--ink); }
.sw-tabs > .sw-on { color: var(--ink); }
.sw-tabs > .sw-on::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: -1px;
  left: 12px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
}

.sw-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--faint);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sw-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sw-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}
.sw-search input::placeholder { color: var(--faint); }
.sw-search input::-webkit-search-cancel-button { opacity: 0.5; }

.sw-input {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sw-input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.sw-input::placeholder { color: var(--faint); }
.sw-input[aria-invalid="true"] { border-color: var(--down); }
.sw-input:disabled, .sw-input[readonly] { color: var(--mute); }
textarea.sw-input { height: auto; min-height: 88px; padding: 10px 12px; line-height: 1.45; resize: vertical; }
select.sw-input { padding-right: 8px; }

.sw-input-row { display: flex; gap: 8px; min-width: 0; }
.sw-input-row > .sw-input { flex: 1; }
.sw-input-row > .sw-btn { height: 40px; }

.sw-field { display: grid; gap: 7px; min-width: 0; }
.sw-field > span:first-child, .sw-field > label:first-child, .sw-field-label { color: var(--mute); font-size: 12.5px; }
.sw-field + .sw-field { margin-top: 16px; }
.sw-field small { font-size: 12.5px; }

.sw-check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.sw-check input { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }

.sw-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.sw-tools > .sw-search { flex: 1 1 240px; max-width: 380px; }
.sw-tools-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-left: auto; }

.sw-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  color: var(--faint);
  font-size: 13px;
}
.sw-pager:empty { display: none; }
.sw-pager button {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--mute);
  font: 500 13px/1 var(--sans);
  font-variant-numeric: tabular-nums;
}
.sw-pager button:hover:not(:disabled) { border-color: var(--line-2); color: var(--ink); }
.sw-pager button[aria-current="page"] { border-color: var(--line-2); background: var(--panel); color: var(--ink); }
.sw-pager button:disabled { opacity: 0.4; cursor: default; }
.sw-pager .sw-gap { padding: 0 2px; }

@media (max-width: 640px) {
  .sw-table td.sw-empty-cell { text-align: left; }
  .sw-tools > .sw-search { flex-basis: 100%; max-width: none; }
  .sw-tools-right { margin-left: 0; }
  /* Phones zoom into inputs set below 16px. */
  .sw-input, .sw-search input { font-size: 16px; }
}

/* -------------------------------------------------------------------------------------------- modals */

#sw-modal-root { position: relative; z-index: 60; }

.sw-modal-back {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--scrim);
  animation: sw-fade 0.16s ease-out;
}

.sw-modal {
  position: relative;
  width: min(100%, 470px);
  padding: 26px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: sw-rise 0.22s ease-out;
}
.sw-modal:focus { outline: none; }
.sw-modal h2 { margin: 0 0 8px; font: 400 24px/1.2 var(--serif); letter-spacing: -0.005em; overflow-wrap: anywhere; }
.sw-modal p { color: var(--mute); font-size: 14px; }
.sw-modal p + p { margin-top: 8px; }
.sw-modal .sw-hint { font-size: 13px; }
.sw-modal .sw-error { color: var(--down); font-size: 13.5px; }
.sw-modal .sw-note { color: var(--ink); font-size: 13.5px; }
.sw-modal pre {
  max-height: 42vh;
  margin: 16px 0 0;
  padding: 14px 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--ink);
  font: 12.5px/1.6 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.sw-modal .sw-lines, .sw-modal .sw-field, .sw-modal .sw-note { margin-top: 18px; }
.sw-modal .sw-lines + p, .sw-modal pre + p { margin-top: 14px; }
/* The take window's coin: logo, symbol, the short mint (a link to the coin page) and any Unverified tag. */
.sw-modal .sw-take-coin { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.sw-take-coin b { color: var(--ink); font-weight: 600; }
.sw-take-coin .sw-mono { font-size: 12.5px; }
.sw-modal-status:not(:empty) { margin-top: 14px; color: var(--accent); }
.sw-modal .sw-error:not(:empty) { margin-top: 14px; }

.sw-modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.sw-wallet-address {
  margin: 14px 0 10px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--ink) !important;
  font-size: 13px !important;
}

.sw-choices { display: grid; gap: 8px; margin-top: 20px; }
.sw-choices + p { margin-top: 14px; }
.sw-choices > button, .sw-choices > a {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--ink);
  font: 500 15px/1.3 var(--sans);
  text-align: left;
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}
.sw-choice-text { flex: 1; min-width: 0; }
.sw-choices > button:hover:not(:disabled), .sw-choices > a:hover { border-color: var(--accent); }
.sw-choices > button:disabled { opacity: 0.5; cursor: default; }
.sw-choices small { display: block; margin-top: 2px; color: var(--faint); font-size: 12.5px; font-weight: 400; }
.sw-choices-label {
  margin-top: 10px;
  color: var(--faint) !important;
  font-size: 11.5px !important;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sw-choice-mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--panel);
  outline: 1px solid var(--line-2);
  outline-offset: -1px;
  color: var(--accent);
}
/* A wallet's own icon, as it announced it through Wallet Standard. */
.sw-choice-icon { flex: none; width: 32px; height: 32px; border-radius: 8px; object-fit: contain; }

@media (max-width: 520px) {
  .sw-modal-back { place-items: end center; padding: 12px 8px; }
  .sw-modal { padding: 22px 18px 18px; }
  .sw-modal h2 { font-size: 22px; }
  .sw-modal-actions > * { flex: 1 1 0; }
}

/* ---------------------------------------------------------------------------------- meter, life bar */

.sw-meter {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--accent);
  vertical-align: middle;
}
.sw-meter b, .sw-meter i { display: block; width: 4px; height: 12px; border-radius: 1px; }
.sw-meter b { background: currentColor; }
.sw-meter i { background: var(--line-2); }
.sw-meter-2 { color: var(--warn); }
.sw-meter-3 { color: var(--down); }

.sw-mini { display: inline-grid; gap: 5px; min-width: 104px; text-align: left; vertical-align: middle; }
.sw-mini svg { display: block; width: 100%; height: 3px; }
.sw-mini-track { fill: var(--line-2); }
.sw-mini-fill { fill: var(--accent); }
.sw-mini-filled .sw-mini-fill { fill: var(--up); }
.sw-mini-closed .sw-mini-fill { fill: var(--faint); }
.sw-mini small { color: var(--faint); font-size: 12px; white-space: nowrap; }

/* ------------------------------------------------------------------------------------- impact chart */

.sw-chart { min-width: 0; }
.sw-chart-plot { position: relative; margin: 0 6px; }
.sw-chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.sw-chart path, .sw-chart line { vector-effect: non-scaling-stroke; }
.sw-chart-floor { stroke: var(--line); stroke-width: 1; }
.sw-chart-gap { fill: var(--down); opacity: 0.08; }
.sw-chart-level { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 6 5; }
.sw-chart-pool { fill: none; stroke: var(--down); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sw-chart-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--accent);
}
.sw-chart-dot-end { background: var(--down); }
.sw-chart-tag {
  position: absolute;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}
.sw-chart-tag-still { left: 0; padding-bottom: 8px; color: var(--accent); transform: translateY(-100%); }
.sw-chart-tag-pool { right: 0; padding-top: 9px; color: var(--down); }
.sw-chart figcaption { margin-top: 12px; color: var(--faint); font-size: 12.5px; }

/* -------------------------------------------------------------------------------------------- loading */

.sw-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 40vh;
  color: var(--faint);
  font-size: 13px;
  opacity: 0;
  animation: sw-fade 0.3s ease-out 0.25s forwards;
}
.sw-loading i {
  position: relative;
  width: 72px;
  height: 1px;
  overflow: hidden;
  background: var(--line-2);
}
.sw-loading i::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 30%;
  background: var(--accent);
  animation: sw-glide 1.6s ease-in-out infinite alternate;
}

/* --------------------------------------------------------------------------------------------- footer */

.sw-foot { border-top: 1px solid var(--line); }
/* Centred: the mark and name on top, the links in one row beneath, set apart by faint dots. */
.sw-foot-in {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px var(--gut) 32px;
  color: var(--faint);
  font-size: 13px;
  text-align: center;
}
.sw-foot-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--mute);
  font: 400 16px/1 var(--serif);
  text-decoration: none;
}
.sw-foot-brand .sw-mark { color: var(--accent); }
.sw-foot-links { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 0; }
.sw-foot-links a + a::before {
  content: "·";
  display: inline-block;
  margin: 0 12px;
  color: var(--line-2);
  pointer-events: none;
}
.sw-foot a { color: var(--mute); text-decoration: none; }
.sw-foot a:hover { color: var(--ink); }


/* ------------------------------------------------------------------------------------------- motion */

@keyframes sw-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sw-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes sw-turn { to { transform: rotate(1turn); } }
@keyframes sw-glide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
