/* ================================================================
   SUSnet Emission Tracker — Dark precision dashboard
   Brand: cyan #06d9fd · blue #087ef4 · molecule-network motif
   ================================================================ */

:root {
    --sn-cyan: #06d9fd;
    --sn-blue: #087ef4;
    --sn-cyan-dim: #06d9fd22;
    --sn-blue-dim: #087ef418;
    --sn-cyan-glow: 0 0 20px #06d9fd18;
    --sn-surface-0: #060a12;
    --sn-surface-1: #0c1220;
    --sn-surface-2: #111827;
    --sn-surface-3: #1a2332;
    --sn-border: #1e293b;
    --sn-border-bright: #2a3a50;
    --sn-text: #e2e8f0;
    --sn-text-dim: #64748b;
    --sn-text-bright: #f8fafc;
    --sn-ok: #22c55e;
    --sn-ok-dim: #22c55e18;
    --sn-warn: #ef4444;
    --sn-warn-dim: #ef444418;
    --sn-radius: 10px;
    --sn-radius-sm: 6px;
}

/* ---- Override Pico defaults ---- */
[data-theme="dark"] {
    --pico-background-color: var(--sn-surface-0);
    --pico-card-background-color: var(--sn-surface-1);
    --pico-card-sectionning-background-color: var(--sn-surface-2);
    --pico-muted-border-color: var(--sn-border);
    --pico-color: var(--sn-text);
    --pico-muted-color: var(--sn-text-dim);
    --pico-primary: var(--sn-cyan);
    --pico-ins-color: var(--sn-ok);
    --pico-del-color: var(--sn-warn);
    --pico-font-family: 'Outfit', system-ui, -apple-system, sans-serif;
    --pico-font-family-monospace: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
    --pico-border-radius: var(--sn-radius);
}

body {
    background: var(--sn-surface-0);
    min-height: 100vh;
}

/* ---- Layout ---- */
main {
    max-width: 1240px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 4rem;
}

/* ---- Header ---- */
main > header {
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--sn-border);
}
main > header .header-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem 1.5rem;
    margin-bottom: 0.5rem;
}
main > header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.header-logo {
    height: 2.4rem;
    width: auto;
    filter: drop-shadow(0 0 8px #06d9fd30);
    transition: filter 0.3s ease;
}
.header-logo:hover {
    filter: drop-shadow(0 0 16px #06d9fd50);
}
main > header .subtitle {
    color: var(--sn-text-dim);
    margin: 0 0 0.35rem;
    font-size: 0.82rem;
    font-weight: 400;
    letter-spacing: 0.02em;
}
main > header .last-snap {
    color: var(--sn-text-dim);
    font-size: 0.78rem;
    margin: 0;
    line-height: 1.5;
}
main > header .last-snap strong {
    color: var(--sn-cyan);
    font-weight: 500;
}

/* ---- Nav ---- */
main > header nav {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.2rem;
    margin: 0;
    padding: 0.25rem;
    background: var(--sn-surface-2);
    border-radius: 8px;
    border: 1px solid var(--sn-border);
}
main > header nav a {
    padding: 0.45rem 0.9rem;
    text-decoration: none;
    color: var(--sn-text-dim);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: all 0.2s ease;
    white-space: nowrap;
}
main > header nav a:hover {
    color: var(--sn-text);
    background: var(--sn-surface-3);
}
main > header nav a.active {
    color: var(--sn-surface-0);
    background: var(--sn-cyan);
    font-weight: 600;
    box-shadow: 0 1px 8px #06d9fd40;
}

/* ---- Panels / sections ---- */
section.panel {
    background: var(--sn-surface-1);
    border: 1px solid var(--sn-border);
    border-radius: var(--sn-radius);
    padding: 1.1rem 1.25rem;
    margin: 0 0 1.25rem;
    backdrop-filter: blur(4px);
}
section.panel > h3:first-child,
section.panel > header:first-child {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--sn-text-dim);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ---- KPI grid ---- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: 0.75rem;
    margin: 0 0 1.5rem;
}
.kpi-card {
    background: var(--sn-surface-1);
    border: 1px solid var(--sn-border);
    border-radius: var(--sn-radius);
    padding: 1rem 1.15rem;
    margin: 0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.kpi-card:hover {
    border-color: var(--sn-border-bright);
}
.kpi-card .kpi-label {
    display: block;
    color: var(--sn-text-dim);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.35rem;
}
.kpi-card .kpi-value {
    font-size: 1.6rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
    color: var(--sn-text-bright);
    font-family: 'JetBrains Mono', monospace;
}
.kpi-card .kpi-sub {
    color: var(--sn-text-dim);
    font-size: 0.75rem;
    margin-top: 0.2rem;
}
.kpi-card.kpi-ok {
    border-color: #22c55e30;
    background: linear-gradient(135deg, var(--sn-surface-1), #22c55e08);
}
.kpi-card.kpi-ok .kpi-value { color: var(--sn-ok); }
.kpi-card.kpi-warn {
    border-color: #ef444430;
    background: linear-gradient(135deg, var(--sn-surface-1), #ef444408);
}
.kpi-card.kpi-warn .kpi-value { color: var(--sn-warn); }
.kpi-grid-3col {
    grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 768px) {
    .kpi-grid-3col { grid-template-columns: 1fr; }
}
.kpi-card-action {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
}
.kpi-card-action button {
    margin-top: 0.4rem;
}
.kpi-card-action .kpi-sub {
    margin-top: 0.4rem;
}

/* Admin actions bar (horizontal, below KPI grids) */
.admin-actions-bar {
    display: flex;
    gap: 0.6rem;
    margin: 0 0 1.5rem;
    flex-wrap: wrap;
}
.admin-actions-bar button {
    padding: 0.5rem 1.2rem;
    font-size: 0.82rem;
}
.btn-danger {
    background: var(--sn-warn) !important;
    border-color: var(--sn-warn) !important;
    color: white !important;
}
.btn-danger:hover {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
    box-shadow: 0 2px 12px #ef444440;
}

/* ---- Filter forms ---- */
form.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: end;
    margin: 0;
}
form.filter-form label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.78rem;
    color: var(--sn-text-dim);
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.02em;
}
form.filter-form input,
form.filter-form select {
    margin: 0;
    background: var(--sn-surface-2);
    border-color: var(--sn-border);
    color: var(--sn-text);
    font-size: 0.85rem;
}
form.filter-form input:focus,
form.filter-form select:focus {
    border-color: var(--sn-cyan);
    box-shadow: 0 0 0 2px #06d9fd20;
}
form.filter-form button {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 500;
    background: var(--sn-blue);
    border-color: var(--sn-blue);
    color: white;
    padding: 0.5rem 1.2rem;
}
form.filter-form button:hover {
    background: #0970df;
    border-color: #0970df;
}
.filter-period {
    color: var(--sn-text-dim);
    font-size: 0.78rem;
    margin: 0.75rem 0 0;
}

/* ---- Tables ---- */
table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
}
th {
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sn-text-dim);
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--sn-border);
    text-align: left;
}
td {
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid var(--sn-border);
    font-size: 0.875rem;
    color: var(--sn-text);
}
tbody tr {
    transition: background 0.15s ease;
}
tbody tr:hover {
    background: var(--sn-surface-2);
}
td.num, th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
code.hotkey-pill {
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--sn-cyan);
    background: var(--sn-cyan-dim);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

/* ---- Status badges ---- */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.4;
    border: none;
}
.badge-ok {
    color: var(--sn-ok);
    background: var(--sn-ok-dim);
}
.badge-warn {
    color: var(--sn-warn);
    background: var(--sn-warn-dim);
}
.badge-info {
    color: var(--sn-cyan);
    background: var(--sn-cyan-dim);
}

/* ---- Row highlights ---- */
tr.row-warn {
    background: #ef444408;
}
tr.row-warn:hover {
    background: #ef444412;
}

/* ---- Buttons ---- */
button, [type="submit"] {
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    border-radius: var(--sn-radius-sm);
    transition: all 0.2s ease;
}
button:not(.secondary):not([style*="del-color"]) {
    background: var(--sn-blue);
    border-color: var(--sn-blue);
    color: white;
}
button:not(.secondary):not([style*="del-color"]):hover {
    background: #0970df;
    border-color: #0970df;
    box-shadow: 0 2px 12px #087ef440;
}
button.secondary {
    background: var(--sn-surface-3);
    border-color: var(--sn-border-bright);
    color: var(--sn-text-dim);
}
button.secondary:hover {
    background: var(--sn-surface-2);
    color: var(--sn-text);
}

/* ---- Dialog (applies to all <dialog> in the app) ---- */
dialog {
    border: 1px solid var(--sn-border-bright);
    border-radius: var(--sn-radius);
    padding: 0;
    background: transparent;
    color: var(--sn-text);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px #06d9fd08;
    max-width: 92vw;
}
dialog::backdrop {
    background: rgba(6, 10, 18, 0.8);
    backdrop-filter: blur(4px);
}
dialog > article {
    margin: 0;
    background: var(--sn-surface-1);
    border-radius: var(--sn-radius);
    padding: 1.5rem;
}
dialog > article > header {
    background: var(--sn-surface-2);
    border-bottom: 1px solid var(--sn-border);
    margin: -1.5rem -1.5rem 1rem;
    padding: 0.85rem 1.5rem;
    border-radius: var(--sn-radius) var(--sn-radius) 0 0;
}
dialog > article > footer {
    background: transparent;
    border-top: 1px solid var(--sn-border);
    margin: 1rem -1.5rem -1.5rem;
    padding: 0.85rem 1.5rem;
}
dialog h3 {
    color: var(--sn-text-bright);
    font-weight: 600;
}
dialog label {
    display: block;
    margin-bottom: 1rem;
    font-size: 0.88rem;
    color: var(--sn-text);
}
dialog select,
dialog input[type="text"],
dialog input[type="number"] {
    margin-top: 0.3rem;
    margin-bottom: 0;
    background: var(--sn-surface-2);
    border-color: var(--sn-border);
    color: var(--sn-text);
}
dialog select:focus,
dialog input:focus {
    border-color: var(--sn-cyan);
    box-shadow: 0 0 0 2px #06d9fd20;
}

/* ---- Per-page table overrides ---- */
.archive-table th, .archive-table td,
.history-table th, .history-table td,
.lines-table th, .lines-table td,
.payout-table th, .payout-table td,
.kas-table th, .kas-table td {
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid var(--sn-border);
    font-size: 0.85rem;
}
.archive-table tbody tr:hover,
.history-table tbody tr:hover,
.lines-table tbody tr:hover,
.payout-table tbody tr:hover,
.kas-table tbody tr:hover {
    background: var(--sn-surface-2);
}
.payout-table tfoot td {
    border-top: 2px solid var(--sn-border-bright);
    border-bottom: none;
    background: var(--sn-surface-2);
    font-weight: 600;
    color: var(--sn-text-bright);
}

/* History status row tints */
.history-table tbody tr.status-row-partial,
.history-table tbody tr.status-row-failed {
    background: #ef444406;
}
.history-table tbody tr.status-row-in_progress {
    background: #06d9fd06;
}

/* ---- Captures wide-table ---- */
.captures-container {
    overflow-x: auto;
    max-width: 100%;
}
.captures-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
    white-space: nowrap;
    margin: 0;
}
.captures-table th, .captures-table td {
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid var(--sn-border);
    border-right: 1px solid #1e293b50;
    background: var(--sn-surface-1);
    color: var(--sn-text);
}
.captures-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sn-text-dim);
    background: var(--sn-surface-2);
}
.sticky-col {
    position: sticky;
    z-index: 2;
}
.col-hotkey { left: 0; min-width: 170px; }
.col-name {
    left: 170px;
    min-width: 120px;
    border-right: 2px solid var(--sn-border-bright) !important;
}
.captures-table thead th.sticky-col { z-index: 3; }
.time-col {
    min-width: 100px;
    font-family: 'JetBrains Mono', monospace;
}
.cell {
    font-family: 'JetBrains Mono', monospace;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.cell .missing { color: var(--sn-text-dim); }
.cell .deregistered {
    color: var(--sn-warn);
    font-weight: 600;
}
.captures-table tbody tr:hover td {
    background: var(--sn-surface-2);
}

/* ---- Misc ---- */
canvas { margin: 1rem 0; }
small.muted, .text-muted { color: var(--sn-text-dim); }
.text-mono {
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
}
code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82em;
}
a {
    color: var(--sn-cyan);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover {
    color: var(--sn-blue);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--sn-surface-0);
}
::-webkit-scrollbar-thumb {
    background: var(--sn-border-bright);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--sn-text-dim);
}

/* ---- Mobile responsiveness ---- */
@media (max-width: 768px) {
    main { padding: 1rem 0.75rem 3rem; }
    main > header .header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    main > header nav {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.6rem;
    }
    .kpi-card .kpi-value { font-size: 1.3rem; }
}

/* --- Coldkey wallet cards -------------------------------------------- */
/* Five across on a wide screen, as specified; the minmax floor lets the
   count drop on narrower viewports rather than squeezing the addresses. */
.coldkey-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.7rem;
    padding: 0.85rem 1.25rem 1.15rem;
}
@media (max-width: 1400px) { .coldkey-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .coldkey-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px)  { .coldkey-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px)  { .coldkey-grid { grid-template-columns: 1fr; } }

.coldkey-card {
    background: var(--sn-surface-1);
    border: 1px solid var(--sn-border);
    border-radius: var(--sn-radius);
    padding: 0.8rem 0.9rem;
    transition: border-color 0.2s ease;
}
.coldkey-card:hover { border-color: var(--sn-border-bright); }

.coldkey-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--sn-text-bright);
    margin-bottom: 0.3rem;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.4rem;
}
.coldkey-shared {
    font-weight: 400;
    font-size: 0.68rem;
    color: var(--sn-text-dim);
    border: 1px solid var(--sn-border);
    border-radius: 999px;
    padding: 0.05rem 0.4rem;
    white-space: nowrap;
}
.coldkey-addr {
    display: block;
    font-size: 0.68rem;
    color: var(--sn-text-dim);
    margin-bottom: 0.6rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.coldkey-stat {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.16rem 0;
}
.coldkey-stat-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sn-text-dim);
}
.coldkey-stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    font-size: 0.76rem;
    color: var(--sn-text-bright);
}

/* Secondary action sitting inside a panel header — quieter than the
   primary blue button so it doesn't compete with "Close period". */
.btn-subtle {
    background: var(--sn-surface-2, transparent);
    color: var(--sn-text-bright);
    border: 1px solid var(--sn-border-bright);
    border-radius: var(--sn-radius);
    padding: 0.3rem 0.7rem;
    font-size: 0.76rem;
    font-weight: 500;
    cursor: pointer;
}
.btn-subtle:hover:not(:disabled) { border-color: var(--sn-text-dim); }
.btn-subtle:disabled { opacity: 0.55; cursor: default; }

/* Progress strip next to the refresh button. Time-based, not true progress:
   the server reports no per-coldkey position, so it is capped at 99% until
   the status poll confirms the run actually ended. */
.refresh-bar {
    display: inline-block;
    width: 90px;
    height: 4px;
    border-radius: 999px;
    background: var(--sn-border);
    overflow: hidden;
}
.refresh-bar > span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--sn-blue);
    transition: width 1s linear;
}

/* The shared team wallet, marked out from the personal ones. Follows the
   same green treatment as .kpi-card.kpi-ok so the dashboard reads as one
   system rather than two. */
.coldkey-card-shared {
    border-color: #22c55e30;
    background: linear-gradient(135deg, var(--sn-surface-1), #22c55e08);
}
.coldkey-card-shared:hover { border-color: var(--sn-ok); }
.coldkey-card-shared .coldkey-name { color: var(--sn-ok); }
.coldkey-card-shared .coldkey-shared {
    color: var(--sn-ok);
    border-color: #22c55e40;
}
.coldkey-card-shared .coldkey-stat-value { color: var(--sn-ok); }

/* Per-card refresh. Sits with the address rather than the figures, so it
   reads as an action on the wallet, not on one of its numbers. */
.coldkey-addr-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
}
.coldkey-addr-row .coldkey-addr { margin-bottom: 0; }
.coldkey-refresh {
    flex: none;
    background: none;
    border: 1px solid var(--sn-border);
    border-radius: var(--sn-radius-sm);
    color: var(--sn-text-dim);
    font-size: 0.8rem;
    line-height: 1;
    padding: 0.15rem 0.35rem;
    cursor: pointer;
}
.coldkey-refresh:hover:not(:disabled) {
    color: var(--sn-text-bright);
    border-color: var(--sn-border-bright);
}
.coldkey-refresh:disabled { opacity: 0.5; cursor: default; }
.coldkey-refresh.spinning { animation: coldkey-spin 1s linear infinite; }
@keyframes coldkey-spin { to { transform: rotate(360deg); } }

/* Money controls, set apart from the read-only figures above them so a
   click here never feels like the same kind of act as a refresh. */
.coldkey-actions {
    margin-top: 0.6rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--sn-border);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.tournament-types { display: flex; flex-direction: column; gap: 0.15rem; }
.tournament-type {
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
}
.tournament-type input { margin: 0; }
.coldkey-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
}
.tournament-total { font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.tournament-total.is-short { color: var(--sn-warn); }
.unstake-all { width: 100%; color: var(--sn-warn); }
.unstake-all:hover:not(:disabled) { border-color: var(--sn-warn); }

/* Outcome of the last signed action on a wallet. Sits above the controls
   so the answer to "did my click work?" is next to the button that did it. */
.coldkey-last-action {
    margin-top: 0.5rem;
    padding: 0.25rem 0.45rem;
    border-radius: var(--sn-radius-sm);
    font-size: 0.68rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.coldkey-last-ok      { color: var(--sn-ok);   background: var(--sn-ok-dim); }
.coldkey-last-failed  { color: var(--sn-warn); background: var(--sn-warn-dim); }
.coldkey-last-pending { color: var(--sn-cyan); background: var(--sn-cyan-dim); }

.spinner-dot {
    display: inline-block;
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: currentColor;
    animation: sn-pulse 1s ease-in-out infinite;
}
@keyframes sn-pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

/* btcli error text runs long and arrives in one line. Clamp it so a single
   bad message cannot stretch the history table past the viewport; the full
   text stays available in the cell's tooltip. */
#actions-table { table-layout: fixed; width: 100%; }
#actions-table td, #actions-table th { vertical-align: middle; }
.action-detail {
    max-width: 0;            /* with table-layout:fixed, lets the cell shrink */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.78rem;
}
/* Six columns — "Oleh" lives in the row tooltip. The first five are
   sized to their content so they sit close together; Keterangan takes
   everything left, which is where btcli's long text goes. Without this
   the short columns spread across half the width and the eye has to
   travel between a wallet and its status. */
#actions-table th:nth-child(1), #actions-table td:nth-child(1) { width: 8.5rem; }
#actions-table th:nth-child(2), #actions-table td:nth-child(2) { width: 9rem; }
#actions-table th:nth-child(3), #actions-table td:nth-child(3) { width: 8rem; }
#actions-table th:nth-child(4), #actions-table td:nth-child(4) { width: 6.5rem; }
#actions-table th:nth-child(5), #actions-table td:nth-child(5) { width: 7rem; }

/* Neither success nor failure: the money may have moved. Amber rather
   than the failure red, because red reads as "nothing happened" and the
   one thing that must not follow is a reflexive retry. */
.coldkey-last-unknown { color: #f59e0b; background: #f59e0b18; }

/* The action log is a log: worth a glance after a click, not worth a
   third of the dashboard the rest of the time. Collapsed to one line by
   default, and dense when open. */
/* The panel surface is defined for section.panel; this log is a
   <details>, so it needs the same skin spelled out. */
details.panel {
    background: var(--sn-surface-1);
    border: 1px solid var(--sn-border);
    border-radius: var(--sn-radius);
    margin: 0 0 1.25rem;
    overflow: hidden;
}
.panel-compact > summary {
    cursor: pointer;
    padding: 0.55rem 1.25rem;
    font-size: 0.82rem;
    font-weight: 600;
    list-style: none;
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
}
.panel-compact > summary::-webkit-details-marker { display: none; }
/* pico adds its own chevron to every summary. Two carets on one row
   read as a rendering bug, and its accordion colour makes the heading
   look like a link. Both are overridden here rather than fought with
   !important. */
.panel-compact > summary::after { display: none; }
details.panel > summary:not([role]) { color: var(--sn-text-dim); }
details.panel > summary:not([role]):hover { color: var(--sn-text); }
.panel-compact > summary::before {
    content: "▸";
    font-size: 0.7rem;
    opacity: 0.6;
}
.panel-compact[open] > summary::before { content: "▾"; }
.panel-compact > summary {
    color: var(--sn-text-dim);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.panel-compact[open] > summary { border-bottom: 1px solid var(--sn-border); }
/* Eight rows is enough to see a session's worth; the rest scrolls rather
   than pushing the hotkey table off the screen. */
.actions-scroll { max-height: 15rem; overflow-y: auto; }
.panel-compact #actions-table td,
.panel-compact #actions-table th {
    padding: 0.3rem 0.6rem;
    font-size: 0.76rem;
    line-height: 1.25;
}
.panel-compact #actions-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--sn-surface-1);
}

/* ---- Login ---- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}
.login-card {
    width: 100%;
    max-width: 22rem;
    background: var(--sn-surface-1);
    border: 1px solid var(--sn-border);
    border-radius: var(--sn-radius);
    padding: 2rem 1.75rem;
}
.login-logo { height: 1.5rem; display: block; }
.login-sub {
    margin: 0.75rem 0 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--sn-border);
    font-size: 0.72rem;
    color: var(--sn-text-dim);
    letter-spacing: 0.02em;
}
.login-card label {
    font-size: 0.72rem;
    color: var(--sn-text-dim);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
}
.login-card input {
    margin-bottom: 1.1rem;
    font-size: 0.9rem;
}
.login-card button,
.login-card [role="button"] {
    width: 100%;
    margin: 0.35rem 0 0;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
}
.login-error {
    margin: 0 0 1.25rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--sn-radius-sm);
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--sn-warn);
    background: var(--sn-warn-dim);
}

/* Who is signed in, and the way out — Basic Auth had neither. */
.header-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--sn-text-dim);
}
.header-user form { margin: 0; }
.header-user button {
    margin: 0;
    padding: 0.2rem 0.6rem;
    font-size: 0.72rem;
    background: transparent;
    border: 1px solid var(--sn-border);
    color: var(--sn-text-dim);
}
.header-user button:hover { color: var(--sn-text); }
/* How old the figures above are. Quiet by default — it only matters
   when someone is about to act on a number. */
.coldkey-age {
    margin-top: 0.35rem;
    font-size: 0.62rem;
    color: var(--sn-text-dim);
    text-align: right;
    letter-spacing: 0.03em;
}

#bulk-unstake-btn:disabled { opacity: 0.45; }

/* One amount per wallet, inside the shared dialog.
   Selectors are id-prefixed on purpose: pico styles form fields through
   a chain of :not() selectors that outranks a plain `.sn-row input`, so
   the rows rendered at full form height — five wallets filled the
   dialog and the rest were a scroll away. */
#sn-modal .sn-row {
    display: grid;
    grid-template-columns: 1fr 6.5rem;
    align-items: center;
    gap: 0.75rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--sn-border);
}
#sn-modal .sn-row:last-child { border-bottom: none; }
#sn-modal .sn-row label {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.2;
}
#sn-modal .sn-row-hint {
    display: block;
    font-size: 0.68rem;
    color: var(--sn-text-dim);
}
#sn-modal .sn-row input[type="number"] {
    margin: 0;
    padding: 0.25rem 0.45rem;
    height: auto;
    font-size: 0.82rem;
    text-align: right;
}
/* The stepper arrows eat a third of a narrow field and nobody nudges a
   transfer by 0.0001 with a mouse. */
#sn-modal .sn-row input[type="number"]::-webkit-inner-spin-button,
#sn-modal .sn-row input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
#sn-modal .sn-row input[type="number"] { -moz-appearance: textfield; }

#sn-modal .sn-row-check { grid-template-columns: 1.15rem 1fr; gap: 0.6rem; }
#sn-modal .sn-row-check input[type="checkbox"] {
    margin: 0;
    width: 1rem;
    height: 1rem;
    justify-self: start;
}
/* Scroll inside the dialog, not the page, and leave room for the
   buttons: the list is fifteen wallets long and the confirm button must
   never be the thing that scrolls out of reach. */
#sn-modal-rows {
    margin: 0 0 1rem;
    max-height: min(22rem, 45vh);
    overflow-y: auto;
    padding-right: 0.4rem;
}

/* Secondary text inside a panel header. The header itself is uppercase
   and letter-spaced, and anything inheriting that reads as a second
   title — a timestamp and a progress line were competing with the panel
   name for attention. */
.panel-subnote {
    font-size: 0.66rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    text-transform: none;
    color: var(--sn-text-dim);
}

/* Waiting is not working. They were the same colour, so a run looked
   like every wallet was already in flight — the one thing the strip
   must never imply, since it is what tells someone it is safe to close
   the tab. */
.coldkey-last-queued {
    color: var(--sn-text-dim);
    background: #64748b18;
}
