

.email-app .btn-primary,
.email-app .btn.btn-primary {
  background: var(--sk-text);
  border-color: var(--sk-text);
  color: var(--email-control-on-fill);
}
.email-app .btn-primary:hover,
.email-app .btn.btn-primary:hover {
  opacity: 0.85;
}

.email-compose-footer .btn-primary {
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-md);
  height: 36px;
  padding: 0 20px;
  gap: 6px;
}
.email-schedule-wrapper .btn-primary {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}
.email-compose-footer .btn-primary svg {
  width: 14px;
  height: 14px;
}

.email-app {
  display: flex;
  flex-direction: column;
  /* Fill the parent .main-content (flex:1, min-height:100vh) so the card is
     framed symmetrically (16px top / 16px bottom from .email-app's own padding).
     Was calc(100dvh - 32px) — 32px short of the parent → a dead strip below the
     card (~48px vs 16px). Keep dvh (not height:100%) so the bottom action bar
     stays above the mobile browser chrome; just drop the erroneous -32px. */
  height: 100vh;
  height: 100dvh;
  background: var(--sk-bg-subtle);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.email-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  border-bottom: 1px solid rgba(228, 220, 212, 0.35);
  flex-shrink: 0;
  min-height: 56px;
  background: rgba(255, 254, 251, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: relative;
  z-index: 2;
}

.email-toolbar-skeleton {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}
.email-toolbar.toolbar-ready .email-toolbar-skeleton {
  display: none;
}

.email-toolbar:not(.toolbar-ready) > :not(.email-toolbar-skeleton) {
  visibility: hidden;
  position: absolute;
  pointer-events: none;
}

.email-toolbar.toolbar-ready > :not(.email-toolbar-skeleton) {
  animation: sk-fade-in 150ms ease both;
}
@keyframes sk-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.toolbar-sk-btn {
  width: 88px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--sk-bg-subtle) 25%, var(--sk-bg-hover, rgba(0,0,0,0.04)) 50%, var(--sk-bg-subtle) 75%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.5s ease infinite;
  flex-shrink: 0;
}
.toolbar-sk-search {
  flex: 1;
  height: 48px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--sk-bg-subtle) 25%, var(--sk-bg-hover, rgba(0,0,0,0.04)) 50%, var(--sk-bg-subtle) 75%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.5s ease infinite;
}
.toolbar-sk-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--sk-bg-subtle) 25%, var(--sk-bg-hover, rgba(0,0,0,0.04)) 50%, var(--sk-bg-subtle) 75%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.5s ease infinite;
  flex-shrink: 0;
}

.email-toolbar-leading {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.email-toolbar-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: #9A8E82;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
  flex-shrink: 0;
}

.email-toolbar-icon-btn svg {
  color: inherit;
}

.email-toolbar-icon-btn:hover {
  background: #FBF7F0;
  color: #5C4D43;
}

.email-toolbar-icon-btn:focus-visible {
  outline: 2px solid #9A8E82;
  outline-offset: 2px;
  color: #5C4D43;
}

.email-toolbar-icon-btn:active {
  transform: scale(0.95);
  /* press-in snappy (70ms); the release fade rides the base 120ms */
  transition: transform 70ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .email-toolbar-icon-btn {
    transition: none;
  }
  .email-toolbar-icon-btn:active {
    transform: none;
    transition: none;
  }
}

.email-toolbar-trailing {
  display: none;
}

.email-search {
  flex: 1;
  position: relative;
  max-width: 480px;
}

.email-search > svg:first-child {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--bb-warm-text-light, var(--sk-text-secondary));
  pointer-events: none;
  z-index: 1;
  transition: color 150ms ease;
}

.email-search:focus-within > svg:first-child {
  color: var(--bb-warm-text, var(--sk-text));
}

.email-search input {
  width: 100%;
  min-height: 48px;
  padding: 0 40px 0 40px;
  border: 1px solid rgba(228, 220, 212, 0.5);
  border-radius: 24px;
  background: rgba(255, 254, 251, 0.85);
  color: var(--bb-warm-text, var(--sk-text));
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  font-style: normal;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.email-search input:hover {
  border-color: rgba(228, 220, 212, 0.7);
}

.email-search input:focus-visible {
  outline: none;
  border-color: var(--bb-sage, #A8C5B8);
  box-shadow: none;
}

.email-search input::placeholder {
  color: var(--bb-muted, var(--sk-text-tertiary, rgba(0,0,0,0.46)));
  font-style: normal;
}

.email-search__kbd {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border: 1px solid rgba(228, 220, 212, 0.5);
  border-radius: 6px;
  background: rgba(228, 220, 212, 0.4);
  color: var(--bb-warm-text-light, var(--sk-text-tertiary, rgba(0,0,0,0.35)));
  font-family: var(--font-family);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  pointer-events: none;
  user-select: none;
  transition: opacity 150ms ease;
}

.email-search input:focus-visible ~ .email-search__kbd,
.email-search input:not(:placeholder-shown) ~ .email-search__kbd {
  opacity: 0;
  pointer-events: none;
}

.email-search__clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  color: var(--sk-text-secondary);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
  z-index: 2;
}

.email-search__clear:hover {
  background: rgba(0, 0, 0, 0.10);
  color: var(--sk-text);
}

.email-search__clear[hidden] {
  display: none;
}

.email-search__spinner {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-top-color: var(--sk-text-secondary);
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
  display: none;
}

.email-search--loading .email-search__spinner {
  display: block;
  animation: email-search-spin 600ms linear infinite;
}

.email-search--loading > svg:first-child {
  display: none;
}

@keyframes email-search-spin {
  to { transform: translateY(-50%) rotate(360deg); }
}

.email-ask-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid rgba(228, 220, 212, 0.6);
  border-radius: 24px;
  background: rgba(255, 254, 251, 0.85);
  color: var(--bb-warm-text, #5C4D43);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
  flex-shrink: 0;
}

.email-ask-ai-btn:hover {
  border-color: var(--bb-sage, #A8C5B8);
  background: var(--bb-sage-bg, rgba(168, 197, 184, 0.08));
  color: var(--bb-sage-dark, #4A7A68);
}

.email-ask-ai-btn svg {
  color: var(--bb-sage, #A8C5B8);
  flex-shrink: 0;
}

.email-toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--bb-warm-text-light, var(--sk-text-secondary));
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.email-toolbar-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--bb-warm-text, var(--sk-text));
}

.email-toolbar-btn:active {
  transform: scale(0.95);
  transition: transform 120ms ease, background 150ms ease, color 150ms ease;
}

.email-profile {
  position: relative;
  flex-shrink: 0;
}

.email-profile-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: opacity 150ms ease;
}

.email-profile-btn:hover {
  opacity: 0.8;
}

.email-profile-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bb-sage, #A8C5B8);
  color: #fff;
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  text-transform: uppercase;
  user-select: none;
}

.email-profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  padding: 6px 0;
  border-radius: 12px;
  background: var(--bb-white, #fff);
  border: 1px solid rgba(228, 220, 212, 0.5);
  box-shadow: 0 8px 24px rgba(92, 77, 67, 0.12), 0 2px 8px rgba(92, 77, 67, 0.06);
  z-index: 100;
}

.email-profile-dropdown[hidden] {
  display: none;
}

.email-profile-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--bb-warm-text, #5C4D43);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 150ms ease;
  text-align: left;
}

.email-profile-item:hover {
  background: rgba(168, 197, 184, 0.08);
}

.email-profile-item svg {
  flex-shrink: 0;
  color: var(--bb-warm-text-light, var(--sk-text-secondary));
}

.email-profile-divider {
  height: 1px;
  margin: 4px 12px;
  background: rgba(228, 220, 212, 0.5);
}

.email-profile-logout:hover {
  color: #c0392b;
}

.email-profile-logout:hover svg {
  color: #c0392b;
}

/* Quiet chrome email header */
.email-page .email-toolbar.email-header {
  background: transparent !important;
  border: 0 !important;
  border-bottom: none !important;
  box-shadow: none !important;
  min-height: 64px !important;
  padding: 14px 9px 14px 0 !important;
  font-family: var(--font-family) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  flex-wrap: nowrap !important;
  overflow: visible !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.email-page .email-toolbar.email-header .email-toolbar-left {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  padding-left: 0 !important;
  margin-left: 0 !important;
}

.email-page .email-toolbar.email-header .email-toolbar-skeleton {
  height: 32px !important;
}

.email-page .email-toolbar.email-header .toolbar-sk-search,
.email-page .email-toolbar.email-header .toolbar-sk-btn,
.email-page .email-toolbar.email-header .toolbar-sk-icon {
  height: 32px !important;
  border-radius: 16px !important;
}

.email-page .email-toolbar.email-header .email-toolbar-leading {
  display: flex !important;
  align-items: center !important;
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 36px !important;
  max-width: none !important;
  padding: 0 !important;
  gap: 6px !important;
  z-index: 5 !important;
}

.email-page .email-toolbar.email-header .email-folder-toggle {
  display: none !important;
}

.email-page .email-toolbar.email-header .email-search {
  flex: 0 0 36px !important;
  width: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;
  height: 36px !important;
  position: relative !important;
  z-index: 3 !important;
  transition: width 180ms ease, max-width 180ms ease, flex-basis 180ms ease !important;
}

.email-page .email-toolbar.email-header .email-search:not(.email-search--expanded):not(.email-search--has-text):not(:has(#email-search-input:focus)) {
  flex: 0 0 36px !important;
  width: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;
}

.email-page .email-toolbar.email-header .email-search.email-search--expanded,
.email-page .email-toolbar.email-header .email-search.email-search--has-text,
.email-page .email-toolbar.email-header .email-search:has(#email-search-input:focus) {
  flex: 1 1 min(340px, 44vw) !important;
  width: min(340px, 44vw) !important;
  min-width: min(220px, calc(100vw - 208px)) !important;
  max-width: min(340px, calc(100vw - 208px)) !important;
}

.email-page .email-toolbar.email-header .email-search__toggle {
  position: absolute !important;
  inset: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 18px !important;
  background: transparent !important;
  color: #9A8E82 !important;
  cursor: pointer !important;
  z-index: 3 !important;
  transition: opacity 150ms ease !important;
}

.email-page .email-toolbar.email-header .email-search__toggle:hover {
  color: #5C4D43 !important;
}

.email-page .email-toolbar.email-header .email-search.email-search--expanded .email-search__toggle,
.email-page .email-toolbar.email-header .email-search.email-search--has-text .email-search__toggle,
.email-page .email-toolbar.email-header .email-search:has(#email-search-input:focus) .email-search__toggle {
  opacity: 0 !important;
  pointer-events: none !important;
}

.email-page .email-toolbar.email-header .email-search__field {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
}

.email-page .email-toolbar.email-header .email-search__field > svg:first-child {
  position: absolute !important;
  left: 12px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 16px !important;
  height: 16px !important;
  color: #7d7168 !important;
  pointer-events: none !important;
  z-index: 2 !important;
  opacity: 0 !important;
  transition: opacity 150ms ease !important;
}

.email-page .email-toolbar.email-header .email-search.email-search--expanded .email-search__field > svg:first-child,
.email-page .email-toolbar.email-header .email-search.email-search--has-text .email-search__field > svg:first-child,
.email-page .email-toolbar.email-header .email-search:has(#email-search-input:focus) .email-search__field > svg:first-child {
  opacity: 1 !important;
}

.email-page .email-toolbar.email-header .email-search input,
.email-page .email-toolbar.email-header #email-search-input {
  width: 36px !important;
  min-height: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 18px !important;
  background: transparent !important;
  color: transparent !important;
  caret-color: transparent !important;
  opacity: 0 !important;
  cursor: pointer !important;
  font-family: var(--font-family) !important;
  font-size: var(--font-size-sm) !important;
  transition: opacity 140ms ease, background 140ms ease, color 140ms ease, width 180ms ease !important;
}

.email-page .email-toolbar.email-header .email-search.email-search--expanded input,
.email-page .email-toolbar.email-header .email-search.email-search--has-text input,
.email-page .email-toolbar.email-header .email-search:has(#email-search-input:focus) input,
.email-page .email-toolbar.email-header .email-search.email-search--expanded #email-search-input,
.email-page .email-toolbar.email-header .email-search.email-search--has-text #email-search-input,
.email-page .email-toolbar.email-header .email-search:has(#email-search-input:focus) #email-search-input {
  width: 100% !important;
  padding: 0 36px 0 34px !important;
  background: rgba(255, 255, 255, 0.62) !important;
  color: #4d423b !important;
  caret-color: #8f2f45 !important;
  opacity: 1 !important;
  cursor: text !important;
}

.email-page .email-toolbar.email-header .email-search input::placeholder {
  color: #6F6258 !important;
}

.email-page .email-toolbar.email-header .email-search:not(.email-search--expanded):not(.email-search--has-text):not(:has(#email-search-input:focus)) input::placeholder {
  color: transparent !important;
}

.email-page .email-toolbar.email-header .email-search__clear {
  right: 4px !important;
  width: 28px !important;
  height: 28px !important;
  background: rgba(92, 77, 67, 0.08) !important;
  color: #6c5d54 !important;
}

.email-page .email-toolbar.email-header .email-search__kbd {
  display: none !important;
}

.email-page .email-toolbar.email-header .email-search__spinner {
  left: 12px !important;
  width: 14px !important;
  height: 14px !important;
}

.email-page .email-toolbar.email-header .email-toolbar-trailing {
  display: none !important;
}

.email-page .email-toolbar.email-header .email-profile {
  width: 36px !important;
  height: 36px !important;
}

.email-page .email-toolbar.email-header .email-profile-btn {
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  color: #76675f !important;
  background: transparent !important;
  opacity: 1 !important;
}

.email-page .email-toolbar.email-header .email-profile-btn:hover,
.email-page .email-toolbar.email-header .email-profile-btn:focus-visible {
  background: rgba(92, 77, 67, 0.07) !important;
  color: #4d423b !important;
  outline: none !important;
}

.email-page .email-toolbar.email-header .email-settings-gear {
  width: 32px !important;
  height: 32px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 50% !important;
}

.email-page .email-toolbar.email-header .email-profile-dropdown {
  top: calc(100% + 10px) !important;
  border-radius: 16px !important;
  background: rgba(255, 253, 250, 0.98) !important;
}

.email-account-filter {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 3px 14px;
  border-bottom: 0.5px solid color-mix(in srgb, var(--sk-border) 72%, transparent);
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: color-mix(in srgb, var(--sk-bg-surface) 86%, transparent);
}

.email-account-filter::-webkit-scrollbar {
  display: none;
}

#email-account-filter.email-account-filter.email-account-filter--calm {
  display: inline-flex;
  align-items: center;
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  min-height: 0;
}

.email-account-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  min-height: 34px;
  max-width: 190px;
  padding: 0 28px 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235C4D43' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  color: var(--sk-text-secondary);
  font: inherit;
  font-size: var(--font-size-sm);
  letter-spacing: 0;
  cursor: pointer;
  transition: background-color 120ms, border-color 120ms, color 120ms;
}

.calm-account-select--hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.calm-account-select--hidden:focus-visible ~ .calm-account-trigger-wrap .calm-account-trigger {
  background: rgba(58, 47, 38, 0.06);
}

.email-account-select:hover,
.email-account-select:focus-visible {
  border-color: var(--sk-border);
  background-color: rgba(0, 0, 0, 0.04);
  color: var(--sk-text);
  outline: none;
}

.email-account-select option {
  background-color: var(--color-card, #fff);
  color: var(--color-text, #1a1a1a);
}

/* ── CalmAccountSelect trigger ── */

.calm-account-trigger-wrap {
  position: relative;
}

.calm-account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(154, 142, 130, 0.22);
  background: #FBF8F2;
  color: #3A2F26;
  font-family: inherit;
  font-size: var(--font-size-sm);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
  user-select: none;
}

.calm-account-trigger:hover {
  background: #FBF7F0;
  border-color: rgba(154, 142, 130, 0.35);
}

.calm-account-trigger-wrap.is-open .calm-account-trigger {
  background: rgba(154, 142, 130, 0.12);
  border-color: transparent;
}

.calm-account-trigger__label {
  color: #3A2F26;
  font-size: var(--font-size-sm);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calm-account-trigger__chevron {
  display: flex;
  align-items: center;
  color: #9A8E82;
  flex: 0 0 auto;
  margin-left: 2px;
  transition: transform 160ms ease;
}

.calm-account-trigger-wrap.is-open .calm-account-trigger__chevron {
  transform: rotate(180deg);
}

.calm-account-trigger[disabled],
.calm-account-trigger.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  .calm-account-trigger {
    transition: none;
  }
  .calm-account-trigger__chevron {
    transition: none;
  }
}

/* ── CalmAccountSelect panel ── */

.calm-account-panel {
  position: fixed;
  z-index: 9999;
  background: #FFFEFB;
  border: 1px solid rgba(154, 142, 130, 0.22);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(58, 47, 38, 0.10), 0 2px 6px rgba(58, 47, 38, 0.06);
  padding: 8px 0 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 140ms, transform 140ms;
}

.calm-account-panel.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .calm-account-panel {
    transform: none;
    transition: opacity 140ms;
  }
}

.calm-account-panel__landmark {
  text-transform: uppercase;
  font: 700 11px/1 Inter, system-ui, -apple-system, sans-serif;
  letter-spacing: 1.1px;
  color: #9A8E82;
  padding: 10px 16px 8px;
}

.calm-account-panel__list {
  padding: 6px 6px 6px;
  max-height: 360px;
  overflow-y: auto;
}

.calm-account-panel__divider {
  height: 0;
  border: 0;
  border-bottom: 1px solid rgba(154, 142, 130, 0.15);
  margin: 4px 10px 4px;
}

/* ── CalmAccountSelect rows ── */

.calm-account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  color: #3A2F26;
  font: 500 13.5px/1.2 Inter, system-ui, -apple-system, sans-serif;
  cursor: pointer;
}

.calm-account-row--all {
  margin-bottom: 2px;
}

.calm-account-row--focused,
.calm-account-row:hover {
  background: rgba(154, 142, 130, 0.10);
}

.calm-account-row--inactive {
  cursor: default;
  opacity: 0.65;
}

.calm-account-row--inactive:hover {
  background: transparent;
}

.calm-account-row--selected {
  background: rgba(58, 47, 38, 0.05);
  color: #3A2F26;
  font-weight: 500;
}

.calm-account-row--selected.calm-account-row--focused,
.calm-account-row--selected:hover {
  background: rgba(58, 47, 38, 0.08);
}

.calm-account-row--selected .calm-account-row__dot {
  background: transparent;
}

.calm-account-row__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.calm-account-row--all .calm-account-row__dot {
  visibility: hidden;
}

.calm-account-row__dot--connected {
  background: #6E8A7E;
}

.calm-account-row__dot--inactive {
  background: transparent;
  border: 1.5px solid rgba(154, 142, 130, 0.45);
}

/* ── Per-mailbox identity colours ─────────────────────────────────────────
   Each connected mailbox gets its own calm, muted colour so work mail and
   private mail are distinguishable at a glance. The colour is identity, not
   decoration: always paired with the account address (dropdown) and the dot
   shape (list row), never the sole cue — colour-blind safe. Theme-aware so the
   swatches stay legible on the light panel (#FFFEFB) and the dark card. The
   palette SLOT is chosen in account-colors.js; the hexes live here so they can
   be re-tuned without touching logic. */
:root {
  --mailbox-c0: #6E8A7E; /* salvie  — sage        */
  --mailbox-c1: #6E84A6; /* havblå  — dusty blue   */
  --mailbox-c2: #9B7BA3; /* lyng    — heather      */
  --mailbox-c3: #B27A5B; /* ler     — clay         */
  --mailbox-c4: #8E7A3A; /* okker   — ochre (darkened for >=3:1 dot contrast + clay separation) */
  --mailbox-c5: #877F76; /* skifer  — slate        */
}
/* html-scoped: the voice-orb host mirrors data-theme onto itself, so bare
   [data-theme="dark"] selectors would match the orb element too. */
html[data-theme="dark"] {
  --mailbox-c0: #8FB0A1;
  --mailbox-c1: #94AAC9;
  --mailbox-c2: #BBA0C2;
  --mailbox-c3: #CB977A;
  --mailbox-c4: #BBAA5E;
  --mailbox-c5: #A69D92;
}

/* Identity-colour dot on the closed account-filter trigger (active mailbox
   only; JS toggles display via syncLabel). */
.calm-account-trigger__dot {
  box-sizing: border-box;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  /* Hairline lifts low-contrast hues off the panel and defines the edge. */
  border: 0.5px solid rgba(58, 47, 38, 0.22);
  flex: 0 0 auto;
  display: none;
}

/* Identity-colour dot leading each list row's sender. Rendered only with 2+
   connected mailboxes (see account-colors.js / list-core.js). */
.email-account-dot {
  box-sizing: border-box;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  /* Hairline lifts low-contrast hues off the panel and defines the edge. */
  border: 0.5px solid rgba(58, 47, 38, 0.22);
  flex: 0 0 auto;
  margin-right: 6px;
  vertical-align: middle;
}

[data-theme="dark"] .email-account-dot,
[data-theme="dark"] .calm-account-trigger__dot {
  border-color: rgba(255, 255, 255, 0.24);
}

.calm-account-row__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calm-account-row__check {
  display: flex;
  align-items: center;
  color: rgba(74, 122, 104, 0.65);
  flex-shrink: 0;
  visibility: hidden;
}

.calm-account-row--selected .calm-account-row__check {
  visibility: visible;
}

.calm-account-row--focused {
  outline: none; /* focus shows as the soft background tint above, not a hard line */
}

@media (prefers-reduced-motion: no-preference) {
  .calm-account-row,
  .calm-account-panel__add-btn {
    transition: background-color 100ms;
  }
}

@media (pointer: coarse) {
  .calm-account-row {
    min-height: 44px;
  }
  .calm-account-panel__add-btn {
    min-height: 44px;
  }
}

/* ── CalmAccountSelect footer ── */

.calm-account-panel__footer {
  border-top: 1px solid rgba(154, 142, 130, 0.18);
  background: transparent;
  padding: 6px;
  margin-top: 4px;
}

.calm-account-panel__add-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #4A7A68;
  font: 600 13.5px/1.2 Inter, system-ui, -apple-system, sans-serif;
  cursor: pointer;
  text-align: left;
}

.calm-account-panel__add-btn:hover {
  background: rgba(74, 122, 104, 0.08);
}

.calm-account-panel__add-btn:focus-visible,
.calm-account-panel__add-btn--focused {
  background: rgba(74, 122, 104, 0.08);
}

.calm-account-panel__add-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: rgba(74, 122, 104, 0.10);
  font-size: 0;
  margin-left: -2px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cline x1='6' y1='1' x2='6' y2='11' stroke='%234a7a68' stroke-width='2.2' stroke-linecap='round'/%3E%3Cline x1='1' y1='6' x2='11' y2='6' stroke='%234a7a68' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.email-profile-dropdown .email-account-filter {
  width: auto;
  min-height: 0;
  margin: 0 6px 4px;
  padding: 4px 10px 8px;
  border-bottom: 1px solid rgba(228, 220, 212, 0.5);
  background: transparent;
  overflow: visible;
}

.email-profile-dropdown .email-account-filter--select,
.email-profile-dropdown .email-account-select {
  max-width: none;
}

.email-account-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  max-width: clamp(84px, 15vw, 164px);
  min-height: 24px;
  padding: 2px 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family);
  color: var(--sk-text-muted);
  background: transparent;
  border: 0.5px solid transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background 180ms, color 180ms, border-color 180ms;
  flex-shrink: 0;
  line-height: 1.2;
}

.email-account-chip:hover {
  background: color-mix(in srgb, var(--sk-text) 5%, transparent);
  border-color: color-mix(in srgb, var(--sk-border) 70%, transparent);
  color: var(--sk-text);
}

.email-account-chip.active {
  background: color-mix(in srgb, var(--sk-text) 8%, var(--sk-bg-surface));
  border-color: color-mix(in srgb, var(--sk-text) 20%, var(--sk-border));
  color: var(--sk-text);
  font-weight: var(--font-weight-semibold);
}

.email-columns {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.email-folders {
  width: 220px;
  overflow-y: auto;
  flex-shrink: 0;
  padding: 8px 8px;
  background: var(--sk-bg-surface);
  border-right: 0.5px solid rgba(0, 0, 0, 0.08);
}

.email-folder-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0 12px;
  border: none;
  background: transparent;
  color: var(--sk-text-secondary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family);
  cursor: pointer;
  transition: background 120ms, color 120ms;
  text-align: left;
  line-height: 1;
  min-height: 44px;
  border-radius: var(--radius-sm);
  margin: 1px 0;
}

.email-folder-item:hover {
  background: rgba(0,0,0,0.04);
  color: var(--sk-text);
}

.email-folder-item.active {
  background: rgba(0, 0, 0, 0.07);
  color: var(--sk-text);
  font-weight: var(--font-weight-semibold);
}

.email-folder-item.active .email-folder-icon {
  color: var(--sk-text);
}

.email-folder-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  color: var(--sk-text-secondary);
}

.email-folder-item:hover .email-folder-icon {
  color: var(--sk-text-secondary);
}

.email-folder-item.active .email-folder-icon svg {
  stroke: currentColor;
}

.email-folder-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-folder-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  padding: 0;
  background: transparent;
  color: var(--sk-text-secondary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  flex-shrink: 0;
  text-align: right;
}

.email-folder-item.active .email-folder-count {
  background: transparent;
  color: var(--sk-text);
}

.email-folder-count-muted {
  opacity: 0.45;
  font-weight: var(--font-weight-medium);
}

.email-folder-section {
  padding: 16px 12px 4px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-top: 0.5px solid rgba(0, 0, 0, 0.08);
  margin-top: 4px;
}

.email-accounts-modal {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: none;
  align-items: center;
  justify-content: center;
}

.email-accounts-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.email-accounts-dialog {
  position: relative;
  width: 560px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  max-height: calc(100dvh - 64px);
  background: var(--color-card);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0,0,0,0.08);
  overflow-y: auto;
  overflow-x: hidden;
}

.email-accounts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--color-card);
  border-bottom: 0.5px solid var(--sk-border);
}

.email-accounts-header h3 {
  font-size: var(--font-size-md, 16px);
  font-weight: var(--font-weight-semibold, 600);
  color: var(--sk-text);
  margin: 0;
}

.email-accounts-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  color: var(--sk-text-secondary);
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}

.email-accounts-close:hover {
  background: rgba(194,75,96,0.08);
  color: var(--sk-danger);
}

.email-accounts-close:focus-visible {
  outline: none;
  outline-offset: 2px;
}

.email-accounts-body {
  padding: 20px;
  background: var(--color-card);
  overflow-y: auto;
  max-height: calc(100vh - 140px);
  max-height: calc(100dvh - 140px);
}

.email-accounts-section-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text-secondary);
  margin-bottom: 12px;
}

.email-accounts-empty {
  text-align: center;
  color: var(--sk-text-secondary);
  font-size: var(--font-size-base);
  padding: 16px 0;
}

.email-accounts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.email-account-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-md);
}

.email-account-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.email-account-icon-gmail {
  background: rgba(194,75,96,0.08);
  color: var(--sk-danger);
}

.email-account-icon-outlook {
  background: rgba(0, 0, 0, 0.04);
  color: var(--sk-text);
}

.email-account-info {
  flex: 1;
  min-width: 0;
}

.email-account-name {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-account-email {
  font-size: var(--font-size-sm);
  color: var(--sk-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-account-disconnect {
  flex-shrink: 0;
}

.email-accounts-connect {
  padding-top: 12px;
}

.email-accounts-list + .email-accounts-connect {
  border-top: 0.5px solid var(--sk-border);
}

.email-accounts-connect-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text-secondary);
  margin-bottom: 8px;
}

.email-accounts-connect-buttons {
  display: flex;
  gap: 8px;
}

.email-connect-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-base);
}

.email-folder-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--sk-text-secondary);
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}

.email-folder-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--sk-text);
}

.email-reader-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border: none;
  border-bottom: 0.5px solid var(--sk-border);
  background: transparent;
  color: var(--sk-text);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.email-list-items,
.email-reader-content,
.email-folders,
.email-reader-body,
.email-compose-body-wrap {
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.10) transparent;
}

.email-list-items::-webkit-scrollbar,
.email-reader-content::-webkit-scrollbar,
.email-folders::-webkit-scrollbar,
.email-reader-body::-webkit-scrollbar,
.email-compose-body-wrap::-webkit-scrollbar {
  width: 4px;
}

.email-list-items::-webkit-scrollbar-track,
.email-reader-content::-webkit-scrollbar-track,
.email-folders::-webkit-scrollbar-track,
.email-reader-body::-webkit-scrollbar-track,
.email-compose-body-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.email-list-items::-webkit-scrollbar-thumb,
.email-reader-content::-webkit-scrollbar-thumb,
.email-folders::-webkit-scrollbar-thumb,
.email-reader-body::-webkit-scrollbar-thumb,
.email-compose-body-wrap::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.07);
  border-radius: var(--radius-sm);
}

.email-list-items::-webkit-scrollbar-thumb:hover,
.email-reader-content::-webkit-scrollbar-thumb:hover,
.email-folders::-webkit-scrollbar-thumb:hover,
.email-reader-body::-webkit-scrollbar-thumb:hover,
.email-compose-body-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.25);
}

.email-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: var(--sk-text-secondary);
}

.email-loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--sk-border);
  border-top-color: var(--sk-text);
  border-radius: var(--radius-full);
  animation: email-spin 0.8s linear infinite;
  margin-right: 12px;
}


.email-signature-host {
  display: block;
}
.email-signature-host .email-signature,
.email-compose-quill .email-signature {
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
}
.email-signature-host .email-signature table,
.email-signature-host .email-signature td,
.email-signature-host .email-signature th {
  border: none;
  border-collapse: collapse;
  border-spacing: 0;
  padding: 0;
  margin: 0;
  outline: none;
}
.email-signature-host .email-signature img {
  max-width: 100%;
  height: auto;
}

.email-compose-field input:focus-visible {
  outline: none;
}

.email-shortcuts-modal {
  position: fixed;
  inset: 0;
  z-index: 12050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.email-page #ss-cookie-banner {
  z-index: 900 !important;
}

.email-shortcuts-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(0, 0, 0, 0.4);
}

.email-shortcuts-dialog {
  position: relative;
  z-index: 1;
  background: var(--sk-bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 24px;
  max-width: 520px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  width: 90%;
}

.email-shortcuts-dialog h3 {
  margin: 0 0 16px;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text);
}

.email-shortcuts-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.email-shortcut {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--font-size-base);
  color: var(--sk-text-secondary);
}

.email-shortcut kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 6px;
  background: var(--sk-bg-subtle);
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text);
}

.email-shortcut span {
  color: var(--sk-text);
}

.email-shortcuts-close {
  margin-top: 16px;
  width: 100%;
  padding: 8px;
  background: var(--sk-bg-subtle);
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--sk-text-secondary);
  cursor: pointer;
}

.email-shortcuts-close:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--sk-text);
}

@media (max-width: 767px) {
  .email-shortcuts-modal {
    padding: 16px;
  }

  .email-shortcuts-dialog {
    width: min(100%, 360px);
    padding: 22px 18px 18px;
  }

  .email-shortcut {
    gap: 10px;
  }

  .email-shortcuts-close {
    min-height: 44px;
  }
}

.cmd-palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 10300;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}
.cmd-palette-dialog {
  background: var(--sk-bg-surface);
  border-radius: var(--radius-lg);
  width: 500px;
  max-width: 92vw;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}
.cmd-palette-input {
  width: 100%;
  padding: 16px 20px;
  font-size: var(--font-size-md);
  border: none;
  border-bottom: 0.5px solid var(--sk-border);
  outline: none;
  background: transparent;
  color: var(--sk-text);
  box-sizing: border-box;
}
.cmd-palette-input::placeholder {
  color: var(--sk-text-secondary);
}
.cmd-palette-results {
  overflow-y: auto;
  padding: 8px 0;
  flex: 1;
}
.cmd-palette-section {
  padding: 8px 20px 4px;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sk-text-secondary);
}
.cmd-palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  cursor: pointer;
  font-size: var(--font-size-base);
  color: var(--sk-text);
}
.cmd-palette-item.selected,
.cmd-palette-item:hover {
  background: rgba(0, 0, 0, 0.04);
}
.cmd-palette-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.6;
}
.cmd-palette-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmd-palette-label mark {
  background: none;
  font-weight: var(--font-weight-bold);
  color: var(--sk-text);
}
.cmd-palette-shortcut {
  font-size: var(--font-size-sm);
  color: var(--sk-text-secondary);
  flex-shrink: 0;
}
.cmd-palette-empty {
  padding: 20px;
  text-align: center;
  color: var(--sk-text-secondary);
  font-size: var(--font-size-base);
}

.email-swipe-wrapper {
  position: relative;
  overflow: hidden;
}

.email-swipe-wrapper .email-message-item {
  transition: transform 120ms ease;
  background: var(--sk-bg-surface);
  position: relative;
  z-index: 1;
}

.email-ptr-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  overflow: hidden;
  transition: max-height 180ms ease, opacity 180ms ease, padding 180ms ease;
  max-height: 0;
  min-height: 0;
  opacity: 0;
}

.email-ptr-spinner.visible {
  max-height: 48px;
  padding: 12px;
  opacity: 1;
}

.email-ptr-spinner svg {
  animation: email-spin 0.8s linear infinite;
  color: var(--sk-text);
}

.email-skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--sk-border);
}
.email-skeleton-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--sk-border);
  animation: skeleton-pulse 1.5s ease infinite;
  flex-shrink: 0;
}
.email-skeleton-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.email-skeleton-line {
  height: 12px;
  border-radius: var(--radius-sm);
  background: var(--sk-border);
  animation: skeleton-pulse 1.5s ease infinite;
}
.email-skeleton-line:nth-child(1) { width: 40%; }
.email-skeleton-line:nth-child(2) { width: 80%; }
.email-skeleton-line:nth-child(3) { width: 60%; }
@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes sk-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.sk-skeleton {
  background: linear-gradient(90deg, var(--sk-bg-subtle) 25%, var(--sk-bg-hover, rgba(0,0,0,0.04)) 50%, var(--sk-bg-subtle) 75%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.5s ease infinite;
  border-radius: var(--radius-sm);
}

.email-folder-skeleton { padding: 16px 12px; }
.sk-folder-row { padding: 10px 0; }

.email-list-skeleton { padding: 12px 16px; }
.sk-msg-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}
.sk-msg-divider {
  height: 0.5px;
  background: var(--sk-border);
  margin: 8px 0;
}

@media (prefers-reduced-motion: reduce) {
  .sk-skeleton,
  .toolbar-sk-btn,
  .toolbar-sk-search,
  .toolbar-sk-icon {
    animation: none;
  }
}

.imap-provider-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.imap-provider-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  border: 2px solid var(--sk-border);
  border-radius: var(--radius-lg);
  background: var(--sk-bg-surface);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
  text-align: center;
  font-family: inherit;
}

.imap-provider-option:hover {
  border-color: var(--sk-text);
  background: rgba(0, 0, 0, 0.04);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.imap-provider-option:active {
  transform: scale(0.98);
}

.imap-provider-option--wide {
  grid-column: 1 / -1;
}

.imap-provider-name {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text);
}

.imap-provider-desc {
  font-size: var(--font-size-sm);
  color: var(--sk-text-secondary);
  line-height: 1.3;
}

.imap-wizard {
  animation: imap-fade-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes imap-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .imap-wizard { animation: none; }
}

.imap-wizard-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.imap-wizard-header h3 {
  flex: 1;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text);
  margin: 0;
}

.imap-wizard-step {
  font-size: var(--font-size-sm);
  color: var(--sk-text-secondary);
  white-space: nowrap;
}

.imap-wizard-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sk-text-secondary);
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
  flex-shrink: 0;
}

.imap-wizard-back:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--sk-text);
}

.imap-wizard-field {
  margin-bottom: 12px;
}

.imap-wizard-field label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text-secondary);
  margin-bottom: 4px;
}

.imap-wizard-field input,
.imap-wizard-field select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-md, 8px);
  background: transparent;
  color: var(--sk-text);
  font-size: var(--font-size-base, 14px);
  font-family: inherit;
  transition: border-color 180ms ease, box-shadow 180ms ease;
  box-sizing: border-box;
}

.imap-wizard-field input:focus-visible,
.imap-wizard-field select:focus-visible {
  outline: none;
  border-color: var(--sk-border);
  box-shadow: none;
}

.imap-wizard-field input::placeholder {
  color: var(--sk-text-secondary);
}

.imap-password-wrap {
  position: relative;
}

.imap-password-wrap input {
  width: 100%;
  padding-right: 42px;
}

.imap-password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sk-text-secondary);
  cursor: pointer;
  transition: color 180ms ease;
}

.imap-password-toggle:hover {
  color: var(--sk-text);
}

.imap-field-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  font-size: var(--font-size-xs);
  color: var(--sk-text-secondary);
  line-height: 1;
}

.imap-field-hint svg {
  flex-shrink: 0;
  vertical-align: middle;
}

.imap-row {
  display: flex;
  gap: 8px;
}

.imap-field-grow {
  flex: 1;
  min-width: 0;
}

.imap-field-small {
  width: 100px;
  flex-shrink: 0;
}

.imap-section {
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-md);
  padding: 12px;
  margin: 0 0 12px 0;
}

.imap-section legend {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text-secondary);
  padding: 0 4px;
}

.imap-wizard-next {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}

.imap-link-btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--sk-text);
  font-size: var(--font-size-base);
  font-family: inherit;
  cursor: pointer;
  transition: color 180ms ease;
}

.imap-link-btn:hover {
  color: var(--sk-text);
  text-decoration: underline;
}

.imap-wizard-error {
  background: rgba(194,75,96,0.08);
  color: var(--sk-danger);
  border: 0.5px solid rgba(220, 38, 38, 0.2);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: var(--font-size-base);
  margin-bottom: 8px;
}

.imap-detect-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 0;
  text-align: center;
}

.imap-detect-text {
  font-size: var(--font-size-base);
  color: var(--sk-text);
  margin: 0;
}

.imap-detect-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--sk-border);
  border-top-color: var(--sk-text);
  border-radius: var(--radius-full);
  animation: imap-spin 0.8s linear infinite;
}

@keyframes imap-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .imap-detect-spinner { animation: none; border-top-color: var(--sk-text); }
}

.imap-detect-fallback {
  text-align: center;
  padding: 12px 0;
  border-top: 0.5px solid var(--sk-border);
  margin-top: 12px;
}

.imap-detect-fallback p {
  font-size: var(--font-size-base);
  color: var(--sk-text-secondary);
  margin: 0 0 8px 0;
}

.imap-detect-manual-btn {
  display: inline-block;
  padding: 8px 16px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--sk-text);
  font-size: var(--font-size-base);
  font-family: inherit;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease;
}

.imap-detect-manual-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: var(--sk-text);
}

.imap-detect-success {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(113, 221, 55, 0.08);
  border: 0.5px solid rgba(113, 221, 55, 0.15);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.imap-detect-success strong {
  display: block;
  font-size: var(--font-size-base);
  color: var(--sk-text);
}

.imap-provider-badge {
  display: inline-block;
  margin-top: 2px;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.04);
  color: var(--sk-text);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

.imap-settings-summary {
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 12px;
}

.imap-setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  font-size: var(--font-size-base);
}

.imap-setting-row + .imap-setting-row {
  border-top: 0.5px solid var(--sk-border);
}

.imap-setting-row > span:first-child {
  color: var(--sk-text-secondary);
  font-size: var(--font-size-sm);
}

.imap-setting-row > span:last-child {
  color: var(--sk-text);
  font-weight: var(--font-weight-medium);
  font-family: monospace;
  font-size: var(--font-size-sm);
}

.imap-provider-note {
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.04);
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--sk-text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
}

.imap-manual-notice {
  padding: 12px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.imap-manual-notice p {
  margin: 0;
  font-size: var(--font-size-base);
  color: var(--sk-text-secondary);
}

.imap-test-steps {
  margin-bottom: 16px;
}

.imap-test-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 0.5px solid var(--sk-border);
  font-size: var(--font-size-base);
  color: var(--sk-text);
}

.imap-test-step:last-child {
  border-bottom: none;
}

.imap-test-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  position: relative;
}

.imap-test-step.pending .imap-test-icon {
  border: 2px solid var(--sk-border);
}

.imap-test-step.pending {
  opacity: 0.5;
}

.imap-test-step.active .imap-test-icon {
  border: 2px solid var(--sk-text);
  border-top-color: transparent;
  animation: imap-spin 0.8s linear infinite;
}

.imap-test-step.success .imap-test-icon {
  background: var(--sk-success);
  border: none;
}

.imap-test-step.success .imap-test-icon::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 10px;
  border: solid var(--sk-text-on-accent);
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -60%) rotate(45deg);
}

.imap-test-step.error .imap-test-icon {
  background: var(--sk-danger);
  border: none;
}

.imap-test-step.error .imap-test-icon::after {
  content: '\00d7';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--email-control-on-fill);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  line-height: 1;
}

.imap-test-result {
  margin-left: auto;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

.imap-test-step.success .imap-test-result {
  color: var(--sk-success);
}

.imap-test-step.error .imap-test-result {
  color: var(--sk-danger);
}

.imap-test-error {
  background: rgba(255, 62, 29, 0.06);
  border: 0.5px solid rgba(255, 62, 29, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.imap-test-error-title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-danger);
  margin: 0 0 4px 0;
}

.imap-test-error-detail {
  font-size: var(--font-size-sm);
  color: var(--sk-text-secondary);
  margin: 0 0 8px 0;
  line-height: 1.5;
}

.imap-test-error-hint {
  font-size: var(--font-size-sm);
  color: var(--sk-text-secondary);
  margin: 0 0 12px 0;
  line-height: 1.5;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 6px;
  border-left: 3px solid rgba(255, 62, 29, 0.3);
}

.imap-test-error-actions {
  display: flex;
  gap: 8px;
}

.imap-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 0 16px;
}

.imap-success-icon {
  margin-bottom: 12px;
  animation: imap-success-pop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes imap-success-pop {
  0%   { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .imap-success-icon { animation: none; }
}

.imap-success h3 {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text);
  margin: 0 0 4px 0;
}

.imap-success p {
  font-size: var(--font-size-base);
  color: var(--sk-text-secondary);
  margin: 0;
}

.imap-success-sync {
  margin-top: 12px;
  font-size: var(--font-size-sm);
  color: var(--sk-text-secondary);
  line-height: 1.5;
}

@media (max-width: 480px) {
  .imap-provider-grid {
    grid-template-columns: 1fr;
  }

  .imap-provider-option--wide {
    grid-column: auto;
  }

  .imap-row {
    flex-direction: column;
  }

  .imap-field-small {
    width: 100%;
  }
}

.sig-account-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.sig-account-tab {
  padding: 6px 14px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--sk-text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background 180ms, border-color 180ms, color 180ms;
}

.sig-account-tab:hover {
  border-color: var(--sk-text);
  color: var(--sk-text);
  background: rgba(0, 0, 0, 0.04);
}

.sig-account-tab.active {
  background: var(--sk-text);
  color: var(--email-control-on-fill);
  border-color: var(--sk-text);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.sig-editor-card {
  background: var(--sk-bg-subtle);
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 12px;
}

/* shared by snippet editor toolbar — do not remove */
.sig-format-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  min-width: 36px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sk-text-secondary);
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  transition: background 120ms, color 120ms;
}
.sig-format-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--sk-text);
}
.sig-format-btn.active {
  background: rgba(0, 0, 0, 0.07);
  color: var(--sk-text);
}
.sig-format-divider {
  width: 1px;
  height: 16px;
  background: var(--sk-border);
  margin: 0 3px;
}

.sig-color-swatch {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 120ms, border-color 120ms, box-shadow 120ms;
}

.sig-color-swatch:hover {
  transform: scale(1.25);
  border-color: var(--sk-text);
  box-shadow: 0 2px 8px rgba(31, 31, 30, 0.15);
}

.sig-more-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sk-text-secondary);
}
.sig-more-divider {
  height: 0.5px;
  background: var(--sk-border);
  margin: 3px 6px;
}

.sig-link-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  border-radius: var(--radius-md);
  backdrop-filter: blur(2px);
}
.email-settings-modal > .sig-link-overlay {
  border-radius: 0;
}
.sig-link-dialog {
  background: var(--sk-bg);
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  width: 320px;
  box-shadow: 0 8px 24px rgba(31, 31, 30, 0.15);
}
.sig-link-dialog-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  margin-bottom: 12px;
  color: var(--sk-text);
}
.sig-link-field {
  margin-bottom: 10px;
}
.sig-link-field label {
  display: block;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sig-link-field input {
  width: 100%;
  padding: 8px 10px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-base);
  color: var(--sk-text);
  background: var(--sk-bg);
  outline: none;
  transition: border-color 180ms;
}
.sig-link-field input:focus-visible {
  outline: none;
  border-color: var(--sk-border);
  box-shadow: none;
}
.sig-link-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}
.sig-link-cancel, .sig-link-remove {
  padding: 6px 14px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sk-text-secondary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
}
.sig-link-remove {
  color: var(--sk-danger);
  border-color: var(--sk-danger);
  margin-right: auto;
}
.sig-link-ok {
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--sk-text);
  color: var(--email-control-on-fill);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
}
.sig-link-ok:hover { opacity: 0.9; }

.sig-source-area {
  width: 100%;
  min-height: 100px;
  max-height: 220px;
  padding: 12px 14px;
  border: 0.5px solid var(--sk-border);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-family: 'Courier New', Consolas, monospace;
  font-size: var(--font-size-sm);
  line-height: 1.5;
  color: var(--sk-text);
  background: var(--sk-bg-subtle);
  resize: vertical;
  outline: none;
  transition: border-color 180ms;
  tab-size: 2;
}
.sig-source-area:focus-visible {
  outline: none;
  border-color: var(--sk-border);
  box-shadow: none;
}

.sig-separator-options {
  display: flex;
  gap: 12px;
}
.sig-separator-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--sk-text-secondary);
  transition: border-color 180ms, background 180ms;
}
.sig-separator-option:has(input:checked) {
  border-color: var(--sk-text);
  background: rgba(0, 0, 0, 0.04);
  color: var(--sk-text);
}
.sig-separator-option input[type="radio"] {
  display: none;
}
.sig-sep-preview {
  display: inline-flex;
  align-items: center;
  width: 30px;
  font-size: var(--font-size-xs);
  color: var(--sk-text-tertiary);
}
.sig-sep-preview hr {
  width: 100%;
  border: none;
  border-top: 0.5px solid var(--sk-border);
  margin: 0;
}

/* Signature card — contained flex column inside settings body */
.sig-card {
  max-height: 460px;
  height: auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #FFFEFB;
  border: 1px solid rgba(154, 142, 130, 0.22);
  border-radius: 14px;
  padding: 0;
}

/* Signature toolbar — compose grammar overrides for settings context */
.sig-toolbar {
  order: 4;
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  align-self: stretch;
  box-sizing: border-box;
  display: flex;
  padding: 6px 10px;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
  background: #FBF8F2;
  border: none;
  border-top: 1px solid rgba(92, 77, 67, 0.10);
  border-radius: 0;
  overflow-x: visible;
}

.sig-toolbar .ect-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #5C4D43;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.sig-toolbar .ect-btn:hover {
  background: rgba(110, 138, 126, 0.08);
  color: #4A7A68;
}

.sig-toolbar .ect-btn:active {
  background: rgba(110, 138, 126, 0.14);
  color: #4A7A68;
}

.sig-toolbar .ect-btn.ect-active,
.sig-toolbar .ect-btn[aria-pressed="true"] {
  background: rgba(110, 138, 126, 0.14);
  color: #4A7A68;
}

.sig-toolbar .ect-btn:focus-visible {
  outline: 2px solid rgba(110, 138, 126, 0.45);
  outline-offset: 2px;
}

.sig-toolbar .ect-group {
  gap: 4px;
}

.sig-toolbar .ect-divider {
  width: 1px;
  height: 18px;
  background: rgba(92, 77, 67, 0.14);
  margin: 0 4px;
}

.sig-toolbar .ect-dropdown-toggle {
  width: auto;
  min-width: 0;
  height: 30px;
  padding: 0 10px;
  gap: 6px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  background: transparent;
  border: 0;
  color: #5C4D43;
}

.sig-toolbar .ect-dropdown-toggle[data-dropdown="sigFontFamily"] {
  min-width: 0;
}

.sig-toolbar .ect-dropdown-toggle[data-dropdown="sigFontSize"] {
  min-width: 0;
  margin-right: 4px;
}

.sig-toolbar .ect-caret {
  width: 10px;
  height: 10px;
  color: #9A8E82;
}

.sig-toolbar .ect-dropdown-toggle:hover .ect-caret {
  color: #6E8A7E;
}

.email-settings-body .sig-card .sig-toolbar .ect-btn-label {
  display: inline-block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: #5C4D43;
  letter-spacing: 0;
  white-space: nowrap;
  line-height: 1;
}

/* Signature merge-tag tokens */
.sig-token {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px 2px 7px;
  margin: 0 2px;
  border-radius: 12px;
  background: var(--bb-sage-light, #e8f0ec);
  color: var(--bb-sage-dark, #3d6b57);
  font-size: var(--font-size-xs, 12px);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.01em;
  vertical-align: baseline;
  cursor: default;
  user-select: none;
  border: 1px dashed var(--bb-sage-medium, rgba(74,122,104,0.35));
}
.sig-token::before {
  content: '◇';
  font-size: var(--font-size-xs);
  opacity: 0.55;
}

/* Signature toolbar dropdowns use fixed positioning appended to body */
.sig-toolbar-dropdown {
  z-index: 10060;
}

.ect-dropdown.sig-toolbar-dropdown {
  background: #FFFEFB;
  border: 1px solid rgba(92, 77, 67, 0.12);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(58, 47, 38, 0.10);
  padding: 6px;
  min-width: 180px;
  max-height: none;
  overflow: visible;
  z-index: 10060;
}

.ect-dropdown.sig-toolbar-dropdown .ect-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #3A2F26;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.ect-dropdown.sig-toolbar-dropdown .ect-dropdown-item:hover,
.ect-dropdown.sig-toolbar-dropdown .ect-dropdown-item.ect-focused {
  background: rgba(110, 138, 126, 0.08);
  color: #4A7A68;
}

.ect-dropdown.sig-toolbar-dropdown .ect-dropdown-item:focus-visible {
  outline: 2px solid rgba(110, 138, 126, 0.45);
  outline-offset: -2px;
}

.ect-dropdown.sig-toolbar-dropdown .ect-dropdown-item .sig-more-icon {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  color: #6E8A7E;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ect-dropdown.sig-toolbar-dropdown .ect-dropdown-item .sig-more-icon svg {
  width: 16px;
  height: 16px;
}

.sig-image-panel {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: var(--sk-surface, #FFFEFB);
  border: 1px solid var(--sk-border, rgba(154, 142, 130, 0.22));
  border-radius: 8px;
  box-shadow: 0 4px 16px var(--sk-shadow-heavy, rgba(58, 47, 38, 0.10));
  min-width: 180px;
  z-index: 10060;
}
.sig-image-panel button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--sk-text, #3A2F26);
  font-size: var(--font-size-sm, 13px);
  font-family: inherit;
  cursor: pointer;
  transition: background 120ms;
  white-space: nowrap;
}
.sig-image-panel button:hover {
  background: var(--sk-hover, rgba(154, 142, 130, 0.10));
}
.sig-image-panel button svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.sig-image-panel .sig-image-pick-file {
  font-weight: 600;
  color: var(--bb-sage, #6b9d8a);
}

.sig-editor-area {
  order: 1;
  flex: 0 0 auto;
  min-height: 96px;
  max-height: 180px;
  overflow: auto;
  padding: 14px 16px;
  background: #FBF8F2;
  color: #3A2F26;
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  line-height: 1.45;
  outline: none;
  border: none;
  border-radius: 0;
  transition: border-color 180ms, box-shadow 180ms;
}

.sig-editor-area:focus {
  border-color: var(--bb-sage, #6b9d8a);
  box-shadow: none;
}

.sig-editor-area:focus-visible {
  outline: none;
  border-color: var(--bb-sage, #6b9d8a);
  box-shadow: none;
}

.sig-editor-area:empty::before {
  content: attr(data-placeholder);
  color: var(--sk-text-muted);
  pointer-events: none;
}

.sig-editor-area img {
  max-width: 220px;
  max-height: 80px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--sk-border, #e0d8cf);
}

.sig-editor-area a {
  color: var(--sk-text);
  text-decoration: underline;
  text-decoration-color: rgba(0, 0, 0, 0.15);
  text-underline-offset: 2px;
}

.sig-editor-area hr {
  border: none;
  border-top: 0.5px solid var(--sk-border);
  margin: 10px 0;
}

/* Inline validation banner */
.sig-inline-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-top: 6px;
  border-radius: var(--radius-md, 8px);
  background: var(--sk-error-bg, #fef2f2);
  color: var(--sk-error-text, #b91c1c);
  font-size: var(--font-size-sm, 13px);
  border: 1px solid var(--sk-error-border, rgba(185,28,28,0.15));
  animation: sig-error-appear 200ms ease-out;
}
.sig-inline-error[hidden] { display: none; }
.sig-inline-error-text {
  flex: 1;
  font-weight: 500;
}
.sig-inline-error-action {
  flex-shrink: 0;
  padding: 3px 10px;
  border: 1px solid var(--sk-error-border, rgba(185,28,28,0.2));
  border-radius: 14px;
  background: transparent;
  color: var(--sk-error-text, #b91c1c);
  font-size: var(--font-size-xs, 12px);
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms;
}
.sig-inline-error-action:hover {
  background: rgba(185, 28, 28, 0.08);
}
@keyframes sig-error-appear {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Signature scanner: Find min signatur ── */
.sig-find-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-md, 8px);
  background: transparent;
  color: var(--sk-text-secondary, #666);
  font-size: var(--font-size-sm, 13px);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
  margin-right: auto;
}
.sig-find-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--sk-text);
  border-color: var(--sk-text-secondary, #999);
}
.sig-find-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.sig-find-btn[aria-busy="true"] {
  pointer-events: none;
}
.sig-find-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.sig-find-label {
  white-space: nowrap;
}
.sig-find-results {
  order: 3;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin: 0;
}
.sig-find-results[hidden] { display: none; }

.sig-find-results-landmark {
  flex: 0 0 auto;
  padding: 10px 14px 6px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(92, 77, 67, 0.55);
}
.sig-find-loading {
  padding: 12px 16px;
  color: var(--sk-text-secondary, #888);
  font-size: var(--font-size-sm, 13px);
}
.sig-find-message {
  padding: 12px 16px;
  color: var(--sk-text-secondary, #888);
  font-size: var(--font-size-sm, 13px);
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-md, 8px);
  background: var(--sk-bg-subtle, #faf8f5);
}
.sig-find-consent-block {
  padding: 14px 16px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-md, 8px);
  background: var(--sk-bg-subtle, #faf8f5);
}
.sig-find-consent-text {
  margin: 0 0 10px;
  font-size: var(--font-size-sm, 13px);
  color: var(--sk-text-secondary, #666);
  line-height: 1.45;
}
.sig-find-consent-actions {
  display: flex;
  gap: 8px;
}
.sig-find-consent-accept {
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-md, 8px);
  background: var(--bb-sage-dark, #3D6B57);
  color: #fff;
  font-size: var(--font-size-sm, 13px);
  cursor: pointer;
  transition: opacity 120ms ease;
}
.sig-find-consent-accept:hover { opacity: 0.85; }
.sig-find-consent-decline {
  padding: 6px 14px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-md, 8px);
  background: transparent;
  color: var(--sk-text-secondary, #666);
  font-size: var(--font-size-sm, 13px);
  cursor: pointer;
  transition: background 120ms ease;
}
.sig-find-consent-decline:hover { background: rgba(0, 0, 0, 0.04); }
.sig-find-candidates {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(154, 142, 130, 0.25) transparent;
}
.sig-find-candidate {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 10px;
  border: 1px solid rgba(154, 142, 130, 0.22);
  border-radius: 12px;
  padding: 12px 14px;
  background: #FBF8F2;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  outline: none;
  cursor: pointer;
}
.sig-find-candidate:hover {
  border-color: rgba(110, 138, 126, 0.4);
  background: rgba(110, 138, 126, 0.04);
}
.sig-find-candidate:focus-visible {
  border-color: var(--bb-sage, #6b9d8a);
  box-shadow: 0 0 0 2px rgba(110, 138, 126, 0.2);
}
.sig-find-candidate[aria-selected="true"] {
  border-color: var(--bb-sage, #6b9d8a);
  box-shadow: 0 0 0 1px var(--bb-sage, #6b9d8a);
}
.sig-find-candidate-preview {
  grid-column: 1;
  font-size: var(--font-size-sm, 13px);
  line-height: 1.5;
  color: var(--sk-text);
  max-height: 100px;
  overflow: hidden;
  white-space: normal;
  word-break: break-word;
}
.sig-find-candidate-hint {
  grid-column: 1;
  font-size: var(--font-size-xs);
  color: var(--sk-text-tertiary, #A09080);
  font-style: italic;
  padding: 2px 0 0;
}

.sig-find-candidate-meta {
  grid-column: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sig-find-candidate-count {
  font-size: var(--font-size-xs);
  color: var(--sk-text-secondary, #888);
}
.sig-find-use-btn {
  grid-column: 2;
  grid-row: 1 / -1;
  align-self: center;
  padding: 0 14px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: #6E8A7E;
  color: #fff;
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms ease;
}
.sig-find-use-btn:hover {
  background: #5A7A6E;
}
.sig-find-banner {
  order: 2;
  margin: 0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 0;
  background: var(--bb-sage-light, #e8f0ec);
  font-size: var(--font-size-sm, 13px);
  color: var(--bb-sage-dark, #3D6B57);
}
.sig-find-banner[hidden] { display: none; }
.sig-find-banner--caution {
  background: rgba(212, 168, 154, 0.12);
  color: #8B5E3C;
}
.sig-find-banner-text { flex: 1; }
.sig-find-undo-btn {
  padding: 3px 10px;
  border: 0.5px solid var(--bb-sage, #6b9d8a);
  border-radius: 6px;
  background: transparent;
  color: var(--bb-sage-dark, #3D6B57);
  font-size: var(--font-size-xs);
  cursor: pointer;
  transition: background 120ms ease;
}
.sig-find-undo-btn:hover { background: rgba(0, 0, 0, 0.04); }

/* Candidate preview rebuilt link rows */
.calm-sig-link {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 1px 0;
  line-height: 1.5;
}
.calm-sig-link-idx {
  flex: 0 0 auto;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: rgba(92, 77, 67, 0.45);
  min-width: 18px;
  text-align: right;
}
.calm-sig-link-url {
  flex: 1 1 auto;
  font-size: var(--font-size-sm);
  color: #3D6B57;
  word-break: break-all;
}

@media (prefers-reduced-motion: reduce) {
  .sig-card,
  .sig-card *,
  .sig-find-candidate,
  .sig-find-use-btn,
  .sig-find-banner,
  .sig-find-undo-btn,
  .sig-editor-area {
    transition: none !important;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Recipient preview */
.sig-recipient-preview {
  margin-top: 16px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-lg, 12px);
  overflow: hidden;
  background: var(--sk-bg-subtle, #faf8f5);
}
.sig-recipient-preview-heading {
  font-size: var(--font-size-xs, 12px);
  letter-spacing: 0.3px;
  font-weight: var(--font-weight-semibold, 600);
  color: var(--sk-text-tertiary, #999);
  padding: 6px 12px;
  background: var(--sk-bg-subtle, #faf8f5);
  border-bottom: 0.5px solid var(--sk-border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.sig-recipient-preview-heading::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full, 50%);
  background: var(--bb-sage, #6b9d8a);
  opacity: 0.6;
}
.sig-recipient-preview-body {
  padding: 14px 16px;
  font-size: var(--font-size-md, 14px);
  line-height: 1.6;
  color: var(--sk-text, #1a1a1a);
  min-height: 40px;
}
.sig-recipient-preview-body img {
  max-width: 200px;
  max-height: 80px;
  border-radius: var(--radius-sm, 4px);
}
.sig-recipient-preview-body a {
  color: var(--sk-text);
  text-decoration: underline;
  text-decoration-color: rgba(0, 0, 0, 0.15);
}
.sig-recipient-preview-body .sig-token-resolved {
  font-weight: 500;
  color: var(--bb-sage-dark, #3d6b57);
}

.sig-preview-wrap {
  margin-top: 12px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--sk-bg-subtle);
}

.sig-preview-iframe {
  width: 100%;
  border: none;
  min-height: 60px;
  max-height: 150px;
  background: var(--sk-bg-surface);
}

.sig-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 18px;
  border: none;
  border-radius: 20px;
  background: var(--bb-sage, #6b9d8a);
  color: #fff;
  font-size: var(--font-size-sm, 13px);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.sig-save-btn:hover { background: var(--bb-sage-dark, #4a7a68); }
.sig-save-btn:active { opacity: 0.85; }
.sig-save-btn:focus-visible {
  outline: 2px solid var(--bb-sage, #6b9d8a);
  outline-offset: 2px;
  background: var(--bb-sage-dark, #4a7a68);
}
.sig-save-btn .sig-save-icon { display: none; }
.sig-save-btn.is-saving { opacity: 0.7; pointer-events: none; }
.sig-save-btn.is-saved .sig-save-icon { display: inline-flex; }
.sig-save-btn svg { width: 14px; height: 14px; }

.sig-reset-btn {
  padding: 7px 14px;
  border: 1px solid var(--sk-border, #e0d8cf);
  border-radius: 20px;
  background: transparent;
  color: var(--sk-text-secondary, #666);
  font-size: var(--font-size-sm, 13px);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.sig-reset-btn:hover {
  background: var(--sk-bg-secondary, #f5f2ef);
  border-color: var(--sk-border-medium, #c5bdb4);
}
.sig-reset-btn:focus-visible {
  outline: 2px solid var(--bb-sage, #6b9d8a);
  outline-offset: 2px;
}

/* Inline reset confirmation */
.sig-reset-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--sk-warning-bg, rgba(217, 119, 6, 0.06));
  color: var(--sk-text, #333);
  font-size: var(--font-size-sm, 13px);
  border: 1px solid var(--sk-warning-border, rgba(217, 119, 6, 0.18));
  animation: sig-error-appear 200ms ease-out;
}
.sig-reset-confirm[hidden] { display: none; }
.sig-reset-confirm-text {
  flex: 1;
  font-weight: 500;
}
.sig-reset-confirm-yes {
  flex-shrink: 0;
  padding: 4px 12px;
  border: 1px solid var(--sk-warning-border, rgba(217, 119, 6, 0.25));
  border-radius: 14px;
  background: transparent;
  color: var(--sk-warning-text, #92400e);
  font-size: var(--font-size-xs, 12px);
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms;
}
.sig-reset-confirm-yes:hover {
  background: rgba(217, 119, 6, 0.1);
}
.sig-reset-confirm-cancel {
  flex-shrink: 0;
  padding: 4px 12px;
  border: 1px solid var(--sk-border, #e0d8cf);
  border-radius: 14px;
  background: transparent;
  color: var(--sk-text-secondary, #666);
  font-size: var(--font-size-xs, 12px);
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms;
}
.sig-reset-confirm-cancel:hover {
  background: var(--sk-bg-secondary, #f5f2ef);
}

#email-reauth-banner {
  margin: 8px 22px;
  border-radius: 10px;
  border: 1px solid rgba(255, 171, 0, 0.35);
  background: #fff7e6;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  flex-shrink: 0;
  position: relative;
  color: #7a5400;
  font-size: var(--sk-font-sm, 13px);
}
.reauth-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 44px 10px 14px;
}
.reauth-row + .reauth-row {
  border-top: 1px solid rgba(255, 171, 0, 0.18);
}
.reauth-icon {
  flex-shrink: 0;
  color: #b97a00;
}
.reauth-text {
  flex: 1;
  min-width: 0;
}
.reauth-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 8px;
  background: #b97a00;
  color: #fff;
  font-size: var(--font-size-xs, 12px);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.reauth-btn:hover { background: #9c6700; }
.reauth-btn:focus-visible {
  outline: 2px solid #b97a00;
  outline-offset: 2px;
}
.reauth-btn[disabled] {
  opacity: 0.6;
  cursor: default;
}
.reauth-dismiss {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  border-radius: 6px;
  transition: opacity 0.15s, background 0.15s;
}
.reauth-dismiss:hover,
.reauth-dismiss:focus-visible {
  opacity: 1;
  background: rgba(0,0,0,0.06);
}
.reauth-dismiss:focus-visible {
  outline: 2px solid #b97a00;
  outline-offset: 1px;
}

@media (max-width: 600px) {
  #email-reauth-banner {
    margin: 6px 10px;
    border-radius: 8px;
  }
  .reauth-row {
    flex-wrap: nowrap;
    padding: 3px 10px;
    gap: 8px;
    min-height: 36px;
    max-height: 42px;
  }
  .reauth-row + .reauth-row {
    border-top-width: 1px;
  }
  .reauth-text {
    font-size: 0;
    line-height: 0;
    overflow: hidden;
  }
  .reauth-text::before {
    content: "Login udløbet";
    font-size: var(--sk-font-sm, 13px);
    line-height: 1.2;
    font-weight: 600;
  }
  .reauth-row[data-provider="imap"] .reauth-text::before {
    content: "Adgangskode";
  }
  .reauth-text strong {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .email-page .reauth-btn {
    background: #8f5e00;
    font-size: 0;
    line-height: 0;
    min-width: 40px;
    min-height: 36px;
    height: 36px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
  }
  .reauth-btn::before {
    content: "Tilslut";
    font-size: var(--font-size-xs, 12px);
    line-height: 1;
    font-weight: 600;
  }
  .reauth-row[data-provider="imap"] .reauth-btn::before {
    content: "Opdater";
  }
  .email-page .reauth-btn:focus-visible {
    outline: 2px solid #8f5e00 !important;
    outline-offset: 2px !important;
  }
  .reauth-dismiss {
    display: none;
  }
}

/* offline/error banner removed — see robots/email/js/modules/ui.js (transient API blips self-recover via retry; the banner read as an ugly, inconsistent regression) */

.email-ask-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: 0.5px solid rgba(0,0,0,0.08);
  border-radius: var(--radius-md, 8px);
  background: rgba(0,0,0,0.025);
  color: var(--sk-text-secondary);
  font-size: var(--font-size-sm, 13px);
  font-weight: var(--font-weight-semibold, 600);
  font-family: var(--font-family);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 120ms ease;
}
.email-ask-ai-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.15);
  color: var(--sk-text);
}
.email-ask-ai-btn:active {
  transform: scale(0.97);
}
.email-ask-ai-btn svg {
  color: var(--sk-text-tertiary);
  flex-shrink: 0;
}


.email-advanced-search-form {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--sk-bg-surface);
  border: 0.5px solid var(--sk-border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: 0 8px 28px rgba(31, 31, 30, 0.15);
  z-index: 1020;
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: advSearchSlideIn 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes advSearchSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.email-adv-search-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.email-adv-search-row label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.email-adv-search-row input[type="text"],
.email-adv-search-row input[type="date"] {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-sm);
  background: var(--sk-bg-subtle);
  color: var(--sk-text);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  transition: border-color 180ms;
  box-sizing: border-box;
}

.email-adv-search-row input:focus-visible {
  outline: none;
  border-color: var(--sk-border);
  box-shadow: none;
}

.email-adv-search-checks {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 2px 0;
}

.email-adv-search-checks label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--sk-text-secondary);
  cursor: pointer;
  padding: 5px 10px;
  border-radius: var(--radius-xl);
  background: var(--sk-bg-subtle);
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  transition: background 180ms, border-color 180ms, color 180ms;
  user-select: none;
}

.email-adv-search-checks label:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
  color: var(--sk-text);
}

.email-adv-search-checks label:has(input:checked) {
  background: rgba(0, 0, 0, 0.07);
  border-color: rgba(0, 0, 0, 0.15);
  color: var(--sk-text);
  font-weight: var(--font-weight-semibold);
}

.email-adv-search-checks input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--email-control-fill);
  margin: 0;
  border-radius: var(--radius-sm);
}

.email-adv-search-dates {
  flex-direction: row;
  gap: 8px;
}

.email-adv-search-dates > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.email-adv-search-btn {
  width: 100%;
  height: 34px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--sk-text);
  color: var(--email-control-on-fill);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-family);
  cursor: pointer;
  transition: background 180ms;
  margin-top: 2px;
}

.email-adv-search-btn:hover {
  background: var(--color-card);
}

/* ── Vector search overlay ── */
.email-vector-overlay {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 120;
  margin-top: 4px;
  background: var(--sk-bg-surface, #FFFEFB);
  border: 0.5px solid var(--sk-border, rgba(0,0,0,0.08));
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.12);
  overflow: hidden;
  max-height: 420px;
  overflow-y: auto;
}
.email-vector-overlay__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--sk-border, rgba(0,0,0,0.06));
}
.email-vector-overlay__title {
  font-size: var(--font-size-xs, 12px);
  font-weight: var(--font-weight-bold, 600);
  color: var(--sk-text-secondary, #566170);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.email-vector-overlay__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  color: var(--sk-text-tertiary, rgba(0,0,0,0.35));
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.email-vector-overlay__close:hover {
  background: rgba(0,0,0,0.06);
  color: var(--sk-text);
}
.email-vector-overlay__empty {
  padding: 24px 16px;
  text-align: center;
  font-size: var(--font-size-base, 14px);
  color: var(--sk-text-secondary, #566170);
  line-height: 1.5;
}
.email-vector-overlay__list {
  padding: 4px 0;
}
.email-vector-overlay__item {
  padding: 10px 14px;
  cursor: pointer;
  transition: background 120ms;
  border-bottom: 0.5px solid rgba(0,0,0,0.04);
}
.email-vector-overlay__item:last-child {
  border-bottom: none;
}
.email-vector-overlay__item:hover,
.email-vector-overlay__item:focus-visible {
  background: var(--email-soft-highlight, rgba(0,0,0,0.03));
  outline: none;
}
.email-vector-overlay__sender {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
.email-vector-overlay__sender-name {
  font-size: var(--font-size-base, 14px);
  font-weight: var(--font-weight-semibold, 600);
  color: var(--sk-text, #2f2934);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.email-vector-overlay__date {
  font-size: var(--font-size-xs, 12px);
  color: var(--sk-text-tertiary, rgba(0,0,0,0.35));
  white-space: nowrap;
  flex-shrink: 0;
}
.email-vector-overlay__subject {
  font-size: var(--font-size-base, 14px);
  font-weight: var(--font-weight-semibold, 600);
  color: var(--sk-text, #2f2934);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.email-vector-overlay__snippet {
  font-size: var(--font-size-sm, 13px);
  color: var(--sk-text-secondary, #566170);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.email-recent-searches {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--sk-bg-surface);
  border: 0.5px solid var(--sk-border);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: 0 4px 12px var(--sk-shadow);
  z-index: 1010;
  max-height: 280px;
  overflow-y: auto;
}

.email-search-section-label {
  padding: 6px 12px 4px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--sk-text-secondary);
  user-select: none;
}

.email-search-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: var(--font-size-base);
  color: var(--sk-text);
  transition: background 120ms;
}

.email-search-item:hover {
  background: var(--email-soft-highlight);
}

.email-search-item--saved {
  background: rgba(0, 0, 0, 0.04);
}

.email-search-item-star {
  flex-shrink: 0;
  color: var(--color-warning);
  display: flex;
  align-items: center;
}

.email-search-item-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-search-item-remove,
.email-search-item-pin {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  color: var(--sk-text-secondary);
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms, background 120ms, color 120ms;
}

.email-search-item:hover .email-search-item-remove,
.email-search-item:hover .email-search-item-pin {
  opacity: 1;
}

.email-search-item-remove:hover {
  background: rgba(194,75,96,0.1);
  color: var(--color-danger);
}

.email-search-item-pin:hover {
  background: rgba(232,167,51,0.12);
  color: var(--color-warning);
}

.email-search-item-pin--active {
  color: var(--color-warning);
  opacity: 0.6;
  cursor: default;
}

.email-save-search-prompt {
  padding: 10px 12px;
}

.email-save-search-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
}

.email-save-search-name {
  flex: 1;
  height: 30px;
  padding: 0 8px;
  font-size: var(--font-size-base);
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-sm);
  background: var(--sk-bg);
  color: var(--sk-text);
  outline: none;
  transition: border-color 180ms;
}

.email-save-search-name:focus-visible {
  outline: none;
  border-color: var(--sk-border);
  box-shadow: none;
}

.email-save-search-confirm {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--sk-text);
  color: var(--email-control-on-fill);
  cursor: pointer;
  transition: background 180ms;
}

.email-save-search-confirm:hover {
  background: var(--color-card);
}

.email-save-search-query {
  margin-top: 4px;
  font-size: var(--font-size-xs);
  color: var(--sk-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-toolbar-btn#email-notif-toggle.active {
  color: var(--sk-text);
}

.email-toolbar-btn#email-notif-toggle.active svg {
  fill: rgba(0, 0, 0, 0.10);
}

.email-settings-modal {
  position: fixed;
  inset: 0;
  z-index: 1002;
  display: flex;
  align-items: center;
  justify-content: center;
}

.email-settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.email-settings-dialog {
  position: relative;
  width: min(960px, 96vw);
  max-width: calc(100vw - 32px);
  max-height: min(820px, 92vh);
  max-height: min(820px, 92dvh);
  min-height: 0;
  background: var(--sk-bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.email-settings-dialog:has(.sig-link-overlay) {
  min-height: min(520px, calc(100vh - 64px));
  min-height: min(520px, calc(100dvh - 64px));
  overflow: hidden;
}

.email-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 0.5px solid var(--sk-border);
  background: var(--sk-bg-secondary);
  flex: 0 0 auto;
}

.email-settings-header h3 {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text);
  margin: 0;
}

.email-settings-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sk-text-secondary);
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}

.email-settings-close:hover {
  background: rgba(194,75,96,0.08);
  color: var(--sk-danger);
}

.email-settings-content {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.email-settings-tabs {
  display: flex;
  flex-direction: column;
  width: 180px;
  flex-shrink: 0;
  align-self: stretch;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 8px;
  border-right: 0.5px solid rgba(0, 0, 0, 0.08);
  background: var(--sk-bg-subtle);
  gap: 2px;
}

.email-settings-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sk-text-secondary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family);
  cursor: pointer;
  transition: background 120ms, color 120ms;
  text-align: left;
}

.email-settings-tab:hover {
  background: rgba(0,0,0,0.04);
  color: var(--sk-text);
}

.email-settings-tab.active {
  background: rgba(0, 0, 0, 0.07);
  color: var(--sk-text);
  font-weight: var(--font-weight-semibold);
}

.email-settings-tab:focus-visible {
  outline: none;
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.email-settings-tab svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.email-settings-tab.active svg {
  stroke: currentColor;
}

.email-settings-logout-wrap {
  margin-top: auto;
  padding-top: 8px;
}

.email-settings-logout-divider {
  height: 1px;
  margin: 0 12px 8px;
  background: rgba(228, 220, 212, 0.5);
}

.email-settings-logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--bb-warm-text-light, var(--sk-text-secondary, #8c7e74));
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
  text-align: left;
  border-radius: var(--radius-sm, 6px);
}

.email-settings-logout-btn:hover {
  background: rgba(194, 75, 96, 0.06);
  color: #c0392b;
}

.email-settings-logout-btn:focus-visible {
  outline: 2px solid var(--bb-sage, var(--sk-accent, #4A7A68));
  outline-offset: 2px;
}

.email-settings-logout-btn svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

@media (prefers-reduced-motion: reduce) {
  .email-settings-logout-btn {
    transition: none;
  }
}

.email-settings-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  min-width: 0;
}

.email-settings-body--general {
  background: rgb(255, 254, 251);
  border-radius: 0 0 20px 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(228, 220, 212, 0.9) transparent;
}
.email-settings-body--general::-webkit-scrollbar {
  width: 8px;
}
.email-settings-body--general::-webkit-scrollbar-track {
  background: transparent;
}
.email-settings-body--general::-webkit-scrollbar-thumb {
  background: rgba(214, 204, 194, 0.8);
  border-radius: 8px;
}
.email-settings-body--general::-webkit-scrollbar-thumb:hover {
  background: rgba(196, 184, 172, 0.9);
}

.email-settings-section {
  max-width: 560px;
}

.email-settings-section--general {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  width: 100%;
}

.email-settings-section--rule-edit {
  max-width: none;
  width: 100%;
}

.email-settings-section--sig {
  max-width: none;
}

.email-settings-section--vacation {
  max-width: none;
  width: 100%;
}

/* ── Genveje (keyboard shortcuts reference) tab ── */
.email-settings-section--shortcuts {
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.email-shortcuts-intro {
  margin: 0;
  font-size: var(--font-size-sm);
  line-height: 1.5;
  color: var(--sk-text-secondary);
}

.email-shortcuts-group {
  background: var(--sk-bg-subtle);
  border: 0.5px solid var(--sk-border);
  border-radius: 14px;
  padding: 14px 16px 16px;
}

.email-shortcuts-group-heading {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 10px;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-accent);
}

.email-shortcuts-group-icon {
  display: inline-flex;
  align-items: center;
  color: var(--sk-accent);
}

.email-shortcuts-rows {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0 20px;
}

.email-shortcut-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
}

.email-shortcut-keys {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  min-width: 88px;
}

.email-shortcut-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 23px;
  padding: 0 6px;
  background: var(--sk-bg-surface);
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text);
}

.email-shortcut-sep {
  color: var(--sk-text-tertiary, var(--sk-text-secondary));
  font-size: var(--font-size-xs);
}

.email-shortcut-label {
  font-size: var(--font-size-sm);
  line-height: 1.3;
  color: var(--sk-text);
}

@media (max-width: 767px) {
  .email-shortcuts-rows {
    grid-template-columns: 1fr;
  }
  .email-shortcut-keys {
    min-width: 78px;
  }
}

.email-settings-empty {
  color: var(--sk-text-secondary);
  font-size: var(--font-size-base);
  padding: 16px 0;
  margin: 0;
}

.email-settings-section-heading {
  margin: 0 0 8px;
  font-size: var(--font-size-md);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--sk-text, #2c2c2c);
  line-height: 1.4;
}

.email-settings-section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.email-settings-section-header-row .email-settings-section-heading {
  margin-bottom: 0;
}

.email-settings-add-rule-btn--inline {
  width: auto;
  padding: 6px 14px;
}

.email-settings-divider {
  border: none;
  border-top: 1px solid rgba(228, 220, 212, 0.7);
  margin: 22px 0;
}

.email-settings-placeholder {
  color: var(--sk-text-tertiary);
  font-size: var(--font-size-sm);
}

.email-settings-form-field {
  margin-bottom: 16px;
}

.email-settings-section--general .email-settings-form-field {
  background: transparent;
  border: none;
  border-radius: 0;
  margin: 0;
  padding: 0;
  border-top: 1px solid rgba(228, 220, 212, 0.55);
}

.email-settings-section--general .email-settings-form-field:first-child {
  border-top: none;
}

.email-settings-form-field > label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text);
  margin-bottom: 6px;
}

.email-settings-form-field input[type="text"],
.email-settings-form-field input[type="date"],
.email-settings-form-field select,
.email-settings-form-field textarea {
  width: 100%;
  padding: 8px 12px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--sk-text);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  transition: border-color 180ms ease, box-shadow 180ms ease;
  box-sizing: border-box;
}

.email-settings-form-field input:focus-visible,
.email-settings-form-field select:focus-visible,
.email-settings-form-field textarea:focus-visible {
  outline: none;
  border-color: var(--sk-border);
  box-shadow: none;
}

.email-settings-form-field textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

/* Selve Konto-kontrollens styling ejes af email-blod-bolge.css' settings-modal-
   !important-lag (formular-select-reglen + chevron-overlayet dér) — regler her
   taber til det lag. Kun popup-listen styles her:
   the native option popup inherits the control's text color; without an explicit
   surface the dark theme paints cream text on the OS' white popup. Dialog-wide so
   every settings select (Signatur, Generelt, filtre) gets a readable menu.
   Warm literal — the modal scope re-points --sk-text at the cool slate global. */
.email-settings-dialog select option {
  background-color: var(--color-card, #fff);
  color: #2B241E;
}

.email-settings-toggle-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.email-settings-toggle-label input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.email-settings-toggle-track {
  display: inline-block;
  width: 36px;
  height: 20px;
  background: rgba(0,0,0,0.15);
  border-radius: var(--radius-pill);
  position: relative;
  transition: background 180ms ease;
}

.email-settings-toggle-track::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  background: var(--sk-bg-surface);
  top: 2px;
  left: 2px;
  transition: transform 180ms ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.email-settings-toggle-label input:checked + .email-settings-toggle-track {
  background: var(--sk-text);
}

.email-settings-toggle-label input:checked + .email-settings-toggle-track::after {
  transform: translateX(16px);
}

.email-settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: var(--font-size-base);
  color: var(--sk-text);
  font-weight: var(--font-weight-medium);
}

.email-settings-section--general .email-settings-toggle-row {
  gap: 16px;
  min-height: 56px;
  padding: 0;
}

.email-settings-section--general .email-settings-toggle-row > span {
  font-size: var(--email-fs-meta);
  font-weight: 500;
  color: rgb(58, 47, 38);
}

.email-settings-section--general .email-settings-toggle-row select {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  box-shadow: none;
  padding: 6px 10px;
  height: 34px;
  color: rgb(58, 47, 38);
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-align: right;
  text-align-last: right;
  transition: background 180ms ease, border-color 180ms ease;
}

.email-settings-section--general .email-settings-toggle-row select:hover {
  background: rgba(92, 77, 67, 0.04);
}

.email-settings-section--general .email-settings-toggle-row select:focus {
  background: rgba(92, 77, 67, 0.05);
  border: 1px solid rgba(228, 220, 212, 0.9);
  outline: none;
}

.email-settings-toggle-hint {
  font-size: var(--font-size-sm);
  color: var(--sk-text-muted);
  margin-left: 8px;
  flex-shrink: 0;
}

.email-settings-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.email-settings-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-base);
  color: var(--sk-text);
  cursor: pointer;
}

.email-settings-checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--email-control-fill);
}

.email-settings-form-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.email-settings-section--general .email-settings-form-buttons {
  margin: 18px 0 4px;
}

.email-settings-save-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--sk-text);
  color: #fff;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-family);
  cursor: pointer;
  transition: opacity 120ms ease;
}

.email-settings-save-btn:hover {
  opacity: 0.85;
}

.email-settings-default-btn {
  height: 32px;
  padding: 0 16px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--sk-text-secondary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family);
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
}

.email-settings-default-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: var(--sk-text);
  color: var(--sk-text);
}

.email-settings-cancel-rule {
  padding: 10px 24px;
  border: 1px solid var(--sk-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--sk-text-secondary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family);
  cursor: pointer;
  transition: background 120ms;
}

.email-settings-cancel-rule:hover {
  background: rgba(0,0,0,0.04);
}

.email-settings-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  margin-bottom: 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sk-text);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family);
  cursor: pointer;
  transition: background 120ms;
}

.email-settings-back-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

.email-settings-rule-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.email-settings-rule-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-md);
  transition: border-color 120ms;
}

.email-settings-rule-item:hover {
  border-color: rgba(0,0,0,0.15);
}

.email-settings-rule-item.disabled {
  opacity: 0.5;
}

.email-settings-rule-info {
  flex: 1;
  min-width: 0;
}

.email-settings-rule-info strong {
  display: block;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text);
}

.email-settings-rule-desc {
  display: block;
  font-size: var(--font-size-sm);
  color: var(--sk-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-settings-rule-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.email-settings-rule-edit,
.email-settings-rule-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sk-text-muted);
  cursor: pointer;
  transition: background 120ms, color 120ms;
}

.email-settings-rule-edit:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--sk-text);
}

.email-settings-rule-delete:hover {
  background: rgba(194,75,96,0.08);
  color: var(--sk-danger);
}

.email-settings-add-rule-btn {
  display: block;
  width: 100%;
  padding: 10px;
  border: 1px dashed rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--sk-text);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family);
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
  text-align: center;
}

.email-settings-add-rule-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: var(--sk-text);
}

.email-settings-rule-form {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}

.email-settings-rule-form .email-settings-form-field {
  margin: 0 0 20px;
}

.email-settings-rule-form .email-settings-rule-name:focus-visible {
  outline: none;
  border-color: rgb(74, 122, 104);
  box-shadow: 0 0 0 3px rgba(74, 122, 104, 0.15);
}

.email-settings-cond-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 32px;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.email-settings-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr 32px;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.email-settings-cond-row select,
.email-settings-action-row select {
  width: 100%;
  min-width: 0;
  height: 41px;
  padding: 6px 38px 6px 8px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
  color: var(--sk-text);
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18' fill='none'%3E%3Cpath d='M4.5 6.75L9 11.25L13.5 6.75' stroke='%23767A86' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px 18px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  box-sizing: border-box;
}

.email-settings-cond-row select::-ms-expand,
.email-settings-action-row select::-ms-expand {
  display: none;
}

.email-settings-cond-row select:focus-visible,
.email-settings-action-row select:focus-visible {
  outline: none;
  border-color: rgb(74, 122, 104);
  box-shadow: 0 0 0 3px rgba(74, 122, 104, 0.15);
}

.email-settings-cond-val-wrap {
  min-width: 0;
  position: relative;
}

.email-settings-cond-val-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.email-settings-cond-val {
  width: 100%;
  min-width: 0;
  height: 41px;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
  color: var(--sk-text);
}

.email-settings-cond-val:focus-visible {
  outline: none;
  border-color: rgb(74, 122, 104);
  box-shadow: 0 0 0 3px rgba(74, 122, 104, 0.15);
}

.email-settings-cond-remove,
.email-settings-action-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgb(118, 122, 134);
  font-size: var(--email-fs-heading-sm);
  cursor: pointer;
  grid-column: -2;
  transition: color 120ms, background 120ms;
}

.email-settings-cond-remove:hover,
.email-settings-action-remove:hover {
  background: rgba(192, 57, 43, 0.08);
  color: rgb(192, 57, 43);
}

.email-settings-add-cond,
.email-settings-add-action {
  display: inline-block;
  padding: 6px 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgb(74, 122, 104);
  font-size: var(--font-size-sm);
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  margin-top: 2px;
  transition: background 120ms;
}

.email-settings-add-cond:hover,
.email-settings-add-action:hover {
  background: rgba(74, 122, 104, 0.08);
}

@media (max-width: 460px) {
  .email-settings-cond-row {
    grid-template-columns: 1fr;
  }
  .email-settings-action-row {
    grid-template-columns: 1fr;
  }
  .email-settings-cond-remove,
  .email-settings-action-remove {
    grid-column: auto;
    justify-self: start;
  }
}

.sig-preview-content {
  padding: 14px 16px;
  font-size: var(--font-size-md);
  line-height: 1.6;
  color: var(--sk-text);
  background: var(--sk-bg-surface);
  min-height: 48px;
  border-left: 3px solid var(--sk-text);
  margin: 8px 12px 12px;
  border-radius: var(--radius-sm);
}

.sig-preview-content img {
  max-width: 200px;
  max-height: 80px;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.sig-preview-content a {
  color: var(--sk-text);
  text-decoration: underline;
  text-decoration-color: rgba(0, 0, 0, 0.15);
}

.sig-preview-content hr {
  border: none;
  border-top: 0.5px solid var(--sk-border);
  margin: 8px 0;
}

.sig-html-paste-dialog {
  width: 420px;
}

.sig-html-paste-dialog textarea {
  width: 100%;
  min-height: 220px;
  padding: 10px 12px;
  font-family: 'Courier New', monospace;
  font-size: var(--font-size-sm);
  line-height: 1.5;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-md);
  background: var(--sk-bg-subtle);
  color: var(--sk-text);
  resize: vertical;
}

.sig-html-paste-dialog textarea:focus {
  outline: none;
  outline-offset: -1px;
  border-color: transparent;
}

.email-vacation-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--sk-warning-bg);
  border-bottom: 0.5px solid var(--sk-warning);
  color: var(--sk-warning-text);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  flex-shrink: 0;
}

.email-vacation-banner-icon {
  flex-shrink: 0;
}

.email-vacation-banner span {
  flex: 1;
}

.email-vacation-banner-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sk-warning-text);
  font-size: var(--font-size-xl);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 120ms;
}

.email-vacation-banner-close:hover {
  background: rgba(95,75,15,0.1);
}

@media (max-width: 600px) {
  .email-settings-dialog {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .email-settings-content {
    flex-direction: column;
  }

  .email-settings-tabs {
    flex-direction: row;
    width: 100%;
    border-right: none;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
    padding: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .email-settings-tabs::-webkit-scrollbar {
    display: none;
  }

  .email-settings-tab {
    white-space: nowrap;
    padding: 6px 10px;
  }

  .email-settings-tab span {
    display: inline; font-size: var(--font-size-xs);
  }

  .email-settings-logout-wrap {
    margin-top: 0;
    padding-top: 0;
  }

  .email-settings-logout-divider {
    display: none;
  }

  .email-settings-logout-btn {
    white-space: nowrap;
    padding: 6px 10px;
    font-size: var(--font-size-xs);
  }

  .email-settings-body {
    padding: 16px;
  }
}

.email-contacts-modal {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
}

.email-contacts-modal .email-contacts-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.email-contacts-modal .email-contacts-dialog {
  position: relative;
  width: 480px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  max-height: calc(100dvh - 64px);
  background: var(--sk-bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.email-contacts-modal .email-contacts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 0.5px solid var(--sk-border);
  flex-shrink: 0;
}

.email-contacts-modal .email-contacts-header h3 {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text);
  margin: 0;
}

.email-contacts-list-items {
  display: flex;
  flex-direction: column;
}

.email-contact-row:hover {
  background: rgba(0, 0, 0, 0.04);
}

.email-contact-row:last-child {
  border-bottom: none;
}

.email-contact-action:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.15);
}

.email-contact-action.danger:hover {
  background: rgba(194,75,96,0.06);
  border-color: rgba(194,75,96,0.3);
}

.email-contact-notes {
  width: 100%;
  min-height: 68px;
  max-height: 160px;
  padding: 10px 12px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-md);
  background: var(--sk-bg-subtle);
  color: var(--sk-text);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  line-height: 1.5;
  resize: vertical;
  box-sizing: border-box;
  transition: border-color 180ms, background 180ms, box-shadow 180ms;
}

.email-contact-notes:focus-visible {
  outline: none;
  border-color: var(--sk-border);
  box-shadow: none;
}

.email-contact-notes::placeholder {
  color: var(--sk-text-tertiary);
}

.email-contact-notes-icon {
  flex-shrink: 0;
  color: var(--sk-text-tertiary);
  opacity: 0.7;
}

.email-reminder-wrapper {
  display: inline-block;
}

.email-reminder-dropdown {
  animation: imap-fade-in 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.email-accounts-dialog {
  background: var(--color-card);
}

.email-accounts-body {
  padding: 24px 24px 20px;
}

.imap-provider-option {
  padding: 24px 12px;
  background: var(--sk-bg);
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-xl);
  gap: 10px;
  min-width: 0;
}

.imap-provider-option svg {
  width: 36px;
  height: 36px;
}

.imap-provider-name {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
}

.imap-provider-desc {
  font-size: var(--font-size-sm);
  opacity: 0.65;
}

.imap-provider-option:hover {
  border-color: var(--sk-text);
  background: rgba(0, 0, 0, 0.04);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.email-accounts-header h3 {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
}

.imap-wizard-field input,
.imap-wizard-field select {
  height: 42px;
  border-radius: var(--radius-lg, 12px);
  background: var(--sk-bg);
  font-size: var(--font-size-md, 16px);
}

.imap-wizard-field input:focus-visible,
.imap-wizard-field select:focus-visible {
  background: var(--sk-bg-surface);
}

.imap-wizard-field label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.imap-wizard-field {
  margin-bottom: 16px;
}

.imap-wizard-step {
  background: rgba(0, 0, 0, 0.07);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text);
}

.imap-wizard-next {
  min-height: 46px;
  font-size: var(--font-size-base);
  border-radius: var(--radius-lg);
  margin-top: 12px;
}

.imap-field-hint {
  background: rgba(34, 197, 94, 0.06);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  margin-top: 12px;
  font-size: var(--font-size-sm);
}

.imap-wizard-back {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--sk-bg);
}

.imap-wizard-back:hover {
  background: rgba(0, 0, 0, 0.07);
}

.email-accounts-modal .btn-primary,
.email-accounts-modal .btn.btn-primary {
  background: var(--sk-text);
  border-color: var(--sk-text);
  color: var(--email-control-on-fill);
}
.email-accounts-modal .btn-primary:hover,
.email-accounts-modal .btn.btn-primary:hover {
  opacity: 0.85;
}

.imap-wizard-step {
  background: var(--sk-bg-active);
  color: var(--sk-text);
}

.email-labels-section {
  padding: 12px 12px 4px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-top: 0.5px solid rgba(0, 0, 0, 0.08);
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.email-labels-section-title {
  pointer-events: none;
}

.email-folder-item .email-label-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.email-labels-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  color: rgb(122,110,98);
  cursor: pointer;
  border-radius: 8px;
  flex-shrink: 0;
  margin: -8px 0;
  position: relative;
}

.email-labels-add-btn::before {
  content: '';
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
  background: transparent;
  transition: background 120ms ease, box-shadow 120ms ease;
}

.email-labels-add-btn:hover::before {
  background: rgba(58,47,38,0.07);
}

.email-labels-add-btn:focus-visible {
  outline: none;
}

.email-labels-add-btn:focus-visible::before {
  background: rgba(110,138,126,0.14);
  box-shadow: 0 0 0 2px rgba(110,138,126,0.35);
}

.email-labels-add-btn svg {
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.email-label-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  margin: 6px 4px 4px;
  background: rgb(255,254,251);
  border: 1px solid rgba(228,220,212,0.7);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(58,47,38,0.04);
}

.email-label-form-row {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

.email-label-form input[type="text"] {
  flex: 1;
  height: 34px;
  padding: 0 10px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  border: 1px solid rgb(228,220,212);
  border-radius: 8px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  font-family: inherit;
  background: rgb(255,254,251);
  color: rgb(92,77,67);
  outline: none;
  box-shadow: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.email-label-form input[type="text"]:hover {
  border-color: rgb(196,186,176);
}

.email-label-form input[type="text"]:focus,
.email-label-form input[type="text"]:focus-visible {
  outline: none;
  border-color: rgb(196,186,176);
  box-shadow: none;
}

.email-label-form input[type="text"]::placeholder {
  color: rgb(168,158,148);
  font-weight: 400;
}

.email-label-swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 12px 0;
  padding: 0;
  place-items: center;
  justify-items: center;
}

.email-label-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  padding: 0;
  background: none;
  position: relative;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(58,47,38,0.12);
  transition: transform .12s ease, box-shadow .12s ease;
}

.email-page .email-label-swatch {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  max-width: 20px;
  max-height: 20px;
}

.email-label-swatch:hover {
  transform: scale(1.12);
  box-shadow: inset 0 0 0 1px rgba(58,47,38,0.12), 0 2px 6px rgba(58,47,38,0.18);
}

.email-label-swatch:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(58,47,38,0.12), 0 0 0 3px rgba(110,138,126,0.30);
}

.email-label-swatch.selected {
  box-shadow: inset 0 0 0 2px rgb(255,254,251), 0 0 0 2px rgba(58,47,38,0.55);
}

.email-label-swatch.selected::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 5.2L4.2 7.5 8 3' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  filter: drop-shadow(0 0 1px rgba(0,0,0,0.35));
  pointer-events: none;
}

.email-label-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
  margin-top: 2px;
}

.email-label-form-actions button {
  height: 34px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
  font-family: inherit;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease, color 150ms ease;
  border: none;
  box-shadow: none;
  flex: 1 1 0;
}

.email-page .email-label-form-actions button {
  min-height: 34px;
  max-height: 34px;
}

.email-label-form-actions .email-label-create-btn {
  background: rgb(74,122,104);
  color: rgb(255,254,251);
  border: none;
}

.email-label-form-actions .email-label-create-btn:hover {
  background: rgb(64,108,91);
}

.email-label-form-actions .email-label-create-btn:active {
  background: rgb(54,94,78);
}

.email-label-form-actions .email-label-create-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(110,138,126,0.30);
}

.email-label-form-actions .email-label-create-btn:disabled {
  background: #D8D2C4;
  border-color: #D8D2C4;
  color: rgb(255,254,251);
  cursor: not-allowed;
  opacity: 1;
}

.email-label-form-actions .email-label-cancel-btn {
  background: transparent;
  color: rgb(107,94,85);
  border: 1px solid rgb(228,220,212);
}

.email-label-form-actions .email-label-cancel-btn:hover {
  background: rgba(58,47,38,0.05);
  border-color: rgb(196,186,176);
  color: rgb(92,77,67);
}

.email-label-cancel-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(110,138,126,0.22);
}

@media (prefers-reduced-motion: reduce) {
  .email-label-swatch {
    transition: none;
  }
  .email-label-swatch:hover {
    transform: none;
  }
  .email-labels-add-btn::before {
    transition: none;
  }
}

.calm-ctx-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
}

.calm-ctx-menu {
  position: fixed;
  min-width: 244px;
  background: #FFFEFB;
  border: 1px solid rgba(154, 142, 130, 0.22);
  border-radius: 14px;
  padding: 6px;
  box-shadow:
    0 4px 16px rgba(58, 47, 38, 0.10),
    0 1px 3px rgba(58, 47, 38, 0.06);
  z-index: 9999;
  font-family: var(--font-family);
  animation: calm-ctx-in 120ms ease-out;
}

@keyframes calm-ctx-in {
  from { opacity: 0; transform: scale(0.96) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .calm-ctx-menu { animation: none; }
  .calm-ctx-item { transition: none; }
}

.calm-ctx-header {
  padding: 8px 12px 4px;
  font-size: var(--font-size-sm);
  font-weight: 400;
  color: #6B5E53;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calm-ctx-header strong {
  font-weight: 600;
  color: #3A2F26;
}

.calm-ctx-hcount {
  font-weight: 400;
  color: #9A8E82;
}

.calm-ctx-divider {
  height: 1px;
  background: rgba(154, 142, 130, 0.16);
  margin: 4px 8px;
}

.calm-ctx-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: #3A2F26;
  font-size: var(--font-size-sm);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border-radius: 10px;
  transition: background 100ms ease;
  text-align: left;
  line-height: 1;
  outline: none;
}

.calm-ctx-item:hover,
.calm-ctx-item:focus-visible {
  background: rgba(110, 138, 126, 0.10);
}

.calm-ctx-item.calm-ctx-disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.calm-ctx-item.calm-ctx-danger {
  color: #A6594B;
}

.calm-ctx-item.calm-ctx-danger:hover,
.calm-ctx-item.calm-ctx-danger:focus-visible {
  background: rgba(166, 89, 75, 0.08);
}

.calm-ctx-ico {
  flex-shrink: 0;
  color: #6E8A7E;
  display: flex;
  align-items: center;
}

.calm-ctx-item.calm-ctx-danger .calm-ctx-ico {
  color: #A6594B;
}

.calm-ctx-ico svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.9;
}

.calm-ctx-label {
  flex: 1;
  min-width: 0;
}

.calm-ctx-shortcut {
  margin-left: auto;
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: #9A8E82;
  flex-shrink: 0;
}

.calm-ctx-inline-rename {
  width: 100%;
  border: 1px solid rgba(110, 138, 126, 0.40);
  border-radius: 6px;
  padding: 2px 6px;
  font: inherit;
  font-size: var(--font-size-sm);
  color: #3A2F26;
  background: #FFFEFB;
  outline: none;
}

.calm-ctx-inline-rename:focus {
  border-color: #6E8A7E;
  box-shadow: 0 0 0 2px rgba(110, 138, 126, 0.18);
}

@keyframes calm-ctx-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-3px); }
  40%, 80% { transform: translateX(3px); }
}

.calm-ctx-shake {
  animation: calm-ctx-shake 200ms ease-in-out;
}

@media (prefers-reduced-motion: reduce) {
  .calm-ctx-shake { animation: none; }
}

.calm-ctx-confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(58, 47, 38, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: calm-ctx-in 120ms ease-out;
}

.calm-ctx-confirm {
  background: #FFFEFB;
  border: 1px solid rgba(154, 142, 130, 0.22);
  border-radius: 16px;
  padding: 24px;
  max-width: 340px;
  width: 90vw;
  box-shadow:
    0 8px 32px rgba(58, 47, 38, 0.14),
    0 2px 6px rgba(58, 47, 38, 0.06);
  font-family: var(--font-family);
}

.calm-ctx-confirm-title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  color: #3A2F26;
  margin: 0 0 8px;
}

.calm-ctx-confirm-desc {
  font-size: var(--font-size-sm);
  font-weight: 400;
  color: #6B5E53;
  margin: 0 0 20px;
  line-height: 1.45;
}

.calm-ctx-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.calm-ctx-confirm-cancel,
.calm-ctx-confirm-danger {
  padding: 9px 18px;
  border-radius: 10px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  line-height: 1;
}

.calm-ctx-confirm-cancel {
  background: rgba(154, 142, 130, 0.12);
  color: #3A2F26;
}

.calm-ctx-confirm-cancel:hover {
  background: rgba(154, 142, 130, 0.20);
}

.calm-ctx-confirm-danger {
  background: #A6594B;
  color: #fff;
}

.calm-ctx-confirm-danger:hover {
  background: #944E42;
}

.email-label-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.email-label-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: 16px;
  white-space: nowrap;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-label-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.email-label-dropdown-wrapper {
  position: relative;
}

.email-label-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1000;
  background: var(--sk-bg-surface);
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  min-width: 180px;
  max-height: 300px;
  overflow-y: auto;
}

.email-label-dropdown-title {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 8px 6px;
}

.email-label-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 8px;
  border: none;
  background: transparent;
  font-size: var(--font-size-base);
  font-family: inherit;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 120ms;
  text-align: left;
  color: var(--sk-text);
}

.email-label-dropdown-item:hover {
  background: rgba(0,0,0,0.04);
}

.email-label-dropdown-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  accent-color: var(--email-control-fill);
}

.email-label-dropdown-item .email-label-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.email-label-dropdown-item span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-label-dropdown-empty {
  padding: 8px;
  text-align: center;
  color: var(--sk-text-muted);
  font-size: var(--font-size-sm);
}

.email-settings-snippets-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--sk-text);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family);
  cursor: pointer;
  transition: box-shadow 120ms ease;
  text-align: left;
  box-sizing: border-box;
  margin: 0;
}

.email-settings-snippets-link:hover {
  background: transparent;
  box-shadow: inset 0 0 0 100px rgba(92, 77, 67, 0.035);
}

.email-settings-snippets-link svg {
  flex-shrink: 0;
  color: var(--sk-text-secondary);
}

.email-settings-snippets-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 12px;
  background: rgba(110, 138, 126, 0.15);
  color: rgb(74, 122, 104);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
}

.email-settings-section-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: rgb(124, 109, 96);
  text-transform: none;
  letter-spacing: 0.01em;
  margin: 0 0 4px;
}

@media (prefers-reduced-motion: reduce) {
  .email-settings-section--general .email-settings-toggle-row select,
  .email-settings-snippets-link {
    transition: none;
  }
}

.snippet-category-header {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sk-text-secondary);
  padding: 8px 0 4px;
  margin-top: 4px;
}

.snippet-category-header:first-child {
  margin-top: 0;
}

.snippet-item {
  cursor: pointer;
}

.snippet-trigger-label {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.04);
  color: var(--sk-text);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  vertical-align: middle;
}

.snippet-var-tag {
  display: inline-block;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: rgba(245,158,11,0.1);
  color: var(--sk-warning-hover);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  vertical-align: middle;
}

.snippet-vars-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.email-settings-hint {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--sk-text-secondary);
  margin-top: 4px;
  line-height: 1.4;
}

.snippet-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  border: 0.5px solid var(--sk-border);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--sk-bg-secondary);
}

.snippet-editor-toolbar .sig-format-btn {
  font-size: var(--font-size-xs);
  padding: 3px 6px;
}

.snippet-editor-toolbar .snippet-var-insert-btn {
  font-size: var(--font-size-xs);
  color: var(--sk-warning-hover);
  background: rgba(245,158,11,0.08);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}

.snippet-editor-toolbar .snippet-var-insert-btn:hover {
  background: rgba(245,158,11,0.16);
}

.snippet-body-editor {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  min-height: 120px;
}

.snippet-body-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--sk-text-tertiary);
  pointer-events: none;
}

.email-skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 10000;
  padding: 8px 16px;
  background: var(--email-control-fill);
  color: var(--email-control-on-fill);
  border-radius: var(--radius-sm, 6px);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  transition: top 180ms;
}
.email-skip-link:focus-visible {
  top: 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#email-compose-attach:focus-visible,
#email-compose-discard:focus-visible {
  outline: none;
  outline-offset: 2px;
}

/* Reply All & Forward — top-level action buttons (#597) */
.email-reply-all-btn,
.email-forward-btn {
  flex-shrink: 0;
}
@media (max-width: 359px) {
  .email-reply-all-btn,
  .email-forward-btn {
    min-width: 36px !important;
    width: 36px !important;
    height: 36px !important;
  }
}

/* ── Search command palette (#3537) ─────────────────────────────── */

#ss-email-palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(40, 38, 34, 0.42);
  backdrop-filter: saturate(110%) blur(2px);
  -webkit-backdrop-filter: saturate(110%) blur(2px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease;
}

#ss-email-palette-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

#ss-email-palette {
  width: min(680px, 92vw);
  max-height: 70vh;
  background: #FFFEFB;
  border: 1px solid #e4e6e8;
  border-radius: 16px;
  box-shadow:
    0 24px 60px -12px rgba(40, 38, 34, .34),
    0 6px 18px -8px rgba(40, 38, 34, .20);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(-6px);
  transition: transform .16s ease;
}

#ss-email-palette-overlay.is-open #ss-email-palette {
  transform: translateY(0);
}

.ss-pal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid #e4e6e8;
  flex-shrink: 0;
}

.ss-pal-header svg {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  color: #9A8E82;
}

#ss-pal-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: var(--font-size-lg, 18px);
  font-family: var(--font-family);
  color: #3A2F26;
  min-width: 0;
}

#ss-pal-input::placeholder {
  color: rgba(0, 0, 0, 0.38);
}

.ss-pal-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  color: #6B5E53;
  cursor: pointer;
  transition: background 120ms ease;
}

.ss-pal-close:hover {
  background: rgba(0, 0, 0, 0.10);
}

.ss-pal-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(77, 122, 104, 0.35);
}

#ss-pal-body {
  overflow-y: auto;
  flex: 1;
  padding: 6px 0;
}

.ss-pal-section {
  padding: 8px 18px 4px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold, 600);
  /* Sentence case, not shouting caps (Morten 13/7) — "E-mails", "Seneste søgninger". */
  text-transform: none;
  letter-spacing: 0.01em;
  color: #9A8E82;
  user-select: none;
}

/* Ask-AI answer line — one calm sage block above the result rows: the answer
   text and a speaker button, nothing else. */
.ss-pal-answer {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 10px 14px 4px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(74, 122, 104, 0.07);
}
.ss-pal-answer-text {
  flex: 1;
  min-width: 0;
  font-size: var(--font-size-sm);
  line-height: 1.55;
  color: #2E4A3F;
  overflow-wrap: break-word;
}
.ss-pal-answer-skel {
  flex: 1;
  min-width: 0;
  padding: 2px 0;
}
.ss-pal-answer-speak {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: -4px -4px 0 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #4A7A68;
  cursor: pointer;
  transition: background 100ms ease;
}
/* Invisible 44px touch target centered on the calm 28px glyph — the dyslexia/
   ADHD audience needs a comfortable tap area on mobile without a chunky button. */
.ss-pal-answer-speak::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}
.ss-pal-answer-speak:hover,
.ss-pal-answer-speak.is-playing {
  background: rgba(74, 122, 104, 0.12);
}
.ss-pal-answer-speak:focus-visible {
  outline: 2px solid #4A7A68;
  outline-offset: 1px;
}

.ss-pal-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 18px;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: var(--font-family);
  transition: background 100ms ease;
}

.ss-pal-row:hover,
.ss-pal-row.ss-active {
  background: rgba(110, 138, 126, .12);
}

.ss-pal-row:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(77, 122, 104, 0.35);
}

.ss-pal-row-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(110, 138, 126, .12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6E8A7E;
}

.ss-pal-row-icon svg {
  width: 15px;
  height: 15px;
}

.ss-pal-row-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* title/sub are spans — without display:block they flow inline on ONE line
   (title+snippet concatenated, ellipsis/margin-top inert). Block stacks them
   into the intended two lines and re-arms the per-line ellipsis. */
.ss-pal-row-title {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: #3A2F26;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ss-pal-row-sub {
  display: block;
  font-size: var(--font-size-xs);
  color: #9A8E82;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.ss-pal-row-date {
  flex-shrink: 0;
  font-size: var(--font-size-xs);
  color: #9A8E82;
}

.ss-pal-row-remove {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  border-radius: 50%;
  color: #9A8E82;
  cursor: pointer;
  opacity: 0;
  transition: opacity 100ms, background 100ms, color 100ms;
}

.ss-pal-row:hover .ss-pal-row-remove,
.ss-pal-row:focus-within .ss-pal-row-remove,
.ss-pal-row-remove:focus-visible {
  opacity: 1;
}

.ss-pal-row-remove:hover {
  background: rgba(194, 75, 96, 0.10);
  color: #A6594B;
}

.ss-pal-empty {
  padding: 24px 18px;
  text-align: center;
  color: #9A8E82;
  font-size: var(--font-size-sm);
}

.ss-pal-loading {
  padding: 18px;
  text-align: center;
  color: #9A8E82;
  font-size: var(--font-size-sm);
}

.ss-pal-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#email-recent-searches-listbox {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  #ss-email-palette-overlay,
  #ss-email-palette {
    transition: none;
  }
}

/* ===== Calm header v2 — dyslexia-simplified toolbar =====
   The two promoted grey icons (Mailkonti, Indstillinger) stay in the DOM
   (the mobile folder drawer delegates to them via .click(); contracts keep
   them) but are hidden on desktop. Their actions live behind one gear on the
   right, next to Spørg AI. Search reads as a labelled pill on desktop. */
.email-search__label { display: none; }
@media (min-width: 768px) {
  .email-page .email-toolbar.email-header #email-toolbar-mailkonti,
  .email-page .email-toolbar.email-header #email-toolbar-settings { display: none !important; }
  .email-page .email-toolbar.email-header .email-search:not(.email-search--expanded):not(.email-search--has-text):not(:has(#email-search-input:focus)) {
    flex: 0 0 auto !important; width: auto !important; min-width: 0 !important; max-width: none !important;
  }
  .email-page .email-toolbar.email-header .email-search__toggle {
    position: relative !important; inset: auto !important; width: auto !important; height: 36px !important;
    padding: 0 14px 0 12px !important; gap: 8px !important; justify-content: flex-start !important;
    border-radius: 10px !important; background: var(--bb-surface-tint, #FBF8F2) !important;
    border: 1px solid rgba(154, 142, 130, 0.22) !important; color: #5C4D43 !important;
  }
  .email-page .email-toolbar.email-header .email-search__toggle > svg {
    width: 18px !important; height: 18px !important; flex: 0 0 auto !important;
  }
  .email-page .email-toolbar.email-header .email-search__label {
    display: inline !important; font-family: var(--font-family) !important;
    font-size: var(--font-size-sm) !important; font-weight: 600 !important; color: #3A2F26 !important; line-height: 1 !important;
  }
}
/* Gear sits on the right next to Spørg AI on every width (now a direct toolbar
   child, moved after the Sofia hero button). */
.email-page .email-toolbar.email-header .email-profile {
  display: inline-flex !important; align-items: center !important; flex: 0 0 auto !important;
}
/* Log ud + its divider stay in the DOM for compatibility but are not shown in
   the gear menu — the global left rail already owns sign-out. */
.email-page #email-profile-logout,
.email-page #email-profile-dropdown .email-profile-divider { display: none !important; }

/* ===== Mapper folding — Gmail-style collapse + hover-expand (desktop only) =====
   The folders panel collapses to a slim icon rail that gives the message list
   more room; hovering slides the full panel out as an overlay (the list never
   reflows). Mobile (<768px) keeps the existing burger drawer untouched. */
@media (min-width: 768px) {
  .email-page #email-list { margin-left: 60px !important; }
  .email-page #email-folders {
    position: absolute !important; left: 0 !important; top: 0 !important; bottom: 0 !important;
    width: 60px !important; min-width: 60px !important; z-index: 30 !important;
    overflow: hidden !important;
    background: #FFFEFB !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease !important;
  }
  [data-theme="dark"] .email-page #email-folders { background: var(--color-bg) !important; }
  .email-page #email-folders.is-rail-open {
    width: 248px !important; overflow-y: auto !important;
    box-shadow: 14px 0 30px rgba(58, 47, 38, 0.13) !important;
  }
  [data-theme="dark"] .email-page #email-folders.is-rail-open { box-shadow: 14px 0 30px rgba(0, 0, 0, 0.4) !important; }
  /* collapsed: only icons, centered as uniform 44px boxes, comfortable spacing */
  .email-page #email-folders:not(.is-rail-open) {
    align-items: center !important; justify-content: flex-start !important;
    gap: 10px !important; padding: 14px 0 !important;
  }
  .email-page #email-folders:not(.is-rail-open) > * {
    margin: 0 auto !important; width: 44px !important; min-width: 44px !important; max-width: 44px !important;
  }
  .email-page #email-folders:not(.is-rail-open) .email-folder-item,
  .email-page #email-folders:not(.is-rail-open) .email-folder-more-toggle,
  .email-page #email-folders:not(.is-rail-open) .email-rail-header,
  .email-page #email-folders:not(.is-rail-open) .email-rail-compose {
    justify-content: center !important; align-items: center !important; padding: 0 !important; gap: 0 !important;
  }
  /* hide every non-icon element so nothing can bias the centering */
  .email-page #email-folders:not(.is-rail-open) .email-folder-item > *:not(.email-folder-icon),
  .email-page #email-folders:not(.is-rail-open) .email-folder-more-toggle > *:not(svg),
  .email-page #email-folders:not(.is-rail-open) .email-rail-compose > *:not(svg),
  .email-page #email-folders:not(.is-rail-open) .email-rail-header > *:not(.email-rail-compose) {
    display: none !important;
  }
  /* collapsed rail shows compose + the main folders only; labels appear on hover */
  .email-page #email-folders:not(.is-rail-open) .email-folder-more-toggle ~ * { display: none !important; }
}

/* Respect reduced-motion: the rail still expands on hover-intent, but snaps
   open/closed instead of gliding. The gear footer band snaps with it. */
@media (min-width: 768px) and (prefers-reduced-motion: reduce) {
  .email-page #email-folders { transition: none !important; }
  .email-page .email-headerless .email-folders-footer { transition: none !important; }
}

/* Inbox header: retire the redundant conversation count (approved spec) — it added noise and
   reserved a dead gap below the title. Hidden in every state (loading + rendered) and on mobile;
   display:none also drops it from the a11y tree so screen readers skip the stale total. */
.email-page .email-list-count { display: none !important; }

/* ===== Headerless /email/ — top toolbar retired, controls moved into context (desktop) =====
   email-headerless-layout.js adds .email-headerless on .email-app + .email-header--relocated on
   the toolbar. The gear sits in a .email-folders-footer appended to the stable .email-columns;
   search + account live in the list title-row. Mobile (<768px) restores the toolbar. */
@media (min-width: 768px) {
  /* Toolbar retired on desktop, hidden from FIRST PAINT (email-base.css is render-blocking) so it
     never paints-then-collapses (was .email-header--relocated, JS-added post-paint = a -64px reflow). */
  .email-page #email-toolbar { display: none !important; }

  /* list title-row = command center: title + account ... search + refresh */
  .email-page .email-headerless .email-list-title-row {
    display: flex !important; align-items: center !important; gap: 10px !important; flex-wrap: nowrap !important;
    min-height: 36px !important; /* JUMP 2: reserve height across the header rebuild */
  }
  .email-page .email-headerless .email-list-heading { min-height: 36px !important; } /* was 58 — reserved the conversation count; count retired so the heading collapses to the title row */
  /* tighten the header band now the count gap is gone (approved spec: ~93px -> ~65px) */
  .email-page .email-headerless #email-list-header { padding-top: 16px !important; padding-bottom: 12px !important; }
  .email-page .email-headerless .email-list-header .email-list-title-row .email-list-title { flex: 0 1 auto !important; min-width: 0 !important; }
  /* account folded next to the title (quiet, not a hanging pill) */
  .email-page .email-headerless .email-list-title-row #email-account-filter { margin: 0 !important; flex: 0 0 auto !important; }
  .email-page .email-headerless .email-list-title-row .calm-account-trigger {
    min-height: 30px !important; padding: 0 8px 0 7px !important; border-color: transparent !important; background: transparent !important;
  }
  .email-page .email-headerless .email-list-title-row .calm-account-trigger:hover { background: #F5EFE5 !important; }
  /* keyboard focus: the same gentle tint, not a hard ring (Morten: no focus line) */
  .email-page .email-headerless .email-list-title-row .calm-account-select--hidden:focus-visible ~ .calm-account-trigger-wrap .calm-account-trigger { background: #F5EFE5 !important; }

  /* spacer pushes search+refresh right so the refresh stays put when the search (re)appears */
  .email-page .email-headerless .email-list-title-row .email-list-title-spacer { flex: 1 1 auto !important; min-width: 0 !important; }
  /* search -> 36px icon button next to refresh */
  .email-page .email-headerless .email-list-title-row .email-hl-search {
    margin-left: auto !important; flex: 0 0 auto !important; display: inline-flex !important; align-items: center !important; justify-content: center !important;
    width: 36px !important; height: 36px !important; padding: 0 !important; border: 0 !important; border-radius: 11px !important;
    background: transparent !important; color: #5C4D43 !important; cursor: pointer !important;
  }
  .email-page .email-headerless .email-list-title-row .email-hl-search:hover { background: #F5EFE5 !important; }
  .email-page .email-headerless .email-list-title-row .cl-refresh { flex: 0 0 auto !important; margin-left: 0 !important; }

  /* settings gear -> folder-rail footer (mounted in the stable .email-columns) */
  .email-page .email-headerless .email-folders-footer {
    position: absolute !important; left: 0 !important; bottom: 0 !important; width: 60px !important; z-index: 31 !important;
    display: flex !important; align-items: center !important; justify-content: center !important; padding: 10px 0 !important;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }
  .email-page .email-headerless .email-folders-footer #email-profile { display: inline-flex !important; position: relative !important; }
  .email-page .email-headerless .email-folders-footer #email-profile-btn { width: 40px !important; height: 40px !important; border-radius: 12px !important; }
  /* the gear dropdown opens upward from the footer */
  .email-page .email-headerless .email-folders-footer #email-profile-dropdown { bottom: calc(100% + 8px) !important; top: auto !important; left: 8px !important; }
  /* Open rail: the footer becomes the panel's own bottom band — the gear must
     never float OVER folder rows (Morten 2026-07-02, mockup A approved). The
     band glides with the rail (same width + curve), turns opaque with a top
     hairline, and the rail reserves the band's height so the last row scrolls
     clear. Gear x stays 10px in both states (centered-in-60px == flex-start +
     10px pad), so the gear itself never moves — the band just grows around it. */
  .email-page .email-headerless #email-folders.is-rail-open ~ .email-folders-footer {
    /* SAME source of truth as the rail's real width: folders-toolbar's
       max-width var(--email-folder-rail-width) CLIPS the 248px above to 240 —
       a hardcoded band width overhung the panel edge by 8px (live edge-drive
       catch). The var keeps band == panel if the rail width ever moves. */
    width: var(--email-folder-rail-width, 240px) !important; justify-content: flex-start !important; padding-left: 10px !important;
    background: #FFFEFB !important; border-top: 0.5px solid rgba(58, 47, 38, 0.14) !important;
    /* break-it lens: the 248px band would otherwise EAT clicks across its whole
       area — including the bottom 60px of the rail's scrollbar track (which the
       old 60px footer never covered). Empty band area falls through to the rail
       (whose own hover-intent keeps the panel open); only the gear stays hot. */
    pointer-events: none !important;
  }
  .email-page .email-headerless #email-folders.is-rail-open ~ .email-folders-footer #email-profile {
    pointer-events: auto !important;
  }
  [data-theme="dark"] .email-page .email-headerless #email-folders.is-rail-open ~ .email-folders-footer {
    background: var(--color-bg) !important; border-top-color: rgba(255, 255, 255, 0.10) !important;
  }
  .email-page .email-headerless #email-folders.is-rail-open { padding-bottom: 60px !important; }

  /* reserve the scrollbar gutter so the list does not narrow when emails load + the scrollbar appears */
  .email-page .email-list-items { scrollbar-gutter: stable !important; }
}

/* ===== Inbox row redesign (approved) =====
   Unread = bold near-black sender/subject/timestamp; read recedes (lighter grey).
   Inks are the WARM ramp (#2B241E / #6B5F55 / #9A8E82) — never the cool Gmail
   greys (#202124/#5f6368/#9aa0a6) the row model was ported from (craft-pass 17/7).
   Each email is a 3-line stack (sender / subject / preview), single-line ellipsis,
   no em-dash. Checkbox + star are always faintly visible (0.45), full on hover/
   focus/checked. No green dot, no accent bar, no backgrounds; row geometry untouched.
   #email-list-items ID beats email-calm-preview; literal light colors scoped to light
   mode so they never reach the dark theme (dark keeps its own tokens). */
/* tighter left padding so the controls sit ~15px from the panel edge, matching the star-to-text gap (Morten) */
.email-page #email-list-items .email-message-item.email-dense-row { padding-left: 4px !important; }
/* the controls fill their 52px grid column and sit 5px right of true center; nudge left so before-circle == star-to-text == 15px (Morten) */
.email-page #email-list-items .email-message-item.email-dense-row .email-row-controls { margin-left: -5px !important; }
.email-page #email-list-items .email-message-item.email-dense-row.unread,
.email-page #email-list-items .email-message-item.email-dense-row:not(.unread) { background-color: transparent !important; }
.email-page #email-list-items .email-message-item.email-dense-row.unread .email-row-controls::before { display: none !important; }
.email-page #email-list-items .email-message-item.email-dense-row.unread .email-sender-name,
.email-page #email-list-items .email-message-item.email-dense-row.unread .email-message-subject,
.email-page #email-list-items .email-message-item.email-dense-row.unread .email-message-time { font-weight: var(--font-weight-bold) !important; }
html:not([data-theme="dark"]) .email-page #email-list-items .email-message-item.email-dense-row.unread .email-sender-name,
html:not([data-theme="dark"]) .email-page #email-list-items .email-message-item.email-dense-row.unread .email-message-subject,
html:not([data-theme="dark"]) .email-page #email-list-items .email-message-item.email-dense-row.unread .email-message-time { color: #2B241E !important; }
.email-page #email-list-items .email-message-item.email-dense-row:not(.unread) .email-sender-name,
.email-page #email-list-items .email-message-item.email-dense-row:not(.unread) .email-message-subject { font-weight: 400 !important; }
html:not([data-theme="dark"]) .email-page #email-list-items .email-message-item.email-dense-row:not(.unread) .email-sender-name,
html:not([data-theme="dark"]) .email-page #email-list-items .email-message-item.email-dense-row:not(.unread) .email-message-subject { color: #6B5F55 !important; }
/* no accent bar — the bold-black sender + 3-line stack carries unread */
.email-page #email-list-items .email-message-item.email-dense-row.unread::before { content: none !important; display: none !important; }
/* 3-line stack: sender / subject / preview, each its own single-line-ellipsis row (kills the em-dash 2-line mush) */
.email-page #email-list-items .email-message-item.email-dense-row .email-message-line {
  display: flex !important; flex-direction: column !important; align-items: flex-start !important; gap: 2px !important; text-align: left !important;
}
.email-page #email-list-items .email-message-item.email-dense-row .email-message-subject,
.email-page #email-list-items .email-message-item.email-dense-row .email-message-snippet {
  display: block !important; flex: 0 0 auto !important; align-self: stretch !important; text-align: left !important;
  white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; max-width: 100% !important;
  min-height: 0 !important; height: auto !important; margin: 0 !important;
}
.email-page #email-list-items .email-message-item.email-dense-row .email-message-snippet::before { content: "" !important; display: none !important; margin: 0 !important; }
/* faint always-visible checkbox + star ([class] out-specifies the app opacity:0 !important) */
.email-page #email-list-items .email-message-item.email-dense-row[class] .email-row-controls .email-bulk-cb[class],
.email-page #email-list-items .email-message-item.email-dense-row[class] .email-row-controls .email-message-star[class] { opacity: 0.45 !important; transition: opacity 0.12s ease !important; }
html:not([data-theme="dark"]) .email-page #email-list-items .email-message-item.email-dense-row[class] .email-row-controls .email-message-star[class] { color: #9A8E82 !important; }
.email-page #email-list-items .email-message-item.email-dense-row[class]:hover .email-row-controls .email-bulk-cb[class],
.email-page #email-list-items .email-message-item.email-dense-row[class]:hover .email-row-controls .email-message-star[class],
.email-page #email-list-items .email-message-item.email-dense-row[class] .email-row-controls .email-bulk-cb[class]:focus-visible,
.email-page #email-list-items .email-message-item.email-dense-row[class] .email-row-controls .email-message-star[class]:focus-visible,
.email-page #email-list-items .email-message-item.email-dense-row[class] .email-row-controls .email-message-star[class].starred,
.email-page #email-list-items .email-message-item.email-dense-row[class].bulk-selected .email-row-controls .email-bulk-cb[class] { opacity: 1 !important; }
@media (prefers-reduced-motion: reduce) {
  .email-page #email-list-items .email-message-item.email-dense-row[class] .email-row-controls .email-bulk-cb[class],
  .email-page #email-list-items .email-message-item.email-dense-row[class] .email-row-controls .email-message-star[class] { transition: none !important; }
}

/* ===== #email-folders sidebar refinement (Morten 6/21) =====
   a11y aria-label/title + aria-controls are rendered in folders.js. Here: uniform
   inactive folder-icon stroke (inbox glyph drifts to 2px; active keeps its emphasis),
   chevron normalised to the folder-icon size (app hard-codes 14px @ 2.2), no divider
   under the compose button, and the relocated gear recoloured to the warm taupe.
   #id selectors beat email-calm-preview.css's class chains. The gear is recoloured via
   the button colour only (its svg uses stroke="currentColor"), so the dark-theme gear
   rule (email-darkmode-detail-polish.css, !important) still wins in dark. */
#email-folders .email-folder-item:not(.active):not([aria-current="true"]) .email-folder-icon svg { stroke-width: 1.85px !important; }
#email-folders #email-folder-more-toggle > svg { width: 18px !important; height: 18px !important; min-width: 18px !important; stroke-width: 1.85px !important; }
#email-folders .email-rail-header { border-bottom: 0 !important; }
#email-profile-btn { color: rgb(154, 142, 130); }
#email-profile-btn svg { stroke-width: 1.85px; }
#email-profile-btn:hover { color: rgb(58, 47, 38); }
