/* ==========================================================================
   邮箱管理系统 · iOS 风格主题
   设计取向：iOS 17/18 的「半透明材质 + 大圆角 + 系统字体 + 发丝线」
   —— 所有面板都用 backdrop-filter 磨砂，背景是一层彩色壁纸，透出来才有层次
   —— 一切间距走 4px 栅格，基线统一，禁止零散 magic number
   ========================================================================== */

/* ============ 1. 设计令牌 ============ */
:root{
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --ease: cubic-bezier(.32,.72,0,1);
  --blur: saturate(180%) blur(26px);
  --blur-sm: saturate(180%) blur(16px);
}

:root[data-theme="dark"]{
  color-scheme: dark;
  --bg:#07080c;
  --wall:
    radial-gradient(920px 720px at 10% -14%, rgba(94,92,230,.46), transparent 62%),
    radial-gradient(780px 640px at 100% 4%,  rgba(10,132,255,.34), transparent 60%),
    radial-gradient(880px 720px at 46% 112%, rgba(255,55,95,.20), transparent 64%),
    radial-gradient(660px 540px at 2% 84%,  rgba(48,209,88,.14), transparent 60%);
  --glass:rgba(26,26,32,.60);
  --glass-strong:rgba(28,28,36,.80);
  --glass-weak:rgba(20,20,26,.42);
  --fill:rgba(120,120,128,.26);
  --fill2:rgba(120,120,128,.15);
  --fill3:rgba(120,120,128,.09);
  --hairline:rgba(255,255,255,.09);
  --sep:rgba(255,255,255,.07);
  --stroke:rgba(255,255,255,.13);
  --text:#f5f5f7;
  --text2:rgba(235,235,245,.62);
  --text3:rgba(235,235,245,.34);
  --accent:#0a84ff; --accent2:#5e5ce6;
  --accent-soft:rgba(10,132,255,.20);
  --accent-tint:rgba(10,132,255,.14);
  --danger:#ff453a; --success:#30d158; --warn:#ff9f0a;
  --shadow:0 28px 64px rgba(0,0,0,.58);
  --shadow-sm:0 12px 30px rgba(0,0,0,.32);
  --r-xs:8px; --r-sm:12px; --r-md:16px; --r-lg:22px; --r-xl:28px;
  --fs:1; /* 正文字号缩放，由 设置→字号 控制 */
  --paper:#ffffff;
}

:root[data-theme="light"]{
  color-scheme: light;
  --bg:#eef1f6;
  --wall:
    radial-gradient(920px 720px at 10% -14%, rgba(94,92,230,.26), transparent 62%),
    radial-gradient(780px 640px at 100% 4%,  rgba(10,132,255,.24), transparent 60%),
    radial-gradient(880px 720px at 46% 112%, rgba(255,55,95,.14), transparent 64%),
    radial-gradient(660px 540px at 2% 84%,  rgba(48,209,88,.12), transparent 60%);
  --glass:rgba(255,255,255,.66);
  --glass-strong:rgba(255,255,255,.82);
  --glass-weak:rgba(255,255,255,.48);
  --fill:rgba(120,120,128,.16);
  --fill2:rgba(120,120,128,.10);
  --fill3:rgba(120,120,128,.06);
  --hairline:rgba(60,60,67,.14);
  --sep:rgba(60,60,67,.10);
  --stroke:rgba(60,60,67,.16);
  --text:#111114;
  --text2:rgba(60,60,67,.62);
  --text3:rgba(60,60,67,.36);
  --accent:#007aff; --accent2:#5856d6;
  --accent-soft:rgba(0,122,255,.14);
  --accent-tint:rgba(0,122,255,.10);
  --danger:#ff3b30; --success:#34c759; --warn:#ff9500;
  --shadow:0 28px 64px rgba(30,45,80,.18);
  --shadow-sm:0 12px 30px rgba(30,45,80,.10);
  --r-xs:8px; --r-sm:12px; --r-md:16px; --r-lg:22px; --r-xl:28px;
  --paper:#ffffff;
}


/* 分段控件（设置页「字号」用） */
.seg{display:inline-flex;gap:2px;padding:3px;border-radius:11px;background:var(--fill2)}
.seg button{
  border:0;background:transparent;color:var(--text2);
  font-size:12.5px;line-height:1.2;padding:5px 10px;border-radius:8px;
  transition:background .16s ease,color .16s ease;
}
.seg button.on{background:var(--glass-strong);color:var(--text);box-shadow:0 1px 3px rgba(0,0,0,.2)}
.seg button:active{opacity:.6}

/* 字号即时预览块 */
.fs-demo{
  margin:-2px 0 12px;padding:12px 14px;border-radius:12px;
  background:var(--fill2);color:var(--text2);
  font-size:calc(14px * var(--fs));line-height:1.6;
}

/* 字号档位：只缩放「读」的部分，不缩放布局和按钮。
   ⚠️ 选择器必须写成 html:root[data-fs=…]（0,2,1）：深/浅色主题是用
   :root[data-theme="dark"]（0,2,0）定义变量的，写成 html[data-fs=…]（0,1,1）
   会被主题块压住，变量静默不生效。 */
html:root[data-fs="s"]{--fs:.92}
html:root[data-fs="m"]{--fs:1}
html:root[data-fs="l"]{--fs:1.12}
html:root[data-fs="xl"]{--fs:1.26}

/* ============ 2. 基础 ============ */
*{box-sizing:border-box}
html,body{height:100%;margin:0}
/* ⚠️ 不要给 html 加 background：壁纸是靠 body::before 的 z-index:-1 穿透到画布的，
   html 一旦有自己的背景色，body 的背景就不再向画布传播，壁纸会被 body 的实色压掉，
   整个「半透明玻璃」风格会瞬间变成一片死黑。 */
html,body{overscroll-behavior:none}
html{-webkit-text-size-adjust:100%}
body{
  background:var(--bg);
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro Display","PingFang SC","Helvetica Neue","Microsoft YaHei",sans-serif;
  font-size:15px;
  line-height:1.5;
  letter-spacing:-.01em;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  -webkit-tap-highlight-color:transparent;
  overflow:hidden;
}
/* 彩色壁纸层：固定不动，所有磨砂面板透出它才有「透明感」 */
body::before{
  content:"";
  position:fixed;
  left:0;right:0;top:0;
  /* 高度要算上 --bottom-gap：iOS 独立模式下布局视口比可视区矮的那一截也得盖住 */
  height:calc(100% + var(--bottom-gap,0px));
  background-image:var(--wall);
  background-repeat:no-repeat;
  pointer-events:none;
  z-index:-1;
}
button,input,select,textarea{font-family:inherit;font-size:16px;letter-spacing:inherit} /* 16px：iOS 聚焦不放大 */
*{touch-action:pan-x pan-y}
button{cursor:pointer;-webkit-appearance:none;appearance:none}
svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round;flex:none}
.hidden{display:none!important}
code{
  font-family:ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  background:var(--fill2);padding:2px 6px;border-radius:6px;font-size:12px;
}
::-webkit-scrollbar{width:0;height:0}
* {scrollbar-width:none}

/* ============ 3. 控件 ============ */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  height:38px;padding:0 16px;
  border:0;border-radius:var(--r-sm);
  background:var(--fill);color:var(--text);
  font-size:15px;font-weight:500;white-space:nowrap;letter-spacing:-.01em;
  transition:background .18s var(--ease),transform .18s var(--ease),opacity .18s var(--ease);
}
.btn:hover{background:var(--fill3)}
.btn:active{transform:scale(.965);opacity:.85}
.btn svg{width:17px;height:17px;stroke-width:1.9}
.btn.primary{
  background:var(--accent);color:#fff;
  box-shadow:0 6px 18px rgba(10,132,255,.28);
}
.btn.primary:hover{background:var(--accent);filter:brightness(1.08)}
.btn.danger{background:var(--fill);color:var(--danger)}
.btn.danger:hover{background:rgba(255,69,58,.14)}
.btn.ghost{background:transparent;color:var(--accent)}
.btn.ghost:hover{background:var(--accent-tint)}
.btn.icon{width:38px;padding:0;border-radius:50%}
.btn.sm{height:32px;padding:0 12px;font-size:13px;border-radius:10px}
.btn.sm.icon{width:32px}
.btn.block{width:100%;height:50px;font-size:17px;font-weight:600;border-radius:14px}
.btn:disabled{opacity:.4;pointer-events:none}

.input{
  width:100%;height:44px;padding:0 14px;
  border:1px solid transparent;border-radius:var(--r-sm);
  background:var(--fill2);color:var(--text);
  font-size:16px;outline:none;
  transition:background .18s var(--ease),border-color .18s var(--ease),box-shadow .18s var(--ease);
}
.input::placeholder{color:var(--text3)}
.input:focus{background:var(--fill);border-color:var(--accent);box-shadow:0 0 0 3.5px var(--accent-tint)}
.input.slim{height:36px;border-radius:10px;font-size:15px}
textarea.input{height:auto;min-height:130px;padding:12px 14px;resize:vertical;line-height:1.6;font-size:15px}
select.input{
  appearance:none;-webkit-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='%239aa6ba' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 13px center;padding-right:34px;
}
.field-label{display:block;margin:16px 0 7px;font-size:13px;color:var(--text2);font-weight:500;letter-spacing:0}
.hint{font-size:12.5px;color:var(--text3);margin-top:7px;line-height:1.6}
.err-text{color:var(--danger);font-size:13px;margin-top:10px}
.ok-text{color:var(--success);font-size:13px;margin-top:8px}
.divider{height:1px;background:var(--sep);margin:20px 0;border:0}

/* ============ 4. 锁屏 ============ */
.lock-screen{
  position:fixed;inset:0;z-index:50;
  display:flex;align-items:center;justify-content:center;
  padding:calc(24px + var(--safe-t)) 20px calc(24px + var(--safe-b));
  background:transparent;
}
.lock-card{
  width:100%;max-width:380px;
  padding:34px 26px 26px;
  border-radius:var(--r-xl);
  background:var(--glass-strong);
  border:1px solid var(--hairline);
  -webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);
  box-shadow:var(--shadow);
  text-align:center;
  animation:card-in .5s var(--ease);
}
@keyframes card-in{from{opacity:0;transform:translateY(14px) scale(.97)}to{opacity:1;transform:none}}
.lock-mark{
  width:58px;height:58px;margin:0 auto 16px;border-radius:17px;
  background:linear-gradient(145deg,var(--accent),var(--accent2));
  color:#fff;display:flex;align-items:center;justify-content:center;
  box-shadow:0 12px 28px var(--accent-soft);
}
.lock-mark svg{width:28px;height:28px;stroke-width:2}
.lock-card h1{font-size:22px;font-weight:700;margin:0 0 6px;letter-spacing:-.02em}
.lock-sub{color:var(--text2);font-size:13.5px;margin:0 0 22px;line-height:1.5}
.lock-card .field-label{text-align:left;margin:0 0 7px}
.lock-card form{text-align:left}
.lock-card .input{height:48px;border-radius:13px}
.lock-card .btn.block{margin-top:18px}
.lock-foot{font-size:11.5px;color:var(--text3);margin-top:18px;line-height:1.7}
#lockError{
  font-size:13.5px;font-weight:500;margin-top:14px;padding:11px 14px;
  background:rgba(255,69,58,.13);color:var(--danger);
  border-radius:12px;text-align:center;
}
#lockError:empty{display:none;padding:0;margin:0}

/* ============ 5. 主框架 ============ */
.app{
  display:flex;
  /* 不用 100dvh：iOS 独立模式下 dvh 和「视觉视口」偶尔不一致，会露底。
     用 position:fixed 钉死四边，底部再按 --bottom-gap 往下延一截（见 app.js syncBottomGap）。 */
  position:fixed;
  top:0;left:0;right:0;
  bottom:calc(-1 * var(--bottom-gap, 0px));
  padding-top:var(--safe-t);
  overflow:hidden;
}
.rail{
  width:78px;flex:none;z-index:5;
  display:flex;flex-direction:column;align-items:center;
  padding:14px 0 12px;
  background:var(--glass-weak);
  -webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);
  border-right:1px solid var(--hairline);
}
.rail-logo{
  width:40px;height:40px;border-radius:12px;margin-bottom:22px;
  overflow:hidden;
}
.rail-logo img{
  width:100%;height:100%;display:block;object-fit:cover;border-radius:12px;
}
.rail-nav{display:flex;flex-direction:column;gap:6px;width:100%;flex:1;padding:0 10px}
.rail-btn{
  position:relative;width:100%;border:0;background:transparent;color:var(--text3);
  border-radius:13px;padding:9px 0;
  display:flex;flex-direction:column;align-items:center;gap:4px;
  font-size:10.5px;font-weight:500;letter-spacing:0;
  transition:color .18s var(--ease),background .18s var(--ease);
}
.rail-btn svg{width:22px;height:22px}
.rail-btn:hover{background:var(--fill3);color:var(--text2)}
.rail-btn.active{background:var(--accent-tint);color:var(--accent)}
.rail-btn.small{padding:9px 0}
.rail-bottom{display:flex;flex-direction:column;gap:6px;width:100%;padding:0 10px}

.shell{flex:1;display:flex;flex-direction:column;min-width:0}

.topbar{
  height:56px;flex:none;z-index:10;
  display:flex;align-items:center;justify-content:space-between;gap:14px;
  padding:0 18px;
  background:var(--glass);
  -webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);
  border-bottom:1px solid var(--hairline);
}
.topbar-title{min-width:0;display:flex;flex-direction:column;justify-content:center}
.topbar-title h2{font-size:17px;font-weight:700;margin:0;letter-spacing:-.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.25}
.topbar-title span{font-size:11.5px;color:var(--text2);line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.topbar-actions{display:flex;align-items:center;gap:8px;min-width:0}
.search-wrap{width:210px}

.workspace{flex:1;display:flex;min-height:0}
.pane{overflow-y:auto;min-height:0;-webkit-overflow-scrolling:touch}
.list-pane{
  width:344px;flex:none;
  background:var(--glass-weak);
  -webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);
  border-right:1px solid var(--hairline);
}
.detail-pane{flex:1;min-width:0;background:transparent}
.tabbar{display:none}

/* ============ 6. 邮件列表 ============ */
.pane-head{
  position:sticky;top:0;z-index:3;
  padding:10px 16px;
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  font-size:12.5px;color:var(--text2);
  background:var(--glass);
  -webkit-backdrop-filter:var(--blur-sm);backdrop-filter:var(--blur-sm);
  border-bottom:1px solid var(--hairline);
}
.pane-head .chip{font-size:12px;color:var(--text2)}

.mail-item{
  position:relative;
  padding:12px 16px 13px 18px;
  cursor:pointer;
  transition:background .16s var(--ease);
}
/* 发丝分隔线：从文字左边起，不顶到边缘（iOS 分组列表的做法） */
.mail-item::after{
  content:"";position:absolute;left:18px;right:0;bottom:0;height:1px;background:var(--sep);
}
.mail-item:last-child::after{display:none}
.mail-item:hover{background:var(--fill3)}
.mail-item.active{background:var(--accent-tint)}
.mail-item.unread::before{
  content:"";position:absolute;left:6px;top:19px;
  width:7px;height:7px;border-radius:50%;background:var(--accent);
}
.mi-top{display:flex;align-items:center;gap:9px;min-width:0}
.mi-dot{width:7px;height:7px;border-radius:50%;flex:none}
.brand{
  display:inline-flex;align-items:center;justify-content:center;
  width:26px;height:26px;border-radius:8px;
  color:#fff;font-size:10px;font-weight:700;letter-spacing:-.2px;line-height:1;
  flex:none;
}
.brand.lg{width:38px;height:38px;border-radius:12px;font-size:13px}
.brand.sm{width:20px;height:20px;border-radius:6px;font-size:9px}
.brand-select{position:relative}
.brand-select-btn{
  width:100%;height:46px;padding:0 14px;
  border:1px solid transparent;border-radius:var(--r-sm);
  background:var(--fill2);color:var(--text);
  display:flex;align-items:center;gap:10px;text-align:left;font-size:16px;
  transition:background .18s var(--ease);
}
.brand-select-btn:hover{background:var(--fill)}
.brand-select-btn::after{
  content:"";width:7px;height:7px;flex:none;margin-left:auto;margin-top:-4px;
  border-right:1.8px solid var(--text3);border-bottom:1.8px solid var(--text3);
  transform:rotate(45deg);
}
.brand-select-panel{
  position:absolute;top:52px;left:0;right:0;z-index:25;
  max-height:290px;overflow-y:auto;padding:6px;
  background:var(--glass-strong);
  -webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);
  border:1px solid var(--hairline);border-radius:14px;
  box-shadow:var(--shadow);
}
.brand-option{
  width:100%;display:flex;align-items:center;gap:10px;
  padding:9px 10px;border:0;border-radius:10px;background:transparent;
  color:var(--text);text-align:left;font-size:15px;
}
.brand-option:hover{background:var(--fill3)}
.brand-option.selected{background:var(--accent-tint);color:var(--accent)}
.brand-option .bo-name{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.brand-option .bo-domain{font-size:11.5px;color:var(--text3);white-space:nowrap}

.mi-from{font-size:calc(15px * var(--fs));font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;letter-spacing:-.01em}
.mail-item.unread .mi-from{font-weight:650}
.mi-date{font-size:calc(11.5px * var(--fs));color:var(--text3);flex:none;font-variant-numeric:tabular-nums}
.mi-subject{
  font-size:calc(13.5px * var(--fs));margin:3px 0 3px;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text2);
}
.mail-item.unread .mi-subject{color:var(--text)}
.mi-meta{
  font-size:calc(11.5px * var(--fs));color:var(--text3);
  display:flex;align-items:center;gap:6px;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.mi-meta svg{width:13px;height:13px}
.tag{
  display:inline-flex;align-items:center;height:20px;padding:0 8px;
  border-radius:6px;background:var(--fill2);color:var(--text2);
  font-size:11px;white-space:nowrap;
}

/* ============ 7. 详情 ============ */
.detail-empty{
  height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:10px;padding:30px;text-align:center;color:var(--text3);
}
.detail-empty svg{width:44px;height:44px;opacity:.45;stroke-width:1.4}
.detail-empty div{font-size:14px}
.detail-wrap{padding:24px 28px 60px;max-width:860px;margin:0 auto}
.back-btn{display:none}
.detail-title{font-size:calc(22px * var(--fs));font-weight:700;margin:0 0 18px;line-height:1.35;letter-spacing:-.02em;word-break:break-word}
.detail-head{display:flex;gap:13px;align-items:flex-start;padding-bottom:16px;border-bottom:1px solid var(--sep)}
.avatar{
  width:44px;height:44px;border-radius:50%;
  background:linear-gradient(145deg,var(--accent),var(--accent2));
  color:#fff;display:flex;align-items:center;justify-content:center;
  font-weight:600;font-size:16px;flex:none;
  box-shadow:0 6px 16px var(--accent-soft);
}
.detail-head-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
.dh-line{font-size:calc(13px * var(--fs));color:var(--text2);word-break:break-all;line-height:1.5}
.dh-line strong{color:var(--text);font-weight:600}
.detail-actions{display:flex;gap:8px;flex-wrap:wrap;margin:16px 0}
.mail-body{
  margin-top:16px;overflow:hidden;
  border-radius:var(--r-md);
  border:1px solid var(--hairline);
  background:var(--paper);
  box-shadow:var(--shadow-sm);
}
.mail-body iframe{width:100%;border:0;display:block;background:var(--paper)}

/* 正文加载中的骨架屏：先把头部显示出来，正文位置给呼吸感的占位条 */
.skel-card{
  margin-top:16px;padding:20px;
  min-height:240px;
  border-radius:var(--r-md);
  background:var(--fill3);
  border:1px solid var(--hairline);
}
.sk-line{height:11px;border-radius:6px;background:var(--fill);margin-bottom:13px;animation:sk-pulse 1.2s ease-in-out infinite}
.sk-line:last-child{margin-bottom:0}
.sk-line.w96{width:96%} .sk-line.w92{width:92%} .sk-line.w84{width:84%} .sk-line.w56{width:56%}
@keyframes sk-pulse{0%,100%{opacity:.4}50%{opacity:.95}}
.plain-body{white-space:pre-wrap;word-break:break-word;font-size:calc(14px * var(--fs));line-height:1.75;padding:20px;color:#1a1a1a}

/* 译文卡片：插在正文上方，不替换原文，随时可收起 */
.trans-card{
  margin-top:16px;padding:14px 16px;
  border-radius:var(--r-md);
  background:var(--accent-tint);
  border:1px solid var(--hairline);
}
.trans-head{display:flex;align-items:center;gap:8px;margin-bottom:10px}
.trans-tag{
  flex:none;padding:2px 8px;border-radius:6px;
  background:var(--accent);color:#fff;
  font-size:11px;font-weight:600;letter-spacing:.2px;
}
.trans-note{flex:1;min-width:0;font-size:11.5px;color:var(--text2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.trans-head .btn{height:26px;padding:0 8px;font-size:12px}
.trans-body{font-size:calc(14px * var(--fs));line-height:1.8;color:var(--text);white-space:pre-wrap;word-break:break-word}
.attach-list{margin-top:16px;display:flex;flex-wrap:wrap;gap:8px}
.attach{
  display:inline-flex;align-items:center;gap:6px;
  padding:8px 12px;border-radius:10px;
  background:var(--fill2);border:1px solid transparent;
  font-size:12.5px;color:var(--text2);text-decoration:none;
  transition:background .16s var(--ease),color .16s var(--ease);
}
.attach:hover{background:var(--accent-tint);color:var(--accent)}
.attach svg{width:14px;height:14px}

/* ============ 8. 页面 / 卡片（iOS 分组列表） ============ */
.page{padding:20px 22px 60px;max-width:880px;margin:0 auto}
.page-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:16px;flex-wrap:wrap}
.page-head h3{font-size:20px;font-weight:700;margin:0;letter-spacing:-.02em;line-height:1.3}
.page-head p{font-size:13px;color:var(--text2);margin:3px 0 0;line-height:1.5}

.card{
  padding:14px 16px;
  border-radius:var(--r-md);
  background:var(--glass);
  -webkit-backdrop-filter:var(--blur-sm);backdrop-filter:var(--blur-sm);
  border:1px solid var(--hairline);
  box-shadow:var(--shadow-sm);
}
.card + .card{margin-top:12px}
.card-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.card-main{flex:1;min-width:180px}
.card-title{font-size:15px;font-weight:600;letter-spacing:-.01em;word-break:break-all}
.card-sub{font-size:12.5px;color:var(--text2);margin-top:3px;line-height:1.6}
.card-actions{display:flex;gap:8px;flex-wrap:wrap}

.notice{
  padding:13px 15px;margin-bottom:14px;
  border-radius:14px;
  background:var(--accent-tint);
  border:1px solid var(--hairline);
  font-size:12.5px;color:var(--text2);line-height:1.75;
}
.notice.warn{background:rgba(255,159,10,.12);color:var(--warn);border-color:rgba(255,159,10,.22)}
.secret{
  display:inline-block;padding:5px 10px;
  font-family:ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  font-size:13px;letter-spacing:.4px;word-break:break-all;
  background:var(--fill2);border-radius:8px;
}
.grid2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}

/* 设置行：发丝分隔线内缩，和 iOS 设置页一致 */
.setting-row{
  display:flex;align-items:center;justify-content:space-between;gap:14px;
  padding:13px 0;flex-wrap:nowrap;position:relative;
}
.setting-row > div:first-child{flex:1;min-width:0}
.setting-row::after{content:"";position:absolute;left:0;right:0;bottom:0;height:1px;background:var(--sep)}
.setting-row:last-child::after{display:none}
.setting-row .label{font-size:15px;font-weight:500;letter-spacing:-.01em}
.setting-row .desc{font-size:12.5px;color:var(--text2);margin-top:2px;line-height:1.55}
.setting-row .control{min-width:150px;display:flex;align-items:center;gap:8px;justify-content:flex-end}
/* 含输入框的行：标题在上、输入框整行铺满 —— 避免长说明把控件挤到下一行导致右边缘参差 */
.setting-row:has(.input){flex-direction:column;align-items:stretch;gap:9px}
.setting-row:has(.input) > div:first-child{flex:none}
.setting-row:has(.input) .control{width:100%;min-width:0}

/* iOS 开关 */
.switch{
  position:relative;width:51px;height:31px;border-radius:16px;flex:none;
  background:var(--fill);border:0;cursor:pointer;
  transition:background .26s var(--ease);
}
.switch::after{
  content:"";position:absolute;top:2px;left:2px;width:27px;height:27px;border-radius:50%;
  background:#fff;box-shadow:0 3px 8px rgba(0,0,0,.18),0 1px 1px rgba(0,0,0,.16);
  transition:transform .26s var(--ease);
}
.switch.on{background:var(--success)}
.switch.on::after{transform:translateX(20px)}
.empty-state{text-align:center;padding:56px 20px;color:var(--text3)}
.empty-state svg{width:46px;height:46px;opacity:.4;margin-bottom:12px;stroke-width:1.4}
.empty-state div{font-size:14px}

/* ============ 9. 模态 / 提示 ============ */
.modal-mask{
  position:fixed;inset:0;z-index:60;
  display:flex;align-items:center;justify-content:center;
  padding:18px;
  background:rgba(0,0,0,.42);
  -webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);
  animation:fade-in .2s ease;
}
@keyframes fade-in{from{opacity:0}to{opacity:1}}
.modal{
  width:100%;max-width:540px;max-height:86dvh;overflow-y:auto;
  padding:22px 22px 20px;
  border-radius:var(--r-lg);
  background:var(--glass-strong);
  -webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);
  border:1px solid var(--hairline);
  box-shadow:var(--shadow);
  animation:pop .26s var(--ease);
}
.modal.wide{max-width:740px}
@keyframes pop{from{opacity:0;transform:scale(.95) translateY(10px)}to{opacity:1;transform:none}}
.modal h3{font-size:19px;font-weight:700;margin:0 0 4px;letter-spacing:-.02em}
.modal-sub{font-size:12.5px;color:var(--text2);margin:0 0 10px;line-height:1.5}
.modal-foot{display:flex;justify-content:flex-end;gap:9px;margin-top:20px;flex-wrap:wrap}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 12px}
.form-grid .full{grid-column:1/-1}
.inline{display:flex;align-items:stretch;gap:8px}
.inline .input{flex:1}
.inline .btn{height:auto;padding:0 15px;font-size:13.5px}

.toast{
  position:fixed;left:50%;z-index:100;
  bottom:calc(28px + var(--safe-b));
  max-width:82vw;
  padding:11px 18px;border-radius:14px;
  background:var(--glass-strong);
  -webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);
  border:1px solid var(--hairline);
  color:var(--text);font-size:14px;font-weight:500;letter-spacing:-.01em;
  box-shadow:var(--shadow);
  opacity:0;pointer-events:none;
  transform:translate(-50%,14px);
  transition:opacity .24s var(--ease),transform .24s var(--ease);
}
.toast.show{opacity:1;transform:translate(-50%,0)}
.toast.err{color:var(--danger);border-color:rgba(255,69,58,.3)}

/* 新邮件通知条：从顶部滑入，复刻 iOS 锁屏通知横幅 */
.notif-banner{
  position:fixed;left:50%;top:calc(8px + var(--safe-t));z-index:80;
  width:calc(100% - 20px);max-width:480px;
  display:flex;align-items:center;gap:14px;
  padding:16px 16px 17px;
  border-radius:28px;
  /* 强透明：能透出底下的壁纸，而不是一块死灰 */
  background:rgba(26,26,32,.58);
  -webkit-backdrop-filter:saturate(200%) blur(30px);
  backdrop-filter:saturate(200%) blur(30px);
  border:1px solid rgba(255,255,255,.10);
  box-shadow:0 20px 50px rgba(0,0,0,.46),inset 0 1px 0 rgba(255,255,255,.07);
  cursor:pointer;
  opacity:0;
  transform:translate(-50%,-140%);
  transition:transform .46s cubic-bezier(.22,1.2,.36,1),opacity .3s var(--ease);
  will-change:transform;
}
html[data-theme="light"] .notif-banner{
  background:rgba(250,250,252,.72);
  border-color:rgba(255,255,255,.7);
  box-shadow:0 20px 50px rgba(0,0,0,.18),inset 0 1px 0 rgba(255,255,255,.9);
}
.notif-banner.show{opacity:1;transform:translate(-50%,0)}
.notif-banner:active{transform:translate(-50%,0) scale(.982)}

/* 图标做成 App 图标的样子：蓝紫渐变 + 内高光 + 白信封 */
.nb-icon{
  width:46px;height:46px;border-radius:12px;flex:none;
  display:flex;align-items:center;justify-content:center;
  background:linear-gradient(160deg,#4b8dff 0%,#5b6bff 46%,#8b5cf6 100%);
  color:#fff;
  box-shadow:0 8px 18px rgba(91,107,255,.42),inset 0 1px 0 rgba(255,255,255,.35);
}
.nb-icon svg{width:25px;height:25px;stroke-width:1.85}

.nb-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
.nb-app{
  font-size:11.5px;color:var(--text3);font-weight:500;letter-spacing:.02em;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.nb-title{
  font-size:15.5px;font-weight:600;letter-spacing:-.012em;line-height:1.26;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.nb-body{
  font-size:13.5px;color:var(--text2);line-height:1.38;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;
  overflow:hidden;
}
.nb-time{
  font-size:12px;color:var(--text3);flex:none;
  align-self:flex-start;margin-top:1px;
}

/* ============ 10. 响应式 ============ */
@media (max-width:980px){
  .list-pane{width:300px}
  .search-wrap{width:160px}
}
.workspace.single > .list-pane{width:100%;border-right:0}
.workspace.single > .detail-pane{display:none}

@media (max-width:760px){
  body{font-size:15px}
  .rail{display:none}

  /* 底部标签栏：用 grid 均分 5 列 + 固定图标盒，彻底消除绝对定位偏移 */
  .tabbar{
    display:grid;
    grid-template-columns:repeat(5,1fr);
    position:fixed;left:0;right:0;bottom:calc(-1 * var(--bottom-gap, 0px));z-index:20;
    padding-bottom:var(--safe-b);
    /* 用渐变玻璃而不是一块 80% 的实色：安全区那 34px 要能透出后面壁纸的颜色，
       否则深玻璃叠在深色壁纸上就是一条「死黑」，看着像标签栏没铺到底。 */
    background:linear-gradient(to bottom,
      rgba(28,28,36,.72) 0%,
      rgba(28,28,36,.60) 62%,
      rgba(28,28,36,.52) 100%);
    -webkit-backdrop-filter:saturate(190%) blur(30px);
    backdrop-filter:saturate(190%) blur(30px);
    border-top:1px solid rgba(255,255,255,.10);
    box-shadow:inset 0 1px 0 rgba(255,255,255,.06);
  }
  html[data-theme="light"] .tabbar{
    background:linear-gradient(to bottom,
      rgba(255,255,255,.80) 0%,
      rgba(255,255,255,.70) 62%,
      rgba(255,255,255,.62) 100%);
    border-top:1px solid rgba(0,0,0,.08);
  }
  .tab{
    display:flex;flex-direction:column;align-items:center;justify-content:center;
    gap:3px;height:52px;padding:0;border:0;background:transparent;
    color:var(--text3);
    font-size:10px;font-weight:500;letter-spacing:0;line-height:1;
    transition:color .18s var(--ease),opacity .18s var(--ease);
    -webkit-user-select:none;user-select:none;
  }
  .tab svg{width:25px;height:25px;stroke-width:1.7;transition:transform .2s var(--ease)}
  .tab span{line-height:1;white-space:nowrap}
  .tab.active{color:var(--accent)}
  .tab.active svg{transform:translateY(-.5px) scale(1.03)}
  .tab:active{opacity:.5}

  .shell{padding-bottom:calc(52px + var(--safe-b))}
  .topbar{height:52px;padding:0 14px;gap:10px}
  .topbar-title h2{font-size:17px}
  .topbar-title span{display:none}
  .search-wrap{display:none}
  .topbar-actions{gap:6px}
  .topbar-actions .btn span{display:none}
  .topbar-actions .btn{width:38px;height:38px;padding:0;border-radius:50%}
  .topbar-actions .btn.primary{width:38px;background:var(--accent)}

  .list-pane{width:100%;border-right:0}
  .detail-pane{display:none}
  .app.show-detail .list-pane{display:none}
  .app.show-detail .detail-pane{display:block;width:100%}
  .back-btn{display:inline-flex}
  .detail-wrap{padding:14px 16px 46px}
  .detail-title{font-size:19px;margin-bottom:14px}
  .page{padding:16px 16px 46px}
  /* 顶部栏已显示标题，去掉页面内重复的大标题，只留说明 */
  .page-head{margin-bottom:12px}
  .page-head h3{display:none}
  .page-head p{margin:0;font-size:12.5px}
  .setting-row .control{min-width:0}
  .form-grid{grid-template-columns:1fr}
  .grid2{grid-template-columns:1fr}
  .detail-actions .btn{flex:1 1 auto}
  .mail-item{padding:12px 16px 12px 20px}
  .mail-item::after{left:20px}
  .mail-item.unread::before{left:7px}

  /* 弹窗：iPhone 底部抽屉 */
  .modal-mask{align-items:flex-end;padding:0;background:rgba(0,0,0,.4)}
  .modal{
    width:100%;max-width:100%;max-height:92dvh;
    border-radius:var(--r-xl) var(--r-xl) 0 0;
    border-bottom:0;
    padding:10px 18px calc(20px + var(--safe-b));
    animation:sheet-up .34s var(--ease);
  }
  .modal::before{
    content:"";display:block;width:38px;height:5px;border-radius:3px;
    background:var(--fill);margin:0 auto 14px;
  }
  .modal.wide{max-width:100%}
  @keyframes sheet-up{from{transform:translateY(100%)}to{transform:translateY(0)}}
  .toast{bottom:calc(66px + var(--safe-b))}
}

@media (prefers-reduced-motion:reduce){
  *{animation-duration:.01ms!important;transition-duration:.01ms!important}
}
