:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: #161616;
  background: #fafafa;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  --ink: #161616;
  --muted: #616161;
  --line: #e4e4e4;
  --paper: #fff;
  --soft: #f5f5f5;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input { font: inherit; }
:focus-visible { outline: 2px solid #505050; outline-offset: 3px; }
a { color: inherit; }
.shell { width: min(calc(100% - 48px), 980px); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); background: var(--paper); }
.header-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; text-decoration: none; }
.wordmark-icon, .empty-icon { display: grid; place-items: center; border-radius: 10px; }
.wordmark-icon { width: 32px; height: 32px; color: #fff; background: var(--ink); }
.envelope { position: relative; display: block; width: 16px; height: 12px; border: 1.4px solid currentColor; border-radius: 2px; overflow: hidden; }
.envelope::after { content: ''; position: absolute; left: 1px; top: -6px; width: 11px; height: 11px; transform: rotate(45deg); border-right: 1.4px solid currentColor; border-bottom: 1.4px solid currentColor; }
.header-link { padding: 7px 10px; border-radius: 7px; color: var(--muted); font-size: 13px; text-decoration: none; }
.header-link:hover { color: var(--ink); background: var(--soft); }

main.shell { display: grid; gap: 16px; padding-block: clamp(36px, 6vw, 72px) 56px; }
.welcome { padding-bottom: 16px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(35px, 6vw, 54px); line-height: 1.07; letter-spacing: -.075em; }
h2 { font-size: 17px; line-height: 1.4; letter-spacing: -.02em; }
.welcome p { margin-top: 12px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 15px; background: var(--paper); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 17px 24px; padding: 22px 24px; }
.panel-heading > div { min-width: 0; }
.panel-description { margin-top: 6px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.mailbox-address { margin-top: 6px; font: 600 clamp(15px, 2.8vw, 20px)/1.45 'IBM Plex Mono', ui-monospace, monospace; overflow-wrap: anywhere; }
.mailbox-details { display: grid; justify-items: start; gap: 10px; padding: 0 24px 22px; }
.mailbox-details .panel-description { margin-top: 0; }
.recovery-link { width: min(100%, 580px); padding: 9px 12px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: var(--soft); font: 13px/1.5 'IBM Plex Mono', ui-monospace, monospace; }
.actions { display: flex; flex-wrap: wrap; gap: 7px; }
.mailbox-heading .actions { flex-shrink: 0; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 37px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--paper); font-size: 13px; font-weight: 600; line-height: 1.45; white-space: nowrap; cursor: pointer; }
.button:hover { border-color: #bcbcbc; background: var(--soft); }
.button.primary { border-color: var(--ink); color: #fff; background: var(--ink); }
.button.primary:hover { border-color: #383838; background: #383838; }
.button:disabled { opacity: .5; cursor: default; }
.plus { font-size: 18px; font-weight: 400; line-height: 1; }

.inbox { overflow: hidden; scroll-margin-top: 12px; }
.inbox-heading { border-bottom: 1px solid var(--line); }
.inbox-empty { display: grid; justify-items: center; align-content: center; gap: 9px; min-height: 166px; padding: 24px 18px; color: var(--muted); font-size: 13px; }
.empty-icon { width: 39px; height: 39px; border: 1px solid var(--line); color: var(--ink); background: var(--soft); }
.mail-list { padding: 0; margin: 0; list-style: none; }
.mail-list li + li { border-top: 1px solid var(--line); }
.mail-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; min-width: 0; }
.mail-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 6px 15px; width: 100%; padding: 14px 24px; border: 0; color: var(--ink); background: var(--paper); text-align: start; cursor: pointer; }
.mail-row:hover { background: var(--soft); }
.mail-row:focus-visible { position: relative; outline-offset: -3px; }
.mail-subject, .mail-from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-subject { font-size: 14px; font-weight: 650; }
.mail-from { grid-row: 2; font-size: 12px; color: var(--muted); }
.mail-date { grid-column: 2; grid-row: 1; font-size: 12px; color: var(--muted); }
.mail-code { margin-inline-end: 24px; }
.mail-code code, .message-code-box code { font: 650 14px/1.45 'IBM Plex Mono', ui-monospace, monospace; letter-spacing: .035em; }
.inbox-pages { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; padding: 12px; border-top: 1px solid var(--line); }
.inbox-pages .panel-description { margin-top: 0; }
.message-code-box { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-top: 13px; padding: 9px 11px; border-radius: 7px; background: var(--soft); }
.message-code-box span { color: var(--muted); font-size: 13px; }

.dialog { width: min(calc(100% - 30px), 450px); max-height: calc(100% - 32px); padding: 23px; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: var(--paper); box-shadow: 0 24px 70px #0002; }
.dialog::backdrop { background: #18181850; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 15px; }
.dialog-heading h2 { min-width: 0; overflow-wrap: anywhere; }
.close-button { display: grid; place-items: center; flex: 0 0 auto; width: 27px; height: 27px; padding: 0; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: 21px; line-height: 1; cursor: pointer; }
.close-button:hover { color: var(--ink); background: var(--soft); }
.dialog label { display: block; margin: 15px 0 5px; font-size: 13px; font-weight: 600; }
.dialog input { display: block; width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; }
.restore-submit { width: 100%; margin-top: 17px; }
.error { margin-top: 10px; color: #9e302b; font-size: 13px; line-height: 1.55; }
.mailbox > .error { margin: 0 24px 20px; }
.message-dialog { width: min(calc(100% - 30px), 700px); }
.message-dialog .panel-description { margin-top: 8px; overflow-wrap: anywhere; }
.message-text { margin: 17px 0 0; padding-top: 15px; border-top: 1px solid var(--line); font: 14px/1.7 Inter, -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif; white-space: pre-wrap; overflow-wrap: anywhere; }
.notification:not(:empty) { position: fixed; z-index: 2; right: 20px; bottom: 20px; max-width: calc(100% - 40px); padding: 9px 13px; border-radius: 8px; color: #fff; background: var(--ink); font-size: 13px; line-height: 1.5; }

@media (max-width: 560px) {
  .shell { width: calc(100% - 28px); }
  .header-inner { min-height: 56px; }
  .welcome { padding-bottom: 7px; }
  .panel-heading { padding: 17px 16px; }
  .mailbox-heading { flex-wrap: wrap; }
  .mailbox-details { padding: 0 16px 17px; }
  .mailbox > .error { margin: 0 16px 16px; }
  .mail-row { padding-inline: 16px; }
  .mail-code { margin-inline-end: 16px; }
  .mail-date { grid-column: 1; grid-row: 3; }
  .dialog { padding: 18px; }
}
