

:root,
.email-page {
  --calm-rh-pad-y: 18px;
  --calm-rh-pad-x: 24px;
  --calm-rh-gap: 8px;
  --calm-rh-subject-size: 19px;
  --calm-rh-subject-weight: 650;
  --calm-rh-subject-clamp: 2;
  --calm-rh-meta-gap: 10px;
  --calm-rh-name-size: 14.5px;
  --calm-rh-email-size: 13px;
  --calm-rh-time-size: 13px;
  --calm-rh-toggle-size: 12.5px;
  --calm-rh-anchor: #3A2F26;
  --calm-rh-body: #5C4D43;
  --calm-rh-muted: #9A8E82;
  --calm-rh-divider: #C8BFB5;
  --calm-rh-sage-dark: #4A7A68;
  --calm-rh-sage-wash: rgba(110,138,126,0.10);
}

.email-reader {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: var(--sk-bg-subtle);
  position: relative;
}

@media (min-width: 1200px) {
  .email-app.is-thread-open.is-reader-split .email-columns {
    align-items: stretch;
  }

  .email-app.is-thread-open.is-reader-split .email-folders {
    flex: 0 1 clamp(160px, 17%, 220px) !important;
    width: clamp(160px, 17%, 220px) !important;
    min-width: 160px !important;
  }

  .email-app.is-thread-open.is-reader-split .email-list {
    display: flex !important;
    flex: 0 0 clamp(320px, 31%, 440px) !important;
    width: clamp(320px, 31%, 440px) !important;
    min-width: 320px !important;
    max-width: 440px !important;
    border-right: 1px solid var(--sk-m3-outline-variant, var(--sk-border)) !important;
    background: var(--sk-m3-surface-container, var(--sk-bg-surface));
  }

  .email-app.is-thread-open.is-reader-split .email-reader {
    display: flex !important;
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    background: var(--sk-m3-surface-container-lowest, var(--sk-bg));
  }

  .email-app.is-thread-open.is-reader-split .email-reader-content {
    width: 100% !important;
    max-width: none !important;
    margin-inline: 0 !important;
    border-inline: 0 !important;
  }

  .email-app.is-thread-open.is-reader-split .email-reader-header {
    padding-inline: 16px;
  }
}

.email-reader-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 48px;
  animation: email-fade-in 300ms ease;
}

.email-reader-empty svg {
  margin-bottom: 16px;
  opacity: 0.3;
  color: var(--sk-text-secondary);
}

.email-reader-empty p {
  font-size: var(--font-size-md);
  color: var(--sk-text-tertiary);
  margin: 0;
}

.email-reader-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--sk-bg-surface);
}

.email-reader-header {
  background: var(--sk-bg-surface);
  padding: var(--calm-rh-pad-y) var(--calm-rh-pad-x) calc(var(--calm-rh-pad-y) - 2px);
  border-bottom: 0.5px solid rgba(58,47,38,0.08);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "meta actions";
  column-gap: var(--calm-rh-gap);
  align-items: start;
}

.email-reader-meta { grid-area: meta; }

.email-reader-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0;
}

.email-reader-subject {
  font-size: var(--calm-rh-subject-size);
  font-weight: var(--calm-rh-subject-weight);
  color: var(--calm-rh-anchor);
  line-height: 1.3;
  letter-spacing: 0;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: var(--calm-rh-subject-clamp);
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  text-overflow: initial;
}

.email-reader-from {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: var(--font-size-sm);
  line-height: 1.4;
  color: var(--calm-rh-body);
}

.email-reader-close {
  margin-left: auto;
  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-tertiary);
  cursor: pointer;
  transition: background 120ms, color 120ms;
  flex-shrink: 0;
}

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

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

.email-reader-from .email-reader-name {
  font-weight: 650;
  font-size: var(--calm-rh-name-size);
  color: var(--calm-rh-anchor);
}

.email-reader-separator {
  display: none;
}

.email-reader-email {
  font-size: var(--calm-rh-email-size);
  color: var(--calm-rh-muted);
  display: inline;
}

.email-reader-email::before {
  content: "<";
  color: var(--calm-rh-divider);
  margin-right: 1px;
}

.email-reader-email::after {
  content: ">";
  color: var(--calm-rh-divider);
  margin-left: 1px;
}

.email-reader-time {
  font-size: var(--calm-rh-time-size);
  font-weight: 500;
  color: var(--calm-rh-muted);
  font-variant-numeric: tabular-nums;
}

.email-reader-actions .email-reader-time {
  align-self: center;
  margin-right: 8px;
  white-space: nowrap;
}

.email-reader-details-toggle {
  margin-left: 2px;
  padding: 2px 6px;
  border-radius: 6px;
  color: rgb(74, 122, 104);
  font-size: var(--font-size-xs);
  font-weight: 600;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-size: var(--calm-rh-toggle-size);
  font-weight: 600;
  transition: background-color 120ms ease, color 120ms ease;
}

.email-reader-details-toggle:hover {
  background: rgba(74, 122, 104, 0.10);
}

.email-reader-details-toggle:focus-visible {
  outline: 2px solid rgba(74, 122, 104, 0.45);
  outline-offset: 2px;
}

.email-reader-from:has(.email-delivery-status--sent) .email-reader-details-toggle,
.email-reader-from[data-delivery-state="sent"] .email-reader-details-toggle {
  flex: 0 0 100%;
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-top: 2px;
  align-self: flex-start;
  text-align: left;
  justify-content: flex-start;
  padding-left: 0;
}

.email-reader-details {
  display: none;
  padding-top: 8px;
}

.email-reader-header.show-details .email-reader-details {
  display: block;
}

.email-reader-to {
  font-size: var(--font-size-sm);
  line-height: 1.4;
  color: #7D746F;
  word-break: break-word;
  margin-bottom: 2px;
}

.email-reader-date-full {
  font-size: var(--font-size-sm);
  line-height: 1.4;
  color: #7D746F;
  font-variant-numeric: tabular-nums;
}

.email-reader-date {
  font-size: var(--font-size-sm);
  color: #9A8E82;
  margin-bottom: 0;
}

.email-reader-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.email-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sk-text-secondary);
  cursor: pointer;
  transition: background 120ms, color 120ms;
}

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

.email-calm-action {
  width: auto;
  gap: 6px;
  padding: 0 12px;
  height: 34px;
  border-radius: 999px;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  border: 1px solid var(--sk-border);
  background: transparent;
}

.email-calm-action span {
  white-space: nowrap;
}

.email-calm-action:hover {
  background: var(--sk-bg-hover, rgba(0,0,0,0.04));
  border-color: var(--sk-text-tertiary);
}

.email-action-btn:active {
  background: var(--sk-border);
  transform: scale(0.95);
  /* press-in snappy (70ms); the release fade rides the base transition */
  transition: transform 70ms ease-out;
}

.email-action-btn span {
  display: none;
}

.email-action-divider {
  width: 1px;
  height: 18px;
  background: var(--sk-border);
  margin: 0 4px;
}

.email-more-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  min-width: 180px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: var(--sk-bg-surface);
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 28px rgba(31, 31, 30, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 4px;
  z-index: 10050;
  animation: moreDropIn 150ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes moreDropIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.email-more-item {
  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);
  font-size: var(--font-size-base);
  cursor: pointer;
  text-align: left;
  transition: background 120ms;
}
.email-more-item:hover {
  background: var(--sk-bg-hover, rgba(0,0,0,0.04));
}
.email-more-item svg {
  flex-shrink: 0;
  color: var(--sk-text-secondary);
}
.email-more-divider {
  height: 0.5px;
  background: var(--sk-border);
  margin: 4px 8px;
}

/* --- Reader overflow menu (#1160, #2513 calm polish) --- */
.email-reader-more-menu {
  position: fixed;
  min-width: 220px;
  background: rgb(251, 248, 242);
  border: 1px solid rgba(92, 77, 67, 0.12);
  border-radius: 14px;
  padding: 6px;
  box-shadow: rgba(71, 52, 45, 0.04) 0px 1px 2px 0px, rgba(71, 52, 45, 0.10) 0px 12px 32px 0px;
  z-index: 10050;
  font-family: var(--font-family, Inter, system-ui, sans-serif);
  font-size: var(--font-size-base);
  text-align: left;
  animation: readerMoreIn 150ms cubic-bezier(0.16, 1, 0.3, 1);
  /* With 14 items the menu is taller than a phone viewport; positionMenu()
     then resolves top to a negative value (-73px on 664px-tall screens) and
     the first group becomes untappable. Keep the #2513 fixed popover, but
     never let it exceed the viewport — overflow scrolls internally. */
  max-height: calc(100vh - 16px);
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.email-reader-more-menu[hidden] {
  display: none;
}
@keyframes readerMoreIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.email-reader-more-menu.is-flipped {
  animation-name: readerMoreInFlip;
}
@keyframes readerMoreInFlip {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
/* Calm group headings */
.email-reader-more-group-heading {
  padding: 10px 12px 4px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: rgb(154, 142, 130);
  text-transform: uppercase;
  letter-spacing: 1px;
  line-height: 1;
  margin: 0;
  user-select: none;
  pointer-events: none;
}
.email-reader-more-group-heading.calm-destructive-heading {
  color: rgb(168, 76, 68);
}
/* Separators: visible calm dividers */
.email-reader-more-separator,
.email-reader-more-sep {
  height: 1px;
  margin: 6px 8px;
  background: rgba(58, 47, 38, 0.08);
  border: 0;
  padding: 0;
  overflow: hidden;
}
/* Menu items: grid layout with icon column */
.email-reader-more-item {
  display: grid;
  grid-template-columns: 20px 1fr;
  justify-items: start;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 32px;
  height: auto;
  padding: 6px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: rgb(58, 47, 38);
  font-family: inherit;
  font-size: var(--font-size-base);
  font-weight: 400;
  letter-spacing: 0.2px;
  line-height: 1.2;
  cursor: pointer;
  text-align: left;
  outline: none;
}
@media (prefers-reduced-motion: no-preference) {
  .email-reader-more-item { transition: background-color 120ms ease, color 120ms ease; }
}
/* Mouse-mode .is-focused: suppressed (no ring, no bg) */
.email-reader-more-item.is-focused {
  background: transparent;
  color: rgb(58, 47, 38);
}
/* Hover: subtle warm background */
.email-reader-more-item:hover {
  background: rgba(58, 47, 38, 0.06);
  color: rgb(58, 47, 38);
}
/* Keyboard mode: inset ring on .is-focused */
.email-reader-more-menu.calm-keyboard .email-reader-more-item.is-focused {
  background: rgba(58, 47, 38, 0.06);
  color: rgb(58, 47, 38);
  box-shadow: inset 0 0 0 2px rgb(58, 47, 38);
}
/* :focus-visible: inset ring for real browser keyboard focus */
.email-reader-more-item:focus-visible {
  background: rgba(58, 47, 38, 0.06);
  color: rgb(58, 47, 38);
  box-shadow: inset 0 0 0 2px rgb(58, 47, 38);
}
/* Destructive items */
.email-reader-more-item[data-destructive],
.email-reader-more-item.is-destructive {
  color: rgb(168, 76, 68);
}
.email-reader-more-item[data-destructive]:hover,
.email-reader-more-item.is-destructive:hover,
.email-reader-more-item[data-destructive]:focus-visible,
.email-reader-more-item.is-destructive:focus-visible {
  background: rgba(168, 76, 68, 0.06);
  color: rgb(168, 76, 68);
}
.email-reader-more-menu.calm-keyboard .email-reader-more-item[data-destructive].is-focused,
.email-reader-more-menu.calm-keyboard .email-reader-more-item.is-destructive.is-focused {
  background: rgba(168, 76, 68, 0.06);
  color: rgb(168, 76, 68);
  box-shadow: inset 0 0 0 2px rgb(168, 76, 68);
}
/* Disabled items */
.email-reader-more-item.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.email-reader-more-item.is-disabled:hover,
.email-reader-more-item.is-disabled.is-focused {
  background: transparent;
  color: rgb(58, 47, 38);
}
/* Item label: wraps instead of clipping */
.email-reader-more-item-label {
  min-width: 0;
  justify-self: start;
  text-align: left;
  width: 100%;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}
/* Coarse pointer: 44px touch target */
@media (pointer: coarse) {
  .email-reader-more-item { min-height: 44px; }
}
/* Overblik + Lav opgave live ONLY in this menu (header chips removed 2026-07-19):
   they must never be display:none'd here on any breakpoint. */
/* Item hint: visually hidden, stays in DOM for a11y */
.email-reader-more-item-hint {
  display: none;
}
/* Calm icon: stroke-only SVG */
.email-reader-more-item .calm-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  width: 18px;
  height: 18px;
  color: rgb(154, 142, 130);
  flex-shrink: 0;
  opacity: 1;
}
.email-reader-more-item .calm-icon svg {
  width: 18px;
  height: 18px;
}
.email-reader-more-item:hover .calm-icon,
.email-reader-more-menu.calm-keyboard .email-reader-more-item.is-focused .calm-icon,
.email-reader-more-item:focus-visible .calm-icon {
  color: rgb(58, 47, 38);
}
.email-reader-more-item[data-destructive]:hover .calm-icon,
.email-reader-more-item.is-destructive:hover .calm-icon,
.email-reader-more-menu.calm-keyboard .email-reader-more-item[data-destructive].is-focused .calm-icon,
.email-reader-more-menu.calm-keyboard .email-reader-more-item.is-destructive.is-focused .calm-icon,
.email-reader-more-item[data-destructive]:focus-visible .calm-icon,
.email-reader-more-item.is-destructive:focus-visible .calm-icon {
  color: rgb(168, 76, 68);
}

/* --- Reader read-aloud (Oplæs) button state (#2499) --- */
.email-read-aloud-action.is-playing {
  background: rgba(61, 107, 87, 0.12);
  border-color: #3D6B57;
  color: #3D6B57;
}
.email-read-aloud-action[aria-busy="true"] {
  opacity: 0.6;
  pointer-events: none;
}

/* --- Reader more-menu Oplæs states (#2538) --- */
.email-reader-more-menu.is-reading {
  box-shadow: 0 1px 2px rgba(58,47,38,0.04), 0 12px 32px rgba(58,47,38,0.12), 0 0 0 2px rgba(110, 138, 126, 0.18);
}
.email-reader-more-menu.is-reading::after {
  content: '';
  /* sticky, not absolute: the menu scrolls internally since the viewport
     clamp above, and an absolute bar would scroll away with the content.
     Sticky keeps the progress pinned to the scrollport bottom; in a
     non-scrolling menu it sits in flow right after the last item. */
  position: sticky;
  display: block;
  bottom: 4px;
  height: 2px;
  margin: 6px 10px 0;
  border-radius: 2px;
  background: linear-gradient(90deg, #4A7A68 0 var(--calm-oplaes-progress-pct, 0%), rgba(74,122,104,0.15) var(--calm-oplaes-progress-pct, 0%) 100%);
  pointer-events: none;
}
.email-reader-more-menu.is-reading.is-indeterminate::after {
  background: linear-gradient(90deg, rgba(74,122,104,0.15) 0%, #4A7A68 50%, rgba(74,122,104,0.15) 100%);
  background-size: 250% 100%;
  animation: calm-progress-indeterminate 1.4s linear infinite;
}
.email-reader-more-item.is-loading {
  pointer-events: none;
  background: rgba(58,47,38,0.04);
  color: #5C4D43;
  position: relative;
}
.email-reader-more-item.is-loading .calm-icon { display: none; }
.email-reader-more-item.is-loading::before {
  content: '';
  display: block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 2px solid rgba(110,138,126,0.25);
  border-top-color: #4A7A68;
  border-radius: 50%;
  animation: calm-spin .7s linear infinite;
  box-sizing: border-box;
}
.email-reader-more-item.is-loading .email-reader-more-item-label::after { content: ' \2026'; opacity: .6; }
.email-reader-more-item.is-playing {
  background: rgba(110,138,126,0.12);
  color: #4A7A68;
  position: relative;
}
.email-reader-more-item.is-playing .calm-icon { display: none; }
.email-reader-more-item.is-playing::before {
  content: '';
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 16px;
  height: 14px;
  flex-shrink: 0;
  background:
    linear-gradient(#4A7A68, #4A7A68) 0px 0/2px 40%,
    linear-gradient(#4A7A68, #4A7A68) 4px 0/2px 80%,
    linear-gradient(#4A7A68, #4A7A68) 8px 0/2px 60%,
    linear-gradient(#4A7A68, #4A7A68) 12px 0/2px 90%;
  background-repeat: no-repeat;
  background-position-y: bottom;
  animation: calm-eq .9s ease-in-out infinite alternate;
}
.email-reader-more-item.is-stopping {
  background: rgba(166,89,75,0.08);
  color: #A6594B;
  position: relative;
}
.email-reader-more-item.is-stopping .calm-icon { display: none; }
.email-reader-more-item.is-stopping::before {
  content: '';
  display: block;
  width: 16px;
  height: 14px;
  flex-shrink: 0;
  background:
    linear-gradient(#A6594B, #A6594B) 0px 0/2px 60%,
    linear-gradient(#A6594B, #A6594B) 4px 0/2px 60%,
    linear-gradient(#A6594B, #A6594B) 8px 0/2px 60%,
    linear-gradient(#A6594B, #A6594B) 12px 0/2px 60%;
  background-repeat: no-repeat;
  background-position-y: bottom;
  opacity: .6;
}
.email-reader-more-item.is-done { color: #4A7A68; }
.email-reader-more-item.is-done .calm-icon { display: none; }
.email-reader-more-item.is-done::before {
  content: '';
  display: block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='none' stroke='%234A7A68' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 8.5l3.5 3.5 6.5-8'/%3E%3C/svg%3E") center/16px no-repeat;
  animation: calm-pop .25s ease-out;
}
.email-reader-more-item.is-error {
  background: rgba(166,89,75,0.06);
  color: #A6594B;
}
.email-reader-more-item.is-error .calm-icon { display: none; }
.email-reader-more-item.is-error::before {
  content: '!';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #A6594B;
  color: #FFFEFB;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  line-height: 1;
}

@keyframes email-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.email-reader-body {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 22px 0;
}

.email-reader-iframe {
  width: 100%;
  border: none;
  display: block;
  min-height: 200px;
  opacity: 0;
  transition: opacity 180ms ease;
}
.email-reader-iframe.loaded {
  opacity: 1;
}
[data-theme="light"] .email-reader-iframe,
:root:not([data-theme="dark"]) .email-reader-iframe {
  background: #fff;
  color-scheme: light;
}

/* ── Faint always-there "Oplæs" over the mail's top-right corner ──
   One-click read-aloud for dyslexia; the ⋮ → Oplæs dropdown path stays, this
   is the fast lane. The zero-height anchor sits OUTSIDE the body scroller so
   it survives body innerHTML re-renders; the JS pin makes the icon RIDE with
   the card (scrolling a long mail moves it out of view - Morten 2026-07-10). */
.email-reader-listen-anchor {
  height: 0;
  position: relative;
  z-index: 6;
  display: flex;
  justify-content: flex-end;
  pointer-events: none; /* the zero-height strip must never eat body clicks */
}
/* All rules ride the doubled .email-action-btn.email-reader-listen selector:
   email-responsive.css (loaded later) re-declares plain .email-action-btn
   sizes/svg/transition at equal specificity, and later-order would silently
   override this button's craft values. */
.email-action-btn.email-reader-listen {
  pointer-events: auto;
  position: relative; /* anchors the ::after hit-area */
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  /* reader-listen.js measures the open mail's CARD and pins the icon 12px
     inside its top-right corner via --listen-tx/--listen-ty; composing them
     here (instead of an inline transform) lets pseudo-class transforms keep
     the measured position instead of clobbering it */
  transform: translate(var(--listen-tx, -22px), var(--listen-ty, 12px));
  opacity: 0.45; /* faint until needed */
  border: 1px solid transparent;
  will-change: transform;
  /* transform is deliberately NOT in the transition list: the pin re-measures
     on every scroll frame, and animating toward a target that moves every
     frame reads as the icon elastically chasing the mail ("keeps jumping
     around", Morten 2026-07-03). Position changes land 1:1; the settle burst
     already handles discrete message switches while hidden. */
  transition: background 120ms, color 120ms, opacity 120ms, border-color 120ms;
}
/* invisible 44px hit-area (WCAG 2.5.8) around the 36px pill — the button
   floats alone over the mail, so give fingers and tremor some margin */
.email-action-btn.email-reader-listen::after {
  content: '';
  position: absolute;
  inset: -4px;
}
/* keep the measured position on press — the family's scale(0.95) press rule
   would replace the translate and teleport the icon (transforms don't compose) */
.email-action-btn.email-reader-listen:active {
  transform: translate(var(--listen-tx, -22px), var(--listen-ty, 12px));
}
/* Fresh-measure window: after a message switch reader-listen.js re-measures
   the card over a ~1s settle burst, and the pin can hop across the reader
   while the iframe finds its height — animating those hops read as the icon
   "flying across the screen" (Morten 2026-07-02). Hidden while settling
   (visibility also drops it from the a11y tree and tab order), position
   changes land instantly (transition: none at !important weight — the
   blod-bolge family transition is !important too), then the normal opacity
   fade brings it in at the final spot. */
.email-page .email-action-btn.email-reader-listen.is-offcanvas,
.email-action-btn.email-reader-listen.is-offcanvas {
  /* the pin rode out of the scroller's visible region - never draw in the
     band under the reader header (doubled selector: same cascade armor as
     is-settling below) */
  visibility: hidden;
  opacity: 0 !important;
  pointer-events: none;
}
.email-page .email-action-btn.email-reader-listen.is-settling,
.email-action-btn.email-reader-listen.is-settling {
  visibility: hidden;
  /* !important: the dark-mode idle rule ([data-theme="dark"] …:not(…)×3,
     specificity 0,6,0) otherwise keeps opacity at 0.55 through the settle —
     invisible anyway (visibility wins) but the reveal then has no 0→idle
     delta and POPS instead of fading. Forcing 0 restores the fade in dark. */
  opacity: 0 !important;
  pointer-events: none;
  transition: none !important;
}
.email-action-btn.email-reader-listen:hover,
.email-action-btn.email-reader-listen:focus-visible {
  opacity: 1;
  background: var(--sk-bg-hover, rgba(0,0,0,0.06));
  color: var(--sk-text);
  /* asymmetric fade: arrive crisply (80ms), recede gently (base 120ms) */
  transition: background 120ms, color 120ms, opacity 80ms ease-out, border-color 120ms;
}
.email-action-btn.email-reader-listen:focus-visible {
  outline: 2px solid var(--bb-sage, #6E8A7E);
  outline-offset: 2px;
}
.email-action-btn.email-reader-listen.is-active {
  opacity: 1;
  color: var(--bb-sage-dark, #4A7A68);
  background: rgba(110, 138, 126, 0.10); /* sage tint = reading */
  border-color: rgba(110, 138, 126, 0.15); /* hairline-quiet, not component-library green */
}
/* each state's fresh glyph fades in instead of popping (innerHTML swap);
   18/36 locks the icon-to-button ratio to the header-action family */
.email-action-btn.email-reader-listen svg {
  width: 18px;
  height: 18px;
  animation: email-reader-listen-swap-in 90ms ease;
}
.email-action-btn.email-reader-listen.is-loading svg {
  animation: email-reader-listen-pulse 1.1s ease-in-out infinite;
}
@keyframes email-reader-listen-swap-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes email-reader-listen-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; } /* never dimmer than the idle 0.45 — dipping below reads as "off" */
}
@media (prefers-reduced-motion: reduce) {
  .email-action-btn.email-reader-listen,
  .email-action-btn.email-reader-listen:hover,
  .email-action-btn.email-reader-listen:focus-visible {
    transition: background 120ms, color 120ms, opacity 120ms, border-color 120ms;
  }
  .email-action-btn.email-reader-listen svg,
  .email-action-btn.email-reader-listen.is-loading svg { animation: none; }
}
/* email-blod-bolge.css paints every .email-page .email-action-btn with
   !important color/transition (the family look). The family color is right
   for idle/hover — the icon should match its header neighbours — but the
   READING state must stay sage and the motion values must stay exact.
   Reclaim only those, at the same weight. */
.email-page .email-action-btn.email-reader-listen {
  transition: background 120ms, color 120ms, opacity 120ms, border-color 120ms !important;
}
.email-page .email-action-btn.email-reader-listen:hover,
.email-page .email-action-btn.email-reader-listen:focus-visible {
  transition: background 120ms, color 120ms, opacity 80ms ease-out, border-color 120ms !important;
}
.email-page .email-action-btn.email-reader-listen.is-active {
  color: var(--bb-sage-dark, #4A7A68) !important;
}
@media (prefers-reduced-motion: reduce) {
  .email-page .email-action-btn.email-reader-listen,
  .email-page .email-action-btn.email-reader-listen:hover,
  .email-page .email-action-btn.email-reader-listen:focus-visible {
    transition: background 120ms, color 120ms, opacity 120ms, border-color 120ms !important;
  }
}
/* The Fokus reader has its own focused design — no floating chrome there. */
.is-fokus-reader .email-reader-listen-anchor { display: none; }
@media (max-width: 640px) {
  .email-action-btn.email-reader-listen {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  /* 22/44 matches the family's 18/36 icon-to-button ratio */
  .email-action-btn.email-reader-listen svg { width: 22px; height: 22px; }
}

.email-body-shimmer {
  padding: 16px;
}
.email-body-shimmer-line {
  height: 14px;
  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: email-shimmer 1.5s ease infinite;
  margin-bottom: 10px;
}
.email-body-shimmer-line:nth-child(1) { width: 90%; }
.email-body-shimmer-line:nth-child(2) { width: 75%; }
.email-body-shimmer-line:nth-child(3) { width: 85%; }
.email-body-shimmer-line:nth-child(4) { width: 60%; }
.email-body-shimmer-line:nth-child(5) { width: 70%; }

.email-reader-attachments {
  flex-shrink: 0;
  margin: 0 22px;
  padding: 0;
  border-top: 1px solid var(--divider, #e4e6e8);
}

.email-attachments-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  min-height: 22px;
  font-size: var(--font-size-sm);
  line-height: 19.5px;
  color: var(--sk-text-secondary, #646e78);
  border: 0;
  cursor: pointer;
  transition: color 120ms ease;
}

.email-attachments-header:hover {
  color: var(--sk-text);
}

.email-attachments-chevron {
  margin-left: 4px;
  transition: transform 120ms ease;
}

.email-attachments-chevron.open {
  transform: rotate(180deg);
}

.email-attachments-list {
  padding: 0 16px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.email-attachments-list[hidden] {
  display: none !important;
}

.email-attachment-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--sk-border, #e4e6e8);
  border-radius: 8px;
  background: #fafaf8;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
  font-size: var(--font-size-sm);
  text-decoration: none;
}

.email-attachment-download {
  margin-left: auto;
  opacity: 0.4;
  transition: opacity 180ms ease;
}

.email-attachment-item:hover .email-attachment-download {
  opacity: 1;
}

.email-attachment-item:hover {
  background: var(--sk-bg-hover, rgba(0,0,0,0.04));
  border-color: rgba(0, 0, 0, 0.18);
}

.email-attachment-item svg {
  color: var(--sk-text);
  flex-shrink: 0;
}

.email-attachment-name {
  color: var(--sk-text);
  font-weight: var(--font-weight-medium);
  max-width: 220px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-attachment-size {
  color: var(--sk-text-secondary);
  font-size: var(--font-size-xs);
  opacity: .7;
  white-space: nowrap;
}

.email-attachments-toggle:focus-visible {
  outline: 2px solid var(--sk-focus, #6b8f71);
  outline-offset: -2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .email-attachments-chevron,
  .email-attachments-list {
    transition: none !important;
  }
}

.email-chips-label {
  padding: 8px 16px 0;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text-secondary);
}

.email-chips-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 8px 16px 12px;
  overflow-x: auto;
}

.email-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  min-height: 36px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--sk-text);
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease;
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

.email-chip:hover {
  background: var(--sk-bg-hover);
  border-color: var(--sk-border-strong);
  color: var(--sk-text);
  transform: translateY(-1px);
}

.email-chip:active {
  transform: scale(0.97);
}

.email-context-menu {
  position: fixed;
  background: rgb(251, 248, 242);
  border: 1px solid rgba(92, 77, 67, 0.12);
  border-radius: 14px;
  box-shadow: rgba(71, 52, 45, 0.04) 0px 1px 2px 0px, rgba(71, 52, 45, 0.10) 0px 12px 32px 0px;
  min-width: 220px;
  padding: 6px;
  z-index: 10060;
  font-size: var(--font-size-base);
  text-align: left;
}
.email-context-menu.is-reading {
  box-shadow: 0 1px 2px rgba(58,47,38,0.04), 0 12px 32px rgba(58,47,38,0.12), 0 0 0 2px rgba(110, 138, 126, 0.18);
}
.email-context-menu.is-reading::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #4A7A68 0 var(--calm-oplaes-progress-pct, 0%), rgba(74,122,104,0.15) var(--calm-oplaes-progress-pct, 0%) 100%);
  pointer-events: none;
}
.email-context-menu.is-reading.is-indeterminate::after {
  background: linear-gradient(90deg, rgba(74,122,104,0.15) 0%, #4A7A68 50%, rgba(74,122,104,0.15) 100%);
  background-size: 250% 100%;
  animation: calm-progress-indeterminate 1.4s linear infinite;
}
@keyframes calm-progress-indeterminate {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.calm-context-landmark {
  font-size: var(--font-size-xs);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgb(154, 142, 130);
  padding: 10px 12px 4px;
  line-height: 1;
  margin: 0;
  user-select: none;
}
.calm-context-separator {
  height: 1px;
  margin: 6px 8px;
  background: rgba(58, 47, 38, 0.08);
  border: 0;
}
.email-context-item {
  display: grid;
  grid-template-columns: 20px 1fr;
  justify-items: start;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 36px;
  height: auto;
  padding: 8px 12px;
  font-size: var(--font-size-base);
  font-weight: 400;
  letter-spacing: 0.2px;
  line-height: 1.2;
  color: rgb(58, 47, 38);
  cursor: pointer;
  border: none;
  border-radius: 10px;
  background: transparent;
  text-align: left;
}
@media (prefers-reduced-motion: no-preference) {
  .email-context-item { transition: background 120ms, color 120ms; }
}
.email-context-item > span {
  justify-self: start;
  text-align: left;
  width: 100%;
  font-weight: inherit;
}
.email-context-item:hover,
.email-context-item.ss-active {
  background: rgba(58, 47, 38, 0.06);
  color: rgb(58, 47, 38);
}
.email-context-item:active {
  background: rgba(58, 47, 38, 0.08);
}
.email-context-item:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px rgb(58, 47, 38);
}
.email-context-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.75;
  stroke: currentColor;
  color: rgb(154, 142, 130);
  opacity: 1;
  justify-self: center;
}
.email-context-item:hover svg,
.email-context-item.ss-active svg { color: rgb(58, 47, 38); }
.email-context-divider { height: 1px; background: rgba(58, 47, 38, 0.08); margin: 6px 8px; border: 0; }
.email-context-item.danger,
.email-context-item.is-destructive { color: rgb(168, 76, 68); }
.email-context-item.danger:hover,
.email-context-item.is-destructive:hover { background: rgba(168, 76, 68, 0.06); color: rgb(168, 76, 68); }
.email-context-item.danger:active,
.email-context-item.is-destructive:active { background: rgba(168, 76, 68, 0.10); }
.email-context-item.danger svg,
.email-context-item.is-destructive svg { color: rgb(168, 76, 68); }
.email-context-item.danger:hover svg,
.email-context-item.is-destructive:hover svg { color: rgb(168, 76, 68); }
.email-context-item.is-active,
.email-context-item[aria-current="true"] { background: rgba(110, 138, 126, 0.14); color: #4A7A68; }
@media (pointer: coarse) {
  .email-context-item { min-height: 44px; }
}
.email-context-more-btn {
  justify-content: center;
  color: #9A8E82;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 8px 12px;
}
.email-context-more-btn:hover { background: rgba(58, 47, 38, 0.04); color: #5C4D43; }
.email-context-more-dots { font-size: var(--font-size-lg); letter-spacing: 3px; color: inherit; line-height: 1; }
.email-context-more-btn:hover .email-context-more-dots { color: #5C4D43; }
.email-context-back { color: #9A8E82; font-size: var(--font-size-sm); }
.email-context-back:hover { color: #5C4D43; }

/* ── Oplæs state: loading ── */
.email-context-item.is-loading {
  pointer-events: none;
  background: rgba(58,47,38,0.04);
  color: #5C4D43;
  position: relative;
}
.email-context-item.is-loading > svg { display: none; }
.email-context-item.is-loading::before {
  content: '';
  display: block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 2px solid rgba(110,138,126,0.25);
  border-top-color: #4A7A68;
  border-radius: 50%;
  animation: calm-spin .7s linear infinite;
  box-sizing: border-box;
}
.email-context-item.is-loading > span::after { content: ' \2026'; opacity: .6; }
@keyframes calm-spin { to { transform: rotate(360deg); } }

/* ── Oplæs state: playing ── */
.email-context-item.is-playing {
  background: rgba(110,138,126,0.12);
  color: #4A7A68;
  position: relative;
}
.email-context-item.is-playing > svg { display: none; }
.email-context-item.is-playing::before {
  content: '';
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 16px;
  height: 14px;
  flex-shrink: 0;
  background:
    linear-gradient(#4A7A68, #4A7A68) 0px 0/2px 40%,
    linear-gradient(#4A7A68, #4A7A68) 4px 0/2px 80%,
    linear-gradient(#4A7A68, #4A7A68) 8px 0/2px 60%,
    linear-gradient(#4A7A68, #4A7A68) 12px 0/2px 90%;
  background-repeat: no-repeat;
  background-position-y: bottom;
  animation: calm-eq .9s ease-in-out infinite alternate;
}
@keyframes calm-eq {
  0%   { background-size: 2px 40%, 2px 80%, 2px 60%, 2px 90%; }
  50%  { background-size: 2px 90%, 2px 30%, 2px 100%, 2px 50%; }
  100% { background-size: 2px 40%, 2px 80%, 2px 60%, 2px 90%; }
}

/* ── Oplæs state: stopping ── */
.email-context-item.is-stopping {
  background: rgba(166,89,75,0.08);
  color: #A6594B;
  position: relative;
}
.email-context-item.is-stopping > svg { display: none; }
.email-context-item.is-stopping::before {
  content: '';
  display: block;
  width: 16px;
  height: 14px;
  flex-shrink: 0;
  background:
    linear-gradient(#A6594B, #A6594B) 0px 0/2px 60%,
    linear-gradient(#A6594B, #A6594B) 4px 0/2px 60%,
    linear-gradient(#A6594B, #A6594B) 8px 0/2px 60%,
    linear-gradient(#A6594B, #A6594B) 12px 0/2px 60%;
  background-repeat: no-repeat;
  background-position-y: bottom;
  opacity: .6;
}

/* ── Oplæs state: done ── */
.email-context-item.is-done {
  color: #4A7A68;
}
.email-context-item.is-done > svg { display: none; }
.email-context-item.is-done::before {
  content: '';
  display: block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='none' stroke='%234A7A68' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 8.5l3.5 3.5 6.5-8'/%3E%3C/svg%3E") center/16px no-repeat;
  animation: calm-pop .25s ease-out;
}
@keyframes calm-pop {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

/* ── Oplæs state: error ── */
.email-context-item.is-error {
  background: rgba(166,89,75,0.06);
  color: #A6594B;
}
.email-context-item.is-error > svg { display: none; }
.email-context-item.is-error::before {
  content: '!';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #A6594B;
  color: #FFFEFB;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  line-height: 1;
}

/* ── Stop sibling row ── */
.calm-stop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 2px 0;
  padding: 8px 10px 8px 38px;
  width: calc(100% - 4px);
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #A6594B;
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms;
}
.calm-stop-row:hover { background: rgba(166,89,75,0.08); }
.calm-stop-row:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(166,89,75,0.35) inset;
}
.calm-stop-row:active { transform: scale(0.995); }
.calm-stop-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.calm-stop-square {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #A6594B;
}
.calm-esc-hint {
  font-size: var(--font-size-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #9A8E82;
  background: rgba(58,47,38,0.05);
  border: 1px solid rgba(58,47,38,0.08);
  border-radius: 4px;
  padding: 2px 5px;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .email-context-item.is-playing::before { animation: none; }
  .email-context-item.is-loading::before { animation-duration: 1.4s; }
  .email-context-menu.is-reading.is-indeterminate::after { animation: none; }
}

.email-snooze-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--sk-toast-bg, #3A2F26);
  color: var(--sk-toast-text, #FFFEFB);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  z-index: 10000;
  font-size: var(--font-size-base);
  box-shadow: var(--sk-toast-shadow, 0 4px 16px rgba(0, 0, 0, 0.08));
}

.email-snooze-btn-wrapper { display: inline-block; position: relative; }
.email-snooze-btn:hover { color: var(--sk-text); }
.email-snooze-btn[aria-expanded="true"] {
  color: var(--sk-text);
  background: var(--sk-bg-hover, rgba(0,0,0,0.04));
}
.email-snooze-dropdown {
  position: fixed;
  z-index: 10050;
  background: var(--sk-bg-surface);
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 28px rgba(31, 31, 30, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
  min-width: 220px;
  padding: 4px;
  animation: moreDropIn 150ms cubic-bezier(0.16, 1, 0.3, 1);
}
.email-snooze-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
  font-size: var(--font-size-base);
  color: var(--sk-text);
  transition: background 120ms;
}
.email-snooze-option svg {
  flex-shrink: 0;
  color: var(--sk-text-secondary);
  transition: color 120ms;
}
.email-snooze-option:hover { background: var(--sk-bg-hover, rgba(0,0,0,0.04)); }
.email-snooze-option:hover svg { color: var(--sk-text); }
.email-snooze-custom {
  padding: 8px 12px;
  border-top: 0.5px solid var(--sk-border);
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.email-snooze-custom label { font-size: var(--font-size-sm); color: var(--sk-text-secondary); }
.email-snooze-picker {
  width: 100%;
  padding: 8px 12px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  background: var(--sk-bg);
  color: var(--sk-text);
  min-height: 34px;
}
.email-snooze-confirm {
  padding: 8px 14px;
  min-height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--sk-text);
  color: var(--email-control-on-fill);
  font-size: var(--font-size-base);
  transition: opacity 120ms;
}
.email-snooze-confirm:hover { opacity: 0.9; }

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

.email-block-btn {
  color: var(--sk-text-secondary);
}
.email-block-btn:hover {
  background: rgba(194,75,96,0.08);
  color: var(--sk-danger);
}

.email-not-spam-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--sk-text);
}
.email-not-spam-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}
.email-not-spam-btn span {
  display: inline;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.email-attachment-thumbnails {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.email-attachment-thumb {
  display: flex;
  flex-direction: column;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 180ms ease, box-shadow 180ms ease;
  max-width: 220px;
}

.email-attachment-thumb:hover {
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.email-attachment-thumb-img {
  width: 200px;
  height: 140px;
  overflow: hidden;
  background: var(--sk-bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.email-attachment-thumb-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.email-attachment-thumb-name {
  padding: 4px 8px 0;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--sk-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-attachment-thumb-size {
  padding: 0 8px 4px;
  font-size: var(--font-size-xs);
  color: var(--sk-text-secondary);
}

.email-attachment-thumb {
  position: relative;
}

.email-attachment-thumb-download {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.85);
  color: var(--sk-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 180ms ease, background 180ms ease;
  z-index: 1;
}

.email-attachment-thumb:hover .email-attachment-thumb-download {
  opacity: 1;
}

.email-attachment-thumb-download:hover {
  background: rgba(255,255,255,1);
  color: var(--sk-accent);
}

.email-attachment-pdf-preview {
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 8px;
}

.email-attachment-pdf-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: background 180ms ease;
}

.email-attachment-pdf-header:hover {
  background: rgba(0, 0, 0, 0.04);
}

.email-attachment-pdf-frame object {
  display: block;
}

/* Busy state while an attachment download/preview-fetch is in flight: swap the
   download glyph for a spinner and ignore further clicks. Fetches can take
   seconds on big files; without feedback users double-click and get duplicate
   downloads. Class is set/removed by _downloadAttachmentGuarded (contacts.js). */
.email-attachment-item.is-downloading,
.email-attachment-thumb-download.is-downloading,
.email-attachment-download-btn.is-downloading,
.email-attachment-pdf-header.is-downloading {
  pointer-events: none;
  cursor: progress;
}

.email-attachment-thumb-download.is-downloading {
  opacity: 1; /* button hides until thumb hover; spinner must stay visible after tap (mobile has no hover) */
}

.email-attachment-download-btn.is-downloading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.email-attachment-item.is-downloading .email-attachment-download,
.email-attachment-thumb-download.is-downloading svg,
.email-attachment-download-btn.is-downloading svg {
  display: none;
}

.email-attachment-item.is-downloading::after,
.email-attachment-thumb-download.is-downloading::after,
.email-attachment-download-btn.is-downloading::after,
.email-attachment-pdf-header.is-downloading::after {
  content: '';
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border: 2px solid var(--sk-border, rgba(0, 0, 0, 0.15));
  border-top-color: var(--sk-text-secondary, #646e78);
  border-radius: var(--radius-full, 50%);
  animation: email-attachment-spin 0.7s linear infinite;
}

.email-attachment-item.is-downloading::after {
  margin-left: auto; /* takes the hidden download glyph's slot */
}

.email-attachment-pdf-header.is-downloading::after {
  margin-left: 8px;
}

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

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

.email-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
}

.email-lightbox-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 90vh;
  z-index: 1;
}

.email-lightbox-img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  user-select: none;
}

.email-lightbox-download {
  position: fixed;
  top: 16px;
  right: 64px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.15);
  color: var(--sk-text-on-accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 180ms ease;
  z-index: 2;
}

.email-lightbox-download:hover {
  background: rgba(255,255,255,0.3);
}

.email-lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.15);
  color: var(--sk-text-on-accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 180ms ease;
  z-index: 2;
}

.email-lightbox-close:hover {
  background: rgba(255,255,255,0.3);
}

.email-lightbox-prev,
.email-lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.15);
  color: var(--sk-text-on-accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 180ms ease;
  z-index: 2;
}

.email-lightbox-prev { left: 16px; }
.email-lightbox-next { right: 16px; }

.email-lightbox-prev:hover,
.email-lightbox-next:hover {
  background: rgba(255,255,255,0.3);
}

.email-lightbox-caption {
  color: rgba(255,255,255,0.8);
  font-size: var(--font-size-base);
  margin-top: 12px;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.email-reply-later-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--sk-text-secondary);
}

.email-reply-later-btn span {
  display: inline;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.email-reply-later-btn:hover {
  background: rgba(245,158,11,0.08);
  color: var(--sk-warning);
}

.email-reply-later-btn.active {
  color: var(--sk-warning);
}

.email-reply-later-btn.active span {
  font-weight: var(--font-weight-semibold);
}

.email-feed-promote-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--sk-text-secondary);
}

.email-feed-promote-btn span {
  
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.email-feed-promote-btn:hover {
  background: var(--sk-bg-hover, rgba(0,0,0,0.04));
  color: var(--sk-text);
}

.email-instant-preview {
  padding: 16px;
  font-size: var(--font-size-md);
  line-height: 1.6;
  color: var(--sk-text);
  animation: email-fade-in 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.email-instant-preview p {
  margin: 0 0 12px;
}
.email-instant-preview-loading {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  opacity: 0.4;
}

.email-thread-view {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.email-body-outgoing {
  opacity: 0.3;
  transition: opacity 180ms ease;
  pointer-events: none;
}

.email-thread-message {
  border-bottom: 0.5px solid var(--sk-border);
  transition: background 120ms ease;
}
.email-thread-message:last-child {
  border-bottom: none;
}

.email-thread-message.collapsed {
  cursor: pointer;
}
.email-thread-message.collapsed:hover {
  background: var(--sk-bg-hover, rgba(0,0,0,0.04));
}
.email-thread-message.collapsed:focus-visible {
  outline: 2px solid var(--sk-focus, #3D6B57);
  outline-offset: -2px;
}

.email-thread-msg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  min-height: 38px;
  overflow: hidden;
}

.email-thread-avatar {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text-on-accent);
  line-height: 1;
  opacity: 0.85;
}

.email-thread-message.expanded .email-thread-avatar {
  width: 28px;
  height: 28px;
  font-size: var(--font-size-sm);
  opacity: 1;
}

.email-thread-msg-sender {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text);
  white-space: nowrap;
  flex-shrink: 0;
}

.email-thread-msg-snippet {
  font-size: var(--font-size-sm);
  color: var(--sk-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.email-thread-message.expanded .email-thread-msg-snippet {
  display: none;
}

.email-thread-msg-date {
  font-size: var(--font-size-xs);
  color: var(--sk-text-secondary);
  flex-shrink: 0;
  white-space: nowrap;
}

.email-thread-msg-body {
  overflow: hidden;
  transition: max-height 180ms ease, opacity 180ms ease;
}
.email-thread-message.collapsed .email-thread-msg-body {
  max-height: 0;
  opacity: 0;
  padding: 0;
}
.email-thread-message.expanded .email-thread-msg-body {
  max-height: none;
  opacity: 1;
  padding: 0 16px 12px;
}

.email-thread-message.expanded .email-thread-msg-header {
  padding: 8px 16px;
  border-bottom: 0.5px solid var(--sk-border);
}
.email-thread-message.expanded .email-thread-msg-sender {
  font-size: var(--font-size-base);
}

.email-thread-msg-body .email-reader-iframe {
  min-height: 0;
  overflow: hidden;
}

.email-thread-older-group {
  border-bottom: 0.5px solid var(--sk-border);
}
.email-thread-older-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 4px 16px;
  border: none;
  background: transparent;
  color: var(--sk-text-secondary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: background 120ms, color 120ms;
  text-align: left;
  min-height: 32px;
}
.email-thread-older-btn:hover {
  background: var(--sk-bg-hover, rgba(0,0,0,0.04));
  color: var(--sk-text);
}
.email-thread-older-dots {
  letter-spacing: 2px;
  font-size: var(--font-size-xs);
}
.email-thread-older-btn.open {
  border-bottom: 0.5px solid var(--sk-border);
}
.email-thread-older-list {
  background: var(--sk-bg-subtle);
}

.email-thread-msg-expand-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--sk-text-secondary);
  transition: transform 180ms ease;
}
.email-thread-message.expanded .email-thread-msg-expand-icon {
  transform: rotate(180deg);
}

.email-thread-separator {
  height: 0.5px;
  background: var(--sk-border);
  margin: 0 16px;
}

.email-reader-thread-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-sm);
  color: var(--sk-text-secondary);
  margin-top: 4px;
}

.email-reader-thread-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--sk-bg-hover, rgba(0,0,0,0.04));
  color: var(--sk-text-secondary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  padding: 1px 7px;
  border-radius: var(--radius-lg);
}

.email-reader-thread-participants {
  color: var(--sk-text-secondary);
  font-size: var(--font-size-sm);
}

@keyframes email-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.meeting-cards-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px 4px;
}

.meeting-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--email-soft-highlight);
  border: 0.5px solid var(--email-soft-border);
  border-radius: var(--radius-lg);
  animation: email-fade-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.meeting-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: var(--email-soft-highlight-strong);
  color: var(--sk-text);
}

.meeting-card-icon svg {
  width: 18px;
  height: 18px;
}

.meeting-card-icon-calendar {
  background: rgba(245, 158, 11, 0.10);
  color: var(--sk-warning);
}

.meeting-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.meeting-card-provider {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--sk-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.meeting-location {
  font-style: italic;
}

.meeting-join-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  color: var(--sk-text);
  border: 2px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-family);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 180ms ease, border-color 180ms ease;
}

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

.meeting-join-btn:active {
  transform: scale(0.97);
}

.meeting-join-btn svg {
  flex-shrink: 0;
}

.meeting-card-calendar {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.15);
}

.meeting-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.meeting-cal-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  min-height: 44px;
  border: 0.5px solid var(--sk-border);
  border-radius: var(--radius-md, 8px);
  background: var(--sk-surface);
  color: var(--sk-text);
  font-size: var(--font-size-sm, 13px);
  font-weight: var(--font-weight-semibold, 600);
  font-family: var(--font-family, inherit);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}
.meeting-cal-btn svg {
  flex-shrink: 0;
}
.meeting-cal-btn:hover {
  border-color: var(--color-info);
  color: var(--color-info);
  background: rgba(59, 130, 246, 0.06);
}
.meeting-cal-btn.is-loading {
  opacity: 0.6;
  pointer-events: none;
}
.meeting-cal-btn.is-added {
  border-color: var(--color-success);
  color: var(--color-success);
  background: rgba(34, 197, 94, 0.06);
  pointer-events: none;
}
.meeting-cal-btn.is-duplicate {
  border-color: var(--color-text-secondary);
  color: var(--color-text-secondary);
  pointer-events: none;
  opacity: 0.7;
}
.meeting-cal-btn.meeting-cal-btn-sm {
  padding: 6px 10px;
  min-height: 36px;
  font-size: var(--font-size-xs);
}

.meeting-cal-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--sk-border);
  border-top-color: var(--email-control-fill);
  border-radius: 50%;
  animation: meeting-cal-spin 0.6s linear infinite;
  flex-shrink: 0;
}
@keyframes meeting-cal-spin {
  to { transform: rotate(360deg); }
}

.meeting-date-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(245, 158, 11, 0.06);
  border: 0.5px solid rgba(245, 158, 11, 0.15);
  border-radius: var(--radius-md, 8px);
  animation: email-fade-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.meeting-date-chip-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: var(--radius-sm, 6px);
  background: rgba(245, 158, 11, 0.10);
  color: var(--sk-warning);
}
.meeting-date-chip-icon svg {
  width: 14px;
  height: 14px;
}
.meeting-date-chip-text {
  flex: 1;
  font-size: var(--font-size-sm, 13px);
  color: var(--sk-text-secondary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meeting-date-chip-status.is-duplicate {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  white-space: nowrap;
}
.meeting-chip-dismiss {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--sk-text-secondary, var(--color-text-secondary));
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  transition: background 120ms, color 120ms;
}
.meeting-chip-dismiss:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--sk-text);
}
.email-meeting-bar {
  padding: 0 16px;
}
.email-meeting-bar:empty {
  display: none;
}


.link-suspicious {
  outline: 2px solid var(--sk-warning);
  outline-offset: 1px;
  border-radius: var(--radius-sm);
  position: relative;
}

.link-safety-tooltip {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  z-index: 10000;
  background: var(--color-bg);
  color: var(--sk-toast-text);
  font-size: var(--font-size-sm);
  line-height: 1.4;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--sk-warning);
  max-width: 360px;
  white-space: normal;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  font-family: var(--font-family);
}

.link-suspicious:hover .link-safety-tooltip,
.link-suspicious:focus .link-safety-tooltip {
  display: block;
}

/* --- Label picker (shared by context menu + reader more menu) --- */
.email-label-picker {
  position: fixed;
  background: var(--color-card);
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.08);
  min-width: 180px;
  max-width: 260px;
  padding: 6px 4px;
  z-index: 10070;
}
.email-label-picker-title {
  padding: 6px 12px 4px;
  font-size: var(--font-size-sm, 12px);
  font-weight: 600;
  color: var(--sk-text-tertiary, #8B8070);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.email-label-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  min-height: 36px;
  margin: 0;
  font-size: var(--font-size-base);
  color: var(--sk-text-secondary);
  cursor: pointer;
  width: 100%;
  border: none;
  border-radius: 6px;
  background: transparent;
  transition: background 120ms, color 120ms;
}
.email-label-picker-item:hover,
.email-label-picker-item.is-focused {
  background: rgba(0, 0, 0, 0.04);
  color: var(--sk-text);
}
.email-label-picker-item:focus-visible {
  outline: 2px solid var(--sk-focus, #3D6B57);
  outline-offset: -2px;
}
.email-label-picker-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.email-label-picker-name {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.email-label-picker-check {
  width: 16px;
  text-align: center;
  font-size: var(--font-size-sm);
  color: #3D6B57;
  flex-shrink: 0;
}

/* ===== Reader overflow menu — calm foldout refinement (Morten) =====
   Light-mode literals; dark keeps its own colours (email-darkmode.css loads later and
   out-orders these at equal specificity). Menu is portaled to <body>: no .email-page prefix. */
.email-reader-more-menu {
  width: 250px;
  min-width: 0;
  padding: 5px;
  background: #FFFDFB;
  box-shadow: 0 1px 2px rgba(71, 52, 45, 0.04), 0 14px 36px rgba(71, 52, 45, 0.12);
}
.email-reader-more-menu .email-reader-more-group-heading {
  font-size: var(--email-fs-micro);
  letter-spacing: 0.6px;
  color: rgba(58, 47, 38, 0.42);
  padding: 8px 12px 3px;
  margin: 0 6px;
  border-top: 0;
}
.email-reader-more-menu .email-reader-more-group-heading.calm-destructive-heading { color: rgb(168, 76, 68); }
.email-reader-more-menu .email-reader-more-separator,
.email-reader-more-menu .email-reader-more-sep {
  background: rgba(92, 77, 67, 0.10);
  margin: 4px 8px;
}
.email-reader-more-menu .email-reader-more-item {
  min-height: 0;
  height: 32px;
  padding: 6px 12px;
  gap: 11px;
  border-radius: 8px;
  font-size: var(--email-fs-body-sm);
}
.email-reader-more-menu .email-reader-more-item:hover,
.email-reader-more-menu .email-reader-more-item.is-focused {
  background: rgba(110, 138, 126, 0.12);
}
.email-reader-more-menu .email-reader-more-item .calm-icon {
  width: 17px;
  height: 17px;
  color: rgba(58, 47, 38, 0.65);
  opacity: 0.75;
}
.email-reader-more-menu .email-reader-more-item .calm-icon svg { width: 17px; height: 17px; }
.email-reader-more-menu .email-reader-more-item.is-destructive:hover,
.email-reader-more-menu .email-reader-more-item.is-destructive.is-focused {
  background: rgba(168, 76, 68, 0.10);
}
/* Foldout: collapse ORGANISÉR + FJERN behind the "Flere handlinger" toggle. */
.email-reader-more-menu[data-ss-expanded="0"] [data-ss-secondary] { display: none; }
.email-reader-more-menu .ss-more-foldout-toggle { color: rgba(58, 47, 38, 0.6); font-weight: 500; }
.email-reader-more-menu .ss-more-foldout-toggle .calm-icon { color: rgba(58, 47, 38, 0.5); }
.email-reader-more-menu .ss-more-foldout-toggle:hover { background: rgba(58, 47, 38, 0.05); color: rgb(58, 47, 38); }
.email-reader-more-menu .ss-more-foldout-toggle svg { transition: transform 150ms ease; }
.email-reader-more-menu[data-ss-expanded="1"] .ss-more-foldout-toggle svg { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) {
  .email-reader-more-menu .ss-more-foldout-toggle svg { transition: none; }
}

/* ===== .email-context-menu — 1:1 match of the calm reader overflow menu (Morten) =====
   Class-based, light-mode literals; dark keeps its own colours (later sheet, equal specificity).
   Portaled to <body>: no .email-page prefix. Read-aloud states (is-loading/playing/...) untouched. */
.email-context-menu {
  background: #FFFDFB;
  box-shadow: 0 1px 2px rgba(71, 52, 45, 0.04), 0 14px 36px rgba(71, 52, 45, 0.12);
  padding: 5px;
  font-size: var(--email-fs-body-sm);
}
.email-context-menu .calm-context-landmark {
  font-size: var(--email-fs-micro);
  letter-spacing: 0.6px;
  color: rgba(58, 47, 38, 0.42);
  padding: 8px 12px 3px;
  margin: 0 6px;
}
.email-context-menu .calm-context-separator,
.email-context-menu .email-context-divider {
  background: rgba(92, 77, 67, 0.10);
  margin: 4px 8px;
}
.email-context-menu .email-context-item {
  grid-template-columns: 18px 1fr;
  min-height: 32px;
  height: 32px;
  padding: 6px 12px;
  gap: 11px;
  border-radius: 8px;
  font-size: var(--email-fs-body-sm);
  letter-spacing: 0;
}
.email-context-menu .email-context-item:hover,
.email-context-menu .email-context-item.ss-active,
.email-context-menu .email-context-item.is-focused {
  background: rgba(110, 138, 126, 0.12);
  color: rgb(58, 47, 38);
}
.email-context-menu .email-context-item:active { background: rgba(110, 138, 126, 0.16); }
.email-context-menu .email-context-item:focus-visible { outline: none; box-shadow: rgb(58, 47, 38) 0 0 0 2px inset; }
.email-context-menu .email-context-item svg,
.email-context-menu .email-context-item .calm-icon svg {
  width: 17px;
  height: 17px;
  opacity: 0.75;
  color: rgba(58, 47, 38, 0.65);
  stroke-width: 1.75;
}
.email-context-menu .email-context-item:hover svg,
.email-context-menu .email-context-item.ss-active svg,
.email-context-menu .email-context-item:hover .calm-icon svg { color: rgb(58, 47, 38); opacity: 1; }
.email-context-menu .email-context-item.danger:hover,
.email-context-menu .email-context-item.is-destructive:hover { background: rgba(168, 76, 68, 0.10); color: rgb(168, 76, 68); }
.email-context-menu .email-context-more-btn,
.email-context-menu .email-context-back { color: rgba(58, 47, 38, 0.6); font-weight: 500; letter-spacing: 0.08em; }
.email-context-menu .email-context-more-btn:hover,
.email-context-menu .email-context-back:hover { background: rgba(58, 47, 38, 0.05); color: rgb(58, 47, 38); }

/* ===== Footer action bar + inline AI-hjælp panel + sender line (Part A, Morten) =====
   One calm action bar: Svar (primary) / Videresend (ghost) / quiet AI-hjælp. AI-hjælp
   replaces itself in place on the same row with the dictation pill (no element above
   the bar). Header Svar removed in markup; sender line = name + Vis detaljer only.
   email-calm-preview.css fully !important-controls the input zone (the old always-on
   pill), so the input-zone rules below carry !important + #id specificity to win; the
   new .ss-fbtn buttons are unstyled there so they stay plain. Dark overrides re-theme
   the pill/ghost/AI (my light !important would otherwise leak into dark); sender-line
   selectors stay (0,2,0) so email-darkmode.css wins by source-order. */
:root {
  --ss-reply-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 17 4 12 9 7'/%3E%3Cpath d='M20 18v-2a4 4 0 0 0-4-4H4'/%3E%3C/svg%3E");
  --ss-forward-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 17 20 12 15 7'/%3E%3Cpath d='M4 18v-2a4 4 0 0 1 4-4h12'/%3E%3C/svg%3E");
}

#email-reader-reply { display: block !important; padding: 12px 22px 18px !important; }
#email-reader-reply .ss-footer-actionbar { display: flex; flex-direction: row; align-items: center; gap: 10px; }

#email-reader-reply .ss-fbtn {
  height: 42px; padding: 0 20px; border-radius: 12px; font-size: var(--font-size-base); font-weight: 600;
  font-family: inherit; cursor: pointer; border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto;
}
#email-reader-reply .ss-fbtn--primary { background: rgb(110,138,126); color: rgb(255,254,251); }
#email-reader-reply .ss-fbtn--primary:hover { background: rgb(96,123,111); }
#email-reader-reply .ss-fbtn--ghost { background: transparent; color: rgba(58,47,38,0.78); border-color: rgba(92,77,67,0.20); }
#email-reader-reply .ss-fbtn--ghost:hover { background: rgba(58,47,38,0.05); border-color: rgba(92,77,67,0.32); }
#email-reader-reply .ss-fbtn--ai { background: rgba(110,138,126,0.12); color: rgb(74,98,86); margin-left: auto; }
#email-reader-reply .ss-fbtn--ai:hover { background: rgba(110,138,126,0.20); }
#email-reader-reply .ss-footer-actionbar[data-ai-open="1"] .ss-fbtn--ai { display: none; }

#email-reader-reply .ss-fbtn--primary::before {
  content: ""; width: 16px; height: 16px; margin-right: 1px; display: inline-block;
  background-color: currentColor; -webkit-mask: var(--ss-reply-arrow) center / contain no-repeat; mask: var(--ss-reply-arrow) center / contain no-repeat;
}
#email-reader-reply .ss-fbtn--ghost::before {
  content: ""; width: 16px; height: 16px; margin-right: 1px; display: inline-block;
  background-color: currentColor; -webkit-mask: var(--ss-forward-arrow) center / contain no-repeat; mask: var(--ss-forward-arrow) center / contain no-repeat;
}
#email-reader-reply .ss-fbtn--ai::before { content: "\2726"; font-size: var(--font-size-sm); opacity: .9; margin-right: 2px; }

/* Inline AI-hjælp / STT panel — !important to beat email-calm-preview's always-on pill */
#email-reader-reply .email-reply-input-zone { display: none !important; order: 9 !important; margin-left: auto !important; flex: 1 1 auto !important; min-width: 0 !important; }
#email-reader-reply .ss-footer-actionbar[data-ai-open="1"] .email-reply-input-zone[data-ss-foldout="open"],
#email-reader-reply .email-reply-input-zone[data-ss-foldout="open"] { display: flex !important; flex-direction: row !important; align-items: center !important; }
#email-reader-reply .email-reply-input-zone .email-reply-input-wrap {
  width: 100% !important; height: 42px !important; min-height: 42px !important; border-radius: 12px !important; background: rgb(255,254,251) !important;
  border: 1px solid rgba(92,77,67,0.16) !important; box-shadow: none !important; padding: 0 8px 0 6px !important; gap: 6px !important;
  display: flex !important; flex-direction: row !important; align-items: center !important;
}
/* Focus must be re-stated at this specificity: the base border above out-ranks
   email-calm-preview's canonical :focus-within (0,4,0) — without this the pill
   shows no focus at all. Consumes the canonical warm-neutral tokens (sage is
   contract-banned in reply focus). */
#email-reader-reply .email-reply-input-zone .email-reply-input-wrap:focus-within {
  border-color: var(--reply-pill-border-focus, rgba(92,77,67,0.55)) !important;
  box-shadow: var(--reply-pill-shadow-focus, 0 0 0 2px rgba(92,77,67,0.08)) !important;
}
#email-reader-reply .email-reply-input-zone .email-reply-input { font-size: var(--font-size-base) !important; font-weight: 500 !important; color: rgb(58,47,38) !important; background: transparent !important; border: 0 !important; flex: 1 1 auto !important; min-width: 0 !important; height: 100% !important; }
#email-reader-reply .email-reply-input-zone .email-reply-mic { width: 34px !important; height: 34px !important; min-width: 34px !important; min-height: 0 !important; border-radius: 999px !important; opacity: .85 !important; flex: 0 0 auto !important; position: relative !important; }
#email-reader-reply .email-reply-input-zone .email-reply-mic:hover { opacity: 1 !important; }
#email-reader-reply .email-reply-input-zone .email-reply-mic:disabled { opacity: .35 !important; cursor: default !important; }
#email-reader-reply .email-reply-input-zone .email-reply-mic.email-mic-error { background: rgba(178,120,100,0.14) !important; color: #B27864 !important; opacity: 1 !important; }
/* Mic lifecycle (Morten-approved): click = the icon breathes while the socket
   connects (NO tint — "vent"); sage tint + soft ring arrive ONLY when stt
   reports listening ("tal nu") — words are captured from that moment, so the
   colour must not lie earlier. Classes come from shared/js/stt.js; the shared
   stt.css is NOT loaded on /email/, so these are the only state styles. No
   pointer-events:none here — a click mid-connect must still cancel. */
#email-reader-reply .email-reply-input-zone .email-reply-mic.ss-mic--connecting { opacity: 1 !important; background: transparent !important; }
#email-reader-reply .email-reply-input-zone .email-reply-mic.ss-mic--connecting svg { animation: ssReplyMicBreath 1.4s ease-in-out infinite !important; }
#email-reader-reply .email-reply-input-zone .email-reply-mic.ss-mic--listening { background: rgba(74,122,104,0.14) !important; color: #4A7A68 !important; opacity: 1 !important; }
#email-reader-reply .email-reply-input-zone .email-reply-mic.ss-mic--listening::after { content: ''; position: absolute; inset: 0; border-radius: inherit; border: 1.5px solid rgba(74,122,104,0.55); animation: ssReplyMicRing 1.6s ease-out infinite; pointer-events: none; }
/* Close-the-panel × lives at the pill's LEFT edge (order:-1): visually "collapse",
   and away from Lav udkast so a missed tap can't discard the user's stikord. */
#email-reader-reply .email-reply-input-zone .ss-ai-close {
  order: -1 !important;
  width: 34px !important; height: 34px !important; min-width: 34px !important; min-height: 0 !important; border-radius: 999px !important; background: transparent !important; border: 0 !important; padding: 0 !important;
  font-size: var(--email-fs-heading-sm) !important; line-height: 1 !important; color: rgba(58,47,38,0.6) !important; cursor: pointer !important;
  display: inline-flex !important; align-items: center !important; justify-content: center !important; flex: 0 0 auto !important;
}
#email-reader-reply .email-reply-input-zone .ss-ai-close:hover { color: rgba(58,47,38,0.85) !important; background: rgba(58,47,38,0.06) !important; }
#email-reader-reply .email-reply-input-zone .email-reply-draft {
  height: 36px !important; min-height: 36px !important; min-width: 0 !important; width: auto !important; border-radius: 8px !important; padding: 0 14px !important; align-self: center !important;
  background: rgb(110,138,126) !important; color: rgb(255,254,251) !important; font-size: var(--font-size-sm) !important; font-weight: 600 !important; box-shadow: none !important; flex: 0 0 auto !important; border: 0 !important;
}
#email-reader-reply .email-reply-input-zone .email-reply-draft:hover { background: rgb(96,123,111) !important; }
/* Approved A: while the draft is written the pill shows life — a thin sage
   line sweeps along the pill's bottom edge and the placeholder breathes.
   The pill must be overflow:visible at rest: email-calm-preview.css:1193 sets
   overflow:hidden !important on the BASE pill at (0,3,0), which would clip the
   listening ring (scale 1.35 > pill height) — this (1,2,0) rule out-ranks it.
   hidden is then re-applied for the loading state ONLY (sweep clip). */
#email-reader-reply .email-reply-input-zone .email-reply-input-wrap { position: relative !important; overflow: visible !important; }
#email-reader-reply .email-reply-input-zone .email-reply-input-wrap.email-reply-loading { overflow: hidden !important; }
#email-reader-reply .email-reply-input-zone .email-reply-input-wrap.email-reply-loading::after { content: ''; position: absolute; bottom: 0; left: -28%; width: 28%; height: 2px; border-radius: 2px; background: rgba(110,138,126,0.75); animation: ssReplySweep 1.8s ease-in-out infinite; pointer-events: none; }
#email-reader-reply .email-reply-input-zone .email-reply-input-wrap.email-reply-loading .email-reply-input { animation: ssReplyPhBreath 2.2s ease-in-out infinite; }

@keyframes ssReplyMicBreath { 0%, 100% { opacity: .3; } 50% { opacity: .85; } }
@keyframes ssReplyMicRing { 0% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(1.35); } }
@keyframes ssReplySweep { 0% { left: -28%; } 100% { left: 100%; } }
@keyframes ssReplyPhBreath { 0%, 100% { opacity: .55; } 50% { opacity: .95; } }

@media (prefers-reduced-motion: reduce) {
  #email-reader-reply .email-reply-input-zone .email-reply-mic.ss-mic--connecting svg { animation: none !important; opacity: .5 !important; }
  #email-reader-reply .email-reply-input-zone .email-reply-mic.ss-mic--listening::after { animation: none !important; opacity: .5; }
  #email-reader-reply .email-reply-input-zone .email-reply-input-wrap.email-reply-loading::after { animation: none !important; left: 0; width: 100%; opacity: .4; }
  #email-reader-reply .email-reply-input-zone .email-reply-input-wrap.email-reply-loading .email-reply-input { animation: none !important; }
}

/* Sender line: name + quiet Vis detaljer; raw email + timestamp hidden inline.
   The email/time hide is raised to .email-page #email-reader-header (1,3,0) to beat
   email-calm-preview's pinned time display (#email-reader-header ...time, 1,2,0 !important);
   the name + toggle colour stay (0,2,0) so the email-darkmode.css rules win by source-order. */
.email-reader-from { display: flex; align-items: baseline; gap: 10px; }
.email-reader-from .email-reader-name { font-size: var(--email-fs-body-sm); font-weight: 600; color: rgb(58,47,38); order: 0; }
.email-reader-from .email-reader-details-toggle {
  order: 1; margin-left: 2px; background: transparent; border: 0; padding: 0;
  font-size: var(--font-size-sm); font-weight: 500; color: rgba(58,47,38,0.5); cursor: pointer; text-decoration: none;
}
.email-reader-from .email-reader-details-toggle:hover { color: rgb(110,138,126); text-decoration: underline; }
.email-page #email-reader-header .email-reader-from .email-reader-email { display: none !important; }
.email-page #email-reader-header .email-reader-from .email-reader-time { display: none !important; }
.email-page #email-reader-header .email-reader-from .email-reader-time::before { content: "" !important; display: none !important; }

/* Dark mode — new .ss-fbtn needs themed colours; the pill/input/close light !important
   above would leak into dark, so re-theme them here at higher specificity + !important. */
[data-theme="dark"] #email-reader-reply .ss-fbtn--ghost { color: var(--color-text-secondary) !important; border-color: rgba(255,255,255,0.18) !important; }
[data-theme="dark"] #email-reader-reply .ss-fbtn--ghost:hover { background: rgba(255,255,255,0.08) !important; border-color: rgba(255,255,255,0.28) !important; }
[data-theme="dark"] #email-reader-reply .ss-fbtn--ai { background: rgba(138,181,163,0.14) !important; color: #A5CBB9 !important; }
[data-theme="dark"] #email-reader-reply .ss-fbtn--ai:hover { background: rgba(138,181,163,0.22) !important; }
[data-theme="dark"] #email-reader-reply .email-reply-input-zone .email-reply-input-wrap { background: rgba(255,255,255,0.06) !important; border-color: rgba(255,255,255,0.14) !important; }
[data-theme="dark"] #email-reader-reply .email-reply-input-zone .email-reply-input-wrap:focus-within { border-color: rgba(200,190,178,0.48) !important; box-shadow: 0 0 0 2px rgba(200,190,178,0.10) !important; }
[data-theme="dark"] #email-reader-reply .email-reply-input-zone .email-reply-input { color: var(--color-text-primary) !important; }
[data-theme="dark"] #email-reader-reply .email-reply-input-zone .ss-ai-close { color: rgba(255,255,255,0.6) !important; }
[data-theme="dark"] #email-reader-reply .email-reply-input-zone .ss-ai-close:hover { color: rgba(255,255,255,0.85) !important; background: rgba(255,255,255,0.08) !important; }
[data-theme="dark"] #email-reader-reply .email-reply-input-zone .email-reply-mic.email-mic-error { background: rgba(196,140,120,0.18) !important; color: #D9A18A !important; }
[data-theme="dark"] #email-reader-reply .email-reply-input-zone .email-reply-mic.ss-mic--listening { background: rgba(74,122,104,0.22) !important; color: #8FBAA8 !important; }
[data-theme="dark"] #email-reader-reply .email-reply-input-zone .email-reply-mic.ss-mic--listening::after { border-color: rgba(143,186,168,0.55) !important; }
[data-theme="dark"] #email-reader-reply .email-reply-input-zone .email-reply-input-wrap.email-reply-loading::after { background: rgba(143,186,168,0.7) !important; }
