:root {
  --ink: #14213d;
  --muted: #667085;
  --line: #e6eaf0;
  --soft: #f5f7fb;
  --paper: #ffffff;
  --blue: #155eef;
  --blue-dark: #124fca;
  --blue-soft: #edf4ff;
  --red: #c4324a;
  --shadow: 0 16px 44px rgba(22, 34, 58, .12);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--soft);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: var(--soft); font-size: 16px; }
button, input { font: inherit; }
select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
button:focus-visible, summary:focus-visible { outline: 3px solid #8ab4ff; outline-offset: 3px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 16px 18px; background: #101828; color: white; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; background: var(--blue); color: white; font-weight: 800; box-shadow: 0 8px 22px rgba(21, 94, 239, .32); }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 1rem; }
.brand span { margin-top: 3px; color: #98a2b3; font-size: .78rem; }
.compose-import { width: 100%; border: 0; border-radius: 12px; padding: 12px 16px; background: var(--blue); color: white; font-weight: 700; text-align: left; transition: background .15s, transform .15s; }
.compose-import:hover { background: #2e6ef2; transform: translateY(-1px); }
.compose-import span { margin-right: 8px; font-size: 1.25rem; line-height: 0; }
.account-nav { margin-top: 22px; }
.nav-heading { margin: 22px 10px 8px; color: #667085; font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.account-row { position: relative; }
.account-item { width: 100%; min-width: 0; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 10px; padding: 10px 36px 10px 9px; background: transparent; color: #d0d5dd; text-align: left; }
.account-item:hover, .account-item.active { background: #1d2939; color: white; }
.account-icon { display: grid; place-items: center; width: 31px; height: 31px; flex: 0 0 31px; border-radius: 9px; background: #344054; color: #dbe7ff; font-size: .8rem; font-weight: 800; }
.all-icon { background: var(--blue); color: white; }
.account-copy { min-width: 0; }
.account-copy strong, .account-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { font-size: .86rem; font-weight: 650; }
.account-copy small { margin-top: 3px; color: #7f8b9d; font-size: .72rem; }
.status-ok { color: #75d7a5 !important; }
.status-auth, .status-error { color: #ff9c9c !important; }
.delete-account { position: absolute; top: 12px; right: 5px; opacity: 0; color: #98a2b3; }
.account-row:hover .delete-account, .delete-account:focus { opacity: 1; }
.logout-form { margin-top: auto; padding-top: 20px; }
.quiet-button { border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; background: white; color: #344054; }
.sidebar .quiet-button { width: 100%; border-color: #344054; background: transparent; color: #98a2b3; }

.workspace { min-width: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.topbar { min-height: 96px; display: flex; align-items: center; justify-content: space-between; padding: 20px 32px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.86); backdrop-filter: blur(14px); }
.eyebrow { margin: 0 0 5px; color: var(--blue); font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.topbar h1 { margin: 0; font-size: 1.55rem; letter-spacing: -.03em; }
.refresh-button { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 13px; background: var(--paper); color: #344054; }
.refresh-button:hover { border-color: #b9c9e8; color: var(--blue); }
.refresh-button.loading span:first-child { animation: spin .8s linear infinite; }
.mail-layout { min-height: 0; flex: 1; display: grid; grid-template-columns: minmax(320px, 36%) minmax(0, 64%); }
.message-panel { min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--paper); overflow: hidden; }
.panel-meta { display: flex; justify-content: space-between; padding: 13px 20px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.message-list { min-height: 0; overflow-y: auto; }
.message-card { width: 100%; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; border: 0; border-bottom: 1px solid #eef1f5; padding: 16px 18px; background: white; text-align: left; transition: background .12s; }
.message-card:hover, .message-card.active { background: #f5f8ff; }
.message-card.unread { box-shadow: inset 3px 0 var(--blue); }
.message-avatar, .sender-avatar { display: grid; place-items: center; border-radius: 50%; background: #e9effb; color: #315a9b; font-weight: 800; }
.message-avatar { width: 40px; height: 40px; }
.message-main { min-width: 0; }
.message-heading { display: flex; gap: 10px; align-items: baseline; }
.message-heading strong, .message-heading span, .message-subject, .message-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-heading strong { flex: 1; font-size: .9rem; }
.message-heading span { max-width: 42%; color: var(--muted); font-size: .7rem; }
.message-subject { display: block; margin-top: 5px; font-size: .87rem; font-weight: 650; color: #344054; }
.message-preview { display: block; margin-top: 4px; color: #7a8699; font-size: .78rem; }
.message-side { color: #7a8699; font-size: .8rem; }
.unread-dot { display: block; width: 7px; height: 7px; margin: 3px auto 0; border-radius: 50%; background: var(--blue); }
.sync-errors { margin: 12px 14px 0; border: 1px solid #ffc8cf; border-radius: 10px; padding: 10px 12px; background: #fff5f6; color: #9f2639; font-size: .8rem; }
.sync-errors p { margin: 3px 0; }

.reader-panel { min-width: 0; background: #f3f5f9; overflow-y: auto; }
.reader-empty { min-height: 100%; display: grid; place-content: center; justify-items: center; padding: 36px; text-align: center; }
.empty-glyph { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 22px; background: var(--blue-soft); color: var(--blue); font-size: 1.8rem; }
.reader-empty h2 { margin: 20px 0 8px; font-size: 1.15rem; }
.reader-empty p { max-width: 350px; margin: 0; color: var(--muted); line-height: 1.7; font-size: .9rem; }
.reader-content { position: relative; max-width: 860px; margin: 24px auto; padding: 32px clamp(22px, 3vw, 44px) 40px; border: 1px solid #e7ebf2; border-radius: 18px; background: white; box-shadow: 0 3px 18px rgba(16,24,40,.025); }
.reader-close { position: absolute; top: 18px; right: 22px; border: 0; background: transparent; color: var(--muted); font-size: 1.7rem; }
.reader-account { display: inline-block; margin: 0 0 16px; border-radius: 999px; padding: 5px 10px; background: var(--blue-soft); color: var(--blue-dark); font-size: .75rem; font-weight: 700; }
.reader-content h2 { max-width: 780px; margin: 0; font-size: clamp(1.25rem, 1.8vw, 1.65rem); line-height: 1.45; overflow-wrap: anywhere; letter-spacing: -.025em; }
.sender-line { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; align-items: center; margin-top: 22px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.sender-avatar { width: 42px; height: 42px; }
.sender-line strong, .sender-line small { display: block; }
.sender-line small { margin-top: 3px; color: var(--muted); font-size: .78rem; }
.sender-line time { color: var(--muted); font-size: .78rem; }
.recipient-line { display: grid; grid-template-columns: auto 1fr; gap: 9px; margin: 12px 0 0; color: var(--muted); font-size: .78rem; }
.recipient-line dt, .recipient-line dd { margin: 0; }
.mail-body { margin-top: 18px; color: #344054; overflow-wrap: anywhere; line-height: 1.85; font-size: .94rem; font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif; }
.mail-body p { margin: 0 0 16px; white-space: pre-line; }
.mail-body p:last-child { margin-bottom: 0; }
.mail-body.is-source { padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; white-space: pre-wrap; font-size: .83rem; line-height: 1.75; }
.inline-mail-link { color: var(--blue-dark); text-underline-offset: 3px; }
.mail-links { margin-top: 24px; }
.mail-links-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 10px; }
.mail-links-heading h3 { display: flex; gap: 7px; align-items: center; margin: 0; color: #475467; font-size: .76rem; font-weight: 650; }
#mail-link-count { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 5px; background: #edf2fa; color: #61708a; font-size: .66rem; }
#message-link-list { display: grid; gap: 8px; }
.mail-link-item { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 3px 10px; align-items: center; padding: 12px 14px; border: 1px solid #e4eaf5; border-radius: 11px; background: #f8faff; }
.link-symbol { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #e1e9fc; border-radius: 8px; background: white; color: #4673c5; font-size: 1rem; }
.mail-link-detail { min-width: 0; }
.mail-link-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: #254f91; font-size: .85rem; font-weight: 650; line-height: 1.5; text-decoration: none; overflow-wrap: anywhere; }
.mail-link-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.mail-link-host { display: block; margin-top: 2px; color: #7a879b; font-size: .7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-mail-link { border-color: #e1e7f0; padding: 7px 9px; background: white; color: #52627a; white-space: nowrap; font-size: .71rem; }
.mail-link-full { grid-column: 2 / -1; min-width: 0; }
.mail-link-full summary { display: inline-block; margin-top: 4px; color: #7b889d; cursor: pointer; font-size: .7rem; list-style: none; }
.mail-link-full summary::-webkit-details-marker { display: none; }
.mail-link-full summary::after { content: " ＋"; }
.mail-link-full[open] summary::after { content: " −"; }
.mail-link-url { display: block; max-height: 128px; overflow-y: auto; margin-top: 8px; border-radius: 7px; padding: 10px; background: #eef2f9; color: #61708a; font-family: ui-monospace, monospace; font-size: .71rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.body-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.body-toolbar > div:first-child { display: flex; align-items: center; gap: 8px; }
.body-toolbar strong { color: #475467; font-size: .76rem; font-weight: 650; }
#reader-body-meta { color: #98a2b3; font-size: .65rem; }
.body-tools { display: flex; gap: 7px; }
.body-tools button { border-color: #e8ecf3; padding: 6px 9px; font-size: .71rem; }
.body-tools button[aria-pressed="true"] { border-color: #b9cff6; background: #edf3ff; color: #315f9e; }
.mail-facts { margin: 0 0 18px; border: 1px solid #e9edf3; border-radius: 11px; padding: 6px 14px; background: #f8fafc; }
.mail-facts > div { display: grid; grid-template-columns: minmax(90px, 30%) minmax(0, 1fr); gap: 12px; padding: 9px 0; }
.mail-facts > div + div { border-top: 1px solid #e9edf3; }
.mail-facts dt, .mail-facts dd { margin: 0; font-size: .8rem; line-height: 1.65; }
.mail-facts dt { color: #7a879b; }
.mail-facts dd { color: #344054; overflow-wrap: anywhere; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.attachment-chip { border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; background: white; color: #344054; font-size: .78rem; text-decoration: none; }
.attachment-chip:hover { border-color: var(--blue); color: var(--blue); }

.loading-state, .empty-state { display: grid; place-items: center; align-content: center; min-height: 280px; padding: 32px; color: var(--muted); text-align: center; }
.spinner { width: 28px; height: 28px; border: 3px solid #dbe4f4; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-button { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; font-size: 1.25rem; }
.import-dialog { width: min(520px, calc(100vw - 30px)); border: 0; border-radius: 20px; padding: 0; box-shadow: var(--shadow); }
.import-dialog::backdrop { background: rgba(15, 23, 42, .54); backdrop-filter: blur(3px); }
.import-dialog form { padding: 26px; }
.dialog-head { display: flex; justify-content: space-between; gap: 20px; }
.dialog-head h2 { margin: 0; font-size: 1.4rem; }
.dialog-copy { color: var(--muted); line-height: 1.65; font-size: .88rem; }
.file-drop { display: grid; justify-items: center; gap: 7px; margin-top: 20px; border: 1px dashed #aebdd5; border-radius: 14px; padding: 28px 18px; background: #f8faff; text-align: center; cursor: pointer; }
.file-drop:hover { border-color: var(--blue); background: var(--blue-soft); }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-symbol { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: white; color: var(--blue); box-shadow: 0 6px 18px rgba(27, 59, 115, .09); font-size: .75rem; font-weight: 850; }
.file-drop small { color: var(--muted); font-size: .74rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.primary-button { border: 0; border-radius: 10px; padding: 10px 16px; background: var(--blue); color: white; font-weight: 700; }
.primary-button:hover { background: var(--blue-dark); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.import-result, .form-error { margin-top: 15px; border-radius: 10px; padding: 10px 12px; background: #fff3f4; color: var(--red); font-size: .82rem; }
.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; max-width: min(400px, calc(100vw - 48px)); border-radius: 12px; padding: 12px 16px; background: #101828; color: white; box-shadow: var(--shadow); font-size: .86rem; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 0%, #e5eeff 0, #f5f7fb 46%, #eef1f6 100%); }
.login-card { width: min(420px, 100%); border: 1px solid rgba(255,255,255,.8); border-radius: 24px; padding: 38px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
.login-card .brand-mark { margin-bottom: 24px; }
.login-card h1 { margin: 0; font-size: 1.8rem; letter-spacing: -.04em; }
.login-hint { margin: 10px 0 24px; color: var(--muted); }
.login-form { display: grid; gap: 11px; }
.login-form label { font-size: .85rem; font-weight: 700; }
.login-form input { width: 100%; border: 1px solid #ccd4e0; border-radius: 10px; padding: 11px 12px; outline: none; }
.login-form input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21,94,239,.12); }
.login-form .primary-button { margin-top: 5px; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 224px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .topbar { padding: 18px 20px; gap: 16px; flex-wrap: wrap; }
  .mail-layout { grid-template-columns: minmax(265px, 37%) minmax(0, 63%); }
  .reader-content { padding-inline: 22px; }
}

@media (max-width: 680px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; display: block; padding: 12px; overflow: visible; }
  .brand { display: inline-flex; padding: 0; vertical-align: middle; }
  .brand-mark { width: 36px; height: 36px; flex-basis: 36px; }
  .compose-import { float: right; width: auto; margin-top: 0; padding: 8px 13px; font-size: .85rem !important; }
  .compose-import span { font-size: 1rem; margin-right: 4px; }
  .account-nav { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; }
  .account-nav > .account-item, .account-row .account-item { width: auto; min-width: max-content; padding: 7px 9px; }
  .account-nav #account-list { display: flex; gap: 8px; }
  .account-icon { width: 29px; height: 29px; flex-basis: 29px; }
  .workspace { height: calc(100dvh - 180px); min-height: 500px; }
  .topbar { min-height: 76px; padding: 14px 18px; }
  .topbar h1 { font-size: 1.25rem; }
  .mail-layout { display: block; position: relative; }
  .message-panel { height: 100%; border-right: 0; }
  .reader-panel { position: absolute; inset: 0; display: none; background: white; }
  .reader-panel.open { display: block; }
  .reader-content { padding: 28px 20px 50px; }
  .sender-line { grid-template-columns: 40px minmax(0, 1fr); }
  .sender-line time { grid-column: 2; }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.identity { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 20px 8px 0; font-size: .82rem; overflow-wrap: anywhere; }
.role-badge { padding: 3px 7px; border-radius: 5px; background: #263854; color: #b4ceff; font-size: .7rem; }
.topbar-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.topbar-actions button { white-space: nowrap; font-size: .84rem; }
.mail-filters { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.mail-filters > input, .settings-form > input, .assignment-fieldset > input, .user-directory > input { width: 100%; min-width: 0; border: 1px solid #ccd4e0; border-radius: 9px; padding: 10px 12px; background: white; color: var(--ink); }
input:focus { outline: 2px solid #a6c7ff; outline-offset: 1px; }
input[readonly] { background: #f2f4f7; color: var(--muted); }
input[type="checkbox"] { width: 16px; height: 16px; flex: 0 0 16px; accent-color: var(--blue); }
.mail-filters > div { display: flex; gap: 18px; margin-top: 10px; }
.mail-filters label { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; color: var(--muted); }
.settings-dialog { width: min(480px, calc(100vw - 30px)); max-height: 90dvh; border: 0; border-radius: 18px; padding: 0; color: var(--ink); box-shadow: var(--shadow); }
.settings-dialog::backdrop { background: rgba(15, 23, 42, .54); backdrop-filter: blur(3px); }
.settings-form, .dialog-body { padding: 26px; }
.settings-form { display: flex; flex-direction: column; gap: 10px; }
.settings-form .dialog-copy { margin: 5px 0; }
.settings-form > label { font-size: .83rem; font-weight: 650; }
.field-hint, .login-note { font-size: .76rem; line-height: 1.65; color: var(--muted); }
.login-note { margin: 20px 0 0; }
.settings-form .dialog-actions { margin-top: 12px; }
.wide-dialog { width: min(720px, calc(100vw - 30px)); }
.info-list { display: grid; gap: 12px; }
.info-card { padding: 16px; border: 1px solid var(--line); border-radius: 10px; overflow-wrap: anywhere; }
.info-card p { margin: 8px 0; font-size: .85rem; }
.info-card small { color: var(--muted); line-height: 1.6; }
.admin-dialog { width: min(960px, calc(100vw - 30px)); }
.admin-layout { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 2fr); gap: 24px; }
.section-heading { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-heading h3, .user-editor h3 { margin: 0; font-size: 1rem; }
.section-heading button { font-size: .8rem; padding: 7px 10px; }
.users-list { display: grid; gap: 8px; margin-top: 12px; max-height: 460px; overflow-y: auto; }
.user-row { display: flex; flex-direction: column; gap: 5px; width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: white; color: var(--ink); text-align: left; overflow-wrap: anywhere; }
.user-row small { color: var(--muted); font-size: .75rem; }
.user-row:hover, .user-row.active { border-color: #a6c7ff; background: var(--blue-soft); }
.user-editor { padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe; }
.user-editor h3 { margin-bottom: 5px; overflow-wrap: anywhere; }
.checkbox-label { display: flex; align-items: center; gap: 8px; margin-block: 5px; }
.assignment-fieldset { min-width: 0; margin: 4px 0 0; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: white; }
.assignment-fieldset legend { padding: 0 5px; font-size: .83rem; font-weight: 650; }
.assignment-fieldset legend span { margin-left: 8px; font-size: .72rem; font-weight: 400; color: var(--muted); }
.assignment-actions { display: flex; gap: 12px; margin: 7px 0; }
.text-button { border: 0; background: transparent; color: var(--blue); padding: 5px 0; font-size: .76rem; }
.assignment-list { max-height: 210px; overflow-y: auto; font-size: .8rem; color: var(--muted); }
.assignment-option { display: flex; align-items: center; gap: 8px; padding: 8px 0; color: var(--ink); overflow-wrap: anywhere; }
.assignment-option:hover { color: var(--blue); }
.danger-button { margin-right: auto; border: 1px solid #fecdd3; border-radius: 10px; background: #fff1f2; color: #be123c; padding: 9px 14px; }
.audit-section { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 16px; }
.audit-section summary { cursor: pointer; font-size: .9rem; font-weight: 650; }
.audit-list { max-height: 270px; overflow-y: auto; font-size: .8rem; }
.audit-list article { padding: 12px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.audit-list p { margin: 6px 0; color: #475467; }
.audit-list small { color: var(--muted); }
.import-result { max-height: 240px; overflow-y: auto; }
.import-result.success { background: #ecfdf3; color: #147a45; }
.import-result p { margin: 5px 0; }
.import-options { display: grid; gap: 8px; font-size: .82rem; }
.import-options input, .import-options select, .account-settings-form input { width: 100%; min-width: 0; border: 1px solid #ccd4e0; border-radius: 9px; padding: 10px; background: white; color: var(--ink); }
#google-import-options { display: grid; gap: 8px; }
#google-import-options .field-hint { margin: 0 0 4px; }
.mail-filters > div { flex-wrap: wrap; align-items: center; }
#filter-label { max-width: 150px; padding: 5px; border: 1px solid var(--line); border-radius: 6px; background: white; font-size: .76rem; color: var(--ink); }
.account-copy .account-labels { color: #9dbbfb; font-size: .68rem; }
.account-labels:empty { display: none; }
.provider-badge { display: inline-block; margin: 0 0 0 8px; border-radius: 5px; padding: 3px 6px; background: var(--blue-soft); color: var(--blue-dark); font-size: .7rem; }
.account-tag-display { color: var(--blue-dark); font-size: .78rem !important; }
.account-settings-form { display: grid; gap: 10px; margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.account-settings-form label { display: grid; gap: 7px; font-size: .78rem; }
.account-settings-form .primary-button { justify-self: end; font-size: .8rem; }

@media (max-width: 680px) {
  .brand > div:last-child { display: block; }
  .identity { display: inline-flex; margin-top: 12px; }
  .sidebar .logout-form { display: inline-block; margin: 0 0 0 10px; padding: 0; }
  .logout-form .quiet-button { width: auto; padding: 5px 9px; font-size: .75rem; }
  .account-nav { margin-top: 10px; }
  .account-nav .nav-heading { display: none; }
  .account-copy { display: block; max-width: 170px; }
  .topbar { gap: 12px; }
  .topbar-actions { width: 100%; }
  .topbar-actions button { padding: 8px 10px; font-size: .78rem; }
  .topbar-actions .refresh-button { margin-left: auto; }
  .admin-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .users-list { max-height: 160px; }
  .settings-form, .dialog-body { padding: 20px; }
  .user-editor { padding: 16px; }
  .login-card { padding: 28px; }
  .delete-account { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.account-search { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; margin: 4px 0 16px; }
.credential-panel { margin-top: 14px; }
.credential-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.credential-actions .quiet-button { font-size: .78rem; text-decoration: none; }
.credential-detail { margin-top: 12px; padding: 14px; background: #f5f8ff; border-radius: 10px; }
.credential-detail > button { margin-top: 10px; font-size: .76rem; }
.password-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.password-row input { flex: 1 1 180px; min-width: 0; border: 1px solid var(--line); border-radius: 7px; padding: 10px; color: var(--ink); }
.password-row button { font-size: .76rem; }
.totp-panel { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 14px; padding: 14px; border: 1px solid #c7e4dc; border-radius: 10px; background: #f2faf7; }
.totp-panel > span { width: 100%; color: #26715a; font-size: .75rem; font-weight: 700; }
.totp-code { font-family: ui-monospace, monospace; font-size: 1.8rem; letter-spacing: .18em; color: #12543e; }
.totp-panel button { font-size: .75rem; }
.account-editor { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; }
.account-editor summary { cursor: pointer; font-size: .82rem; color: var(--blue); }
.account-editor .account-settings-form { border: 0; margin: 0; }
.account-settings-form .checkbox-label { display: flex; }
.account-settings-form input[type="checkbox"] { width: 16px; }
.settings-form > select { border: 1px solid #ccd4e0; border-radius: 9px; padding: 10px; background: white; color: var(--ink); }
.status-managed { color: #9dbdff !important; }

@media (min-width: 681px) {
  .reader-panel { padding: 0 18px; }
}
@media (max-width: 1100px) and (min-width: 681px) {
  .reader-panel { padding-inline: 10px; }
  .reader-content { padding-inline: 20px; margin-block: 16px; }
  .sender-line { grid-template-columns: 36px minmax(0, 1fr); }
  .sender-line time { grid-column: 2; margin-top: -5px; }
  .sender-avatar { width: 36px; height: 36px; }
}
@media (max-width: 680px) {
  .reader-panel { padding: 0; }
  .reader-content { margin: 0; border: 0; border-radius: 0; padding: 25px 18px 40px; box-shadow: none; }
  .reader-content h2 { padding-right: 16px; font-size: 1.3rem; }
  .reader-close { top: 17px; right: 14px; }
  .sender-line, .recipient-line { overflow-wrap: anywhere; }
  .mail-link-item { grid-template-columns: 26px minmax(0, 1fr) auto; gap: 3px 8px; padding: 11px 10px; }
  .link-symbol { width: 26px; height: 26px; }
  .copy-mail-link { padding: 7px; font-size: .67rem; }
  .mail-facts > div { grid-template-columns: 95px minmax(0, 1fr); gap: 10px; }
  .mail-body { font-size: .9rem; }
}

.attachment-list:empty { display: none; }
@media (max-width: 680px) {
  .reader-panel.open { position: fixed; inset: 0; z-index: 15; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; }
}
