/*
 * Rare-sat supply dashboard. Plain CSS, no build step; served under a strict
 * CSP, so every style lives here (the script only toggles classes and sets a
 * few CSSOM properties such as meter widths and tooltip positions).
 *
 * Colors follow the dataviz reference palette: chrome/ink tokens, a 2-slot
 * categorical palette validated by the owner (slot 1 = extracted, slot 2 =
 * located), the blue ramp for the extracted meter, and the reserved status
 * scale (always shipped with an icon and a label). Dark mode is its own set of
 * selected steps, declared for the OS setting and again for the theme toggle.
 */

:root {
    color-scheme: light;
    --page: #f9f9f7;
    --surface: #fcfcfb;
    --ink: #0b0b0b;
    --ink-2: #52514e;
    --muted: #898781;
    --grid: #e1e0d9;
    --axis: #c3c2b7;
    --border: rgba(11, 11, 11, 0.10);
    /* Control outlines need 3:1 against the surface (WCAG 1.4.11); --muted clears it. */
    --control-border: #898781;
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --series-3: #1baf7a;
    /* Meter track: a lighter step of the fill's own (blue) ramp. */
    --track: #cde2fb;
    --good: #0ca30c;
    --warning: #fab219;
    --serious: #ec835a;
    --critical: #d03b3b;
    --focus: #2a78d6;
    /* Link underline: quiet, but still visible against the surface. */
    --underline: #c3c2b7;
    --backdrop: rgba(11, 11, 11, 0.38);
    --shadow: 0 1px 2px rgba(11, 11, 11, 0.06), 0 12px 32px rgba(11, 11, 11, 0.14);

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    --radius: 8px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --page: #0d0d0d;
        --surface: #1a1a19;
        --ink: #ffffff;
        --ink-2: #c3c2b7;
        --muted: #898781;
        --grid: #2c2c2a;
        --axis: #383835;
        --border: rgba(255, 255, 255, 0.10);
        --control-border: #898781;
        --series-1: #3987e5;
        --series-2: #d95926;
        --series-3: #199e70;
        --track: #0d366b;
        --focus: #3987e5;
        --underline: #898781;
        --backdrop: rgba(0, 0, 0, 0.6);
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 32px rgba(0, 0, 0, 0.55);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --control-border: #898781;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --track: #0d366b;
    --focus: #3987e5;
    --underline: #898781;
    --backdrop: rgba(0, 0, 0, 0.6);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 32px rgba(0, 0, 0, 0.55);
}

/* Derived washes: mixed from the tokens above so both themes get them for free. */
:root {
    --wash: color-mix(in srgb, var(--series-1) 8%, var(--surface));
    --flash: color-mix(in srgb, var(--series-1) 26%, var(--surface));
    --hover: color-mix(in srgb, var(--ink) 5%, var(--surface));
    --chip: color-mix(in srgb, var(--ink) 6%, var(--surface));
    --sunken: color-mix(in srgb, var(--ink) 3%, var(--page));
}

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

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

[hidden] {
    display: none !important;
}

html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/*
 * App shell: the body is exactly one viewport tall and never scrolls; each
 * pane scrolls inside itself. That keeps the header and filters in view, and
 * lets the supply table have a sticky header row and first column at once.
 */
body {
    margin: 0;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--page);
    color: var(--ink);
    font: 14px/1.4 var(--font);
}

h1,
h2,
h3,
p {
    margin: 0;
}

a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--underline);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:hover {
    text-decoration-color: currentColor;
}

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

.mono {
    font-family: var(--mono);
    font-size: 0.92em;
}

.num {
    font-variant-numeric: tabular-nums;
}

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

/* A quiet link to a sat type's explainer (type-links.js infoLink): muted
   small words after a type's name, or a muted (i) beside a title. */
.type-info {
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
    text-decoration-color: transparent;
}

.type-info:hover {
    color: var(--ink-2);
    text-decoration-color: currentColor;
}

/* The ⓘ drawn by CSS (a font may have no U+24D8): a ringed serif i. */
.type-info--icon {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: 1.25px solid currentColor;
    border-radius: 50%;
    font: italic 600 11px/1 Georgia, "Times New Roman", serif;
    text-decoration: none;
}

.skip-link {
    position: absolute;
    left: 8px;
    top: -48px;
    z-index: 100;
    padding: 6px 10px;
    background: var(--surface);
    border: 1px solid var(--control-border);
    border-radius: 6px;
}

.skip-link:focus {
    top: 8px;
}

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

input,
select,
button {
    font: inherit;
    color: inherit;
}

input[type="search"],
select {
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--control-border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    min-width: 0;
}

input[type="search"]::placeholder {
    color: var(--ink-2);
    opacity: 0.8;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--control-border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    white-space: nowrap;
}

.btn:hover {
    background: var(--hover);
}

.btn[aria-pressed="true"] {
    background: var(--chip);
    font-weight: 600;
}

.btn--ghost {
    border-color: transparent;
    background: transparent;
}

.btn--icon {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
}

.btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    fill: currentColor;
}

.btn--icon svg path {
    fill: none;
}

.linkish {
    border: 0;
    padding: 0;
    background: none;
    color: var(--ink-2);
    font-size: 12px;
    text-decoration: underline;
    text-decoration-color: var(--underline);
    text-underline-offset: 2px;
    cursor: pointer;
}

.linkish:hover {
    color: var(--ink);
    text-decoration-color: currentColor;
}

/* A checkbox dressed as a switch; the native input keeps focus and state. */
.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 30px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

.switch-track {
    position: relative;
    flex: none;
    width: 30px;
    height: 18px;
    border-radius: 9px;
    border: 1px solid var(--control-border);
    background: var(--surface);
}

.switch-track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--ink-2);
    transition: transform 0.15s ease;
}

.switch input:checked + .switch-track {
    background: var(--series-1);
    border-color: var(--series-1);
}

.switch input:checked + .switch-track::after {
    transform: translateX(12px);
    background: #ffffff;
}

.switch input:focus-visible + .switch-track {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.switch-count {
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
}

/* Segmented radio group (history range, chart/table view). */
.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    border: 1px solid var(--control-border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface);
}

.segmented button {
    height: 30px;
    padding: 0 10px;
    border: 0;
    border-left: 1px solid var(--grid);
    background: transparent;
    color: var(--ink-2);
    cursor: pointer;
    white-space: nowrap;
}

.segmented button:first-child {
    border-left: 0;
}

.segmented button:hover {
    background: var(--hover);
    color: var(--ink);
}

.segmented button[aria-checked="true"],
.segmented button[aria-pressed="true"] {
    background: var(--chip);
    color: var(--ink);
    font-weight: 600;
    box-shadow: inset 0 -2px 0 var(--ink);
}

.segmented button:focus-visible {
    outline-offset: -2px;
}

/* ------------------------------------------------------------ sorting */

/*
 * A sortable column header is a button dressed as the header's own text: the
 * th keeps its padding and alignment. The sorted column's label turns to
 * full ink with an arrow on its inner side (before a right-aligned label,
 * after a left-aligned one), so numbers stay flush with their header.
 */
.sort-btn {
    display: inline-block;
    max-width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    line-height: inherit;
    text-align: inherit;
    cursor: pointer;
}

.sort-label {
    position: relative;
    display: inline-block;
}

.sort-btn:hover .sort-label,
.sort-btn.is-sorted .sort-label {
    color: var(--ink);
}

.sort-btn:hover .sort-label {
    text-decoration: underline;
    text-decoration-color: var(--underline);
    text-underline-offset: 2px;
}

.sort-glue {
    white-space: nowrap;
}

/* inline-block: the hover underline of the label skips the arrow. */
.sort-ind {
    display: inline-block;
    font-size: 0.8em;
    color: var(--ink);
}

.sort-btn--right .sort-ind {
    margin-right: 3px;
}

.sort-btn--left .sort-ind {
    margin-left: 3px;
}

/* Unsorted, a faint arrow previews the first click on hover or keyboard
   focus. It sits in the cell's padding, so nothing shifts. */
.sort-btn:not(.is-sorted):is(:hover, :focus-visible) .sort-label::after {
    position: absolute;
    top: 0;
    font-size: 0.8em;
    color: var(--ink-2);
    text-decoration: none;
}

.sort-btn--down:not(.is-sorted):is(:hover, :focus-visible) .sort-label::after {
    content: "\25BC";
}

.sort-btn--up:not(.is-sorted):is(:hover, :focus-visible) .sort-label::after {
    content: "\25B2";
}

.sort-btn--right .sort-label::after {
    right: calc(100% + 3px);
}

.sort-btn--left .sort-label::after {
    left: calc(100% + 3px);
}

/* The chip beside the supply filters: what the table is sorted by; a click
   clears it. */
.sort-chip {
    height: 28px;
    padding: 0 8px 0 10px;
    border-radius: 14px;
    background: var(--chip);
    font-size: 12.5px;
}

.sort-chip-lead {
    color: var(--ink-2);
}

.sort-chip svg {
    width: 12px;
    height: 12px;
    stroke-width: 1.8;
}

.sort-chip svg path {
    fill: none;
}

/* ------------------------------------------------------------- header */

/* The header's layout and its parts: header.css. The status pills (in the
   header's status panel; their icons in the notices too) and the meter: */

/* Status pill: icon shape + label carry the state; the wash only echoes it. */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    max-width: 100%;
    padding: 2px 9px 2px 6px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    font-size: 12.5px;
    line-height: 1.25;
}

.pill-icon {
    width: 14px;
    height: 14px;
    flex: none;
}

.pill-label {
    min-width: 0;
    overflow-wrap: anywhere;
}

.pill--good {
    background: color-mix(in srgb, var(--good) 10%, var(--surface));
    border-color: color-mix(in srgb, var(--good) 35%, transparent);
}

.pill--warning {
    background: color-mix(in srgb, var(--warning) 14%, var(--surface));
    border-color: color-mix(in srgb, var(--warning) 55%, transparent);
}

.pill--serious {
    background: color-mix(in srgb, var(--serious) 14%, var(--surface));
    border-color: color-mix(in srgb, var(--serious) 55%, transparent);
}

.pill--critical {
    background: color-mix(in srgb, var(--critical) 12%, var(--surface));
    border-color: color-mix(in srgb, var(--critical) 50%, transparent);
}

.pill--quiet {
    border-color: transparent;
    background: transparent;
    color: var(--ink-2);
    padding-left: 2px;
}

.icon-good { fill: var(--good); }
.icon-warning { fill: var(--warning); }
.icon-serious { fill: var(--serious); }
.icon-critical { fill: var(--critical); }
.icon-neutral { fill: none; stroke: var(--muted); stroke-width: 1.6; }
.icon-mark-light { fill: none; stroke: #ffffff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-mark-dark { fill: none; stroke: #0b0b0b; stroke-width: 1.8; stroke-linecap: round; }

/* Thin progress meter (fast sync, backfill): blue fill on its lighter step. */
.meter {
    position: relative;
    display: inline-block;
    flex: none;
    width: 48px;
    height: 4px;
    border-radius: 2px;
    background: var(--track);
    overflow: hidden;
    vertical-align: middle;
}

.meter > span {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    border-radius: 2px;
    background: var(--series-1);
}

/* The collection page's tabs (collection.js). */
.tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px 7px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--ink-2);
    cursor: pointer;
    white-space: nowrap;
}

.tab:hover {
    color: var(--ink);
}

.tab[aria-selected="true"] {
    color: var(--ink);
    font-weight: 600;
    border-bottom-color: var(--ink);
}

.tab:focus-visible {
    outline-offset: -2px;
}

/* A tab's label as wide as its bold (selected) self, so selecting a tab
   moves none of the others: a hidden bold copy of the text sets the width. */
.tab-label {
    display: inline-flex;
    flex-direction: column;
}

.tab-label::after {
    content: attr(data-text);
    content: attr(data-text) / "";
    height: 0;
    overflow: hidden;
    visibility: hidden;
    font-weight: 600;
    pointer-events: none;
    user-select: none;
}

.badge {
    display: inline-block;
    min-width: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--ink);
    color: var(--surface);
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* The Pending chip (core/pending.js): an item from a transaction still in
   the mempool. Its title says when it was first seen and at what fee rate. */
.pending-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: none;
    padding: 0 7px;
    border: 1px solid color-mix(in srgb, var(--warning) 60%, transparent);
    border-radius: 9px;
    background: color-mix(in srgb, var(--warning) 14%, var(--surface));
    color: var(--ink);
    font-size: 11px;
    font-weight: 600;
    line-height: 16px;
    white-space: nowrap;
    vertical-align: middle;
    cursor: help;
}

.pending-chip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--warning);
    animation: pending-pulse 1.6s ease-in-out infinite;
}

@keyframes pending-pulse {
    50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
    .pending-chip-dot {
        animation: none;
    }
}

/* A row or card of a pending item: set apart from the confirmed ones. */
.is-pending {
    background: color-mix(in srgb, var(--warning) 6%, var(--surface));
}

/* ------------------------------------------------------------ notices */

.notices {
    flex: none;
}

.notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    background: var(--surface);
}

.notice .pill-icon {
    margin-top: 2px;
}

.notice-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.notice-line,
.notice-secondary {
    margin: 0;
}

/* The short second line: what still works, what happens next. */
.notice-secondary {
    margin-top: 1px;
    color: var(--ink-2);
    font-size: 12.5px;
}

/* A calm tint and an accent edge in the level's color (the icon's shape
   carries the level too); the words stay --ink / --ink-2 on a near-surface
   wash, so they keep their contrast in both themes. */
.notice--critical {
    background: color-mix(in srgb, var(--critical) 9%, var(--surface));
    box-shadow: inset 3px 0 0 var(--critical);
}

.notice--serious {
    background: color-mix(in srgb, var(--serious) 10%, var(--surface));
    box-shadow: inset 3px 0 0 var(--serious);
}

.notice--warning {
    background: color-mix(in srgb, var(--warning) 10%, var(--surface));
    box-shadow: inset 3px 0 0 var(--warning);
}

.notice .btn {
    flex: none;
    height: 24px;
    padding: 0 8px;
    font-size: 12px;
}

/* Hide the live-updates notice: a 24px square, its × a stroke. */
.notice .notice-close {
    width: 24px;
    padding: 0;
    margin: -1px -6px 0 0;
    color: var(--ink-2);
}

.notice .notice-close svg {
    width: 14px;
    height: 14px;
    fill: none;
}

.notice .notice-close:hover {
    color: var(--ink);
}

/* -------------------------------------------------------------- panes */

.panes {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 12px 16px 16px;
}

.panes:focus {
    outline: none;
}

.pane {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

/* Below 1600 px the panes are tabs; at 1600 px and up all three show at once. */
@media (max-width: 1599.98px) {
    .pane:not(.is-active) {
        display: none;
    }
}

/* Wide, the Statistics tab is the overview (supply and both feeds at once)
   and the Market and Sales tabs take the whole width. */
.tab-wide {
    display: none;
}

@media (min-width: 1600px) {
    .tab-narrow {
        display: none;
    }

    .tab-wide {
        display: inline;
    }

    .panes {
        display: grid;
        /* ~60/40: the compact table fits the left pane, cards the right. */
        grid-template-columns: minmax(0, 31fr) minmax(0, 19fr);
        grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
        gap: 12px;
    }

    .pane--supply {
        grid-row: 1 / 3;
    }

    .panes.is-sales,
    .panes.is-market {
        display: flex;
    }

    .panes.is-sales > .pane:not(.pane--sales),
    .panes.is-market > .pane:not(.pane--market),
    .panes:not(.is-sales) > .pane--sales,
    .panes:not(.is-market) > .pane--market {
        display: none;
    }
}

.pane-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 12px;
    padding: 10px 16px 0;
}

.pane-head h2 {
    font-size: 15px;
    font-weight: 650;
}

.pane-meta {
    color: var(--ink-2);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    padding: 8px 16px 10px;
    border-bottom: 1px solid var(--grid);
}

.field {
    display: inline-flex;
    min-width: 0;
}

.field--search {
    flex: 1 1 200px;
    max-width: 300px;
}

.field--search input {
    width: 100%;
}

.field select {
    max-width: 100%;
}

.empty {
    padding: 24px 16px;
    color: var(--ink-2);
    text-align: center;
}

/* ------------------------------------------------------- supply table */

.table-scroll {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.supply {
    /* separate, not collapse: sticky cells keep their borders while scrolling */
    border-collapse: separate;
    border-spacing: 0;
    min-width: 100%;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}

.supply th,
.supply td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--grid);
    background: var(--surface);
    text-align: right;
    white-space: nowrap;
    vertical-align: top;
}

/*
 * Two sticky header rows: the first has a fixed height so the second knows
 * where to stick (top: var(--head-1)). Headers that span both rows stick at 0.
 */
.supply {
    --head-1: 24px;
}

.supply thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding-top: 4px;
    padding-bottom: 5px;
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 600;
    line-height: 15px;
    vertical-align: bottom;
    white-space: normal;
    border-bottom-color: var(--axis);
}

.supply thead tr:first-child th:not([rowspan]) {
    height: var(--head-1);
    border-bottom-color: var(--grid);
    text-align: center;
}

.supply thead tr:nth-child(2) th {
    top: var(--head-1);
}

.supply th.col-row {
    position: sticky;
    left: 0;
    z-index: 1;
    text-align: left;
    min-width: 132px;
    white-space: normal;
    font-weight: 400;
    box-shadow: inset -1px 0 0 var(--grid);
}

.supply thead th.col-row {
    z-index: 3;
    font-weight: 600;
}

.table-scroll.is-scrolled-x .supply th.col-row {
    box-shadow: inset -1px 0 0 var(--axis), 6px 0 8px -6px rgba(0, 0, 0, 0.25);
}

.th-sub {
    display: block;
    font-weight: 400;
    color: var(--ink-2);
    font-size: 11px;
}

.supply thead th.num-head {
    min-width: 44px;
}

/* Capped so a long id (palindrome_perfect_palinception) truncates instead of
   widening the sticky column; the full id is in its title. */
.row-link {
    display: block;
    max-width: 158px;
    color: var(--ink);
    text-decoration: none;
}

.row-link:hover .row-label {
    text-decoration: underline;
    text-decoration-color: var(--underline);
    text-underline-offset: 2px;
}

.row-label {
    display: block;
    font-weight: 500;
    overflow-wrap: anywhere;
}

/* A sorted table is one list: each row names its group in a small tag,
   where the grouped view shows the row's id. */
.group-tag {
    display: inline-block;
    max-width: 100%;
    margin-top: 2px;
    padding: 0 5px;
    border-radius: 4px;
    background: var(--chip);
    color: var(--ink-2);
    font-size: 10.5px;
    line-height: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: top;
}

/* A label row (a subset of a market row) says so under its name. */
.label-tag {
    display: block;
    width: max-content;
    white-space: normal;
}

/* The id is secondary; ink-2 (not --muted) because muted fails 4.5:1 at 11 px. */
.row-id {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink-2);
    font-family: var(--mono);
    font-size: 11px;
}

.group-row th {
    padding-top: 14px;
    padding-bottom: 5px;
    background: var(--sunken);
    color: var(--ink);
    text-align: left;
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.01em;
    border-bottom-color: var(--axis);
}

.group-label {
    position: sticky;
    left: 10px;
}

.group-count {
    margin-left: 6px;
    color: var(--ink-2);
    font-weight: 400;
}

.data-row {
    cursor: pointer;
}

.data-row:hover > * {
    background: var(--hover);
}

/* Changed in the tip block: accent bar + faint wash; flash when it arrives. */
.data-row.is-changed > * {
    background: var(--wash);
}

.data-row.is-changed:hover > * {
    background: color-mix(in srgb, var(--series-1) 13%, var(--surface));
}

.data-row.is-changed > th.col-row {
    box-shadow: inset 3px 0 0 var(--series-1), inset -1px 0 0 var(--grid);
}

.data-row.is-flash > * {
    animation: flash-bg 2.4s ease-out;
}

@keyframes flash-bg {
    from {
        background-color: var(--flash);
    }
}

.cell-value {
    display: block;
}

.cell-zero {
    color: var(--ink-2);
}

.delta {
    display: block;
    margin-top: 1px;
    color: var(--ink-2);
    font-size: 11px;
    line-height: 1.2;
}

.pct {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.pct .meter {
    width: 34px;
}

/* Compact hides 2y-5y, but never the column the table is sorted by. */
.supply.is-compact .opt:not(.is-sorted) {
    display: none;
}

/* --------------------------------------------------------------- feeds */

.pane-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
}

.why {
    margin-left: auto;
    font-size: 12.5px;
    color: var(--ink-2);
}

.why summary {
    cursor: pointer;
    list-style-position: inside;
}

.why[open] {
    flex-basis: 100%;
    margin-left: 0;
}

.why-body {
    margin-top: 6px;
    padding: 10px 12px;
    border-radius: 6px;
    background: var(--sunken);
    color: var(--ink);
    line-height: 1.45;
}

.why-body h3 {
    font-size: 12.5px;
    margin: 0 0 2px;
}

.why-body ul {
    margin: 0 0 8px;
    padding-left: 18px;
}

.why-body p {
    color: var(--ink-2);
}

.events {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* A notable event's row; its parts are notable-row.css's. */
.event {
    padding: 10px 16px;
    border-bottom: 1px solid var(--grid);
}

.event.is-new {
    animation: flash-bg 2.4s ease-out;
}

/* A row, card or offer that just arrived over the live stream (core/live.js). */
.is-live-new {
    animation: flash-bg 2.4s ease-out;
}

.reasons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.reason {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 1px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--chip);
    font-size: 12px;
    line-height: 18px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.reason-tag {
    color: var(--ink-2);
    font-weight: 400;
}

.sep {
    color: var(--muted);
}

.kv {
    font-size: 13px;
    overflow-wrap: anywhere;
}

.k {
    display: inline-block;
    min-width: 4.5em;
    color: var(--ink-2);
    font-size: 12px;
}

.moved-list {
    display: inline;
}

/* A moved row: its badges (icon only), its label and count, kept together. */
.moved-entry {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    vertical-align: bottom;
}

.moved-sep {
    color: var(--muted);
}

.reason .sat-badges,
.moved-entry .sat-badges {
    flex: none;
}

/* The badge stacks of the feeds: a little smaller than in the tables
   (badges.css sizes a pill and a capsule by these). */
.reason .sat-badges,
.moved-entry .sat-badges {
    --sb-size: 21px;
    --sb-glyph: 12px;
    --sb-pad: 5px;
}

.parties {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 3px 10px;
    align-items: baseline;
    font-size: 13px;
}

.parties > .k {
    min-width: 0;
}

.party-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
    min-width: 0;
}

.party {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 8px;
    min-width: 0;
    font-variant-numeric: tabular-nums;
}

.party-addr {
    min-width: 0;
    overflow-wrap: anywhere;
}

.party-val {
    color: var(--ink-2);
    font-size: 12.5px;
}

.flag {
    display: inline-block;
    padding: 0 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
    color: var(--ink-2);
    font-size: 11px;
    line-height: 16px;
}

.fee,
.dormancy {
    color: var(--ink-2);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}

.load-more {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 12px 16px 16px;
    color: var(--ink-2);
    font-size: 12.5px;
}

/* ------------------------------------------------------------- detail */

dialog.detail {
    width: min(1040px, 100vw);
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0 0 0 auto;
    padding: 0;
    border: 0;
    border-left: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow);
    overflow: hidden;
}

dialog.detail[open] {
    display: flex;
    flex-direction: column;
}

dialog.detail::backdrop {
    background: var(--backdrop);
}

.detail-head {
    flex: none;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 12px 10px 20px;
    border-bottom: 1px solid var(--grid);
}

.detail-heading {
    flex: 1 1 auto;
    min-width: 0;
}

.detail-group {
    color: var(--ink-2);
    font-size: 12px;
}

#detail-title {
    font-size: 19px;
    font-weight: 650;
    overflow-wrap: anywhere;
}

#detail-title:focus {
    outline: none;
}

.detail-id {
    margin-left: 8px;
    color: var(--ink-2);
    font-family: var(--mono);
    font-size: 12.5px;
    font-weight: 400;
}

.detail-def {
    margin-top: 2px;
    color: var(--ink-2);
    font-size: 12.5px;
    overflow-wrap: anywhere;
}

.detail-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 14px 20px 28px;
}

/* Refetch keeps the frame: the old render dims, nothing jumps. */
.detail-content {
    transition: opacity 0.2s ease;
}

.detail-content.is-loading {
    opacity: 0.5;
}

.detail-alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--critical) 9%, var(--surface));
    font-size: 13px;
}

.detail-alert .btn {
    height: 26px;
    margin-left: auto;
    font-size: 12px;
}

.detail-loading {
    padding: 32px 0;
    color: var(--ink-2);
}

.section {
    margin-top: 22px;
}

.section:first-child {
    margin-top: 0;
}

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-bottom: 10px;
}

.section-head h3 {
    font-size: 14px;
    font-weight: 650;
    margin-right: auto;
}

.section-note {
    color: var(--ink-2);
    font-size: 12.5px;
}

/* Six tiles: one row on a wide sheet, 3 x 2 on tablets, 2 x 3 on phones. */
.tiles {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

@media (max-width: 1079.98px) {
    .tiles {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.tile {
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.tile-label {
    color: var(--ink-2);
    font-size: 12px;
}

/* Proportional figures on standalone values (tabular only where columns align). */
.tile-value {
    margin-top: 2px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.tile-value--long {
    font-size: 15px;
    line-height: 1.45;
}

.tile-sub {
    margin-top: 2px;
    color: var(--ink-2);
    font-size: 12px;
}

.tile .delta {
    display: inline;
    font-size: 12px;
}

.active-strip {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.active-cell {
    padding: 7px 10px;
    border-left: 1px solid var(--grid);
    font-variant-numeric: tabular-nums;
    min-width: 0;
}

.active-cell:first-child {
    border-left: 0;
}

.active-cell dt {
    color: var(--ink-2);
    font-size: 12px;
}

.active-cell dd {
    margin: 0;
    font-size: 13.5px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

@media (max-width: 719.98px) {
    .active-strip {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .active-cell:nth-child(4) {
        border-left: 0;
    }

    .active-cell:nth-child(n + 4) {
        border-top: 1px solid var(--grid);
    }
}

/* ------------------------------------------------------------- charts */

.chart-figure {
    position: relative;
    margin: 0;
    border-radius: var(--radius);
    touch-action: pan-y;
}

.chart-figure:focus-visible {
    outline-offset: 4px;
}

.chart-panel + .chart-panel {
    margin-top: 10px;
}

.chart-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 10px;
    font-size: 13px;
    font-weight: 600;
}

.chart-last {
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

.chart-svg {
    display: block;
    width: 100%;
    overflow: visible;
    user-select: none;
    -webkit-user-select: none;
}

.chart-grid {
    stroke: var(--grid);
    stroke-width: 1;
    shape-rendering: crispEdges;
}

.chart-baseline {
    stroke: var(--axis);
    stroke-width: 1;
    shape-rendering: crispEdges;
}

.chart-tick {
    fill: var(--muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.chart-line {
    fill: none;
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.chart-area {
    stroke: none;
    fill-opacity: 0.1;
}

.series-1 .chart-line { stroke: var(--series-1); }
.series-1 .chart-area,
.series-1 .chart-dot { fill: var(--series-1); }
.series-2 .chart-line { stroke: var(--series-2); }
.series-2 .chart-area,
.series-2 .chart-dot { fill: var(--series-2); }

/* 2 px surface ring keeps markers legible where they sit on the line. */
.chart-dot {
    stroke: var(--surface);
    stroke-width: 2;
}

.chart-cross {
    stroke: var(--ink-2);
    stroke-width: 1;
    shape-rendering: crispEdges;
}

.chart-hit {
    fill: transparent;
    cursor: crosshair;
}

/* Line key: a short stroke of the series color beside text in ink. */
.key {
    display: inline-block;
    flex: none;
    width: 14px;
    height: 0;
    border-top: 2px solid;
    border-radius: 1px;
    vertical-align: middle;
}

.key--1 {
    border-top-color: var(--series-1);
}

.key--2 {
    border-top-color: var(--series-2);
}

.key--3 {
    border-top-color: var(--series-3);
}

.key--other {
    border-top-color: var(--muted);
}

.key--ink {
    border-top-color: var(--ink);
}

.chart-tip {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 5;
    min-width: 170px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    box-shadow: var(--shadow);
    pointer-events: none;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.tip-head {
    font-weight: 600;
}

.tip-date {
    color: var(--ink-2);
    margin-bottom: 4px;
}

/* One grid for all rows so the values line up: key | value | label. */
.tip-grid {
    display: grid;
    grid-template-columns: 14px auto auto;
    align-items: center;
    gap: 3px 8px;
}

/* Values lead (strong, primary ink); series names follow in secondary ink. */
.tip-grid strong {
    font-weight: 650;
    text-align: right;
}

.tip-grid > span:not(.key) {
    color: var(--ink-2);
}

.chart-empty {
    padding: 28px 12px;
    border: 1px dashed var(--axis);
    border-radius: var(--radius);
    color: var(--ink-2);
    text-align: center;
}

/* ------------------------------------------------ detail tables (twin, holders) */

.table-x {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    /* The containing block of what is positioned inside (a visually hidden
       caption): else it lies outside the scroll frame and widens the page. */
    position: relative;
}

.table-x--tall {
    max-height: 420px;
    overflow-y: auto;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--grid);
    text-align: right;
    white-space: nowrap;
    background: var(--surface);
}

.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: var(--ink-2);
    font-weight: 600;
    /* A fixed line box, which the sort arrow's preview lines up with. */
    line-height: 17px;
    border-bottom-color: var(--axis);
}

.data-table tbody tr:last-child > * {
    border-bottom: 0;
}

.data-table .left {
    text-align: left;
}

.data-table .rank {
    width: 1%;
    color: var(--ink-2);
}

/* Stacked, not side by side: each table then has room for every column. */
.holders-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
}

.holders-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 10px;
    margin-bottom: 6px;
}

.holders-head h4 {
    margin: 0;
    font-size: 13.5px;
    font-weight: 650;
}

/* What the list is: the fork's top N by sats, and how the table sorts it. */
.holders-scope {
    color: var(--ink-2);
    font-size: 12.5px;
}

.holders-order {
    color: var(--ink);
}

.holders-more {
    margin-top: 6px;
}

/* Last received: the date (linked to its block), then how long ago. */
.received-age::before {
    content: " · ";
    color: var(--muted);
}

.received-age {
    color: var(--ink-2);
}

/* -------------------------------------------------------------- sales */

.sales-body {
    padding: 12px 16px 24px;
}

.sales-content {
    transition: opacity 0.2s ease;
}

/* Refetch keeps the frame: the last render dims, nothing jumps. */
.sales-content.is-loading {
    opacity: 0.55;
}

.sales-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 14px;
    margin-bottom: 8px;
    font-size: 12.5px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink);
    font: inherit;
}

button.legend-item {
    cursor: pointer;
}

button.legend-item:hover {
    text-decoration: underline;
    text-decoration-color: var(--underline);
    text-underline-offset: 2px;
}

.legend-key {
    color: var(--ink-2);
}

.legend-count {
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
}

/* The marks the chart draws, at legend size. */
.legend-dot {
    display: inline-block;
    flex: none;
    width: 9px;
    height: 9px;
    border: 0;
    border-radius: 50%;
    background: var(--series-1);
}

.legend-dot.key--2 {
    background: var(--series-2);
}

.legend-dot.key--3 {
    background: var(--series-3);
}

.legend-dot.key--other {
    background: var(--muted);
}

.legend-ring {
    display: inline-block;
    flex: none;
    width: 9px;
    height: 9px;
    border: 1.5px solid var(--ink-2);
    border-radius: 50%;
}

.legend-diamond {
    display: inline-block;
    flex: none;
    width: 8px;
    height: 8px;
    margin: 0 1px;
    background: var(--ink-2);
    transform: rotate(45deg);
}

/* A rarer sub-category's sale: the chart's lighter tone. */
.legend-faint {
    display: inline-block;
    flex: none;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--ink-2);
    opacity: 0.3;
}

.key--faint {
    opacity: 0.4;
}

.row-sub {
    color: var(--ink-2);
}

/* A Sales table's row cell: the lead row's badges, label and "×3", kept together. */
.sale-lead {
    gap: 6px;
    vertical-align: middle;
    white-space: nowrap;
}

.sale-lead .sat-badges {
    flex: none;
}

/* The Sales tables stay dense: their badges (the lead row's and the "+"
   chip's) a size down. */
.sales-table .sat-badges {
    --sb-size: 20px;
    --sb-glyph: 12px;
    --sb-pad: 5px;
}

.sale-qty {
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
    cursor: help;
}

/* A sale another row led, under one of its secondary rows: "with Alpha uncommon". */
.row-led {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
    cursor: help;
}

.sales-figure {
    position: relative;
    margin: 0;
    border-radius: var(--radius);
    touch-action: pan-y;
    cursor: crosshair;
}

.sales-figure:focus-visible {
    outline-offset: 4px;
}

.sales-canvas {
    display: block;
}

.sales-axes {
    position: absolute;
    top: 0;
    left: 0;
    overflow: visible;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

.chart-tick--major {
    fill: var(--ink-2);
}

/* The sale under the pointer or the keyboard: a ring that never hides it. */
.sales-marker {
    fill: none;
    stroke: var(--ink);
    stroke-width: 2;
}

.sales-tip {
    max-width: min(320px, calc(100vw - 48px));
    cursor: auto;
}

/* Pinned (a click, a tap, Enter), it takes the pointer: its links work. */
.sales-tip.is-pinned {
    pointer-events: auto;
    border-color: var(--control-border);
}

.sale-tip > div + div {
    margin-top: 3px;
}

.sale-tip-price strong {
    font-size: 15px;
    font-weight: 650;
}

.sale-tip-price span,
.sale-tip-meta,
.sale-tip-more {
    color: var(--ink-2);
}

.sale-tip-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.sale-tip-sat {
    overflow-wrap: anywhere;
}

.sale-tip-flag {
    color: var(--ink-2);
    font-style: italic;
}

.sales-stats {
    margin-top: 10px;
}

.sales-market {
    font-size: 13px;
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
}

.sales-market strong {
    color: var(--ink);
    font-weight: 650;
}

.sales-table-wrap {
    margin-top: 16px;
}

.sales-list-note {
    margin-top: 6px;
    color: var(--ink-2);
    font-size: 12px;
}

.sales-list .btn {
    margin-top: 8px;
}

.data-table .center {
    text-align: center;
}

.sat-more {
    color: var(--ink-2);
}

.outlier-mark {
    color: var(--ink-2);
}

.section-link {
    font-size: 12.5px;
}

.sale-tip-sat .sep,
.sales-market .sep {
    margin: 0 5px;
}

/* ------------------------------------------------------------- phones */

@media (max-width: 719.98px) {
    .panes {
        padding: 0;
    }

    /* A phone scrolls the Sales page as one: its filters go up with the
       chart and the table, instead of a window under fixed filters. */
    .pane--sales {
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .pane--sales > * {
        flex-shrink: 0;
    }

    .pane--sales > .sales-body {
        flex: 1 0 auto;
        overflow: visible;
    }

    .pane {
        border: 0;
        border-radius: 0;
    }

    .pane-head {
        padding: 8px 12px 0;
    }

    .filters {
        padding: 6px 12px 8px;
        gap: 6px 8px;
    }

    .field--search {
        flex: 1 1 140px;
        max-width: none;
    }

    .field select {
        max-width: 150px;
    }

    /* The tab already names the pane; keep the heading for screen readers. */
    .pane-head h2 {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .supply th.col-row {
        min-width: 0;
    }

    .row-link {
        max-width: 112px;
    }

    .supply th,
    .supply td {
        padding-left: 7px;
        padding-right: 7px;
    }

    .event {
        padding: 10px 12px;
    }

    .load-more {
        padding: 12px;
    }

    .sales-body {
        padding: 10px 12px 20px;
    }

    dialog.detail {
        width: 100vw;
        border-left: 0;
    }

    .detail-head {
        padding: 8px 6px 8px 14px;
    }

    .detail-body {
        padding: 12px 14px 24px;
    }

    .tiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tile-value {
        font-size: 17px;
    }

    .tile {
        padding: 9px 10px;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding-left: 5px;
        padding-right: 5px;
    }
}

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

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

/* Without motion a new live item is outlined instead, while it is new. */
@media (prefers-reduced-motion: reduce) {
    .is-live-new {
        outline: 2px solid var(--focus);
        outline-offset: -2px;
    }
}

/* Forced colors: meters and switches need real borders to stay visible. */
@media (forced-colors: active) {
    .meter,
    .switch-track {
        border: 1px solid CanvasText;
    }

    .meter > span {
        background: Highlight;
    }

    .data-row.is-changed > th.col-row {
        border-left: 3px solid Highlight;
    }
}

/* The footer: header.css. */

/* --------------------------------------------------------------- market */

/* A row of toggle buttons: the market's window. */
.segmented {
    display: inline-flex;
    border: 1px solid var(--control-border);
    border-radius: 8px;
    overflow: hidden;
}

.segmented button {
    padding: 4px 10px;
    border: 0;
    background: var(--surface);
    color: var(--ink-2);
    font: inherit;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

.segmented button + button {
    border-left: 1px solid var(--grid);
}

.segmented button:hover {
    color: var(--ink);
    background: var(--hover);
}

.segmented button[aria-pressed="true"] {
    background: var(--ink);
    color: var(--surface);
    font-weight: 600;
}

.segmented button:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: -2px;
}

.market-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 12px 16px 20px;
}

.market-content.is-loading {
    opacity: 0.6;
}

@media (min-width: 1100px) {
    .market-content {
        grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
        align-items: start;
    }
}

.market-main,
.market-side {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.market-card {
    min-width: 0;
    padding: 12px 14px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.market-card h3 {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 650;
}

.market-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

/* Positioned, so the screen-reader text inside stays inside. */
.market-stat {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    padding: 10px 14px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.market-stat-label {
    color: var(--ink-2);
    font-size: 11.5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.market-stat-value {
    font-size: 24px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.market-stat-change {
    color: var(--ink-2);
    font-size: 12px;
}

/* An amount in bitcoin, with the mark after it. */
.btc {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.btc-mark {
    flex: none;
    width: 8px;
    height: 12px;
}

.btc--big {
    gap: 5px;
}

.btc--big .btc-mark {
    width: 12px;
    height: 18px;
}

/* Up and down against the window before; the arrows carry it as well. */
.change {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.change--up {
    color: color-mix(in srgb, var(--good) 70%, var(--ink));
}

.change--down {
    color: var(--critical);
}

.change--flat,
.change--none {
    color: var(--ink-2);
}

/* Every category that sold is listed: rows a little tighter than a data table's. */
.market-table tbody td {
    padding-top: 3px;
    padding-bottom: 3px;
}

.market-table .market-rank {
    width: 1%;
    color: var(--ink-2);
}

.market-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: inherit;
    text-decoration: none;
}

.market-row:hover .market-row-label,
.market-row:focus-visible .market-row-label {
    text-decoration: underline;
    text-decoration-color: var(--underline);
    text-underline-offset: 2px;
}

.market-table .market-share {
    min-width: 110px;
}

.market-share .meter {
    width: 56px;
    margin-right: 8px;
}

.market-board .table-x {
    position: relative;
}

/* The leaderboard's group chips (filters.css .flt-chip), above its table. */
.market-groups {
    margin-bottom: 10px;
}

/* The dearest sales: tiles sized by price, wrapping into rows. Each is a
   button: its details open in a popover (sale-detail.css). */
.mosaic {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mosaic-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    height: 72px;
    margin: 0;
    padding: 7px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--sunken);
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
}

.mosaic-tile:hover,
.mosaic-tile[aria-expanded="true"] {
    border-color: var(--control-border);
    background: var(--hover);
}

.mosaic-tile:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.mosaic-badges {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
}

.mosaic-price {
    font-size: 14px;
    font-weight: 650;
}

.mosaic-line {
    overflow: hidden;
    color: var(--ink-2);
    font-size: 11.5px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.mosaic-tile--big {
    height: 88px;
}

.mosaic-tile--big .mosaic-price {
    font-size: 19px;
}

/* A pair or a bundle on the compact line: "+1", the chip in the details. */
.sale-pair-hint {
    flex: none;
    padding: 0 5px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--ink-2);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 16px;
}

/* The latest sales: one line each, its details below it on a click. */
.market-latest {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
}

.market-latest > li {
    min-width: 0;
    border-bottom: 1px solid var(--grid);
}

.market-latest > li:last-child {
    border-bottom: 0;
}

.market-latest .detail-row-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 6.6em 10px;
    align-items: center;
    gap: 8px;
    padding: 7px 2px;
}

.market-latest-name {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.market-latest-name .market-row-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.market-latest-name .sat-badges {
    flex: none;
}

.market-latest-ago {
    color: var(--ink-2);
    font-size: 12px;
    text-align: right;
    white-space: nowrap;
}

/* A phone: two columns, the dearest sale across both. */
@media (max-width: 719.98px) {
    .mosaic {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .mosaic > .mosaic-tile:first-child {
        grid-column: span 2;
    }

    .mosaic-tile,
    .mosaic-tile--big {
        height: 84px;
    }

    .mosaic-tile .mosaic-price {
        font-size: 17px;
    }

    .mosaic > .mosaic-tile:first-child {
        height: 96px;
    }

    .mosaic > .mosaic-tile:first-child .mosaic-price {
        font-size: 22px;
    }

    .market-latest .detail-row-summary {
        padding: 9px 2px;
    }
}

/* A row's badges before its name: in the Statistics table and the Sales
   heading too. */
.row-label .sat-badges,
.sales-heading-badges .sat-badges {
    margin-right: 6px;
}

@media (max-width: 719.98px) {
    .market-content {
        padding: 10px 12px 16px;
    }

    .market-stats {
        gap: 6px;
    }

    .market-stat {
        padding: 8px 10px;
    }

    .market-stat-value {
        font-size: 17px;
    }

    .segmented button {
        padding: 4px 8px;
    }
}

/* The leaderboard's rows with no sales in the window: under those with. */
.market-table tr.market-quiet td:not(.left) {
    color: var(--muted);
}

.market-board-more {
    margin-top: 8px;
}

/* The Sales pane's pending sales (app.js renderSalesPending): above the
   confirmed ones, in no chart or count. */
.sales-pending {
    margin: 12px 0 16px;
}

.sales-pending-title {
    margin: 0 0 2px;
    font-size: 14px;
}

.sales-pending .section-note {
    margin: 0 0 8px;
}

/* ------------------------------------------------- the "Columns" menu */
/* core/columns.js: a button over a table, opening a list of checkboxes. */

.colpick {
    position: relative;
    display: inline-flex;
}

.colpick-btn {
    height: 30px;
}

/* At a table's right edge, the menu opens leftwards. */
.colpick--end .colpick-menu {
    left: auto;
    right: 0;
}

.colpick-caret {
    margin-left: 4px;
    color: var(--ink-2);
    font-size: 10px;
}

.colpick-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 30;
    display: grid;
    gap: 2px;
    min-width: 200px;
    max-width: calc(100vw - 32px);
    padding: 6px;
    border: 1px solid var(--grid);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.colpick-menu[hidden] {
    display: none;
}

.colpick-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.colpick-item:hover {
    background: var(--hover);
}

.colpick-name {
    flex: 1 1 auto;
}

.colpick-tag {
    color: var(--ink-2);
    font-size: 11px;
}

.colpick-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
    padding: 6px 8px 2px;
    border-top: 1px solid var(--grid);
}

.colpick-count {
    color: var(--ink-2);
    font-size: 12px;
}
