/* ZHILE 邮件 — 样式 */

:root {
  --brand: #4d6bfe;
  --brand-dark: #3a55e0;
  --brand-soft: #eef1ff;
  --bg: #f7f8fc;
  --surface: #ffffff;
  --text: #15192b;
  --text-soft: #5a6178;
  --text-mute: #8a90a6;
  --line: #e6e8f0;
  --line-strong: #d5d9e6;
  --ok: #17a673;
  --warn: #d97706;
  --err: #dc2626;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(21, 25, 43, .06), 0 1px 3px rgba(21, 25, 43, .04);
  --shadow-md: 0 6px 24px rgba(21, 25, 43, .08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------- 按钮 */

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 18px;
  transition: background .15s, border-color .15s, color .15s, transform .06s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn.primary {
  background: var(--brand); color: #fff;
  box-shadow: 0 4px 14px rgba(77, 107, 254, .25);
}
.btn.primary:hover:not(:disabled) { background: var(--brand-dark); }

.btn.ghost {
  background: transparent; color: var(--text-soft); border-color: var(--line-strong);
}
.btn.ghost:hover:not(:disabled) { background: #f2f4fa; color: var(--text); }

.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

.mini {
  background: transparent; border: 0; color: var(--brand); cursor: pointer;
  font: inherit; font-size: 12.5px; padding: 2px 6px; border-radius: 6px;
}
.mini:hover { background: var(--brand-soft); }

.link-btn {
  background: none; border: 0; padding: 0 2px 6px;
  color: var(--brand); font: inherit; font-size: 13px; cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

/* ---------------------------------------------------- 登录 */

.gate {
  min-height: 100%; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1100px 480px at 50% -10%, #e6ebff 0%, rgba(230, 235, 255, 0) 65%),
    var(--bg);
}

.gate-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 20px;
  padding: 34px 30px 26px; text-align: center; box-shadow: var(--shadow-md);
}

.brand-mark {
  width: 56px; height: 56px; margin: 0 auto 16px;
  border-radius: 16px; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center;
}

.gate-card h1 { font-size: 21px; margin: 0 0 6px; letter-spacing: -.01em; }
.gate-sub { margin: 0 0 22px; color: var(--text-mute); font-size: 13.5px; }
.gate-card form { display: flex; flex-direction: column; gap: 10px; }

.gate-card input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line-strong);
  border-radius: 11px; font: inherit; text-align: center;
  letter-spacing: .04em; background: #fbfcff; color: var(--text);
}
.gate-card input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(77, 107, 254, .12);
}

.gate-error { color: var(--err); font-size: 13px; min-height: 20px; margin: 10px 0 0; }
.gate-foot { color: var(--text-mute); font-size: 12px; margin: 18px 0 0; }

/* ---------------------------------------------------- 顶栏 */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

.logo {
  display: inline-flex; align-items: center; gap: 9px;
  text-decoration: none; color: var(--text);
  font-weight: 700; letter-spacing: -.01em;
}
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--brand); color: #fff; display: grid; place-items: center;
}
.logo-text { font-size: 16px; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-soft);
  background: #f1f4fc; border: 1px solid var(--line);
  padding: 5px 11px; border-radius: 999px;
}
.pill .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 3px rgba(23, 166, 115, .14);
}
.pill.bad .dot { background: var(--err); box-shadow: 0 0 0 3px rgba(220, 38, 38, .14); }

/* ---------------------------------------------------- 布局 */

.main {
  max-width: 1180px; margin: 0 auto; padding: 26px 20px 50px;
  display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr);
  gap: 18px; align-items: start;
}

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 18px 20px;
}

.card-title { margin: 0 0 16px; font-size: 16px; letter-spacing: -.01em; }

.side { display: flex; flex-direction: column; gap: 14px; }
.side .card { padding: 16px 18px; }

.side-title {
  margin: 0 0 10px; font-size: 13.5px; color: var(--text-soft);
  display: flex; align-items: center; justify-content: space-between;
}
.side-title .count { color: var(--text-mute); font-weight: 600; margin-left: 2px; }

/* ---------------------------------------------------- 表单 */

.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 13px; color: var(--text-soft);
  margin-bottom: 6px; font-weight: 600;
}
.req { color: var(--err); font-weight: 400; }

.field input[type="text"], .field textarea, .editor {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #fbfcff;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .editor:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(77, 107, 254, .11);
}

.row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-note { margin: -8px 0 14px; font-size: 12px; color: var(--text-mute); }

.body-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 6px;
}
.body-head label { margin-bottom: 0; }

.tabs { display: inline-flex; background: #eef0f7; border-radius: 8px; padding: 2px; gap: 2px; }
.tabs button {
  border: 0; background: transparent; font: inherit; font-size: 12.5px;
  color: var(--text-soft); padding: 4px 12px; border-radius: 6px; cursor: pointer;
}
.tabs button.on { background: #fff; color: var(--brand); font-weight: 700; box-shadow: var(--shadow-sm); }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  padding: 6px 8px; border: 1px solid var(--line);
  border-bottom: 0; border-radius: 10px 10px 0 0; background: #f8f9fe;
}
.toolbar button {
  border: 1px solid transparent; background: transparent;
  font: inherit; font-size: 12.5px; color: var(--text-soft);
  padding: 3px 8px; border-radius: 6px; cursor: pointer; min-width: 28px;
}
.toolbar button:hover { background: #fff; border-color: var(--line-strong); color: var(--text); }
.tb-sep { width: 1px; height: 16px; background: var(--line-strong); margin: 0 3px; }
.toolbar[hidden] { display: none; }

.editor {
  min-height: 190px; border-radius: 0 0 10px 10px;
  line-height: 1.7; overflow: auto;
}
.editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-mute); pointer-events: none;
}
.editor p { margin: 0 0 .7em; }
.editor blockquote {
  margin: 0 0 .8em; padding-left: 12px; border-left: 3px solid var(--line-strong);
  color: var(--text-soft);
}
.editor a { color: var(--brand); }
textarea.editor { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; }

.file-btn { display: inline-flex; align-items: center; cursor: pointer; }

.attach-list { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; }
.attach-list li {
  display: flex; align-items: center; gap: 10px;
  background: #f6f8fd; border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 10px; font-size: 13px;
}
.attach-list .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-list .sz { color: var(--text-mute); font-size: 12px; }
.attach-list button {
  border: 0; background: transparent; color: var(--text-mute);
  cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 4px; border-radius: 5px;
}
.attach-list button:hover { background: #eceffa; color: var(--err); }

.actions { display: flex; align-items: center; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.actions .spacer { flex: 1; }
.hint-kbd { font-size: 12px; }
.muted { color: var(--text-mute); font-size: 12.5px; }

/* ---------------------------------------------------- 结果 */

.result {
  margin-top: 14px; padding: 12px 14px; border-radius: 11px;
  font-size: 13.5px; border: 1px solid; word-break: break-word;
}
.result.ok { background: #eaf8f2; border-color: #c6efe0; color: #0f7a54; }
.result.err { background: #fdecec; border-color: #f6c9c9; color: #a51f1f; }
.result .rid { display: block; margin-top: 5px; font-size: 12px; opacity: .85; }

/* ---------------------------------------------------- 侧栏列表 */

.list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow: auto; }
.list .empty { color: var(--text-mute); font-size: 12.5px; margin: 4px 0; }

.item {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 11px; font-size: 13px; background: #fcfdff;
  display: flex; flex-direction: column; gap: 3px;
}
.item.clickable { cursor: pointer; }
.item.clickable:hover { border-color: var(--brand); background: #f6f8ff; }
.item .l1 { display: flex; align-items: center; gap: 6px; }
.item .sub { color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { color: var(--text-mute); font-size: 11.5px; display: flex; gap: 8px; flex-wrap: wrap; }
.item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .x {
  border: 0; background: transparent; color: var(--text-mute); cursor: pointer;
  font-size: 14px; padding: 0 3px; border-radius: 4px; line-height: 1;
}
.item .x:hover { color: var(--err); background: #fbeaea; }

.tag {
  font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 999px;
  background: #eef1ff; color: var(--brand); border: 1px solid #dbe1ff;
}
.tag.ok { background: #e7f8f1; color: var(--ok); border-color: #c6efe0; }
.tag.bad { background: #fdecec; color: var(--err); border-color: #f6c9c9; }

/* ---------------------------------------------------- 页脚 / 提示 */

.foot {
  max-width: 1180px; margin: 0 auto; padding: 10px 20px 40px;
  color: var(--text-mute); font-size: 12.5px;
}
.foot .sep { margin: 0 6px; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: #1b2036; color: #fff; font-size: 13.5px;
  padding: 10px 18px; border-radius: 11px; box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  z-index: 90; max-width: min(520px, calc(100vw - 40px)); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: #991b1b; }

/* ---------------------------------------------------- 响应式 */

@media (max-width: 980px) {
  .main { grid-template-columns: 1fr; }
  .side { order: 2; }
}

@media (max-width: 620px) {
  .main { padding: 18px 14px 40px; }
  .topbar-inner { padding: 10px 14px; }
  .logo-text { font-size: 15px; }
  .card { padding: 15px 14px; }
  .row.two { grid-template-columns: 1fr; }
  .hint-kbd { display: none; }
  .toolbar { overflow-x: auto; flex-wrap: nowrap; }
}

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