/* PandaTool EVM 市值管理 - 1:1 布局复刻 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background: #f5f7f9;
    color: #374151;
    line-height: 1.5;
    min-height: 100vh;
    font-size: 14px;
}

/* ===== 顶部工具栏 ===== */
.top-bar {
    display: flex;
    justify-content: flex-end;
    padding: 8px 16px 0;
    width: 100%;
    background: #f5f7f9;
}

.user-bar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 8px;
    padding: 4px 10px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    font-size: 0.8125rem;
}

.user-bar-label {
    color: #64748b;
}

#user-bar-name {
    color: #166534;
}

.user-bar-status {
    font-size: 0.6875rem;
    color: #64748b;
    white-space: nowrap;
}

.user-bar-status.ok {
    color: #16a34a;
}

.user-bar-status.warn {
    color: #b45309;
    font-weight: 600;
}

.user-bar-status.muted {
    color: #94a3b8;
}

.top-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.wallet-hint {
    font-size: 0.75rem;
    color: #64748b;
    max-width: 220px;
    line-height: 1.3;
    text-align: right;
}

.wallet-hint.warn {
    color: #b45309;
    font-weight: 500;
}

.wallet-hint.ok {
    color: #16a34a;
}

/* ===== 主布局 43% / 57% ===== */
.main-layout {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    margin: 8px 0 16px;
    padding: 0 4px;
}

@media (min-width: 768px) {
    .main-layout {
        flex-direction: row;
        align-items: flex-start;
    }
    .panel-left {
        width: 43%;
        flex: 0 0 43%;
        padding: 0 32px 0 24px;
    }
    .panel-right {
        width: 57%;
        flex: 0 0 57%;
        padding-right: 16px;
    }
}

/* ===== 左侧标题 ===== */
.page-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #374151;
    margin: 4px 0 12px;
    line-height: 1.3;
}

.tutorial-link {
    color: #ef4444;
    font-size: 0.875rem;
    margin-left: 4px;
    text-decoration: none;
    font-weight: 400;
}

/* ===== 卡片（链配置区） ===== */
.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.card-top {
    padding: 8px 0 4px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: none;
    margin-bottom: 0;
}

.card-bottom {
    padding: 0 0 16px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: none;
    margin-top: 0;
    margin-bottom: 8px;
}

/* 交易区：无外框，仅内部白底块 */
.card-trade {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin-top: 0;
}

/* ===== 表单行：左标签右控件 ===== */
.form-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    min-height: 40px;
    margin-bottom: 2px;
}

.form-row label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.font-bold { font-weight: 600 !important; }

.select-wrap {
    position: relative;
    width: 45%;
    min-width: 140px;
}

.select-wrap.select-wrap-lg {
    width: 80%;
    min-width: 200px;
}

/* ===== 自定义下拉（对齐原站 Radix Select） ===== */
.custom-select {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    height: 36px;
    padding: 0 10px 0 8px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.custom-select-trigger:hover {
    border-color: #9ca3af;
}

.custom-select-trigger:focus-visible {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.45);
}

.custom-select-value {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.custom-select-placeholder {
    color: #9ca3af;
}

.custom-select-chevron {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #9ca3af;
}

.custom-select-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 50;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 6px 0;
    max-height: 320px;
    overflow-y: auto;
}

.custom-select-panel.hidden {
    display: none;
}

.custom-select-panel-label {
    padding: 6px 12px 4px;
    font-size: 0.75rem;
    color: #9ca3af;
    font-weight: 500;
}

.custom-select-list {
    display: flex;
    flex-direction: column;
}

.custom-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    text-align: left;
}

.custom-select-option:hover {
    background: #f3f4f6;
}

.custom-select-option.is-selected {
    background: #f9fafb;
}

.custom-select-option-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.custom-select-option-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-check {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #374151;
}

.custom-select-check-spacer {
    width: 16px;
    flex-shrink: 0;
}

.trade-select {
    width: 180px;
    flex-shrink: 0;
}

.trade-select-xs {
    width: 120px;
}

.select-wrap .select {
    width: 100%;
}

.select, .input {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 0.875rem;
    background: #fff;
    outline: none;
    height: 36px;
    color: #374151;
    appearance: auto;
}

.select-with-icon {
    padding-left: 12px;
}

.select:focus, .input:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.45);
}

.select-sm { width: 45%; min-width: 120px; }
.select-lg { width: 80%; min-width: 180px; }
.select-xs { width: auto; min-width: 88px; }
.select-static {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    color: #374151;
    font-size: 0.875rem;
}
.wash-ratio-block {
    margin-top: 0;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.wash-ratio-block.wash-target-emphasis {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.wash-ratio-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.wash-ratio-hint {
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
}

.wash-ratio-row {
    margin-top: 6px;
}

.input-ratio {
    width: 100px;
    min-width: 72px;
    max-width: 140px;
    flex: 0 1 auto;
}

.ratio-colon {
    font-weight: 700;
    color: #6b7280;
    padding: 0 2px;
}

.wash-actuarial {
    margin-top: 10px;
    padding: 10px 12px;
    background: #fff;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    font-size: 0.8125rem;
    line-height: 1.5;
}

.wash-result-card {
    margin-bottom: 10px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #ecfdf5 0%, #eff6ff 100%);
    border: 2px solid #34d399;
    border-radius: 10px;
}

.wash-result-card.hidden {
    display: none !important;
}

.wash-result-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #047857;
    margin-bottom: 8px;
}

.wash-result-body {
    font-size: 0.8125rem;
    color: #1e293b;
    line-height: 1.55;
    word-break: break-word;
}

.wash-result-shot {
    margin-top: 8px;
    font-weight: 600;
    color: #1d4ed8;
}

.wash-actuarial-line {
    color: #475569;
}

.wash-result-card.unreachable {
    background: linear-gradient(135deg, #fff7ed 0%, #fef2f2 100%);
    border-color: #f97316;
}

.wash-result-card.unreachable .wash-result-title {
    color: #c2410c;
}

.wash-result-card.unreachable .wash-result-shot {
    color: #b45309;
}

.wash-actuarial-highlight {
    color: #1d4ed8;
    font-weight: 600;
    margin-top: 4px;
}

.wash-actuarial-highlight.unreachable {
    color: #c2410c;
}
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.wash-actuarial-actions .btn-sm {
    height: 30px;
    padding: 0 10px;
    font-size: 0.8125rem;
}

.wash-oneshot-check {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8125rem;
    color: #374151;
    cursor: pointer;
}

.stop-wash-hint {
    font-size: 0.75rem;
    color: #64748b;
    margin-left: 4px;
}

.trade-save-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed #e2e8f0;
    flex-wrap: wrap;
}

.settings-save-hint {
    flex: 1;
    min-width: 160px;
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.4;
}

.settings-save-hint.dirty {
    color: #b45309;
    font-weight: 600;
}

#btn-save-settings.btn-save-pending {
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.35);
}
select option:disabled {
    color: #9ca3af;
}
.input-lg { width: 80%; min-width: 180px; height: 36px; }

.detect-status {
    padding: 0 24px 8px;
    font-size: 0.8125rem;
    color: #64748b;
    min-height: 1.25rem;
}
.detect-status.detect-success { color: #16a34a; }
.detect-status.detect-error { color: #dc2626; }

.input-md { width: 35%; min-width: 100px; }
.input-sm { width: 33%; min-width: 70px; max-width: 120px; }
.input-xs { width: 80px; }

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    height: 36px;
    white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}
.btn-primary:hover:not(:disabled) { background: #60a5fa; }

.btn-block {
    display: flex;
    width: calc(100% - 48px);
    margin: 8px 24px 0;
}

.btn-outline {
    background: #fff;
    border-color: #d1d5db;
    color: #374151;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.btn-outline:hover:not(:disabled) { background: #f9fafb; }

.btn-outline-green {
    background: transparent;
    border-color: #4ade80;
    color: #4ade80;
    box-shadow: 0 1px 2px rgba(74, 222, 128, 0.15);
}
.btn-outline-green:hover { background: #f0fdf4; }

.btn-outline-gray {
    background: transparent;
    border-color: #9ca3af;
    color: #6b7280;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.btn-outline-gray:hover { background: #f9fafb; }

.btn-connect {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
    font-weight: 500;
}

.btn-import {
    background: #f0fdf4;
    border-color: #d1d5db;
    color: #374151;
}
.btn-import:hover { background: #dcfce7; }

.btn-generate {
    background: #eff6ff;
    color: #1d4ed8;
}
.btn-generate:hover { background: #dbeafe; }

.btn-transfer {
    background: #fef3c7;
    color: #b45309;
}
.btn-transfer:hover { background: #fde68a; }

.btn-collect {
    background: #f3e8ff;
    color: #7c3aed;
}
.btn-collect:hover { background: #e9d5ff; }

.btn-clear-addresses {
    color: #dc2626;
    border-color: #fecaca;
    background: #fef2f2;
}
.btn-clear-addresses:hover {
    background: #fee2e2;
    border-color: #f87171;
}

.modal-form-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.modal-form-row label {
    min-width: 88px;
    font-size: 0.875rem;
    color: #374151;
}
.modal-form-col {
    flex-direction: column;
    align-items: stretch;
}
.modal-form-col label { min-width: auto; }
.modal-warn { color: #b45309; }
.transfer-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: #374151;
    margin-bottom: 8px;
    cursor: pointer;
}
.transfer-progress { color: #1d4ed8; font-weight: 500; }

.input-sm { max-width: 120px; }

/* ===== Tabs ===== */
.tabs {
    display: flex;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 3px;
    margin: 0 24px;
}

.tab {
    flex: 1;
    padding: 6px 8px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    color: #374151;
    height: 32px;
}

.tab.active {
    background: #3b82f6;
    color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== 交易参数白底块 ===== */
.trade-panel {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 24px;
    margin: 12px 24px 0;
}

.stop-panel {
    margin-top: 8px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 24px;
    margin: 12px 24px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.stop-panel .interval-row {
    flex-wrap: wrap;
    gap: 4px 6px;
}
.stop-panel .interval-group {
    display: inline-flex;
    align-items: center;
    gap: 4px 6px;
    flex-wrap: wrap;
}
.stop-panel .interval-group.hidden {
    display: none !important;
}
.stop-panel .interval-sell-label {
    margin-left: 8px;
}
@media (max-width: 900px) {
    .stop-panel .interval-sell-label {
        margin-left: 0;
    }
}

.form-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.form-inline label {
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 2px;
}

.trade-panel .input-trade-amount {
    width: auto;
    min-width: 88px;
    max-width: none;
    flex: 1 1 100px;
}

.range-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.range-row label {
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
}

.symbol-label { font-weight: 700; color: #1f2937; }
.stop-field-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.price-pair { font-size: 12px; font-weight: 700; color: #374151; white-space: nowrap; }

.pool-info {
    margin: 8px 24px 0;
    padding: 8px 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    font-size: 0.8125rem;
    color: #1e40af;
    display: none;
}
.pool-info.show { display: block; }

.pool-select-row {
    margin: 10px 24px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.pool-select-row label {
    font-size: 0.8125rem;
    color: #374151;
    font-weight: 600;
}
.pool-select-row.hidden { display: none; }
.pool-select-row .input { width: 100%; }

/* ===== 右侧面板 ===== */
.panel-right {
    background: #f3f4f6;
    border-radius: 4px;
    padding: 8px;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    min-height: 620px;
}

.wallet-toolbar {
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.btn-anchor {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
}

.btn-anchor:hover {
    background: #dbeafe;
    border-color: #60a5fa;
}

.btn-anchor.is-open {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.btn-anchor-summary {
    margin-left: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.9;
}

.btn-anchor-summary:empty {
    display: none;
}

.smart-anchor-panel {
    margin-bottom: 8px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.smart-anchor-panel.hidden {
    display: none !important;
}

.wash-anchor-hint {
    padding: 8px 10px;
    font-size: 0.8125rem;
    color: #64748b;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
}

.smart-anchor-panel .wash-anchor-hint {
    margin: 0 0 10px;
}
.wash-auto-anchor-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #1d4ed8;
    cursor: pointer;
    user-select: none;
}
.wash-auto-anchor-extra {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
    color: #64748b;
}
.wash-auto-anchor-extra .input-xs {
    width: 52px;
    padding: 2px 6px;
    font-size: 0.75rem;
}
.wash-auto-anchor-status {
    margin-top: 8px;
    padding: 8px 10px;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #64748b;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.wash-auto-anchor-status.is-active {
    color: #047857;
    background: #ecfdf5;
    border-color: #6ee7b7;
}
.wash-auto-anchor-status.is-warn {
    color: #b45309;
    background: #fffbeb;
    border-color: #fcd34d;
}
.wash-auto-anchor-status.is-error {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fca5a5;
}
.wash-actuarial-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.table-wrap {
    overflow-y: auto;
    max-height: 40vh;
    height: 288px;
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
}

.wallet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    table-layout: fixed;
}

.wallet-table thead {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

.wallet-table th {
    padding: 8px 6px;
    text-align: center;
    font-weight: 400;
    font-size: 0.875rem;
    color: #111827;
    border-bottom: 1px solid #e5e7eb;
}

.wallet-table th:nth-child(1),
.wallet-table td:nth-child(1) {
    width: 36%;
    text-align: left;
}

.wallet-table th:nth-child(2),
.wallet-table td:nth-child(2) {
    width: 14%;
}

.wallet-table th:nth-child(3),
.wallet-table td:nth-child(3) {
    width: 22%;
}

.wallet-table th:nth-child(4),
.wallet-table td:nth-child(4) {
    width: 28%;
}

.wallet-table td {
    padding: 8px 6px;
    text-align: center;
    font-size: 0.875rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.wallet-th-base {
    vertical-align: middle;
    line-height: 1.35;
}

.wallet-th-base-title {
    font-weight: 400;
    white-space: nowrap;
}

.wallet-th-base .tab-server-auto-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    max-width: 100%;
    white-space: normal;
    text-align: center;
}

.wallet-th-base .tab-server-auto-label.hidden {
    display: none !important;
}

.wallet-td-base {
    position: relative;
    text-align: center;
    padding-right: 26px !important;
}

.wallet-td-base .btn-delete {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
}

.btn-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: #ef4444;
    font-size: 1rem;
    padding: 0 4px;
    flex-shrink: 0;
}

.action-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.current-price {
    font-size: 0.875rem;
    color: #111827;
    margin-left: auto;
    white-space: nowrap;
}

.trade-status {
    font-size: 0.875rem;
    color: #16a34a;
    font-weight: 600;
    animation: pulse 1.5s ease-in-out infinite;
}
.trade-status.hidden { display: none; }

.trade-random-wallet-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.trade-random-wallet-wrap input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.trade-server-mode-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.trade-server-mode-wrap input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.wallet-table .th-wallet-server,
.wallet-table .wallet-server-cell {
    width: 52px;
    text-align: center;
    white-space: nowrap;
}
.wallet-table .wallet-actions-cell {
    width: 36px;
    text-align: center;
}
.wallet-server-auto-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.wallet-server-auto-wrap input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.wallet-server-auto-wrap input:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}
.threads-server-auto-row {
    flex-wrap: wrap;
    gap: 8px 12px;
    width: 100%;
}
.threads-server-auto-spacer {
    flex: 1 1 12px;
    min-width: 8px;
}
.tab-server-auto-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: #1d4ed8;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
}
.tab-server-auto-label input {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}
.tab-server-auto-label.hidden {
    display: none !important;
}
.trade-tab-hint {
    margin: 0 0 10px;
    padding: 8px 10px;
    font-size: 0.75rem;
    line-height: 1.45;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}
.trade-wallet-mode-hint {
    font-size: 0.75rem;
    color: #64748b;
    white-space: nowrap;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.log-panel {
    margin-top: 8px;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.log-expand-bar {
    text-align: center;
    padding: 6px 0 2px;
}

.log-expand-bar.hidden {
    display: none;
}

.log-actions {
    margin-top: 8px;
    text-align: center;
}

.log-wrap {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    height: 288px;
    overflow-y: auto;
    width: 100%;
    flex: 1;
}

.log-wrap.log-wrap-collapsed {
    height: auto;
    max-height: 132px;
    overflow: hidden;
}

.log-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    text-align: center;
    color: #9ca3af;
    font-size: 0.875rem;
}

.log-item {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    font-size: 0.8125rem;
    padding: 4px 8px;
    border-bottom: 1px solid #f3f4f6;
}

.log-item.success { color: #16a34a; }
.log-item.fail { color: #dc2626; }
.log-item a { color: #2563eb; text-decoration: underline; }
.log-trade-detail {
    flex: 1 1 100%;
    color: #374151;
    font-variant-numeric: tabular-nums;
}
.log-item.success .log-trade-detail { color: #15803d; }

/* ===== 弹窗 ===== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal.hidden { display: none; }

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    max-width: 480px;
    width: calc(100% - 32px);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-lg { max-width: 700px; }
.modal-content h3 { text-align: center; margin-bottom: 8px; font-size: 1.125rem; }
.modal-desc { text-align: center; font-size: 0.875rem; color: #6b7280; margin-bottom: 16px; }
.generate-progress {
    margin: 0 0 12px;
    padding: 12px;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #1d4ed8;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    text-align: left;
}
.generate-progress-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 8px;
}
.generate-progress-count {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e40af;
    font-variant-numeric: tabular-nums;
}
.generate-progress-percent {
    font-size: 0.875rem;
    font-weight: 600;
    color: #3b82f6;
}
.generate-progress-track {
    height: 8px;
    background: #dbeafe;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 8px;
}
.generate-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    border-radius: 999px;
    transition: width 0.15s ease;
}
.generate-progress-detail {
    font-size: 0.8125rem;
    color: #475569;
}
.generate-bg-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #1d4ed8;
    background: #eff6ff;
    border: 1px solid #93c5fd;
    border-radius: 999px;
    cursor: pointer;
    animation: generate-pulse 1.5s ease-in-out infinite;
}
.generate-bg-status:hover {
    background: #dbeafe;
}
@keyframes generate-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.72; }
}
.generate-done-summary {
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: #047857;
    margin: 8px 0 16px;
}
.generate-mode-options { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.generate-mode-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8125rem;
    line-height: 1.5;
}
.generate-mode-option:has(input:checked) { border-color: #3b82f6; background: #eff6ff; }
.generate-mode-option input { margin-top: 3px; flex-shrink: 0; }
.field-label { display: block; font-size: 0.8125rem; color: #374151; margin-bottom: 4px; }

.modal-content textarea {
    width: 100%;
    min-height: 72px;
    max-height: 140px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.75rem;
    color: #374151;
    font-family: ui-monospace, monospace;
    resize: vertical;
    box-sizing: border-box;
}

.modal-content textarea.textarea-compact {
    min-height: 56px;
    max-height: 88px;
}

.modal-content textarea.textarea-result {
    min-height: 80px;
    max-height: 120px;
    color: #f87171;
}

.modal-content textarea.textarea-import {
    min-height: 160px;
    max-height: 240px;
    color: #f87171;
}

#modal-generate .modal-content {
    max-height: min(88vh, 640px);
    display: flex;
    flex-direction: column;
}

#modal-generate .modal-generate-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

#modal-generate .modal-footer {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    background: #fff;
    padding-top: 12px;
    margin-top: 8px;
    border-top: 1px solid #f1f5f9;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.modal-content ul { padding-left: 20px; margin: 16px 0; }
.modal-content li { margin-bottom: 8px; font-size: 0.875rem; color: #4b5563; }

.fee-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; margin: 16px 0; }
.fee-table th, .fee-table td { border: 1px solid #e5e7eb; padding: 8px; text-align: left; }
.fee-table th { background: #f9fafb; }

.tip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid #9ca3af;
    color: #6b7280;
    font-size: 11px;
    cursor: help;
    position: relative;
    flex-shrink: 0;
}

.tip-icon:hover::after {
    content: attr(data-tips);
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: normal;
    white-space: pre-line;
    width: 280px;
    z-index: 100;
    pointer-events: none;
}

.hidden { display: none !important; }

#toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: 8px;
    color: #fff;
    font-size: 0.875rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }
.toast.info { background: #3b82f6; }
.toast.warn { background: #d97706; }

.loading { position: relative; pointer-events: none; opacity: 0.7; }

.v3-fee-row { margin-bottom: 8px; }
.address-short { font-family: ui-monospace, monospace; font-size: 0.8125rem; }
.copy-addr { cursor: pointer; }
.copy-addr:hover { color: #3b82f6; }

.announcement-bar {
    background: #eff6ff;
    border-bottom: 1px solid #bfdbfe;
    padding: 8px 16px;
    font-size: 0.875rem;
    color: #1e40af;
}
.announcement-bar.hidden { display: none; }
.announcement-item { margin: 4px 0; }
.announcement-warning { color: #b45309; }
.announcement-error { color: #b91c1c; }
.announcement-success { color: #15803d; }