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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: #1a1a2e;
    color: #fff;
    padding: 20px 30px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 22px;
}

header nav a {
    color: #adb5bd;
    text-decoration: none;
    margin-left: 20px;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.2s;
}

header nav a:hover,
header nav a.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.stat-card h3,
.stat-card h4 {
    font-size: 13px;
    color: #666;
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
}

.stat-card.income .stat-value {
    color: #28a745;
}

.stat-card.expense .stat-value {
    color: #dc3545;
}

.section {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.section h2 {
    font-size: 18px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

tr:hover {
    background: #f8f9fa;
}

.chain-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.chain-badge.TRC20 {
    background: #e8f5e9;
    color: #2e7d32;
}

.chain-badge.ERC20 {
    background: #e3f2fd;
    color: #1565c0;
}

.direction {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.direction.in {
    background: #e8f5e9;
    color: #28a745;
}

.direction.out {
    background: #fce4ec;
    color: #dc3545;
}

.addr {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px;
    color: #666;
}

.addr a {
    color: #0366d6;
    text-decoration: none;
}

.addr a:hover {
    text-decoration: underline;
}

.amount {
    font-weight: 600;
    font-family: 'SF Mono', monospace;
}

.empty {
    text-align: center;
    padding: 40px;
    color: #999;
}

.report-form {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.report-form label {
    font-weight: 500;
}

.report-form input[type="date"] {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.report-form button {
    padding: 8px 20px;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.report-form button:hover {
    background: #2d2d4e;
}

footer {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 13px;
}


/* ---- 钱包筛选栏 ---- */

.wallet-filter {
    background: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    margin-bottom: 16px;
}

.wallet-filter-form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.wallet-filter-form label {
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
}

.wallet-filter-form select,
.wallet-filter-form input[type="date"] {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.wallet-filter-form select {
    max-width: 500px;
    flex: 1;
}


/* ---- 钱包管理表单 ---- */

.wallet-add-form {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.wallet-add-form form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-row label {
    font-size: 13px;
    font-weight: 500;
    color: #555;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.form-row input,
.form-row select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-row input[type="text"] {
    min-width: 280px;
}

.form-msg {
    margin-top: 8px;
    font-size: 13px;
}

.msg-ok {
    color: #28a745;
}

.msg-err {
    color: #dc3545;
}

.btn-primary {
    padding: 8px 20px;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

.btn-primary:hover {
    background: #2d2d4e;
}

.btn-primary:disabled {
    background: #888;
    cursor: not-allowed;
}

.btn-enter {
    display: inline-block;
    padding: 6px 18px;
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3);
}

.btn-enter:hover {
    background: linear-gradient(135deg, #43A047, #1B5E20);
    color: #fff;
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.45);
    transform: translateY(-1px);
}

.btn-enter:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(76, 175, 80, 0.3);
}


/* ========== 使用指南 ========== */

.guide-section {
    margin-top: 30px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}

.guide-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    cursor: pointer;
    user-select: none;
    background: #f9fafc;
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.2s;
}

.guide-toggle:hover {
    background: #f0f4ff;
}

.guide-toggle h3 {
    margin: 0;
    font-size: 17px;
    color: #1976d2;
    display: flex;
    align-items: center;
    gap: 8px;
}

.guide-toggle .arrow {
    font-size: 12px;
    transition: transform 0.3s;
    color: #888;
}

.guide-body {
    padding: 24px 28px;
    font-size: 14px;
    line-height: 1.9;
    color: #444;
    display: none;
}

.guide-body.show {
    display: block;
}

.guide-body h4 {
    font-size: 16px;
    color: #1976d2;
    margin: 22px 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e3f2fd;
}

.guide-body h4:first-child {
    margin-top: 0;
}

.guide-body .hl {
    font-weight: 700;
    color: #e65100;
}

.guide-body .hl-blue {
    font-weight: 700;
    color: #1565c0;
}

.guide-body .hl-green {
    font-weight: 700;
    color: #2e7d32;
}

.guide-body .hl-red {
    font-weight: 700;
    color: #c62828;
}

.guide-body .hl-orange {
    font-weight: 700;
    color: #e65100;
}

.guide-body .badge-step {
    display: inline-block;
    background: #1976d2;
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 4px;
    font-weight: 600;
    vertical-align: middle;
}

.guide-body .badge-tip {
    display: inline-block;
    background: #fff3e0;
    color: #e65100;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 3px;
    margin-right: 4px;
    font-weight: 600;
    border: 1px solid #ffe0b2;
    vertical-align: middle;
}

.guide-body .badge-risk {
    display: inline-block;
    background: #ffebee;
    color: #c62828;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 3px;
    margin-right: 4px;
    font-weight: 600;
    border: 1px solid #ffcdd2;
    vertical-align: middle;
}

.guide-body ul,
.guide-body ol {
    margin: 8px 0 8px 22px;
}

.guide-body li {
    margin-bottom: 6px;
}

.guide-body code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
    color: #d32f2f;
    border: 1px solid #eee;
}

.guide-body .kv-row {
    display: flex;
    gap: 12px;
    margin: 4px 0;
    align-items: baseline;
}

.guide-body .kv-key {
    flex-shrink: 0;
    font-weight: 600;
    font-size: 12px;
    color: #555;
    white-space: nowrap;
}

.guide-body .kv-val {
    color: #333;
}

.guide-body .flow-box {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 10px 0;
    padding: 10px 14px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px dashed #ccc;
}

.guide-body .flow-box span {
    background: #e3f2fd;
    color: #1565c0;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.guide-body .flow-box .flow-arr {
    background: none;
    color: #888;
    padding: 0 2px;
    font-size: 16px;
}

.btn-danger {
    padding: 6px 14px;
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

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

.btn-small {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    cursor: pointer;
}

.btn-small:hover {
    background: #f0f0f0;
}

.btn-danger.btn-small {
    border-color: #dc3545;
    color: #fff;
    background: #dc3545;
}

.btn-danger.btn-small:hover {
    background: #c82333;
}

.btn-danger-small {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid #e6a817;
    color: #856404;
    background: #fff3cd;
    cursor: pointer;
    margin-left: 4px;
}

.btn-danger-small:hover {
    background: #e6a817;
    color: #fff;
}

.btn-sync {
    border-color: #17a2b8;
    color: #17a2b8;
}

.btn-sync:hover {
    background: #17a2b8;
    color: #fff;
}

.btn-sync-range {
    border-color: #6f42c1;
    color: #6f42c1;
}

.btn-sync-range:hover {
    background: #6f42c1;
    color: #fff;
}

.btn-sync-count {
    border-color: #e67e22;
    color: #e67e22;
}

.btn-sync-count:hover {
    background: #e67e22;
    color: #fff;
}

.wallet-table {
    width: 100%;
}


/* ---- 多维表格关联状态 ---- */

.bitable-linked {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #e8f5e9;
    color: #2e7d32;
}

.bitable-none {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #f5f5f5;
    color: #999;
}

.bitable-status {
    text-align: center;
}

.bitable-check {
    color: #2e7d32;
    font-size: 18px;
    font-weight: bold;
}

.btn-sync-single {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 3px;
    border: 1px solid #17a2b8;
    color: #17a2b8;
    background: #fff;
    cursor: pointer;
}

.btn-sync-single:hover {
    background: #17a2b8;
    color: #fff;
}

.btn-sync-single:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* ---- 表单提示 ---- */

.form-hint {
    margin-top: 8px;
    font-size: 12px;
    color: #888;
}

.form-hint code {
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 11px;
}


/* ---- 弹窗 ---- */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 400px;
    max-width: 600px;
}

.modal-content h3 {
    margin-bottom: 16px;
    font-size: 16px;
}

.modal-content .form-row {
    margin-bottom: 12px;
}

.modal-content .form-row input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}


/* ---- 同步日志 ---- */

#syncLogWrap {
    margin: 12px 0;
}

#syncLog {
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.6;
    height: 280px;
    overflow-y: auto;
    padding: 10px 12px;
    border-radius: 6px;
    white-space: pre-wrap;
    word-break: break-all;
}

.sync-log-line {
    padding: 1px 0;
}


/* ---- 自定义确认/提示弹窗 ---- */

.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.dialog-box {
    background: #fff;
    padding: 28px 32px 22px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    min-width: 320px;
    max-width: 420px;
    text-align: center;
    animation: dialogIn 0.2s ease-out;
}

@keyframes dialogIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.dialog-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.dialog-msg {
    font-size: 15px;
    color: #333;
    line-height: 1.5;
    margin-bottom: 20px;
    word-break: break-word;
}

.dialog-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}


/* ---- 危险区域 ---- */

.danger-zone {
    background: #fff5f5;
    border: 1px solid #fdd;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.danger-zone h4 {
    color: #dc3545;
    margin-bottom: 8px;
    font-size: 14px;
}

.danger-zone p {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
}


/* ---- 颜色工具类 ---- */

.text-green {
    color: #28a745 !important;
}

.text-red {
    color: #dc3545 !important;
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 12px;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    table {
        display: block;
        overflow-x: auto;
    }
}