:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #ef4444;
    --success: #10b981;
    --bg-snow: #ffffff;
    --bg-light: #f8fafc;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    
    --shadow-soft: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lux: 0 10px 15px -3px rgb(0 0 0 / 0.03), 0 4px 6px -4px rgb(0 0 0 / 0.03);
    --radius-lg: 12px;
    --radius-md: 8px;
    
    --sidebar-w: 320px;
    --header-h: 90px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-snow);
    color: var(--text-dark);
    height: 100vh;
    overflow: hidden;
}

/* 布局结构 */
.app-layout {
    display: flex;
    height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-w);
    background-color: var(--bg-light);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    height: var(--header-h);
    display: flex;
    align-items: center;
    padding: 0 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 700;
}

.logo i {
    font-size: 2rem;
    color: var(--primary);
}

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

.nav-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.account-actions {
    margin-bottom: 24px;
}

.premium-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary);
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.premium-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.acc-list {
    list-style: none;
}

.acc-item {
    position: relative;
    padding: 12px 14px;
    margin-bottom: 8px;
    border-radius: var(--radius-lg);
    background: white;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.acc-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: var(--primary);
    transition: width 0.3s ease;
}

.acc-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px rgba(37, 99, 235, 0.1);
}

.acc-item.active {
    background: #f0f7ff;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.acc-item.active::before {
    width: 4px;
}

.acc-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    background: #f1f5f9;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.25rem;
    transition: all 0.3s ease;
}

.acc-status {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: var(--success);
    border: 2px solid white;
    border-radius: 50%;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.acc-item.active .acc-avatar {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

.acc-info {
    flex: 1;
    min-width: 0;
}

.acc-remark {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 2px;
    letter-spacing: -0.01em;
}

.acc-email {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 6px;
    font-family: 'Inter', ui-monospace, monospace;
    word-break: break-all;
    line-height: 1.3;
}

.acc-item.active .acc-email {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.acc-creds {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.cred-tag {
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 4px;
    background: #f8fafc;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: ui-monospace, monospace;
    max-width: 100%;
    word-break: break-all;
}

.cred-tag.pwd {
    color: var(--primary);
    background: #eff6ff;
    border-color: rgba(37, 99, 235, 0.1);
}

.acc-actions {
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0;
    transition: all 0.2s;
    margin-left: 12px;
}

.acc-item:hover .acc-actions {
    opacity: 1;
}

.action-icon-btn {
    padding: 4px;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.action-icon-btn:hover {
    background: #e2e8f0;
    color: var(--primary);
}

.action-icon-btn.danger:hover {
    background: #fee2e2;
    color: var(--danger);
}

.sidebar-footer {
    padding: 24px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    border-top: 1px solid var(--border);
}

/* 主展示区 */
.main-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.stage-header {
    height: var(--header-h);
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.welcome-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.stage-actions {
    display: flex;
    gap: 12px;
}

.action-btn {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: white;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.sync-btn {
    background: var(--primary);
    color: white;
    border: none;
}

.danger-btn {
    color: var(--danger);
}

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

/* 内容视口 */
.content-viewport {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    background: #fcfdfe;
}

.state-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.illustration {
    font-size: 5rem;
    color: #cbd5e1;
    margin-bottom: 24px;
}

.state-container h2 {
    font-size: 1.25rem;
    margin-bottom: 12px;
}

.state-container p {
    color: var(--text-muted);
}

/* 邮件面板 */
.panels-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.folder-panel {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lux);
    display: flex;
    flex-direction: column;
    min-height: 400px;
}

.panel-head {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-head i {
    font-size: 1.25rem;
    color: var(--primary);
}

.panel-head h3 {
    flex: 1;
    font-size: 1rem;
}

.count-badge {
    background: #f1f5f9;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}

.count-badge.danger {
    background: #fef2f2;
    color: var(--danger);
}

/* 邮件卡片 */
.email-stack {
    padding: 12px;
}

.email-card {
    padding: 16px;
    margin-bottom: 12px;
    border-radius: var(--radius-md);
    background: #f8fafc;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.email-card:hover {
    background: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-soft);
    transform: translateX(4px);
}

.email-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.email-sender {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.email-desc {
    font-size: 0.85rem;
    line-height: 1.4;
    color: #475569;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 动画 */
.sync-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f1f5f9;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 24px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ri-spin {
    display: inline-block;
    animation: spin 1s linear infinite;
}

/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s ease;
}

.premium-modal {
    background: white;
    width: 600px;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

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

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 24px;
}

.hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

textarea {
    width: 100%;
    height: 120px;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    font-family: inherit;
    resize: none;
    outline: none;
}

textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.modal-footer {
    padding: 24px;
    background: #f8fafc;
    text-align: right;
}

.primary-btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary);
    color: white;
    font-weight: 600;
    cursor: pointer;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: var(--text-dark);
    color: white;
    border-radius: 30px;
    font-size: 0.9rem;
    box-shadow: var(--shadow-lux);
    z-index: 2000;
}

.hidden { display: none !important; }

/* 实用工具 */
.text-muted { color: var(--text-muted); }
.error-msg {
    margin: 12px;
    padding: 12px;
    background: #fef2f2;
    color: var(--danger);
    font-size: 0.85rem;
    border-radius: var(--radius-md);
}
/* 详情抽屉 */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.2);
    backdrop-filter: blur(2px);
    z-index: 1100;
    display: flex;
    justify-content: flex-end;
}

.drawer-content {
    width: 700px;
    height: 100vh;
    background: white;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.drawer-header {
    height: 70px;
    padding: 0 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-snow);
}

.icon-btn {
    background: none;
    border: none;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: #eff6ff;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
}

.detail-subject {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 24px;
    color: var(--text-dark);
}

.detail-meta {
    margin-bottom: 24px;
}

.detail-sender {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 32px 0;
}

.detail-body-content {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #334155;
    word-break: break-all;
}

.detail-body-content img {
    max-width: 100%;
}

.detail-body-content a {
    color: var(--primary);
}

/* 写信按钮幽灵样式 */
.premium-btn.ghost {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.premium-btn.ghost:hover {
    background: rgba(37, 99, 235, 0.05);
}

/* 表单组样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.readonly-input {
    background: #f1f5f9;
    cursor: default;
    color: var(--text-muted);
}

/* 详情页内删除按钮 */
.icon-btn.danger {
    color: var(--danger);
}

.icon-btn.danger:hover {
    background: #fef2f2;
}
