:root {
  color-scheme: dark;
  --app-bg: #0b1424;
  --app-bg-deep: #081120;
  --app-sidebar: #081120;
  --app-surface: #101b30;
  --app-surface-soft: #13233a;
  --app-surface-raised: #172740;
  --app-text: #e8eff8;
  --app-muted: #8d9bb1;
  --app-subtle: #62728a;
  --app-line: #1e3048;
  --app-line-strong: #2a405e;
  --app-primary: #10b981;
  --app-primary-dark: #34d399;
  --app-primary-soft: rgba(16, 185, 129, 0.13);
  --app-danger: #fb7185;
  --app-warning: #fbbf24;
  --app-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
  --control-height: 38px;
  --control-radius: 9px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

:root.light {
  color-scheme: light;
  --app-bg: #f3f6fa;
  --app-bg-deep: #eaf0f6;
  --app-sidebar: #ffffff;
  --app-surface: #ffffff;
  --app-surface-soft: #f7f9fc;
  --app-surface-raised: #edf8f4;
  --app-text: #17263d;
  --app-muted: #66758a;
  --app-subtle: #8694a7;
  --app-line: #e1e8ef;
  --app-line-strong: #cbd7e3;
  --app-primary: #059669;
  --app-primary-dark: #047857;
  --app-primary-soft: rgba(5, 150, 105, 0.1);
  --app-danger: #e11d48;
  --app-warning: #b7791f;
  --app-shadow: 0 12px 30px rgba(28, 54, 80, 0.08);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { min-width: 320px; color: var(--app-text); background: var(--app-bg); font-size: 13px; transition: color 180ms ease, background-color 180ms ease; }
button, input, select, textarea { font: inherit; }
button:not(:disabled) { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
[hidden] { display: none !important; }

button, input, select { outline: none; }
input, select, .compose-body {
  width: 100%;
  min-height: var(--control-height);
  border: 1px solid var(--app-line-strong);
  border-radius: var(--control-radius);
  color: var(--app-text);
  background: var(--app-bg-deep);
  padding: 0 11px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
input::placeholder { color: var(--app-subtle); }
input:focus, select:focus, .compose-body:focus { border-color: var(--app-primary); box-shadow: 0 0 0 3px var(--app-primary-soft); }

.auth-view {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 24px;
  background: var(--app-bg-deep);
}
.auth-view::before, .auth-view::after { position: absolute; content: ""; pointer-events: none; }
.auth-view::before { width: 520px; height: 1px; top: 18%; left: 0; background: #1a3a48; box-shadow: 880px 560px 0 #1a3a48; opacity: 0.45; }
.auth-view::after { width: 1px; height: 420px; top: 0; right: 18%; background: #1a3a48; box-shadow: -720px 460px 0 #1a3a48; opacity: 0.34; }
.auth-glow { position: absolute; width: 280px; height: 280px; border: 1px solid rgba(16, 185, 129, 0.08); border-radius: 50%; }
.auth-glow-one { top: -160px; right: -90px; }
.auth-glow-two { bottom: -190px; left: -100px; width: 340px; height: 340px; }
.auth-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 432px);
  padding: 36px;
  border: 1px solid var(--app-line-strong);
  border-radius: 16px;
  background: var(--app-surface);
  box-shadow: var(--app-shadow);
}
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 36px; border-radius: 10px; color: #04251a; background: var(--app-primary); font-size: 18px; font-weight: 900; }
.brand-copy { min-width: 0; display: grid; gap: 2px; }
.brand-copy strong { color: var(--app-text); font-size: 16px; line-height: 1.1; letter-spacing: 0.01em; }
.brand-copy small { color: var(--app-muted); font-size: 10px; font-weight: 600; }
.brand-large { margin-bottom: 54px; }
.brand-large .brand-mark { width: 42px; height: 42px; flex-basis: 42px; font-size: 20px; }
.brand-large .brand-copy strong { font-size: 20px; }
.auth-intro { margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; color: var(--app-primary-dark); font-size: 10px; font-weight: 850; letter-spacing: 0.12em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 9px; color: var(--app-text); font-size: 27px; line-height: 1.2; letter-spacing: 0; }
h2 { margin-bottom: 6px; color: var(--app-text); font-size: 17px; line-height: 1.3; }
.muted { color: var(--app-muted); }
.stack-form { display: grid; gap: 9px; }
label { color: var(--app-text); font-size: 11px; font-weight: 750; }
.input-wrap { position: relative; }
.input-wrap input { padding-left: 36px; }
.input-icon { position: absolute; z-index: 1; top: 10px; left: 12px; color: var(--app-primary-dark); font-weight: 800; }
.button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  padding: 0 12px;
  color: var(--app-text);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}
.button:active:not(:disabled) { transform: translateY(1px); }
.button-primary { color: #032318; background: var(--app-primary); box-shadow: 0 8px 18px rgba(16, 185, 129, 0.12); }
.button-primary:hover:not(:disabled) { background: var(--app-primary-dark); }
.button-secondary { border-color: var(--app-line-strong); color: var(--app-text); background: var(--app-surface-raised); }
.button-secondary:hover:not(:disabled) { border-color: var(--app-primary); color: var(--app-primary-dark); }
.button-large { width: 100%; min-height: 44px; margin-top: 9px; font-size: 13px; }
.button-arrow { margin-left: auto; font-size: 17px; line-height: 1; }
.button-symbol { color: currentColor; font-size: 16px; line-height: 1; }
.form-error, .inline-error { color: var(--app-danger); font-size: 12px; line-height: 1.5; }
.auth-footnote { display: flex; align-items: center; gap: 7px; margin-top: 30px; color: var(--app-muted); font-size: 10px; }

.app-view { min-height: 100vh; display: flex; background: var(--app-bg); }
.sidebar {
  width: 252px;
  min-height: 100vh;
  display: flex;
  flex: 0 0 252px;
  flex-direction: column;
  gap: 22px;
  padding: 20px 14px 15px;
  border-right: 1px solid var(--app-line);
  color: var(--app-text);
  background: var(--app-sidebar);
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 10px 20px; border-bottom: 1px solid var(--app-line); }
.sidebar-brand .brand-mark { width: 34px; height: 34px; flex-basis: 34px; border-radius: 9px; font-size: 17px; }
.sidebar-close { display: none; }
.compose-button { width: 100%; min-height: 42px; justify-content: flex-start; padding-left: 15px; }
.compose-button .button-symbol { font-size: 20px; }
.primary-nav, .folder-list { display: grid; gap: 4px; }
.nav-heading { margin: 0 12px 3px; color: var(--app-subtle); font-size: 10px; font-weight: 850; letter-spacing: 0.1em; }
.nav-item, .folder-item { width: 100%; min-height: 40px; display: flex; align-items: center; gap: 11px; border: 1px solid transparent; border-radius: 9px; padding: 0 12px; color: var(--app-muted); background: transparent; text-align: left; transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease; }
.nav-item:hover, .folder-item:hover { color: var(--app-text); background: var(--app-surface-soft); }
.nav-item.is-active { border-color: rgba(16, 185, 129, 0.17); color: var(--app-primary-dark); background: var(--app-primary-soft); font-weight: 800; }
.nav-icon { width: 19px; color: currentColor; font-size: 16px; line-height: 1; text-align: center; }
.nav-label { min-width: 0; flex: 1; }
.nav-count { min-width: 18px; color: var(--app-primary-dark); font-size: 11px; text-align: right; }
.sidebar-section { min-height: 0; overflow: auto; }
.sidebar-heading { display: flex; align-items: center; gap: 9px; margin: 2px 12px 8px; color: var(--app-subtle); font-size: 10px; font-weight: 850; letter-spacing: 0.07em; }
.sidebar-rule { height: 1px; flex: 1; background: var(--app-line); }
.folder-item { min-height: 34px; padding-left: 23px; font-size: 11px; }
.sidebar-footer { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--app-line); color: var(--app-muted); font-size: 10px; }
.online-row { display: flex; align-items: center; gap: 7px; }
.sidebar-footer-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 13px; color: var(--app-subtle); }
.status-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--app-primary); box-shadow: 0 0 0 3px var(--app-primary-soft); }
.main-shell { min-width: 0; min-height: 100vh; display: flex; flex: 1; flex-direction: column; }
.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 0 28px; border-bottom: 1px solid var(--app-line); background: var(--app-surface); }
.topbar-heading, .topbar-actions { min-width: 0; display: flex; align-items: center; gap: 13px; }
.topbar-actions { justify-content: flex-end; gap: 8px; }
.topbar-title { min-width: 0; }
.breadcrumb { display: flex; align-items: center; gap: 8px; color: var(--app-subtle); font-size: 11px; }
.breadcrumb b { color: var(--app-line-strong); font-weight: 500; }
.breadcrumb strong { color: var(--app-text); font-weight: 800; }
.topbar-title p { margin: 4px 0 0; color: var(--app-muted); font-size: 10px; }
.connection-state { display: inline-flex; align-items: center; gap: 6px; color: var(--app-primary-dark); font-size: 10px; font-weight: 700; white-space: nowrap; }
.connection-state i { width: 6px; height: 6px; border-radius: 50%; background: var(--app-primary); }
.icon-button, .theme-button { width: 34px; height: 34px; display: inline-grid; flex: 0 0 34px; place-items: center; border: 1px solid var(--app-line); border-radius: 9px; color: var(--app-muted); background: transparent; font-size: 17px; line-height: 1; }
.icon-button:hover, .theme-button:hover { border-color: var(--app-line-strong); color: var(--app-primary-dark); background: var(--app-primary-soft); }
.account-switcher { min-width: 0; display: flex; align-items: center; gap: 7px; }
.account-avatar { width: 28px; height: 28px; display: inline-grid; place-items: center; flex: 0 0 28px; border: 1px solid rgba(16, 185, 129, 0.22); border-radius: 8px; color: var(--app-primary-dark); background: var(--app-primary-soft); font-size: 13px; font-weight: 850; }
.account-select { width: 210px; min-height: 34px; border-color: var(--app-line); color: var(--app-text); background: var(--app-surface-soft); font-size: 11px; }
.account-label { max-width: 210px; overflow: hidden; color: var(--app-muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions > .icon-button { flex: 0 0 34px; }
.profile-trigger { min-height: 34px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; border-radius: 9px; padding: 0 7px; color: var(--app-muted); background: transparent; font-size: 11px; }
.profile-trigger:hover { border-color: var(--app-line); color: var(--app-text); background: var(--app-surface-soft); }
.profile-trigger .account-avatar { width: 26px; height: 26px; flex-basis: 26px; }
.profile-chevron { color: var(--app-subtle); font-size: 15px; }
.mobile-nav-button { display: none; }
.page-scroll { width: 100%; max-width: 1700px; min-width: 0; flex: 1; margin: 0 auto; padding: 26px 28px 34px; }
.workspace-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 0 auto 18px; }
.workspace-head h1 { margin-bottom: 5px; font-size: 25px; }
.workspace-head .muted { margin: 0; font-size: 11px; }
.mail-workbench { overflow: hidden; border: 1px solid var(--app-line); border-radius: 15px; background: var(--app-surface); box-shadow: var(--app-shadow); }
.mail-command-bar { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--app-line); background: var(--app-surface); }
.search-form { min-width: 0; display: flex; flex: 1 1 auto; align-items: center; gap: 8px; }
.search-form input { min-width: 160px; min-height: 34px; padding-left: 32px; border-color: var(--app-line); background: var(--app-bg-deep); }
.search-symbol { position: absolute; margin-left: 12px; color: var(--app-muted); font-size: 18px; line-height: 1; }
.search-button { min-height: 34px; }
.command-actions { flex: 0 0 auto; color: var(--app-subtle); font-size: 10px; }
.mail-layout { min-height: clamp(510px, calc(100vh - 255px), 820px); display: grid; grid-template-columns: minmax(320px, 0.85fr) minmax(420px, 1.35fr); }
.message-column { min-width: 0; border-right: 1px solid var(--app-line); }
.list-toolbar { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--app-line); background: var(--app-surface-soft); }
.section-title { color: var(--app-text); font-size: 11px; font-weight: 800; }
.list-toolbar-actions { min-width: 0; display: flex; align-items: center; gap: 9px; }
.list-toolbar .muted { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.text-button { min-height: 28px; border: 0; border-radius: 7px; padding: 0 8px; color: var(--app-primary-dark); background: transparent; font-size: 10px; font-weight: 750; white-space: nowrap; }
.text-button:hover:not(:disabled) { background: var(--app-primary-soft); }
.text-button.danger { color: var(--app-danger); }
.message-list { min-height: 0; display: grid; align-content: start; }
.message-row { position: relative; min-width: 0; min-height: 78px; display: grid; grid-template-columns: 7px minmax(0, 1fr); gap: 11px; width: 100%; border: 0; border-bottom: 1px solid var(--app-line); padding: 13px 15px; color: var(--app-text); background: var(--app-surface); text-align: left; transition: background-color 160ms ease; }
.message-row:hover { background: var(--app-surface-soft); }
.message-row.is-selected { background: var(--app-primary-soft); box-shadow: inset 3px 0 var(--app-primary); }
.message-indicator { width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: transparent; }
.message-indicator.is-unread { background: var(--app-primary); box-shadow: 0 0 0 3px var(--app-primary-soft); }
.message-content { min-width: 0; display: grid; gap: 5px; }
.message-line { min-width: 0; display: flex; align-items: center; gap: 8px; }
.message-line strong, .message-subject, .message-preview { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-line strong { flex: 1; color: var(--app-text); font-size: 11px; }
.message-row.is-unread .message-line strong, .message-row.is-unread .message-subject { font-weight: 850; }
.message-line time { color: var(--app-subtle); font-size: 9px; white-space: nowrap; }
.message-subject { flex: 1; color: var(--app-text); font-size: 11px; }
.message-preview { color: var(--app-muted); font-size: 10px; }
.star-indicator { color: var(--app-warning); font-size: 15px; line-height: 1; }
.list-state { min-height: 300px; display: grid; justify-items: center; align-content: center; gap: 7px; padding: 50px 25px; color: var(--app-text); text-align: center; }
.list-state strong { font-size: 12px; }
.list-state .muted { font-size: 10px; }
.loader { width: 20px; height: 20px; border: 2px solid var(--app-line-strong); border-top-color: var(--app-primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.detail-column { min-width: 0; background: var(--app-surface); }
.detail-empty { min-height: 100%; display: grid; justify-items: center; align-content: center; padding: 40px; text-align: center; }
.empty-mark { width: 44px; height: 44px; display: grid; place-items: center; margin-bottom: 15px; border: 1px solid rgba(16, 185, 129, 0.18); border-radius: 12px; color: var(--app-primary-dark); background: var(--app-primary-soft); font-size: 19px; }
.detail-empty h2 { margin-bottom: 5px; }
.detail-empty .muted { margin: 0; font-size: 11px; }
.detail-header { min-height: 112px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 23px 26px 17px; border-bottom: 1px solid var(--app-line); }
.detail-heading-copy { min-width: 0; }
.detail-heading-copy h2 { overflow-wrap: anywhere; font-size: 18px; }
.detail-heading-copy .eyebrow { margin-bottom: 7px; }
.detail-heading-copy .muted { margin: 0; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.star-button { color: var(--app-warning); background: var(--app-surface-soft); font-size: 21px; }
.detail-toolbar { min-height: 52px; display: flex; align-items: center; gap: 5px; padding: 9px 26px; border-bottom: 1px solid var(--app-line); background: var(--app-surface-soft); }
.detail-toolbar .button { min-height: 31px; font-size: 10px; }
.message-frame { display: block; width: calc(100% - 52px); min-height: 430px; margin: 22px 26px 28px; border: 1px solid var(--app-line); border-radius: 9px; background: #fff; }

.account-setup { min-height: 470px; display: grid; justify-items: center; align-content: center; padding: 40px 24px; border: 1px solid var(--app-line); border-radius: 15px; background: var(--app-surface); box-shadow: var(--app-shadow); text-align: center; }
.setup-icon { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 18px; border: 1px solid rgba(16, 185, 129, 0.2); border-radius: 14px; color: var(--app-primary-dark); background: var(--app-primary-soft); font-size: 22px; font-weight: 800; }
.account-setup .eyebrow { margin-bottom: 7px; }
.account-setup h2 { margin-bottom: 7px; font-size: 19px; }
.account-setup .muted { max-width: 360px; margin-bottom: 20px; font-size: 11px; line-height: 1.7; }

.alias-workbench { overflow: hidden; border: 1px solid var(--app-line); border-radius: 15px; background: var(--app-surface); box-shadow: var(--app-shadow); }
.alias-command-bar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--app-line); background: var(--app-surface); }
.alias-command-title { min-width: 0; display: flex; align-items: center; gap: 10px; }
.alias-command-title .setup-icon { width: 34px; height: 34px; flex-basis: 34px; margin: 0; border-radius: 9px; font-size: 15px; }
.alias-command-title .eyebrow { margin-bottom: 3px; }
.alias-command-title h2 { margin: 0; font-size: 14px; }
.alias-command-title p:last-child { margin: 3px 0 0; color: var(--app-muted); font-size: 10px; }
.alias-command-actions { display: flex; align-items: center; gap: 7px; }
.alias-command-actions .muted { font-size: 10px; white-space: nowrap; }
.alias-command-actions .button { min-height: 32px; padding-inline: 9px; font-size: 10px; }
.alias-helper { min-height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 16px; border-bottom: 1px solid var(--app-line); color: var(--app-muted); background: var(--app-surface-soft); font-size: 10px; }
.alias-select-all { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; color: var(--app-text); font-size: 10px; font-weight: 750; }
.alias-select-all input { width: 14px; min-height: 14px; accent-color: var(--app-primary); }
.alias-select-all:has(input:disabled) { opacity: 0.5; }
.alias-limit { margin-left: auto; color: var(--app-subtle); }
.alias-list { min-height: 360px; }
.alias-row { min-height: 70px; display: flex; align-items: center; gap: 12px; padding: 10px 17px; border-bottom: 1px solid var(--app-line); }
.alias-row:hover { background: var(--app-surface-soft); }
.alias-select { display: inline-grid; place-items: center; flex: 0 0 18px; }
.alias-select-checkbox { width: 15px; min-height: 15px; accent-color: var(--app-primary); }
.alias-icon { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 34px; border: 1px solid rgba(16, 185, 129, 0.2); border-radius: 9px; color: var(--app-primary-dark); background: var(--app-primary-soft); font-weight: 850; }
.alias-copy { min-width: 0; display: grid; flex: 1; gap: 4px; }
.alias-copy strong { min-width: 0; overflow: hidden; color: var(--app-text); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.alias-copy span { color: var(--app-muted); font-size: 10px; }
.alias-actions { display: flex; align-items: center; gap: 7px; }
.alias-code-button { min-height: 28px; border: 1px solid rgba(16, 185, 129, 0.28); border-radius: 7px; padding: 0 8px; color: var(--app-primary-dark); background: var(--app-primary-soft); font-size: 10px; font-weight: 750; white-space: nowrap; }
.alias-code-button:hover { border-color: var(--app-primary); background: rgba(16, 185, 129, 0.2); }
.alias-default-button { min-height: 28px; border: 1px solid var(--app-line); border-radius: 7px; padding: 0 8px; color: var(--app-muted); background: transparent; font-size: 10px; font-weight: 700; white-space: nowrap; }
.alias-default-button:hover:not(:disabled) { border-color: var(--app-primary); color: var(--app-primary-dark); background: var(--app-primary-soft); }
.alias-default-button.is-default { border-color: rgba(251, 191, 36, 0.2); color: var(--app-warning); background: rgba(251, 191, 36, 0.1); }
.alias-delete-button { width: 30px; height: 30px; flex-basis: 30px; color: var(--app-danger); font-size: 17px; }
.alias-error { min-height: 260px; display: grid; place-items: center; padding: 30px; text-align: center; }
.alias-address-input { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(130px, 0.75fr); align-items: center; gap: 7px; }
.alias-address-input > span { color: var(--app-muted); font-size: 14px; }
.alias-address-input select { min-width: 0; }
.api-code-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; align-items: center; }
.api-code-field input { min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 11px; }
.api-code-field .button { min-height: 36px; }
.api-code-dialog code { padding: 2px 4px; border: 1px solid var(--app-line); border-radius: 4px; color: var(--app-primary-dark); background: var(--app-surface-soft); font-size: 10px; }
.export-text-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; align-items: stretch; }
.export-text-field textarea { width: 100%; min-height: 106px; resize: vertical; padding: 9px 10px; border: 1px solid var(--app-line); border-radius: 8px; color: var(--app-text); background: var(--app-surface-soft); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 10px; line-height: 1.55; }
.export-text-field .button { align-self: start; min-height: 36px; }

.account-dialog { width: min(470px, calc(100% - 24px)); padding: 0; border: 1px solid var(--app-line-strong); border-radius: 15px; color: var(--app-text); background: var(--app-surface); box-shadow: 0 28px 72px rgba(0, 0, 0, 0.38); }
.account-dialog::backdrop { background: rgba(2, 6, 23, 0.72); backdrop-filter: blur(5px); }
.account-form { display: grid; gap: 9px; padding: 24px; }
.account-form .dialog-header { margin-bottom: 0; }
.dialog-note { margin: -2px 0 6px; color: var(--app-muted); font-size: 11px; line-height: 1.6; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; padding-top: 15px; border-top: 1px solid var(--app-line); }

.compose-dialog { width: min(720px, calc(100% - 24px)); max-height: calc(100vh - 24px); overflow: auto; padding: 0; border: 1px solid var(--app-line-strong); border-radius: 15px; color: var(--app-text); background: var(--app-surface); box-shadow: 0 28px 72px rgba(0, 0, 0, 0.38); }
.compose-dialog::backdrop { background: rgba(2, 6, 23, 0.72); backdrop-filter: blur(5px); }
.compose-form { display: grid; gap: 9px; padding: 24px; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 7px; }
.dialog-header h2 { margin: 0; font-size: 18px; }
.compose-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.compose-grid > div { display: grid; gap: 9px; }
.compose-body { min-height: 190px; overflow: auto; padding: 10px 11px; line-height: 1.6; }
.compose-footer { display: flex; align-items: center; gap: 11px; margin-top: 8px; }
.compose-footer .button { margin-left: auto; }
.file-button { display: inline-flex; align-items: center; gap: 4px; color: var(--app-primary-dark); cursor: pointer; }
.file-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.theme-button { font-size: 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.sidebar-backdrop { position: fixed; z-index: 20; inset: 0; background: rgba(2, 6, 23, 0.58); backdrop-filter: blur(2px); }

@media (max-width: 1100px) {
  .topbar { padding: 0 18px; }
  .page-scroll { padding: 22px 18px 28px; }
  .connection-state { display: none; }
  .account-select { width: 170px; }
  .mail-layout { grid-template-columns: minmax(290px, 0.85fr) minmax(360px, 1.15fr); }
}

@media (max-width: 820px) {
  .sidebar { position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; transform: translateX(-101%); transition: transform 180ms ease; box-shadow: 18px 0 50px rgba(0, 0, 0, 0.25); }
  .sidebar.sidebar-open { transform: translateX(0); }
  .sidebar-close, .mobile-nav-button { display: inline-grid; }
  .mobile-nav-button { flex: 0 0 34px; }
  .topbar { min-height: 66px; }
  .topbar-heading { gap: 10px; }
  .page-scroll { padding-top: 20px; }
  .mail-layout { min-height: 620px; grid-template-columns: minmax(270px, 0.9fr) minmax(320px, 1.1fr); }
  .command-hint { display: none; }
}

@media (max-width: 620px) {
  .auth-panel { padding: 28px 22px; }
  .brand-large { margin-bottom: 39px; }
  .topbar { align-items: flex-start; flex-direction: column; gap: 11px; padding: 12px 14px; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .topbar-title p { display: none; }
  .top-theme-button { display: none; }
  .account-select { width: min(44vw, 190px); }
  .account-label { max-width: 40vw; }
  .logout-label { display: none; }
  .page-scroll { padding: 17px 12px 22px; }
  .workspace-head { align-items: flex-start; }
  .workspace-head h1 { font-size: 22px; }
  .workspace-head .button { min-height: 32px; padding-inline: 9px; }
  .mail-command-bar { align-items: stretch; flex-direction: column; padding: 10px; }
  .search-form { width: 100%; }
  .search-form input { min-width: 0; }
  .mail-layout { display: block; min-height: 0; }
  .message-column { border-right: 0; }
  .detail-column { min-height: 520px; border-top: 1px solid var(--app-line); }
  .detail-empty { min-height: 280px; }
  .detail-header, .detail-toolbar { padding-left: 17px; padding-right: 17px; }
  .message-frame { width: calc(100% - 34px); margin-left: 17px; margin-right: 17px; }
  .list-toolbar { padding-left: 11px; padding-right: 11px; }
  .list-toolbar .muted { display: none; }
  .compose-grid { grid-template-columns: 1fr; }
  .compose-footer { flex-wrap: wrap; }
  .compose-footer .button { width: 100%; margin-left: 0; }
  .alias-command-bar { align-items: stretch; flex-direction: column; }
  .alias-command-actions { justify-content: flex-end; }
  .alias-helper { align-items: flex-start; flex-wrap: wrap; padding-top: 11px; padding-bottom: 11px; }
  .alias-limit { margin-left: 0; width: 100%; }
  .alias-row { align-items: flex-start; }
  .alias-actions { flex-direction: column; align-items: stretch; }
  .alias-default-button { min-width: 82px; }
  .alias-address-input { grid-template-columns: minmax(0, 1fr) auto; }
  .alias-address-input select { grid-column: 1 / -1; }
}
