/* Monk 学院社区邮箱（先引 /ui/monk-ui.css） */
#themeBtn .t-moon { display: none; }
[data-theme="dark"] #themeBtn .t-sun { display: none; }
[data-theme="dark"] #themeBtn .t-moon { display: inline; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #themeBtn .t-sun { display: none; } :root:not([data-theme="light"]) #themeBtn .t-moon { display: inline; } }
.mk-btn svg { width: 18px; height: 18px; }
.mk-brand { white-space: nowrap; }
.me { font-size: 13px; color: var(--mk-muted); margin-right: 4px; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- 登录 / 领取 ---------- */
.auth { display: grid; justify-items: center; gap: 22px; padding-top: 36px; padding-bottom: 48px; }
.auth-intro { text-align: center; display: grid; gap: 8px; max-width: 560px; }
.auth-intro .mk-lede { margin: 0; }
.auth-card { width: min(480px, 100%); padding: 22px; display: grid; gap: 16px; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: var(--mk-surface-2); border: 1px solid var(--mk-border); }
.tabs button { height: 38px; border: 0; border-radius: 9px; background: none; color: var(--mk-muted); font: inherit; font-weight: 600; cursor: pointer; }
.tabs button.is-on { background: var(--mk-surface); color: var(--mk-text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--mk-text-2); }
.form small, .fine { font-weight: 400; font-size: 12.5px; line-height: 1.6; color: var(--mk-muted); }
.form small a, .auth-foot a { color: var(--mk-accent-ink); }
.addr-input { display: flex; align-items: stretch; }
.addr-input .mk-input { border-top-right-radius: 0; border-bottom-right-radius: 0; min-width: 0; flex: 1; }
.addr-input em { display: grid; place-items: center; padding: 0 12px; font-style: normal; font-family: var(--mk-mono); font-size: 13px; color: var(--mk-muted); border: 1px solid var(--mk-border-strong); border-left: 0; border-radius: 0 10px 10px 0; background: var(--mk-surface-2); }
.avail.ok { color: var(--mk-ok); }
.avail.bad { color: #EF4444; }
.check { grid-template-columns: auto 1fr; align-items: start; font-weight: 400 !important; line-height: 1.6; }
.check input { margin-top: 4px; accent-color: var(--mk-accent); }
.form-err { margin: 0; min-height: 0; color: #EF4444; font-size: 13.5px; }
.form-err:empty { display: none; }
.mk-input.is-bad { border-color: #EF4444; }
textarea.mk-input { height: auto; min-height: 180px; padding: 12px 14px; resize: vertical; line-height: 1.6; font: inherit; }
.auth-foot { margin: 0; font-size: 13px; color: var(--mk-muted); text-align: center; }

/* ---------- 邮箱主界面 ---------- */
.app { display: grid; grid-template-columns: 210px minmax(260px, 360px) 1fr; gap: 0; height: calc(100dvh - 72px); border-top: 1px solid var(--mk-border); }
.side { display: flex; flex-direction: column; gap: 14px; padding: 16px 12px; border-right: 1px solid var(--mk-border); }
.compose-btn { justify-content: center; }
.folders { display: grid; gap: 2px; }
.folders button { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border: 0; border-radius: 9px; background: none; color: var(--mk-text-2); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.folders button svg { width: 18px; height: 18px; color: var(--mk-muted); }
.folders button b { margin-left: auto; font-size: 12px; color: var(--mk-accent-ink); }
.folders button:hover { background: var(--mk-surface-2); }
.folders button.is-on { background: color-mix(in srgb, var(--mk-info) 14%, transparent); color: var(--mk-text); }
.folders button.is-on svg { color: var(--mk-info); }
.quota { margin-top: auto; display: grid; gap: 6px; font-size: 12px; color: var(--mk-muted); }
.quota .bar { height: 6px; border-radius: 9px; background: var(--mk-surface-3); overflow: hidden; }
.quota .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--mk-accent), var(--mk-accent-2)); }

.list-pane { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--mk-border); }
.list-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--mk-border); }
.list-head h2 { margin: 0; font-size: 16px; }
.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.list button { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--mk-border); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.list button:hover { background: var(--mk-surface-2); }
.list button.is-on { background: color-mix(in srgb, var(--mk-info) 12%, transparent); }
.list .who { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list time { font-size: 12px; color: var(--mk-muted); }
.list .subj { grid-column: 1 / -1; font-size: 13.5px; color: var(--mk-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.list .subj svg { width: 14px; height: 14px; flex: none; color: var(--mk-muted); }
.list .snip { grid-column: 1 / -1; font-size: 12.5px; color: var(--mk-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .unseen .who, .list .unseen .subj { font-weight: 800; color: var(--mk-text); }
.list .unseen .who::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--mk-accent); margin-right: 6px; vertical-align: 2px; }
.more-btn { margin: 10px auto; }
.empty { margin: 40px 0; text-align: center; color: var(--mk-muted); font-size: 14px; }

.read-pane { min-width: 0; min-height: 0; overflow-y: auto; }
.read-empty { height: 100%; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--mk-subtle); }
.read-empty svg { width: 46px; height: 46px; }
.reader { display: flex; flex-direction: column; gap: 12px; padding: 14px 22px 30px; min-height: 100%; }
.reader-bar { display: flex; align-items: center; gap: 8px; }
.back-btn { display: none; }
.r-subject { margin: 4px 0 0; font-size: 22px; line-height: 1.35; word-break: break-word; }
.r-meta { display: grid; gap: 3px; font-size: 13px; color: var(--mk-muted); padding-bottom: 12px; border-bottom: 1px solid var(--mk-border); }
.r-meta b { color: var(--mk-text); font-size: 14px; }
.r-to { word-break: break-all; }
.r-images { font-size: 13px; padding: 9px 12px; border-radius: 9px; background: var(--mk-surface-2); color: var(--mk-muted); }
.r-images button { border: 0; background: none; color: var(--mk-info); font: inherit; font-weight: 600; cursor: pointer; }
.r-html { width: 100%; flex: 1; min-height: 60vh; border: 1px solid var(--mk-border); border-radius: 12px; background: #fff; }
.r-text { margin: 0; white-space: pre-wrap; word-break: break-word; font: 14.5px/1.75 var(--mk-font); color: var(--mk-text); }
.r-att { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.r-att a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--mk-border); color: var(--mk-text); text-decoration: none; font-size: 13px; }
.r-att a small { color: var(--mk-muted); }
.r-att svg { width: 15px; height: 15px; }

/* ---------- 写信 / 设置抽屉 ---------- */
.compose { padding: 18px 22px calc(18px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; gap: 14px; }
.compose form, #settings .form { display: grid; gap: 12px; }
.compose label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--mk-text-2); }
.compose-head { display: flex; align-items: center; gap: 10px; }
.compose-head h2 { margin: 0; font-size: 18px; }
.compose-foot { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.compose-foot small { color: var(--mk-muted); font-size: 12px; }
#settings .form + .form { padding-top: 14px; border-top: 1px solid var(--mk-border); }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto auto; align-content: start; height: auto; min-height: calc(100dvh - 62px); }
  .tag-sm { display: none; }
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--mk-border); padding: 10px 12px; }
  .folders { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
  .folders button { height: 36px; padding: 0 10px; white-space: nowrap; }
  .folders button svg { display: none; }
  .quota { display: none; }
  .list-pane { border-right: 0; }
  .read-pane { display: none; }
  body.reading .list-pane, body.reading .side { display: none; }
  body.reading .read-pane { display: block; }
  .back-btn { display: inline-flex; }
  .reader { padding: 10px 14px 30px; }
  .me { display: none; }
}
