:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --panel: #fff;
  --rail: #f8fafd;
  --ink: #24334b;
  --muted: #6b788c;
  --line: #e5ebf3;
  --hover: #edf2f9;
  --sel: #e8f0ff;
  --accent: #356be4;
  --accent-press: #2557c7;
  --ok: #227253;
  --err: #bd3e45;
  --radius: 10px;
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", sans-serif; }
button, input, select { font: inherit; }
button, a, summary, input, select { -webkit-tap-highlight-color: transparent; }
button, a, summary { touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
button:disabled { opacity: .48; cursor: default; }
:focus-visible { outline: 3px solid #9abbff; outline-offset: 3px; }
input:focus-visible, select:focus-visible { outline: 3px solid #e0eaff; outline-offset: 0; border-color: var(--accent); }
.icon { display: inline-block; width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }
.shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.topbar { display: flex; align-items: center; gap: 40px; min-height: 72px; flex: 0 0 auto; padding: 0 28px; }
.brand { display: inline-flex; align-items: center; flex-shrink: 0; gap: 11px; }
.brand-mark, .auth-mark { display: grid; place-items: center; background: var(--accent); color: white; border-radius: 11px; }
.brand-mark { width: 36px; height: 36px; box-shadow: 0 3px 7px #356be41a; }
.brand-mark .icon { width: 22px; height: 22px; }
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: .02em; }
.topbar-caption { margin-left: auto; color: var(--muted); font-size: 12px; letter-spacing: .05em; }
.topbar:has(.who:not([hidden])) .topbar-caption { display: none; }
.who { display: flex; align-items: center; justify-content: space-between; flex: 1; gap: 16px; min-width: 0; }
.nav-links, .user-tools, .actions { display: flex; align-items: center; gap: 8px; }
.link { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 8px; color: var(--muted); white-space: nowrap; }
a.link:hover { background: var(--hover); color: var(--ink); }
.link.active { color: var(--accent); background: #e6edfa; font-weight: 600; }
.who-name { max-width: 180px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-right: 15px; border-right: 1px solid #dce3ed; color: var(--muted); font-size: 13px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 7px 14px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink); font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:enabled { background: var(--accent-press); }
.btn-ghost { background: var(--panel); border-color: #dce3ed; }
.btn-ghost:hover:enabled, .btn-quiet:hover:enabled { background: var(--hover); }
.btn-quiet { color: var(--muted); }
.btn-danger { color: var(--err); border-color: #f1dadd; background: white; }
.btn-danger:hover:enabled { background: #fff2f3; }
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 8px; }
input[type="text"], input[type="password"], input[type="email"], input[type="search"], select { width: 100%; min-width: 0; height: 42px; padding: 0 12px; color: var(--ink); background: var(--panel); border: 1px solid #dbe3ee; border-radius: 8px; }
input::placeholder { color: #8591a4; font-size: 13px; }
input:disabled, select:disabled { background: var(--rail); color: var(--muted); }
.login { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 32px 32px 20px; }
.login-layout { width: min(1010px, 100%); margin: auto; display: grid; grid-template-columns: 1fr 410px; gap: 100px; align-items: center; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 650; letter-spacing: .12em; margin: 0 0 18px; }
.login-intro h1 { font-size: clamp(32px, 3.5vw, 46px); letter-spacing: -.025em; line-height: 1.5; margin: 0 0 18px; font-weight: 700; }
.intro-text { color: var(--muted); line-height: 1.95; font-size: 15px; margin: 0 0 24px; }
.intro-features { display: flex; gap: 24px; color: #536984; font-size: 12px; }
.intro-features span { display: flex; gap: 7px; align-items: center; }
.intro-features .icon { width: 16px; }
.auth { background: white; border: 1px solid var(--line); border-radius: 18px; padding: 36px; box-shadow: 0 12px 50px #2a4b7510; }
.auth-mark { width: 46px; height: 46px; background: #edf3ff; color: var(--accent); margin-bottom: 23px; }
.auth-mark .icon { width: 25px; height: 25px; }
.auth h2 { font-size: 25px; letter-spacing: -.02em; margin: 0 0 8px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.8; margin: 0 0 28px; }
.auth input { margin-bottom: 20px; height: 45px; }
.auth .btn-primary { width: 100%; min-height: 45px; margin-top: 4px; }
.auth-help { margin: 19px 0 0; border-top: 1px solid var(--line); padding-top: 20px; text-align: center; font-size: 12px; color: var(--muted); }
.login-footer { margin-top: 56px; text-align: center; font-size: 12px; color: #8290a3; }
.mail-illustration { width: 300px; height: 148px; margin-top: 35px; border: 1px solid #dfe7f3; border-radius: 12px; background: #ffffffa6; position: relative; }
.illustration-top { display: flex; gap: 5px; padding: 12px; border-bottom: 1px solid var(--line); }
.illustration-dot { width: 5px; height: 5px; border-radius: 100%; background: #ced9eb; }
.illustration-content { display: flex; height: 115px; }
.illustration-rail { width: 73px; background: #ebf1fb; padding: 15px 12px; border-radius: 0 0 0 12px; }
.mail-illustration i { display: block; height: 5px; border-radius: 3px; background: #dae4f4; margin-bottom: 11px; }
.illustration-rail i:first-child { background: #93b3f3; }
.illustration-message { padding: 17px 22px; flex: 1; }
.illustration-envelope { color: var(--accent); display: block; margin-bottom: 8px; }
.illustration-message i { height: 4px; margin-bottom: 7px; }
.illustration-message i:last-child { width: 60%; }
.illustration-check { display: grid; place-items: center; position: absolute; width: 42px; height: 42px; border-radius: 13px; background: #e0f3ec; color: #429578; right: -18px; bottom: 19px; border: 5px solid var(--bg); }
.app { flex: 1; display: flex; min-height: 0; min-width: 0; margin: 0 16px 16px; overflow: hidden; border: 1px solid #e1e7f0; border-radius: 12px; background: var(--panel); box-shadow: 0 3px 14px #20385d04; }
.rail { display: flex; flex-direction: column; width: 264px; flex: 0 0 264px; background: var(--rail); border-right: 1px solid var(--line); min-height: 0; }
.rail-head { display: flex; align-items: center; justify-content: space-between; min-height: 74px; padding: 20px 20px 14px; gap: 10px; }
.rail-head h1 { font-size: 16px; margin: 0; font-weight: 650; }
.rail-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.rail-head .rail-count { background: #eaf0f8; border-radius: 6px; padding: 1px 7px; }
.rail-head .rail-count:empty { display: none; }
.find { display: flex; align-items: center; margin: 0 14px 14px; position: relative; }
.find > .icon { position: absolute; left: 11px; width: 16px; color: #8091aa; pointer-events: none; }
.find input { height: 37px; padding-left: 35px; padding-right: 29px; font-size: 13px; }
.find kbd { position: absolute; right: 11px; color: #9aa7ba; font: 12px inherit; pointer-events: none; }
.find:focus-within kbd { display: none; }
.rail-list { flex: 1; overflow: auto; padding: 0 10px 12px; min-height: 80px; scrollbar-width: thin; }
.mailbox, .user-row { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 62px; margin: 0 0 3px; padding: 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink); text-align: left; }
.mailbox:hover, .user-row:hover { background: var(--hover); }
.mailbox.active, .user-row.active { background: var(--sel); border-color: #dce7fb; }
.mail { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.mailbox .local, .user-row .uname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.mailbox .domain, .user-row .badge { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { flex: 0 0 34px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: #e9eef6; color: #637a9a; font-size: 13px; font-weight: 650; }
.mailbox:nth-child(3n + 2) .avatar { background: #e5f0ef; color: #508881; }
.mailbox:nth-child(3n) .avatar { background: #efedf7; color: #8a7ba7; }
.mailbox.active .avatar, .user-row.active .avatar { background: #d4e3ff; color: var(--accent); }
.mailbox.active .local, .user-row.active .uname { color: #2b60c9; }
.rail-footer { margin: auto 16px 0; padding: 12px 0; border-top: 1px solid var(--line); font-size: 11px; color: #7c899d; }
.list-pane { display: flex; flex-direction: column; width: 326px; flex: 0 0 326px; min-width: 0; min-height: 0; border-right: 1px solid var(--line); }
.list-head { display: flex; align-items: center; gap: 8px; min-height: 75px; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.list-titles { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.list-titles strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.muted { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 9px 15px; border-bottom: 1px solid var(--line); }
.list-toolbar .btn { font-size: 12px; min-height: 32px; padding: 4px 8px; }
.count { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 12px; color: var(--muted); }
.count select { height: 30px; width: 65px; padding: 0 6px; font-size: 12px; }
.list { flex: 1; overflow: auto; scrollbar-width: thin; }
.mail-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 5px 10px; width: 100%; padding: 18px 20px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: inherit; text-align: left; position: relative; }
.mail-item:hover { background: #f7f9fc; }
.mail-item.active { background: #f0f5ff; }
.mail-item.active::before { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.mail-item .from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; font-size: 13px; }
.mail-item .when { color: #8390a2; font-size: 11px; white-space: nowrap; }
.mail-item .sub, .mail-item .snip { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item .sub { font-size: 13px; }
.mail-item .snip { color: #7b8799; font-size: 12px; }
.read { flex: 1; overflow: auto; padding: 34px clamp(24px, 3vw, 52px) 48px; min-width: 0; position: relative; }
.read h2 { font-size: 24px; font-weight: 650; line-height: 1.5; letter-spacing: -.02em; margin: 0 0 25px; overflow-wrap: anywhere; }
.from-row { display: flex; align-items: flex-start; gap: 12px; padding-bottom: 25px; margin-bottom: 28px; border-bottom: 1px solid var(--line); }
.from-row .avatar { width: 40px; height: 40px; flex-basis: 40px; border-radius: 50%; background: #eaf0ff; color: var(--accent); }
.from-meta { min-width: 0; }
.from-name { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.from-email, .from-when { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.body { margin: 0; max-width: 78ch; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 15px; line-height: 1.9; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-align: center; padding: 36px 22px; gap: 12px; margin: 0; min-height: 230px; }
.read:has(> .empty), #grant-empty { display: flex; flex-direction: column; }
.read > .empty, #grant-empty > .empty { flex: 1; padding-bottom: 80px; }
.empty-icon { display: grid; place-items: center; width: 72px; height: 72px; border: 1px solid #e4ebf6; border-radius: 22px; background: #f3f6fd; color: #8ca8d9; margin-bottom: 7px; }
.empty-icon .icon { width: 33px; height: 33px; }
.empty strong { color: #4d6280; font-size: 17px; font-weight: 550; }
.empty p { margin: 0; max-width: 26em; line-height: 1.9; font-size: 13px; }
.list .empty { padding: 46px 25px; min-height: 220px; }
.list .empty strong { font-size: 14px; }
.list .empty-icon { width: 48px; height: 48px; border-radius: 15px; }
.list .empty-icon .icon { width: 23px; height: 23px; }
.status { margin: 8px 0 0; font-size: 12px; overflow-wrap: anywhere; }
.status:empty { display: none; }
.status.err { color: var(--err); }
.status.ok { color: var(--ok); }
.rail-status { margin: 0 0 6px; }
.find-empty { text-align: center; margin: 30px 8px; font-size: 13px; color: var(--muted); }
.create-details { margin: 0 14px 18px; border: 1px solid #dce5f3; border-radius: 8px; background: #fff; flex-shrink: 0; }
.create-details summary { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; color: var(--accent); cursor: pointer; list-style: none; font-size: 13px; font-weight: 500; }
.create-details summary::-webkit-details-marker { display: none; }
.create-details[open] summary { border-bottom: 1px solid var(--line); }
.create-details[open] summary .icon { transform: rotate(45deg); }
.create { padding: 16px 12px; }
.create label { font-size: 12px; }
.create input { height: 37px; margin-bottom: 13px; }
.create .btn { width: 100%; }
.optional { color: #8a95a6; font-weight: 400; margin-left: 5px; }
.grant { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; background: var(--panel); }
.grant-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 25px 30px; border-bottom: 1px solid var(--line); }
.grant-titles { min-width: 0; }
.grant-titles .eyebrow { margin: 0 0 5px; font-size: 10px; color: var(--muted); }
.grant-head h2 { margin: 0; font-size: 21px; overflow-wrap: anywhere; }
.grant-head .actions { margin-left: auto; flex-wrap: wrap; gap: 8px; }
.actions .btn { font-size: 12px; min-height: 35px; padding: 6px 11px; }
.state-badge { color: var(--ok); background: #edf7f2; border-radius: 6px; padding: 3px 8px; font-size: 11px; }
.state-badge.disabled { color: var(--muted); background: #eef1f5; }
.state-badge:empty { display: none; }
.grant-intro { padding: 26px 30px 16px; }
.grant-intro h3 { font-size: 15px; margin: 0 0 5px; font-weight: 600; }
.grant-intro p { color: var(--muted); font-size: 12px; margin: 0; }
.grant-tools { display: flex; align-items: center; gap: 15px; padding: 0 30px 17px; }
.find-grant { width: min(380px, 100%); margin: 0; }
.checks { flex: 1; overflow: auto; padding: 0 30px 25px; min-height: 100px; }
.checks label { display: flex; align-items: center; gap: 13px; min-height: 56px; padding: 12px 15px; margin: 0; border-bottom: 1px solid #edf0f5; font-size: 13px; font-weight: 400; cursor: pointer; }
.checks label:first-child { border-top: 1px solid #edf0f5; }
.checks label:hover { background: var(--rail); }
.checks label:has(input:checked) { background: #f3f7ff; }
.checks input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
.checks label > .icon { color: #8297b7; width: 17px; }
.checks label > span { overflow-wrap: anywhere; min-width: 0; }
.grant-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 30px; border-top: 1px solid var(--line); background: #fbfcfe; }
.grant-footer strong { font-size: 13px; font-weight: 500; }
.grant-status { margin-top: 3px; }
.back { display: none; }
.is-loading .empty-icon { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 1180px) {
 .topbar { gap: 24px; padding: 0 22px; }
 .rail { width: 234px; flex-basis: 234px; }
 .list-pane { width: 292px; flex-basis: 292px; }
 .read { padding: 28px 24px; }
 .grant-head .actions { width: 100%; margin-left: 0; }
 .login-layout { gap: 50px; }
}
@media (max-width: 900px) {
 .topbar { padding: 0 18px; min-height: 64px; gap: 20px; }
 .brand-name { font-size: 17px; }
 .who-name { display: none; }
 .link { padding: 8px 10px; font-size: 13px; }
 .login-layout { gap: 40px; grid-template-columns: 1fr 370px; }
 .auth { padding: 30px; }
 .login-intro h1 { font-size: 33px; }
 .intro-features { flex-direction: column; gap: 10px; }
 .mail-illustration { width: 235px; }
 .rail { width: 210px; flex-basis: 210px; }
 .list-pane { width: 270px; flex-basis: 270px; }
 .read { padding: 24px 20px; }
 .read h2 { font-size: 21px; }
}
@media (max-width: 760px) {
 .topbar { min-height: 62px; padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
 .brand-mark { width: 31px; height: 31px; border-radius: 9px; }
 .brand { gap: 9px; }
 .brand-name { font-size: 16px; }
 .topbar-caption { font-size: 11px; }
 .topbar:has(.who:not([hidden])) { gap: 10px; }
 .who { flex-basis: 100%; }
 .nav-links { gap: 4px; }
 .link { padding: 6px 9px; font-size: 12px; gap: 5px; }
 .link .icon { width: 15px; height: 15px; }
 .user-tools .btn { padding: 5px 8px; min-height: 32px; font-size: 12px; }
 .user-tools .icon { display: none; }
 .login { padding: 28px 20px 20px; }
 .login-layout { display: block; max-width: 410px; }
 .login-intro { margin-bottom: 28px; }
 .login-intro .eyebrow { font-size: 10px; margin-bottom: 10px; }
 .login-intro h1 { font-size: 29px; line-height: 1.5; margin-bottom: 8px; }
 .login-intro h1 br { display: none; }
 .intro-text { font-size: 13px; margin: 0; }
 .desktop-break, .mail-illustration, .intro-features { display: none; }
 .auth { padding: 27px; border-radius: 14px; }
 .auth-mark { display: none; }
 .auth h2 { font-size: 22px; }
 .hint { margin-bottom: 23px; }
 .login-footer { margin-top: 28px; font-size: 11px; }
 .app { margin: 0 8px 8px; border-radius: 10px; }
 .rail, .list-pane, .read, .grant { width: 100%; flex: 1; min-width: 0; border-right: 0; }
 .app[data-pane="boxes"] .list-pane, .app[data-pane="boxes"] .read,
 .app[data-pane="list"] .rail, .app[data-pane="list"] .read,
 .app[data-pane="read"] .rail, .app[data-pane="read"] .list-pane,
 .app[data-pane="users"] .grant, .app[data-pane="grant"] .rail { display: none !important; }
 .back { display: inline-flex; font-size: 12px; min-height: 34px; }
 .rail-head { min-height: 65px; padding: 18px 20px 12px; }
 .rail-list { padding: 0 12px 12px; }
 .mailbox, .user-row { min-height: 64px; }
 .rail-footer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
 .list-head { padding: 14px; }
 .list-head .back { margin-right: 3px; }
 .list-toolbar { padding: 9px 17px; }
 .list-titles strong { font-size: 14px; }
 .read { padding: 20px; }
 .read > .back { align-self: flex-start; margin-bottom: 23px; }
 .read h2 { font-size: 22px; }
 .read > .empty { padding: 35px 0 75px; }
 .grant-head { padding: 18px; gap: 12px; }
 .grant-head .back { flex-shrink: 0; }
 .grant-head h2 { font-size: 18px; }
 .grant-head .actions { gap: 6px; }
 .actions .btn { padding: 5px 9px; font-size: 11px; }
 .grant-intro { padding: 21px 18px 16px; }
 .grant-tools { padding: 0 18px 15px; }
 .checks { padding: 0 15px 20px; }
 .checks label { padding: 13px 10px; }
 .grant-footer { padding: 15px 18px max(15px, env(safe-area-inset-bottom)); }
 .grant-footer strong { font-size: 12px; }
 .create-details[open] { max-height: 55dvh; overflow: auto; }
}
@media (max-width: 370px) {
 .link { padding: 6px; }
 .link .icon { display: none; }
 .auth { padding: 23px; }
 .login-intro h1 { font-size: 25px; }
}
