:root {
  color-scheme: light;
  --ink: #202b27;
  --muted: #52625b;
  --line: #dbe4df;
  --paper: #fff;
  --sidebar: #f2f6f4;
  --select: #e6f2ec;
  --brand: #126148;
  --brand-hover: #0d4c39;
  --focus: #326bc2;
  font: 15px/1.5 system-ui, "Microsoft YaHei", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
button { cursor: pointer; }
h1, h2, h3, p, form, dl, dd { margin: 0; }
.icon { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: middle; }
.brand { display: inline-flex; gap: 10px; align-items: center; font-size: 17px; font-weight: 700; min-width: 0; }
.brand-mark { flex: 0 0 34px; height: 34px; display: grid; place-items: center; background: var(--brand); color: white; border-radius: 7px; }
.appbar { display: flex; align-items: center; gap: 20px; min-height: 62px; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.domain { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.logout { margin-left: auto; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 42px; border-radius: 6px; font-weight: 650; padding: 8px 14px; }
.primary { color: #fff; background: var(--brand); border: 1px solid var(--brand); }
.primary:hover { background: var(--brand-hover); }
.secondary { color: var(--ink); background: var(--paper); border: 1px solid var(--line); }
.secondary:hover { background: var(--sidebar); }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 6px; border: 0; color: var(--muted); background: transparent; }
.icon-button:hover { background: var(--select); color: var(--brand-hover); }
.workspace { display: grid; grid-template-columns: 212px minmax(260px, 340px) minmax(0, 1fr); min-height: calc(100vh - 62px); }
.rail { background: var(--sidebar); border-right: 1px solid var(--line); padding: 18px 12px; min-width: 0; }
.compose-link { width: 100%; margin-bottom: 22px; }
.rail h2 { font-size: 13px; color: var(--muted); font-weight: 650; padding: 0 9px; margin-bottom: 6px; }
.rail nav + nav { margin-top: 20px; }
.rail-link { display: flex; align-items: center; gap: 9px; padding: 6px 9px; min-height: 41px; border-radius: 6px; overflow-wrap: anywhere; }
.rail-link:hover, .rail-link.selected { background: var(--select); }
.rail-link.selected { color: var(--brand-hover); font-weight: 700; }
.rail-link .icon { color: var(--muted); }
.avatar { flex: 0 0 24px; height: 24px; border-radius: 5px; display: grid; place-items: center; font-size: 12px; background: #e0eee5; color: #18573e; font-weight: 700; }
.account-2 .avatar { background: #e2edf8; color: #234c76; }
.account-3 .avatar { background: #f5e6da; color: #774321; }
.listing { min-width: 0; border-right: 1px solid var(--line); }
.list-header { padding: 16px 15px 10px; border-bottom: 1px solid var(--line); }
.list-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.list-title h1 { font-size: 22px; }
.current-account { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.search { margin-top: 15px; display: flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 6px; }
.search input { min-width: 0; width: 100%; padding: 8px 9px; color: var(--ink); border: 0; background: transparent; }
.search input::-webkit-search-cancel-button { display: none; }
.list-count { font-size: 13px; color: var(--muted); margin-top: 10px; }
.message-row { display: block; padding: 12px 13px 11px 11px; border-left: 3px solid transparent; border-bottom: 1px solid var(--line); min-height: 67px; }
.message-row:hover { background: #f4f8f6; }
.message-row.active { background: var(--select); border-left-color: var(--brand); }
.message-row.unread .sender, .message-row.unread .subject { font-weight: 700; }
.row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.sender, .subject { min-width: 0; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.subject { margin-top: 3px; font-size: 14px; color: var(--muted); }
.row-top time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.unread-dot { display: inline-block; margin-right: 6px; width: 7px; height: 7px; background: var(--brand); border-radius: 50%; vertical-align: 2px; }
.list-empty { padding: 28px 16px; color: var(--muted); text-align: center; }
.pagination { display: grid; grid-template-columns: 38px 1fr 38px; padding: 8px; align-items: center; text-align: center; color: var(--muted); }
.reader { min-width: 0; padding: 24px 28px; }
.reader-title { font-size: 24px; line-height: 1.35; margin: 12px 0 16px; overflow-wrap: anywhere; }
.reader-tools, .reader-tools form, .form-actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.message-meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; font-size: 14px; }
.message-meta dt { color: var(--muted); }
.message-meta dd { overflow-wrap: anywhere; }
.message-body { margin-top: 18px; padding: 18px 0 24px; border-top: 1px solid var(--line); font-size: 16px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.attachments { border-top: 1px solid var(--line); padding-top: 14px; }
.attachments h3 { font-size: 14px; margin-bottom: 8px; }
.attachments a { display: flex; align-items: flex-start; gap: 7px; color: var(--brand); margin: 7px 0; overflow-wrap: anywhere; }
.attachments a:hover { text-decoration: underline; }
.idle { min-height: 325px; display: grid; align-content: center; justify-items: center; gap: 10px; color: var(--muted); }
.back { display: none; }
.fields { display: grid; gap: 15px; }
.fields label { display: grid; gap: 6px; font-weight: 650; }
.fields input, .fields textarea { min-width: 0; width: 100%; background: var(--paper); border: 1px solid #cbd7d0; color: var(--ink); border-radius: 6px; padding: 9px 11px; font-weight: 400; }
.fields textarea { resize: vertical; }
.attachment-field span { font-size: 13px; font-weight: 400; color: var(--muted); }
.feedback { padding: 10px 12px; margin-bottom: 14px; border-radius: 6px; overflow-wrap: anywhere; }
.feedback.ok { background: var(--select); color: var(--brand-hover); }
.feedback.warn { background: #fff0e0; color: #753607; }
.entry-page { background: var(--sidebar); }
.entry { width: min(100% - 32px, 400px); margin: 12vh auto 24px; padding: 25px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.entry h1 { font-size: 22px; margin-top: 20px; }
.entry-domain { color: var(--muted); margin: 3px 0 18px; overflow-wrap: anywhere; }
.entry-action { margin-top: 18px; }
@media (max-width: 900px) {
  .workspace { grid-template-columns: 154px minmax(212px, 290px) minmax(0, 1fr); }
  .reader { padding: 18px; }
}
@media (max-width: 700px) {
  .appbar { gap: 8px 13px; padding: 7px 12px; flex-wrap: wrap; }
  .domain { margin-left: auto; }
  .logout { margin-left: 0; }
  .workspace { display: block; min-height: 0; }
  .rail { border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; }
  .compose-link { width: auto; margin-bottom: 8px; }
  .rail nav { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }
  .rail nav + nav { margin-top: 3px; }
  .rail h2 { padding: 0 4px; margin: 0; }
  .rail-link { min-height: 42px; padding: 5px 7px; }
  .listing { border-right: 0; }
  .reader { padding: 14px 14px 22px; }
  .reader:has(.feedback) { padding-top: 10px; }
  .idle, .workspace.has-reader .listing { display: none; }
  .back { display: inline-flex; min-height: 42px; align-items: center; gap: 6px; margin-bottom: 4px; color: var(--brand); }
  .search input, .fields input, .fields textarea { font-size: 16px; }
  .icon-button { width: 44px; height: 44px; flex-basis: 44px; }
}
@media (max-width: 390px) {
  .domain { order: 3; flex: 1 0 100%; margin: 0; }
  .logout { margin-left: auto; }
}
