/* mail.hink.uk 页面专属样式 */

.view[hidden] { display: none !important; }

/* 未登录卡片：居中 */
.logged-out {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 65px);
  padding: 2rem 1rem;
}
.auth-card {
  max-width: 420px;
  width: 100%;
  text-align: center;
}
.auth-card h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.auth-card p { color: var(--fg-muted); margin-bottom: 1.5rem; }
.auth-actions { display: flex; gap: 0.75rem; justify-content: center; }
.auth-actions .btn { min-width: 120px; }

/* 登录后布局 */
.logged-in { padding: 1rem 1.5rem 2rem; }
.mail-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.mail-toolbar h1 { font-size: 1.4rem; }

.mail-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1rem;
  align-items: start;
}

/* 邮件列表 */
.mail-sidebar {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-elevated);
}
.mail-list { list-style: none; max-height: calc(100vh - 200px); overflow-y: auto; }
.mail-list li.empty {
  padding: 2rem 1rem; text-align: center; color: var(--fg-muted);
}
.mail-item {
  display: block; width: 100%; text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: transparent;
  transition: background 0.15s;
}
.mail-item:hover { background: var(--bg-hover); }
.mail-item.active { background: var(--bg-hover); }
.mail-list li:last-child .mail-item { border-bottom: none; }
.mail-item .from { font-weight: 600; display: flex; align-items: center; gap: 0.4rem; }
.mail-item .from-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item .subject {
  margin: 0.2rem 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mail-item .date { color: var(--fg-muted); font-size: 0.8rem; }
.mail-item .unread-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--fg);
  flex: none;
}
.mail-item.read .unread-dot { visibility: hidden; }

.mail-sidebar .empty {
  padding: 2rem 1rem; text-align: center; color: var(--fg-muted);
}

/* 阅读区 */
.mail-reader {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  min-height: 300px;
}
.reader-empty {
  display: flex; align-items: center; justify-content: center;
  min-height: 300px; color: var(--fg-muted);
}
.reader-content { padding: 1.25rem; }
.reader-head { border-bottom: 1px solid var(--border); padding-bottom: 1rem; margin-bottom: 1rem; }
.reader-head h2 { font-size: 1.25rem; margin-bottom: 0.75rem; word-break: break-word; }
.reader-meta { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.meta-row { display: flex; gap: 0.5rem; }
.meta-label { color: var(--fg-muted); min-width: 3.5em; flex: none; }
.meta-value { word-break: break-all; }

.reader-actions { display: flex; gap: 0.6rem; }

.reader-body { line-height: 1.6; word-break: break-word; }
.reader-body .body-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.reader-body .load-error { color: var(--fg-muted); }

/* HTML 正文基础排版 */
.reader-body.html-view a { color: var(--fg); text-decoration: underline; }
.reader-body.html-view blockquote {
  border-left: 3px solid var(--border); padding-left: 0.75rem;
  color: var(--fg-muted); margin: 0.5rem 0;
}
.reader-body.html-view pre { background: var(--bg); padding: 0.75rem; border-radius: 8px; overflow-x: auto; }
.reader-body.html-view code { background: var(--bg); padding: 0.1em 0.35em; border-radius: 4px; }
.reader-body.html-view table { border-collapse: collapse; }
.reader-body.html-view th,
.reader-body.html-view td { border: 1px solid var(--border); padding: 0.4rem 0.6rem; }

/* mail 图标含笔：右下角叠加铅笔 */
.hink-icon { position: relative; }
.hink-icon svg.pencil {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 42%;
  height: 42%;
  fill: var(--bg);
  pointer-events: none;
}

/* 移动端：堆叠，阅读时隐藏列表 */
@media (max-width: 767px) {
  .mail-layout { grid-template-columns: 1fr; }
  .mail-reader { display: none; }
  .logged-in.reading .mail-sidebar { display: none; }
  .logged-in.reading .mail-reader { display: block; }
}
