/* dd87 邮箱：浅色、系统字体、宽 1100px 居中。不依赖任何外部资源。 */
:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --line: #e3e6ec;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --danger: #dc2626;
  --ok: #15803d;
  --warn-bg: #fff7e0;
  --hover: #f1f5fb;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 18px 0 12px; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 16px 0 6px; }
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace; font-size: 13px; }
code { background: #eef1f6; padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; font-weight: normal; }
.center { text-align: center; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.wrap-anywhere { word-break: break-all; }

/* 顶栏 */
.topbar { background: #111827; color: #fff; }
.topbar-inner { display: flex; align-items: center; gap: 20px; min-height: 52px; flex-wrap: wrap; }
.logo { color: #fff; font-weight: 700; font-size: 18px; letter-spacing: .5px; }
.logo:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { color: #cbd5e1; padding: 6px 12px; border-radius: 6px; }
.nav a:hover { background: #1f2937; color: #fff; text-decoration: none; }
.nav a.active { background: #374151; color: #fff; }
.badge { display: inline-block; margin-left: 6px; padding: 0 7px; background: var(--danger); color: #fff; border-radius: 10px; font-size: 12px; line-height: 18px; }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.topbar-user a { color: #93c5fd; }
.who { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #e5e7eb; }

.admin-bar { background: #fef3c7; border-bottom: 1px solid #fcd34d; padding: 6px 0; font-size: 14px; }
.admin-bar a { margin-left: 12px; }

main.wrap { padding-bottom: 24px; }
.footer { color: var(--muted); font-size: 13px; padding: 16px; text-align: center; }

/* 提示 */
.flashes { margin-top: 14px; }
.flash { padding: 10px 14px; border-radius: var(--radius); margin: 8px 0; border: 1px solid var(--line); background: #eef2ff; }
.flash-success { background: #ecfdf3; border-color: #a7f3d0; color: #065f46; }
.flash-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash-warn { background: var(--warn-bg); border-color: #fde68a; color: #92400e; }
.flash-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* 卡片 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 14px 0; }
.card-narrow { max-width: 420px; margin: 48px auto; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.error-code { font-size: 56px; font-weight: 700; color: #cbd5e1; margin: 0; line-height: 1; }

/* 按钮 */
.btn {
  display: inline-block; padding: 7px 14px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; color: var(--text); font: inherit; font-size: 14px; line-height: 1.4; cursor: pointer;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-danger { color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-small { padding: 3px 9px; font-size: 13px; }
.btn-block { display: block; width: 100%; }

/* 表单 */
.form label { display: block; margin: 0 0 12px; font-size: 14px; color: #374151; }
.form input[type=text], .form input[type=email], .form input[type=password], .form input[type=number],
.form input[type=search], .form select, .form textarea,
.search input[type=search], .input-small {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; font-size: 15px; color: var(--text);
  background: #fff; border: 1px solid #cbd5e1; border-radius: 6px;
}
.form input:focus, .form select:focus, .form textarea:focus, .search input:focus, .input-small:focus {
  outline: 2px solid #bfdbfe; border-color: var(--accent);
}
textarea { resize: vertical; }
textarea.mono { width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 6px; background: #f8fafc; }
fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 0 0 12px; padding: 8px 12px 4px; }
legend { font-size: 13px; color: var(--muted); padding: 0 6px; }
.inline-fields { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-fields label { flex: 1 1 100px; }
.radio { display: block; margin-bottom: 10px; }
.radio input { margin-right: 6px; }
.actions { margin-top: 10px; display: flex; gap: 10px; }
form.inline { display: inline-block; margin: 0; }
.input-small { display: inline-block; width: 150px; margin: 0; padding: 3px 8px; font-size: 13px; }

/* 写信 */
.field-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.form label.field-row { display: flex; margin-bottom: 8px; }  /* 要比 ".form label"（块级、下边距 12px）优先级高 */
.field-row .field-label { flex: 0 0 56px; color: var(--muted); font-size: 14px; }
.form .field-row input { margin-top: 0; }
.field-block { display: block; margin-bottom: 12px; }
.field-block .field-label { display: block; color: var(--muted); font-size: 14px; margin-bottom: 4px; }
.compose-form textarea { font-family: inherit; line-height: 1.6; }

/* 页头与工具条 */
.page-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 6px 0; }
.page-head h1 { flex: 1; margin: 18px 0 12px; }
.search { display: flex; gap: 6px; align-items: center; }
.search input[type=search] { margin: 0; width: 260px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 12px; }

/* 表格 */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { background: #f8fafc; font-weight: 600; font-size: 13px; color: #4b5563; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table-hover tbody tr:hover { background: var(--hover); }
.num { text-align: right; white-space: nowrap; }
.narrow { white-space: nowrap; width: 1%; }
.actions-cell { white-space: nowrap; }
.actions-cell .btn, .actions-cell form { margin-right: 4px; }
.api-table td:first-child { min-width: 240px; word-break: break-all; }
.domain-title { margin-top: 18px; }

/* 邮件列表 */
.mail-list td { vertical-align: middle; }
.col-who { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-subject { max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snippet { color: var(--muted); }
.mail-list tr.unread td { font-weight: 700; background: #fcfdff; }
.mail-list tr.unread .snippet { font-weight: 400; }
.empty { background: var(--card); border: 1px dashed #cbd5e1; border-radius: var(--radius); padding: 40px 16px; text-align: center; color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; margin: 12px 0; gap: 10px; flex-wrap: wrap; }
.pager-links { display: flex; gap: 6px; }

/* 阅读邮件 */
.mail-subject { margin-top: 0; font-size: 20px; word-break: break-word; }
.mail-headers { display: grid; grid-template-columns: 64px 1fr; gap: 4px 12px; margin: 0 0 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.mail-headers dt { color: var(--muted); }
.mail-headers dd { margin: 0; word-break: break-word; }
.attachments { background: #f8fafc; border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; margin-bottom: 12px; }
.attachments ul { margin: 4px 0 0; padding-left: 20px; }
.view-switch { font-size: 13px; margin-bottom: 8px; }
.mail-text { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 15px; line-height: 1.7; }
.mail-frame { display: block; width: 100%; height: 70vh; min-height: 320px; border: 1px solid var(--line); border-radius: 6px; background: #fff; resize: vertical; }

/* 标签、统计、代码块 */
.tag { display: inline-block; padding: 0 8px; border-radius: 10px; font-size: 12px; line-height: 20px; }
.tag-ok { background: #dcfce7; color: var(--ok); }
.tag-off { background: #f3f4f6; color: var(--muted); }
.tag-att { background: #e0e7ff; color: #3730a3; font-weight: 400; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 10px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; }
.stat-num { font-size: 32px; font-weight: 700; line-height: 1.2; }
.stat-text { font-size: 20px; padding: 6px 0; }
.stat-label { color: var(--muted); font-size: 14px; }
.token { word-break: break-all; padding: 4px 8px; }
.code { background: #0f172a; color: #e2e8f0; padding: 12px 14px; border-radius: 6px; overflow-x: auto; margin: 12px 0 0; }

.copy-helper { position: fixed; left: -9999px; top: 0; opacity: 0; }

/* 手机 */
@media (max-width: 720px) {
  .grid-2, .stats { grid-template-columns: 1fr; }
  .topbar-inner { gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .nav { order: 3; flex-basis: 100%; }
  .topbar-user { margin-left: auto; }
  .search input[type=search] { width: 100%; flex: 1; }
  .search { flex: 1 1 100%; }
  .field-row { flex-direction: column; align-items: stretch; gap: 2px; }
  .field-row .field-label { flex-basis: auto; }
  .card { padding: 14px; }
  .card-narrow { margin: 20px auto; }
}
