:root {
color-scheme: dark;
--bg: #15181d;
--panel: #1c2027;
--hover: #262c34;
--border: #2f353e;
--text: #e2e6eb;
--muted: #99a1ad;
--accent: #5aa2ff;
--unread: #1f2836;
--danger: #d9736e;
}
* { box-sizing: border-box; }
body {
margin: 0;
font: 14px/1.5 -apple-system, "Segoe UI", "Noto Sans CJK SC", sans-serif;
color: var(--text);
background: var(--bg);
}
header {
display: flex;
align-items: center;
gap: 10px;
padding: 10px 16px;
background: var(--panel);
border-bottom: 1px solid var(--border);
}
.brand {
display: inline-flex;
align-items: center;
gap: 6px;
font-weight: 700;
font-size: 16px;
}
源图 256×256,缩到 20px 显示;圆角让它的视觉重量与旁边的按钮接近一些。
宽高属性写在 HTML 上,图片加载前也不会引起顶栏跳动。 */
.brand-icon {
flex: none;
width: 20px;
height: 20px;
border-radius: 4px;
object-fit: contain;
}
header input[type="search"] { flex: 1; max-width: 420px; }
nav { margin-left: auto; display: flex; gap: 4px; }
.user-menu { position: relative; }
#btn-user { display: inline-flex; align-items: center; gap: 4px; }
.user-caret { font-size: 10px; color: var(--muted); }
#user-dropdown {
position: absolute;
right: 0;
top: calc(100% + 6px);
min-width: 132px;
padding: 4px;
display: flex;
flex-direction: column;
background: var(--panel);
border: 1px solid var(--border);
border-radius: 6px;
box-shadow: 0 6px 20px rgba(0, 0, 0, .28);
z-index: 150;
}
#user-dropdown > button {
border: none;
background: none;
text-align: left;
padding: 7px 10px;
border-radius: 4px;
}
#user-dropdown > button:hover { background: var(--hover); }
半透明白在任何面板色上都稳定可见。
flex:none 是防御——父级是 column flex,1px 高的元素在空间紧张时
会被压成 0,那看起来就跟没画一样。 */
#user-dropdown .menu-separator {
flex: none;
height: 1px;
margin: 5px 8px;
background: rgba(255, 255, 255, .16);
}
button, input, select, textarea {
font: inherit;
padding: 6px 10px;
border: 1px solid var(--border);
border-radius: 6px;
background: var(--panel);
color: var(--text);
}
button { cursor: pointer; }
button:hover { border-color: var(--accent); }
.tab.active { background: var(--accent); color: #10151c; border-color: var(--accent); }
main { display: flex; height: calc(100vh - 53px); }
#sidebar {
width: 220px;
flex: none;
overflow-y: auto;
background: var(--panel);
border-right: 1px solid var(--border);
padding: 10px;
}
#sidebar .account {
display: flex; align-items: center; gap: 6px;
width: 100%; text-align: left; font-weight: 600;
border: none; background: none; padding: 6px 8px; border-radius: 5px;
margin: 12px 0 4px;
}
#sidebar .account:first-child { margin-top: 0; }
#sidebar .account:hover { background: var(--hover); }
#sidebar .twisty { flex: none; width: 12px; text-align: center; color: var(--muted); }
#sidebar .folder {
display: block; width: 100%; text-align: left;
border: none; background: none; padding: 4px 8px 4px 22px; border-radius: 5px;
}
#sidebar .folder:hover { background: var(--hover); }
#sidebar .folder.active { background: var(--unread); color: var(--accent); }
@keyframes mmail-spin { to { transform: rotate(360deg); } }
这样按钮宽度和点击区域都不受影响 */
#btn-sync.loading::before {
content: '';
display: inline-block;
width: 11px; height: 11px;
margin-right: 6px;
border: 2px solid currentColor;
border-top-color: transparent;
border-radius: 50%;
vertical-align: -1px;
animation: mmail-spin .7s linear infinite;
}
这里跟着右浮;margin-top 用来在 18px 高的行里与徽标对齐 */
#sidebar .folder .folder-spinner {
float: right;
width: 11px; height: 11px;
margin: 4px 0 0 6px;
border: 2px solid var(--muted);
border-top-color: transparent;
border-radius: 50%;
animation: mmail-spin .7s linear infinite;
}
它是目录索引不是账户名,不能在视觉上跟账户平级 */
#sidebar .account.other-group {
font-weight: 500;
font-size: 12px;
margin: 6px 0 2px;
color: var(--muted);
}
#sidebar .subfolder-group .folder { padding-left: 36px; }
账户行是 flex,用 margin-left:auto 顶到最右;文件夹行是 block,只能 float 右浮。
分成两条是为了不去改动上面已有的 display 属性。 */
.unread-badge {
flex: none;
min-width: 18px; height: 18px;
padding: 0 5px;
border-radius: 9px;
background: var(--accent);
color: #fff;
font-size: 11px; font-weight: 600;
line-height: 18px; text-align: center;
}
#sidebar .account .unread-badge { margin-left: auto; }
#sidebar .folder .unread-badge { float: right; }
否则它和上一个账户最后的文件夹连成一片,看不出是另一层 */
#sidebar .folder.unread-root {
padding-left: 12px;
margin-bottom: 6px;
font-weight: 600;
}
差别不小(有的按全角算),不固定的话每行文件夹名的起点会参差不齐。
字号略小于正文,免得图标比文字还抢眼。 */
#sidebar .folder .folder-icon {
display: inline-block;
width: 18px;
margin-right: 2px;
text-align: center;
font-size: 13px;
}
#context-menu {
position: fixed;
z-index: 200;
min-width: 168px;
padding: 4px;
background: var(--panel);
border: 1px solid var(--border);
border-radius: 6px;
box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
#context-menu .menu-item {
display: block; width: 100%;
text-align: left; font: inherit; color: inherit;
border: none; background: none;
padding: 7px 10px; border-radius: 4px;
}
#context-menu .menu-item:hover { background: var(--hover); }
#context-menu .menu-separator {
height: 1px; margin: 4px 6px; background: var(--border);
}
.splitter {
flex: none;
width: 5px;
background: var(--border);
cursor: col-resize;
transition: background .12s;
}
.splitter:hover, .splitter.dragging { background: var(--accent); }
body.resizing { user-select: none; cursor: col-resize; }
.view { flex: 1; display: flex; min-width: 0; }
.view.hidden, .hidden { display: none !important; }
#list-pane {
width: 400px; flex: none; overflow-y: auto;
background: var(--panel);
}
#message-list {
list-style: none; margin: 0;
padding: 8px;
display: flex; flex-direction: column; gap: 8px;
}
#message-list li {
padding: 8px;
border: 1px solid var(--border);
border-radius: 6px;
background: var(--bg);
cursor: pointer;
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
gap: 1px 8px;
line-height: 1.35;
}
#message-list li:hover { background: var(--hover); border-color: var(--accent); }
#message-list li.unread { background: var(--unread); box-shadow: inset 3px 0 0 var(--accent); }
#message-list li.active { outline: 2px solid var(--accent); outline-offset: -2px; }
#message-list .subject {
font-weight: 600;
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#message-list li.unread .subject { font-weight: 700; }
做成圆形小徽标而不是纯文字:主题过长被省略号截断时,它仍然占住固定位置。
四档都要看得出来——少了「未验证」,用户会把没做的检查当成通过了的。 */
#message-list .auth-badge {
display: inline-flex;
align-items: center;
justify-content: center;
flex: none;
width: 14px; height: 14px;
margin-right: 5px;
border-radius: 50%;
font-size: 10px;
font-weight: 700;
line-height: 1;
vertical-align: -1px;
cursor: help;
}
#message-list .auth-verified { background: #1e4d34; color: #7ee2a8; }
#message-list .auth-suspicious { background: #57430f; color: #e8c266; }
#message-list .auth-failed { background: #5c1f1c; color: #f0a09b; }
#message-list .auth-unverified { background: #2b3038; color: #8b939f; }
#message-list .time {
color: var(--muted); font-size: 12px; white-space: nowrap;
}
#message-list .meta,
#message-list .preview {
grid-column: 1 / -1;
color: var(--muted); font-size: 12.5px;
}
#message-list .meta {
font-size: 12px;
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#message-list .who { color: var(--text); }
#message-list .addr { color: var(--muted); }
#message-list .preview {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
#pager { padding: 0 8px 8px; display: flex; gap: 6px; align-items: center; justify-content: center; }
#detail-pane { flex: 1; overflow-y: auto; padding: 16px; background: var(--panel); min-width: 0; }
主题用 flex:1 + min-width:0,长主题才会正常换行而不是把按钮挤出去 */
#detail .detail-head {
display: flex;
align-items: flex-start;
gap: 12px;
margin-bottom: 6px;
}
#detail .detail-head h2 { flex: 1; min-width: 0; margin: 0; }
#detail .detail-head .btn-reply,
#detail .detail-head .btn-edit { flex: none; }
#detail .meta { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
#detail .auth {
font-size: 12px; color: var(--muted); border: 1px dashed var(--border);
padding: 6px 8px; border-radius: 5px; margin-bottom: 12px; word-break: break-all;
}
#detail .body { border-top: 1px solid var(--border); padding-top: 12px; }
而不是一行让人不敢点的下划线链接。全局 button 样式自带边框与悬停色,
这里只补与下方正文的间距 */
#show-images { margin-bottom: 10px; }
.mail-frame {
display: block;
width: 100%;
min-height: 120px;
border: 0;
}
.attachments { margin: 12px 0; }
.attachments a { display: inline-block; margin-right: 8px; color: var(--accent); }
.empty { color: var(--muted); padding: 16px; }
.panel { flex: 1; padding: 16px; overflow-y: auto; }
.stack { display: flex; flex-direction: column; gap: 8px; max-width: 560px; }
.row { display: flex; gap: 8px; align-items: center; }
.hint { color: var(--muted); font-size: 13px; }
.hint.error {
color: var(--danger);
}
.meta.warning {
color: var(--danger);
}
.link-button {
background: none;
border: none;
padding: 0;
font-size: inherit;
color: var(--accent);
text-decoration: underline;
}
.link-button:disabled {
color: var(--muted);
text-decoration: none;
}
它和版本条是一个信息块,中间再切一刀就碎了 */
.storage-bar {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
margin: 0 0 6px;
}
否则「当前版本 + 检查更新」会看起来像另一个设置项 */
.version-bar {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
margin: 0 0 14px;
padding-bottom: 12px;
border-bottom: 1px solid var(--border);
}
.version-label {
color: var(--muted);
font-size: 13px;
}
.version-bar code {
font-size: 13px;
color: var(--text);
}
a { color: var(--accent); }
.setting-card {
border: 1px solid var(--border);
border-radius: 8px;
padding: 14px;
margin: 12px 0;
max-width: 680px;
}
.setting-card h3 { margin: 0 0 6px; font-size: 15px; }
.setting-card code {
background: var(--bg);
border: 1px solid var(--border);
border-radius: 4px;
padding: 2px 6px;
font-size: 12.5px;
word-break: break-all;
}
#account-list, #contact-list { list-style: none; padding: 0; margin-top: 16px; }
宽屏下那行「邮箱 · 认证方式 · 上次同步」被硬挤成两三行,右侧还空着
一大片——列表项本来就是 flex 行,宽度给足就不会折。
contact-list 保留原上限:联系人条目短,铺满全宽反而把姓名和按钮拉开。 */
#contact-list { max-width: 560px; }
#account-list li, #contact-list li {
display: flex; align-items: center; gap: 8px;
padding: 8px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 6px;
}
#account-list .spacer, #contact-list .spacer { margin-left: auto; }
#account-list input.account-name { padding: 3px 8px; max-width: 260px; }
#compose {
position: fixed; right: 24px; bottom: 24px; width: 520px;
background: var(--panel); border: 1px solid var(--border);
border-radius: 10px; padding: 16px; box-shadow: 0 8px 28px rgba(0,0,0,.55);
max-height: 80vh; overflow-y: auto;
}
#compose h2 { margin: 0 0 8px; font-size: 16px; }
#compose-status {
display: inline-flex;
align-items: center;
gap: 6px;
color: var(--muted);
font-size: 13px;
}
不只是禁用行为,视觉上也要一眼看出点不了 */
#compose-form button:disabled {
opacity: .5;
cursor: not-allowed;
}
这里是常规行内场景,直接给个类复用同一套动画 */
.spinner {
flex: none;
width: 11px; height: 11px;
border: 2px solid currentColor;
border-top-color: transparent;
border-radius: 50%;
animation: mmail-spin .7s linear infinite;
}
#toast {
position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
background: var(--panel); color: var(--text); padding: 10px 16px; border-radius: 6px;
border: 1px solid var(--border); box-shadow: 0 4px 16px rgba(0,0,0,.5);
}
用固定的全屏遮罩而不是单独的 login 页面:
邮件数据只在通过 API 校验之后才会被取回来,登录前后渲染的是同一个 SPA,
所以即便遮罩意外失效,底下也只是一层空壳,不会漏出任何邮件内容。 */
.overlay {
position: fixed; inset: 0; z-index: 50;
display: flex; align-items: center; justify-content: center;
background: var(--bg);
}
.overlay form {
width: 340px; padding: 24px;
background: var(--panel); border: 1px solid var(--border);
border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.55);
}
.overlay h2 { margin: 0 0 4px; font-size: 18px; }
.overlay .hint { margin-top: 0; }
#current-user { color: var(--muted); white-space: nowrap; }
code {
font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
font-size: .92em;
padding: 1px 5px; border-radius: 4px;
background: var(--hover); border: 1px solid var(--border);
}
原则:桌面样式零改动。下面只有两类东西——
1. 桌面上 display:none 的新元素(手机专用按钮、FAB、返回键);
2. 一个 @media (max-width: 768px) 块,断点与 app.js 的 mobileQuery 一致。
手机上「哪个窗格可见」由 body[data-pane](list / folders / detail)决定,
该属性由 app.js 的 showMobilePane 写入;桌面端媒体查询不匹配,属性留着也无碍。 */
.mobile-only, .mobile-fab { display: none; }
.btn-back { display: none; }
@media (max-width: 768px) {
html { touch-action: manipulation; }
header 在手机上可能是一行也可能两行(搜索展开时),
写死 calc(100vh - 53px) 会错位。dvh 随地址栏收起而收缩,是真实视口 */
body {
display: flex;
flex-direction: column;
height: 100vh;
height: 100dvh;
}
main { flex: 1; height: auto; min-height: 0; display: flex; }
.view { height: 100%; }
body[data-pane="folders"] #mail-view { display: none; }
body[data-pane="list"] #detail-pane { display: none; }
body[data-pane="detail"] #list-pane { display: none; }
.splitter { display: none !important; }
三栏里的常驻列在单栏模式下没有位置 */
#sidebar { display: none; }
body[data-pane="folders"] #sidebar {
display: block;
width: auto;
height: 100%;
flex: 1;
}
#list-pane, #detail-pane { width: auto; flex: 1; }
#detail-pane { padding: 12px; padding-top: max(12px, env(safe-area-inset-top)); }
#list-pane, #detail-pane, #sidebar, .panel, #compose {
overscroll-behavior: contain;
}
header {
flex-wrap: wrap;
padding: 8px max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left));
}
.mobile-only { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; }
.brand-text { display: none; }
header input[type="search"] { display: none; flex: 1 1 100%; max-width: none; order: 9; }
header.search-open input[type="search"] { display: block; }
nav, #btn-sync, #btn-compose { display: none; }
#btn-search { margin-left: auto; }
input, select, textarea { font-size: 16px; }
#message-list li { padding: 10px; }
#message-list .preview { -webkit-line-clamp: 1; }
.btn-back { display: inline-flex; }
#detail .detail-head { flex-wrap: wrap; }
#detail .detail-head h2 { font-size: 17px; }
#compose {
inset: 0;
width: 100%;
max-height: none;
border-radius: 0;
padding: 12px;
padding-top: max(12px, env(safe-area-inset-top));
padding-bottom: max(12px, env(safe-area-inset-bottom));
}
#compose .row {
position: sticky;
bottom: 0;
background: var(--panel);
padding: 8px 0 4px;
flex-wrap: wrap;
}
.mobile-fab {
display: flex;
align-items: center;
justify-content: center;
position: fixed;
right: max(16px, env(safe-area-inset-right));
bottom: max(16px, env(safe-area-inset-bottom));
width: 52px;
height: 52px;
border-radius: 50%;
font-size: 22px;
line-height: 1;
z-index: 60;
box-shadow: 0 4px 14px rgba(0, 0, 0, .45);
}
body:has(#compose:not(.hidden)) .mobile-fab { display: none; }
.overlay form { width: min(340px, calc(100vw - 32px)); }
#toast { max-width: calc(100vw - 32px); text-align: center; }
}