/* 玄霆：低对比背景、明确的内容层级与冷翠色操作反馈。 */
:root {
  color-scheme: dark;
  --primary: #58d9b0;
  --primary-dark: #38bf95;
  --primary-light: #85e9c8;
  --accent: #58d9b0;
  --bg-color: #101416;
  --surface-color: #191f22;
  --surface-raised: #20282c;
  --border-color: #2d373b;
  --text-primary: #e9efed;
  --text-secondary: #b1c1bc;
  --text-tertiary: #899b95;
  --card-bg: #191f22;
  --card-border: #2d373b;
  --header-bg: rgba(16, 20, 22, .94);
  --header-border: #283135;
  --button-bg: #25332f;
  --button-hover: #31463e;
  --button-text: #d7e9e1;
  --input-bg: #13191c;
  --input-border: #34403f;
  --input-text: #e9efed;
  --modal-bg: #191f22;
  --modal-border: #34403f;
  --accent-soft: rgba(88, 217, 176, .09);
  --code-bg: #13191c;
  --shadow: 0 18px 45px rgba(0, 0, 0, .24);
}
:root.light {
  color-scheme: light;
  --primary: #11785e;
  --primary-dark: #0b604a;
  --primary-light: #159572;
  --accent: #11785e;
  --bg-color: #f2f5f3;
  --surface-color: #ffffff;
  --surface-raised: #edf3ef;
  --border-color: #dce5df;
  --text-primary: #1b2a23;
  --text-secondary: #53665b;
  --text-tertiary: #697c70;
  --card-bg: #ffffff;
  --card-border: #dce5df;
  --header-bg: rgba(242, 245, 243, .95);
  --header-border: #dce5df;
  --button-bg: #e5efe8;
  --button-hover: #d8e8df;
  --button-text: #235a44;
  --input-bg: #f7faf8;
  --input-border: #cedbd2;
  --input-text: #1b2a23;
  --modal-bg: #ffffff;
  --modal-border: #dce5df;
  --accent-soft: rgba(17, 120, 94, .06);
  --code-bg: #edf3ef;
  --shadow: 0 16px 45px rgba(33, 61, 45, .1);
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg-color); }
body { margin: 0; min-height: 100vh; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--text-primary); -webkit-font-smoothing: antialiased; }
body.galaxy-bg { background: var(--bg-color); color: var(--text-primary); }
h1, h2, h3, .brand-font { font-family: inherit; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled, select:disabled { cursor: not-allowed; opacity: .45; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
button, a, input, textarea { transition: background-color .15s, border-color .15s, color .15s; }
[hidden], .hidden { display: none !important; }
::selection { background: var(--primary-dark); color: white; }
.icon { width: 20px; height: 20px; flex-shrink: 0; }
.glass-card { border: 1px solid var(--card-border); background: var(--card-bg); border-radius: 16px; }
#stars-container, .meteor-container { display: none; }

/* 页首与品牌。 */
.workspace-header { border-bottom: 1px solid var(--header-border); background: var(--header-bg); }
.header-inner { max-width: 1256px; margin: auto; padding: 22px 36px; display: flex; align-items: center; justify-content: space-between; gap: 26px; }
.brand-lockup { display: inline-flex; align-items: center; gap: 12px; flex-shrink: 0; color: var(--text-primary); }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 39px; height: 43px; background: var(--primary); color: var(--bg-color); border-radius: 11px 3px 11px 3px; flex-shrink: 0; }
.brand-mark svg { width: 26px; height: 26px; }
.brand-name { font-size: 21px; font-weight: 760; letter-spacing: 3px; line-height: 1.3; }
.brand-name > span { display: block; font-size: 9px; letter-spacing: 3.6px; font-weight: 600; color: var(--text-tertiary); margin-top: 3px; }
.main-nav, .header-tools { display: flex; align-items: center; gap: 6px; }
.main-nav { margin-right: auto; margin-left: 30px; }
.nav-action { display: inline-flex; align-items: center; justify-content: center; padding: 9px 14px; min-height: 38px; white-space: nowrap; border-radius: 7px; font-size: 13px; color: var(--text-secondary); }
.nav-action:hover, .icon-button:hover { background: var(--surface-raised); color: var(--text-primary); }
.nav-action.active { color: var(--primary); background: var(--accent-soft); font-weight: 600; }
.header-tools { flex-shrink: 0; }
.header-tools form { margin: 0; }
.icon-button { width: 34px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; color: var(--text-tertiary); }
.icon-button svg { width: 18px; height: 18px; }
.tool-divider { width: 1px; height: 18px; background: var(--border-color); margin: 0 4px; }
.logout-action { color: var(--text-tertiary); padding-right: 0; }
#langToggle { position: relative; }
#langToggle::after { position: absolute; right: 0; bottom: 0; font-size: 7px; background: var(--surface-color); border: 1px solid var(--border-color); border-radius: 3px; line-height: 1.2; padding: 1px; color: var(--text-secondary); }
#langToggle.zh-mode::after { content: 'CN'; }
#langToggle.en-mode::after { content: 'EN'; }

/* Token 设置和内嵌调用说明。 */
.admin-content-card { scroll-margin-top: 110px; }
.token-panel { padding: 30px; min-width: 0; }
.token-heading, .token-guide-heading, .token-code-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.token-heading h2 { margin: 10px 0 0; font-size: 26px; font-weight: 650; letter-spacing: -.5px; }
.token-status { white-space: nowrap; color: var(--text-tertiary); background: var(--surface-raised); border: 1px solid var(--border-color); border-radius: 30px; padding: 5px 11px; font-size: 11px; }
.token-status.is-enabled { color: var(--primary); border-color: var(--primary); background: var(--accent-soft); }
.token-description { color: var(--text-secondary); font-size: 14px; line-height: 1.8; margin: 18px 0; }
.token-scope { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--primary); }
.token-scope-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.token-note { color: var(--text-tertiary); font-size: 12px; line-height: 1.9; margin-top: 10px; overflow-wrap: anywhere; }
.token-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.token-primary, .token-secondary { border-radius: 7px; font-size: 12px; font-weight: 600; padding: 10px 16px; }
.token-primary { background: #58d9b0; color: #102a20; border: 1px solid #58d9b0; }
.token-primary:hover { background: #85e9c8; }
.token-secondary { color: var(--text-secondary); border: 1px solid var(--input-border); background: var(--surface-color); }
.token-secondary:hover { background: var(--surface-raised); }
.token-result { background: var(--accent-soft); border: 1px solid var(--primary); border-radius: 10px; padding: 18px; margin-top: 22px; }
.token-result label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.token-value-row { display: flex; gap: 8px; }
#token-value { min-width: 0; width: 100%; padding: 10px; border-radius: 6px; border: 1px solid var(--input-border); background: var(--input-bg); color: var(--input-text); font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.token-value-row button { flex-shrink: 0; }
.token-feedback { margin-top: 16px; font-size: 12px; line-height: 1.7; color: var(--primary); }
.token-feedback.is-error { color: #df655f; }
.token-guide { margin-top: 28px; border-top: 1px solid var(--border-color); padding-top: 26px; }
.token-guide h3 { font-size: 15px; font-weight: 650; }
.token-guide-heading a, .token-copy-code { color: var(--primary); font-size: 11px; }
.token-code-heading { margin: 22px 0 10px; font-size: 11px; font-weight: 600; color: var(--text-secondary); }
.token-copy-code { padding: 4px; }
.token-guide pre { margin: 0; padding: 17px; border-radius: 9px; border: 1px solid var(--border-color); background: var(--code-bg); color: var(--text-secondary); overflow-x: auto; font: 11px/1.9 ui-monospace, SFMono-Regular, Consolas, monospace; tab-size: 4; }
.token-guide code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.token-endpoints { margin-top: 22px; border-top: 1px solid var(--border-color); }
.token-endpoints > div { display: flex; justify-content: space-between; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--border-color); font-size: 11px; color: var(--text-tertiary); }
.token-endpoints code { color: var(--text-secondary); overflow-wrap: anywhere; }
.token-notice { margin-top: 16px; padding: 13px 15px; border-left: 2px solid var(--primary); background: var(--accent-soft); color: var(--text-secondary); font-size: 11px; line-height: 1.9; }
@media (max-width: 600px) {
  .token-panel { padding: 22px 18px; }
  .token-endpoints > div { flex-direction: column; gap: 5px; }
  .token-guide-heading { align-items: start; }
}

/* 收件工作台。 */
.workspace-main { max-width: 1256px; margin: 0 auto; padding: 46px 36px 30px; }
.workspace-intro { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.eyebrow { display: flex; align-items: center; gap: 9px; color: var(--text-tertiary); font-size: 10px; letter-spacing: 2.1px; font-weight: 600; }
.eyebrow > span { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); }
.workspace-intro h1 { font-size: clamp(28px, 3.3vw, 40px); font-weight: 650; line-height: 1.3; letter-spacing: -.8px; margin: 13px 0 10px; }
.intro-description { font-size: 13px; line-height: 1.8; color: var(--text-tertiary); }
.private-badge { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-secondary); border: 1px solid var(--border-color); border-radius: 30px; padding: 8px 12px; white-space: nowrap; }
.private-badge svg { width: 15px; height: 15px; color: var(--primary); }
.address-panel { position: relative; z-index: 2; padding: 24px 26px 18px; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 15px; }
.panel-kicker { display: flex; align-items: center; gap: 10px; margin-bottom: 23px; }
.panel-kicker h2 { font-size: 13px; font-weight: 600; }
.section-number { font-size: 10px; color: var(--primary); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; border: 1px solid var(--input-border); border-radius: 5px; padding: 3px 5px; line-height: 1; }
.panel-caption { color: var(--text-tertiary); font-size: 9px; letter-spacing: 1.5px; margin-left: auto; }
.address-controls { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 16px; align-items: end; }
.address-field { display: flex; align-items: center; min-width: 0; height: 62px; background: var(--input-bg); border: 1px solid var(--input-border); border-radius: 9px; padding: 0 8px 0 18px; }
.address-symbol { color: var(--primary); font-size: 24px; margin-right: 13px; font-weight: 400; }
#mailboxId { flex: 1; width: 0; min-width: 0; border: 0; outline: none; background: transparent; padding: 14px 4px 14px 0; color: var(--text-primary); font: 500 clamp(14px, 1.7vw, 21px)/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: -.6px; }
#mailboxId::placeholder { font: 13px -apple-system, BlinkMacSystemFont, sans-serif; color: var(--text-tertiary); letter-spacing: 0; }
.copy-action { display: inline-flex; align-items: center; gap: 7px; height: 42px; flex-shrink: 0; padding: 0 14px; border-radius: 6px; color: #102a20; background: #58d9b0; font-size: 12px; font-weight: 600; }
.copy-action:hover { background: #7ee6c3; }
.copy-action .icon { width: 16px; height: 16px; }
.copy-action.is-copied { background: #a8efd7; }
.address-note { display: flex; align-items: center; gap: 6px; margin-top: 16px; font-size: 11px; color: var(--text-tertiary); line-height: 1.6; }
.note-dot { width: 4px; height: 4px; background: var(--text-tertiary); border-radius: 50%; flex-shrink: 0; }
.address-note a { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; color: var(--text-secondary); flex-shrink: 0; }
.address-note .icon { width: 13px; height: 13px; }

/* 自定义域名下拉浮层。 */
.domain-picker { min-width: 0; position: relative; }
.field-label { display: block; margin-bottom: 8px; font-size: 11px; color: var(--text-tertiary); }
.domain-toggle { display: flex; width: 100%; height: 62px; align-items: center; gap: 10px; padding: 0 16px; background: var(--input-bg); color: var(--text-primary); border: 1px solid var(--input-border); border-radius: 9px; text-align: left; }
.domain-toggle:hover, .domain-toggle[aria-expanded="true"] { border-color: var(--primary); background: var(--accent-soft); }
.domain-globe { color: var(--text-tertiary); display: flex; }
.domain-globe svg { width: 17px; height: 17px; }
.domain-value { font: 13px ui-monospace, SFMono-Regular, Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.domain-chevron { margin-left: auto; color: var(--text-tertiary); }
.domain-chevron svg { width: 15px; height: 15px; transition: transform .15s; }
.domain-toggle[aria-expanded="true"] .domain-chevron svg { transform: rotate(180deg); }
.domain-menu { position: absolute; top: calc(100% + 8px); right: 0; width: max-content; min-width: 100%; max-width: min(360px, calc(100vw - 40px)); max-height: 250px; overflow-y: auto; background: var(--surface-color); border: 1px solid var(--input-border); border-radius: 11px; padding: 6px; box-shadow: var(--shadow); z-index: 40; }
.domain-option { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 6px; font: 13px ui-monospace, SFMono-Regular, Consolas, monospace; text-align: left; color: var(--text-secondary); overflow-wrap: anywhere; }
.domain-option::before { content: '@'; color: var(--text-tertiary); }
.domain-option[aria-selected="true"] { color: var(--primary); background: var(--accent-soft); }
.domain-option[aria-selected="true"]::after { content: '✓'; margin-left: auto; padding-left: 10px; }
.domain-option:hover, .domain-option:focus { color: var(--text-primary); background: var(--surface-raised); outline: none; }

/* 历史地址与收件列表。 */
.inbox-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 22px; align-items: start; margin-top: 24px; }
.history-panel, .inbox-panel { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 15px; min-width: 0; }
.history-panel { padding: 21px 16px 17px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-heading h2 { font-size: 14px; font-weight: 600; }
.history-panel .panel-heading, .history-hint { margin-left: 5px; margin-right: 5px; }
.count-badge { display: inline-flex; justify-content: center; align-items: center; min-width: 22px; height: 21px; padding: 0 6px; border-radius: 5px; background: var(--surface-raised); color: var(--text-tertiary); font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.history-hint { font-size: 11px; color: var(--text-tertiary); line-height: 1.8; margin-top: 8px; margin-bottom: 17px; }
.mailbox-history { display: flex; flex-direction: column; gap: 5px; max-height: 310px; overflow-y: auto; }
.history-item { display: flex; min-width: 0; max-width: 100%; border: 1px solid transparent; border-radius: 8px; }
.history-item:hover { background: var(--surface-raised); }
.history-item.current { background: var(--accent-soft); border-color: color-mix(in srgb, var(--primary) 25%, transparent); }
.history-address { min-width: 0; flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 12px 4px 12px 10px; font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--text-secondary); }
.history-address::before { content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--border-color); vertical-align: middle; margin-right: 9px; }
.current .history-address { color: var(--primary); }
.current .history-address::before { background: var(--primary); }
.history-remove { width: 30px; flex-shrink: 0; color: var(--text-tertiary); font-size: 18px; border-radius: 0 6px 6px 0; }
.history-remove:hover { color: #ee9e95; background: rgba(220, 70, 60, .09); }
.history-footnote { border-top: 1px solid var(--border-color); padding-top: 14px; margin: 18px 5px 0; color: var(--text-tertiary); font-size: 10px; line-height: 1.8; }
.inbox-panel { min-height: 342px; overflow: hidden; }
.inbox-heading { padding: 22px 23px 19px; }
.inbox-title { display: flex; align-items: center; gap: 9px; }
.connection-badge { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--text-tertiary); }
.connection-badge > span:first-child { width: 5px; height: 5px; background: var(--text-tertiary); border-radius: 50%; }
.connection-badge.is-connected > span:first-child { background: var(--primary); box-shadow: 0 0 0 3px var(--accent-soft); }
.mail-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.mail-table th { color: var(--text-tertiary); padding: 12px 16px; font-size: 10px; font-weight: 500; text-align: left; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); background: var(--input-bg); }
.mail-table th:first-child { width: 27%; padding-left: 23px; }
.mail-table th:nth-child(2) { width: 35%; }
.mail-table th:nth-child(3) { width: 27%; }
.mail-table th:last-child { width: 11%; text-align: right; padding-right: 23px; }
.mail-table td { padding: 18px 16px; font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; }
.mail-table td:first-child { padding-left: 23px; }
.mail-table td:last-child { padding-right: 23px; }
.selected-row, .selected-card { background: var(--accent-soft); }
.mobile-mail-list { display: none; }
.inbox-empty { display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 42px 18px 35px; text-align: center; }
.empty-illustration { position: relative; display: flex; align-items: center; justify-content: center; width: 55px; height: 55px; border: 1px solid var(--border-color); border-radius: 16px; background: var(--input-bg); color: var(--text-tertiary); transform: rotate(-7deg); margin-bottom: 17px; }
.empty-illustration .icon { width: 27px; height: 27px; }
.empty-spark { position: absolute; right: -6px; top: -6px; width: 18px; height: 18px; line-height: 16px; border-radius: 50%; border: 1px solid var(--border-color); color: var(--primary); background: var(--surface-color); }
.inbox-empty h3 { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.inbox-empty p { font-size: 11px; color: var(--text-tertiary); margin-top: 8px; }
.empty-rule { height: 2px; width: 24px; background: var(--border-color); margin-top: 23px; border-radius: 2px; }
.workspace-footer { max-width: 1256px; margin: 0 auto; padding: 3px 36px 28px; display: flex; justify-content: space-between; gap: 15px; color: var(--text-tertiary); font-size: 10px; letter-spacing: .5px; }
.footer-dot { opacity: .4; padding: 0 9px; }

/* 共用页面、表单和邮件弹窗。 */
.admin-menu-item { color: var(--text-secondary); }
.admin-menu-item.active-menu { color: var(--primary); background: var(--accent-soft); }
.primary-action, button[data-i18n="save_all_settings"], button[data-i18n="login_button"] { background: var(--primary) !important; color: var(--bg-color) !important; }
.custom-address-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.custom-address-row input { flex: 1; min-width: 120px; width: 100%; padding: 12px; border: 1px solid var(--input-border); border-radius: 8px; background: var(--input-bg); color: var(--input-text); }
.custom-address-row span { font-size: 13px; color: var(--text-secondary); overflow-wrap: anywhere; }
#modal, #customModal { overflow-y: auto; }
#modalContent { max-height: 60vh; overflow-y: auto; overflow-x: hidden; overflow-wrap: anywhere; }
#rawContent { max-height: 40vh; overflow: auto; }
.mail-body-frame { width: 100%; min-height: 360px; border: 0; border-radius: 8px; background: white; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--input-border); border-radius: 4px; }
@media (max-width: 1020px) {
  .header-inner { gap: 18px; padding-left: 24px; padding-right: 24px; }
  .main-nav { margin-left: 0; }
  .nav-action { padding-left: 10px; padding-right: 10px; }
  .workspace-main { padding-left: 24px; padding-right: 24px; }
  .inbox-layout { grid-template-columns: 230px minmax(0, 1fr); gap: 16px; }
  .address-controls { grid-template-columns: minmax(0, 1fr) 210px; }
  .copy-action { padding: 0 11px; }
  .copy-action > span { display: none; }
}
@media (max-width: 760px) {
  .header-inner { flex-wrap: wrap; gap: 18px 12px; padding: 18px 20px 12px; }
  .brand-mark { width: 31px; height: 35px; border-radius: 8px 2px; }
  .brand-name { font-size: 18px; }
  .brand-name > span { font-size: 8px; letter-spacing: 3px; }
  .header-tools { margin-left: auto; }
  .header-tools .nav-action { font-size: 11px; padding: 5px 7px; }
  .tool-divider { display: none; }
  .main-nav { order: 3; flex-basis: 100%; gap: 10px; }
  .main-nav .nav-action { padding: 7px 13px; }
  .workspace-main { padding: 28px 20px 24px; }
  .workspace-intro { margin-bottom: 24px; }
  .workspace-intro h1 { margin-top: 12px; }
  .private-badge { display: none; }
  .eyebrow { font-size: 9px; }
  .intro-description { font-size: 12px; }
  .address-panel { padding: 19px 16px 16px; }
  .address-controls { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .panel-kicker { margin-bottom: 17px; }
  .panel-caption { font-size: 8px; }
  .address-field { height: 57px; padding-left: 12px; }
  #mailboxId { font-size: 16px; letter-spacing: -.5px; }
  .address-symbol { font-size: 21px; margin-right: 8px; }
  .domain-toggle { height: 49px; }
  .field-label { margin-bottom: 7px; }
  .domain-menu { width: 100%; }
  .address-note { flex-wrap: wrap; font-size: 10px; row-gap: 8px; }
  .address-note a { margin-left: 10px; }
  .inbox-layout { grid-template-columns: minmax(0, 1fr); margin-top: 18px; gap: 18px; }
  .history-panel { padding: 18px 14px 13px; }
  .history-hint { margin-bottom: 10px; }
  .mailbox-history { flex-direction: row; flex-wrap: wrap; gap: 6px; max-height: 142px; }
  .history-item { max-width: 100%; background: var(--input-bg); border-color: var(--border-color); }
  .history-address { padding: 9px 3px 9px 9px; font-size: 11px; }
  .history-address::before { margin-right: 6px; }
  .history-footnote { margin-top: 13px; padding-top: 12px; }
  .inbox-heading { padding: 20px 18px; }
  .desktop-mail-list { display: none; }
  .mobile-mail-list { display: flex; flex-direction: column; gap: 10px; padding: 0 14px; }
  .inbox-panel { min-height: 280px; }
  .inbox-empty { padding-top: 23px; }
  .workspace-footer { padding: 0 20px 24px; font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
