:root {
  --paper: #fdfefb; --desk: #f1f5ee; --wash: #e3ede3; --ink: #1f332a;
  --muted: #51665b; --accent: #1c604c; --hover: #144835; --mint: #d4e9da;
  --line: #d7e0d7; --edge: #84968a; --rust: #963c31; --apricot: #f5dfb1;
  --mono: 'IBM Plex Mono', Consolas, 'Microsoft YaHei UI', monospace;
  font-family: 'Source Sans 3', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei UI', sans-serif;
  color: var(--ink); background: var(--paper); font-size: 16px; line-height: 1.55;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: transparent; }
button:disabled { opacity: .52; cursor: default; }
button:active:not(:disabled), a:active { transform: translateY(1px); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3, strong { font-family: 'Instrument Sans', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei UI', sans-serif; }
h1 { font-size: clamp(1.75rem, 3vw, 2.38rem); line-height: 1.25; font-weight: 700; letter-spacing: -.045em; }
h2 { font-size: 1.55rem; line-height: 1.4; letter-spacing: -.035em; }
h3 { font-size: 1.13rem; }
input, textarea { min-width: 0; width: 100%; border: 1px solid var(--edge); background: var(--paper); border-radius: 8px; padding: 11px 13px; }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
svg.icon { width: 1.2em; height: 1.2em; display: block; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.skip { position: fixed; top: -10rem; z-index: 10; background: var(--paper); padding: 10px; color: var(--accent); }
.skip:focus { top: 8px; left: 8px; }
.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; border-radius: 8px; white-space: nowrap; }
.button { min-height: 44px; padding: 8px 15px; }
.button.primary { background: var(--accent); color: var(--paper); }
.button.primary:hover:not(:disabled) { background: var(--hover); }
.button.secondary { background: var(--desk); color: var(--ink); }
.button.secondary:hover:not(:disabled), .icon-button:hover:not(:disabled) { background: var(--wash); }
.icon-button { min-width: 42px; min-height: 42px; color: var(--muted); padding: 8px; }
.full { width: 100%; }
.brand { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand strong { font-weight: 750; font-size: 1.48rem; letter-spacing: -.06em; }
.brand-mark { position: relative; display: inline-block; width: 35px; height: 35px; flex: none; border-radius: 9px; background: var(--accent); }
.brand-mark::before, .brand-mark::after { content: ''; position: absolute; }
.brand-mark::before { left: 7px; right: 7px; top: 11px; height: 13px; background: var(--paper); border-radius: 2px; }
.brand-mark::after { width: 12px; height: 12px; left: 11px; top: 6px; border: solid var(--accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.boot { min-height: 100svh; display: grid; place-content: center; justify-items: center; gap: 14px; }
.boot p, .intro, .meta, .field-help { color: var(--muted); }
.intro { margin-top: 7px; }
.login-page { min-height: 100svh; display: grid; place-items: center; padding: 32px; background: var(--desk); }
.login-board { display: grid; grid-template-columns: 1fr 1fr; width: min(100%, 920px); min-height: 508px; border-radius: 22px; background: var(--paper); overflow: clip; box-shadow: 0 16px 64px rgb(38 64 47 / .08); }
.login-art { position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; background: var(--mint); padding: clamp(25px, 4vw, 47px); min-width: 0; }
.art-caption h2 { font-size: clamp(1.8rem, 3.7vw, 2.62rem); }
.art-caption p { margin-top: 6px; color: var(--muted); }
.letter-scene { position: relative; width: min(63%, 195px); aspect-ratio: 1.3; margin: 38px auto 23px; transform: rotate(-9deg); }
.letter-shadow, .letter-back, .letter-sheet, .letter-front, .letter-seal { position: absolute; }
.letter-shadow { inset: 18% -5% -6% 5%; background: #a7c9b3; border-radius: 4px; transform: rotate(7deg); }
.letter-back { inset: 22% 0 0; background: #4b8268; border-radius: 4px; }
.letter-sheet { inset: 0 9% 7%; padding: 15% 12%; background: var(--paper); border-radius: 3px; transform: rotate(7deg); }
.letter-sheet i { display: block; width: 74%; margin-bottom: 7%; border-top: 2px solid var(--line); }
.letter-sheet i:last-child { width: 45%; }
.letter-front { inset: 26% 0 0; background: #77a78c; clip-path: polygon(0 0, 50% 48%, 100% 0, 100% 100%, 0 100%); border-radius: 4px; }
.letter-front::after { content: ''; position: absolute; inset: 0; background: #63977a; clip-path: polygon(0 100%, 48% 40%, 100% 100%); }
.letter-seal { width: 13%; aspect-ratio: 1; border-radius: 50%; inset: 57% auto auto 44%; background: var(--apricot); }
.login-main { align-self: center; padding: clamp(30px, 5vw, 68px); }
.login-main h1 { font-size: 2rem; }
.login-main .intro { margin-bottom: 30px; }
.field { margin-top: 18px; display: block; font-weight: 600; }
.field input, .field textarea { display: block; margin-top: 6px; font-weight: 400; }
.field small { font-size: .81rem; color: var(--muted); font-weight: 400; }
.form-error { margin-top: 14px; color: var(--rust); white-space: pre-wrap; overflow-wrap: anywhere; }
.form-error:empty { margin: 0; }
.login-main button { margin-top: 25px; }
.bar { min-height: 66px; padding: 9px clamp(18px, 3.2vw, 48px); display: flex; justify-content: space-between; align-items: center; gap: 16px; background: var(--paper); border-bottom: 1px solid var(--line); }
.bar-brand, .account, .drawer-head, .dialog-heading, .dialog-actions, .folder-header, .search-line, .list-bar, .nav-head, .pagination, .reader-top { display: flex; align-items: center; }
.bar-brand, .account { gap: 10px; min-width: 0; }
.bar-divider { height: 17px; width: 1px; background: var(--line); margin: 0 4px; }
.bar-name { color: var(--muted); font-weight: 550; }
.avatar { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: var(--apricot); font-size: .88rem; font-weight: 650; }
#user-name { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-nav { display: none; }
.workspace-grid { min-height: calc(100svh - 66px); display: grid; grid-template-columns: clamp(215px, 19vw, 280px) minmax(0, 1fr); }
#sidebar { background: var(--desk); padding: 25px clamp(12px, 2vw, 25px) 30px; }
.nav-heading { font-size: .82rem; font-weight: 650; letter-spacing: .03em; color: var(--muted); padding-inline: 9px; }
.nav-head { justify-content: space-between; margin: 27px 0 4px; }
.nav-entry { display: flex; align-items: center; width: 100%; text-align: left; min-height: 45px; gap: 10px; border-radius: 8px; padding: 8px 10px; }
.nav-entry:hover { background: var(--wash); }
.nav-entry[aria-current='page'] { background: var(--mint); color: var(--hover); font-weight: 650; }
#all-folders { margin-top: 8px; }
.nav-count { font: .83rem var(--mono); margin-left: auto; }
.nav-copy { min-width: 0; display: grid; overflow-wrap: anywhere; }
.nav-copy small { color: var(--muted); font: .75rem/1.5 var(--mono); }
#domain-list { display: grid; gap: 3px; margin-top: 9px; }
.nav-note { font-size: .88rem; color: var(--muted); padding: 8px 9px; }
main { min-width: 0; }
#list-pane, #reader { width: min(100%, 1160px); margin-inline: auto; padding: clamp(25px, 4vw, 60px) clamp(19px, 4vw, 70px); }
.folder-header, .list-bar, .dialog-heading, .drawer-head, .reader-top { justify-content: space-between; gap: 12px; }
.folder-header { align-items: flex-start; }
.folder-header > div { min-width: 0; overflow-wrap: anywhere; }
.search-line { gap: 8px; margin: 26px 0 22px; }
.search { min-width: 0; display: flex; align-items: center; flex: 1; gap: 9px; padding: 0 13px; border-radius: 8px; color: var(--muted); border: 1px solid var(--edge); background: var(--paper); }
.search input { background: transparent; border: 0; padding: 10px 0; border-radius: 2px; outline-offset: 1px; }
.search.compact { background: transparent; border-color: var(--edge); padding-inline: 9px; }
.search.compact input { font-size: .88rem; }
.list-bar { border-bottom: 1px solid var(--line); flex-wrap: wrap; }
#filters { display: flex; gap: 2px; }
#filters button { min-height: 44px; padding: 9px 12px 11px; color: var(--muted); position: relative; }
#filters button[aria-pressed='true'] { color: var(--accent); font-weight: 700; }
#filters button:hover { background: var(--desk); border-radius: 5px 5px 0 0; }
#filters button[aria-pressed='true']::after { content: ''; height: 3px; background: var(--accent); position: absolute; bottom: 0; left: 10px; right: 10px; border-radius: 4px 4px 0 0; }
.meta, .pagination { font-size: .84rem; font-variant-numeric: tabular-nums; }
.empty { min-height: 260px; display: grid; place-content: center; justify-items: center; text-align: center; padding: 28px 12px; gap: 8px; }
.empty p { color: var(--muted); max-width: 42ch; }
.empty .button { margin-top: 8px; }
.folder-icon { display: inline-grid; place-items: center; width: 45px; height: 45px; background: var(--mint); color: var(--accent); border-radius: 12px; }
.empty .folder-icon { margin-bottom: 5px; }
.message { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; width: 100%; gap: 12px; align-items: start; text-align: left; border-bottom: 1px solid var(--line); padding: 16px 8px; }
.message:hover { background: var(--desk); }
.read-dot { display: block; width: 7px; height: 7px; margin: 8px auto 0; background: transparent; border-radius: 50%; }
.message.unread .read-dot { background: var(--accent); }
.message-body, .message-end { display: grid; min-width: 0; gap: 3px; }
.sender-line, .subject-line, .excerpt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sender-line, .excerpt, .message-end { font-size: .85rem; color: var(--muted); }
.subject-line { font-size: 1.04rem; }
.message.unread .subject-line { font-weight: 700; }
.message-end { justify-items: end; gap: 6px; }
.message-end time { font-variant-numeric: tabular-nums; }
.row-recipient { padding-left: 5px; }
.pending { color: var(--muted); background: var(--desk); border-radius: 5px; font-size: .78rem; padding: 2px 6px; }
.handled { color: var(--accent); background: var(--wash); border-radius: 5px; font-size: .78rem; padding: 2px 6px; }
.pagination { justify-content: center; gap: 8px; margin-top: 15px; }
#reader { max-width: 1050px; }
.reader-top { align-items: flex-start; margin-bottom: 24px; }
.reader-subject { overflow-wrap: anywhere; font-size: clamp(1.55rem, 3vw, 2.25rem); }
.reader-meta { display: grid; grid-template-columns: max-content minmax(0,1fr); gap: 5px 16px; margin: 20px 0 0; padding-bottom: 21px; border-bottom: 1px solid var(--line); }
.reader-meta dt { color: var(--muted); }
.reader-meta dd { margin: 0; overflow-wrap: anywhere; }
.mail-body { margin: 26px 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; }
.attachments { display: grid; gap: 7px; }
.attachment { display: flex; width: fit-content; max-width: 100%; align-items: center; gap: 8px; padding: 10px 13px; border-radius: 8px; background: var(--desk); color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
.attachment:hover { background: var(--wash); text-decoration: underline; }
dialog { border: 0; border-radius: 16px; padding: 26px; background: var(--paper); color: var(--ink); width: min(460px, calc(100vw - 28px)); max-height: calc(100svh - 26px); overflow: auto; box-shadow: 0 18px 80px rgb(24 48 35 / .18); }
dialog::backdrop { background: rgb(29 48 37 / .39); }
.dialog-heading { margin-bottom: 13px; }
.dialog-actions { justify-content: flex-end; gap: 8px; margin-top: 20px; }
.existing { margin-top: 18px; }
.existing ul { list-style: none; padding: 0; margin: 6px 0; max-height: 135px; overflow: auto; }
.existing li { font: .88rem/1.8 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.field-help { margin-top: 5px; font-size: .85rem; }
details { background: var(--desk); padding: 10px 12px; margin-top: 16px; border-radius: 8px; font-size: .9rem; }
summary { cursor: pointer; font-weight: 600; }
details p { margin-top: 8px; overflow-wrap: anywhere; }
.toast:not(:empty) { position: fixed; bottom: max(16px, env(safe-area-inset-bottom)); right: 16px; left: auto; max-width: min(calc(100vw - 32px), 380px); background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 9px; z-index: 8; }
.sr { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
#drawer { margin: 0 auto 0 0; height: 100svh; max-height: 100svh; width: min(310px, 87vw); border-radius: 0 12px 12px 0; padding: 16px; background: var(--desk); }
.drawer-head { margin-bottom: 24px; }
@media (max-width: 720px) {
  .login-page { padding: 18px; }
  .login-board { max-width: 460px; min-height: auto; grid-template-columns: 1fr; }
  .login-art { padding: 23px; min-height: 155px; }
  .login-art .letter-scene { position: absolute; right: 10%; top: 2px; width: 93px; opacity: .8; }
  .login-art .art-caption { margin-top: 25px; }
  .art-caption h2 { font-size: 1.45rem; }
  .art-caption p { font-size: .85rem; }
  .login-main { padding: 24px; }
  .bar { padding: 7px 12px; min-height: 56px; gap: 8px; }
  .bar-brand, .account { gap: 6px; }
  .brand { gap: 7px; }
  .brand strong { font-size: 1.25rem; }
  .brand-mark { transform: scale(.9); }
  .bar-name, .bar-divider { display: none; }
  .workspace-grid { display: block; min-height: calc(100svh - 56px); }
  #sidebar { display: none; }
  .mobile-nav { display: inline-flex; }
  .icon-button { min-width: 44px; min-height: 44px; }
  .folder-header { flex-wrap: wrap; }
  #list-pane, #reader { padding: 25px 16px; }
  .search-line { margin: 20px 0 14px; }
  .list-bar { gap: 3px; }
  #filters button { padding-inline: 9px; }
  .refresh-label { display: none; }
  .message { gap: 7px; padding-inline: 0; }
  .reader-meta { column-gap: 11px; }
}
@media (max-width: 360px) { .meta { width: 100%; padding-bottom: 4px; } #user-name { max-width: 7ch; } }
@media (prefers-reduced-motion: reduce) { button:active:not(:disabled), a:active { transform: none; } }
@media (forced-colors: active) { .read-dot { forced-color-adjust: none; } .unread .read-dot, #filters button[aria-pressed='true']::after { background: Highlight; } .nav-entry[aria-current='page'] { outline: 1px solid Highlight; } }
