:root {
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #221b38;
  background: #f6f5fb;
  font-synthesis: none;
  color-scheme: light;
  --ink: #221b38;
  --muted: #6d657f;
  --line: #e9e5f0;
  --accent: #6248cb;
  --accent-dark: #5038b2;
  --accent-light: #f1ecff;
  --surface: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-dark); text-underline-offset: .2em; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #967af0; outline-offset: 3px; }
svg { width: 1.25rem; height: 1.25rem; flex: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.container { width: min(1160px, calc(100% - 64px)); margin-inline: auto; }
.topbar { background: #ffffffb3; border-bottom: 1px solid #ece8f3; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 750; font-size: 1.125rem; letter-spacing: .055em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: white; background: linear-gradient(145deg, #7d63e6, #5a3bc6); box-shadow: 0 3px 8px #6044bc36; }
.brand-mark svg { width: 22px; height: 22px; }
.source-link { display: inline-flex; align-items: center; gap: 7px; color: #645978; font-size: .875rem; font-weight: 550; text-decoration: none; }
.source-link:hover { color: var(--accent-dark); text-decoration: underline; }
.source-link svg { width: 17px; height: 17px; }
.intro { padding: 43px 0 24px; }
.intro h1 { font-size: clamp(2rem, 2rem + 1.3vw, 3rem); font-weight: 780; line-height: 1.2; letter-spacing: -.045em; margin: 0 0 10px; }
.intro p { color: var(--muted); font-size: 1rem; margin: 0; line-height: 1.65; }
.lookup { padding: 20px 23px; background: var(--surface); border: 1px solid var(--line); border-radius: 19px; box-shadow: 0 6px 24px #3e285007; }
.lookup-fields { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 14px; }
.field label { display: block; font-size: .875rem; font-weight: 675; margin: 0 0 7px 1px; }
.field input, .field select { width: 100%; min-height: 47px; padding: 9px 13px; border: 1px solid #ded8e9; border-radius: 10px; background: #faf9fd; color: var(--ink); }
.field input::placeholder { color: #7e758e; opacity: 1; }
.field input[aria-invalid="true"] { border-color: #bf4772; }
.select-wrap { position: relative; }
.select-wrap select { appearance: none; padding-right: 33px; }
.select-wrap svg { position: absolute; top: 50%; right: 10px; width: 19px; height: 19px; transform: translateY(-50%); color: #726884; pointer-events: none; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; border-radius: 9px; border: 1px solid transparent; padding: 7px 12px; font-weight: 630; white-space: nowrap; cursor: pointer; transition: background-color .15s, border-color .15s; }
.button svg { width: 17px; height: 17px; }
.button:disabled { opacity: .53; cursor: default; }
.primary { min-height: 47px; padding: 8px 17px; color: white; background: var(--accent); font-size: .9375rem; border-color: #5d42c7; }
.primary:hover:not(:disabled) { background: var(--accent-dark); }
.secondary { color: #57486b; border-color: var(--line); background: white; font-size: .875rem; }
.secondary:hover:not(:disabled) { background: var(--accent-light); border-color: #ded2fb; }
.field-error { color: #9a244f; margin: 11px 0 0; font-size: .875rem; }
.inbox { margin-top: 24px; background: white; border: 1px solid var(--line); border-radius: 19px; overflow: hidden; box-shadow: 0 7px 24px #3e285009; }
.inbox-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 16px 22px; min-height: 75px; border-bottom: 1px solid var(--line); }
.inbox-identity { min-width: 0; }
.inbox-title-line { display: flex; align-items: center; gap: 9px; }
.inbox-title-line h2 { font-size: 1.14rem; margin: 0; line-height: 1.4; }
.message-count { display: inline-block; border-radius: 99px; padding: 3px 8px; font-size: .75rem; font-weight: 680; color: #5a40a7; background: var(--accent-light); white-space: nowrap; }
.inbox-address { display: block; color: var(--muted); font-size: .875rem; margin-top: 4px; overflow-wrap: anywhere; }
.inbox-actions { display: flex; align-items: center; gap: 8px; }
.inbox-columns { display: grid; grid-template-columns: minmax(260px, .56fr) minmax(0, 1fr); min-height: 356px; }
.mail-panel { border-right: 1px solid var(--line); min-width: 0; }
.reader-panel { min-width: 0; }
.panel-heading { display: flex; align-items: center; min-height: 45px; padding: 10px 20px; background: #faf9fc; color: #6c607d; border-bottom: 1px solid #efecf5; font-size: .875rem; font-weight: 640; }
.reader-heading { justify-content: space-between; }
.text-button { display: none; font-size: .875rem; border: 0; padding: 0; background: none; color: var(--accent-dark); cursor: pointer; }
.text-button:hover { text-decoration: underline; }
.panel-empty { min-height: 310px; display: grid; place-content: center; justify-items: center; padding: 25px; text-align: center; }
.empty-icon { display: grid; place-items: center; height: 51px; width: 51px; border-radius: 17px; color: #7157cb; background: #f2edff; margin-bottom: 15px; }
.empty-icon svg { width: 25px; height: 25px; }
.panel-empty strong { font-size: .975rem; font-weight: 680; overflow-wrap: anywhere; }
.panel-empty p { color: var(--muted); font-size: .875rem; line-height: 1.6; margin: 6px 0 0; max-width: 32rem; overflow-wrap: anywhere; }
.upstream-link { display: inline-block; margin-top: 11px; font-size: .875rem; }
.list-notice { background: #fff3f6; color: #781b3e; border-bottom: 1px solid #f2dce5; padding: 10px 15px; font-size: .875rem; line-height: 1.6; overflow-wrap: anywhere; }
.list-notice .upstream-link { margin-top: 0; display: block; width: fit-content; }
.mail-list, .message-links ul { margin: 0; }
.mail-list { padding: 0; list-style: none; max-height: 640px; overflow-y: auto; }
.mail-list li + li { border-top: 1px solid #f0edf5; }
.mail-item { appearance: none; display: block; width: 100%; border: 0; border-inline-start: 3px solid transparent; padding: 13px 15px 13px 17px; text-align: start; background: white; color: var(--ink); cursor: pointer; }
.mail-item:hover { background: #faf8ff; }
.mail-item[aria-pressed="true"] { background: #f4efff; border-inline-start-color: var(--accent); }
.mail-item:focus-visible { outline-offset: -4px; }
.mail-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.mail-from, .mail-subject, .mail-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-from { min-width: 0; font-size: .875rem; font-weight: 700; }
.mail-time { flex: none; color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
.mail-subject, .mail-preview { display: block; margin-top: 4px; font-size: .875rem; }
.mail-preview { color: var(--muted); }
.message-view { padding: 24px; min-width: 0; }
.message-header { border-bottom: 1px solid var(--line); padding-bottom: 17px; }
.message-header h3 { font-size: clamp(1.2rem, 1rem + .55vw, 1.5rem); margin: 0 0 14px; line-height: 1.45; overflow-wrap: anywhere; }
.message-meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 11px; margin: 0; font-size: .875rem; }
.message-meta dt { color: var(--muted); font-weight: 600; }
.message-meta dd { margin: 0; overflow-wrap: anywhere; }
.message-body { margin-top: 19px; font-size: .975rem; line-height: 1.72; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-body.muted { color: var(--muted); }
.message-links { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 18px; overflow-wrap: anywhere; }
.message-links h4 { margin: 0 0 8px; font-size: .9375rem; }
.message-links ul { padding-inline-start: 20px; line-height: 1.55; font-size: .9rem; }
.footer { padding: 16px 2px 23px; color: var(--muted); font-size: .8125rem; line-height: 1.5; }
.footer a { margin-left: 14px; color: var(--accent); }
.admin-brand { color: var(--ink); font-weight: 750; text-decoration: none; }
.admin-main { max-width: 760px; padding-top: 42px; }
.admin-main h1 { margin: 0 0 8px; font-size: 2rem; }
.admin-main > p { color: var(--muted); margin: 0 0 24px; }
.admin-card { background: white; border: 1px solid var(--line); border-radius: 17px; padding: 22px; margin: 18px 0; }
.admin-card label { display: block; font-weight: 650; margin-bottom: 8px; }
.admin-row { display: flex; gap: 10px; }
.admin-row input { flex: 1; min-width: 0; min-height: 47px; border: 1px solid #ded8e9; border-radius: 10px; padding: 9px 13px; background: #faf9fd; }
.admin-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.admin-panel-heading h2 { margin: 0; font-size: 1.25rem; }
.domain-list { list-style: none; padding: 0; margin: 14px 0 24px; }
.domain-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
#admin-notice:empty { display: none; }
@media (max-width: 450px) { .admin-row { flex-direction: column; } }
.toast { position: fixed; right: max(14px, 4vw); bottom: max(14px, 4vh); z-index: 3; max-width: min(400px, calc(100vw - 28px)); padding: 12px 16px; border-radius: 11px; color: white; background: #382758; box-shadow: 0 10px 35px #27204131; font-size: .875rem; }
@media (max-width: 760px) {
  .container { width: calc(100% - 36px); }
  .topbar-inner { min-height: 58px; }
  .intro { padding: 30px 0 20px; }
  .lookup { padding: 15px; }
  .lookup-fields { grid-template-columns: minmax(0, 1fr) auto; gap: 11px; }
  .inbox { margin-top: 18px; }
  .inbox-header { padding: 13px 15px; }
  .inbox-columns { display: block; min-height: 280px; }
  .mail-panel { border-right: 0; }
  .reader-panel { display: none; }
  .inbox.has-selected .mail-panel { display: none; }
  .inbox.has-selected .reader-panel { display: block; }
  .inbox.has-selected .text-button { display: block; }
  .panel-heading { padding-inline: 15px; }
  .panel-empty { min-height: 238px; }
  .message-view { padding: 18px 15px; }
}
@media (max-width: 450px) {
  .container { width: calc(100% - 24px); }
  .lookup-fields { grid-template-columns: 1fr; }
  .lookup-fields .primary { width: 100%; }
  .inbox-header { flex-wrap: wrap; min-height: 0; }
  .inbox-actions { order: 1; }
  .source-link { font-size: .8125rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
