:root {
    --bg: #090d10;
    --bg-raised: #0d1318;
    --surface: #111a21;
    --surface-2: #16212a;
    --surface-hover: #1d2a35;
    --border: #263541;
    --border-soft: #1b2832;
    --text: #e7edf2;
    --text-dim: #a7b4bf;
    --text-muted: #72818e;
    --accent: #38bdf8;
    --accent-2: #2dd4bf;
    --green: #22c55e;
    --red: #f87171;
    --yellow: #f59e0b;
    --rose: #fb7185;
    --shadow: 0 18px 60px rgba(0, 0, 0, 0.24);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Themed text selection */
::selection {
    background: rgba(56, 189, 248, 0.32);
    color: #f1f8fc;
}

/* Thin themed scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
*::-webkit-scrollbar-track {
    background: transparent;
}
*::-webkit-scrollbar-thumb {
    background: var(--border);
    border: 2px solid transparent;
    background-clip: padding-box;
    border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover {
    background: var(--surface-hover);
    background-clip: padding-box;
    border: 2px solid transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background:
        linear-gradient(180deg, rgba(18, 28, 35, 0.78), rgba(9, 13, 16, 0) 360px),
        var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.highlight-outdated .outdated { color: var(--red) !important; }

.nav-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.dev-badge {
    background: rgba(234, 179, 8, 0.2);
    color: #eab308;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 2rem;
    background: rgba(13, 19, 24, 0.88);
    border-bottom: 1px solid var(--border-soft);
    backdrop-filter: blur(18px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}
.nav-brand:hover { text-decoration: none; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.nav-links a { color: var(--text-dim); font-size: 0.9rem; }
.nav-links a:hover { color: var(--text); text-decoration: none; }

.collect-button {
    appearance: none;
    border: 1px solid rgba(56, 189, 248, 0.55);
    border-radius: 6px;
    background: rgba(56, 189, 248, 0.13);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1;
    min-width: 118px;
    padding: 0.55rem 0.75rem;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.collect-button:hover:not(:disabled),
.collect-button:focus-visible:not(:disabled) {
    background: rgba(56, 189, 248, 0.22);
    border-color: var(--accent);
}
.collect-button:disabled {
    color: var(--text-dim);
    cursor: wait;
    opacity: 0.82;
}

.container {
    max-width: 1480px;
    margin: 0 auto;
    padding: 2.25rem;
    flex: 1;
    width: 100%;
}

.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
}
.footer p { margin: 0.35rem 0; }
.footer-links {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
}
.footer-links a { color: var(--accent); }
.footer-links a:hover { text-decoration: underline; }
.footer-contact {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
}
.footer-contact a { color: var(--accent); }
.footer-contact a:hover { text-decoration: underline; }
.footer p.footer-disclaimer {
    max-width: 540px;
    margin: 0.75rem auto 0;
    font-size: 0.7rem;
    line-height: 1.4;
    text-align: center;
    opacity: 0.7;
}

.newsletter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0 0 1.1rem;
}
.newsletter-label {
    color: var(--text-dim);
    font-size: 0.8rem;
}
.newsletter-input {
    appearance: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-raised);
    color: var(--text);
    font: inherit;
    font-size: 0.85rem;
    line-height: 1;
    padding: 0.55rem 0.65rem;
    width: 200px;
    max-width: 100%;
    transition: border-color 0.2s;
}
.newsletter-input::placeholder { color: var(--text-muted); }
.newsletter-input:focus {
    outline: none;
    border-color: var(--accent);
}
.newsletter-button {
    appearance: none;
    border: 1px solid rgba(56, 189, 248, 0.55);
    border-radius: 6px;
    background: rgba(56, 189, 248, 0.13);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.55rem 0.9rem;
    transition: background 0.2s, border-color 0.2s;
}
.newsletter-button:hover,
.newsletter-button:focus-visible {
    background: rgba(56, 189, 248, 0.22);
    border-color: var(--accent);
}

h1 {
    font-size: clamp(1.9rem, 3vw, 3rem);
    letter-spacing: 0;
    line-height: 1.05;
    margin-bottom: 0.75rem;
}
h2 {
    color: var(--text);
    font-size: 1.08rem;
    letter-spacing: 0;
    margin: 2rem 0 1rem;
}
h3 {
    color: var(--text);
    font-size: 0.96rem;
    letter-spacing: 0;
    margin-bottom: 0.75rem;
}

.chain-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(45, 212, 191, 0.12);
    border: 1px solid rgba(45, 212, 191, 0.34);
    color: #9ff5ea;
    vertical-align: middle;
    margin-left: 0.5rem;
}

.consensus-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.34);
    color: #b8eaff;
    vertical-align: middle;
    margin-left: 0.5rem;
}

/* Network Grid */
.network-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1.5rem;
}

.network-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    transition: border-color 0.2s, transform 0.2s;
    display: block;
    color: var(--text);
}
.network-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    text-decoration: none;
}

.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}
.card-header h2 { font-size: 1.25rem; margin: 0; }

.card-price {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1rem;
}
.price { font-size: 1.75rem; font-weight: 700; }
.price.dim { color: var(--text-muted); }
.market-cap { color: var(--text-dim); font-size: 0.85rem; }

.card-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat {
    display: flex;
    flex-direction: column;
}
.stat-label { font-size: 0.75rem; color: var(--text-muted); }
.stat-value { font-size: 1rem; font-weight: 600; }

.card-footnote {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: -0.25rem 0 0.75rem;
}

.sparkline-container { height: 60px; margin-top: 0.5rem; }

.dashboard-section { margin-top: 2.5rem; }

/* Network Detail */
.breadcrumb {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--text-dim); }

.network-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.network-header h1 { display: inline; margin: 0; }
.header-price { text-align: right; }
.price-large { font-size: 2.5rem; font-weight: 700; display: block; }
.meta { color: var(--text-dim); font-size: 0.9rem; display: block; }
.ext-link { color: var(--text-muted); font-size: 0.85rem; display: block; margin-top: 0.25rem; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.metric-section + .metric-section { margin-top: 0.5rem; }

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
}
.stat-card .stat-label { display: block; margin-bottom: 0.25rem; font-size: 0.75rem; color: var(--text-muted); }
.stat-card .stat-value { font-size: 1.25rem; font-weight: 600; }

/* Compute Table */
.compute-table-wrap { overflow-x: auto; }
.compute-table,
.metrics-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
}
.compute-table th,
.compute-table td,
.metrics-table th,
.metrics-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.compute-table th,
.metrics-table th {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.compute-table td,
.metrics-table td { font-size: 0.9rem; }

.metrics-table tfoot th,
.metrics-table tfoot td {
    background: rgba(10, 17, 22, 0.72);
    border-top: 1px solid #2d3e4b;
    color: var(--text);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.gpu-breakdown-optional {
    display: none;
}

.metrics-table-wrap { overflow-x: auto; }
.metrics-table code {
    color: var(--text-dim);
    background: #111827;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1rem 0.3rem;
}

.source-link {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--accent);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.source-link:hover {
    background: var(--accent);
    color: white;
    text-decoration: none;
}

.util-bar {
    display: inline-block;
    width: 80px;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    vertical-align: middle;
    margin-right: 0.5rem;
}
.util-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
    gap: 1.5rem;
}

.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    min-width: 0;
}
.chart-frame {
    position: relative;
    width: 100% !important;
    height: 260px !important;
    min-height: 260px;
    max-height: 260px;
    overflow: hidden;
}
.chart-frame canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-dim);
}
.empty-state code {
    background: var(--surface);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .navbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
    }
    .nav-links {
        flex-wrap: wrap;
        gap: 0.75rem 1rem;
    }
    .container { padding: 1rem; }
    .network-grid { grid-template-columns: 1fr; }
    .charts-grid { grid-template-columns: 1fr; }
    .network-header { flex-direction: column; }
    .header-price { text-align: left; }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--surface);
    margin: 5% auto;
    padding: 2rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 80%;
    max-width: 800px;
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
}

.close {
    color: var(--text-dim);
    position: absolute;
    right: 1.5rem;
    top: 1rem;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
}

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

.status-badge {
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.status-running { background: rgba(16, 185, 129, 0.2); color: var(--green); }
.status-ok { background: rgba(16, 185, 129, 0.2); color: var(--green); }
.status-empty { background: rgba(245, 158, 11, 0.2); color: var(--yellow); }
.status-error { background: rgba(239, 68, 68, 0.2); color: var(--red); }
.status-active { background: rgba(16, 185, 129, 0.2); color: var(--green); }
.status-idle { background: rgba(245, 158, 11, 0.2); color: var(--yellow); }
.status-down { background: rgba(239, 68, 68, 0.2); color: var(--red); }

.expand-btn {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.expand-btn:hover {
    background: var(--accent);
    color: white;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}
.detail-label { color: var(--text-dim); font-size: 0.9rem; }
.detail-value { font-weight: 600; }
.detail-section { margin-top: 1.5rem; }
.detail-section h4 { border-bottom: 2px solid var(--border); padding-bottom: 0.5rem; margin-bottom: 0.5rem; }

/* --- Projects spreadsheet --- */
.subtitle {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

.table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.projects-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.projects-table thead th {
    text-align: left;
    padding: 0.75rem 1rem;
    background: rgba(99, 102, 241, 0.06);
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.projects-table thead th:hover {
    background: rgba(99, 102, 241, 0.14);
    color: var(--text);
}

.projects-table thead th.sorted {
    color: var(--accent);
    background: rgba(99, 102, 241, 0.18);
}

.projects-table .sort-arrow {
    display: inline-block;
    width: 0.9em;
    margin-left: 0.25rem;
    color: var(--accent);
    font-size: 0.75em;
}

.projects-table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.projects-table tbody tr:last-child td {
    border-bottom: none;
}

.projects-table tbody tr:hover {
    background: var(--surface-hover);
}

.projects-table tbody td:nth-child(n+3) {
    /* Numeric columns right-aligned for readability */
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.projects-table tbody td a {
    color: var(--text);
    font-weight: 600;
}
.projects-table tbody td a:hover { color: var(--accent); }

.highlight-outdated .projects-table tbody tr.outdated-row td {
    color: var(--text-dim);
}

.confidence-badge {
    display: inline-block;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.45);
    color: var(--text-dim);
    font-size: 0.78rem;
    line-height: 1;
    padding: 0.3rem 0.45rem;
}

/* --- Polished dashboard surfaces --- */
.page-heading {
    align-items: flex-end;
    display: flex;
    gap: 1.5rem;
    justify-content: space-between;
    margin-bottom: 1.35rem;
}

.page-heading h1,
.project-title-line h1 {
    margin: 0;
}

.subtitle {
    color: var(--text-dim);
    font-size: 0.95rem;
    margin: 0.55rem 0 0;
    max-width: 760px;
}

.projects-heading {
    margin-bottom: 0.9rem;
}

.projects-heading h1 {
    font-size: clamp(2rem, 3vw, 2.65rem);
}

.summary-strip {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    margin: 1.25rem 0 1.3rem;
}

.summary-tile,
.hero-kpi,
.metric-panel,
.utilization-card,
.chart-card,
.distribution-card,
.data-panel,
.data-section {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0.006)), var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.summary-tile {
    min-height: 104px;
    padding: 1rem;
}

.summary-label,
.summary-detail,
.stat-label,
.metric-label {
    color: var(--text-muted);
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
}

.summary-value {
    display: block;
    font-size: 1.7rem;
    font-weight: 750;
    letter-spacing: 0;
    line-height: 1.15;
    margin-top: 0.45rem;
}

.summary-detail {
    color: var(--text-dim);
    margin-top: 0.25rem;
}

.table-search {
    align-items: flex-start;
    display: grid;
    gap: 0.35rem;
    min-width: 280px;
}

.table-search span {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
}

.table-search input {
    appearance: none;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font: inherit;
    font-size: 0.92rem;
    min-height: 42px;
    outline: none;
    padding: 0.65rem 0.8rem;
    width: 100%;
}

.table-search input:focus {
    border-color: rgba(56, 189, 248, 0.7);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.data-panel,
.data-section {
    margin-top: 1.2rem;
    overflow: hidden;
}

.table-toolbar,
.data-section-header,
.section-heading,
.chart-card-header,
.distribution-card-header,
.metric-panel-header,
.utilization-card-header {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.table-toolbar,
.data-section-header {
    border-bottom: 1px solid var(--border-soft);
    padding: 1rem 1.1rem;
}

.table-toolbar h2,
.data-section-header h2,
.section-heading h2 {
    margin: 0;
}

.table-toolbar p,
.section-heading span,
.data-section-header span,
.chart-card-header span,
.distribution-card-header span,
.metric-panel-header span,
.utilization-card-header > span {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.row-count {
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.24);
    border-radius: 999px;
    color: #b8eaff;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.3rem 0.6rem;
    white-space: nowrap;
}

.table-wrap-large {
    border: 0;
    border-radius: 0;
    max-height: min(72vh, 820px);
}

.projects-table-large {
    min-width: 1120px;
}

.projects-table-primary {
    margin-top: 0.9rem;
}

.projects-table-toolbar {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0));
}

.table-meta-strip {
    align-items: center;
    background: rgba(10, 17, 22, 0.42);
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    gap: 0.45rem 1.1rem;
    overflow-x: auto;
    padding: 0.55rem 1.1rem;
}

.table-meta-strip span {
    color: var(--text-muted);
    flex: 0 0 auto;
    font-size: 0.76rem;
    font-weight: 700;
}

.table-meta-strip strong {
    color: var(--text);
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
    margin-right: 0.3rem;
}

.projects-panel .table-wrap-large {
    max-height: calc(100vh - 260px);
    min-height: 430px;
}

.projects-table-large thead th {
    background: #101922;
    border-bottom-color: #2d3e4b;
    color: #9fb0bd;
    padding: 0.92rem 1rem;
}

.projects-table-large thead th.sorted {
    background: #17233f;
}

.projects-table-large thead th[data-type="number"] {
    text-align: right;
}

.projects-table-large tbody td {
    background: rgba(17, 26, 33, 0.82);
    padding: 1rem;
    vertical-align: middle;
}

.projects-table-large tbody tr:hover td {
    background: var(--surface-hover);
}

.projects-table-large tbody td.num-cell {
    color: #d9e3ea;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.highlight-outdated .projects-table-large tbody td.outdated::after,
.highlight-outdated .metric-value.outdated::after,
.highlight-outdated .hero-kpi .outdated::after {
    background: var(--red);
    border-radius: 999px;
    content: "";
    display: inline-block;
    height: 0.38rem;
    margin-left: 0.42rem;
    vertical-align: 0.08rem;
    width: 0.38rem;
}

.project-name-cell {
    left: 0;
    min-width: 220px;
    position: sticky;
    z-index: 2;
}

.projects-table-large thead th:first-child {
    left: 0;
    position: sticky;
    z-index: 3;
}

.project-name-cell a {
    display: block;
    font-size: 0.98rem;
}

.project-name-cell span {
    color: var(--text-muted);
    display: block;
    font-size: 0.78rem;
    margin-top: 0.1rem;
}

.chain-chip {
    background: rgba(45, 212, 191, 0.08);
    border: 1px solid rgba(45, 212, 191, 0.24);
    border-radius: 999px;
    color: #a7f3d0;
    display: inline-block;
    font-size: 0.76rem;
    line-height: 1;
    padding: 0.35rem 0.55rem;
    text-transform: capitalize;
}

.consensus-chip {
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.24);
    border-radius: 999px;
    color: #b8eaff;
    display: inline-block;
    font-size: 0.76rem;
    line-height: 1;
    padding: 0.35rem 0.55rem;
}

.breadcrumb {
    margin-bottom: 1.1rem;
}

.project-hero {
    align-items: flex-start;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    gap: 1.5rem;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 1.4rem;
}

.project-title-line {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.project-identity .ext-link {
    margin-top: 0.65rem;
}

.price-large {
    color: #f8fbfd;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1;
}

.header-price .meta {
    font-variant-numeric: tabular-nums;
    margin-top: 0.25rem;
}

.hero-kpi-grid {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    margin-bottom: 1.4rem;
}

.hero-kpi {
    min-height: 110px;
    padding: 1rem;
}

.hero-kpi strong {
    color: var(--text);
    display: block;
    font-size: 1.55rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
    margin-top: 0.55rem;
}

.dashboard-band {
    margin-top: 2.2rem;
}

.section-heading {
    margin-bottom: 0.8rem;
}

.metric-panel-grid {
    align-items: start;
    display: grid;
    gap: 1rem;
    grid-auto-flow: dense;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.metric-panel {
    min-width: 0;
    padding: 1rem;
}

.metric-panel-wide {
    grid-column: span 2;
}

.metric-panel-wide .metric-list {
    column-gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-panel-wide .metric-row {
    min-height: 40px;
}

.metric-panel-header {
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 0.35rem;
    padding-bottom: 0.75rem;
}

.metric-panel-header h3,
.chart-card-header h3,
.distribution-card-header h3 {
    margin: 0;
}

.metric-panel-header span {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 999px;
    padding: 0.18rem 0.5rem;
}

.metric-list {
    display: grid;
}

.metric-row {
    align-items: baseline;
    border-bottom: 1px solid rgba(38, 53, 65, 0.58);
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 44px;
    padding: 0.65rem 0;
}

.metric-row:last-child {
    border-bottom: 0;
}

.metric-value {
    color: #eaf1f6;
    font-size: 0.98rem;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    min-width: max-content;
    text-align: right;
}

.utilization-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.utilization-card {
    padding: 1rem;
}

.utilization-card-header strong {
    display: block;
    font-size: 1.8rem;
    line-height: 1.05;
    margin-top: 0.25rem;
}

.allocation-bar {
    background: #0a1116;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    display: flex;
    height: 12px;
    margin: 1rem 0 0.85rem;
    overflow: hidden;
}

.allocation-bar span {
    display: block;
    min-width: 0;
}

.allocation-used { background: var(--accent); }
.allocation-available { background: var(--green); }
.allocation-pending { background: var(--yellow); }

.allocation-facts {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.allocation-facts span {
    color: var(--text-muted);
    display: block;
    font-size: 0.72rem;
}

.allocation-facts strong {
    display: block;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.charts-grid {
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.chart-card {
    padding: 1rem;
}

.chart-card-header {
    margin-bottom: 0.8rem;
}

.chart-frame {
    background: #0b1116;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    height: 280px !important;
    max-height: 280px;
    min-height: 280px;
    padding: 0.2rem;
}

.distribution-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.distribution-card {
    padding: 1rem;
}

.distribution-body {
    align-items: center;
    display: grid;
    gap: 1rem;
    grid-template-columns: 210px minmax(0, 1fr);
    margin-top: 0.9rem;
}

.distribution-canvas-wrap {
    height: 210px;
    min-width: 0;
    position: relative;
}

.rank-list {
    counter-reset: rank;
    display: grid;
    gap: 0.45rem;
    list-style: none;
}

.rank-list li {
    align-items: center;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(38, 53, 65, 0.68);
    border-radius: 6px;
    display: flex;
    gap: 0.8rem;
    justify-content: space-between;
    min-width: 0;
    padding: 0.55rem 0.65rem;
}

.rank-list span {
    color: var(--text-dim);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-list strong {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.enhanced-table {
    background: transparent;
}

.enhanced-table th {
    background: #101922;
}

.enhanced-table tr:hover td {
    background: rgba(29, 42, 53, 0.62);
}

.source-link,
.expand-btn {
    border-color: rgba(56, 189, 248, 0.52);
    color: var(--accent);
}

.source-link:hover,
.expand-btn:hover {
    background: var(--accent);
    color: #061015;
}

@media (max-width: 820px) {
    .page-heading,
    .project-hero {
        align-items: stretch;
        flex-direction: column;
    }

    .table-search {
        min-width: 0;
        width: 100%;
    }

    .header-price {
        text-align: left;
    }

    .distribution-body {
        grid-template-columns: 1fr;
    }

    .distribution-canvas-wrap {
        height: 230px;
        max-width: 320px;
        width: 100%;
    }

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

    .metric-panel-wide {
        grid-column: auto;
    }

    .metric-panel-wide .metric-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    .summary-strip,
    .hero-kpi-grid,
    .metric-panel-grid,
    .utilization-grid,
    .charts-grid,
    .distribution-grid {
        grid-template-columns: 1fr;
    }

    .table-toolbar,
    .data-section-header,
    .section-heading,
    .chart-card-header,
    .distribution-card-header,
    .metric-panel-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.35rem;
    }

    .project-name-cell,
    .projects-table-large thead th:first-child {
        left: auto;
        position: static;
    }

    .chart-frame {
        height: 240px !important;
        max-height: 240px;
        min-height: 240px;
    }
}

/* --- Collector debug --- */
.debug-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1rem;
}

.debug-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    min-width: 0;
}

.debug-card-header {
    align-items: flex-start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.debug-card-header h2 {
    color: var(--text);
    font-size: 1.05rem;
    margin: 0;
}

.debug-facts {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 1rem;
}

.debug-facts div {
    min-width: 0;
}

.debug-facts dt {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
}

.debug-facts dd {
    font-size: 0.86rem;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.debug-section-list {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.debug-section-list + h3,
.debug-error + h3 {
    margin-top: 1rem;
}

.debug-section-row {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.86rem;
}

.debug-section-row:last-child {
    border-bottom: none;
}

.debug-section-meta {
    color: var(--text-dim);
    font-size: 0.8rem;
    text-align: right;
}

.status-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    margin-right: 0.35rem;
}

.status-dot-ok { background: var(--green); }
.status-dot-empty { background: var(--yellow); }
.status-dot-unknown { background: var(--text-muted); }

.debug-error {
    margin: 1rem 0 0;
    padding: 0.75rem;
    border: 1px solid rgba(239, 68, 68, 0.45);
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.08);
}

.debug-error strong {
    color: var(--red);
}

.debug-error pre,
.debug-table pre {
    color: var(--text-dim);
    font-size: 0.78rem;
    margin-top: 0.4rem;
    max-width: 680px;
    overflow-x: auto;
    white-space: pre-wrap;
}

.debug-empty,
.dim {
    color: var(--text-muted);
}

.debug-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.debug-table th,
.debug-table td {
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    text-align: left;
    vertical-align: top;
}

.debug-table th {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.debug-table td {
    font-variant-numeric: tabular-nums;
}

.debug-table details summary {
    color: var(--red);
    cursor: pointer;
    font-weight: 600;
}

@media (max-width: 768px) {
    .debug-grid { grid-template-columns: 1fr; }
    .debug-facts { grid-template-columns: 1fr; }
    .debug-section-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.2rem;
    }
    .debug-section-meta { text-align: left; }
}

/* --- Tooltips --- */
.info-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 50%;
    font-size: 10px;
    cursor: pointer;
    margin-left: 6px;
    color: var(--text-muted);
    vertical-align: middle;
    transition: all 0.2s;
    font-weight: bold;
    flex-shrink: 0;
    user-select: none;
}
.info-tooltip:hover,
.info-tooltip.active {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

.info-popup {
    position: fixed;
    z-index: 1000;
    max-width: 260px;
    padding: 0.6rem 0.75rem;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
    color: var(--text-dim);
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.45;
}
.info-popup[hidden] { display: none; }

/* ─────────────────────────────────────────────────────────────
   Main Dashboard redesign — terminal-style layout for `/`
   Scoped to the new `.dash-shell` wrapper; existing pages
   (network detail, compute, gpus) keep their old chrome.
   ───────────────────────────────────────────────────────────── */

body:has(.dash-shell) {
  background: var(--bg);
}

main.container:has(.dash-shell) {
  max-width: 1480px;
  padding: 0 2.25rem 4rem;
}

.dash-shell {
  display: block;
  margin-top: 2rem;
}

.dash-main { min-width: 0; }

/* Hero header */
.page-hero { margin: 0.5rem 0 2.25rem; }
.page-hero h1 {
  font-size: clamp(2rem, 3.6vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0 0 0.45rem;
  color: var(--text);
}
.page-hero-subtitle {
  color: var(--text-dim);
  font-size: 0.98rem;
  max-width: 70ch;
  margin: 0;
}
.page-hero-meta {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  margin-top: 0.9rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.page-hero-meta .pulse {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-dim);
}
.pulse-dot {
  width: 7px; height: 7px; border-radius: 999px;
  background: var(--green);
}

/* Block envelopes */
.dash-shell .block { margin: 0 0 3rem; scroll-margin-top: 5rem; }
.block-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 1rem; gap: 1rem;
}
.block-head h2 {
  font-size: 1.4rem; font-weight: 600; letter-spacing: -0.01em;
  display: flex; align-items: baseline; gap: 0.65rem;
  margin: 0;
}
.block-head h2 .num {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.72rem;
  color: var(--accent);
  background: rgba(56,189,248,0.1);
  border: 1px solid rgba(56,189,248,0.3);
  border-radius: 4px;
  padding: 0.2rem 0.45rem;
  letter-spacing: 0.04em;
}
.block-head .sub { color: var(--text-muted); font-size: 0.85rem; }
.block-head-actions { display: flex; align-items: center; gap: 0.6rem; }

/* KPI grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
}
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.kpi-grid-compact {
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 0.75rem;
}
.kpi-grid-compact .kpi {
  grid-column: auto;
  min-height: 96px;
  padding: 0.75rem 0.9rem 0.85rem;
}
.kpi-grid-compact .kpi-value { font-size: 1.4rem; margin-top: 0.35rem; }
.kpi-grid-compact .kpi-value.accent-2 { font-size: 1.45rem; }
.kpi-grid-compact .kpi-hero { grid-column: auto; }
.kpi-grid-compact .kpi-hero .kpi-value { font-size: 2.1rem; margin-top: 0.4rem; }
.kpi-grid-compact .kpi-hero .kpi-spark { height: 38px; width: 55%; }
.kpi-grid-compact .kpi-label { font-size: 0.68rem; }
@media (max-width: 980px) {
  .kpi-grid-compact { grid-template-columns: 1fr 1fr; }
}
.chain-cell .badge { white-space: nowrap; font-size: 0.72rem; padding: 0.18rem 0.45rem; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.2rem 1.2rem;
  display: flex; flex-direction: column;
  min-height: 130px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  transition: border-color 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}
.kpi:hover {
  border-color: rgba(56, 189, 248, 0.42);
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 12px 28px -10px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(56, 189, 248, 0.08);
}
.kpi-label {
  font-size: 0.74rem; color: var(--text-muted);
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.kpi-value {
  font-size: 1.85rem; font-weight: 600; letter-spacing: -0.025em;
  margin-top: 0.5rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.05;
}
.kpi-value .sign {
  font-weight: 500;
  margin: 0 0.05em;
  letter-spacing: 0;
}
.kpi-value .suffix,
.kpi-value .unit {
  color: var(--text-muted);
  font-weight: 500;
  margin: 0 0.05em;
  letter-spacing: 0;
}
.kpi-value .unit { font-size: 0.55em; margin-left: 0.3em; }
.kpi-value.accent-2 { color: var(--accent-2); font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; }
.kpi-foot {
  font-size: 0.78rem; color: var(--text-dim);
  margin-top: auto; padding-top: 0.55rem;
  font-variant-numeric: tabular-nums;
}
.kpi-foot.muted { color: var(--text-muted); }

.kpi-hero {
  grid-column: span 2;
  background: var(--surface);
  border-color: rgba(56,189,248,0.25);
}
.kpi-hero .kpi-value {
  font-size: 3rem; font-weight: 700; letter-spacing: -0.035em;
  color: var(--accent); line-height: 1; margin-top: 0.6rem;
}
.kpi-hero .kpi-value .decimal {
  color: var(--text-muted); font-weight: 500;
  font-size: 0.45em; margin-left: 0.1em; letter-spacing: 0;
}
.kpi-hero .kpi-spark {
  position: absolute; right: 0; bottom: 0;
  width: 60%; height: 60px;
  opacity: 0.9;
}
.kpi-hero .kpi-spark canvas { width: 100% !important; height: 100% !important; display: block; }

.kpi-capacity { grid-column: span 2; }
.kpi-reach    { grid-column: span 2; }
.kpi-marketcap { grid-column: span 2; }
.kpi-volume    { grid-column: span 2; }
.kpi-tracked   { grid-column: span 2;
  background: var(--surface);
}
.kpi-marketcap .kpi-spark {
  margin-top: 0.55rem;
  height: 42px; width: 100%;
}
.kpi-marketcap .kpi-spark canvas { width: 100% !important; height: 100% !important; display: block; }

.chains-row {
  display: flex; gap: 0.3rem; flex-wrap: wrap;
  margin-top: 0.55rem;
}
.chain-pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.7rem; padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
  font-weight: 500;
}
.chain-pill .dot {
  width: 6px; height: 6px; border-radius: 999px; display: inline-block;
}

/* Compared-to-centralized-labs block */
.lab-compare-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 1080px) {
  .lab-compare-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .lab-compare-grid { grid-template-columns: 1fr; }
}

.lab-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.2rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-width: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  transition: border-color 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}
.lab-card:hover {
  border-color: rgba(56, 189, 248, 0.42);
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 12px 28px -10px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(56, 189, 248, 0.08);
}
.lab-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.lab-card-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}
.lab-card-pct {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.lab-card-pct-sub {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0;
  text-transform: none;
}

.lab-bar {
  --lab-bar-rgb: 56, 189, 248;
  position: relative;
  height: 24px;
  width: 100%;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(var(--lab-bar-rgb), 0.18),
      rgba(var(--lab-bar-rgb), 0.18) 6px,
      transparent 6px,
      transparent 12px
    ),
    rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -1px 0 rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
.lab-card:nth-child(2) .lab-bar { --lab-bar-rgb: 45, 212, 191; }
.lab-card:nth-child(3) .lab-bar { --lab-bar-rgb: 167, 139, 250; }
.lab-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  display: block;
  background: linear-gradient(90deg, var(--accent), rgba(56,189,248,0.72));
  border-radius: 7px;
  min-width: 7px;
  box-shadow:
    0 0 10px rgba(56, 189, 248, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
  transition: width 0.4s ease;
}
.lab-bar-fill.alt {
  background: linear-gradient(90deg, var(--accent-2), rgba(45,212,191,0.72));
  box-shadow:
    0 0 10px rgba(45, 212, 191, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.lab-bar-fill.alt2 {
  background: linear-gradient(90deg, #a78bfa, rgba(167,139,250,0.72));
  box-shadow:
    0 0 10px rgba(167, 139, 250, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.lab-card .lab-card-pct {
  color: var(--accent);
}
.lab-card:nth-child(2) .lab-card-pct { color: var(--accent-2); }
.lab-card:nth-child(3) .lab-card-pct { color: #a78bfa; }

.lab-card-rows {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0;
}
.lab-card-rows > div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.lab-card-rows dt {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
}
.lab-card-rows dd {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.lab-card-foot {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.lab-card-foot a {
  color: var(--text-dim);
  border-bottom: 1px dashed var(--border);
  margin-left: 0.25rem;
  white-space: nowrap;
}
.lab-card-foot a:hover {
  color: var(--accent);
  text-decoration: none;
  border-bottom-color: var(--accent);
}

/* Market charts */
.market-charts {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 1rem;
}
.vis-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.2rem 1.25rem;
  min-width: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.vis-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 0.85rem;
}
.vis-head h3 { font-size: 0.96rem; font-weight: 600; margin: 0; }
.vis-head .sub { color: var(--text-muted); font-size: 0.78rem; }
.vis-frame { position: relative; width: 100%; height: 260px; }
.vis-frame canvas { width: 100% !important; height: 100% !important; display: block; }
.pill-group {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}
.pill-group button {
  background: transparent; border: none; color: var(--text-muted);
  padding: 0.25rem 0.7rem; border-radius: 999px;
  font-size: 0.76rem; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.pill-group button.active {
  background: rgba(56,189,248,0.18);
  color: var(--text);
}
.legend-inline {
  display: flex; gap: 0.35rem 0.75rem; flex-wrap: wrap;
  margin-top: 0.8rem;
  font-size: 0.78rem; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.legend-inline .item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 24px;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  cursor: pointer;
  font: inherit;
  padding: 0;
}
.legend-inline .item:hover,
.legend-inline .item:focus-visible {
  color: var(--text);
}
.legend-inline .item:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}
.legend-inline .item.off {
  color: var(--text-muted);
  opacity: 0.55;
}
.legend-inline .swatch { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.legend-inline .item.off .swatch { background: transparent !important; box-shadow: inset 0 0 0 1px currentColor; }

/* Projects table — redesign chrome (scoped to .dash-shell) */
.dash-shell .table-toolbar.redesign {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.75rem; gap: 1rem; flex-wrap: wrap;
  background: transparent;
  border: none;
  padding: 0;
}
.search-wrap {
  position: relative;
  display: inline-flex; align-items: center;
}
.search-wrap svg {
  position: absolute; left: 0.7rem; width: 14px; height: 14px;
  color: var(--text-muted); pointer-events: none;
}
.search-wrap .search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.45rem 0.7rem 0.45rem 2rem;
  font-size: 0.85rem;
  min-width: 280px;
  font-family: inherit;
  outline: none;
}
.search-wrap .search-input:focus { border-color: var(--accent); }
.search-wrap .search-input::placeholder { color: var(--text-muted); }

.filter-chips { display: inline-flex; gap: 0.4rem; flex-wrap: wrap; }
.filter-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem; font-weight: 500; cursor: pointer;
  font-family: inherit;
  transition: color 0.18s ease, border-color 0.18s ease,
              background 0.18s ease, box-shadow 0.22s ease,
              transform 0.18s ease;
}
.filter-chip:hover {
  color: var(--text);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}
.filter-chip.active {
  background: rgba(56,189,248,0.13);
  border-color: rgba(56,189,248,0.45);
  color: var(--text);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.08);
}

.pj-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
  overflow-y: hidden;
}
table.pj {
  width: 100%; border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 1120px;
}
table.pj thead th {
  text-align: left;
  padding: 0.85rem 1rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: rgba(56,189,248,0.04);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
table.pj thead th { transition: color 0.16s ease, background 0.16s ease; }
table.pj thead th:hover { color: var(--text-dim); }
table.pj thead th.sorted {
  color: var(--accent);
  background: rgba(56,189,248,0.10);
}
table.pj thead th .sort-arrow {
  display: inline-block;
  margin-left: 0.3rem;
  font-size: 0.62rem;
  opacity: 0.95;
  color: var(--accent);
  line-height: 1;
  transform: translateY(-1px);
  letter-spacing: -0.1em;
}
table.pj thead th.num { text-align: right; }
table.pj tbody td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}
@keyframes pj-row-in {
  /* Opacity only — no transform. A non-`none` transform persisting on the row
     (via `forwards`) turns the <tr> into the containing block for its sticky
     <td>s, which breaks the frozen first column on iOS/Safari. */
  from { opacity: 0; }
  to   { opacity: 1; }
}
@media (prefers-reduced-motion: no-preference) {
  table.pj tbody tr {
    opacity: 0;
    animation: pj-row-in 0.45s ease-out forwards;
  }
  table.pj tbody tr:nth-child(1)  { animation-delay: 0.02s; }
  table.pj tbody tr:nth-child(2)  { animation-delay: 0.06s; }
  table.pj tbody tr:nth-child(3)  { animation-delay: 0.10s; }
  table.pj tbody tr:nth-child(4)  { animation-delay: 0.14s; }
  table.pj tbody tr:nth-child(5)  { animation-delay: 0.18s; }
  table.pj tbody tr:nth-child(6)  { animation-delay: 0.22s; }
  table.pj tbody tr:nth-child(7)  { animation-delay: 0.26s; }
  table.pj tbody tr:nth-child(8)  { animation-delay: 0.30s; }
  table.pj tbody tr:nth-child(9)  { animation-delay: 0.34s; }
  table.pj tbody tr:nth-child(n+10) { animation-delay: 0.38s; }
}
table.pj tbody tr { transition: background 0.18s ease; cursor: pointer; }
table.pj tbody tr:last-child td { border-bottom: none; }
table.pj tbody tr:hover { background: var(--surface-hover); }
table.pj td.num { text-align: right; white-space: nowrap; }
table.pj .row-caret-cell { width: 36px; padding-right: 1rem; }

/* Coming-soon placeholder rows — inactive, non-clickable, dimmed, pinned to the
   bottom of the table. No hover affordances. */
table.pj tbody tr.coming-soon { cursor: default; opacity: 0.5; }
table.pj tbody tr.coming-soon:hover { background: transparent; }
table.pj tbody tr.coming-soon:hover td:first-child { background: var(--surface); }
table.pj tbody tr.coming-soon .row-logo {
  background: var(--surface-hover);
  color: var(--text-muted);
  border-style: dashed;
}
table.pj tbody tr.coming-soon .row-id .name { color: var(--text-dim); font-weight: 500; }
table.pj tbody tr.coming-soon .na { color: var(--text-muted); }
.propose-row {
  margin: 0.85rem 0 0;
  text-align: right;
}
.propose-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.16s ease;
}
.propose-link::before {
  content: "+";
  font-size: 0.95rem;
  line-height: 1;
  color: var(--text-muted);
  transition: color 0.16s ease;
}
.propose-link:hover { color: var(--accent); }
.propose-link:hover::before { color: var(--accent); }
.soon-pill {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  white-space: nowrap;
}

/* Sticky first column — keep the network/project name in view while scrolling
   horizontally through the metric columns, Excel-freeze style. The wrap owns the
   horizontal scroll (overflow-x: auto), so the first cell of each row stays pinned. */
table.pj thead th:first-child,
table.pj tbody tr td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
}
table.pj thead th:first-child {
  /* header sits above body cells when both are pinned */
  z-index: 3;
  /* preserve the header's blue tint but make it opaque so scrolled-under cells
     don't bleed through (the original rgba tint alone is see-through) */
  background: linear-gradient(rgba(56,189,248,0.04), rgba(56,189,248,0.04)), var(--surface);
}
table.pj tbody tr td:first-child {
  background: var(--surface);
  /* match the row's background transition so the frozen column fades in sync
     with the rest of the row on hover, instead of snapping a frame early */
  transition: background 0.18s ease;
}
table.pj tbody tr:hover td:first-child {
  background: var(--surface-hover);
}
/* thin divider marking the frozen edge */
table.pj thead th:first-child::after,
table.pj tbody td:first-child::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; right: 0;
  width: 1px;
  background: var(--border);
  pointer-events: none;
}

/* ── Projects table (/) — split project column ──────────────────────────────
   The first column is split into a frozen logo cell and a separate name cell.
   On desktop/tablet the two freeze together (one visual column, as before).
   On mobile only the logo stays pinned while the name scrolls away with the
   metrics — the name slides under the logo, which sits on top. The logo cell
   and its header inherit `position: sticky; left: 0` from the generic
   `table.pj … :first-child` rules above. */
#projects-table { --pj-logo-w: 58px; }

#projects-table thead th.logo-th,
#projects-table tbody td.logo-cell {
  width: var(--pj-logo-w);
  min-width: var(--pj-logo-w);
  max-width: var(--pj-logo-w);
  padding-left: 0.5rem;
  padding-right: 0;
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
}
/* smaller header label so "Project" fits the narrow frozen strip */
#projects-table thead th.logo-th {
  font-size: 0.62rem;
}
/* name sits flush against the logo column edge (no double gutter) */
#projects-table tbody td.name-cell { padding-left: 0; }

/* name cell pinned right after the logo on desktop/tablet (frozen as a pair) */
#projects-table thead th.name-th,
#projects-table tbody tr td.name-cell {
  position: sticky;
  left: var(--pj-logo-w);
  z-index: 2;
  background: var(--surface);
  transition: background 0.18s ease;
}
#projects-table thead th.name-th {
  z-index: 3;
  background: linear-gradient(rgba(56,189,248,0.04), rgba(56,189,248,0.04)), var(--surface);
}
#projects-table tbody tr:hover td.name-cell { background: var(--surface-hover); }

/* logo sits above the name cell so the name tucks under it while scrolling */
#projects-table thead th.logo-th { z-index: 5; }
#projects-table tbody tr td.logo-cell { z-index: 4; }

/* on desktop the frozen edge is the right side of the name cell, not the logo */
#projects-table thead th.logo-th::after,
#projects-table tbody td.logo-cell::after { display: none; }
#projects-table thead th.name-th::after,
#projects-table tbody td.name-cell::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; right: 0;
  width: 1px;
  background: var(--border);
  pointer-events: none;
}

@media (max-width: 760px) {
  /* mobile: only the logo freezes — the name column scrolls with the rest */
  #projects-table thead th.name-th,
  #projects-table tbody tr td.name-cell { position: static; }
  /* frozen-edge divider moves back to the logo cell */
  #projects-table thead th.logo-th::after,
  #projects-table tbody td.logo-cell::after { display: block; }
  #projects-table thead th.name-th::after,
  #projects-table tbody td.name-cell::after { display: none; }
}

.project-cell {
  display: flex; align-items: center; gap: 0.7rem;
  min-width: 220px;
}
table.pj .row-logo {
  width: 32px; height: 32px;
  border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.86rem; font-weight: 700;
  border: 1px solid var(--border);
  flex-shrink: 0;
  letter-spacing: -0.02em;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  overflow: hidden;
}
table.pj .row-logo .row-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
table.pj .row-id .name {
  font-weight: 600; color: var(--text); font-size: 0.94rem;
  line-height: 1.2;
  display: inline-flex; align-items: center; gap: 0.4rem;
}
table.pj .row-id .name a { color: var(--text); }
table.pj .row-id .name a:hover { color: var(--accent); text-decoration: none; }
table.pj .row-id .sym {
  color: var(--text-muted); font-size: 0.74rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 0.1rem;
}

.dash-shell .badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid;
  white-space: nowrap;
}
.badge.chain-bittensor { background: rgba(167,139,250,0.12); border-color: rgba(167,139,250,0.34); color: #d3c4ff; }
.badge.chain-cosmos    { background: rgba(45,212,191,0.12);  border-color: rgba(45,212,191,0.34);  color: #9ff5ea; }
.badge.chain-solana    { background: rgba(251,113,133,0.12); border-color: rgba(251,113,133,0.34); color: #ffc1cb; }
.badge.chain-substrate { background: rgba(56,189,248,0.12);  border-color: rgba(56,189,248,0.34);  color: #b8eaff; }
.badge.chain-evm       { background: rgba(245,158,11,0.12);  border-color: rgba(245,158,11,0.34);  color: #f7d18b; }
.badge.consensus       { background: var(--surface-2); border-color: var(--border); color: var(--text-dim); }

.row-spark { display: inline-block; width: 64px; height: 22px; vertical-align: middle; }
.row-spark-slot {
  position: relative;
  display: inline-flex; align-items: center; gap: 0.3rem;
  margin-right: 0.5rem; vertical-align: middle; min-width: 64px;
}
.row-spark-period {
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.row-spark-slot[data-tip-title]::before,
.row-spark-slot[data-tip-title]::after {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 50;
}
.row-spark-slot[data-tip-title]::before {
  content: attr(data-tip-title) "\A" attr(data-tip-body);
  white-space: pre;
  background: rgba(13,19,24,0.95);
  border: 1px solid #263541;
  color: #a7b4bf;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.35;
  padding: 0.4rem 0.55rem;
  border-radius: 4px;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
.row-spark-slot[data-tip-title]::after {
  content: "";
  bottom: calc(100% + 2px);
  border: 6px solid transparent;
  border-top-color: #263541;
}
.row-spark-slot:hover[data-tip-title]::before,
.row-spark-slot:hover[data-tip-title]::after {
  opacity: 1;
}

.delta-inline {
  font-size: 0.74rem;
  margin-left: 0.45rem;
  font-variant-numeric: tabular-nums;
}
.delta-inline.up { color: var(--green); }
.delta-inline.down { color: var(--red); }
.delta-inline.flat { color: var(--text-muted); }

/* Keep this a normal table-cell (no `display:flex`): a flex <td> drops out of
   the table layout and no longer stretches to the row height, which left the
   price column shorter than its row and broke the row divider line. The two
   children already align inline (`.row-spark-slot` is inline-flex, `.price-amt`
   below is vertical-align:middle), so plain right-aligned cell flow is enough. */
.price-cell {
  white-space: nowrap;
}
.price-cell .price-amt {
  vertical-align: middle;
}

.na { color: var(--text-muted); }

.row-caret {
  color: var(--text-muted);
  font-size: 1rem;
  opacity: 0;
  transition: opacity 0.12s, transform 0.12s;
  display: inline-block;
}
table.pj tbody tr:hover .row-caret {
  opacity: 1;
  transform: translateX(2px);
  color: var(--accent);
}

/* Empty state inside the dashboard shell stays compact */
.dash-shell .empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  text-align: center;
  color: var(--text-dim);
}

/* Responsive */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .kpi-hero, .kpi-capacity, .kpi-reach,
  .kpi-marketcap, .kpi-volume, .kpi-tracked { grid-column: span 3; }
  .market-charts { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  main.container:has(.dash-shell) { padding: 0 1rem 3rem; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-hero, .kpi-capacity, .kpi-reach,
  .kpi-marketcap, .kpi-volume, .kpi-tracked { grid-column: span 2; }
  table.pj { font-size: 0.82rem; }
  .search-wrap .search-input { min-width: 0; width: 100%; }
  .search-wrap { width: 100%; flex: 1 1 100%; }
}

/* ───────── Community Score page (/community) ───────── */
/* Per-metric formula weight shown under each numeric header. */
.social-table th .th-cap,
table.pj th .th-cap {
  display: block;
  font-weight: 400;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
  letter-spacing: 0;
  text-transform: none;
}
.social-table .th-cap .na { color: var(--text-muted); }

/* Community Score cell — the headline number, set apart from the raw inputs.
   Keep it a normal table cell (no display:flex, which would break it out of
   the table layout); the pill + tooltip sit inline and right-align via .num. */
table.pj td.score-cell {
  white-space: nowrap;
}
table.pj td.score-cell .info-tooltip {
  margin-left: 0.35rem;
}
.score-pill {
  display: inline-block;
  min-width: 3.2em;
  text-align: center;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
