:root {
  --brand: #cc0000;
  --red: var(--brand);
  --red-bright: color-mix(in srgb, var(--brand) 82%, white);
  --red-dark: color-mix(in srgb, var(--brand) 82%, black);
  --brand-soft: color-mix(in srgb, var(--brand) 12%, transparent);
  --brand-faint: color-mix(in srgb, var(--brand) 8%, transparent);
  --dark: #192126;
  --bg: #f4f5f6;
  --paper: #ffffff;
  --border: #e2e4e6;
  --text: rgba(0, 0, 0, 0.72);
  --text-muted: rgba(0, 0, 0, 0.55);
  --on-dark: #ffffff;
  --preview: rgba(0, 0, 0, 0.45);
  --row-hover: #f0f1f2;
  --unread-bg: #fff;
  --radius-btn: 4px;
  --radius-card: 16px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Source Sans 3", system-ui, sans-serif;
  --shadow: 0 8px 28px rgba(25, 33, 38, 0.06);
  --side-w: 220px;
  --icon-muted: #c4c7c5;
  --icon-hover: #5f6368;
  --star-gold: #f4b400;
  --search-bg: #f2f6fc;
  --search-field-bg: #ffffff;
}
html.theme-dark {
  --bg: #12181c;
  --paper: #1a2228;
  --border: #2a333a;
  --text: rgba(255, 255, 255, 0.86);
  --text-muted: rgba(255, 255, 255, 0.55);
  --preview: rgba(255, 255, 255, 0.4);
  --row-hover: #222b32;
  --unread-bg: #1e272e;
  --dark: #e8ecef;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  --search-bg: #1f1f1f;
  --search-field-bg: #2a2a2a;
  --icon-muted: #6b7280;
  --icon-hover: #d1d5db;
  --star-gold: #f4b400;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

/* ===== Custom Scrollbar (theme-aware, auto-hide on WebKit) ===== */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
*::-webkit-scrollbar {
  width: 0;
  height: 0;
  background: transparent;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
  transition: background 0.15s var(--ease-out);
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
*::-webkit-scrollbar-corner {
  background: transparent;
}

/* Auto-hide: show only when container hovered/focused */
*:hover::-webkit-scrollbar,
*:focus-within::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*:hover::-webkit-scrollbar-thumb,
*:focus-within::-webkit-scrollbar-thumb {
  background: var(--border);
}

/* Horizontal scrollbar (compose attachment bar) — thinner */
.compose-attach-bar::-webkit-scrollbar {
  height: 6px;
}
.compose-attach-bar:hover::-webkit-scrollbar {
  height: 6px;
}

/* Firefox: ensure thin scrollbar in dialogs/lists */
.wm-nav-scroll,
.wm-list,
.wm-read,
.dialog-form-body,
.settings-panel-body,
.sig-editor,
.compose-attach-bar {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--red);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-btn);
  background: var(--red);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}
.brand-logo {
  display: block;
  height: 32px;
  max-width: 160px;
  width: auto;
  object-fit: contain;
}
.brand.has-domain-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 100%;
}
.brand.has-domain-logo .brand-mark,
.brand.has-domain-logo .brand-text {
  display: none;
}
.brand.has-domain-logo .brand-logo {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 200px;
  margin: 0 auto;
  object-fit: contain;
}
.brand-logo.hidden { display: none !important; }
.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  font-size: 1.25rem;
  line-height: 1;
  user-select: none;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1.1rem;
  border: 1px solid var(--red);
  border-radius: var(--radius-btn);
  background: var(--red);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--red-bright); border-color: var(--red-bright); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-bright); border-color: var(--red-bright); color: #fff; }
.btn-secondary {
  background: var(--paper);
  border-color: var(--border);
  color: var(--dark);
}
.btn-secondary:hover {
  background: #e8eaed;
  border-color: #dadce0;
  color: var(--dark);
}
html.theme-dark .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  color: #e8ecef;
}
.btn-danger {
  background: transparent;
  border-color: transparent;
  color: var(--red);
}
.btn-danger:hover {
  background: color-mix(in srgb, var(--red) 12%, transparent);
  border-color: transparent;
  color: var(--red);
}
html.theme-dark .btn-danger,
html.theme-dark .btn-danger:hover {
  color: color-mix(in srgb, var(--brand) 45%, white);
}
.btn-danger-solid {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.btn-danger-solid:hover {
  background: var(--red-bright);
  border-color: var(--red-bright);
  color: #fff;
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--row-hover); color: var(--dark); }
.btn-icon { min-width: 2.25rem; width: 2.25rem; height: 2.25rem; padding: 0.4rem; }
.btn-compact { padding: 0.4rem 0.75rem; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn-compose {
  width: 100%;
  margin-bottom: 0.75rem;
  border-radius: 1.25rem;
  padding: 0.85rem 1.25rem;
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
  gap: 0;
}
/* Default: icon hidden (desktop sidebar shows text only). FAB re-enables it. */
.btn-compose:not(.btn-compose-fab) .btn-compose-icon { display: none; }

.login-body {
  min-height: 100dvh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.25rem;
  box-sizing: border-box;
  background: var(--bg);
}
.login-shell {
  width: min(920px, 100%);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.login-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 1.5rem 2.5rem;
  align-items: stretch;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 2.5rem 2.25rem;
  box-sizing: border-box;
}
.login-hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1rem;
  padding: 0.25rem 0 0;
  text-align: left;
  min-width: 0;
}
.login-hero-brand {
  margin: 0;
  text-decoration: none;
}
.login-hero-brand.brand {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.85rem;
  font-size: 2.25rem;
}
.login-hero .brand-mark {
  width: 96px;
  height: 96px;
  font-size: 1.75rem;
  border-radius: 14px;
}
.login-hero .brand.has-domain-logo {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  width: auto;
  max-width: 100%;
}
.login-hero .brand.has-domain-logo .brand-logo {
  display: block;
  width: auto;
  max-width: 360px;
  height: auto;
  max-height: 180px;
  margin: 0;
  object-fit: contain;
}
.login-sub {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.4;
}
.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 0;
}
.login-panel form {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 220px;
}
.login-pass-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.login-pass-wrap input {
  padding-right: 2.75rem;
}
.login-pass-toggle {
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  background: transparent;
  border: none;
  box-shadow: none;
}
.login-pass-toggle:hover {
  color: var(--dark);
  background: var(--brand-faint);
}
.login-pass-toggle .material-symbols-outlined {
  font-size: 1.25rem;
}
.login-panel .turnstile-wrap {
  margin: 0 0 1rem;
  min-height: 65px;
}
.login-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 1.25rem;
}
.login-submit {
  min-width: 7rem;
  border-radius: 999px;
  padding: 0.7rem 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}
.login-submit.sending,
.login-submit:disabled {
  cursor: wait;
  opacity: 0.92;
}
.login-submit-spinner {
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: compose-send-spin 0.65s linear infinite;
  flex-shrink: 0;
}
.login-footer {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 0.35rem;
}
.login-lang-label {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.login-lang {
  appearance: none;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  color: var(--dark);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.4rem 1.8rem 0.4rem 0.6rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) calc(50% - 2px), calc(100% - 8px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
  width: auto;
  min-width: 0;
  max-width: 9rem;
}
.login-lang:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-soft);
  border-color: var(--brand);
}
@media (max-width: 799px) {
  .login-body {
    overflow-y: auto;
    padding: 1.25rem 1rem 2rem;
  }
  .login-card {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    border-radius: 24px;
    padding: 1.75rem 1.35rem 1.5rem;
  }
  .login-hero {
    align-items: flex-start;
    justify-content: flex-start;
  }
  .login-hero-brand.brand {
    font-size: 1.35rem;
  }
  .login-hero .brand-mark {
    width: 48px;
    height: 48px;
    font-size: 1rem;
  }
  .login-hero .brand.has-domain-logo .brand-logo {
    max-width: 180px;
    max-height: 64px;
  }
  .login-panel form {
    min-height: 0;
  }
  .login-actions {
    margin-top: 0.5rem;
  }
}
.field { margin: 0 0 0.9rem; }
.field label {
  display: block;
  margin-bottom: 0.3rem;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}
input, textarea, select {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  font: inherit;
  color: var(--dark);
  background: var(--paper);
}
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--red);
}
.field select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--paper);
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) calc(50% - 2px), calc(100% - 9px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2rem;
  cursor: pointer;
  /* Reserve focus ring so hover/focus does not shift nearby labels */
  box-shadow: 0 0 0 2px transparent;
}
.field select:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 2px var(--brand-soft, rgba(204,0,0,0.12));
}
html.theme-dark .field select option {
  background: var(--paper);
  color: var(--dark);
}
#signature { resize: none; }
.sig-editor-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--paper);
  overflow: visible;
}
.sig-toolbar {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.25rem 0.35rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--paper) 92%, var(--dark));
  border-radius: var(--radius-btn) var(--radius-btn) 0 0;
  position: relative;
  z-index: 1;
}
.sig-toolbar .btn-icon {
  width: 2rem;
  height: 2rem;
}
.sig-toolbar .material-symbols-outlined { font-size: 1.15rem; line-height: 1; }
.editor-font-size {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 2rem;
  margin-left: 0.25rem;
  flex-shrink: 0;
}
.editor-font-size-btn {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  height: 2rem;
  padding: 0 0.1rem 0 0.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--paper);
  color: var(--dark);
  font-family: inherit;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
}
.editor-font-size-btn:hover,
.editor-font-size-btn[aria-expanded="true"] {
  border-color: var(--dark);
}
.editor-font-size-btn:focus-visible {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 2px var(--brand-soft);
}
.editor-font-size-btn:disabled {
  cursor: default;
  opacity: 0.55;
}
.editor-font-size-btn .material-symbols-outlined {
  font-size: 1.15rem;
  line-height: 1;
}
.editor-font-size-caret { font-size: 1.2rem !important; margin-left: -0.15rem; }
.editor-font-size-label {
  min-width: 3.35rem;
  text-align: left;
}
.editor-font-size-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 0.25rem);
  z-index: 8;
  min-width: 9.5rem;
  padding: 0.3rem 0;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow);
}
.editor-font-size-menu.hidden { display: none !important; }
.editor-font-size-menu button {
  display: flex;
  align-items: center;
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  padding: 0.4rem 0.85rem;
  color: var(--dark);
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  white-space: nowrap;
}
.editor-font-size-menu button:hover,
.editor-font-size-menu button.is-on {
  background: var(--row-hover);
}
.editor-font-size-menu button.is-on {
  color: var(--red);
  font-weight: 600;
}
.sig-editor {
  min-height: 7.5rem;
  max-height: 14rem;
  overflow-y: auto;
  padding: 0.65rem 0.8rem;
  font: inherit;
  color: var(--dark);
  outline: none;
  line-height: 1.45;
  word-break: break-word;
  border-radius: 0 0 var(--radius-btn) var(--radius-btn);
}
.sig-editor:focus {
  box-shadow: inset 0 0 0 2px var(--brand-soft);
}
.sig-editor:empty:before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}
.sig-auto-check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-top: 0.85rem;
  font-size: 0.9rem;
  color: var(--dark);
  cursor: pointer;
  line-height: 1.35;
}
.sig-auto-check input {
  width: auto;
  margin-top: 0.15rem;
  accent-color: var(--red);
  flex-shrink: 0;
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}
.compose-sig-preview {
  margin-top: 0.75rem;
  margin-bottom: 0.35rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid #dadce0;
  border-left: 3px solid var(--red);
  border-radius: 8px;
  background: #f8f9fa;
  flex-shrink: 0;
  user-select: text;
  cursor: default;
}
.compose-locked-block {
  position: relative;
}
.compose-locked-badge {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #5f6368;
  margin-bottom: 0.45rem;
}
.compose-locked-badge .material-symbols-outlined {
  font-size: 0.95rem;
  color: var(--red);
}
.compose-locked-hint {
  margin-left: auto;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  font-size: 0.72rem;
  color: #80868b;
  background: #e8eaed;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}
.compose-quote-remove {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: #5f6368;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  font-size: 1.05rem;
  line-height: 1;
  flex-shrink: 0;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.compose-quote-remove:hover {
  background: rgba(95, 99, 104, 0.14);
  color: #202124;
}
.compose-sig-preview-html {
  font-size: 0.92rem;
  line-height: 1.45;
  color: #202124;
  word-break: break-word;
}
.compose-sig-preview-html a { color: var(--red); }
.compose-quote-preview {
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid #dadce0;
  border-left: 3px solid #9aa0a6;
  border-radius: 8px;
  background: #f8f9fa;
  flex-shrink: 0;
  user-select: text;
  cursor: default;
}
.compose-quote-header {
  font-size: 0.8rem;
  color: #5f6368;
  margin-bottom: 0.45rem;
  line-height: 1.35;
}
.compose-quote-body {
  margin: 0;
  padding: 0.35rem 0 0.15rem 0.75rem;
  border-left: 3px solid #dadce0;
  color: #202124;
  font-size: 0.88rem;
  line-height: 1.45;
  max-height: none;
  overflow: visible;
  word-break: break-word;
}
.compose-quote-body img { max-width: 100%; height: auto; }

/* Gmail-like compose window */
.compose-backdrop.dialog-backdrop {
  background: transparent;
  place-items: end;
  justify-content: end;
  align-items: end;
  padding: 0 1rem 1rem 0;
  pointer-events: none;
  z-index: 55;
}
.compose-backdrop.open {
  display: grid;
}
.compose-window {
  pointer-events: auto;
  width: min(580px, calc(100vw - 1.5rem));
  height: min(560px, calc(100dvh - 1.5rem));
  max-height: calc(100dvh - 1.5rem);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 8px 28px rgba(32, 33, 36, 0.28), 0 1px 3px rgba(32, 33, 36, 0.12);
  overflow: hidden;
  color: #202124;
  font-family: var(--font-body);
  transition: width 0.2s var(--ease-out), height 0.2s var(--ease-out);
}
.compose-window.expanded {
  width: min(920px, calc(100vw - 1.5rem));
  height: min(85dvh, calc(100dvh - 1.5rem));
}
.compose-window.minimized {
  height: 3rem;
  width: min(320px, calc(100vw - 1.5rem));
}
.compose-window.minimized .compose-fields,
.compose-window.minimized .compose-body-area,
.compose-window.minimized .compose-attach-bar,
.compose-window.minimized .compose-format-bar,
.compose-window.minimized .compose-foot {
  display: none !important;
}
.compose-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem 0.55rem 1rem;
  background: #f2f6fc;
  color: #001d35;
  flex-shrink: 0;
  cursor: default;
  user-select: none;
}
.compose-head h2 {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0;
  color: #001d35;
}
.compose-head-actions {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}
.compose-icon-btn {
  border: 0;
  background: transparent;
  color: inherit;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.compose-icon-btn .material-symbols-outlined {
  font-size: 1.2rem;
}
.compose-head .compose-icon-btn {
  color: #444746;
}
.compose-head .compose-icon-btn:hover {
  background: rgba(68, 71, 70, 0.08);
}
.compose-fields {
  flex-shrink: 0;
  background: #fff;
}
.compose-from-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.65rem 1rem 0.45rem;
  font-size: 0.875rem;
  color: #202124;
  border-bottom: 1px solid #e8eaed;
}
.compose-from-label {
  color: #5f6368;
  font-weight: 400;
}
.compose-from-value {
  color: #202124;
  font-weight: 500;
}
.compose-field-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.15rem 1rem;
  min-height: 2.4rem;
  border-bottom: 1px solid #e8eaed;
}
.compose-field-label {
  flex-shrink: 0;
  min-width: 1.75rem;
  margin: 0;
  padding-top: 0.7rem;
  font-size: 0.875rem;
  font-weight: 400;
  color: #5f6368;
}
.compose-field-input {
  flex: 1;
  min-width: 0;
  border: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  background: transparent;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  color: #202124;
  font-family: inherit;
  border-radius: 0;
}
.compose-chip-field {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0;
  cursor: text;
}
.compose-chips {
  display: contents;
}
.compose-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  max-width: 100%;
  padding: 0.15rem 0.2rem 0.15rem 0.55rem;
  border-radius: 999px;
  background: #e8f0fe;
  color: #174ea6;
  font-size: 0.8rem;
  line-height: 1.25;
  cursor: default;
  user-select: none;
}
.compose-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 16rem;
}
.compose-chip-remove {
  border: 0;
  background: transparent;
  color: #174ea6;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.75;
}
.compose-chip-remove:hover {
  background: rgba(23, 78, 166, 0.12);
  opacity: 1;
}
.compose-chip.invalid {
  background: #fce8e6;
  color: #c5221f;
}
.compose-chip.invalid .compose-chip-remove {
  color: #c5221f;
}
.compose-chip.invalid .compose-chip-remove:hover {
  background: rgba(197, 34, 31, 0.12);
}
.compose-chip-input {
  flex: 1 1 8rem;
  min-width: 6rem;
  border: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  background: transparent;
  padding: 0.35rem 0;
  font-size: 0.9rem;
  color: #202124;
  font-family: inherit;
}
.compose-subject-row {
  align-items: center;
}
.compose-subject-row .compose-field-input {
  padding: 0.5rem 0;
}
.compose-cc-toggles {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  padding-top: 0.55rem;
}
.compose-subject-input {
  padding-left: 0;
}
.compose-subject-input::placeholder {
  color: #80868b;
}
.compose-text-toggle {
  border: 0;
  background: transparent;
  color: #5f6368;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0.15rem 0;
}
.compose-text-toggle:hover {
  color: #202124;
  text-decoration: underline;
}
.compose-body-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.65rem 1rem 0.35rem;
  overflow: auto;
  background: #fff;
  overscroll-behavior: contain;
}
.compose-body-input {
  flex: 0 0 auto;
  min-height: 8rem;
  width: 100%;
  border: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  resize: none;
  padding: 0.25rem 0;
  font-size: 0.9rem;
  line-height: 1.5;
  font-family: Arial, Helvetica, sans-serif;
  color: #202124;
  background: transparent;
}
.compose-editor {
  overflow: visible;
  word-break: break-word;
}
.compose-sig-preview,
.compose-quote-preview {
  flex: 0 0 auto;
}
.compose-editor:empty:before {
  content: attr(data-placeholder);
  color: #80868b;
  pointer-events: none;
}
.compose-editor:focus {
  outline: none;
}
.compose-format-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15rem;
  margin: 0 0.85rem 0.55rem;
  padding: 0.3rem 0.45rem;
  background: #edf2fa;
  border-radius: 1.25rem;
  flex-shrink: 0;
}
.compose-format-bar[hidden] {
  display: none !important;
}
.compose-fmt-dropdown {
  position: relative;
  flex-shrink: 0;
}
.compose-fmt-trigger {
  border: 0;
  background: transparent;
  color: #3c4043;
  font-size: 0.8rem;
  font-family: inherit;
  height: 2rem;
  border-radius: 1rem;
  padding: 0 0.2rem 0 0.55rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.05rem;
  max-width: 8.5rem;
}
.compose-fmt-dropdown-size .compose-fmt-trigger {
  max-width: 6.25rem;
}
.compose-fmt-trigger:hover,
.compose-fmt-trigger[aria-expanded="true"] {
  background: rgba(60, 64, 67, 0.08);
}
.compose-fmt-trigger-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 6.5rem;
}
.compose-fmt-dropdown-size .compose-fmt-trigger-label {
  max-width: 4.25rem;
}
.compose-fmt-trigger .material-symbols-outlined {
  font-size: 1.2rem;
  color: #5f6368;
  flex-shrink: 0;
}
.compose-fmt-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 0.35rem);
  z-index: 12;
  min-width: 11rem;
  max-height: min(18rem, 50vh);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.35rem 0;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(32, 33, 36, 0.18);
}
.compose-fmt-menu-size {
  min-width: 8.5rem;
}
.compose-fmt-menu.hidden {
  display: none !important;
}
.compose-fmt-option {
  display: flex;
  align-items: center;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.45rem 0.85rem;
  color: #202124;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.25;
  white-space: nowrap;
}
.compose-fmt-option:hover,
.compose-fmt-option.active {
  background: #f1f3f4;
}
.compose-fmt-option.active {
  color: var(--red);
  font-weight: 600;
}
.compose-fmt-menu-font .compose-fmt-option {
  font-size: 0.95rem;
}
.compose-fmt-menu-size .compose-fmt-option {
  min-height: 2.1rem;
}
.compose-fmt-dropdown-color .compose-fmt-menu {
  min-width: 0;
  padding: 0.45rem;
  bottom: calc(100% + 0.35rem);
}
.compose-fmt-color-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.compose-fmt-color-btn .material-symbols-outlined {
  font-size: 1.15rem;
  line-height: 1;
}
.compose-fmt-color-bar {
  display: block;
  width: 0.95rem;
  height: 0.22rem;
  border-radius: 1px;
  margin-top: -0.12rem;
  background: currentColor;
  flex-shrink: 0;
}
#composeForeColorBar { background: #202124; }
#composeBackColorBar { background: #fbbc04; }
.compose-fmt-color-grid {
  display: grid;
  grid-template-columns: repeat(8, 1.35rem);
  gap: 0.2rem;
}
.compose-fmt-color-swatch {
  width: 1.35rem;
  height: 1.35rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 3px;
  padding: 0;
  cursor: pointer;
  background: #fff;
  box-sizing: border-box;
}
.compose-fmt-color-swatch:hover,
.compose-fmt-color-swatch.active {
  outline: 2px solid var(--red);
  outline-offset: 1px;
}
.compose-fmt-color-swatch.none {
  position: relative;
  background:
    linear-gradient(to top right, transparent calc(50% - 0.6px), #c5221f 50%, transparent calc(50% + 0.6px)),
    #fff;
}
.compose-fmt-color-actions {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.4rem;
  padding-top: 0.35rem;
  border-top: 1px solid #e8eaed;
}
.compose-fmt-color-action {
  flex: 1;
  border: 0;
  background: transparent;
  color: #3c4043;
  font-size: 0.72rem;
  font-family: inherit;
  font-weight: 600;
  padding: 0.35rem 0.4rem;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
}
.compose-fmt-color-action:hover {
  background: #f1f3f4;
}
html.theme-dark .compose-fmt-color-swatch {
  border-color: rgba(255, 255, 255, 0.18);
}
html.theme-dark .compose-fmt-color-actions {
  border-top-color: #5f6368;
}
html.theme-dark .compose-fmt-color-action {
  color: #e8eaed;
}
html.theme-dark .compose-fmt-color-action:hover {
  background: #3c4043;
}
html.theme-dark .compose-fmt-trigger {
  color: #e8eaed;
}
html.theme-dark .compose-fmt-trigger:hover,
html.theme-dark .compose-fmt-trigger[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.08);
}
html.theme-dark .compose-fmt-menu {
  background: #2d2e30;
  border-color: #5f6368;
}
html.theme-dark .compose-fmt-option {
  color: #e8eaed;
}
html.theme-dark .compose-fmt-option:hover,
html.theme-dark .compose-fmt-option.active {
  background: #3c4043;
}
.compose-fmt-btn {
  border: 0;
  background: transparent;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #3c4043;
  cursor: pointer;
  padding: 0;
}
.compose-fmt-btn:hover {
  background: rgba(60, 64, 67, 0.08);
}
.compose-fmt-btn .material-symbols-outlined {
  font-size: 1.15rem;
}
.compose-fmt-sep {
  width: 1px;
  height: 1.15rem;
  background: #dadce0;
  margin: 0 0.2rem;
}
.compose-foot {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.75rem 0.75rem 1rem;
  flex-shrink: 0;
  background: #fff;
}
.compose-send-group {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  flex-shrink: 0;
  border-radius: 1.25rem;
  overflow: visible;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.2);
}
.compose-send-btn {
  border: 0;
  background: var(--red);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.65rem 1.15rem;
  border-radius: 1.25rem 0 0 1.25rem;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.35rem;
  min-width: 5.5rem;
  transition: opacity 0.15s var(--ease-out);
}
.compose-send-btn:hover:not(:disabled) {
  background: var(--red-bright);
}
.compose-send-btn:disabled,
.compose-send-btn.sending {
  cursor: wait;
  opacity: 0.92;
}
.compose-send-spinner {
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: compose-send-spin 0.65s linear infinite;
  flex-shrink: 0;
}
@keyframes compose-send-spin {
  to { transform: rotate(360deg); }
}
.compose-send-group.sending .compose-send-caret {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}
.compose-send-caret {
  border: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.35);
  background: var(--red);
  color: #fff;
  width: 2rem;
  border-radius: 0 1.25rem 1.25rem 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.compose-send-caret:hover {
  background: var(--red-bright);
}
.compose-send-caret .material-symbols-outlined {
  font-size: 1.35rem;
}
.compose-send-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 0.35rem);
  min-width: 10rem;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(32, 33, 36, 0.2);
  padding: 0.35rem;
  z-index: 5;
}
.compose-send-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  color: #202124;
  cursor: pointer;
  font-family: inherit;
}
.compose-send-menu button:hover {
  background: #f1f3f4;
}
.compose-tool-row {
  display: flex;
  align-items: center;
  gap: 0.05rem;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  color: #5f6368;
  position: relative;
}
.compose-attach-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 1rem 0.35rem;
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid #f1f3f4;
  max-height: 5.5rem;
  overflow-y: auto;
}
.compose-attach-bar.hidden { display: none; }
.compose-attach-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid #dadce0;
  border-radius: 8px;
  background: #f8f9fa;
  font-size: 0.82rem;
  color: #3c4043;
  max-width: min(14rem, 100%);
}
.compose-attach-item .material-symbols-outlined {
  font-size: 1rem;
  color: #5f6368;
}
.compose-attach-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compose-attach-size {
  font-size: 0.75rem;
  color: #80868b;
  flex-shrink: 0;
}
.compose-attach-remove {
  border: 0;
  background: transparent;
  color: #80868b;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
  border-radius: 4px;
}
.compose-attach-remove:hover {
  color: var(--red);
  background: var(--brand-faint);
}

.compose-sub-backdrop {
  position: fixed;
  inset: 0;
  z-index: 58;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(32, 33, 36, 0.35);
}
.compose-sub-backdrop.hidden { display: none !important; }
.compose-float-layer {
  position: fixed;
  inset: 0;
  z-index: 58;
  background: transparent;
}
.compose-float-layer.hidden { display: none !important; }
.compose-sub-panel {
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(32, 33, 36, 0.28), 0 1px 3px rgba(32, 33, 36, 0.12);
  width: min(400px, calc(100vw - 2rem));
  overflow: hidden;
  color: #202124;
  font-family: var(--font-body);
}
.compose-sub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem 0.55rem 1rem;
  background: #f2f6fc;
  color: #001d35;
}
.compose-sub-head h2 {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: #001d35;
}
.compose-sub-head .compose-icon-btn {
  color: #444746;
}
.compose-sub-head .compose-icon-btn:hover {
  background: rgba(68, 71, 70, 0.08);
}
.compose-sub-body {
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: #fff;
}
.compose-sub-field {
  border-bottom: 1px solid #f1f3f4;
  padding: 0.35rem 0;
}
.compose-sub-field:last-child {
  border-bottom: 0;
}
.compose-sub-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.65rem 1rem 0.85rem;
  background: #fff;
}
.compose-sub-cancel {
  border: 0;
  background: transparent;
  color: #5f6368;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0.45rem 0.75rem;
  border-radius: 4px;
  flex-shrink: 0;
}
.compose-sub-cancel:hover {
  background: #f1f3f4;
  color: #202124;
}
.compose-sub-foot .compose-send-btn {
  border-radius: 1.25rem;
  min-width: auto;
  flex-shrink: 0;
  white-space: nowrap;
  padding: 0.55rem 1.1rem;
}
.compose-emoji-panel {
  position: fixed;
  width: fit-content;
  max-width: calc(100vw - 1rem);
  top: 0;
  left: 0;
}
.compose-emoji-panel .compose-sub-head {
  padding-left: 0.85rem;
  padding-right: 0.85rem;
}
.compose-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 2.35rem);
  gap: 0.25rem;
  padding: 0.75rem 0.85rem;
  overflow: visible;
  background: #fff;
  box-sizing: border-box;
}
.compose-emoji-btn {
  border: 0;
  background: transparent;
  font-size: 1.25rem;
  line-height: 1;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
}
.compose-emoji-btn:hover {
  background: #f1f3f4;
}
html.theme-dark .compose-attach-bar {
  background: #2d2e30;
  border-top-color: #3c4043;
}
html.theme-dark .compose-attach-item {
  background: #3c4043;
  border-color: #5f6368;
  color: #e8eaed;
}
html.theme-dark .compose-sub-panel,
html.theme-dark .compose-sub-body,
html.theme-dark .compose-sub-foot,
html.theme-dark .compose-emoji-grid {
  background: #2d2e30;
  border-color: #5f6368;
  color: #e8eaed;
}
html.theme-dark .compose-sub-head {
  background: #394457;
  color: #e8eaed;
}
html.theme-dark .compose-sub-head h2 {
  color: #e8eaed;
}
html.theme-dark .compose-sub-field {
  border-bottom-color: #3c4043;
}
html.theme-dark .compose-sub-cancel {
  color: #9aa0a6;
}
html.theme-dark .compose-sub-cancel:hover {
  background: #3c4043;
  color: #e8eaed;
}
html.theme-dark .compose-emoji-btn:hover {
  background: #3c4043;
}
.compose-tool-row .compose-icon-btn:hover:not(:disabled) {
  background: #f1f3f4;
  color: #202124;
}
.compose-tool-row .compose-icon-btn.on {
  color: var(--red);
  background: color-mix(in srgb, var(--red) 10%, transparent);
}
.compose-tool-row .compose-icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.compose-discard {
  color: #5f6368;
  margin-left: auto;
}
.compose-discard:hover {
  background: #f1f3f4;
  color: var(--red);
}
html.theme-dark .compose-window {
  background: #2d2e30;
  border-color: #5f6368;
  color: #e8eaed;
}
html.theme-dark .compose-head {
  background: #1f1f1f;
  color: #e8eaed;
}
html.theme-dark .compose-head h2 {
  color: #e8eaed;
}
html.theme-dark .compose-head .compose-icon-btn {
  color: #e8eaed;
}
html.theme-dark .compose-head .compose-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}
html.theme-dark .compose-from-row,
html.theme-dark .compose-field-row {
  border-bottom-color: #5f6368;
}
html.theme-dark .compose-from-label,
html.theme-dark .compose-field-label,
html.theme-dark .compose-text-toggle {
  color: #9aa0a6;
}
html.theme-dark .compose-from-value,
html.theme-dark .compose-field-input,
html.theme-dark .compose-chip-input,
html.theme-dark .compose-body-input {
  color: #e8eaed;
}
html.theme-dark .compose-chip {
  background: #394457;
  color: #aecbfa;
}
html.theme-dark .compose-chip-remove {
  color: #aecbfa;
}
html.theme-dark .compose-chip-remove:hover {
  background: rgba(174, 203, 250, 0.16);
}
html.theme-dark .compose-chip.invalid {
  background: #5c2b29;
  color: #f28b82;
}
html.theme-dark .compose-chip.invalid .compose-chip-remove {
  color: #f28b82;
}
html.theme-dark .compose-body-area,
html.theme-dark .compose-fields,
html.theme-dark .compose-foot {
  background: #2d2e30;
}
html.theme-dark .compose-locked-hint {
  background: #5f6368;
  color: #e8eaed;
}
html.theme-dark .compose-quote-remove {
  color: #bdc1c6;
}
html.theme-dark .compose-quote-remove:hover {
  background: rgba(232, 234, 237, 0.12);
  color: #e8eaed;
}
html.theme-dark .compose-sig-preview,
html.theme-dark .compose-quote-preview {
  background: #3c4043;
  border-color: #5f6368;
}
html.theme-dark .compose-locked-badge {
  color: #bdc1c6;
}
html.theme-dark .compose-quote-header {
  color: #9aa0a6;
}
html.theme-dark .compose-sig-preview-html,
html.theme-dark .compose-quote-body {
  color: #e8eaed;
}
html.theme-dark .compose-quote-body {
  border-left-color: #5f6368;
}
/* Email HTML often forces black text / white fills — neutralize in dark compose. */
html.theme-dark .compose-sig-preview-html *:not(a),
html.theme-dark .compose-quote-body *:not(a) {
  color: inherit !important;
  background-color: transparent !important;
}
html.theme-dark .compose-sig-preview-html a,
html.theme-dark .compose-quote-body a {
  color: #f28b82 !important;
}
html.theme-dark .compose-format-bar {
  background: #3c4043;
}
html.theme-dark .compose-fmt-btn {
  color: #e8eaed;
}
html.theme-dark .compose-send-menu {
  background: #2d2e30;
  border-color: #5f6368;
}
html.theme-dark .compose-send-menu button {
  color: #e8eaed;
}
html.theme-dark .compose-send-menu button:hover,
html.theme-dark .compose-tool-row .compose-icon-btn:hover:not(:disabled),
html.theme-dark .compose-discard:hover {
  background: #3c4043;
}

@media (max-width: 640px) {
  .compose-backdrop.dialog-backdrop {
    padding: 0;
    place-items: stretch;
    justify-content: stretch;
    align-items: stretch;
  }
  .compose-window,
  .compose-window.expanded,
  .compose-window.minimized {
    width: 100%;
    height: 100%;
    max-height: 100dvh;
    border-radius: 0;
  }
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.form-error { color: var(--red-dark); font-size: 0.9rem; }
.field-note { color: var(--text-muted); font-size: 0.82rem; margin-top: 0.3rem; }
.ar-save-hint { color: var(--red-dark); font-size: 0.82rem; margin-right: auto; }
.form-ok { color: #1f7a4d; font-size: 0.9rem; }

.wm-body { height: 100dvh; overflow: hidden; }
.wm-app {
  display: flex;
  flex-direction: row;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}
.wm-side {
  width: var(--side-w);
  flex-shrink: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-right: 1px solid var(--border);
  padding: 1rem 0.65rem 1rem 0;
  overflow: hidden;
}
.wm-side-brand {
  margin: 0.15rem 0.5rem 1.15rem 1.15rem;
  align-self: flex-start;
  flex-shrink: 0;
}
.wm-side-brand.has-domain-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  width: calc(100% - 0.65rem);
  margin: 0.15rem 0 1.15rem 0.65rem;
  align-self: stretch;
  box-sizing: border-box;
}
.wm-side-brand.has-domain-logo .brand-logo {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100px;
  margin: 0 auto;
  object-fit: contain;
}
.wm-side .btn-compose {
  width: calc(100% - 0.65rem);
  margin-left: 0.65rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
}
.wm-nav-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 0.5rem;
}
.wm-nav-sec {
  margin-top: 0.85rem;
  padding-top: 0.35rem;
}
.wm-nav-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  padding: 0.25rem 0.35rem 0.35rem 1.15rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5f6368;
}
.btn-nav-add {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
}
.btn-nav-add .material-symbols-outlined { font-size: 1.15rem; }
.wm-nav-item .wm-swatch {
  width: 0.75rem;
  height: 0.75rem;
  min-width: 0.75rem;
  max-width: 0.75rem;
  border-radius: 50%;
  flex: 0 0 0.75rem;
  flex-shrink: 0;
  margin-left: 0.2rem;
  margin-right: 0.2rem;
  align-self: center;
  box-sizing: border-box;
}
.wm-nav-item .wm-nav-edit {
  margin-left: auto;
  opacity: 0;
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.wm-nav-item:hover .wm-nav-edit { opacity: 1; }
.wm-nav-item .wm-nav-edit:focus { opacity: 1; }
.wm-nav-item:hover .wm-nav-count[data-count-custom]:not([hidden]),
.wm-nav-item:hover .wm-nav-count[data-count-label]:not([hidden]) { display: none; }
/* ponytail: align unread & edit with header "+" — same 36×28 at right 0.35rem */
.wm-nav-item[data-folder^="custom:"],
.wm-nav-item[data-folder^="label:"] {
  position: relative;
  padding-right: 2.6rem;
}
.wm-nav-item[data-folder^="custom:"] .wm-nav-count,
.wm-nav-item[data-folder^="label:"] .wm-nav-count {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  min-width: 36px;
  width: 36px;
  height: 28px;
  pointer-events: none;
  display: inline-grid;
  place-items: center;
  text-align: center;
  margin-left: 0;
  line-height: 1;
}
.wm-nav-item[data-folder^="custom:"] .wm-nav-edit,
.wm-nav-item[data-folder^="label:"] .wm-nav-edit {
  position: absolute;
  right: calc(0.35rem + 4px);
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  margin-left: 0;
  z-index: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.wm-nav-item[data-folder^="custom:"] .wm-nav-edit .material-symbols-outlined,
.wm-nav-item[data-folder^="label:"] .wm-nav-edit .material-symbols-outlined {
  font-size: 1.1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.wm-nav-item .wm-nav-edit:hover { color: var(--dark); background: rgba(0, 0, 0, 0.06); }
.wm-nav-item .wm-nav-edit .material-symbols-outlined { font-size: 1.05rem; }
html.theme-dark .wm-nav-item .wm-nav-edit:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}
.wm-label-chips {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.22rem;
  min-width: 0;
  width: 100%;
  height: 0.55rem;
  overflow: hidden;
}
.wm-label-chip {
  display: block;
  flex: 0 0 0.55rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
}
.wm-color-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.wm-color-swatch {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.wm-color-swatch.selected {
  border-color: var(--dark);
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--dark);
}
html.theme-dark .wm-color-swatch.selected {
  border-color: var(--red);
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--red);
}
.rule-back {
  margin-bottom: 0.75rem;
}
.rule-list-sec {
  margin: 0;
}
.tune-tabs {
  display: flex;
  gap: 0.15rem;
  padding: 0 1rem;
  border-bottom: 2px solid var(--border);
  flex-shrink: 0;
}
.tune-tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 0.55rem 0.85rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.tune-tab-on {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  background: var(--brand);
  color: #fff;
  line-height: 1.2;
}
/* ponytail: same ON-pill visual on toolbar + avatar menu; text fixed EN like the tab pill */
.tune-ar-pill {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  background: var(--brand);
  color: #fff;
  line-height: 1.2;
  white-space: nowrap;
}
#menuTune .tune-ar-pill { margin-left: 0.35rem; }
.tune-tab.is-on {
  color: var(--dark);
  border-bottom-color: var(--brand);
}
.tune-tab:hover:not(.is-on) { color: var(--dark); }
.tune-tab:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}
#ruleDialog.tune-tab-ar #btnNewRule { display: none; }
#ruleDialog:not(.tune-tab-ar) #btnSaveAutoReply { display: none; }
.rule-list-empty {
  margin: 0;
  padding: 1.25rem 0.25rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.ar-sec {
  margin: 0;
}
.ar-enable {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dark);
  cursor: pointer;
  user-select: none;
}
.ar-enable input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
.ar-enable .toggle-switch { width: 52px; }
.ar-enable .toggle-switch::before {
  content: "OFF";
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  line-height: 1;
}
.ar-enable:has(input:checked) .toggle-switch { background: var(--red); }
.ar-enable:has(input:checked) .toggle-knob { transform: translateX(26px); }
.ar-enable:has(input:checked) .toggle-switch::before {
  content: "ON";
  right: auto;
  left: 6px;
  color: #fff;
}
.ar-enable:focus-within .toggle-switch {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}
.ar-period {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ar-period input[type="date"] {
  flex: 1;
  min-width: 0;
}
.ar-period-sep {
  color: var(--text-muted);
  flex-shrink: 0;
}
.ar-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.ar-sec .radio {
  display: flex;
  margin: 0.35rem 0;
}
.ar-editor-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--paper);
  overflow: visible;
}
.ar-toolbar {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.25rem 0.35rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--paper) 92%, var(--dark));
  border-radius: var(--radius-btn) var(--radius-btn) 0 0;
  position: relative;
  z-index: 1;
}
.ar-toolbar .btn-icon {
  width: 2rem;
  height: 2rem;
}
.ar-toolbar .material-symbols-outlined { font-size: 1.15rem; line-height: 1; }
.ar-editor {
  height: 8.5rem;
  overflow-y: auto;
  resize: none;
  padding: 0.65rem 0.8rem;
  font: inherit;
  color: var(--dark);
  outline: none;
  line-height: 1.45;
  word-break: break-word;
  border-radius: 0 0 var(--radius-btn) var(--radius-btn);
}
.ar-editor:focus {
  box-shadow: inset 0 0 0 2px var(--brand-soft);
}
.ar-editor:empty:before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}
.ar-sec.is-off .field {
  opacity: 0.55;
}
.ar-sec.is-off .ar-editor {
  pointer-events: none;
}
#ruleFormDialog .dialog-form-body { counter-reset: rule-sec; }
.rule-sec {
  margin-bottom: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
}
.rule-sec:last-child { margin-bottom: 0; }
.rule-sec .field:last-child { margin-bottom: 0; }
.rule-sec-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--dark);
  margin: 0 0 0.6rem;
  padding-bottom: 0.45rem;
  border-bottom: 2px solid var(--border);
}
.rule-sec-head::before {
  counter-increment: rule-sec;
  content: counter(rule-sec);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.rule-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.rule-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--paper);
  cursor: pointer;
}
.rule-row:hover { border-color: var(--dark); }
.rule-row.dragging { opacity: 0.45; }
.rule-row.drop-target {
  border-color: var(--red);
  background: var(--brand-faint);
}
.rule-row.is-invalid { border-style: dashed; }
.rule-row.is-locked { cursor: default; }
.rule-row.is-locked:hover { border-color: var(--border); }
#ruleList.is-locked .rule-row button { pointer-events: none; opacity: 0.55; }
.rule-apply-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--border);
  border-top-color: var(--icon-muted);
  border-radius: 50%;
  animation: compose-send-spin 0.65s linear infinite;
  flex-shrink: 0;
}
.rule-prio {
  min-width: 1.5rem;
  height: 1.5rem;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.rule-grip {
  display: grid;
  place-items: center;
  color: var(--text-muted);
  cursor: grab;
  flex-shrink: 0;
}
.rule-grip .material-symbols-outlined { font-size: 1.1rem; }
.rule-meta { flex: 1; min-width: 0; }
.rule-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rule-sub {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
}
.rule-sub-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex-shrink: 1;
}
.rule-sub-arrow {
  font-size: 1rem;
  flex-shrink: 0;
}
#ruleDialog .dialog-form {
  width: min(640px, calc(100vw - 2rem));
  max-width: 660px;
  height: min(90dvh, 48rem);
}
#ruleDialog .dialog-form-body { min-height: 0; }
#ruleFormDialog {
  z-index: 56;
}
#ruleFormDialog .dialog-form {
  width: min(640px, calc(100vw - 2rem));
  max-width: 660px;
}
.rule-invalid {
  font-size: 0.75rem;
  color: var(--red);
  font-weight: 600;
}
.rule-move .material-symbols-outlined { font-size: 1.1rem; }
.wm-label-checks {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
#ruleLabelChecks {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem;
}
#ruleLabelChecks .rule-list-empty {
  padding: 0.2rem 0;
  text-align: left;
}
.rule-picks {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.rule-pick {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.8rem 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--paper);
  background-clip: padding-box;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
}
.rule-pick .material-symbols-outlined {
  font-size: 1.05rem;
  flex-shrink: 0;
}
.rule-pick:hover {
  color: var(--dark);
  background: var(--row-hover);
}
.rule-pick.is-on {
  border-color: var(--brand);
  color: var(--dark);
  background: var(--brand-faint);
  box-shadow: 0 0 0 1px var(--brand);
}
.rule-pick:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand);
}
.rule-pick::after {
  content: "check";
  font-family: "Material Symbols Outlined";
  font-size: 1rem;
  line-height: 1;
  width: 1rem;
  display: inline-block;
  text-align: center;
  flex-shrink: 0;
  color: var(--brand);
  opacity: 0;
}
.rule-pick.is-on::after {
  opacity: 1;
}
#ruleLabelChecks .wm-label-check {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.8rem 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--paper);
  background-clip: padding-box;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  user-select: none;
}
#ruleLabelChecks .wm-label-check:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand);
  outline: none;
}
#ruleLabelChecks .wm-label-check:has(input:checked) {
  border-color: var(--brand);
  color: var(--dark);
  background: var(--brand-faint);
  box-shadow: 0 0 0 1px var(--brand);
}
#ruleLabelChecks .wm-label-check .wm-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  flex-shrink: 0;
}
#ruleLabelChecks .wm-label-check .wm-nav-text {
  flex: none;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#ruleLabelChecks .wm-label-cb {
  position: absolute;
  top: 0;
  left: 0;
  width: 0 !important;
  height: 0 !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  opacity: 0 !important;
  pointer-events: none;
  outline: none !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  accent-color: transparent;
}
#ruleLabelChecks .wm-label-check::after {
  content: "check";
  font-family: "Material Symbols Outlined";
  font-size: 1rem;
  line-height: 1;
  width: 1rem;
  display: inline-block;
  text-align: center;
  flex-shrink: 0;
  color: var(--brand);
  opacity: 0;
}
#ruleLabelChecks .wm-label-check:has(input:checked)::after {
  opacity: 1;
}
.wm-bulk-label-menu .wm-label-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.7rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.3;
  box-sizing: border-box;
  border-radius: var(--radius-btn);
}
.wm-bulk-label-menu .wm-label-check:hover { background: var(--bg); }
.wm-bulk-label-menu .wm-label-cb {
  opacity: 1;
  filter: none;
  flex-shrink: 0;
}
.wm-bulk-label-menu .wm-label-check .wm-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.wm-bulk-label-menu .wm-label-check .wm-nav-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wm-side-backdrop { display: none; }
.wm-right {
  flex: 1;
  min-width: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}
.wm-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 3.6rem;
  padding: 0 1rem;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 20;
  overflow: visible;
}
.btn-nav { display: none !important; }
.wm-search-wrap {
  flex: 1;
  position: relative;
  max-width: 720px;
  margin: 0;
  margin-right: auto;
  z-index: 21;
}
.wm-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  background: var(--search-bg);
  border-radius: 1.5rem;
  padding: 0.35rem 0.9rem;
  color: var(--text-muted);
}
.wm-search-wrap.is-open .wm-search {
  border-radius: 1.5rem 1.5rem 0 0;
}
.wm-search input {
  border: 0;
  background: transparent;
  padding: 0.4rem 0;
  box-shadow: none;
  flex: 1;
  min-width: 0;
}
.wm-search input.is-adv-query {
  cursor: pointer;
  color: var(--dark);
}
/* Hide native search cancel (ugly, inconsistent across browsers) — use custom button */
.wm-search input[type="search"]::-webkit-search-cancel-button,
.wm-search input[type="search"]::-webkit-search-decoration,
.wm-search input[type="search"]::-webkit-search-results-button,
.wm-search input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}
.wm-search input[type="search"]::-ms-clear,
.wm-search input[type="search"]::-ms-reveal {
  display: none;
  width: 0;
  height: 0;
}
.wm-search-clear {
  min-width: 2rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 50%;
  flex-shrink: 0;
}
.wm-search-clear.hidden { display: none !important; }
.wm-search-clear .material-symbols-outlined { font-size: 1.35rem; }
#btnAdvSearch.on,
#btnAdvSearch[aria-expanded="true"] {
  color: var(--dark);
}
#btnAdvSearch.on .material-symbols-outlined,
#btnAdvSearch[aria-expanded="true"] .material-symbols-outlined {
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
}
.wm-search-adv {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--search-bg);
  border-radius: 0 0 1.5rem 1.5rem;
  padding: 0.35rem 1rem 0.9rem;
  box-shadow: 0 10px 24px rgba(25, 33, 38, 0.12);
  max-height: min(70vh, 32rem);
  overflow-y: auto;
  z-index: 22;
}
.wm-search-adv .field { margin: 0 0 0.55rem; }
.wm-search-adv .field label { font-size: 0.7rem; }
.wm-search-adv input:not([type="checkbox"]),
.wm-search-adv select {
  padding: 0.4rem 0.65rem;
  font-size: 0.875rem;
  background: var(--search-field-bg);
  color: var(--dark);
  color-scheme: light;
}
html.theme-dark .wm-search-adv input:not([type="checkbox"]),
html.theme-dark .wm-search-adv select {
  color-scheme: dark;
}
.wm-search-adv-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.7rem;
  font-size: 0.875rem;
  color: var(--dark);
  cursor: pointer;
  user-select: none;
}
.wm-search-adv-check input {
  width: auto;
  margin: 0;
}
.wm-search-adv-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.wm-search-adv-size {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.wm-search-adv-size select { flex: 1.4; min-width: 0; }
.wm-search-adv-size input { flex: 0.9; min-width: 0; }
.wm-search-adv-mb {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.wm-search-adv-head { display: none; }
.wm-search-adv-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.35rem;
}
.wm-search-adv-foot .btn { font-size: 0.875rem; padding: 0.45rem 0.95rem; }
html.theme-dark .wm-search,
html.theme-dark .wm-search-adv {
  background: var(--search-bg);
}
html.theme-dark .wm-search input.is-adv-query {
  color: #e8ecef;
}
html.theme-dark .wm-search-adv {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}
html.theme-dark #btnAdvSearch.on,
html.theme-dark #btnAdvSearch[aria-expanded="true"] {
  color: #e8ecef;
}
@media (max-width: 640px) {
  /* FAB is position:fixed z-index 35 on body; raise header stacking
     context so the fullscreen search overlay paints above it. */
  .wm-top:has(.wm-search-wrap.is-open) {
    z-index: 90;
  }
  .wm-search-wrap.is-open .wm-search {
    border-radius: 1.5rem;
  }
  .wm-search-wrap.is-open .wm-search-adv {
    position: fixed;
    inset: 0;
    border-radius: 0;
    max-height: none;
    z-index: 80;
    padding: 0.75rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
    box-shadow: none;
    display: flex;
    flex-direction: column;
  }
  .wm-search-adv-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-shrink: 0;
    margin: 0 0 0.75rem;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
  }
  html.theme-dark .wm-search-adv-head { color: #e8ecef; }
  .wm-search-adv-head .btn-icon {
    width: 2.25rem;
    height: 2.25rem;
  }
  .wm-search-adv-foot {
    margin-top: auto;
    padding-top: 0.75rem;
  }
  .wm-search-adv-foot .btn { width: 100%; }
}
.wm-avatar-wrap { position: relative; }
.wm-ws-dot {
  position: absolute;
  top: 0;
  right: 0;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  border: 2px solid var(--paper);
  box-sizing: border-box;
  pointer-events: none;
  z-index: 1;
}
.wm-ws-dot.is-on { background: #1e8e3e; }
.wm-ws-dot.is-off { background: #d93025; }
.wm-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 0;
  background: var(--dark);
  color: var(--on-dark);
  font-family: var(--font-display);
  font-weight: 700;
  cursor: pointer;
}
html.theme-dark .wm-avatar { background: var(--red); }
.wm-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 200px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow);
  padding: 0.5rem;
  z-index: 40;
}
.wm-menu-email {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.35rem 0.5rem 0.55rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.3rem;
  word-break: break-all;
}
.wm-menu a, .wm-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.45rem 0.5rem;
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.3;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--radius-btn);
}
.wm-menu a:hover, .wm-menu button:hover { background: var(--row-hover); }

.wm-nav { display: flex; flex-direction: column; gap: 0.1rem; }
.wm-nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  min-height: 2rem;
  box-sizing: border-box;
  border: 0;
  background: transparent;
  padding: 0.4rem 1rem 0.4rem 1.35rem;
  border-radius: 0 1.5rem 1.5rem 0;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.15rem;
  color: #3c4043;
  cursor: pointer;
  text-align: left;
}
.wm-nav-item > span[data-i18n],
.wm-nav-item > .wm-nav-text { flex: 1; min-width: 0; }
.wm-nav-count {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  color: inherit;
  font-variant-numeric: tabular-nums;
  line-height: 1.15rem;
}
.wm-nav-item .material-symbols-outlined {
  font-size: 1.15rem;
  color: inherit;
  flex: 0 0 1.15rem;
  width: 1.15rem;
  height: 1.15rem;
  display: grid;
  place-items: center;
}
.wm-nav-item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #202124;
}
.wm-nav-item.active {
  background: #e8eaed;
  color: #202124;
  font-weight: 600;
}
.wm-nav-item.active:hover {
  background: #e8eaed;
  color: #202124;
}
html.theme-dark .wm-nav-item {
  color: rgba(255, 255, 255, 0.55);
}
html.theme-dark .wm-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e8ecef;
}
html.theme-dark .wm-nav-item.active,
html.theme-dark .wm-nav-item.active:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.wm-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  /* Profile avatar size; gap between avatar and from */
  --toolbar-btn: 2.25rem;
  --avatar-size: 2.25rem;
  --avatar-gap: 0.5rem;
  --avatar-inset: 0.85rem;
  --read-col: calc(1rem + var(--avatar-size) + var(--avatar-gap) + var(--avatar-inset));
}
.wm-list-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}
.wm-mail-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  overflow: hidden;
  z-index: 4;
  pointer-events: none;
  background: transparent;
}
.wm-mail-progress[hidden] {
  display: none !important;
}
.wm-mail-progress-bar {
  display: block;
  height: 100%;
  width: 36%;
  border-radius: 99px;
  background: var(--red);
  animation: wm-mail-indet 1.05s var(--ease-out) infinite;
}
@keyframes wm-mail-indet {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(380%); }
}
.wm-mail-loading {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  pointer-events: auto;
}
.wm-mail-loading.hidden {
  display: none !important;
}
.wm-mail-spinner {
  width: 1.65rem;
  height: 1.65rem;
  border: 2.5px solid color-mix(in srgb, var(--red) 22%, transparent);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: compose-send-spin 0.65s linear infinite;
}
.wm-mail-loading-text {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}
.wm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  height: 2.75rem;
  padding: 0 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.wm-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding-left: calc(1.25rem + 0.35rem);
}
.wm-toolbar-read {
  padding-left: var(--avatar-inset);
  gap: var(--avatar-gap);
}
.wm-tool-check {
  display: grid;
  place-items: center;
  width: 1.15rem;
  height: 1.75rem;
  flex-shrink: 0;
  cursor: pointer;
}
.wm-bulk-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}
.btn-empty-trash {
  height: 2rem;
  padding: 0 0.7rem;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  border-radius: var(--radius-btn);
}
.btn-empty-trash:hover {
  color: var(--red);
  background: var(--brand-faint);
}
.btn-empty-trash.hidden {
  display: none !important;
}
.wm-bulk-folder { position: relative; }
.wm-bulk-folder-menu { left: 0; right: auto; }
.wm-tool-check input,
.msg-check {
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  width: 1rem;
  height: 1rem;
  margin: 0;
  padding: 0;
  min-width: 1rem;
  max-width: 1rem;
  min-height: 1rem;
  max-height: 1rem;
  border: 1.5px solid var(--icon-muted);
  border-radius: 2px;
  background: transparent;
  justify-self: start;
  align-self: center;
  accent-color: var(--icon-muted);
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.15s var(--ease-out), border-color 0.15s var(--ease-out), background-color 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out);
}
/* Small square hit pad — keep aspect ratio so focus ring stays circular/square */
.msg-row > .msg-check {
  position: relative;
}
.msg-row > .msg-check::before {
  content: "";
  position: absolute;
  inset: -0.35rem;
  border-radius: 4px;
}
.wm-tool-check input:hover,
.msg-check:hover,
.msg-row:hover .msg-check {
  opacity: 1;
  border-color: var(--icon-hover);
}
.wm-tool-check input:checked,
.msg-check:checked {
  opacity: 1;
  border-color: var(--red);
  background-color: var(--red);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6-6'/%3E%3C/svg%3E");
  background-size: 0.75rem 0.75rem;
  background-position: center;
  background-repeat: no-repeat;
}
.wm-tool-check input:focus,
.wm-tool-check input:focus-visible,
.msg-check:focus,
.msg-check:focus-visible {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 2px var(--brand-soft);
}
.wm-tool-more { position: relative; }
.wm-tool-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 0.25rem);
  min-width: 220px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow);
  padding: 0.35rem;
  z-index: 35;
}
.wm-tool-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.6rem 0.7rem;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius-btn);
}
.wm-tool-menu button:hover { background: var(--row-hover); }
.wm-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  margin-left: auto;
}
.wm-toolbar-read-actions {
  display: none;
  align-items: center;
  gap: 0.1rem;
  margin-left: auto;
  flex-shrink: 0;
}
.wm-toolbar-read-actions .wm-read-actions {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}
.wm-toolbar-read-actions .btn-icon,
.wm-toolbar-read-actions .icon-toggle {
  min-width: var(--toolbar-btn, 2.25rem);
  width: var(--toolbar-btn, 2.25rem);
  height: var(--toolbar-btn, 2.25rem);
}
.wm-toolbar-read-actions .material-symbols-outlined {
  font-size: 1.35rem;
}
.wm-toolbar-read-actions.hidden {
  display: none !important;
}
.wm-toolbar-right .btn-icon:disabled {
  opacity: 0.35;
  cursor: default;
}
.wm-toolbar-right .btn-icon:disabled:hover {
  background: transparent;
  color: var(--text-muted);
}
.wm-paging-wrap { position: relative; }
.wm-paging {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  border: 0;
  background: transparent;
  padding: 0.35rem 0.45rem;
  border-radius: var(--radius-btn);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
}
.wm-paging:hover { background: var(--row-hover); color: var(--dark); }
.wm-paging .material-symbols-outlined { font-size: 1.25rem; }
.wm-paging-menu {
  left: auto;
  right: 0;
}
.wm-paging-menu button.active {
  color: var(--red);
  font-weight: 600;
}
.wm-toast {
  position: fixed;
  left: 50%;
  top: 1.25rem;
  bottom: auto;
  transform: translateX(-50%);
  z-index: 80;
  padding: 0.7rem 1.15rem;
  background: var(--dark);
  color: var(--on-dark);
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  pointer-events: none;
  max-width: min(28rem, calc(100vw - 2rem));
  text-align: center;
}
.wm-toast.wm-toast-error {
  background: var(--red);
  color: #fff;
}
html.theme-dark .wm-toast {
  background: #e8ecef;
  color: #12181c;
}
html.theme-dark .wm-toast.wm-toast-error {
  background: var(--red);
  color: #fff;
}
.wm-menu-header {
  padding: 0.35rem 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.3rem;
}
.wm-menu-sep {
  border-top: 1px solid var(--border);
  margin: 0.3rem 0;
}
.wm-menu-name {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--dark);
  padding: 0.2rem 0.5rem 0;
  word-break: break-word;
}
.wm-menu-email {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.1rem 0.5rem 0.4rem;
  border-bottom: none;
  margin-bottom: 0;
  word-break: break-all;
}
.wm-menu-storage {
  padding: 0.5rem 0.5rem 0.3rem;
}
.wm-menu-storage[hidden] { display: none !important; }
.wm-menu-storage .wm-storage-label {
  text-align: left;
  font-size: 0.72rem;
}
.wm-storage {
  flex-shrink: 0;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--border);
  background: var(--paper);
  margin-top: auto;
}
.wm-storage-bar {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.wm-storage-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--brand);
  border-radius: 999px;
  transition: width 0.3s var(--ease-out);
}
.wm-storage-fill.warn { background: #f9a825; }
.wm-storage-fill.full { background: var(--red); }
.wm-storage-label {
  margin-top: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wm-ptr {
  display: none;
  flex-shrink: 0;
  height: 0;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  pointer-events: none;
}
.wm-ptr .wm-ptr-icon {
  font-size: 1.5rem;
  transition: transform 0.12s var(--ease-out);
}
.wm-ptr.ready .wm-ptr-icon {
  color: var(--red);
}
.wm-ptr.refreshing .wm-ptr-icon {
  animation: wm-ptr-spin 0.75s linear infinite;
  color: var(--red);
}
@keyframes wm-ptr-spin {
  to { transform: rotate(360deg); }
}
.wm-list { flex: 1; overflow-y: auto; }
.msg-row.selected { background: var(--row-hover); }
.msg-row {
  display: grid;
  grid-template-columns: 1.25rem 1.15rem 1.5rem 1.5rem minmax(6.5rem, 11rem) minmax(0, 1fr) 3.25rem 3.75rem;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 1rem;
  min-height: 2.5rem;
  border-bottom: 1px solid var(--border);
  cursor: default;
  position: relative;
}
.msg-row.has-attach {
  --msg-meta-h: 2.35rem;
  grid-template-rows: var(--msg-meta-h) auto;
  align-items: stretch;
  row-gap: 0.2rem;
  padding-top: 0.4rem;
  padding-bottom: 0.5rem;
  min-height: 4rem;
}
.msg-row.has-attach > .msg-grip,
.msg-row.has-attach > .msg-check,
.msg-row.has-attach > .icon-toggle,
.msg-row.has-attach > .msg-from,
.msg-row.has-attach > .msg-subject-line,
.msg-row.has-attach > .wm-label-chips,
.msg-row.has-attach > .msg-time {
  grid-row: 1;
  box-sizing: border-box;
}
.msg-row.has-attach > .msg-from,
.msg-row.has-attach > .msg-subject-line,
.msg-row.has-attach > .wm-label-chips,
.msg-row.has-attach > .msg-time {
  height: var(--msg-meta-h);
  min-height: var(--msg-meta-h);
  max-height: var(--msg-meta-h);
  align-self: stretch;
}
.msg-row.has-attach > .msg-grip,
.msg-row.has-attach > .icon-toggle {
  display: grid;
  place-items: center;
  margin: 0;
  width: 100%;
  height: var(--msg-meta-h);
  min-height: var(--msg-meta-h);
  max-height: var(--msg-meta-h);
  align-self: stretch;
}
.msg-row.has-attach > .msg-check {
  width: 1rem;
  height: 1rem;
  min-width: 1rem;
  max-width: 1rem;
  min-height: 1rem;
  max-height: 1rem;
  align-self: center;
  justify-self: center;
  margin: 0;
}
.msg-row.has-attach > .wm-label-chips {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  align-self: stretch;
  margin: 0;
  width: 100%;
  height: var(--msg-meta-h);
  min-height: var(--msg-meta-h);
  max-height: var(--msg-meta-h);
  box-sizing: border-box;
  grid-row: 1;
}
.msg-row.has-attach > .msg-from,
.msg-row.has-attach > .msg-subject-line,
.msg-row.has-attach > .msg-time {
  display: flex;
  align-items: center;
  margin: 0;
}
.msg-row.has-attach > .msg-time {
  justify-content: flex-end;
}
.msg-row.has-attach > .msg-attach-line {
  grid-column: 6;
  grid-row: 2;
  align-self: start;
  padding: 0 0 0.1rem;
  min-height: 1.7rem;
}
.msg-row:hover { background: var(--row-hover); }
.msg-row.unread { background: var(--unread-bg); }
.msg-row.unread:hover { background: var(--row-hover); }
.msg-row.unread .msg-from-name,
.msg-row.unread .msg-subject,
.msg-row.unread .msg-time {
  font-weight: 600;
  color: #000;
}
html.theme-dark .msg-row.unread .msg-from-name,
html.theme-dark .msg-row.unread .msg-subject,
html.theme-dark .msg-row.unread .msg-time {
  color: #fff;
}
.msg-grip {
  display: grid;
  place-items: center;
  width: 1.25rem;
  height: 1.5rem;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--icon-muted);
  cursor: grab;
  opacity: 0;
  transition: opacity 0.15s var(--ease-out), color 0.15s var(--ease-out);
  user-select: none;
  touch-action: none;
}
.msg-grip .material-symbols-outlined { font-size: 1.15rem; }
.msg-row:hover .msg-grip { opacity: 1; }
.msg-row:hover .msg-grip:hover { color: var(--icon-hover); }
.msg-grip:active { cursor: grabbing; }
.msg-row.no-drag .msg-grip {
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}
.msg-row.dragging { opacity: 0.45; }
.wm-nav-item.drop-target {
  background: var(--brand-faint);
  color: #202124;
}
html.theme-dark .wm-nav-item.drop-target {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
.msg-from {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  overflow: hidden;
  font-size: 0.875rem;
  line-height: 1.25;
  cursor: pointer;
}
.msg-from-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  color: var(--dark);
}
.msg-draft-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: #e8f0fe;
  color: #174ea6;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.25;
  user-select: none;
}
html.theme-dark .msg-draft-pill {
  background: #394457;
  color: #aecbfa;
}
.msg-thread-n {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  background: var(--row-hover);
  border-radius: 0.3rem;
  padding: 0.05rem 0.32rem;
  line-height: 1.3;
}
.msg-subject-line {
  display: flex;
  gap: 0.3rem;
  min-width: 0;
  overflow: hidden;
  font-size: 0.875rem;
  line-height: 1.25;
  cursor: pointer;
}
.msg-subject {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 45%;
  color: var(--dark);
}
.msg-preview {
  color: var(--preview);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  font-weight: 400;
}
.msg-subject-line .msg-preview:not(:empty)::before {
  content: " — ";
}
.msg-attach-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--text-muted);
  cursor: pointer;
}
.msg-attach-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 14rem;
  min-width: 0;
  padding: 0.2rem 0.6rem 0.2rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--paper);
  color: var(--dark);
  text-decoration: none;
  cursor: pointer;
}
.msg-attach-pill:hover {
  border-color: var(--red);
  color: var(--red);
}
.msg-attach-pill .material-symbols-outlined {
  font-size: 1.05rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.msg-attach-pill:hover .material-symbols-outlined { color: var(--red); }
.msg-attach-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html.theme-dark .msg-attach-pill {
  background: #2a2a2a;
}
html.theme-dark .msg-attach-pill:hover,
html.theme-dark .msg-attach-pill:hover .material-symbols-outlined {
  color: color-mix(in srgb, var(--brand) 45%, white);
  border-color: color-mix(in srgb, var(--brand) 45%, white);
}
.msg-time {
  font-size: 0.75rem;
  line-height: 1.25;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: right;
}
.msg-actions {
  display: none;
  gap: 0.15rem;
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--row-hover);
  padding-left: 0.35rem;
}
.msg-row.has-attach .msg-actions {
  top: 0.4rem;
  height: var(--msg-meta-h, 2.35rem);
  align-items: center;
  transform: none;
}
.msg-row:hover .msg-actions { display: flex; }
.msg-row:hover .msg-time { visibility: hidden; }
.msg-row .btn-icon {
  min-width: 1.75rem;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0.2rem;
}
.msg-row .btn-icon .material-symbols-outlined { font-size: 1.15rem; }
.icon-toggle {
  border: 0;
  background: transparent;
  color: var(--icon-muted);
  cursor: pointer;
  padding: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: grid;
  place-items: center;
  font-weight: 400;
  transition: color 0.15s var(--ease-out);
}
.icon-toggle .material-symbols-outlined { font-size: 1.15rem; }
.msg-row:hover .icon-toggle:not(.on),
.icon-toggle:hover { color: var(--icon-hover); }
.icon-toggle.on,
.icon-toggle.on:hover,
.msg-row:hover .icon-toggle.on {
  color: var(--star-gold);
}
.icon-toggle.on .material-symbols-outlined {
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
  font-optical-sizing: auto;
}
.msg-empty {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.25;
}

.wm-read {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem 2rem;
  padding-left: var(--read-col);
}
.wm-read-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.wm-read-title-block {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.wm-read-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  min-width: 0;
}
.wm-read-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--dark);
  min-width: 0;
  word-break: break-word;
  line-height: 1.25;
}
.wm-read-important {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
  align-self: center;
  padding: 0.1rem 0.45rem 0.1rem 0.25rem;
  border-radius: 999px;
  background: rgba(251, 140, 0, 0.12);
  color: #e65100;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
  height: 1.35rem;
  box-sizing: border-box;
}
.wm-read-important .material-symbols-outlined {
  font-size: 0.95rem;
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
}
html.theme-dark .wm-read-important {
  background: rgba(251, 140, 0, 0.2);
  color: #ffb74d;
}
.wm-read-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  width: 100%;
}
.wm-read-folder {
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: 0.2rem;
  max-width: 100%;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.15;
  height: 1.35rem;
  box-sizing: border-box;
}
.wm-read-folder .material-symbols-outlined {
  font-size: 0.95rem;
  color: var(--text-muted);
}
.wm-read-folder-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 14rem;
  color: var(--dark);
}
.wm-read-label {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  max-width: 100%;
  padding: 0 0.1rem 0 0.4rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--chip-color, var(--red)) 35%, var(--border));
  background: color-mix(in srgb, var(--chip-color, var(--red)) 12%, var(--paper));
  color: var(--dark);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1;
  height: 1.35rem;
  box-sizing: border-box;
}
.wm-read-label.is-locked {
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--text-muted);
}
.wm-read-label.is-locked .wm-read-label-dot {
  background: var(--text-muted);
}
.wm-read-label.is-locked .wm-read-label-name {
  color: var(--dark);
}
.wm-label-chip[data-locked] {
  background: var(--text-muted) !important;
}
.wm-read-label-dot {
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: var(--chip-color, var(--red));
  flex-shrink: 0;
}
.wm-read-label-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 10rem;
}
.wm-read-label-remove {
  display: grid;
  place-items: center;
  width: 1.05rem;
  height: 1.05rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.wm-read-label-remove:hover {
  background: color-mix(in srgb, var(--chip-color, var(--red)) 18%, transparent);
  color: var(--dark);
}
.wm-read-label-remove .material-symbols-outlined {
  font-size: 0.85rem;
}
.wm-read-meta {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--avatar-gap);
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  /* Avatar hangs left; from/to stay on --read-col with subject/body/delete */
  margin-left: calc(-1 * (var(--avatar-size) + var(--avatar-gap)));
}
#readMeta.hidden,
#readBody.hidden {
  display: none !important;
}
.wm-read-sender-avatar {
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--dark);
  color: var(--on-dark);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  user-select: none;
  align-self: center;
}
html.theme-dark .wm-read-sender-avatar {
  background: var(--red);
}
.wm-read-meta-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}
.wm-read-meta-aside {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.15rem 0.35rem;
  flex-shrink: 0;
  margin-left: auto;
  align-self: center;
  max-width: min(22rem, 55%);
}
.wm-read-received {
  font-size: 0.78rem;
  line-height: 1.3;
  color: var(--text-muted);
  text-align: right;
}
.wm-read-actions {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  flex-shrink: 0;
}
.wm-read-actions .btn-icon,
.wm-read-actions .icon-toggle {
  min-width: 2rem;
  width: 2rem;
  height: 2rem;
  padding: 0.25rem;
}
.wm-read-actions .material-symbols-outlined {
  font-size: 1.2rem;
}
.wm-read-from-line {
  color: var(--dark);
  font-size: 0.95rem;
  line-height: 1.35;
  word-break: break-word;
}
.wm-read-from-line b {
  font-weight: 700;
}
.wm-read-from-email {
  color: var(--text-muted);
  font-weight: 400;
}
.wm-read-from-email::before { content: "\00a0<"; }
.wm-read-from-email::after { content: ">"; }
.wm-read-to-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.2rem 0.35rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  position: relative;
}
.wm-read-to-label {
  color: var(--text-muted);
}
.wm-read-to {
  color: var(--dark);
  word-break: break-word;
}
.wm-read-details-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.wm-read-details-toggle {
  width: 1.6rem;
  height: 1.6rem;
  min-width: 1.6rem;
  padding: 0;
  color: var(--text-muted);
}
.wm-read-details-toggle .material-symbols-outlined {
  font-size: 1.35rem;
}
.wm-read-details-toggle[aria-expanded="true"] {
  color: var(--dark);
}
.wm-read-details {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  z-index: 20;
  min-width: min(22rem, 78vw);
  max-width: min(28rem, 92vw);
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 0.75rem;
  font-size: 0.82rem;
  line-height: 1.35;
}
.wm-read-details.hidden { display: none; }
.wm-read-details dt {
  margin: 0;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}
.wm-read-details dd {
  margin: 0;
  color: var(--dark);
  word-break: break-word;
}
.wm-read-meta .wm-read-arrow {
  font-size: 1rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.wm-thread {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 0 0 0.35rem;
}
.wm-thread.hidden { display: none; }
.wm-thread-msg {
  min-width: 0;
  padding: 0.7rem 0.85rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--paper);
  cursor: pointer;
}
.wm-thread-msg.is-expanded {
  cursor: default;
}
.wm-thread-msg .wm-read-meta {
  margin-left: 0;
  margin-bottom: 0;
  cursor: pointer;
}
.wm-thread-msg.is-expanded .wm-read-meta {
  margin-bottom: 0.65rem;
}
.wm-thread-msg:not(.is-expanded) .wm-read-to-line,
.wm-thread-msg:not(.is-expanded) .wm-read-actions,
.wm-thread-msg:not(.is-expanded) .wm-thread-body,
.wm-thread-msg:not(.is-expanded) .wm-read-attachments {
  display: none !important;
}
.wm-thread-msg.is-expanded .wm-thread-snippet {
  display: none;
}
.wm-thread-snippet {
  margin: 0.15rem 0 0;
  padding-left: calc(var(--avatar-size) + var(--avatar-gap));
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wm-thread-msg.is-unread:not(.is-expanded) .wm-read-from-line b,
.wm-thread-msg.is-unread:not(.is-expanded) .wm-thread-snippet {
  color: var(--dark);
  font-weight: 700;
}
.wm-thread-msg .wm-read-attachments {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
}
.wm-thread-body {
  word-break: break-word;
  color: var(--dark);
}
.wm-thread-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.65rem 0 0;
}
.wm-thread-actions.hidden { display: none; }
.wm-thread-actions .btn {
  font-size: 0.875rem;
  padding: 0.5rem 0.95rem;
}
.wm-thread-actions .material-symbols-outlined { font-size: 1.15rem; }
.wm-thread-drafts {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 1rem;
}
.wm-thread-drafts.hidden { display: none; }
.wm-thread-draft {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid #dadce0;
  border-left: 3px solid #174ea6;
  border-radius: 8px;
  background: #f8f9fa;
}
.wm-thread-draft-text {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}
.wm-thread-draft .msg-draft-pill {
  align-self: center;
}
.wm-thread-draft [data-open-draft] {
  flex-shrink: 0;
}
.wm-thread-draft-from {
  display: block;
  min-width: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--dark);
}
.wm-thread-draft-preview {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html.theme-dark .wm-thread-draft {
  background: #3c4043;
  border-color: #5f6368;
  border-left-color: #aecbfa;
}
.wm-read-body {
  word-break: break-word;
  color: var(--dark);
}
.wm-read-body-plain {
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.55;
}
.wm-read-body-html {
  white-space: normal;
}
.wm-read-html-frame {
  display: block;
  width: 100%;
  min-height: 3rem;
  border: 0;
  background: transparent;
}
.wm-read-attachments {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.wm-read-attachments.hidden { display: none; }
.wm-read-attach-title {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.wm-read-attach-title .material-symbols-outlined {
  font-size: 1.05rem;
}
.wm-read-attach-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.wm-read-attach-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--paper);
  color: var(--dark);
  text-decoration: none;
  font-size: 0.82rem;
  line-height: 1.25;
  cursor: pointer;
  transition: border-color 0.15s var(--ease-out), background 0.15s var(--ease-out);
}
.wm-read-attach-item:hover {
  border-color: var(--red);
  background: var(--row-hover);
}
html.theme-dark .wm-read-attach-item:hover {
  color: var(--dark);
  border-color: color-mix(in srgb, var(--brand) 45%, white);
}
.wm-read-attach-item .material-symbols-outlined {
  font-size: 1.1rem;
  color: var(--icon-muted);
  flex-shrink: 0;
}
.wm-read-attach-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}
.wm-read-attach-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 16rem;
  font-weight: 600;
}
.wm-read-attach-size {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 400;
}
.wm-read-quote {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}
.wm-read-quote.hidden { display: none; }

.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(25, 33, 38, 0.45);
  display: none;
  place-items: center;
  padding: 1rem;
  z-index: 50;
}
.dialog-backdrop.open { display: grid; }
#confirmDialog { z-index: 60; }
#noticeDialog { z-index: 70; }
.notice-dialog .dialog-danger-icon {
  background: #e8f0fe;
  color: #174ea6;
}
html.theme-dark .notice-dialog .dialog-danger-icon {
  background: #394457;
  color: #aecbfa;
}
.notice-dialog .notice-hint {
  margin: -0.65rem 0 1.25rem;
  color: var(--dark);
  font-weight: 500;
}
.notice-dialog .notice-hint.hidden { display: none; }
.dialog.confirm-dialog {
  background: var(--paper);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-width: 420px;
  width: 100%;
  padding: 1.5rem 1.5rem 1.25rem;
}
.confirm-dialog .dialog-danger-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-btn);
  background: var(--brand-faint);
  color: var(--red);
  display: grid;
  place-items: center;
  margin-bottom: 0.85rem;
}
.confirm-dialog .dialog-danger-icon .material-symbols-outlined {
  font-size: 1.35rem;
}
.confirm-dialog h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--dark);
}
.confirm-dialog p {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.45;
}
.dialog-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.dialog-form {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  width: min(420px, calc(100vw - 2rem));
  max-width: 440px;
  max-height: min(90dvh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.dialog-form-head, .dialog-form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}
.dialog-form-foot {
  border-bottom: 0;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}
.dialog-form-foot-spacer { flex: 1; min-width: 0; }
.dialog-form-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  font-weight: 600;
  color: var(--dark);
}
.dialog-form-body {
  padding: 0.9rem 1rem;
  overflow: auto;
  flex: 1;
}
#folderDialog .dialog-form .field input,
#labelDialog .dialog-form .field input { font-size: 0.875rem; padding: 0.55rem 0.75rem; }
#folderDialog .dialog-form .btn,
#labelDialog .dialog-form .btn { font-size: 0.875rem; padding: 0.55rem 0.95rem; }
@media (max-width: 1079px) {
  #folderDialog .dialog-form .field input,
  #labelDialog .dialog-form .field input { font-size: 16px; }
}

.settings-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(25, 33, 38, 0.4);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.settings-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  z-index: 56;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(25, 33, 38, 0.12);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  visibility: hidden;
}
.settings-panel.open {
  transform: translateX(0);
  visibility: visible;
}
.settings-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--paper);
  flex-shrink: 0;
}
.settings-panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--dark);
}
.settings-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1rem 2rem;
  overscroll-behavior: contain;
}
.card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
}
.card h2,
.card h3 {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--dark);
}
.radio {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.4rem 0;
  font-size: 0.95rem;
}
.radio input { width: auto; accent-color: var(--red); }
.settings-panel .radio input,
.settings-panel .settings-check input,
.settings-panel .sig-auto-check input {
  -webkit-appearance: none;
  appearance: none;
  width: 1rem;
  height: 1rem;
  min-width: 1rem;
  min-height: 1rem;
  margin: 0;
  padding: 0;
  border: 1.5px solid var(--icon-muted);
  border-radius: 2px;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.settings-panel .radio input { border-radius: 50%; }
.settings-panel .radio input:checked,
.settings-panel .settings-check input:checked,
.settings-panel .sig-auto-check input:checked {
  background: var(--red);
  border-color: var(--red);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6-6'/%3E%3C/svg%3E");
  background-size: 0.75rem 0.75rem;
  background-position: center;
  background-repeat: no-repeat;
}
.settings-panel .radio input:checked {
  background-image: radial-gradient(circle, #fff 35%, transparent 36%);
  background-size: auto;
}
.settings-panel .radio input:hover:not(:checked),
.settings-panel .settings-check input:hover:not(:checked),
.settings-panel .sig-auto-check input:hover:not(:checked) { border-color: var(--icon-hover); }
.settings-panel .radio input:focus-visible,
.settings-panel .settings-check input:focus-visible,
.settings-panel .sig-auto-check input:focus-visible { outline: none; border-color: var(--red); box-shadow: 0 0 0 2px var(--brand-soft); }
.settings-check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--dark);
  cursor: pointer;
}
.settings-check input {
  width: auto;
  margin: 0.2rem 0 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  accent-color: var(--red);
  flex-shrink: 0;
  box-shadow: none;
}
.settings-check input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.settings-check:has(input:disabled) {
  cursor: not-allowed;
  color: var(--text-muted);
}
.segmented {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: fit-content;
}
.segmented-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.18s var(--ease-out), color 0.18s var(--ease-out), box-shadow 0.18s;
  user-select: none;
}
.segmented-option .material-symbols-outlined { font-size: 1.1rem; }
.segmented-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
.segmented-option:has(input:checked) {
  background: var(--dark);
  color: var(--paper);
  box-shadow: 0 2px 8px rgba(25,33,38,0.12);
}
.segmented-option:has(input[value="dark"]:checked) {
  background: var(--dark);
  color: var(--paper);
}
html.theme-dark .segmented-option:has(input:checked) {
  color: var(--bg);
}
.rule-attach-seg .segmented-option:has(input[value="yes"]:checked) {
  background: #1e8e3e;
  color: #fff;
  box-shadow: none;
}
.rule-attach-seg .segmented-option:has(input[value="no"]:checked) {
  background: #d32f2f;
  color: #fff;
  box-shadow: none;
}
.rule-attach-seg .segmented-option:has(input[value="any"]:checked) {
  background: var(--brand);
  color: #fff;
  box-shadow: none;
}
html.theme-dark .rule-attach-seg .segmented-option:has(input:checked) {
  color: #fff;
}
.rule-attach-seg {
  display: flex;
  align-items: center;
  width: fit-content;
  padding: 3px;
  gap: 2px;
}
.field .rule-attach-seg .segmented-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  min-width: 2.75rem;
  padding: 0.32rem 0.7rem;
  font-size: 0.8rem;
  line-height: 1;
  color: var(--text-muted);
}
.field .rule-attach-seg .segmented-option input {
  position: absolute;
  inset: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  appearance: none;
}
.segmented-option:hover:not(:has(input:checked)) {
  background: var(--paper);
  color: var(--dark);
}
.toggle-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--paper);
  cursor: pointer;
  transition: border-color 0.15s var(--ease-out), background 0.15s var(--ease-out);
  margin: 0;
  user-select: none;
}
.toggle-card:hover { border-color: var(--dark); }
.toggle-card:has(input:checked) {
  border-color: var(--red);
  background: rgba(204, 0, 0, 0.04);
}
.toggle-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background 0.18s, color 0.18s;
}
.toggle-card:has(input:checked) .toggle-card-icon {
  background: var(--red);
  color: #fff;
}
.toggle-card-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.toggle-card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: -0.01em;
  color: var(--dark);
  line-height: 1.2;
}
.toggle-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.3;
}
.toggle-switch {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--border);
  position: relative;
  flex-shrink: 0;
  transition: background 0.18s var(--ease-out);
}
.toggle-card:has(input:checked) .toggle-switch { background: var(--red); }
.toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s var(--ease-out);
}
.toggle-card:has(input:checked) .toggle-knob { transform: translateX(18px); }
.toggle-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
.linked-accounts-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.linked-account-item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.linked-account-item:last-child {
  border-bottom: none;
}
.linked-account-title {
  font-weight: 600;
  color: var(--dark);
}
.linked-account-error {
  color: var(--red);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}
.linked-account-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}
.linked-accounts-add .field {
  margin-bottom: 0.75rem;
}
#linkedAccountsAdd[hidden],
#linkedAccountsHint[hidden],
#linkedAccountsCard[hidden] {
  display: none !important;
}
#btnAddImapAccount {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-width: 9rem;
}
#btnAddImapAccount.sending,
#btnAddImapAccount:disabled {
  cursor: wait;
  opacity: 0.92;
}
.settings-status {
  margin: 0.7rem 0 0;
  font-size: 0.88rem;
  line-height: 1.4;
}
/* ponytail: settings-panel dense harmonize — scoped, not global */
.settings-panel .card h3 { font-size: 0.92rem; }
.settings-panel .field input,
.settings-panel .field select,
.settings-panel .field textarea { font-size: 0.875rem; }
.settings-panel .sig-editor { font-size: 0.875rem; line-height: 1.5; }
.settings-panel .radio,
.settings-panel .settings-check,
.settings-panel .alias-list li,
.settings-panel .linked-account-item,
.settings-panel .update-banner p { font-size: 0.875rem; }
.settings-panel p.muted,
.settings-panel .settings-status { font-size: 0.82rem; line-height: 1.4; }
.settings-panel .linked-account-title { font-size: 0.875rem; font-weight: 600; }
@media (max-width: 1079px) {
  .settings-panel .field input,
  .settings-panel .field select,
  .settings-panel .sig-editor { font-size: 16px; }
}
.settings-actions[hidden] {
  display: none !important;
}
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.update-banner {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.7rem;
}
.update-banner[hidden] {
  display: none !important;
}
#btnUpdateNow[hidden],
.update-banner .btn[hidden] {
  display: none !important;
}
.update-banner p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--dark);
}
.update-progress {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--dark);
}
.update-progress[hidden] {
  display: none !important;
}
.update-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(25, 33, 38, 0.2);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: compose-send-spin 0.65s linear infinite;
  flex-shrink: 0;
}
html.theme-dark .update-spinner {
  border-color: rgba(255, 255, 255, 0.25);
  border-top-color: var(--red-bright, var(--red));
}
html.theme-dark .update-banner {
  background: rgba(255, 255, 255, 0.04);
}
.page-actions { margin-top: 0.5rem; }
.alias-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.alias-list li {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  word-break: break-all;
}
.alias-list li:last-child { border-bottom: none; }

@media (max-width: 1079px) {
  .btn-nav { display: grid !important; place-items: center; }
  .wm-side {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 30;
    transform: translateX(-105%);
    transition: transform 0.25s var(--ease-out);
    width: min(280px, 86%);
    height: 100dvh;
  }
  .wm-side.open { transform: translateX(0); }
  .wm-side-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(25, 33, 38, 0.4);
    z-index: 25;
  }
  .wm-search-wrap { max-width: none; }

  .wm-ptr {
    display: flex;
  }
  .wm-list {
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  /* List toolbar: refresh + paging + prev/next */
  #toolbarListLeft:not(.hidden) {
    display: flex !important;
    padding-left: 0;
    min-width: 0;
  }
  #toolbarListLeft.hidden {
    display: none !important;
  }
  #toolbarReadLeft:not(.hidden) {
    display: flex !important;
    padding-left: 0;
    min-width: 0;
    flex: 1;
    justify-content: flex-start;
    gap: 0.35rem;
  }
  #toolbarReadLeft.hidden {
    display: none !important;
  }
  #toolbarReadRight:not(.hidden) {
    display: flex !important;
    margin-left: auto;
    width: auto;
    flex-shrink: 0;
    justify-content: flex-end;
  }
  #toolbarReadRight.hidden {
    display: none !important;
  }
  #toolbarRight:not(.hidden) {
    display: flex !important;
  }
  #toolbarRight.hidden {
    display: none !important;
  }
  #toolbarListLeft .wm-tool-check,
  #toolbarListLeft .wm-bulk-actions,
  #toolbarListLeft .wm-tool-more {
    display: none !important;
  }
  .wm-toolbar {
    justify-content: space-between;
    padding: 0 0.65rem;
    gap: 0.5rem;
  }
  .wm-toolbar-right {
    margin-left: auto;
    width: auto;
    flex-shrink: 0;
    justify-content: flex-end;
  }

  /* Mobile list row: from · labels · time | subject + preview | attachment */
  .msg-row {
    grid-template-columns: minmax(0, 1fr) auto minmax(3.75rem, max-content);
    grid-template-rows: auto auto;
    align-items: center;
    gap: 0.2rem 0.15rem;
    padding: 0.55rem 0.85rem;
    min-height: 0;
  }
  .msg-row .msg-grip,
  .msg-row .msg-check,
  .msg-row .icon-toggle,
  .msg-row .msg-actions {
    display: none !important;
  }
  .msg-row:hover .msg-time {
    visibility: visible;
  }
  .msg-from {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }
  .wm-label-chips {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    min-width: 0;
    max-width: 3.5rem;
    height: auto;
    justify-content: flex-end;
  }
  .msg-time {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    text-align: end;
  }
  .msg-subject-line {
    grid-column: 1 / -1;
    grid-row: 2;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    align-self: stretch;
    width: 100%;
    gap: 0.12rem;
    cursor: pointer;
    text-align: left;
  }
  .msg-subject {
    width: 100%;
    max-width: 100%;
    flex-shrink: 1;
    align-self: stretch;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .msg-preview {
    width: 100%;
    max-width: 100%;
    flex: none;
    align-self: stretch;
    text-align: left;
    font-size: 0.8125rem;
    line-height: 1.3;
    white-space: nowrap;
  }
  .msg-subject-line .msg-preview:not(:empty)::before {
    content: none;
  }
  .msg-row.has-attach {
    grid-template-rows: auto auto auto;
    row-gap: 0.2rem;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
    min-height: 0;
  }
  .msg-row.has-attach > .msg-grip,
  .msg-row.has-attach > .msg-check,
  .msg-row.has-attach > .icon-toggle,
  .msg-row.has-attach > .msg-from,
  .msg-row.has-attach > .msg-subject-line,
  .msg-row.has-attach > .wm-label-chips,
  .msg-row.has-attach > .msg-time {
    height: auto;
    min-height: 0;
    max-height: none;
    align-self: center;
  }
  .msg-row.has-attach > .msg-from,
  .msg-row.has-attach > .wm-label-chips,
  .msg-row.has-attach > .msg-time {
    grid-row: 1;
  }
  .msg-row.has-attach > .msg-subject-line {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    align-self: stretch;
    width: 100%;
  }
  .msg-row.has-attach > .msg-attach-line {
    grid-column: 1 / -1;
    grid-row: 3;
    padding: 0;
    min-height: 0;
  }
  .msg-row.has-attach .msg-actions {
    display: none !important;
  }

  /* Read view: back/actions left, star/reply/forward right */
  .wm-toolbar:has(#toolbarReadLeft:not(.hidden)) {
    justify-content: space-between;
    padding: 0 0.65rem;
  }
  .wm-read {
    padding: 0.75rem 0.85rem 1.5rem;
  }
  .wm-read-head {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
  }
  .wm-read-title-block {
    width: 100%;
    align-items: flex-start;
  }
  .wm-read-title-row {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 0.35rem;
  }
  .wm-read-head h2 {
    width: 100%;
    text-align: left;
    font-size: 1.15rem;
  }
  .wm-read-folder,
  .wm-read-important {
    align-self: flex-start;
  }
  .wm-read-tags {
    justify-content: flex-start;
    width: 100%;
  }
  /* Standalone last-message header (hidden when cards are used). */
  #readMeta {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    margin-left: 0;
    margin-bottom: 1rem;
    gap: 0.15rem 0.4rem;
    width: 100%;
  }
  #readMeta .wm-read-sender-avatar {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 0.85rem;
  }
  #readMeta .wm-read-meta-text,
  #readMeta .wm-read-meta-aside,
  #readMeta .wm-read-details-wrap,
  #readMeta .wm-read-to-line {
    display: contents;
  }
  #readMeta .wm-read-actions {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.15rem;
  }
  #readMeta .wm-read-from-line {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    text-align: left;
    margin-top: 0.45rem;
  }
  #readMeta .wm-read-to-label {
    grid-column: 1;
    grid-row: 3;
    text-align: left;
  }
  #readMeta .wm-read-to {
    grid-column: 2;
    grid-row: 3;
    min-width: 0;
    text-align: left;
  }
  #readMeta .wm-read-details-toggle {
    grid-column: 3;
    grid-row: 3;
    justify-self: end;
  }
  #readMeta .wm-read-details {
    grid-column: 1 / -1;
    grid-row: 4;
    position: static;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-top: 0.35rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
  }
  #readMeta .wm-read-details.hidden {
    display: none;
  }
  #readMeta .wm-read-received {
    grid-column: 1 / -1;
    grid-row: 5;
    width: 100%;
    text-align: left;
    margin-top: 0;
  }

  .wm-thread-msg .wm-read-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.2rem 0.5rem;
    margin-left: 0;
    width: 100%;
  }
  .wm-thread-msg .wm-read-meta-text {
    display: contents;
  }
  .wm-thread-msg .wm-read-sender-avatar {
    grid-column: 1;
    grid-row: 1;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 0.85rem;
    align-self: center;
  }
  .wm-thread-msg:not(.is-expanded) .wm-read-from-line {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.05rem;
    min-width: 0;
  }
  .wm-thread-msg:not(.is-expanded) .wm-read-from-email::before,
  .wm-thread-msg:not(.is-expanded) .wm-read-from-email::after {
    content: none;
  }
  .wm-thread-msg:not(.is-expanded) .wm-read-meta-aside {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
    max-width: none;
    margin-left: 0;
    align-self: start;
  }
  .wm-thread-msg:not(.is-expanded) .wm-read-received {
    text-align: left;
  }
  .wm-thread-msg:not(.is-expanded) .wm-thread-snippet {
    padding-left: calc(2.5rem + 0.5rem);
    margin-top: 0.2rem;
  }
  .wm-thread-msg.is-expanded .wm-read-meta-aside {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-self: end;
    align-self: center;
    max-width: none;
    margin-left: 0;
    gap: 0.15rem;
  }
  .wm-thread-msg.is-expanded .wm-read-from-line {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    text-align: left;
    margin-top: 0.35rem;
  }
  .wm-thread-msg.is-expanded .wm-read-to-line {
    grid-column: 1 / -1;
    grid-row: 3;
    width: 100%;
  }
  .wm-thread-msg.is-expanded .wm-read-details-wrap {
    display: contents;
  }
  .wm-thread-msg.is-expanded .wm-read-details {
    position: static;
    flex-basis: 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-top: 0.35rem;
    box-shadow: none;
    left: auto;
    top: auto;
    z-index: auto;
  }
  .wm-thread-msg.is-expanded .wm-read-details.hidden {
    display: none;
  }

  /* Mobile FAB: compose button is moved to <body> on boot so it can
     position:fixed without being trapped by .wm-side's transform. */
  .btn-compose.btn-compose-fab {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    width: 3.5rem;
    height: 3.5rem;
    min-width: 3.5rem;
    padding: 0;
    border-radius: 50%;
    z-index: 35;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    margin: 0;
  }
  .btn-compose.btn-compose-fab .btn-compose-text {
    display: none;
  }
  .btn-compose.btn-compose-fab .btn-compose-icon {
    font-size: 1.5rem;
  }
  /* Hide FAB while side drawer is open so it doesn't sit on top. */
  .btn-compose.btn-compose-fab.fab-hidden {
    display: none;
  }
}

@media (max-width: 640px) {
  #btnTune,
  #tuneArPill,
  #btnSettings { display: none; }
  #ruleDialog:not(.tune-tab-ar) .dialog-form-foot,
  #btnNewRule,
  .rule-move,
  .rule-edit { display: none !important; }
  .msg-attach-line {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
  }
  .msg-attach-pill {
    max-width: none;
    width: 100%;
  }
}

