/* ============================================================
   云邮局 PostOffice — 全站样式
   ============================================================ */
:root{
    --brand:#4f46e5;--brand-2:#7c3aed;--brand-3:#6366f1;--brand-soft:#eef2ff;--brand-ink:#4338ca;
    --bg:#f3f6fb;--bg-2:#e9eef7;--surface:#fff;--surface-2:#f7f9fd;--surface-3:#eef3fa;
    --text:#0f172a;--text-2:#475569;--muted:#8b97ab;--border:#e3e8f1;--border-2:#edf1f7;
    --ok:#059669;--ok-soft:#ecfdf5;--warn:#d97706;--warn-soft:#fffbeb;--bad:#dc2626;--bad-soft:#fef2f2;
    --info:#2563eb;--info-soft:#eff6ff;
    --shadow-sm:0 1px 2px rgba(15,23,42,.04);
    --shadow:0 12px 32px -18px rgba(15,23,42,.22),0 2px 6px rgba(15,23,42,.04);
    --shadow-lg:0 28px 70px -20px rgba(15,23,42,.32);
    --r-xs:8px;--r-sm:10px;--r:12px;--r-lg:16px;--r-xl:22px;
    --sidebar-w:256px;--topbar-h:62px;
    --font:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
}
html[data-theme="dark"]{
    --brand:#818cf8;--brand-2:#a78bfa;--brand-3:#818cf8;--brand-soft:#1c2450;--brand-ink:#c7d2fe;
    --bg:#070c17;--bg-2:#0b1221;--surface:#0f172a;--surface-2:#141f36;--surface-3:#1a2742;
    --text:#e9eefb;--text-2:#aab8d2;--muted:#8292ad;--border:#22304a;--border-2:#1b2740;
    --ok:#34d399;--ok-soft:#062c22;--warn:#fbbf24;--warn-soft:#2d2106;--bad:#f87171;--bad-soft:#3a0f12;
    --info:#60a5fa;--info-soft:#0b2242;
    --shadow-sm:0 1px 2px rgba(0,0,0,.35);
    --shadow:0 14px 36px -18px rgba(0,0,0,.7),0 2px 8px rgba(0,0,0,.25);
    --shadow-lg:0 34px 80px -20px rgba(0,0,0,.8);
}
*{box-sizing:border-box}
html{color-scheme:light}
html[data-theme="dark"]{color-scheme:dark}
html,body{height:100%}
#app{height:100%}
body{margin:0;font-family:var(--font);background:var(--bg);color:var(--text);font-size:14px;line-height:1.6;-webkit-font-smoothing:antialiased;overflow:hidden}
a{color:var(--brand);text-decoration:none}
a:hover{text-decoration:underline}
h1,h2,h3,h4,p{margin:0}
button,input,select,textarea{font-family:inherit;font-size:inherit;color:inherit}
button{cursor:pointer}
::selection{background:rgba(99,102,241,.22)}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,[contenteditable]:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-thumb{background:rgba(100,116,139,.28);border-radius:20px;border:3px solid transparent;background-clip:content-box}
::-webkit-scrollbar-thumb:hover{background:rgba(100,116,139,.45);background-clip:content-box;border:3px solid transparent}
::-webkit-scrollbar-track{background:transparent}

/* ---------- 启动 ---------- */
.boot-splash{position:fixed;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;background:var(--bg)}
.boot-logo{width:64px;height:64px;border-radius:20px;background:linear-gradient(135deg,var(--brand),var(--brand-2));display:flex;align-items:center;justify-content:center;box-shadow:0 18px 40px rgba(79,70,229,.35)}
.boot-logo svg{width:34px;height:34px;fill:#fff}
.boot-name{font-size:17px;font-weight:700;letter-spacing:.5px}
.boot-spinner{width:22px;height:22px;border-radius:50%;border:2.5px solid rgba(99,102,241,.2);border-top-color:var(--brand);animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* ---------- 基础组件 ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;height:38px;padding:0 16px;border-radius:var(--r-sm);border:1px solid transparent;background:var(--surface-2);color:var(--text-2);font-weight:600;font-size:13.5px;white-space:nowrap;transition:all .16s ease;user-select:none}
.btn:hover{background:var(--surface-3);color:var(--text)}
.btn:active{transform:translateY(1px)}
.btn:disabled{opacity:.55;cursor:not-allowed;transform:none}
.btn svg{width:17px;height:17px;flex:none}
.btn.primary{background:linear-gradient(135deg,var(--brand),var(--brand-2));color:#fff;border-color:transparent;box-shadow:0 8px 18px rgba(79,70,229,.25)}
.btn.primary:hover{filter:brightness(1.06);box-shadow:0 10px 24px rgba(79,70,229,.34)}
.btn.soft{background:var(--brand-soft);color:var(--brand-ink)}
.btn.soft:hover{filter:brightness(.97)}
.btn.ghost{background:transparent;border-color:var(--border);color:var(--text-2)}
.btn.ghost:hover{background:var(--surface-2);color:var(--text)}
.btn.danger{background:var(--bad-soft);color:var(--bad)}
.btn.danger:hover{background:var(--bad);color:#fff}
.btn.sm{height:32px;padding:0 12px;font-size:12.5px;border-radius:9px}
.btn.sm svg{width:15px;height:15px}
.btn.lg{height:46px;padding:0 24px;font-size:15px;border-radius:12px}
.btn.icon{width:38px;padding:0;background:transparent;color:var(--text-2)}
.btn.icon:hover{background:var(--surface-2);color:var(--text)}
.btn.icon.sm{width:32px;height:32px}
.btn.block{width:100%}

.field{display:flex;flex-direction:column;gap:6px;margin-bottom:14px}
.field>label,.field-label{font-size:12.5px;font-weight:600;color:var(--text-2)}
.field .hint{font-size:11.5px;color:var(--muted)}
.input,.select,.textarea{width:100%;height:40px;border:1px solid var(--border);border-radius:var(--r-sm);background:var(--surface);padding:0 12px;color:var(--text);transition:border .16s,box-shadow .16s;font-size:13.5px}
.textarea{height:auto;min-height:110px;padding:10px 12px;resize:vertical;line-height:1.7}
.input:hover,.select:hover,.textarea:hover{border-color:var(--border-2)}
.input:focus,.select:focus,.textarea:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3.5px rgba(99,102,241,.13)}
.input::placeholder,.textarea::placeholder{color:var(--muted)}
.select{appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center;padding-right:32px}
.input.sm,.select.sm{height:34px;font-size:12.5px;border-radius:8px}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 16px}
.form-grid .span2{grid-column:span 2}
.checkbox{display:inline-flex;align-items:center;gap:8px;font-size:13px;color:var(--text-2);cursor:pointer;user-select:none}
.checkbox input{width:16px;height:16px;accent-color:var(--brand)}
.switch{position:relative;display:inline-block;width:42px;height:24px;flex:none}
.switch input{opacity:0;width:0;height:0}
.switch span{position:absolute;inset:0;background:var(--border);border-radius:100px;transition:.2s;cursor:pointer}
.switch span::after{content:"";position:absolute;left:3px;top:3px;width:18px;height:18px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.2);transition:.2s}
.switch input:checked+span{background:var(--brand)}
.switch input:checked+span::after{transform:translateX(18px)}
.switch-row{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:12px 0;border-bottom:1px dashed var(--border-2)}
.switch-row:last-child{border-bottom:0}
.switch-row .t{font-size:13.5px;font-weight:600}
.switch-row .d{font-size:12px;color:var(--muted);margin-top:2px}

.pill{display:inline-flex;align-items:center;gap:5px;height:22px;padding:0 9px;border-radius:999px;font-size:11.5px;font-weight:700;background:var(--surface-3);color:var(--text-2);white-space:nowrap}
.pill.ok{background:var(--ok-soft);color:var(--ok)}
.pill.warn{background:var(--warn-soft);color:var(--warn)}
.pill.bad{background:var(--bad-soft);color:var(--bad)}
.pill.info{background:var(--info-soft);color:var(--info)}
.pill.brand{background:var(--brand-soft);color:var(--brand-ink)}
.dot{width:7px;height:7px;border-radius:50%;background:currentColor;display:inline-block}

.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--r-lg);box-shadow:var(--shadow-sm)}
.panel{padding:20px}
.panel-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}
.panel-head h3{font-size:15px;font-weight:700;letter-spacing:-.2px}
.panel-head .sub{font-size:12px;color:var(--muted)}
.divider{height:1px;background:var(--border-2);margin:18px 0}

.empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:54px 20px;color:var(--muted);text-align:center}
.empty .ico{width:64px;height:64px;border-radius:20px;background:var(--surface-2);display:flex;align-items:center;justify-content:center}
.empty .ico svg{width:30px;height:30px;color:var(--muted)}
.empty .t{font-size:14px;font-weight:700;color:var(--text-2)}
.empty .d{font-size:12.5px;max-width:320px}

.skeleton{background:linear-gradient(90deg,var(--surface-2) 25%,var(--surface-3) 37%,var(--surface-2) 63%);background-size:400% 100%;animation:shimmer 1.3s ease infinite;border-radius:8px}
@keyframes shimmer{0%{background-position:100% 0}100%{background-position:0 0}}
.loading-line{height:12px;border-radius:6px;margin:9px 0}

.avatar{width:34px;height:34px;border-radius:11px;background:linear-gradient(135deg,var(--brand-soft),var(--surface-2));color:var(--brand-ink);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:13px;flex:none;text-transform:uppercase;overflow:hidden}
.avatar.sm{width:26px;height:26px;border-radius:8px;font-size:11px}
.avatar.lg{width:46px;height:46px;border-radius:14px;font-size:16px}
.avatar img{width:100%;height:100%;object-fit:cover}
.avatar.c1{background:#eef2ff;color:#4338ca}
.avatar.c2{background:#ecfdf5;color:#047857}
.avatar.c3{background:#fef3c7;color:#b45309}
.avatar.c4{background:#fce7f3;color:#be185d}
.avatar.c5{background:#e0f2fe;color:#0369a1}
.avatar.c6{background:#f3e8ff;color:#7e22ce}

/* ---------- 登录 ---------- */
.login-wrap{position:fixed;inset:0;display:flex;background:var(--bg);overflow:auto}
.login-brand{flex:0 0 46%;position:relative;background:linear-gradient(150deg,#4338ca 0%,#4f46e5 42%,#7c3aed 100%);color:#fff;display:flex;flex-direction:column;justify-content:space-between;padding:46px 52px;overflow:hidden}
.login-brand::before{content:"";position:absolute;width:520px;height:520px;border-radius:50%;background:radial-gradient(circle,rgba(255,255,255,.16),transparent 65%);top:-180px;right:-160px}
.login-brand::after{content:"";position:absolute;width:380px;height:380px;border-radius:50%;background:radial-gradient(circle,rgba(255,255,255,.1),transparent 65%);bottom:-160px;left:-100px}
.login-brand .brand-row{position:relative;display:flex;align-items:center;gap:12px;z-index:1}
.login-brand .brand-logo{width:46px;height:46px;border-radius:14px;background:rgba(255,255,255,.16);backdrop-filter:blur(8px);display:flex;align-items:center;justify-content:center;border:1px solid rgba(255,255,255,.22)}
.login-brand .brand-logo svg{width:26px;height:26px;fill:#fff}
.login-brand .brand-name{font-size:19px;font-weight:800;letter-spacing:.4px}
.login-brand .hero-copy{position:relative;z-index:1;max-width:430px}
.login-brand .hero-copy h1{font-size:34px;line-height:1.28;font-weight:800;letter-spacing:-.5px;margin-bottom:16px}
.login-brand .hero-copy p{font-size:14.5px;line-height:1.9;color:rgba(255,255,255,.82)}
.login-brand .feature-list{position:relative;z-index:1;display:flex;flex-direction:column;gap:14px;margin-top:26px}
.login-brand .feature{display:flex;align-items:flex-start;gap:12px;font-size:13.5px;color:rgba(255,255,255,.9)}
.login-brand .feature .fi{width:32px;height:32px;border-radius:10px;background:rgba(255,255,255,.14);display:flex;align-items:center;justify-content:center;flex:none;border:1px solid rgba(255,255,255,.16)}
.login-brand .feature .fi svg{width:17px;height:17px;stroke:#fff;fill:none;stroke-width:2}
.login-brand .brand-foot{position:relative;z-index:1;font-size:12px;color:rgba(255,255,255,.6)}
.login-panel{flex:1;display:flex;align-items:center;justify-content:center;padding:40px 24px}
.login-card{width:100%;max-width:390px}
.login-mobile-brand{display:none;align-items:center;gap:10px;margin-bottom:22px;font-size:17px;font-weight:800}
.login-mobile-brand svg{width:38px;height:38px;padding:9px;border-radius:12px;background:linear-gradient(135deg,var(--brand),var(--brand-2));box-shadow:0 8px 18px rgba(79,70,229,.25)}
.login-card .welcome{font-size:25px;font-weight:800;letter-spacing:-.4px}
.login-card .welcome-sub{color:var(--muted);font-size:13.5px;margin-top:6px;margin-bottom:28px}
.login-card .field{margin-bottom:16px}
.login-card .input{height:46px;border-radius:12px;background:var(--surface)}
.login-actions{display:flex;align-items:center;justify-content:space-between;margin:4px 0 20px}
.login-card .btn.lg{height:48px;border-radius:12px;font-size:15px}
.field-error{display:none;align-items:flex-start;gap:5px;margin-top:1px;font-size:11.5px;line-height:1.55;color:var(--bad)}
.field-error.show{display:flex}
.field-error svg{width:14px;height:14px;flex:none;margin-top:1px}
.login-card .input.is-invalid,.login-card .input.is-invalid:focus{border-color:var(--bad);box-shadow:0 0 0 3px var(--bad-soft)}
#login-submit:disabled{background:var(--surface-3);color:var(--muted);border:1px solid var(--border);box-shadow:none;opacity:1;filter:none;cursor:not-allowed}
#login-submit:disabled:hover{background:var(--surface-3);filter:none}
#login-submit.is-loading:disabled{background:linear-gradient(135deg,var(--brand),var(--brand-2));color:#fff;border-color:transparent;box-shadow:0 8px 20px -10px rgba(79,70,229,.65);cursor:wait}
html[data-theme="dark"] #login-submit.is-loading:disabled{background:linear-gradient(135deg,#4f46e5,#6d28d9)}
.login-error{background:var(--bad-soft);color:var(--bad);border:1px solid rgba(220,38,38,.2);border-radius:10px;padding:10px 13px;font-size:12.5px;margin-bottom:16px;display:flex;gap:8px;align-items:flex-start}
.login-notice{background:var(--brand-soft);color:var(--brand-ink);border-radius:10px;padding:10px 13px;font-size:12.5px;margin-bottom:18px;line-height:1.6}
.login-error svg{width:17px;height:17px;flex:none;margin-top:1px}
.login-error>div{flex:1;min-width:0;line-height:1.65}
.login-foot{margin-top:24px;padding-top:18px;border-top:1px solid var(--border-2);color:var(--muted);font-size:11.5px;display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap}

/* ---------- 应用骨架 ---------- */
.app-shell{display:flex;height:100%;min-height:0}
.sidebar{width:var(--sidebar-w);flex:none;background:var(--surface);border-right:1px solid var(--border);display:flex;flex-direction:column;height:100%;z-index:40;transition:transform .24s ease}
.sidebar-head{height:var(--topbar-h);display:flex;align-items:center;padding:0 18px;flex:none}
.brand{display:flex;align-items:center;gap:10px;min-width:0;text-decoration:none;color:var(--text)}
.brand:hover{text-decoration:none}
.brand-mark{width:36px;height:36px;border-radius:11px;background:linear-gradient(135deg,var(--brand),var(--brand-2));display:flex;align-items:center;justify-content:center;flex:none;box-shadow:0 6px 14px rgba(79,70,229,.28)}
.brand-mark svg{width:20px;height:20px;fill:#fff}
.brand-txt{min-width:0;display:flex;flex-direction:column;line-height:1.25}
.brand-txt .n{display:block;font-size:15.5px;font-weight:800;letter-spacing:.2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.brand-txt .s{display:block;font-size:10px;color:var(--muted);letter-spacing:2.4px;margin-top:1px}
.sidebar-scroll{flex:1;overflow:auto;padding:4px 12px 16px}
.nav-group{margin-top:14px}
.nav-group:first-child{margin-top:2px}
.nav-title{font-size:10.5px;font-weight:800;letter-spacing:1.6px;color:var(--muted);padding:0 10px 7px;text-transform:uppercase}
.nav-item{display:flex;align-items:center;gap:10px;height:38px;padding:0 10px;border-radius:10px;color:var(--text-2);font-size:13.5px;font-weight:600;cursor:pointer;user-select:none;transition:background .14s,color .14s;position:relative}
.nav-item:hover{background:var(--surface-2);color:var(--text)}
.nav-item.active{background:var(--brand-soft);color:var(--brand-ink)}
.nav-item.active::before{content:"";position:absolute;left:-12px;top:9px;bottom:9px;width:3px;border-radius:0 3px 3px 0;background:var(--brand)}
.nav-item svg{width:18px;height:18px;flex:none;stroke-width:1.9}
.nav-item .label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.nav-item .count{font-size:11px;font-weight:700;color:var(--muted);background:var(--surface-3);border-radius:999px;padding:1px 7px;min-width:20px;text-align:center}
.nav-item.active .count{background:#fff;color:var(--brand-ink)}
html[data-theme="dark"] .nav-item.active .count{background:rgba(255,255,255,.08);color:#c7d2fe}
.nav-item .count.unread{background:var(--brand);color:#fff}
.nav-item.active .count.unread{background:var(--brand);color:#fff}
.sidebar-foot{flex:none;padding:12px 16px 16px;border-top:1px solid var(--border-2)}
.storage{border-radius:12px;background:var(--surface-2);padding:11px 12px;margin-bottom:12px}
.storage-head{display:flex;justify-content:space-between;font-size:11.5px;color:var(--muted);margin-bottom:7px}
.storage-head b{color:var(--text-2);font-weight:700}
.meter{height:5px;border-radius:99px;background:var(--border);overflow:hidden}
.meter>i{display:block;height:100%;border-radius:99px;background:linear-gradient(90deg,var(--brand),var(--brand-2));transition:width .4s}
.user-chip{display:flex;align-items:center;gap:10px;padding:8px;border-radius:12px;cursor:pointer;transition:background .14s;min-width:0}
.user-chip:hover{background:var(--surface-2)}
.user-chip .meta{min-width:0;flex:1}
.user-chip .meta .n{font-size:13px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.user-chip .meta .e{font-size:11px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.user-chip>svg{width:16px;height:16px;color:var(--muted);flex:none}

.main{flex:1;min-width:0;display:flex;flex-direction:column;height:100%}
.topbar{height:var(--topbar-h);flex:none;display:flex;align-items:center;gap:14px;padding:0 20px;background:var(--surface);border-bottom:1px solid var(--border);z-index:30}
.topbar .menu-btn{display:none}
.topbar-title{font-size:17px;font-weight:800;letter-spacing:-.3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.topbar .crumb{font-size:12px;color:var(--muted);margin-left:2px}
.topbar-search{flex:1;max-width:460px;margin-left:auto;position:relative}
.topbar-search input{width:100%;height:38px;border-radius:11px;border:1px solid var(--border);background:var(--surface-2);padding:0 36px 0 36px;font-size:13px;transition:.16s}
.topbar-search input:focus{outline:none;background:var(--surface);border-color:var(--brand);box-shadow:0 0 0 3.5px rgba(99,102,241,.12)}
.topbar-search .si{position:absolute;left:12px;top:50%;transform:translateY(-50%);width:16px;height:16px;color:var(--muted);pointer-events:none}
.topbar-actions{display:flex;align-items:center;gap:6px}
.topbar-actions .sep{width:1px;height:22px;background:var(--border);margin:0 4px}
.content{flex:1;min-height:0;overflow:auto;padding:20px;position:relative}
.content.flush{padding:0;overflow:hidden}
.page{max-width:1280px;margin:0 auto}
.page.wide{max-width:1440px}
.page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;margin-bottom:18px;flex-wrap:wrap}
.page-head h2{font-size:20px;font-weight:800;letter-spacing:-.4px}
.page-head .sub{color:var(--muted);font-size:12.5px;margin-top:3px}
.page-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}

/* ---------- 仪表盘 ---------- */
.stat-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:18px}
.stat{border-radius:var(--r-lg);padding:18px;background:var(--surface);border:1px solid var(--border);box-shadow:var(--shadow-sm);position:relative;overflow:hidden}
.stat .ico{width:38px;height:38px;border-radius:12px;display:flex;align-items:center;justify-content:center;margin-bottom:12px}
.stat .ico svg{width:19px;height:19px}
.stat .label{font-size:12.5px;color:var(--muted);font-weight:600}
.stat .value{font-size:26px;font-weight:800;letter-spacing:-.8px;margin-top:2px;font-variant-numeric:tabular-nums}
.stat .sub{font-size:11.5px;color:var(--muted);margin-top:2px}
.stat.g1 .ico{background:#eef2ff;color:#4338ca}
.stat.g2 .ico{background:#ecfdf5;color:#047857}
.stat.g3 .ico{background:#fef3c7;color:#b45309}
.stat.g4 .ico{background:#fce7f3;color:#be185d}
html[data-theme="dark"] .stat.g1 .ico{background:#1c2450;color:#a5b4fc}
html[data-theme="dark"] .stat.g2 .ico{background:#062c22;color:#6ee7b7}
html[data-theme="dark"] .stat.g3 .ico{background:#2d2106;color:#fcd34d}
html[data-theme="dark"] .stat.g4 .ico{background:#3a0f1f;color:#f9a8d4}
.stat .spark{position:absolute;right:12px;bottom:12px;width:64px;height:28px;opacity:.5}
.dash-grid{display:grid;grid-template-columns:1.6fr 1fr;gap:14px}
.chart-card{padding:20px}
.chart-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:14px}
.chart-head h3{font-size:14.5px}
.legend{display:flex;gap:14px;font-size:11.5px;color:var(--muted)}
.legend i{width:8px;height:8px;border-radius:3px;display:inline-block;margin-right:5px}
.chart-box{height:220px;position:relative}
.chart-box canvas{width:100%;height:100%;display:block}
.list-mini{display:flex;flex-direction:column}
.mini-row{display:flex;align-items:center;gap:10px;padding:10px 0;border-bottom:1px dashed var(--border-2);font-size:12.5px;min-width:0}
.mini-row:last-child{border-bottom:0;padding-bottom:0}
.mini-row .grow{flex:1;min-width:0}
.mini-row .s{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:600}
.mini-row .m{color:var(--muted);font-size:11.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mini-row .t{color:var(--muted);font-size:11px;flex:none}

/* ---------- 表格 ---------- */
.table-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--r-lg);box-shadow:var(--shadow-sm);overflow:hidden}
.table-tools{display:flex;align-items:center;gap:10px;padding:14px 16px;border-bottom:1px solid var(--border-2);flex-wrap:wrap}
.table-tools .grow{flex:1}
.table-wrap{overflow:auto;max-width:100%}
table.tbl{width:100%;border-collapse:separate;border-spacing:0;font-size:13px;min-width:640px}
table.tbl th{text-align:left;font-size:11.5px;font-weight:800;letter-spacing:.4px;color:var(--muted);text-transform:uppercase;background:var(--surface-2);padding:10px 14px;white-space:nowrap;position:sticky;top:0;z-index:1;border-bottom:1px solid var(--border-2)}
table.tbl td{padding:12px 14px;border-bottom:1px solid var(--border-2);vertical-align:middle;color:var(--text-2)}
table.tbl tbody tr:hover td{background:var(--surface-2)}
table.tbl tbody tr:last-child td{border-bottom:0}
table.tbl td .strong{color:var(--text);font-weight:700}
table.tbl td .muted{color:var(--muted);font-size:12px}
table.tbl .num{text-align:right;font-variant-numeric:tabular-nums}
table.tbl .act{display:flex;gap:4px;justify-content:flex-end}
.row-actions{display:flex;justify-content:flex-end;gap:2px}
.pager{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 16px;border-top:1px solid var(--border-2);font-size:12.5px;color:var(--muted);flex-wrap:wrap}
.pager .pages{display:flex;gap:4px}
.pager button{min-width:30px;height:30px;border-radius:8px;border:1px solid var(--border);background:var(--surface);color:var(--text-2);font-size:12px;font-weight:600}
.pager button.active{background:var(--brand);border-color:var(--brand);color:#fff}
.pager button:disabled{opacity:.4;cursor:not-allowed}

/* ---------- 分段 / 过滤 ---------- */
.seg{display:inline-flex;background:var(--surface-2);border:1px solid var(--border);border-radius:10px;padding:3px;gap:2px;max-width:100%;overflow-x:auto;scrollbar-width:none}
.seg::-webkit-scrollbar{display:none}
.seg button{height:28px;padding:0 11px;border:0;border-radius:7px;background:transparent;color:var(--muted);font-size:12px;font-weight:700;transition:.14s;flex:none;white-space:nowrap;display:inline-flex;align-items:center;gap:5px}
.seg button svg{width:14px;height:14px}
.seg button.on{background:var(--surface);color:var(--text);box-shadow:var(--shadow-sm)}
.chips{display:flex;gap:6px;flex-wrap:wrap}
.chip{height:26px;padding:0 10px;border-radius:999px;background:var(--surface-2);border:1px solid var(--border);color:var(--text-2);font-size:11.5px;font-weight:600;display:inline-flex;align-items:center;gap:5px}
.chip.on{background:var(--brand-soft);border-color:transparent;color:var(--brand-ink)}
.chip button{border:0;background:none;padding:0;color:inherit;display:flex}

/* ---------- 邮件布局 ---------- */
.mail-layout{display:flex;height:100%;min-height:0;background:var(--bg)}
.mail-list-col{width:390px;flex:none;display:flex;flex-direction:column;border-right:1px solid var(--border);background:var(--surface);min-width:0;position:relative}
.mail-list-head{flex:none;padding:12px 14px;border-bottom:1px solid var(--border-2);display:flex;flex-direction:column;gap:10px}
.mail-list-title{display:flex;align-items:center;justify-content:space-between;gap:8px}
.mail-list-title h3{font-size:15px;font-weight:800;letter-spacing:-.2px;display:flex;align-items:center;gap:7px}
.mail-toolbar{display:flex;align-items:center;gap:2px}
.mail-toolbar .grow{flex:1}
.mail-progress{height:2px;background:linear-gradient(90deg,var(--brand),var(--brand-2));width:0;transition:width .25s;border-radius:2px}
.mail-list{flex:1;overflow:auto;min-height:0}
.mail-item{display:flex;gap:11px;padding:12px 14px;border-bottom:1px solid var(--border-2);cursor:pointer;position:relative;transition:background .12s}
.mail-item:hover{background:var(--surface-2)}
.mail-item.active{background:var(--brand-soft)}
.mail-item.unread .mi-subject{font-weight:800;color:var(--text)}
.mail-item .mi-main{flex:1;min-width:0}
.mi-top{display:flex;align-items:center;gap:7px;margin-bottom:2px}
.mi-from{font-size:13px;font-weight:600;color:var(--text-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}
.mail-item.unread .mi-from{color:var(--text);font-weight:800}
.mi-time{font-size:11px;color:var(--muted);flex:none}
.mi-subject{font-size:13px;color:var(--text-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:2px}
.mi-preview{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mi-meta{display:flex;align-items:center;gap:6px;margin-top:4px;color:var(--muted);font-size:11px}
.mi-meta svg{width:13px;height:13px}
.mi-star{border:0;background:none;padding:2px;color:var(--muted);opacity:0;transition:.12s;align-self:flex-start}
.mail-item:hover .mi-star,.mail-item .mi-star.on{opacity:1}
.mi-star.on{color:#f59e0b}
.mi-star svg{width:15px;height:15px}
.mi-unread-dot{width:7px;height:7px;border-radius:50%;background:var(--brand);flex:none}
.mi-check{position:absolute;left:6px;top:50%;transform:translateY(-50%);opacity:0}
.mail-item:hover .mi-check{opacity:1}
.mail-item.checked .mi-check{opacity:1}
.mail-item .cbx{width:15px;height:15px;accent-color:var(--brand);cursor:pointer}
.mail-item.checked{background:var(--brand-soft)}
.bulk-bar{position:absolute;left:14px;right:14px;bottom:14px;background:var(--text);color:#fff;border-radius:14px;padding:8px 12px;display:flex;align-items:center;gap:8px;box-shadow:var(--shadow-lg);z-index:5}
html[data-theme="dark"] .bulk-bar{background:#243051}
.bulk-bar .n{font-size:12.5px;font-weight:700;margin-right:4px}
.bulk-bar button{background:rgba(255,255,255,.1);border:0;color:#fff;height:30px;padding:0 10px;border-radius:8px;font-size:12px;font-weight:600;display:flex;align-items:center;gap:5px}
.bulk-bar button:hover{background:rgba(255,255,255,.2)}
.bulk-bar button svg{width:14px;height:14px}
.bulk-bar .spacer{flex:1}
.mail-list-foot{flex:none;padding:8px 12px;border-top:1px solid var(--border-2);display:flex;align-items:center;justify-content:space-between;font-size:11.5px;color:var(--muted)}
.mail-list-foot .pg{display:flex;gap:4px}

.reader{flex:1;min-width:0;display:flex;flex-direction:column;background:var(--surface);min-height:0}
.reader-head{flex:none;padding:14px 20px;border-bottom:1px solid var(--border-2);display:flex;align-items:center;gap:4px;min-height:56px}
.reader-head .title{font-size:14px;font-weight:700;flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.reader-scroll{flex:1;overflow:auto;min-height:0}
.reader-doc{padding:24px 30px 40px;max-width:900px}
.reader-subject{font-size:22px;font-weight:800;letter-spacing:-.4px;line-height:1.35;margin-bottom:16px;word-break:break-word}
.reader-meta{display:flex;gap:12px;align-items:flex-start;padding-bottom:16px;border-bottom:1px solid var(--border-2);margin-bottom:18px}
.reader-meta .who{flex:1;min-width:0}
.reader-meta .who .n{font-size:14px;font-weight:700;display:flex;align-items:center;gap:7px;flex-wrap:wrap}
.reader-meta .who .e{font-size:12px;color:var(--muted);margin-top:1px;word-break:break-all}
.reader-meta .when{font-size:11.5px;color:var(--muted);text-align:right;flex:none}
.reader-body{font-size:14px;line-height:1.8;color:var(--text);word-break:break-word;min-height:120px}
.reader-body iframe{width:100%;border:0;display:block;background:#fff;border-radius:8px}
.reader-text{white-space:pre-wrap;font-family:var(--font);font-size:14px;line-height:1.85}
.remote-note{display:flex;align-items:center;justify-content:space-between;gap:10px;background:var(--warn-soft);color:var(--warn);border-radius:10px;padding:9px 12px;font-size:12px;margin-bottom:14px;flex-wrap:wrap}
.attach-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:10px;margin-top:22px}
.attach-item{display:flex;align-items:center;gap:10px;border:1px solid var(--border);border-radius:12px;padding:10px 12px;background:var(--surface-2);min-width:0;transition:.14s}
.attach-item:hover{border-color:var(--brand);background:var(--surface)}
.attach-item .fi{width:34px;height:34px;border-radius:9px;background:var(--brand-soft);color:var(--brand-ink);display:flex;align-items:center;justify-content:center;flex:none;font-size:10px;font-weight:800;text-transform:uppercase}
.attach-item .fi svg{width:16px;height:16px}
.attach-item .meta{flex:1;min-width:0}
.attach-item .nm{display:block;font-size:12.5px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--text)}
.attach-item .sz{display:block;font-size:11px;color:var(--muted);margin-top:1px}
.attach-item .dl{color:var(--muted);display:flex;padding:4px}
.attach-item .dl svg{width:15px;height:15px}
.reader-foot{flex:none;border-top:1px solid var(--border-2);padding:10px 20px;display:flex;gap:8px;align-items:center;background:var(--surface)}
.reader-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;color:var(--muted);padding:30px;text-align:center}
.reader-empty .art{width:96px;height:96px;border-radius:28px;background:linear-gradient(135deg,var(--brand-soft),var(--surface-2));display:flex;align-items:center;justify-content:center;position:relative}
.reader-empty .art svg{width:44px;height:44px;color:var(--brand);opacity:.8}
.reader-empty .t{font-size:15px;font-weight:700;color:var(--text-2)}
.reader-empty .d{font-size:12.5px;max-width:300px;line-height:1.7}

/* ---------- 写信 ---------- */
.compose-modal{width:min(880px,calc(100vw - 40px));max-height:calc(100vh - 60px);display:flex;flex-direction:column;background:var(--surface);border-radius:var(--r-xl);box-shadow:var(--shadow-lg);border:1px solid var(--border);overflow:hidden}
.compose-head{display:flex;align-items:center;gap:10px;padding:14px 18px;border-bottom:1px solid var(--border-2)}
.compose-head h3{font-size:15px;font-weight:800;flex:1}
.compose-body{flex:1;overflow:auto;min-height:0;padding:4px 18px}
.compose-row{display:flex;align-items:center;gap:10px;border-bottom:1px solid var(--border-2);padding:9px 0;min-height:42px}
.compose-row>label{font-size:12.5px;color:var(--muted);width:42px;flex:none}
.compose-row input{flex:1;border:0;background:transparent;height:26px;font-size:13.5px;min-width:0}
.compose-row input:focus{outline:none}
.compose-row .row-act{display:flex;gap:2px}
.compose-subject input{font-size:15px;font-weight:700}
.chip-input{display:flex;align-items:center;flex-wrap:wrap;gap:5px;flex:1;min-width:0}
.chip-input input{border:0;background:transparent;flex:1;min-width:80px;height:26px;font-size:13.5px}
.chip-input input:focus{outline:none}
.addr-chip{display:inline-flex;align-items:center;gap:5px;background:var(--brand-soft);color:var(--brand-ink);border-radius:999px;padding:2px 8px;font-size:12px;font-weight:600;max-width:100%}
.addr-chip span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.addr-chip button{border:0;background:none;color:inherit;display:flex;padding:0;opacity:.7}
.addr-chip button:hover{opacity:1}
.addr-chip svg{width:12px;height:12px}
.editor-wrap{border-top:1px solid var(--border-2)}
.editor-tools{display:flex;align-items:center;gap:2px;padding:7px 0;border-bottom:1px solid var(--border-2);flex-wrap:wrap}
.editor-tools button{width:30px;height:30px;border:0;background:transparent;border-radius:7px;color:var(--text-2);display:flex;align-items:center;justify-content:center}
.editor-tools button:hover{background:var(--surface-2);color:var(--text)}
.editor-tools button.on{background:var(--brand-soft);color:var(--brand-ink)}
.editor-tools button svg{width:15px;height:15px}
.editor-tools .sep{width:1px;height:18px;background:var(--border);margin:0 5px}
.editor{min-height:240px;max-height:46vh;overflow:auto;padding:14px 2px;font-size:14px;line-height:1.8;outline:none}
.editor:empty::before{content:attr(data-placeholder);color:var(--muted);pointer-events:none}
.editor p{margin:0 0 10px}
.editor blockquote{border-left:3px solid var(--border);margin:8px 0;padding:2px 0 2px 12px;color:var(--text-2)}
.compose-attach{display:flex;flex-wrap:wrap;gap:8px;padding:8px 0;border-top:1px dashed var(--border-2)}
.compose-foot{display:flex;align-items:center;gap:10px;padding:12px 18px;border-top:1px solid var(--border-2);background:var(--surface-2);flex-wrap:wrap}
.compose-foot .grow{flex:1}
.mail-tip{display:inline-flex;align-items:center;gap:5px;font-size:11.5px;color:var(--muted)}
.mail-tip svg{width:13px;height:13px}

/* ---------- 抽屉 / 弹层 ---------- */
.overlay{position:fixed;inset:0;background:rgba(15,23,42,.45);backdrop-filter:blur(2px);z-index:80;display:flex;align-items:center;justify-content:center;padding:20px;animation:fadeIn .16s ease}
html[data-theme="dark"] .overlay{background:rgba(0,0,0,.6)}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
.modal{width:min(560px,100%);max-height:calc(100vh - 40px);display:flex;flex-direction:column;background:var(--surface);border-radius:var(--r-xl);box-shadow:var(--shadow-lg);border:1px solid var(--border);overflow:hidden;animation:pop .18s ease}
.modal.wide{width:min(920px,100%)}
@keyframes pop{from{opacity:0;transform:translateY(10px) scale(.985)}to{opacity:1;transform:none}}
.modal-head{display:flex;align-items:center;gap:12px;padding:18px 22px 14px;border-bottom:1px solid var(--border-2)}
.modal-head .mt{flex:1;min-width:0}
.modal-head h3{font-size:16px;font-weight:800;letter-spacing:-.2px}
.modal-head .ms{font-size:12px;color:var(--muted);margin-top:2px}
.modal-body{padding:20px 22px;overflow:auto;min-height:0}
.modal-foot{padding:14px 22px;border-top:1px solid var(--border-2);display:flex;justify-content:flex-end;gap:8px;background:var(--surface-2);flex-wrap:wrap}
.drawer{position:fixed;top:0;right:0;bottom:0;width:min(560px,100%);background:var(--surface);border-left:1px solid var(--border);box-shadow:var(--shadow-lg);z-index:90;display:flex;flex-direction:column;animation:slideIn .22s ease}
@keyframes slideIn{from{transform:translateX(30px);opacity:.4}to{transform:none;opacity:1}}
.drawer-head{display:flex;align-items:center;gap:10px;padding:16px 20px;border-bottom:1px solid var(--border-2)}
.drawer-head h3{font-size:15px;font-weight:800;flex:1}
.drawer-body{flex:1;overflow:auto;padding:18px 20px}
.drawer-foot{padding:12px 20px;border-top:1px solid var(--border-2);display:flex;justify-content:flex-end;gap:8px}

/* ---------- Toast ---------- */
.toast-root{position:fixed;top:16px;right:16px;z-index:200;display:flex;flex-direction:column;gap:8px;pointer-events:none;max-width:min(360px,calc(100vw - 32px))}
body:not(.is-login) .toast-root{top:calc(var(--topbar-h) + 12px)}
.toast{display:flex;align-items:flex-start;gap:9px;background:var(--surface);border:1px solid var(--border);border-radius:12px;box-shadow:var(--shadow);padding:11px 14px;font-size:13px;color:var(--text-2);animation:toastIn .22s ease;pointer-events:auto}
.toast svg{width:17px;height:17px;flex:none;margin-top:1px}
.toast.ok svg{color:var(--ok)}
.toast.bad svg{color:var(--bad)}
.toast.info svg{color:var(--info)}
.toast.out{animation:toastOut .2s ease forwards}
@keyframes toastIn{from{opacity:0;transform:translateX(20px)}to{opacity:1;transform:none}}
@keyframes toastOut{to{opacity:0;transform:translateX(20px)}}

/* 新邮件提醒 */
.notify-btn{position:relative}
.notify-btn.on{color:var(--brand);background:var(--brand-soft)}
.notify-dot{position:absolute;top:7px;right:7px;width:7px;height:7px;border-radius:50%;background:var(--bad);border:1.5px solid var(--surface);box-shadow:0 0 0 1px var(--surface)}
.notify-dot[hidden]{display:none}
.toast.mail-notify{width:min(350px,calc(100vw - 32px));max-width:350px;gap:10px;padding:12px;cursor:pointer;position:relative;border-color:var(--border)}
.toast.mail-notify:hover{border-color:var(--brand-3);box-shadow:var(--shadow)}
.mail-notify .mn-ico{width:34px;height:34px;border-radius:10px;background:var(--brand-soft);color:var(--brand-ink);display:flex;align-items:center;justify-content:center;flex:none}
.mail-notify .mn-ico svg{width:17px;height:17px;margin:0}
.mail-notify .mn-body{flex:1;min-width:0}
.mail-notify .mn-from{font-size:12px;font-weight:800;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-right:16px}
.mail-notify .mn-subject{font-size:12.5px;font-weight:600;color:var(--text-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}
.mail-notify .mn-preview{font-size:11.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:3px}
.mail-notify .mn-close{position:absolute;top:8px;right:8px;border:0;background:transparent;color:var(--muted);padding:2px;border-radius:5px;display:flex}
.mail-notify .mn-close:hover{background:var(--surface-3);color:var(--text)}
.mail-notify .mn-close svg{width:14px;height:14px;margin:0}

/* ---------- 设置页 ---------- */
.settings-grid{display:grid;grid-template-columns:210px 1fr;gap:18px;align-items:start}
.settings-nav{position:sticky;top:0;display:flex;flex-direction:column;gap:2px;background:var(--surface);border:1px solid var(--border);border-radius:var(--r-lg);padding:8px}
.settings-nav button{display:flex;align-items:center;gap:9px;height:36px;padding:0 10px;border:0;border-radius:9px;background:none;color:var(--text-2);font-size:12.5px;font-weight:600;text-align:left}
.settings-nav button:hover{background:var(--surface-2)}
.settings-nav button.on{background:var(--brand-soft);color:var(--brand-ink)}
.settings-nav svg{width:16px;height:16px}
.settings-panel{display:flex;flex-direction:column;gap:16px}
.settings-section{padding:20px 22px}
.settings-section h3{font-size:14.5px;font-weight:800;margin-bottom:4px}
.settings-section .sdesc{font-size:12px;color:var(--muted);margin-bottom:16px}
.form-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:8px}

/* 邮件客户端配置 */
.client-status{display:flex;align-items:flex-start;gap:9px;padding:11px 13px;border-radius:10px;font-size:12.5px;line-height:1.65;margin-bottom:16px}
.client-status svg{width:17px;height:17px;flex:none;margin-top:1px}
.client-status.ok{background:var(--ok-soft);color:var(--ok)}
.client-status.warn{background:var(--warn-soft);color:var(--warn)}
.client-config{border:1px solid var(--border);border-radius:12px;overflow:hidden;background:var(--surface)}
.client-row{display:flex;align-items:center;gap:10px;padding:10px 13px;border-bottom:1px solid var(--border-2);min-width:0}
.client-row:last-child{border-bottom:0}
.client-row span{width:92px;flex:none;font-size:11.5px;color:var(--muted)}
.client-row b{flex:1;min-width:0;font-size:12.5px;font-weight:600;color:var(--text-2);word-break:break-all}
.client-row .btn{flex:none}
.client-url{display:flex;align-items:center;gap:8px;padding:8px 10px;margin-top:7px;border:1px solid var(--border);border-radius:9px;background:var(--surface-2);min-width:0}
.client-url>svg{width:15px;height:15px;color:var(--muted);flex:none}
.client-url code{flex:1;min-width:0;font-size:11px;color:var(--text-2);word-break:break-all}
.client-url .btn{flex:none}
.client-guide{display:grid;grid-template-columns:1fr 1fr;gap:9px}
.client-guide>div{padding:10px 12px;border:1px solid var(--border-2);border-radius:9px;background:var(--surface-2)}
.client-guide b{display:block;font-size:12.5px;color:var(--text);margin-bottom:3px}
.client-guide span{display:block;font-size:11.5px;line-height:1.7;color:var(--muted)}
@media (max-width:820px){
    .client-guide{grid-template-columns:1fr}
    .client-row span{width:78px}
}

/* ---------- 日志 / 队列 ---------- */
.log-line{display:flex;gap:12px;padding:11px 0;border-bottom:1px dashed var(--border-2);font-size:12.5px;align-items:flex-start}
.log-line:last-child{border-bottom:0}
.log-line .ico{width:30px;height:30px;border-radius:9px;display:flex;align-items:center;justify-content:center;flex:none}
.log-line .ico.in{background:var(--ok-soft);color:var(--ok)}
.log-line .ico.out{background:var(--info-soft);color:var(--info)}
.log-line .ico.fail{background:var(--bad-soft);color:var(--bad)}
.log-line .ico svg{width:15px;height:15px}
.log-line .body{flex:1;min-width:0}
.log-line .t{font-weight:700;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.log-line .d{color:var(--muted);font-size:11.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.log-line .r{color:var(--muted);font-size:11px;flex:none;text-align:right}
.kv{display:grid;grid-template-columns:110px 1fr;gap:8px 14px;font-size:12.5px}
.kv dt{color:var(--muted)}
.kv dd{margin:0;color:var(--text-2);word-break:break-all}
.code-box{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11.5px;background:var(--surface-2);border:1px solid var(--border);border-radius:10px;padding:10px 12px;word-break:break-all;line-height:1.7;color:var(--text-2);max-height:200px;overflow:auto;white-space:pre-wrap}
.dns-row{display:flex;align-items:flex-start;gap:10px;padding:10px 0;border-bottom:1px dashed var(--border-2);font-size:12px}
.dns-row:last-child{border:0}
.dns-row .ty{width:44px;flex:none;font-weight:800;font-size:10.5px;letter-spacing:.4px;color:var(--brand-ink);background:var(--brand-soft);border-radius:6px;text-align:center;padding:2px 0;margin-top:1px}
.dns-row .val{flex:1;min-width:0;word-break:break-all;color:var(--text-2)}
.dns-row .val b{display:block;color:var(--text);font-size:12.5px;margin-bottom:2px}
.check-row{display:flex;align-items:center;gap:10px;padding:10px 0;border-bottom:1px dashed var(--border-2);font-size:13px}
.check-row:last-child{border:0}
.check-row .ci{width:24px;height:24px;border-radius:7px;display:flex;align-items:center;justify-content:center;flex:none}
.check-row .ci.ok{background:var(--ok-soft);color:var(--ok)}
.check-row .ci.bad{background:var(--bad-soft);color:var(--bad)}
.check-row .ci svg{width:14px;height:14px}
.check-row .grow{flex:1;min-width:0}
.check-row .d{font-size:11.5px;color:var(--muted)}

/* ---------- 视觉精修 2026 ---------- */
body{background:var(--bg)}
.app-shell{background:radial-gradient(900px 480px at 12% -10%,rgba(99,102,241,.07),transparent 62%),var(--bg)}
html[data-theme="dark"] .app-shell{background:radial-gradient(900px 480px at 12% -10%,rgba(99,102,241,.12),transparent 62%),var(--bg)}
.content{background:radial-gradient(1000px 480px at 18% -12%,rgba(99,102,241,.055),transparent 62%)}
html[data-theme="dark"] .content{background:radial-gradient(1000px 480px at 18% -12%,rgba(99,102,241,.1),transparent 62%)}

.btn{height:36px;padding:0 15px;border-radius:9px;font-size:13px}
.btn.primary{box-shadow:0 8px 20px -10px rgba(79,70,229,.65)}
.btn.primary:hover{box-shadow:0 12px 26px -10px rgba(79,70,229,.72)}
.btn.ghost{background:var(--surface)}
.btn.ghost:hover{background:var(--surface-2);border-color:var(--border-2)}
.btn.sm{height:30px;padding:0 11px;font-size:12px;border-radius:8px}
.btn.icon{width:36px;height:36px;border-radius:9px}
.btn.icon.sm{width:30px;height:30px}
.btn .lbl{white-space:nowrap}

.input,.select,.textarea{height:38px;border-radius:9px;font-size:13px;background:var(--surface)}
.input.sm,.select.sm{height:33px;font-size:12px}
.input:hover,.select:hover,.textarea:hover{border-color:#cbd5e1}
html[data-theme="dark"] .input:hover,html[data-theme="dark"] .select:hover,html[data-theme="dark"] .textarea:hover{border-color:#31415e}
.input:focus,.select:focus,.textarea:focus{box-shadow:0 0 0 3px rgba(99,102,241,.12)}
.field{gap:7px;margin-bottom:15px}
.field>label,.field-label{font-size:12px;letter-spacing:.01em}
.field .hint{font-size:11px;line-height:1.55}
.form-grid{gap:0 18px}
.checkbox{font-size:12.5px}

.card,.table-card{border-radius:var(--r-lg);box-shadow:var(--shadow-sm)}
.panel{padding:20px 22px}
.panel-head{margin-bottom:15px}
.panel-head h3{font-size:14.5px}
.pill{height:21px;font-size:11px;padding:0 8px}
.avatar{border-radius:10px}
.avatar.sm{border-radius:7px}

/* 顶栏 / 侧栏 */
.topbar{height:var(--topbar-h);padding:0 22px;gap:12px;box-shadow:0 1px 0 var(--border)}
.topbar-title{font-size:16px;letter-spacing:-.2px}
.topbar-search{max-width:500px}
.topbar-search input{height:36px;border-radius:10px;font-size:12.5px}
.sidebar-head{padding:0 18px}
.brand-mark{width:35px;height:35px;border-radius:11px}
.brand-txt .n{font-size:15px}
.sidebar-scroll{padding:6px 12px 16px}
.nav-group{margin-top:16px}
.nav-title{font-size:10px;letter-spacing:1.5px;padding:0 10px 6px}
.nav-item{height:37px;border-radius:9px;font-size:13.2px;gap:9px}
.nav-item svg{width:17px;height:17px}
.nav-item.active{background:linear-gradient(90deg,var(--brand-soft),rgba(99,102,241,.04))}
.nav-item.active::before{top:8px;bottom:8px;width:2.5px}
.sidebar-foot{padding:12px 14px 14px}
.user-chip{padding:7px;border-radius:11px}

/* 页面标题 / 后台左侧导航 */
.page-head{align-items:center;margin-bottom:15px;gap:14px}
.page-head h2{font-size:21px;letter-spacing:-.45px}
.page-head .sub{font-size:12.5px;margin-top:2px;color:var(--muted)}
.page-head-main{min-width:0}
.admin-page-head{margin-bottom:14px}
.admin-side-label{display:flex;align-items:center;gap:8px;padding:4px 10px 10px;font-size:12.5px;font-weight:800;color:var(--text)}
.admin-side-label svg{width:16px;height:16px;color:var(--brand);flex:none}
.admin-side-label em{margin-left:auto;font-style:normal;font-size:9px;font-weight:800;letter-spacing:1.4px;color:var(--muted)}
.admin-nav-return{margin-top:16px;padding-top:12px;border-top:1px solid var(--border-2)}
.admin-nav-return .nav-item{color:var(--muted)}
.admin-nav-return .nav-item:hover{color:var(--text)}
.admin-mode .sidebar{box-shadow:inset -1px 0 0 var(--border)}
.admin-mode .sidebar-foot{padding-top:10px}
.seg{background:var(--surface-2);border-color:var(--border);border-radius:9px;padding:3px}
.seg button{height:27px;font-size:11.5px;border-radius:7px}
.seg count,.seg-count{font-size:10px;background:var(--surface-3);color:var(--muted);padding:0 5px;border-radius:99px;line-height:16px}
.seg button.on .seg-count{background:var(--surface);color:var(--brand-ink)}
.queue-tabs .seg-count{margin-left:3px}

/* 统计卡 */
.stat{padding:17px 18px;border-radius:16px;background:linear-gradient(180deg,var(--surface) 30%,var(--surface-2) 165%)}
html[data-theme="dark"] .stat{background:linear-gradient(180deg,var(--surface) 30%,var(--surface-2) 165%)}
.stat .ico{width:36px;height:36px;border-radius:11px;margin-bottom:11px}
.stat .ico svg{width:18px;height:18px}
.stat .label{font-size:12px;letter-spacing:.01em}
.stat .value{font-size:25px;letter-spacing:-.7px;margin-top:1px}
.stat .sub{font-size:11px}
.dash-grid{gap:16px}

/* 表格 */
.table-tools{padding:12px 16px;gap:8px}
table.tbl{font-size:12.8px}
table.tbl th{padding:10px 16px;font-size:10.5px;letter-spacing:.055em;background:var(--surface-2);border-bottom:1px solid var(--border)}
table.tbl td{padding:12px 16px;border-bottom:1px solid var(--border-2)}
table.tbl tbody tr:hover td{background:var(--brand-soft)}
html[data-theme="dark"] table.tbl tbody tr:hover td{background:rgba(129,140,248,.06)}
table.tbl td .muted{font-size:11.5px}
.pager{padding:11px 16px}
.pager button{height:29px;min-width:29px;border-radius:7px}

/* 筛选栏 */
.filter-bar{padding:12px 16px;border-bottom:1px solid var(--border-2);background:var(--surface)}
.filter-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.filter-row .seg{flex:none}
.filter-row .select{width:116px;flex:none}
.filter-search{flex:1;min-width:200px;max-width:360px}
.date-range{display:flex;align-items:center;gap:6px;flex:none}
.date-range label{display:flex;align-items:center;gap:6px;height:33px;padding:0 9px;border:1px solid var(--border);border-radius:9px;background:var(--surface)}
.date-range label span{font-size:10.5px;color:var(--muted);flex:none}
.date-range input{border:0;background:transparent;height:29px;width:116px;padding:0;font-size:11.5px;color:var(--text-2)}
.date-range input:focus{outline:none}
.date-range i{width:9px;height:1px;background:var(--border);flex:none}

/* 邮箱容量 */
.quota-cell{min-width:170px}
.quota-top{display:flex;align-items:baseline;gap:5px;margin-bottom:6px;font-size:11px;color:var(--muted);white-space:nowrap}
.quota-top b{color:var(--text);font-size:12px;font-weight:700}
.quota-top em{margin-left:auto;font-style:normal;font-size:10.5px;color:var(--muted)}
.scope-tags{display:flex;gap:4px;flex-wrap:wrap;min-width:150px}
.scope-tags span{font-size:10px;font-weight:700;color:var(--brand-ink);background:var(--brand-soft);border-radius:5px;padding:2px 6px;line-height:1.4;white-space:nowrap}
html[data-theme="dark"] .scope-tags span{color:var(--brand-ink)}

/* API 文档渲染 */
.docs-md{max-height:56vh;overflow:auto;padding:2px 4px 2px 0;font-size:12.8px;line-height:1.8;color:var(--text-2)}
.docs-md h1{font-size:20px;font-weight:800;letter-spacing:-.3px;color:var(--text);margin:0 0 10px}
.docs-md h2{font-size:15px;font-weight:800;color:var(--text);margin:22px 0 8px;padding-top:2px;border-top:1px solid var(--border-2);padding-top:14px}
.docs-md h2:first-child{border-top:0;padding-top:0}
.docs-md h3,.docs-md h4{font-size:13.5px;font-weight:700;color:var(--text);margin:14px 0 6px}
.docs-md p{margin:7px 0}
.docs-md strong{color:var(--text)}
.docs-md code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11.5px;background:var(--surface-2);border:1px solid var(--border);border-radius:5px;padding:1px 5px;color:var(--brand-ink)}
.docs-md pre{margin:10px 0;padding:12px 14px;background:var(--surface-2);border:1px solid var(--border);border-radius:10px;overflow:auto}
.docs-md pre code{background:none;border:0;padding:0;color:var(--text-2);white-space:pre}
.docs-md ul{margin:6px 0;padding-left:20px}
.docs-md li{margin:2px 0}
.docs-md blockquote{margin:8px 0;padding:6px 12px;border-left:3px solid var(--brand-3);background:var(--brand-soft);border-radius:0 7px 7px 0;color:var(--brand-ink);font-size:12.5px}
.docs-md a{color:var(--brand);text-decoration:none}
.docs-md a:hover{text-decoration:underline}
.docs-table-wrap{overflow:auto;margin:10px 0;border:1px solid var(--border);border-radius:9px}
.docs-table{width:100%;border-collapse:collapse;font-size:11.8px;min-width:440px}
.docs-table th{background:var(--surface-2);text-align:left;padding:7px 9px;color:var(--text-2);font-weight:700;border-bottom:1px solid var(--border)}
.docs-table td{padding:7px 9px;border-bottom:1px solid var(--border-2);vertical-align:top}
.docs-table tr:last-child td{border-bottom:0}

/* 邮件列表 */
.mail-list-col{width:400px;background:var(--surface)}
.mail-list-head{padding:12px 14px;gap:8px}
.mail-list-title h3{font-size:14.5px}
.mail-toolbar{gap:1px}
.mail-toolbar .btn.icon.sm{width:29px;height:29px}
.mail-item{padding:11px 14px;gap:10px;border-bottom:1px solid var(--border-2)}
.mail-item.active{background:linear-gradient(90deg,var(--brand-soft),rgba(99,102,241,.03));box-shadow:inset 3px 0 0 var(--brand)}
html[data-theme="dark"] .mail-item.active{background:linear-gradient(90deg,rgba(129,140,248,.14),rgba(129,140,248,.03));box-shadow:inset 3px 0 0 var(--brand)}
.mi-top{gap:6px;margin-bottom:3px}
.mi-from{font-size:12.8px}
.mi-time{font-size:10.5px}
.mi-aside{display:flex;flex-direction:column;align-items:flex-end;gap:1px;flex:none;line-height:1.35}
.mi-size{display:inline-flex;align-items:center;gap:3px;font-size:10px;color:var(--muted);white-space:nowrap}
.mi-size svg{width:11px;height:11px}
.mi-flag{height:17px;line-height:17px;padding:0 6px;border-radius:5px;background:var(--warn-soft);color:var(--warn);font-size:9.5px;font-weight:800;flex:none}
.mi-subject{font-size:12.8px;margin-bottom:2px}
.mi-preview{font-size:11.5px;line-height:1.5}
.mi-star{margin-top:-2px}
.mail-list-foot{padding:7px 12px;font-size:11px}

/* 阅读 */
.reader-head{min-height:52px;padding:10px 20px}
.reader-head .title{font-size:13px}
.reader-scroll{overflow-y:auto;overflow-x:hidden}
.reader-doc{padding:28px 34px 46px;max-width:880px}
.reader-subject{font-size:21px;letter-spacing:-.35px;margin-bottom:15px}
.reader-meta{gap:13px;padding-bottom:15px;margin-bottom:18px}
.reader-meta .who .n{font-size:13.5px}
.reader-meta .who .e{font-size:11.5px;word-break:normal;overflow-wrap:anywhere;line-height:1.55}
.reader-meta .when{font-size:11px;line-height:1.75;max-width:170px}
.reader-body{font-size:14.5px;line-height:1.85}
.reader-foot{padding:9px 18px;background:linear-gradient(180deg,var(--surface),var(--surface-2));gap:7px;overflow-x:auto;flex-wrap:nowrap;scrollbar-width:none}
.reader-foot::-webkit-scrollbar{display:none}
.reader-foot .btn{flex:none}
.attach-grid{gap:9px;margin-top:20px}
.attach-item{border-radius:11px;background:var(--surface);padding:10px 11px}
.attach-item .fi{width:32px;height:32px;border-radius:8px}
.remote-note{border-radius:9px;padding:8px 11px}

/* 写信 */
.compose-modal{width:min(920px,calc(100vw - 40px));max-height:min(860px,calc(100vh - 48px));border-radius:20px}
.compose-head{padding:15px 20px}
.compose-head h3{font-size:14.5px}
.compose-body{padding:2px 20px}
.compose-row{padding:10px 0;min-height:44px;gap:12px}
.compose-row>label{width:44px;font-size:12px}
.compose-row input{font-size:13px}
.compose-subject input{font-size:15px}
.editor-tools{padding:6px 0;gap:1px}
.editor-tools button{width:29px;height:29px;border-radius:7px}
.editor{min-height:280px;max-height:48vh;padding:15px 2px;font-size:14px}
.editor:focus-visible{outline:none}
.editor.is-empty::before{content:attr(data-placeholder);color:var(--muted);pointer-events:none}
.compose-foot{padding:12px 20px;background:var(--surface-2)}
.compose-attach{padding:7px 0}

/* 设置 / 弹层 */
.settings-grid{grid-template-columns:200px 1fr;gap:20px}
.settings-nav{padding:7px;border-radius:14px}
.settings-nav button{height:35px;font-size:12px;border-radius:8px}
.settings-panel{gap:14px}
.settings-section{padding:21px 24px}
.settings-section h3{font-size:14.5px;letter-spacing:-.1px}
.settings-section .sdesc{font-size:11.5px;margin-bottom:16px}
.form-actions{margin-top:4px}
.modal{border-radius:20px}
.modal-head{padding:17px 22px 13px}
.modal-head h3{font-size:15px}
.modal-body{padding:19px 22px}
.modal-foot{padding:13px 22px}
.drawer-head{padding:15px 20px}
.drawer-body{padding:17px 20px}
.code-box{border-radius:9px;background:var(--surface-2);font-size:11px}
.switch-row{padding:11px 0}

/* 登录 */
.login-brand{flex-basis:47%;padding:48px 54px}
.login-brand .hero-copy h1{font-size:36px;line-height:1.24;letter-spacing:-.7px}
.login-brand .hero-copy p{font-size:14px;line-height:1.85}
.login-brand .feature-list{gap:13px;margin-top:24px}
.login-card{max-width:392px}
.login-card .welcome{font-size:26px}
.login-card .welcome-sub{font-size:13px;margin-bottom:26px}
.login-card .input{height:47px}
.login-card .btn.lg{height:48px}
.login-foot{font-size:11px}

/* 深色模式细调 */
html[data-theme="dark"] .btn.primary{background:linear-gradient(135deg,#4f46e5,#6d28d9);color:#fff;box-shadow:0 8px 22px -10px rgba(79,70,229,.8)}
html[data-theme="dark"] .btn.primary:hover{background:linear-gradient(135deg,#5b52f0,#7c3aed);filter:none}
html[data-theme="dark"] .topbar{background:rgba(15,23,42,.92);backdrop-filter:blur(12px)}
html[data-theme="dark"] .sidebar{background:var(--surface)}
html[data-theme="dark"] .card,html[data-theme="dark"] .table-card,html[data-theme="dark"] .stat{box-shadow:0 1px 2px rgba(0,0,0,.3)}
html[data-theme="dark"] .reader-body iframe{background:#fff}


@media (max-width:1200px){
    .stat-grid{grid-template-columns:repeat(2,1fr)}
    .dash-grid{grid-template-columns:1fr}
}
@media (max-width:1080px){
    .mail-list-col{width:340px}
    .login-brand{padding:36px}
    .login-brand .hero-copy h1{font-size:28px}
}
@media (max-width:960px){
    body{overflow:auto}
    .app-shell{height:100vh}
    .sidebar{position:fixed;left:0;top:0;bottom:0;transform:translateX(-102%);box-shadow:var(--shadow-lg)}
    .sidebar.open{transform:none}
    .sidebar-backdrop{position:fixed;inset:0;background:rgba(15,23,42,.4);z-index:35;animation:fadeIn .16s}
    .topbar .menu-btn{display:flex}
    .topbar-search{max-width:280px}
    .settings-grid{grid-template-columns:1fr}
    .settings-nav{position:static;flex-direction:row;overflow:auto;padding:6px}
    .settings-nav button{white-space:nowrap}
}
@media (max-width:820px){
    .login-brand{display:none}
    .login-mobile-brand{display:flex}
    .login-panel{padding:24px 18px}
    .mail-list-col{width:100%;border-right:0}
    .mail-layout[data-view="reader"] .mail-list-col{display:none}
    .mail-layout[data-view="list"] .reader{display:none}
    .reader{position:absolute;inset:0;z-index:5}
    .mail-layout{position:relative}
    .content{padding:14px}
    .page-head h2{font-size:18px}
    .topbar-search{display:none}
    .topbar{padding:0 14px}
    .stat-grid{grid-template-columns:1fr 1fr;gap:10px}
    .stat{padding:14px}
    .stat .value{font-size:22px}
    .reader-doc{padding:18px 16px 30px}
    .reader-subject{font-size:19px}
    .form-grid{grid-template-columns:1fr}
    .form-grid .span2{grid-column:auto}
    .compose-modal{width:100vw;height:100vh;max-height:100vh;border-radius:0}
    .modal.wide{width:100%}
    .overlay{padding:0}
    .modal{max-height:100vh;border-radius:16px 16px 0 0;margin-top:auto}
    .overlay{align-items:flex-end}
    .table-wrap{border-radius:0}
    .page-head{align-items:flex-start}
}
@media (max-width:560px){
    .stat-grid{grid-template-columns:1fr 1fr;gap:10px}
    .stat{padding:14px 13px}
    .stat .value{font-size:22px}
    .stat .label{font-size:11px}
    .stat .sub{font-size:10.5px}
    .stat .ico{width:32px;height:32px;margin-bottom:9px;border-radius:10px}
    .page-actions .btn span{display:none}
    .page-actions .btn{padding:0 10px}
    .mail-list-head{padding:10px}
    .mi-meta{display:none}
    .reader-foot{flex-wrap:wrap}
    .kv{grid-template-columns:90px 1fr}
    .bulk-bar{left:8px;right:8px;bottom:8px;flex-wrap:wrap}
}
@media (prefers-reduced-motion:reduce){
    *{animation-duration:.001s!important;transition-duration:.001s!important}
}

/* ---------- 精修响应式 ---------- */
@media (max-width:960px){
    body{overflow-y:auto;overflow-x:hidden}
    .content{padding:16px;overflow-x:hidden}
    .mail-list-head{padding:11px 12px;gap:7px}
    .page-head h2{font-size:19px}
}
@media (max-width:820px){
    .admin-page-head .sub{display:none}
    .mail-list-title h3{font-size:14px}
    .reader-meta{flex-wrap:wrap;gap:10px}
    .reader-meta .when{width:100%;max-width:none;text-align:left;padding-left:58px;margin-top:-3px;display:flex;gap:8px;align-items:center}
    .reader-meta .when span{display:inline}
    .reader-doc{padding:20px 16px 32px}
    .reader-subject{font-size:19px}
    .reader-foot{flex-wrap:nowrap;overflow-x:auto;padding:8px 12px;gap:6px}
    .reader-foot .btn{flex:none}
    .filter-row .select{width:108px}
    .filter-search{max-width:none;flex:1 1 200px}
    .date-range{width:100%}
    .date-range label{flex:1}
    .date-range input{width:100%}
    .date-range i{display:none}
}
@media (max-width:560px){
    .reader-foot{flex-wrap:nowrap}
    .reader-foot .btn:not(.primary) .lbl{display:none}
    .reader-foot .btn:not(.primary){width:30px;padding:0}
    .reader-meta{gap:8px 11px}
    .reader-meta .who{flex:1 1 calc(100% - 57px);min-width:0}
    .reader-meta .when{width:100%;padding-left:0;margin-left:57px;text-align:left;justify-content:flex-start;margin-top:-2px}
    .topbar-title{font-size:15px}
    .mail-list-head{padding:9px 11px;gap:6px}
    .mail-list-title h3{font-size:13.5px}
    .mail-list-head .seg button{height:26px;padding:0 9px}
    .mail-list-head .mail-toolbar{padding-top:4px!important}
    .compose-foot .mail-tip{display:none}
    .compose-foot{gap:7px}
    .mail-list-head{padding:10px 12px}
    .mail-toolbar .btn.icon.sm{width:28px;height:28px}
    .filter-row{gap:7px}
    .filter-row .select{flex:1;width:auto}
    .date-range label span{display:none}
    .page-head .sub{font-size:11.5px}
}
