:root {
    --bg-body: #09090b;       /* 极深背景 */
    --bg-panel: #18181b;      /* 面板背景 */
    --bg-hover: #27272a;      /* 悬停背景 */
    --border: #27272a;        /* 边框颜色 */
    
    --primary: #2563eb;       /* 主色调蓝 */
    --primary-hover: #1d4ed8;
    
    --success: #10b981;       /* 成功绿 */
    --fail: #ef4444;          /* 失败红 */
    --text-main: #e4e4e7;     /* 主文本 */
    --text-sub: #a1a1aa;      /* 副文本 */
    
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

/* 布局 */
.main-container {
    display: flex;
    height: 100%;
    width: 100%;
}

.col {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    height: 100%;
}

.col-ctrl { width: 280px; background: #0c0c0e; padding: 20px; z-index: 10; box-shadow: 2px 0 10px rgba(0,0,0,0.2); }
.col-acc { width: 260px; background: var(--bg-panel); }
.col-list { width: 400px; background: var(--bg-panel); }
.col-view { flex: 1; background: var(--bg-body); position: relative; }

/* 头部 */
.col-header {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sub);
    background: rgba(24, 24, 27, 0.8);
    backdrop-filter: blur(10px);
}

.counter {
    background: var(--fail);
    color: white;
    padding: 1px 8px;
    border-radius: 12px;
    font-size: 11px;
}

/* 滚动区域 */
.scroll-area {
    flex: 1;
    overflow-y: auto;
}
.scroll-area::-webkit-scrollbar { width: 6px; }
.scroll-area::-webkit-scrollbar-thumb { background: #3f3f46; border-radius: 3px; }

/* 左侧控制栏组件 */
.brand {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.badge-pro {
    font-size: 9px;
    background: linear-gradient(45deg, var(--primary), #8b5cf6);
    padding: 2px 6px;
    border-radius: 4px;
}

.input-wrapper textarea {
    width: 100%;
    height: 140px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    resize: none;
    outline: none;
    transition: 0.2s;
    margin-bottom: 16px;
}
.input-wrapper textarea:focus { border-color: var(--primary); }

.btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn.stop { background: var(--fail); }

.status-bar {
    font-size: 12px;
    color: var(--text-sub);
    margin: 15px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.status-bar .ok { color: var(--success); }
.status-bar .err { color: var(--fail); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* 统计面板 */
.stats-panel {
    margin-top: auto;
    background: var(--bg-hover);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
}
.stat-item .val { font-family: var(--font-mono); font-weight: bold; }
.val.success { color: var(--success); }
.val.fail { color: var(--fail); }

.progress-track {
    height: 4px;
    background: #3f3f46;
    border-radius: 2px;
    overflow: hidden;
    margin: 12px 0 8px 0;
}
.progress-bar {
    height: 100%;
    background: var(--success);
    width: 0%;
    transition: width 0.3s ease;
}
.status-text {
    text-align: center;
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
}

/* 账号列表 */
.acc-item {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}
.acc-email {
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}
.acc-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-hover);
    color: var(--text-sub);
    min-width: 60px;
    text-align: center;
}
.acc-badge.loading { color: var(--primary); border: 1px solid var(--primary); }
.acc-badge.success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.acc-badge.fail { background: rgba(239, 68, 68, 0.1); color: var(--fail); }

/* 邮件卡片 */
.list-divider {
    font-size: 10px;
    color: var(--text-sub);
    text-transform: uppercase;
    padding: 10px 16px 5px;
    letter-spacing: 1px;
}

.mail-card {
    margin: 8px 16px;
    padding: 12px;
    background: #202024;
    border: 1px solid #303036;
    border-radius: 6px;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}
.mail-card:hover {
    background: #2a2a30;
    transform: translateY(-1px);
}
.mail-card.new {
    border-left-color: var(--fail);
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.05) 0%, #202024 100%);
}
.mail-card.selected {
    border-color: var(--primary);
    border-left-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}
.mail-card.read {
    opacity: 0.6;
    border-left-color: var(--text-sub);
}

.mail-head { display: flex; justify-content: space-between; margin-bottom: 6px; }
.mail-title { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 250px; }
.mail-time { 
    font-family: var(--font-mono); 
    font-size: 10px;               /* 字体稍微调小以容纳长日期 */
    color: var(--text-sub); 
    background: #303036; 
    padding: 2px 6px;              /* 增加一点左右内边距 */
    border-radius: 4px; 
    white-space: nowrap;           /* 防止换行 */
    letter-spacing: -0.5px;        /*稍微紧凑一点 */
    margin-left: 8px;              /* 与标题拉开距离 */
}
.mail-sub { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-sub); }
.acc-tag { color: var(--primary); }

.copy-btn {
    margin-top: 10px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px dashed var(--success);
    width: 100%;
    padding: 6px;
    border-radius: 4px;
    font-size: 12px;
    font-family: var(--font-mono);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: 0.2s;
}
.copy-btn:hover { background: var(--success); color: white; border-style: solid; }

/* 详情页 */
.empty-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-sub);
}
.empty-placeholder i { font-size: 48px; opacity: 0.3; }

.mail-detail { height: 100%; display: flex; flex-direction: column; }
.detail-header { padding: 24px; border-bottom: 1px solid var(--border); }
.detail-header h2 { font-size: 20px; margin-bottom: 16px; }
.meta-row { display: flex; gap: 20px; font-size: 13px; color: var(--text-sub); margin-bottom: 8px; }
.meta-item { display: flex; align-items: center; gap: 6px; }
.highlight-acc { color: var(--text-main); font-weight: bold; font-family: var(--font-mono); }

.detail-body { padding: 30px; overflow-y: auto; line-height: 1.6; font-size: 14px; background: white; color: black; flex: 1; }

/* Toast */
#toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--success);
    color: white;
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 600;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: 0.3s;
    pointer-events: none;
    z-index: 100;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }