/* ============================================================================
 *  app.css — NekoMail 控制台样式（登录 / 设置 / 收件箱）
 *  ----------------------------------------------------------------------------
 *  设计语言（参考 taste-skill 设计规范，按产品界面定调）：
 *    · 设计阅读：面向普通用户的邮件产品界面，安静克制的工具感，
 *      拨盘 VARIANCE 4 / MOTION 4 / DENSITY 7（高信息密度、低视觉噪音）
 *    · 单一强调色（深松石绿），暖中性色底座；无渐变、无装饰性阴影
 *    · 统一圆角体系：面板 16px / 控件 10px / 小徽章胶囊
 *    · 数字与编号使用等宽字体；动效只做 160-280ms 的进出门与状态反馈
 *    · 支持浅色/深色（跟随系统），尊重 prefers-reduced-motion
 * ========================================================================== */

/* ------------------------------ 字体 ------------------------------ */
@font-face {
    font-family: 'Geist';
    src: url('fonts/geist-sans-400.woff2') format('woff2');
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Geist';
    src: url('fonts/geist-sans-500.woff2') format('woff2');
    font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Geist';
    src: url('fonts/geist-sans-600.woff2') format('woff2');
    font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Geist Mono';
    src: url('fonts/geist-mono-400.woff2') format('woff2');
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Geist Mono';
    src: url('fonts/geist-mono-500.woff2') format('woff2');
    font-weight: 500; font-style: normal; font-display: swap;
}

/* ------------------------------ 设计令牌 ------------------------------ */
:root {
    color-scheme: light dark;

    --font-sans: 'Geist', 'PingFang SC', 'HarmonyOS Sans SC', 'MiSans', 'Noto Sans SC',
                 'Source Han Sans SC', 'Microsoft YaHei', system-ui, -apple-system, sans-serif;
    --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;

    --bg:          #F5F4F1;
    --surface:     #FFFFFF;
    --surface-2:   #FAF9F7;
    --side-bg:     #F2F1ED;
    --hover:       rgba(28, 28, 26, 0.045);

    --ink:         #1C1C1A;
    --ink-2:       #5E5D57;
    --ink-3:       #8B8A83;

    --line:        #E8E6E1;
    --line-2:      #D8D6D0;

    --accent:       #0C6B5B;
    --accent-hover: #0A5A4C;
    --accent-ink:   #FFFFFF;
    --accent-soft:  #E7F0EC;
    --accent-line:  #C4DCD3;
    --accent-strong:#0A5145;

    --danger:      #A8443A;
    --danger-soft: #F8ECE9;
    --danger-line: #E5C8C2;
    --danger-ink:  #7E2E26;

    --star:        #B07E1F;
    --focus-ring:  rgba(12, 107, 91, 0.30);
    --topbar-bg:   rgba(255, 255, 255, 0.86);

    --r-sm: 8px;
    --r-md: 10px;
    --r-lg: 16px;
    --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:          #111312;
        --surface:     #181B1A;
        --surface-2:   #1E2221;
        --side-bg:     #151817;
        --hover:       rgba(232, 233, 228, 0.05);

        --ink:         #E8E9E4;
        --ink-2:       #A6A9A2;
        --ink-3:       #7B7E78;

        --line:        #282C2A;
        --line-2:      #343936;

        --accent:       #3FA98F;
        --accent-hover: #4DBC9F;
        --accent-ink:   #0B1714;
        --accent-soft:  #17332D;
        --accent-line:  #245047;
        --accent-strong: #7FCDB8;

        --danger:      #C4756B;
        --danger-soft: #33211E;
        --danger-line: #4C322D;
        --danger-ink:  #E5A99F;

        --star:        #D2A044;
        --focus-ring:  rgba(63, 169, 143, 0.35);
        --topbar-bg:   rgba(24, 27, 26, 0.86);
    }
}

/* ------------------------------ 基础 ------------------------------ */
* { box-sizing: border-box; }

/* 允许移动端自由缩放（text-size-adjust:100% 会在部分移动浏览器里限制缩放） */
html { -webkit-text-size-adjust: auto; text-size-adjust: auto; }

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-soft); }

a { color: var(--accent-strong); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.mono { font-family: var(--font-mono); }

code {
    font-family: var(--font-mono);
    font-size: 0.92em;
}

.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.ic {
    flex: 0 0 auto;
    width: 18px; height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}
.ic-13 { width: 13px; height: 13px; }
.ic-14 { width: 14px; height: 14px; }
.ic-15 { width: 15px; height: 15px; }
.ic-40 { width: 40px; height: 40px; stroke-width: 1.4; }

* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------ 按钮 ------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: var(--r-md);
    font: inherit;
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    transition: background-color .18s var(--ease), border-color .18s var(--ease),
                color .18s var(--ease), transform .12s var(--ease);
}
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--ink-2); }
.btn-ghost:hover { background: var(--hover); color: var(--ink); }

.btn-danger-ghost { background: transparent; border-color: var(--danger-line); color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-danger-ghost.armed { background: var(--danger-soft); border-color: var(--danger); }

.btn-block { width: 100%; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--ink-2);
    cursor: pointer;
    transition: background-color .16s var(--ease), color .16s var(--ease), transform .1s var(--ease);
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.on { color: var(--star); }
.icon-btn.on .ic { fill: currentColor; }
.icon-btn-sm { width: 26px; height: 26px; border-radius: 7px; }

.icon-a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: var(--r-md);
    color: var(--ink-2);
    text-decoration: none;
}
.icon-a:hover { background: var(--hover); color: var(--ink); }

/* ------------------------------ 表单 ------------------------------ */
.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field input {
    height: 44px;
    padding: 0 13px;
    border: 1px solid var(--line-2);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 14.5px;
    transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.field input:hover { border-color: var(--ink-3); }
.field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
.field input::placeholder { color: var(--ink-3); }
.form-inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 4px; }
.field-grow { flex: 1 1 260px; margin-bottom: 0; }

/* ------------------------------ 提示条 ------------------------------ */
.alert {
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13.5px;
    line-height: 1.6;
    margin: 0 0 16px;
}
.alert-error { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-ink); }
.alert-ok { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-strong); }

/* ------------------------------ 品牌 ------------------------------ */
.brand-mark { flex: 0 0 auto; }

/* ============================================================================
 *  登录 / 找回密码 / 重置密码
 * ========================================================================== */
.auth {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-shell {
    width: 100%;
    max-width: 1040px;
    display: grid;
    grid-template-columns: 1.02fr 1fr;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(28, 28, 26, 0.04), 0 20px 50px rgba(28, 28, 26, 0.06);
}

.auth-shell-simple { grid-template-columns: 1fr; max-width: 470px; }
.auth-shell-simple .auth-main { padding: 34px 30px; }
.auth-shell-simple .auth-card { max-width: none; }

.auth-side {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding: 42px 38px 34px;
    background:
        radial-gradient(120% 90% at 85% -10%, rgba(12, 107, 91, 0.07), transparent 55%),
        var(--surface-2);
    border-right: 1px solid var(--line);
}
@media (prefers-color-scheme: dark) {
    .auth-side {
        background:
            radial-gradient(120% 90% at 85% -10%, rgba(63, 169, 143, 0.10), transparent 55%),
            var(--surface-2);
    }
}

.auth-brand,
.auth-brand-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 17px;
    letter-spacing: -0.01em;
    color: var(--ink);
}
.auth-brand-inline { font-size: 15px; margin-bottom: 20px; }

.auth-side-note { margin: 8px 0 0; font-size: 12.5px; color: var(--ink-3); }

.auth-side-body { margin-top: 26px; }
.auth-side-body h1 {
    margin: 0 0 12px;
    font-size: clamp(25px, 2.6vw, 32px);
    font-weight: 600;
    line-height: 1.16;
    letter-spacing: -0.022em;
}
.auth-side-body p {
    margin: 0;
    max-width: 40ch;
    font-size: 14px;
    line-height: 1.7;
    color: var(--ink-2);
}
.auth-side-body code { color: var(--ink); }

.auth-facts {
    list-style: none;
    margin: auto 0 0;
    padding: 0;
    display: grid;
    gap: 9px;
    font-size: 12.5px;
    color: var(--ink-3);
}
.auth-facts li { display: flex; align-items: center; gap: 9px; }
.auth-facts li::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 2px;
    background: var(--accent);
    opacity: 0.55;
    flex: 0 0 auto;
}

.auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 42px 38px;
}
.auth-card { width: 100%; max-width: 360px; }

.auth-card-head { margin-bottom: 20px; }
.auth-card-head h2 { margin: 0 0 5px; font-size: 21px; font-weight: 600; letter-spacing: -0.015em; }
.auth-card-head p { margin: 0; font-size: 13px; color: var(--ink-3); }

.auth-links {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    font-size: 13px;
}
.auth-links a { color: var(--ink-2); text-decoration: none; }
.auth-links a:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; }
.auth-links-row { justify-content: center; gap: 22px; }

.auth-foot { margin: 24px 0 0; font-size: 12px; color: var(--ink-3); text-align: center; }

@media (max-width: 760px) {
    .auth { padding: 0; align-items: stretch; }
    .auth-shell { border: 0; border-radius: 0; max-width: none; box-shadow: none; min-height: 100vh; min-height: 100dvh; }
    .auth-shell, .auth-shell-simple { grid-template-columns: 1fr; }
    .auth-side { border-right: 0; border-bottom: 1px solid var(--line); padding: 28px 22px 24px; gap: 18px; }
    .auth-side-body { margin-top: 6px; }
    .auth-side-body h1 { font-size: 23px; }
    .auth-facts { display: none; }
    .auth-main { padding: 26px 22px 40px; align-items: flex-start; }
    .auth-card { max-width: none; }
}

/* ============================================================================
 *  普通页面（账号设置）
 * ========================================================================== */
.page { min-height: 100vh; min-height: 100dvh; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 58px;
    padding: 0 22px;
    background: var(--topbar-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.topbar-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
}
.topbar-nav { display: flex; gap: 2px; }
.topbar-nav a {
    padding: 7px 12px;
    border-radius: 9px;
    font-size: 13.5px;
    color: var(--ink-2);
    text-decoration: none;
    transition: background-color .16s var(--ease), color .16s var(--ease);
}
.topbar-nav a:hover { background: var(--hover); color: var(--ink); }
.topbar-nav a.on { background: var(--accent-soft); color: var(--accent-strong); font-weight: 500; }

.content { max-width: 700px; margin: 0 auto; padding: 30px 20px 90px; }

.page-head { margin-bottom: 20px; }
.page-head h1 { margin: 0 0 4px; font-size: 22px; font-weight: 600; letter-spacing: -0.018em; }
.page-head p { margin: 0; font-size: 13.5px; color: var(--ink-3); }

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 20px;
    margin-bottom: 16px;
}
.panel-head { margin-bottom: 12px; }
.panel-head h2 { margin: 0 0 3px; font-size: 15px; font-weight: 600; }
.panel-head p { margin: 0; font-size: 12.5px; line-height: 1.65; color: var(--ink-3); }
.panel-note { margin: 10px 0 0; font-size: 12.5px; line-height: 1.65; color: var(--ink-3); }
.panel-quiet { background: transparent; border-style: dashed; }
.panel-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.panel-row-title { margin: 0 0 2px !important; }

.kv { display: grid; margin: 0; }
.kv-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13.5px;
}
.kv-row:last-child { border-bottom: 0; }
.kv dt { color: var(--ink-3); flex: 0 0 auto; }
.kv dd { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; text-align: right; }
.kv dd code {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 2px 8px;
    font-size: 12.5px;
    word-break: break-all;
}

.tag {
    display: inline-flex;
    align-items: center;
    font-size: 11.5px;
    padding: 2px 9px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--ink-3);
}
.tag-locked { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-ink); }

.copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--ink-3);
    cursor: pointer;
    transition: color .16s var(--ease), background-color .16s var(--ease);
}
.copy-btn:hover { color: var(--ink); background: var(--hover); }
.copy-btn.copied { color: var(--accent-strong); }

@media (max-width: 520px) {
    .content { padding: 22px 14px 70px; }
    .kv-row { flex-direction: column; align-items: flex-start; gap: 4px; }
    .kv dd { justify-content: flex-start; text-align: left; }
}

/* ============================================================================
 *  收件箱控制台
 * ========================================================================== */
.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }

.mobile-bar { display: none; }

.app-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 236px minmax(300px, 372px) minmax(0, 1fr);
    /* 关键：单行严格占满容器高度，不被内容撑高（否则内部滚动失效） */
    grid-template-rows: minmax(0, 1fr);
}

/* ------------------------------ 侧栏 ------------------------------ */
.side {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    padding: 16px 12px 12px;
    background: var(--side-bg);
    border-right: 1px solid var(--line);
}

.side-top { padding: 2px 6px; }

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
    text-decoration: none;
}

.account-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    min-width: 0;
}
.avatar {
    flex: 0 0 auto;
    width: 34px; height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-md);
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 14px;
    font-weight: 600;
}
.account-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.account-name { font-size: 13.5px; font-weight: 600; }
.account-addr {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink-3);
    font: inherit;
    font-size: 11.5px;
    text-align: left;
    cursor: pointer;
    min-width: 0;
    border-radius: 5px;
}
.account-addr span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.account-addr:hover { color: var(--accent-strong); }
.account-addr.copied { color: var(--accent-strong); }

.folders { display: grid; gap: 2px; }
.folder {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: var(--r-md);
    background: transparent;
    color: var(--ink-2);
    font: inherit;
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
    transition: background-color .16s var(--ease), color .16s var(--ease);
}
.folder:hover:not(.on) { background: var(--hover); }
.folder.on { background: var(--accent-soft); color: var(--accent-strong); font-weight: 500; }
.folder .ic { opacity: 0.85; }
.folder.on .ic { opacity: 1; }

.badge {
    margin-left: auto;
    min-width: 20px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 11px;
    text-align: center;
}
.count { margin-left: auto; font-size: 11.5px; color: var(--ink-3); }

.side-foot { margin-top: auto; display: grid; gap: 12px; padding: 0 6px 2px; }
.sync-status { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-3); }
.sync-status .ic { opacity: 0.75; }
.sync-status.warn { color: var(--danger); }
.side-links { display: flex; gap: 16px; font-size: 12.5px; }
.side-links a { color: var(--ink-3); text-decoration: none; }
.side-links a:hover { color: var(--accent-strong); }

/* ------------------------------ 邮件列表 ------------------------------ */
.list-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: var(--surface);
    border-right: 1px solid var(--line);
    position: relative;
}

.list-head {
    display: grid;
    gap: 11px;
    padding: 14px 16px 11px;
    border-bottom: 1px solid var(--line);
}
.list-head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.list-head h1 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.012em; }
.list-head-actions { display: flex; gap: 4px; }

.search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface-2);
    color: var(--ink-3);
    transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background-color .16s var(--ease);
}
.search:focus-within {
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
.search input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: none;
    outline: none;
    font: inherit;
    font-size: 13.5px;
    color: var(--ink);
}
.search input::placeholder { color: var(--ink-3); }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink-3);
    cursor: pointer;
}
.search-clear:hover { background: var(--hover); color: var(--ink); }

.chips { display: flex; align-items: center; gap: 6px; }
.chip {
    height: 28px;
    padding: 0 12px;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    background: transparent;
    color: var(--ink-2);
    font: inherit;
    font-size: 12.5px;
    cursor: pointer;
    transition: background-color .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip-quiet { border-color: transparent; color: var(--ink-3); }
.chip-quiet:hover { color: var(--ink); border-color: transparent; background: var(--hover); }
.chip-right { margin-left: auto; }

.new-mail-chip {
    position: absolute;
    top: 128px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
    padding: 7px 15px;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font: inherit;
    font-size: 12.5px;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(10, 81, 69, 0.28);
}
.new-mail-chip:hover { background: var(--accent-hover); }

.list { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }

.row {
    position: relative;
    display: flex;
    gap: 10px;
    padding: 11px 40px 11px 12px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    transition: background-color .14s var(--ease);
}
.row:hover { background: var(--surface-2); }
.row.current { background: var(--accent-soft); }
.row.kbd { outline: 2px solid var(--focus-ring); outline-offset: -2px; }

.row-dot {
    flex: 0 0 auto;
    width: 7px; height: 7px;
    margin-top: 6px;
    border-radius: 50%;
    background: transparent;
}
.row.unread .row-dot { background: var(--accent); }

.row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }

.row-l1 { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.row-from {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink);
}
.row.unread .row-from { font-weight: 600; }
.row-time { flex: 0 0 auto; font-size: 11px; color: var(--ink-3); }

.row-l2 { min-width: 0; }
.row-subject {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13px;
    color: var(--ink-2);
}
.row.unread .row-subject { color: var(--ink); font-weight: 500; }

.row-l3 { display: flex; align-items: center; gap: 6px; min-width: 0; }
.row-preview {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 12px;
    color: var(--ink-3);
}
.row-clip { color: var(--ink-3); }

.row-star {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-3);
    opacity: 0;
    cursor: pointer;
    transition: opacity .14s var(--ease), color .14s var(--ease), background-color .14s var(--ease);
}
.row:hover .row-star, .row-star:focus-visible { opacity: 1; }
.row-star:hover { background: var(--hover); color: var(--star); }
.row-star.on { opacity: 1; color: var(--star); }
.row-star.on .ic { fill: currentColor; }

/* 骨架屏 */
.row-skeleton { display: flex; gap: 10px; pointer-events: none; }
.sk {
    display: inline-block;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: sk-shimmer 1.5s linear infinite;
}
.sk-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; }
.sk-dot-space { width: 0; }
.sk-lines { flex: 1; display: grid; gap: 8px; padding-top: 2px; }
.sk-l1 { height: 12px; width: 38%; }
.sk-l2 { height: 12px; width: 74%; }
.sk-l3 { height: 11px; width: 90%; }
@keyframes sk-shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* 空状态 */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 70px 28px;
    text-align: center;
}
.empty-ic { width: 36px; height: 36px; color: var(--ink-3); opacity: 0.55; }
.empty h3 { margin: 6px 0 0; font-size: 14.5px; font-weight: 600; color: var(--ink-2); }
.empty p { margin: 0; max-width: 36ch; font-size: 12.5px; line-height: 1.65; color: var(--ink-3); }

.list-foot {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 46px;
    padding: 8px 16px;
    border-top: 1px solid var(--line);
    background: var(--surface);
}
.list-total { font-size: 11.5px; color: var(--ink-3); }
.list-hint { margin-left: auto; font-size: 11px; color: var(--ink-3); opacity: 0.75; }

/* ------------------------------ 阅读器 ------------------------------ */
.reader-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: var(--surface);
}

.reader-empty { display: none; }

.reader-head {
    display: grid;
    gap: 9px;
    padding: 14px 18px 0;
    border-bottom: 1px solid var(--line);
}
.reader-row { display: flex; align-items: flex-start; gap: 10px; }
.reader-back { margin-top: 1px; }
.reader-subject {
    flex: 1;
    min-width: 0;
    margin: 3px 0 0;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.012em;
    word-break: break-word;
}
.reader-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }

.reader-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    font-size: 12.5px;
    color: var(--ink-3);
    padding-bottom: 2px;
}
.reader-meta .meta-strong { color: var(--ink); font-weight: 500; }

.reader-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid var(--line);
}
.chip-static {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border: 1px solid var(--accent-line);
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 11.5px;
}

.view-toggle { display: inline-flex; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; }
.view-toggle .seg {
    padding: 5px 12px;
    border: 0;
    background: transparent;
    color: var(--ink-2);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}
.view-toggle .seg.on { background: var(--ink); color: var(--surface); }

.meta-toggle {
    margin-left: auto;
    padding: 4px 2px;
    border: 0;
    background: none;
    color: var(--ink-3);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}
.meta-toggle:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.reader-details {
    display: grid;
    gap: 6px;
    padding: 10px 0 13px;
    border-top: 1px solid var(--line);
}
.detail-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.detail-k { flex: 0 0 118px; font-size: 12px; color: var(--ink-3); }
.detail-v {
    flex: 1;
    min-width: 0;
    font-size: 11.5px;
    color: var(--ink-2);
    word-break: break-all;
}
.detail-note { margin: 4px 0 0; font-size: 11.5px; line-height: 1.6; color: var(--ink-3); }

.reader-body { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface-2); }

.frame-wrap { position: relative; flex: 1; min-height: 0; display: flex; }
.mail-frame {
    flex: 1;
    width: 100%;
    height: 100%;
    border: 0;
    background: #FFFFFF;
}
.frame-skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
    background-size: 200% 100%;
    animation: sk-shimmer 1.5s linear infinite;
}
.frame-wrap:not(.loading) .frame-skeleton { display: none; }
.frame-wrap.loading .mail-frame { opacity: 0; }

.mail-text {
    flex: 1;
    min-height: 0;
    margin: 0;
    padding: 22px 24px;
    overflow: auto;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--ink);
    background: var(--surface);
}

/* ------------------------------ 浮层提示 ------------------------------ */
.toasts {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    max-width: 92vw;
}
.toast {
    max-width: 100%;
    padding: 9px 16px;
    border-radius: 999px;
    background: var(--ink);
    color: var(--bg);
    font-size: 13px;
    box-shadow: 0 10px 26px rgba(28, 28, 26, 0.22);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .24s var(--ease), transform .24s var(--ease);
}
.toast.in { opacity: 1; transform: none; }
.toast-ok { background: var(--accent); color: var(--accent-ink); }
.toast-error { background: var(--danger); color: #FFFFFF; }

/* ------------------------------ 响应式 ------------------------------ */
@media (min-width: 1100px) {
    .reader-back { display: none; }
    .reader-pane:not(.has-mail) .reader-head,
    .reader-pane:not(.has-mail) .reader-body { display: none; }
    .reader-pane:not(.has-mail) .reader-empty {
        display: flex;
        flex: 1;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 40px 30px;
        text-align: center;
        color: var(--ink-3);
    }
    .reader-empty h3 { margin: 6px 0 0; font-size: 15px; font-weight: 600; color: var(--ink-2); }
    .reader-empty p { margin: 0; font-size: 12.5px; line-height: 1.65; max-width: 40ch; }
}

@media (max-width: 1099px) {
    .app-grid { grid-template-columns: 236px minmax(0, 1fr); }
    .reader-pane {
        position: fixed;
        inset: 0;
        z-index: 50;
        transform: translateX(102%);
        transition: transform .3s var(--ease);
        box-shadow: -24px 0 60px rgba(28, 28, 26, 0.16);
    }
    .reader-pane.open { transform: none; }
    .reader-back { display: inline-flex; }
}

@media (max-width: 760px) {
    .mobile-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 8px 12px;
        background: var(--surface);
        border-bottom: 1px solid var(--line);
        position: relative;
        z-index: 10;
    }
    .brand-mini {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px; height: 36px;
        color: var(--accent-strong);
        border-radius: var(--r-md);
        text-decoration: none;
    }
    .seg-group {
        display: flex;
        gap: 2px;
        padding: 2px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: var(--surface-2);
    }
    .seg-m {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px; height: 32px;
        border: 0;
        border-radius: 9px;
        background: transparent;
        color: var(--ink-3);
        cursor: pointer;
    }
    .seg-m.on { background: var(--surface); color: var(--accent-strong); box-shadow: 0 1px 2px rgba(28, 28, 26, 0.08); }
    .app-grid { grid-template-columns: 1fr; }
    .side { display: none; }
    .list-pane { border-right: 0; }
    .list-hint { display: none; }
    .new-mail-chip { top: 118px; }
}

/* ------------------------------ 动效克制 ------------------------------ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .sk, .frame-skeleton { animation: none; }
}

/* ============================================================================
 *  批量选择 + 页码分页（v2 补充）
 * ========================================================================== */

/* 修复：类样式里的 display 会覆盖 hidden 属性的 UA 规则，这里统一兜底 */
[hidden] { display: none !important; }

/* 行内复选框 */
.row-check {
    flex: 0 0 auto;
    width: 15px; height: 15px;
    margin: 6px 0 0;
    accent-color: var(--accent);
    cursor: pointer;
    opacity: 0;
    transition: opacity .14s var(--ease);
}
.row:hover .row-check, .row.checked .row-check, .row-check:focus-visible { opacity: 1; }
@media (hover: none) { .row-check { opacity: 1; } }
.row.checked { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--accent); }

/* 批量操作条 */
.batch-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}
.batch-count { font-size: 12.5px; color: var(--ink-2); }
.batch-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.batch-btn {
    height: 28px;
    padding: 0 10px;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink-2);
    font: inherit; font-size: 12px;
    cursor: pointer;
    transition: background-color .14s var(--ease), color .14s var(--ease), border-color .14s var(--ease);
}
.batch-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.batch-btn.danger { color: var(--danger); border-color: var(--danger-line); }
.batch-btn.danger:hover { background: var(--danger-soft); }
.batch-btn.armed { background: var(--danger-soft); border-color: var(--danger); }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; user-select: none; }
.check-inline input { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; }

/* 批量栏可见时，把“新邮件”提示条往下推 */
.batch-bar:not([hidden]) ~ .new-mail-chip { top: 170px; }

/* 页码分页 */
.pager { display: flex; align-items: center; gap: 8px; }
.pg-btn {
    width: 26px; height: 26px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line-2);
    border-radius: 7px;
    background: transparent;
    color: var(--ink-2);
    font: inherit; font-size: 15px; line-height: 1;
    cursor: pointer;
    transition: background-color .14s var(--ease), color .14s var(--ease);
}
.pg-btn:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.pg-btn:disabled { opacity: .35; cursor: default; }
.pg-info { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }

/* ============================================================================
 *  阅读器页眉：刘海屏安全区 + 手机/矮屏紧凑化（v3）
 *  ----------------------------------------------------------------------------
 *  手机竖屏页眉从 ~195px 压缩到 ~110px；横屏（矮屏）同样生效，避免“页眉
 *  占据上半屏”的感觉。邮箱正文区域不受影响，仍从页眉正下方开始。
 * ========================================================================== */

/* 安全区（viewport-fit=cover）：刘海/挖孔屏下避免顶栏内容被状态栏遮住 */
.mobile-bar { padding: calc(8px + env(safe-area-inset-top)) 12px 8px; }
.reader-head { padding-top: calc(14px + env(safe-area-inset-top)); }
.topbar { padding-top: env(safe-area-inset-top); height: calc(58px + env(safe-area-inset-top)); }

@media (max-width: 760px), (max-height: 540px) {
    .reader-head {
        padding: calc(8px + env(safe-area-inset-top)) 14px 0;
        gap: 5px;
    }
    .reader-subject {
        font-size: 15.5px;
        line-height: 1.3;
        margin-top: 1px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .reader-meta {
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 12px;
        padding-bottom: 0;
    }
    .reader-meta > span { margin-right: 12px; }
    .reader-toolbar { padding: 5px 0; gap: 8px; }
    .chip-static { padding: 2px 8px; font-size: 11px; }
    .view-toggle .seg { padding: 4px 10px; font-size: 11.5px; }
    .meta-toggle { font-size: 11.5px; padding: 3px 2px; }
    .reader-details { padding: 8px 0 10px; }
}

/* 登录页人机验证 */
.ts { margin: 16px 0 4px; min-height: 65px; }
.ts-hint { font-size: 12px; color: var(--ink-3); margin: 8px 2px 0; text-align: center; }

/* 公告弹窗 */
.ann-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(20, 20, 18, 0.45);
}
.ann-card {
    width: min(560px, 100%);
    max-height: min(82dvh, 620px);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    animation: annIn 0.18s var(--ease);
}
@keyframes annIn {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}
.ann-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
}
.ann-badge {
    flex: 0 0 auto;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    color: var(--accent-strong);
    font-size: 11px;
}
.ann-title {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    word-break: break-word;
}
.ann-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 15px 16px;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--ink-2);
}
.ann-foot { padding: 12px 16px; border-top: 1px solid var(--line); }
