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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f1419;
    color: #e7e9ea;
    min-height: 100vh;
}

/* 登录页 */
.login-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0f1419 0%, #1a1f26 100%);
}

.login-box {
    background: #16181c;
    border: 1px solid #2f3336;
    border-radius: 16px;
    padding: 40px;
    width: 360px;
    text-align: center;
}

.login-box h1 {
    font-size: 24px;
    background: linear-gradient(90deg, #1d9bf0, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.login-box p { color: #71767b; margin-bottom: 20px; }

.login-box input {
    width: 100%;
    padding: 14px;
    margin-bottom: 15px;
    background: #1d1f23;
    border: 1px solid #2f3336;
    border-radius: 8px;
    color: #e7e9ea;
    font-size: 15px;
}

.login-box input:focus { outline: none; border-color: #1d9bf0; }

.login-box button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(90deg, #1d9bf0, #8b5cf6);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.login-box button:hover { opacity: 0.9; }

.error-msg {
    background: #f4212e22;
    border: 1px solid #f4212e44;
    color: #f4212e;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
    display: none;
    font-size: 14px;
}

/* Dashboard */
.dashboard { display: block; }

header {
    background: #16181c;
    padding: 15px 25px;
    border-bottom: 1px solid #2f3336;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 20px;
    background: linear-gradient(90deg, #1d9bf0, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.header-right button {
    padding: 8px 16px;
    background: #2f3336;
    border: none;
    border-radius: 6px;
    color: #e7e9ea;
    cursor: pointer;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f4212e;
}

.dot.online { background: #00ba7c; animation: pulse 2s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

main { padding: 15px; max-width: 1600px; margin: 0 auto; }

/* 统计卡片 */
.stats-row {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.stat-card {
    background: #16181c;
    border: 1px solid #2f3336;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
}

.val { font-size: 24px; font-weight: 700; }
.lbl { font-size: 11px; color: #71767b; margin-top: 4px; }

.blue { color: #1d9bf0; }
.green { color: #00ba7c; }
.red { color: #f4212e; }
.purple { color: #8b5cf6; }
.orange { color: #f97316; }
.cyan { color: #06b6d4; }
.yellow { color: #eab308; }
.pink { color: #ec4899; }

/* 面板 */
.panels {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.panel {
    background: #16181c;
    border: 1px solid #2f3336;
    border-radius: 10px;
    padding: 15px;
}

.panel h3 { font-size: 13px; margin-bottom: 10px; color: #e7e9ea; }

.info-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 4px 0;
}

/* 卡片 */
.card {
    background: #16181c;
    border: 1px solid #2f3336;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

.card h3 { font-size: 14px; margin-bottom: 10px; }

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

.card-header input {
    padding: 8px 12px;
    background: #1d1f23;
    border: 1px solid #2f3336;
    border-radius: 6px;
    color: #e7e9ea;
    font-size: 12px;
    width: 150px;
}

/* 任务类型 */
.task-types {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: #71767b;
}

.task-type {
    background: #1d1f23;
    padding: 4px 10px;
    border-radius: 4px;
}

/* 失败区 */
.failed-section {
    background: #f4212e15;
    border-color: #f4212e33;
}

.failed-section h3 { color: #f4212e; }

.failed-item {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 4px 0;
    border-bottom: 1px solid #f4212e22;
}

.failed-item.clickable {
    cursor: pointer;
    padding: 6px 8px;
    margin: 2px -8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.failed-item.clickable:hover {
    background: #f4212e22;
}

.failed-item:last-child { border: none; }

/* 两栏 */
.two-col {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 15px;
}

/* 标签 */
.tabs { display: flex; gap: 5px; margin-bottom: 10px; }

.tab {
    padding: 6px 12px;
    background: #1d1f23;
    border: none;
    border-radius: 6px;
    color: #71767b;
    cursor: pointer;
    font-size: 11px;
}

.tab.active { background: #1d9bf0; color: white; }

/* 表格 */
.table-wrap { max-height: 400px; overflow-y: auto; }

table { width: 100%; border-collapse: collapse; font-size: 11px; }

th {
    text-align: left;
    padding: 8px;
    background: #1d1f23;
    color: #71767b;
    position: sticky;
    top: 0;
}

td { padding: 8px; border-bottom: 1px solid #2f3336; }

tr:hover { background: #1d1f23; }

.phone { color: #1d9bf0; font-family: monospace; }

.badge {
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 9px;
}

.badge.active { background: #00ba7c33; color: #00ba7c; }
.badge.idle { background: #71767b33; color: #71767b; }
.badge.error { background: #f4212e33; color: #f4212e; }
.badge.cooldown { background: #eab30833; color: #eab308; }

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 11px;
    color: #71767b;
}

.pagination button {
    padding: 6px 12px;
    background: #2f3336;
    border: none;
    border-radius: 4px;
    color: #e7e9ea;
    cursor: pointer;
    font-size: 11px;
}

.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }

/* 事件列表 */
.events-list { max-height: 500px; overflow-y: auto; }

.event {
    padding: 10px;
    border-bottom: 1px solid #2f3336;
    font-size: 11px;
}

.event-head {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.event-type { font-weight: 600; }
.event-time { color: #71767b; font-size: 10px; }
.event-acc { color: #1d9bf0; font-family: monospace; }
.event-detail { color: #71767b; font-size: 10px; margin-top: 3px; }

/* 连接状态 */
.conn-status {
    position: fixed;
    bottom: 15px;
    right: 15px;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 12px;
    background: #dc2626;
}

.conn-status.ok { background: #16a34a; }

/* 滚动条 */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: #1d1f23; }
::-webkit-scrollbar-thumb { background: #3f4347; border-radius: 3px; }

/* 响应式 */
@media (max-width: 1200px) {
    .stats-row { grid-template-columns: repeat(4, 1fr); }
    .panels { grid-template-columns: repeat(2, 1fr); }
    .two-col { grid-template-columns: 1fr; }
}

/* 账号详情弹窗 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: #16181c;
    border: 1px solid #2f3336;
    border-radius: 16px;
    width: 100%;
    max-width: 900px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #2f3336;
}

.modal-header h2 {
    font-size: 18px;
    background: linear-gradient(90deg, #1d9bf0, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-close {
    width: 36px;
    height: 36px;
    background: #2f3336;
    border: none;
    border-radius: 50%;
    color: #e7e9ea;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #3f4347;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* 详情摘要 */
.detail-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.summary-item {
    background: #1d1f23;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
}

.summary-item .val {
    font-size: 28px;
    font-weight: 700;
}

.summary-item .lbl {
    font-size: 12px;
    color: #71767b;
    margin-top: 5px;
}

/* 标签页 */
.detail-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    border-bottom: 1px solid #2f3336;
    padding-bottom: 15px;
}

.tab-btn {
    padding: 10px 20px;
    background: #1d1f23;
    border: 1px solid #2f3336;
    border-radius: 8px;
    color: #71767b;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: #2f3336;
    color: #e7e9ea;
}

.tab-btn.active {
    background: #1d9bf0;
    border-color: #1d9bf0;
    color: white;
}

/* 标签页内容 */
.tab-content {
    min-height: 300px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* 详情列表项 */
.detail-item {
    background: #1d1f23;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
}

.detail-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.detail-item-target {
    font-weight: 600;
    color: #1d9bf0;
}

.detail-item-time {
    font-size: 11px;
    color: #71767b;
}

.detail-item-content {
    font-size: 13px;
    color: #e7e9ea;
    line-height: 1.5;
    word-break: break-all;
    background: #0f1419;
    padding: 10px;
    border-radius: 6px;
    margin-top: 8px;
}

/* 动作列表 */
.action-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid #2f3336;
}

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

.action-type-badge {
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.action-type-badge.group { background: #8b5cf633; color: #8b5cf6; }
.action-type-badge.private { background: #1d9bf033; color: #1d9bf0; }
.action-type-badge.forward { background: #00ba7c33; color: #00ba7c; }
.action-type-badge.other { background: #71767b33; color: #71767b; }

.action-status {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
}

.action-status.completed { background: #00ba7c33; color: #00ba7c; }
.action-status.failed { background: #f4212e33; color: #f4212e; }
.action-status.pending { background: #eab30833; color: #eab308; }

.action-time {
    font-size: 10px;
    color: #71767b;
    margin-left: auto;
}

.action-result {
    flex: 1;
    font-size: 12px;
    color: #e7e9ea;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #71767b;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 15px;
}

/* ========== 账号档案样式 ========== */
.profile-section, .stability-section, .today-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #2f3336;
}

.profile-section h4, .stability-section h4, .today-section h4 {
    margin: 0 0 12px 0;
    color: #e7e9ea;
    font-size: 14px;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.profile-item {
    background: #16181c;
    padding: 8px 12px;
    border-radius: 8px;
}

.profile-label {
    display: block;
    font-size: 10px;
    color: #71767b;
    margin-bottom: 4px;
}

.profile-value {
    font-size: 12px;
    color: #e7e9ea;
    word-break: break-all;
}

.profile-value.green { color: #00ba7c; }
.profile-value.blue { color: #1d9bf0; }
.profile-value.orange { color: #eab308; }
.profile-value.red { color: #f4212e; }

/* 稳定性样式 */
.stability-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.stability-item {
    background: #16181c;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

.stability-val {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: #e7e9ea;
}

.stability-val.green { color: #00ba7c; }
.stability-val.red { color: #f4212e; }

.stability-lbl {
    display: block;
    font-size: 10px;
    color: #71767b;
    margin-top: 4px;
}

/* 今日统计网格 */
.summary-grid {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.summary-item .val.orange { color: #eab308; }

/* 历史记录样式 */
.history-date-section {
    margin-bottom: 15px;
}

.history-date {
    font-size: 12px;
    font-weight: 600;
    color: #71767b;
    padding: 8px 0;
    border-bottom: 1px solid #2f3336;
    margin-bottom: 8px;
}

.history-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #16181c;
    padding: 6px 12px;
    border-radius: 15px;
}

.history-group {
    font-size: 12px;
    color: #e7e9ea;
}

.history-count {
    font-size: 10px;
    color: #71767b;
    background: #2f3336;
    padding: 2px 6px;
    border-radius: 10px;
}

/* 可点击行 */
tr.clickable {
    cursor: pointer;
    transition: background 0.2s;
}

tr.clickable:hover {
    background: #1d9bf015 !important;
}

/* ==================== 锁监控样式 ==================== */

.lock-monitor-section,
.log-monitor-section {
    margin-top: 20px;
}

.lock-monitor-section .card-header,
.log-monitor-section .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.refresh-btn {
    background: #1d9bf0;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

.refresh-btn:hover {
    opacity: 0.8;
}

/* 锁统计 */
.lock-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.lock-stat {
    background: #1d1f23;
    padding: 12px 20px;
    border-radius: 8px;
    text-align: center;
    min-width: 80px;
}

.lock-stat .val {
    font-size: 24px;
    font-weight: 700;
    color: #71767b;
}

.lock-stat.active .val { color: #00ba7c; }
.lock-stat.expired .val { color: #f4212e; }
.lock-stat.file .val { color: #ffd700; }

.lock-stat .lbl {
    font-size: 11px;
    color: #71767b;
    margin-top: 4px;
}

/* 锁标签页 */
.lock-tabs,
.log-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    border-bottom: 1px solid #2f3336;
    padding-bottom: 10px;
}

.lock-tab,
.log-tab {
    background: transparent;
    border: 1px solid #2f3336;
    color: #71767b;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.lock-tab:hover,
.log-tab:hover {
    border-color: #1d9bf0;
    color: #1d9bf0;
}

.lock-tab.active,
.log-tab.active {
    background: #1d9bf0;
    border-color: #1d9bf0;
    color: white;
}

/* 锁内容面板 */
.lock-content,
.log-content {
    max-height: 400px;
    overflow-y: auto;
}

.lock-pane,
.log-pane {
    display: none;
}

.lock-pane.active,
.log-pane.active {
    display: block;
}

/* 锁列表项 */
.lock-list,
.log-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lock-item,
.runtime-item {
    background: #1d1f23;
    border: 1px solid #2f3336;
    border-radius: 8px;
    padding: 12px 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lock-item.active {
    border-left: 3px solid #00ba7c;
}

.lock-item.expired {
    border-left: 3px solid #f4212e;
    opacity: 0.7;
}

.lock-item.idle {
    border-left: 3px solid #71767b;
}

.lock-main,
.runtime-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lock-icon,
.runtime-icon {
    font-size: 16px;
}

.lock-account,
.runtime-account {
    font-weight: 600;
    color: #e7e9ea;
    font-family: monospace;
}

.lock-purpose,
.lock-status,
.runtime-status {
    background: #2f3336;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    color: #71767b;
}

.lock-details,
.runtime-details {
    display: flex;
    gap: 15px;
    font-size: 11px;
    color: #71767b;
}

/* 运行时状态样式 */
.runtime-item.busy { border-left: 3px solid #f97316; }
.runtime-item.idle { border-left: 3px solid #71767b; }
.runtime-item.offline { border-left: 3px solid #374151; }
.runtime-item.draining { border-left: 3px solid #06b6d4; }
.runtime-item.faulted { border-left: 3px solid #f4212e; }

.runtime-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    padding: 10px;
    background: #16181c;
    border-radius: 8px;
}

.runtime-stats .stat {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    background: #2f3336;
}

.runtime-stats .stat.busy { color: #f97316; }
.runtime-stats .stat.idle { color: #71767b; }
.runtime-stats .stat.offline { color: #6b7280; }
.runtime-stats .stat.draining { color: #06b6d4; }

/* ==================== 日志样式 ==================== */

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

.log-controls select {
    background: #1d1f23;
    border: 1px solid #2f3336;
    color: #e7e9ea;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
}

.log-item {
    background: #1d1f23;
    border-radius: 4px;
    padding: 8px 12px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 11px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    border-left: 3px solid #2f3336;
}

.log-item.error { border-left-color: #f4212e; background: #f4212e11; }
.log-item.warn,
.log-item.warning { border-left-color: #ffd700; background: #ffd70011; }
.log-item.info { border-left-color: #1d9bf0; }
.log-item.debug { border-left-color: #8b5cf6; }

.log-time {
    color: #71767b;
    min-width: 140px;
}

.log-level {
    min-width: 80px;
}

.log-shard {
    color: #8b5cf6;
    min-width: 50px;
}

.log-module {
    color: #06b6d4;
    min-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-msg {
    flex: 1;
    color: #e7e9ea;
    word-break: break-all;
}

.log-item.guard .highlight {
    color: #ffd700;
    font-weight: 600;
}

.log-item.guard .success {
    color: #00ba7c;
}

.log-item.guard .fail {
    color: #f4212e;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #71767b;
}

.empty-state .icon {
    font-size: 40px;
    margin-bottom: 10px;
}
