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

/* Pool stats card */
.pool-info-table td:first-child {
    width: 160px;
    padding-right: 16px;
}

.pool-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.pool-status-dot.pool-up { background: #66bb6a; box-shadow: 0 0 6px #66bb6a; }
.pool-status-dot.pool-down { background: #ef5350; }

.pool-header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

#pool_dashboard_link {
    background: #0f3460;
    color: #4fc3f7;
    border: 1px solid #1a3a6e;
    text-decoration: none;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
}
#pool_dashboard_link:hover { background: #1a3a6e; }

body {
    background: #1a1a2e;
    color: #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 20px 0;
    flex: 1;
}

header {
    text-align: center;
    padding: 20px 0 16px;
}

header h1 {
    color: #4fc3f7;
    font-size: 1.8rem;
    margin-bottom: 4px;
}

.subtitle {
    color: #888;
    font-size: 0.9rem;
    font-weight: 600;
}

.subtitle-post {
    color: #66bb6a;
}

.subtitle-pre {
    color: #ffab91;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    align-items: start;
    margin-bottom: 20px;
}

@media (max-width: 1100px) {
    .grid {
        grid-template-columns: 1fr 1fr;
    }

    .explorer-search input[type="text"] {
        max-width: 20vw;
    }
}

@media (max-width: 750px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .chain-header {
        flex-wrap: wrap;
    }

    .explorer-search {
        width: 100%;
        order: 3;
    }

    .explorer-search input[type="text"] {
        width: 100%;
        max-width: none;
    }
}

.column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card {
    background: #16213e;
    border-radius: 8px;
    padding: 12px 16px 14px;
    border: 1px solid #0f3460;
}

.card h2 {
    color: #4fc3f7;
    font-size: 1.1rem;
    margin-bottom: 8px;
    border-bottom: 1px solid #0f3460;
    padding-bottom: 6px;
}

.info-table {
    width: 100%;
}

.info-table td {
    padding: 4px 0;
    vertical-align: top;
}

.info-table td:first-child {
    color: #888;
    width: 110px;
    white-space: nowrap;
}

.mono {
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 0.8rem;
    word-break: break-all;
}

.peer-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.peer-list li {
    background: #0f3460;
    padding: 4px 12px;
    border-radius: 4px;
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 0.85rem;
}

.form-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.form-row input[type="text"] {
    flex: 1;
    min-width: 120px;
    padding: 8px 12px;
    background: #0f3460;
    border: 1px solid #1a3a6e;
    border-radius: 4px;
    color: #e0e0e0;
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 0.85rem;
}

.form-row input[type="number"] {
    width: 70px;
    padding: 8px 12px;
    background: #0f3460;
    border: 1px solid #1a3a6e;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.85rem;
    text-align: center;
    -moz-appearance: textfield;
}

.form-row input[type="number"]::-webkit-outer-spin-button,
.form-row input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.form-row input[type="text"]::placeholder {
    color: #556;
}

.form-row input[type="text"]:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.form-row button {
    padding: 8px 20px;
    background: #e94560;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

.form-row button:hover {
    background: #c73652;
}

.form-row button:disabled {
    background: #555;
    cursor: not-allowed;
}

.result {
    margin-top: 10px;
    font-size: 0.85rem;
}

.result.success {
    color: #66bb6a;
}

.result.error {
    color: #ef5350;
}

.hidden {
    display: none;
}

.busy-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 18, 38, 0.78);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.busy-overlay.hidden {
    display: none;
}

.busy-box {
    width: min(440px, 100%);
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 10px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
    padding: 22px 24px;
    text-align: center;
}

.busy-spinner {
    width: 44px;
    height: 44px;
    margin: 0 auto 14px;
    border-radius: 50%;
    border: 4px solid rgba(79, 195, 247, 0.18);
    border-top-color: #4fc3f7;
    animation: busy-spin 0.9s linear infinite;
}

.busy-box h3 {
    color: #4fc3f7;
    font-size: 1.15rem;
    margin-bottom: 8px;
}

.busy-box p {
    color: #c7d4f3;
    font-size: 0.9rem;
    line-height: 1.5;
}

@keyframes busy-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Recent Activity — internal scroll with styled scrollbar */
.activity-scroll {
    overflow-y: auto;
    max-height: calc(100vh - 571px);
    scrollbar-width: thin;
    scrollbar-color: #0f3460 #0a1e3d;
}

.activity-scroll::-webkit-scrollbar {
    width: 6px;
}

.activity-scroll::-webkit-scrollbar-track {
    background: #0a1e3d;
    border-radius: 3px;
}

.activity-scroll::-webkit-scrollbar-thumb {
    background: #0f3460;
    border-radius: 3px;
}

.activity-scroll::-webkit-scrollbar-thumb:hover {
    background: #1a3a6e;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.history-table th {
    text-align: left;
    color: #888;
    padding: 6px 8px;
    border-bottom: 1px solid #0f3460;
    font-weight: 500;
    position: sticky;
    top: 0;
    background: #16213e;
    z-index: 1;
}

.history-table td {
    padding: 5px 8px;
    border-bottom: 1px solid #0a1e3d;
    vertical-align: top;
}

.history-table .mono {
    font-size: 0.75rem;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-faucet {
    background: #1b5e20;
    color: #66bb6a;
}

.badge-mine {
    background: #1a237e;
    color: #42a5f5;
}

.badge-reset {
    background: #b71c1c;
    color: #ef9a9a;
}

.btn-danger {
    padding: 8px 20px;
    background: #b71c1c;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-danger:disabled {
    background: #555;
    cursor: not-allowed;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #aaa;
    cursor: pointer;
}

.chain-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #0f3460;
    padding-bottom: 8px;
}

.chain-header h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
    margin-right: auto;
}

.explorer-search {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.explorer-search input[type="text"] {
    width: 240px;
    max-width: 24vw;
    padding: 6px 10px;
    background: #0a1e3d;
    border: 1px solid #1a3a6e;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.82rem;
}

.explorer-search input[type="text"]::placeholder {
    color: #5f729c;
}

.explorer-search input[type="text"]:focus {
    outline: none;
    border-color: #4fc3f7;
    box-shadow: 0 0 0 2px rgba(79, 195, 247, 0.15);
}

.explorer-search-btn {
    background: #0f3460;
    color: #4fc3f7;
    border: 1px solid #1a3a6e;
    white-space: nowrap;
}

.explorer-search-btn:hover {
    background: #1a3a6e;
}

.reset-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 0.75rem;
}

.addr-type {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
    background: #2a2a4e;
    color: #888;
    margin-left: 4px;
    vertical-align: middle;
}

.mine-status {
    position: static;
    font-size: 0.8rem;
    color: #ffb74d;
    transition: opacity 1s ease;
    white-space: nowrap;
}

.mine-status.fading {
    opacity: 0;
}

.mine-header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.mine-mode-select {
    min-width: 150px;
    padding: 6px 10px;
    background: #0f3460;
    border: 1px solid #1a3a6e;
    border-radius: 4px;
    color: #4fc3f7;
    font-size: 0.82rem;
    font-weight: 600;
}

.mine-help {
    color: #8fa8c8;
    font-size: 0.82rem;
    margin-bottom: 8px;
    min-height: 20px;
}

.faucet-balance {
    font-size: 0.85rem;
    color: #66bb6a;
    font-weight: 600;
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
}

.faucet-stats {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    font-size: 0.75rem;
    color: #666;
}

.faucet-stats span span {
    color: #aaa;
}

/* Server stats */
.server-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-label {
    width: 32px;
    font-size: 0.75rem;
    color: #888;
    font-weight: 600;
}

.stat-track {
    flex: 1;
    height: 8px;
    background: #0a1e3d;
    border-radius: 4px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    background: #4fc3f7;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.stat-val {
    min-width: 90px;
    text-align: right;
    font-size: 0.7rem;
    color: #aaa;
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    white-space: nowrap;
}

/* Blocks explorer scroll */
.blocks-scroll {
    overflow-y: scroll;
    height: calc(100vh - 247px);
    min-height: 420px;
    max-height: calc(100vh - 247px);
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #0f3460 #0a1e3d;
}

.blocks-scroll::-webkit-scrollbar { width: 6px; }
.blocks-scroll::-webkit-scrollbar-track { background: #0a1e3d; border-radius: 3px; }
.blocks-scroll::-webkit-scrollbar-thumb { background: #0f3460; border-radius: 3px; }
.blocks-scroll::-webkit-scrollbar-thumb:hover { background: #1a3a6e; }

.addr-link {
    color: #4fc3f7;
    text-decoration: none;
}

.addr-link:hover {
    color: #81d4fa;
    text-decoration: underline;
}

.sync-badge {
    font-size: 0.7rem;
    color: #888;
}

.blocks-select {
    padding: 2px 8px;
    background: #0f3460;
    border: 1px solid #1a3a6e;
    border-radius: 4px;
    color: #4fc3f7;
    font-size: 0.75rem;
    cursor: pointer;
}

.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable:hover {
    color: #4fc3f7;
}

#tx_sort_arrow {
    font-size: 0.65rem;
}

/* Wallet line badge + switch */
.wl-line-badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 3px;
    background: #1a237e;
    color: #42a5f5;
}

.wl-line-pre {
    background: #4e342e;
    color: #ffab91;
}

.wl-line-post {
    background: #1b5e20;
    color: #66bb6a;
}

.btn-switch {
    background: #0f3460;
    color: #4fc3f7;
    border: 1px solid #1a3a6e;
    cursor: pointer;
}

.btn-sm {
    cursor: pointer;
}

.btn-switch:hover {
    background: #1a3a6e;
}

.switch-btn-group {
    display: flex;
    gap: 8px;
}

.btn-switch-pre {
    padding: 8px 16px;
    background: #4e342e;
    color: #ffab91;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
}

.btn-switch-pre:hover { background: #5d4037; }
.btn-switch-pre:disabled { background: #333; color: #666; cursor: not-allowed; }

.btn-switch-post {
    padding: 8px 16px;
    background: #1b5e20;
    color: #66bb6a;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
}

.btn-switch-post:hover { background: #2e7d32; }
.btn-switch-post:disabled { background: #333; color: #666; cursor: not-allowed; }

/* Whitelist overlay */
.wl-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 12px 0;
    max-height: 200px;
    overflow-y: auto;
}

.wl-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0f3460;
    padding: 6px 12px;
    border-radius: 4px;
}

.wl-name {
    font-size: 0.75rem;
    color: #aaa;
    margin-left: auto;
    margin-right: 8px;
}

.wl-you {
    font-size: 0.7rem;
    color: #4fc3f7;
    background: #1a3a6e;
    padding: 2px 8px;
    border-radius: 3px;
}

.wl-remove {
    background: none;
    border: none;
    color: #ef5350;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.wl-remove:hover {
    color: #f44336;
}

.wl-add-row {
    display: flex;
    gap: 8px;
}

.wl-add-row input {
    flex: 1;
    padding: 8px 12px;
    background: #0f3460;
    border: 1px solid #1a3a6e;
    border-radius: 4px;
    color: #e0e0e0;
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-size: 0.85rem;
}

.wl-add-row input::placeholder {
    color: #556;
}

/* Confirm overlay */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.confirm-overlay.hidden {
    display: none;
}

.confirm-box {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 24px 32px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(79, 195, 247, 0.15);
}

.detail-box {
    display: flex;
    flex-direction: column;
}

.confirm-box h3 {
    color: #e94560;
    margin-bottom: 10px;
    font-size: 1.1rem;
    text-align: center;
}

.confirm-box p {
    margin-bottom: 20px;
}

.confirm-warn {
    display: block;
    color: #e0e0e0;
    font-size: 0.95rem;
    margin-bottom: 12px;
    text-align: center;
}

.confirm-detail {
    display: block;
    color: #ffb74d;
    font-size: 0.85rem;
    line-height: 1.5;
    text-align: center;
}

.confirm-buttons {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.detail-actions {
    justify-content: flex-end;
}

.detail-table-scroll {
    overflow-y: auto;
    max-height: var(--detail-scroll-max, 320px);
    min-height: 0;
    height: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #0f3460 #0a1e3d;
}

.detail-table-scroll::-webkit-scrollbar {
    width: 6px;
}

.detail-table-scroll::-webkit-scrollbar-track {
    background: #0a1e3d;
    border-radius: 3px;
}

.detail-table-scroll::-webkit-scrollbar-thumb {
    background: #0f3460;
    border-radius: 3px;
}

.detail-table-scroll::-webkit-scrollbar-thumb:hover {
    background: #1a3a6e;
}

.btn-wallet-delete {
    padding: 8px 16px;
    background: #b71c1c;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
}

.btn-wallet-delete:hover {
    background: #d32f2f;
}

.btn-wallet-keep {
    padding: 8px 16px;
    background: #2e7d32;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
}

.btn-wallet-keep:hover {
    background: #388e3c;
}

.btn-cancel {
    padding: 8px 20px;
    background: #2a2a4e;
    color: #aaa;
    border: 1px solid #0f3460;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-cancel:hover {
    background: #3a3a5e;
}

/* Error toast */
/* Toast notifications */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #16213e;
    border-radius: 8px;
    padding: 16px 28px;
    font-size: 0.85rem;
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    white-space: nowrap;
    z-index: 200;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.toast.visible {
    opacity: 1;
}

.toast.hidden {
    display: none;
}

.toast.toast-error {
    color: #ef5350;
    border: 1px solid #ef5350;
}

.toast.toast-success {
    color: #66bb6a;
    border: 1px solid #66bb6a;
}

footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 4px 0;
    color: #555;
    font-size: 0.8rem;
    background: #1a1a2e;
}
