:root {
    --primary: #2563eb;
    --primary-2: #7c3aed;
    --success: #22c55e;
    --danger: #ef4444;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --bg: #f8fafc;
    --card: #ffffff;
    --shadow: 0 24px 70px rgba(15, 23, 42, .10);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    font-family: Inter, Arial, "Microsoft YaHei", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(37,99,235,.18), transparent 32%),
        radial-gradient(circle at top right, rgba(124,58,237,.16), transparent 30%),
        linear-gradient(180deg, #f8fbff, #f8fafc 42%, #eef2ff);
}
button, input, select { font: inherit; }
.app { width: min(1120px, 100%); margin: 0 auto; padding: 22px; }
.hero {
    position: relative;
    overflow: hidden;
    border-radius: 34px;
    padding: 34px;
    margin-bottom: 20px;
    color: #fff;
    background: linear-gradient(135deg, #1d4ed8, #6d28d9 58%, #9333ea);
    box-shadow: 0 30px 80px rgba(37, 99, 235, .28);
}
.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,.16);
    border: 1px solid rgba(255,255,.24);
    font-size: 13px;
    backdrop-filter: blur(14px);
}
.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: blink 1s infinite;
}
@keyframes blink { 50% { opacity: .32; } }
.hero h1 { margin: 18px 0 10px; font-size: 38px; letter-spacing: -.04em; }
.hero p { max-width: 680px; color: rgba(255,255,.86); line-height: 1.7; }
.grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
.panel {
    border: 1px solid rgba(226,232,.9);
    background: rgba(255,255,.82);
    backdrop-filter: blur(18px);
    border-radius: 28px;
    box-shadow: var(--shadow);
}
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 0;
}
.panel-title { font-size: 18px; font-weight: 800; }
.auto-status { display: flex; align-items: center; color: var(--muted); font-size: 13px; }
.panel-body { padding: 18px 20px 20px; }
.current-mail {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: #f8fafc;
}
.current-mail input {
    flex: 1;
    height: 48px;
    border: 0;
    outline: 0;
    background: transparent;
    font-weight: 700;
}
.form-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin-top: 14px; }
.input-group { position: relative; }
.input-group input {
    width: 100%;
    height: 56px;
    border: 0;
    border-radius: 18px;
    background: #f8fafc;
    box-shadow: inset 0 0 0 1px var(--border);
    padding: 0 18px 0 50px;
    transition: .22s;
}
.input-group input:focus {
    box-shadow: inset 0 0 0 2px var(--primary), 0 0 0 5px rgba(37,99,.12);
}
.input-icon {
    position: absolute;
    left: 18px; top: 50%; transform: translateY(-50%);
    color: #94a3b8; pointer-events: none;
}
.btn {
    height: 48px;
    border: none; border-radius: 16px;
    font-weight: 800; cursor: pointer; transition: .22s;
}
.btn-primary {
    height: 56px; padding: 0 24px;
    color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2));
}
.btn-secondary { color: var(--primary); background: #eef2ff; }
.btn-ghost { background: #fff; border: 1px solid var(--border); }
.btn-danger { color: #fff; background: var(--danger); }
.stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-top: 16px; }
.stat { padding: 14px; border-radius: 20px; background: linear-gradient(#fff,#f8fafc); border: 1px solid var(--border); }
.stat b { font-size: 22px; }
.stat span { color: var(--muted); font-size: 13px; }
.mail-list { display: flex; flex-direction: column; gap: 12px; max-height: 580px; overflow: auto; }
.mail-item {
    padding: 16px; border-radius: 22px; border: 1px solid var(--border); background: #fff; cursor: pointer;
}
.mail-item.unread { background: #eff6ff; border-left: 5px solid var(--primary); }
.mail-title { font-weight: 850; margin-bottom: 6px; }
.mail-meta { font-size: 13px; color: var(--muted); }
.empty { text-align: center; padding: 50px; color: var(--muted); border: 1px dashed #cbd5e1; border-radius: 22px; background: #f8fafc; }
.modal {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center; padding: 24px;
    background: rgba(0,0,.55); opacity: 0; visibility: hidden; transition: .22s;
}
.modal.show { opacity: 1; visibility: visible; }
.modal-card {
    width: min(860px, 100%); max-height: 85vh;
    background: #fff; border-radius: 28px; overflow: hidden;
    transform: translateY(12px) scale(.98); transition: .22s;
}
.modal.show .modal-card { transform: translateY(0) scale(1); }
.modal-header { height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--border); }
.icon-btn { width: 42px; height: 42px; border-radius: 14px; border: 1px solid var(--border); background: #f8fafc; }
.modal-body { padding: 22px; overflow-y: auto; }
.detail-meta { padding: 14px; border-radius: 18px; background: #f8fafc; margin-bottom: 16px; }
.mail-content { padding: 16px; border-radius: 18px; border: 1px solid var(--border); white-space: pre-wrap; }
.email-body-html {
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom:16px;
}
.email-body-html iframe {
    width: 100%;
    min-height: 300px;
    border: none;
    background: #fff;
}
.attachments { margin-top:16px; }
.attach-item { display:flex; justify-content:space-between; align-items:center; padding:12px; border-radius:14px; background:#eff6ff; margin-top:8px; }
.footer-actions { display:flex; gap:12px; padding:16px; border-top:1px solid var(--border); }
.footer-actions .btn { flex:1; }
.toast {
    position:fixed; left:50%; bottom:26px; transform:translateX(-50%);
    background:#111; color:#fff; padding:12px 20px; border-radius:999px;
    opacity:0; visibility:hidden; transition:.22s; z-index:10000;
}
.toast.show { opacity:1; visibility:visible; }
.popup-mask {
    position:fixed; inset:0; background:rgba(0,0,0.65); z-index:10000;
    display:flex; align-items:center; justify-content:center; padding:16px;
}
.popup-box { background:#fff; width:min(520px,100%); border-radius:24px; padding:30px; }
.popup-title { font-size:22px; font-weight:bold; text-align:center; margin-bottom:24px; color:#1d4ed8; }
.popup-item { margin-bottom:14px; font-size:15px; line-height:1.7; }
.popup-item strong { color:#111; min-width:90px; display:inline-block; }
.popup-link { color:#2563eb; word-break:break-all; }
.popup-btn-wrap { margin-top:30px; text-align:center; }
.popup-close { width:100%; padding:14px; border-radius:14px; border:none; background:linear-gradient(135deg,#2563eb,#7c3aed); color:#fff; font-size:16px; font-weight:bold; cursor:pointer; }
@media(max-width:768px){
    .form-row { grid-template-columns:1fr; }
    .current-mail { flex-direction:column; }
    .stats { grid-template-columns:1fr 1fr 1fr; }
    .modal { padding:0; }
    .modal-card { border-radius:0; height:100%; }
    .popup-box { padding:22px; }
}
