:root {
  --brand: #0d7a68;
  --brand-dark: #0a5f52;
  --brand-soft: #e6f2ef;
  --bg: #eef2f3;
  --panel: #ffffff;
  --panel-2: #f7f9f9;
  --line: #e1e7e8;
  --text: #182a2d;
  --muted: #6c7f83;
  --danger: #b4453a;
  --warn: #b97d10;
  --shadow: 0 12px 32px rgba(20, 45, 50, .10);
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- 顶栏 */
#app { height: 100%; display: flex; flex-direction: column; }
.topbar {
  height: 56px; flex: 0 0 56px;
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; letter-spacing: .5px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, var(--brand), #149e86);
  color: #fff; display: grid; place-items: center; font-size: 14px;
}
.brand-mark svg { display: block; }
.search-wrap .icon { display: flex; align-items: center; justify-content: center; top: 0; bottom: 0; height: 36px; }
.search-wrap .icon svg { display: block; }
.brand-domain { font-size: 12px; font-weight: 400; color: var(--muted); }
.search-wrap { flex: 1; max-width: 520px; position: relative; }
.search-wrap input {
  width: 100%; height: 36px; padding: 0 14px 0 36px;
  border: 1px solid var(--line); border-radius: 18px; background: var(--panel-2);
  outline: none; transition: .15s;
}
.search-wrap input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(13,122,104,.10); }
.search-wrap .icon { position: absolute; left: 13px; top: 9px; color: var(--muted); font-size: 13px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.user-meta { line-height: 1.25; }
.user-meta .name { font-weight: 600; font-size: 13px; }
.user-meta .mail { color: var(--muted); font-size: 11px; }
.ghost-btn {
  height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--muted); font-size: 13px;
}
.ghost-btn:hover { color: var(--brand); border-color: #cfe3dd; background: var(--brand-soft); }

/* ---------------------------------------------------------------- 主区域 */
.workspace { flex: 1; min-height: 0; display: flex; }
.sidebar {
  width: 224px; flex: 0 0 224px; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 16px 12px 12px;
}
.compose-btn {
  height: 44px; border: none; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand), #12917c);
  color: #fff; font-weight: 600; font-size: 14px;
  box-shadow: 0 8px 18px rgba(13,122,104,.22);
  margin-bottom: 16px;
}
.compose-btn:hover { filter: brightness(1.04); }
.folders { flex: 1; overflow-y: auto; }
.folder {
  display: flex; align-items: center; gap: 9px;
  height: 38px; padding: 0 10px; border-radius: 8px; cursor: pointer;
  color: #2c4147; user-select: none;
}
.folder:hover { background: var(--panel-2); }
.folder.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.folder .fico { width: 18px; display: flex; align-items: center; justify-content: center; color: #7d9296; }
.folder.active .fico { color: var(--brand-dark); }
.folder .fico svg { width: 16px; height: 16px; display: block; }
.folder .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 600;
  display: grid; place-items: center;
}
.folder-actions { display: flex; align-items: center; gap: 4px; }
.folder .del {
  border: none; background: transparent; color: #b7c4c6; font-size: 12px; padding: 2px 4px; visibility: hidden;
}
.folder:hover .del { visibility: visible; }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; }
.quota-bar { height: 5px; border-radius: 3px; background: #e6ecec; overflow: hidden; margin: 8px 0 6px; }
.quota-fill { height: 100%; background: linear-gradient(90deg, #149e86, #0d7a68); width: 0; }
.quota-text { font-size: 11px; color: var(--muted); }
.link-btn { border: none; background: none; padding: 0; color: var(--brand); font-size: 12px; }
.link-btn:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- 列表 */
.list-pane {
  width: 380px; flex: 0 0 380px; background: var(--panel-2);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0;
}
.list-head { padding: 14px 16px 8px; }
.list-title-row { display: flex; align-items: center; justify-content: space-between; }
.list-title { font-size: 15px; font-weight: 700; margin: 0; }
.list-count { font-size: 12px; color: var(--muted); }
.filters { display: flex; gap: 6px; margin: 10px 0 6px; }
.chip {
  height: 26px; padding: 0 11px; border-radius: 13px; border: 1px solid var(--line);
  background: #fff; color: var(--muted); font-size: 12px;
}
.chip.active { background: var(--brand-soft); color: var(--brand-dark); border-color: #ccdfd9; font-weight: 600; }
.bulk-bar {
  display: none; align-items: center; gap: 8px; padding: 6px 16px 8px;
  font-size: 12px; color: var(--muted);
}
.bulk-bar.show { display: flex; }
.bulk-bar button { border: none; background: none; color: var(--brand); font-size: 12px; }
.messages { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.msg {
  display: flex; gap: 8px; padding: 10px 10px; border-radius: 9px; cursor: pointer;
  border: 1px solid transparent; margin-bottom: 2px; background: transparent;
}
.msg:hover { background: #fff; border-color: var(--line); }
.msg.active { background: #fff; border-color: #cfe0dc; box-shadow: 0 3px 10px rgba(20,45,50,.06); }
.msg.unread .m-from, .msg.unread .m-subject { font-weight: 700; }
.msg .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); margin-top: 9px; flex: 0 0 7px; }
.msg .dot.read { background: transparent; }
.msg .pick { display: none; margin-top: 3px; flex: 0 0 16px; }
.msg:hover .pick, .msg.selected .pick { display: block; }
.msg.selected { background: #eaf5f2; border-color: #cfe3dd; }
.msg.selected:hover .dot, .msg.selected .dot { display: none; }
.m-main { flex: 1; min-width: 0; }
.m-top { display: flex; justify-content: space-between; gap: 8px; }
.m-from { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-date { font-size: 11px; color: var(--muted); white-space: nowrap; }
.m-subject { font-size: 13px; color: #24383d; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-snippet { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-tags { display: flex; gap: 6px; margin-top: 3px; }
.mini { font-size: 10px; color: var(--muted); display: inline-flex; align-items: center; gap: 3px; }
.star { color: var(--warn); }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.pager button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 3px 10px; }
.pager button:disabled { opacity: .45; cursor: default; }

/* ---------------------------------------------------------------- 阅读区 */
.reader { flex: 1; min-width: 0; background: var(--panel); display: flex; flex-direction: column; }
.reader-empty { flex: 1; display: grid; place-items: center; color: #9db0b4; font-size: 13px; }
.reader-head { padding: 18px 24px 12px; border-bottom: 1px solid var(--line); }
.reader-subject { font-size: 19px; font-weight: 700; line-height: 1.4; margin: 0 0 12px; word-break: break-word; }
.reader-from { display: flex; align-items: center; gap: 10px; }
.reader-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark);
  display: grid; place-items: center; font-weight: 700;
}
.reader-from .who { font-weight: 600; }
.reader-from .addr { font-size: 12px; color: var(--muted); word-break: break-all; }
.reader-to { font-size: 12px; color: var(--muted); margin-top: 3px; }
.reader-actions { display: flex; gap: 8px; margin: 12px 0 2px; flex-wrap: wrap; }
.act {
  height: 30px; padding: 0 12px; border-radius: 7px; border: 1px solid var(--line);
  background: #fff; font-size: 12px; color: #355055;
}
.act:hover { background: var(--brand-soft); border-color: #cfe3dd; color: var(--brand-dark); }
.act.danger:hover { background: #fbeceb; border-color: #eed4d1; color: var(--danger); }
.reader-body { flex: 1; min-height: 0; background: #fff; }
.reader-body iframe { width: 100%; height: 100%; border: none; background: #fff; }
.attachments { padding: 10px 24px 14px; border-top: 1px solid var(--line); }
.attachments h4 { margin: 0 0 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.att-item {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 8px 8px 0;
  padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2);
  font-size: 12px; text-decoration: none; color: var(--text);
}
.att-item:hover { border-color: #cfe3dd; background: var(--brand-soft); }
.att-size { color: var(--muted); font-size: 11px; }

/* ---------------------------------------------------------------- 登录 */
.login-screen {
  position: fixed; inset: 0; z-index: 60;
  background: radial-gradient(1200px 600px at 15% 10%, #dff0eb 0%, #eef2f3 45%, #e9eef0 100%);
  background-size: var(--login-bg-size, cover);
  background-position: var(--login-bg-position, center);
  background-repeat: var(--login-bg-repeat, no-repeat);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 24px; overflow: auto;
}
.login-screen[data-announce-position="left"],
.login-screen[data-announce-position="right"] { flex-direction: row; }
.login-screen[data-announce-position="right"] { flex-direction: row-reverse; }
.login-screen[data-announce-position="bottom"] .login-announce { order: 2; }
.login-screen[data-announce-position="bottom"] .login-card { order: 1; }
.login-announce {
  width: 400px; max-width: calc(100vw - 48px); max-height: 42vh; overflow: auto;
  background: rgba(255,255,255,.96); border-radius: 14px; padding: 14px 18px;
  box-shadow: 0 16px 40px rgba(18,45,50,.12); line-height: 1.7;
  overflow-wrap: anywhere; color: #24383b; font-size: var(--login-announce-size, 13px);
  text-align: var(--login-announce-align, left);
}
.login-announce.hidden { display: none; }
.login-announce img { max-width: 100%; height: auto; border-radius: 8px; }
.login-screen[data-announce-position="left"] .login-announce,
.login-screen[data-announce-position="right"] .login-announce { width: 300px; max-height: 70vh; }
.login-card {
  width: 400px; background: #fff; border-radius: 16px; padding: 34px 34px 28px;
  box-shadow: 0 24px 60px rgba(18, 45, 50, .14);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-brand.hidden { display: none; }
.login-title { font-size: 20px; font-weight: 700; }
.login-title:empty { display: none; }
#loginLogo { width: var(--login-logo-size, 28px); height: var(--login-logo-size, 28px); flex: 0 0 auto; }
#loginLogo img { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; display: block; }
#loginLogo svg { width: calc(var(--login-logo-size, 28px) * .54); height: calc(var(--login-logo-size, 28px) * .54); }
.login-sub.hidden, .login-tip.hidden, .login-domains.hidden { display: none; }
.login-sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 9px;
  padding: 0 12px; background: var(--panel-2); outline: none;
}
.field input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(13,122,104,.10); }
.primary {
  height: 42px; border: none; border-radius: 9px; color: #fff; font-weight: 600;
  background: linear-gradient(135deg, var(--brand), #12917c); width: 100%;
}
.primary:hover { filter: brightness(1.05); }
.login-tip { margin-top: 16px; font-size: 12px; color: var(--muted); text-align: center; }
.login-err { color: var(--danger); font-size: 12px; min-height: 18px; margin: 4px 0 6px; }

/* ---------------------------------------------------------------- 弹窗 */
.modal {
  position: fixed; inset: 0; z-index: 70; background: rgba(20, 38, 42, .38);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-card {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; max-height: 92vh;
  max-width: calc(100vw - 48px); min-width: 0;
}
.compose-card { width: min(720px, 100%); height: 620px; max-width: 96vw; }
.admin-card { width: min(880px, 100%); height: 640px; max-width: 96vw; }
.settings-card { width: min(780px, 100%); max-width: 96vw; height: min(86vh, 760px); display: flex; flex-direction: column; }
.settings-tabs {
  display: flex; gap: 4px; padding: 8px 16px 0; border-bottom: 1px solid var(--line);
  overflow-x: auto; flex: 0 0 auto; background: var(--panel);
}
.settings-tab {
  border: none; background: transparent; color: var(--muted); font-size: 13px;
  padding: 9px 14px 11px; border-bottom: 2px solid transparent; white-space: nowrap; cursor: pointer;
}
.settings-tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.settings-body { padding-top: 14px; }
.settings-pane { display: none; }
.settings-pane.active { display: block; }
.settings-group {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 14px;
}
.settings-group h4 { margin: 0 0 12px; font-size: 13px; }
.settings-group .field:last-child { margin-bottom: 0; }
.settings-foot { flex: 0 0 auto; background: var(--panel); }
.record-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 10px; margin-bottom: 10px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 9px; font-size: 12px;
}
.record-bar .record-count { color: var(--muted); }
.record-bar label { display: inline-flex; align-items: center; gap: 5px; }
.record-check { width: 15px; height: 15px; }
#directoryModal .modal-card, #vaultModal .modal-card, #rulesModal .modal-card,
#extModal .modal-card { width: min(720px, 100%); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 15px; }
.close-x { border: none; background: none; font-size: 18px; color: var(--muted); line-height: 1; }
.modal-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px 20px; min-width: 0; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.btn-secondary { height: 36px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.btn-primary { height: 36px; padding: 0 20px; border-radius: 8px; border: none; background: var(--brand); color: #fff; font-weight: 600; }
.btn-primary:disabled { opacity: .6; }

.compose-field { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding: 6px 0; }
.compose-field label { width: 54px; font-size: 12px; color: var(--muted); }
.compose-field input { flex: 1; border: none; outline: none; height: 32px; background: transparent; }
.compose-field .mini-link { font-size: 12px; color: var(--brand); border: none; background: none; padding: 0 4px; }
.compose-field .mini-link:hover { text-decoration: underline; }
.toolbar { display: flex; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.toolbar button {
  width: 30px; height: 28px; border: 1px solid transparent; background: none; border-radius: 6px; color: #40585d;
  display: grid; place-items: center;
}
.toolbar button svg { display: block; }
#btnInlineImage { width: auto; padding: 0 8px; display: inline-flex; align-items: center; gap: 4px; }
.tb-label { font-size: 11px; line-height: 1; }
.toolbar button:hover { background: var(--panel-2); border-color: var(--line); }
.editor {
  min-height: 240px; padding: 12px 2px; outline: none; font-size: 14px; line-height: 1.75;
  overflow-y: auto; max-height: 260px;
}
.editor:empty:before { content: attr(data-placeholder); color: #a9b6b9; }
.att-list { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 8px; }
.att-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; font-size: 12px; }
.att-chip button { border: none; background: none; color: var(--danger); font-size: 12px; }

table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.grid td { padding: 10px; border-bottom: 1px solid #f0f4f4; vertical-align: middle; }
table.grid tr:hover td { background: #fafcfc; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; }
.tag.on { background: var(--brand-soft); color: var(--brand-dark); }
.tag.off { background: #f4f6f6; color: var(--muted); }
.tag.admin { background: #fdf3e3; color: var(--warn); }
.row-actions button { border: none; background: none; color: var(--brand); font-size: 12px; padding: 2px 4px; }
.row-actions .del { color: var(--danger); }

.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.form-row .field { margin: 0; flex: 1; min-width: 140px; }
.form-row .field input, .form-row .field select { height: 36px; }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 10px 14px; font-size: 13px; }
.kv .k { color: var(--muted); }
.kv .v { font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; word-break: break-all; }
.note { background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; font-size: 12px; color: var(--muted); margin-top: 14px; line-height: 1.8; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(10px);
  background: #1d3a40; color: #fff; padding: 10px 18px; border-radius: 9px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: .22s; z-index: 70; max-width: 70vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #8f372e; }

@media (max-width: 1180px) {
  .list-pane { width: 320px; flex-basis: 320px; }
  .sidebar { width: 200px; flex-basis: 200px; }
}
@media (max-width: 900px) {
  .workspace { flex-direction: column; }
  .sidebar { width: 100%; flex: 0 0 auto; flex-direction: row; align-items: center; padding: 8px; gap: 6px; overflow-x: auto; }
  .sidebar .folders { display: flex; gap: 4px; overflow-x: auto; }
  .sidebar-foot { display: none; }
  .compose-btn { margin: 0; width: 110px; height: 36px; flex: 0 0 110px; }
  .list-pane { width: 100%; flex: 1; min-height: 0; }
  .reader { display: none; }
}

/* ---------------------------------------------------------------- 企业版补充 */
.login-notice {
  margin: 0 0 14px; padding: 8px 12px; border-radius: 8px; font-size: 12px;
  background: #fdf1dc; color: #8a5b00; border: 1px solid #f3e0b8;
}
.login-notice.hidden { display: none; }
.login-links { display: flex; gap: 14px; justify-content: center; margin-top: 12px; }
.login-links .link-btn { font-size: 12px; }
.login-links .link-btn.hidden { display: none; }
.box-switch {
  height: 26px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel-2); font-size: 12px; padding: 0 6px; max-width: 210px;
}
.dir-list { display: flex; flex-direction: column; max-height: 52vh; overflow-y: auto; margin-top: 10px; }
.dir-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 6px;
  border-bottom: 1px solid #f1f4f4;
}
.dir-item:hover { background: #fafcfc; }
.dir-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft);
  color: var(--brand-dark); display: grid; place-items: center; font-weight: 600; font-size: 13px;
}
.dir-main { flex: 1; min-width: 0; }
.dir-name { font-size: 13px; font-weight: 600; }
.dir-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dir-actions { display: flex; gap: 6px; }
.vault-item { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid #f1f4f4; }
.vault-meta { flex: 1; min-width: 0; }
.recent-bar { display: flex; gap: 6px; align-items: center; margin-left: 8px; }

/* ---------------------------------------------------------------- 皮肤主题 */
body[data-theme="blue"] { --brand: #1f5fa9; --brand-dark: #174781; --brand-soft: #e8f0fb; }
body[data-theme="ink"] { --brand: #35424c; --brand-dark: #232d34; --brand-soft: #eceff1; }
body[data-theme="amber"] { --brand: #a8641b; --brand-dark: #8a4f12; --brand-soft: #fdf1dc; }
body[data-theme] .brand-mark { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); }

/* ---------------------------------------------------------------- 窄屏适配 */
@media (max-width: 900px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .brand { font-size: 15px; }
  .brand span { white-space: nowrap; }
  .topbar-right { gap: 4px; }
  .topbar-right .ghost-btn { padding: 0 8px; font-size: 12px; white-space: nowrap; }
  .user-meta, .avatar { display: none; }
  .search-wrap { max-width: none; }
  .sidebar-foot { display: flex; align-items: center; border: 0; padding: 0; margin: 0; }
  .sidebar-foot .quota-text, .sidebar-foot .quota-bar, .sidebar-foot #btnNewFolder { display: none; }
  .login-card { margin: 0 12px; }
}

.login-domains { font-size: 12px; color: #6b7c7f; margin: 0 0 14px; padding: 6px 10px; background: #f6faf9; border-radius: 8px; line-height: 1.6; }


.field.inline { display: flex; align-items: center; gap: 8px; }
.field.inline label { margin: 0; font-weight: 400; }


.field.inline label { flex: 0 0 auto; }

/* ---------------------------------------------------------------- 明亮 / 深色 / 墨青 / 暖阳 */
body[data-theme="bright"] {
  --brand: #0d7a68; --brand-dark: #0a5f52; --brand-soft: #e6f2ef;
  --bg: #f2f5f5; --panel: #ffffff; --panel-2: #f7f9f9; --line: #e1e7e8;
  --text: #182a2d; --muted: #6c7f83;
}
body[data-theme="dark"] {
  --brand: #39b39a; --brand-dark: #2b8d79; --brand-soft: #1b3a35;
  --bg: #11181b; --panel: #1b2428; --panel-2: #222d31; --line: #314045;
  --text: #e8f0f1; --muted: #9fb1b5;
  --shadow: 0 12px 32px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
body[data-theme="ink"] {
  --brand: #2f6f63; --brand-dark: #245449; --brand-soft: #e2ece8;
  --bg: #edf1ef; --panel: #ffffff; --panel-2: #f4f7f5; --line: #dfe6e2;
  --text: #1c2f2a; --muted: #6b7f78;
}
body[data-theme="sun"] {
  --brand: #b06a1f; --brand-dark: #8d5313; --brand-soft: #fdf1dc;
  --bg: #fbf6ec; --panel: #fffdf8; --panel-2: #fbf3e4; --line: #ecdfc8;
  --text: #3b2d18; --muted: #8b7658;
}
body[data-theme="dark"] .search-wrap input:focus,
body[data-theme="dark"] .field input:focus,
body[data-theme="dark"] .msg:hover,
body[data-theme="dark"] .msg.active,
body[data-theme="dark"] .ghost-btn,
body[data-theme="dark"] .pager button,
body[data-theme="dark"] .btn-secondary { background: var(--panel-2); }
body[data-theme="dark"] .reader-body,
body[data-theme="dark"] .reader-body iframe,
body[data-theme="dark"] .modal-card,
body[data-theme="dark"] .login-card { background: var(--panel); color: var(--text); }
body[data-theme="dark"] .kv .v,
body[data-theme="dark"] .note,
body[data-theme="dark"] .modal-body { color: var(--text); }
body[data-theme="dark"] .note { background: var(--panel-2); }
body[data-theme="dark"] .field input,
body[data-theme="dark"] .field textarea,
body[data-theme="dark"] .field select { background: var(--panel-2); color: var(--text); }
body[data-theme="dark"] .reader-avatar { background: #2b3a3f; color: #cfe5e0; }
body[data-theme="dark"] .login-screen { background-color: #0d1416; }
body[data-theme="sun"] .login-card { background: #fffdf8; }

/* 背景图：登录页铺满，工作区加一层淡背景 */
.login-screen { background-size: var(--login-bg-size, cover); background-position: var(--login-bg-position, center); background-repeat: var(--login-bg-repeat, no-repeat); }
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: var(--app-bg-image, none); background-size: cover; background-position: center;
  opacity: .10;
}
#app { position: relative; z-index: 1; }
body[data-density="compact"] .msg { padding-top: 4px; padding-bottom: 4px; }
body[data-density="compact"] .reader-head { padding-bottom: 8px; }
body.hide-preview .m-snippet { display: none; }
.m-tags .mini.cat { background: var(--brand-soft); color: var(--brand-dark); border-radius: 6px; padding: 0 6px; }
.cat-filter {
  height: 26px; border-radius: 13px; border: 1px solid var(--line);
  background: var(--panel); color: var(--muted); padding: 0 8px; font-size: 12px;
}
.reader-body { font-size: var(--reader-font, 14px); }

/* 设置里的主题卡片 */
.theme-picker { margin-bottom: 8px; }
.theme-group { margin-bottom: 12px; }
.theme-cards { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.theme-card {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  width: 84px; padding: 8px 6px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); color: var(--text); font-size: 12px;
}
.theme-card.active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.theme-card .swatch { width: 52px; height: 32px; border-radius: 6px; border: 1px solid var(--line); }
.theme-card .swatch.bg { background-size: cover !important; }
.category-editor { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px;
  background: var(--brand-soft); color: var(--brand-dark); border-radius: 12px; font-size: 12px;
}
.cat-chip button { border: none; background: transparent; color: inherit; cursor: pointer; padding: 0; font-size: 12px; }

/* 通讯录多选 */
.dir-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.dir-tools { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.dir-tools .field { margin: 0; min-width: 180px; }
.dir-check { flex: 0 0 auto; width: 16px; height: 16px; }
.dir-select-bar {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; margin-bottom: 8px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
}
.vault-crumb { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.vault-crumb span[data-vroot], .vault-crumb span[data-vtrail] { cursor: pointer; color: var(--brand); }
.vault-drop {
  border: 1px dashed var(--line); border-radius: 10px; padding: 12px;
  text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 10px;
}
.vault-drop.over { border-color: var(--brand); background: var(--brand-soft); }
.vault-send-bar {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  padding-top: 10px; border-top: 1px solid var(--line); margin-top: 10px;
}
.drop-hint { font-size: 12px; color: var(--muted); padding-top: 6px; }
.modal.dragging .compose-card { outline: 2px dashed var(--brand); outline-offset: -6px; }
#vaultModal.dragging .modal-card { outline: 2px dashed var(--brand); outline-offset: -6px; }
.security-session {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-top: 6px;
  background: var(--panel-2);
}
.vault-item.folder .dir-avatar { background: var(--brand-soft); color: var(--brand-dark); }

