* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, 'Segoe UI', sans-serif; background: #1a1a2e; color: #e0e0e0; }

.login-overlay { position: fixed; inset: 0; background: #1a1a2e; display: flex; align-items: center; justify-content: center; z-index: 9999; }
.login-overlay.hidden { display: none; }
.login-box { background: #22223e; padding: 40px; border-radius: 8px; width: 360px; }
.login-box h2 { color: #4a9eff; margin-bottom: 20px; text-align: center; }
.login-box input { display: block; width: 100%; margin-bottom: 16px; background: #1a1a2e; border: 1px solid #3a3a5a; color: #e0e0e0; padding: 10px; border-radius: 4px; font-size: 14px; }
.login-error { color: #f44336; font-size: 12px; margin-top: 8px; min-height: 16px; }

.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 36px !important; }
.eye-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); cursor: pointer; user-select: none; opacity: 0.4; transition: opacity 0.2s; display: flex; align-items: center; }
.eye-btn:hover { opacity: 1; }
.eye-icon { width: 20px; height: 20px; fill: #aaa; }
.app { max-width: 1100px; margin: 0 auto; padding: 16px; }
header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
h1 { font-size: 20px; color: #fff; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { background: #2a2a4a; color: #aaa; border: none; padding: 8px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.tab.active { background: #4a6cf7; color: #fff; }
.tab:hover { color: #fff; }

.panel { display: none; }
.panel.active { display: block; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
h2 { font-size: 16px; color: #ccc; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #2a2a4a; }
th { color: #888; font-weight: 600; }
td { color: #ccc; word-break: break-all; }

.btn { background: #2a2a4a; color: #ccc; border: none; padding: 6px 14px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.btn:hover { background: #3a3a5a; color: #fff; }
.btn.primary { background: #4a6cf7; color: #fff; }
.btn.primary:hover { background: #5a7cff; }
.btn.danger { background: #e74c3c; color: #fff; }
.btn.small { padding: 4px 8px; font-size: 12px; }
.btn.small:disabled { opacity: 0.5; cursor: not-allowed; }

.pager { display: flex; align-items: center; justify-content: center; margin-top: 12px; gap: 8px; }

.muted { color: #666; font-size: 12px; margin-bottom: 8px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal.hidden { display: none; }
.modal-body { background: #22223e; padding: 24px; border-radius: 8px; width: 1260px; max-width: 95vw; }
.modal-body h3 { margin-bottom: 16px; color: #fff; }
.modal-body label { display: block; margin-bottom: 12px; font-size: 13px; color: #aaa; }
.modal-body label.checkbox-label { display: flex; align-items: center; gap: 6px; }
.modal-body label.checkbox-label input { width: auto; margin: 0; }
.modal-body input, .modal-body select, .modal-body textarea { display: block; width: 100%; margin-top: 4px; background: #1a1a2e; border: 1px solid #3a3a5a; color: #e0e0e0; padding: 8px; border-radius: 4px; font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.code { background: #111122; border: 1px solid #2a2a4a; border-radius: 6px; padding: 16px; overflow: auto; max-height: 70vh; font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-all; }

.token-card { background: #22223e; padding: 16px; border-radius: 6px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.token-name { font-size: 20px; font-weight: 700; margin-bottom: 6px; background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb, #1dd1a1, #5f27cd, #ff6b6b); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: rainbow 3s linear infinite; }
@keyframes rainbow { 0% { background-position: 0% 50%; } 100% { background-position: 300% 50%; } }
.token-link { background: #1a1a2e; padding: 6px 10px; border-radius: 4px; font-family: monospace; font-size: 12px; color: #7ec; word-break: break-all; }
.qr-box { background: #fff; padding: 8px; border-radius: 6px; width: 196px; height: 196px; flex-shrink: 0; }
.qr-box img, .qr-box canvas { width: 180px !important; height: 180px !important; }

.checkbox-cell { text-align: center; }

.badge { display: inline-block; background: #2a4a6a; color: #8cf; padding: 1px 8px; border-radius: 10px; font-size: 11px; margin-left: 4px; }
.badge-all { background: #2a4a2a; color: #7e7; }
.badge-expired { background: #4a2a2a; color: #f44; }

.node-select-area { margin-bottom: 12px; }
.node-select-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; color: #888; }
.node-select-toolbar .btn { margin-left: 0; }
.node-checkbox-list { max-height: 400px; overflow-y: auto; border: 1px solid #3a3a5a; border-radius: 4px; background: #1a1a2e; }
.node-cb-header, .node-cb { display: grid !important; grid-template-columns: 24px minmax(140px,1.5fr) 70px minmax(160px,1.2fr) 90px 50px 50px; align-items: center; gap: 8px; padding: 4px 8px; font-size: 12px; box-sizing: border-box; }
.node-cb-header { color: #888; font-size: 11px; border-bottom: 1px solid #3a3a5a; position: sticky; top: 0; background: #1a1a2e; z-index: 1; }
.node-cb { color: #ccc; cursor: pointer; border-bottom: 1px solid #2a2a3e; }
.node-cb:hover { background: #2a2a4a; }
.node-cb input { width: auto; margin: 0; }
.node-cb-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-cb-type { color: #8cf; }
.node-cb-addr { color: #888; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.delay-good { color: #4caf50; font-weight: 600; }
.delay-ok { color: #ff9800; font-weight: 600; }
.delay-bad { color: #f44336; font-weight: 600; }

.source-status-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.src-badge { padding: 2px 10px; border-radius: 4px; font-size: 12px; cursor: help; }
.src-ok { background: #1a3a1a; color: #4caf50; }
.src-err { background: #3a1a1a; color: #f44336; }

.fmt-capsule { display: inline-flex; border: 1px solid #3a3a5a; border-radius: 20px; overflow: hidden; margin-left: 4px; }
.fmt-btn { background: transparent; color: #888; border: none; padding: 4px 12px; font-size: 12px; cursor: pointer; transition: all 0.2s; }
.fmt-btn.active { background: #4a6cf7; color: #fff; }
.fmt-btn:hover:not(.active) { color: #ccc; }

/* 设置页面 */
.settings-grid { display: flex; flex-direction: column; gap: 16px; max-width: 560px; }
.settings-card { background: #22223e; border-radius: 8px; padding: 24px; }
.settings-card-title { font-size: 15px; font-weight: 600; color: #4a9eff; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid #2a2a4a; }
.settings-field { margin-bottom: 20px; }
.settings-label { display: block; font-size: 13px; font-weight: 500; color: #ccc; margin-bottom: 2px; }
.settings-hint { display: block; font-size: 11px; color: #666; margin-bottom: 8px; }
.settings-field input { display: block; width: 100%; background: #1a1a2e; border: 1px solid #3a3a5a; color: #e0e0e0; padding: 10px; border-radius: 4px; font-size: 13px; }
.settings-field input:focus { outline: none; border-color: #4a6cf7; }
.settings-field .pwd-wrap input { padding-right: 36px; }
