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

:root {
    --bg-primary: #f5f7f9;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f2f5;
    --bg-card: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --accent: #18a058;
    --accent-light: #36ad6a;
    --accent-gradient: linear-gradient(135deg, #18a058 0%, #36ad6a 100%);
    --accent-blue: #2080f0;
    --success: #18a058;
    --warning: #f0a020;
    --danger: #d03050;
    --border: #efeff5;
    --sidebar-border: #efeff5;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

.app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: white;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.logo span {
    font-size: 20px;
    font-weight: 600;
    color: var(--accent);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 4px;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(24, 160, 88, 0.08);
    color: var(--accent);
}

.nav-item.active {
    background: rgba(24, 160, 88, 0.1);
    color: var(--accent);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: var(--bg-secondary);
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

#currentTime {
    color: var(--text-secondary);
    font-size: 14px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.content {
    flex: 1;
    padding: 32px;
}

/* Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: none;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.stat-card-title {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card-icon.purple { background: rgba(24, 160, 88, 0.12); color: #18a058; }
.stat-card-icon.green { background: rgba(24, 160, 88, 0.12); color: #18a058; }
.stat-card-icon.blue { background: rgba(32, 128, 240, 0.12); color: #2080f0; }
.stat-card-icon.orange { background: rgba(240, 160, 32, 0.12); color: #d4920a; }

.stat-card-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.stat-card-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-card-amount {
    font-size: 14px;
    color: var(--text-secondary);
}

.stat-card-footer {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
}

/* Tables */
.table-container {
    background: var(--bg-card);
    border: none;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.table-title {
    font-size: 18px;
    font-weight: 600;
}

.table-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-input {
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    min-width: 150px;
}

.filter-input:focus {
    outline: none;
    border-color: var(--accent);
}

.filter-select {
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.btn {
    padding: 10px 20px;
    background: var(--accent-gradient);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(24, 160, 88, 0.3);
}

.btn-secondary {
    background: var(--accent-gradient);
    border: none;
    color: white;
}

.btn-secondary:hover {
    box-shadow: 0 4px 12px rgba(24, 160, 88, 0.3);
}

.btn-refresh {
    padding: 10px 12px;
    background: var(--accent-gradient);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-refresh:hover {
    box-shadow: 0 4px 12px rgba(24, 160, 88, 0.3);
}

.btn-refresh svg {
    transition: transform 0.3s;
    stroke: white;
}

.btn-refresh:hover svg {
    transform: rotate(180deg);
}

.date-shortcuts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-shortcut {
    padding: 6px 12px;
    background: #ffffff;
    border: 1px solid var(--accent);
    border-radius: 6px;
    color: var(--accent);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-shortcut:hover {
    background: var(--accent);
    color: white;
}

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

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg-tertiary);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

td {
    font-size: 13px;
}

tr:hover td {
    background: rgba(24, 160, 88, 0.04);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-0 { background: rgba(240, 160, 32, 0.12); color: #d4920a; }
.status-1 { background: rgba(24, 160, 88, 0.12); color: #18a058; }
.status-2 { background: rgba(102, 102, 102, 0.12); color: #666666; }
.status-3 { background: rgba(208, 48, 80, 0.12); color: #d03050; }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-top: 1px solid var(--border);
}

.pagination-info {
    font-size: 14px;
    color: var(--text-secondary);
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-jump {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 8px;
}

.page-input {
    width: 60px;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    text-align: center;
}

.page-input:focus {
    outline: none;
    border-color: var(--accent);
}

.page-input::-webkit-inner-spin-button,
.page-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.page-total {
    color: var(--text-secondary);
    font-size: 14px;
}

.page-btn {
    padding: 8px 14px;
    background: #ffffff;
    border: 1px solid #dadce0;
    border-radius: 6px;
    color: #1a73e8;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    background: #f1f3f4;
    border-color: #dadce0;
}

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

.page-btn.active {
    background: var(--accent);
    border-color: var(--accent);
}

/* Settings */
.settings-section {
    background: var(--bg-card);
    border: none;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.settings-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-info h4 {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 4px;
}

.setting-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: none;
    border-radius: 8px;
    padding: 32px;
    width: 100%;
    max-width: 480px;
    transform: scale(0.9);
    transition: all 0.3s;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.modal-overlay.show .modal {
    transform: scale(1);
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
}

.modal-body {
    margin-bottom: 24px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.qr-container {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 12px;
    margin-bottom: 20px;
}

.qr-container img {
    max-width: 200px;
}

.secret-key {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 14px;
    text-align: center;
    margin-bottom: 20px;
    word-break: break-all;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    stroke: var(--text-muted);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* Amount display */
.amount {
    font-weight: 600;
    color: var(--success);
}

.amount::before {
    content: '¥';
    font-size: 0.85em;
}

/* Order number */
.order-no {
    font-family: monospace;
    font-size: 13px;
    color: var(--accent-light);
}

/* Truncate text */
.truncate {
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Copyable field */
.copy-field {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 180px;
}

.copy-field-text {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: help;
}

.copy-btn {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    padding: 4px;
    background: #ffffff;
    border: 1px solid #dadce0;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: #1a73e8;
    border-color: #1a73e8;
}

.copy-btn svg {
    width: 14px;
    height: 14px;
    stroke: var(--text-secondary);
    fill: none;
    stroke-width: 2;
}

.copy-btn:hover svg {
    stroke: white;
}

.copy-btn.copied {
    background: var(--success);
    border-color: var(--success);
}

.copy-btn.copied svg {
    stroke: white;
}

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: #333333;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    color: #ffffff;
    white-space: nowrap;
    max-width: 400px;
    word-break: break-all;
    white-space: normal;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 8px);
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: var(--success);
    color: white;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 1.7s forwards;
}

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* TRX Query Form */
.trx-form .form-group {
    margin-bottom: 0;
}

.trx-form .form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

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

.trx-form .filter-input,
.trx-form .filter-select {
    height: 42px;
}
