/* wevmail — output.css
   4-zone layout: dock | nav-panel | workspace | viewer
   Design: progressive disclosure, typography hierarchy, zero visual noise.
   Pre-built — no Tailwind CLI required to open in browser. */

/* ============================================================
   RESET
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { line-height: 1.5; -webkit-text-size-adjust: 100%; }
body { margin: 0; }
a { color: inherit; text-decoration: inherit; }
b, strong { font-weight: bolder; }
button, input, textarea, select { font-family: inherit; font-size: 100%; color: inherit; margin: 0; padding: 0; }
button { background: transparent; border: none; cursor: pointer; }
img, svg, iframe { display: block; }
[hidden] { display: none; }
ol, ul { list-style: none; }


/* ============================================================
   DESIGN TOKENS
   ============================================================ */

:root {
  /* Surfaces */
  --c-bg:           #F4F5F7;   /* Zone 2 background, page bg */
  --c-surface:      #FFFFFF;   /* Zone 3 & 4, cards */
  --c-surface-2:    #F9FAFB;   /* Hover states, subtle fills */
  --c-border:       #EAECF0;

  /* Text */
  --c-text-main:    #111827;
  --c-text-sub:     #374151;   /* Secondary text, read emails */
  --c-text-muted:   #6B7280;   /* Timestamps, labels, previews */
  --c-text-faint:   #9CA3AF;   /* Very muted — section headers */

  /* Accent */
  --c-accent:       #3B82F6;
  --c-accent-hover: #2563EB;
  --c-accent-soft:  rgba(59, 130, 246, 0.08);

  /* Status */
  --c-warning:      #F59E0B;
  --c-warning-soft: rgba(245, 158, 11, 0.1);
  --c-danger:       #EF4444;
  --c-danger-soft:  rgba(239, 68, 68, 0.1);

  /* Dock — always dark, theme-independent */
  --c-dock:         #0D0D0D;
  --c-dock-icon:    #555;
  --c-dock-active:  #FFFFFF;
  --c-dock-hover:   rgba(255, 255, 255, 0.07);

  /* Radii */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:  0 12px 32px rgba(0,0,0,0.12);
  --shadow-xl:  0 24px 48px rgba(0,0,0,0.16);

  /* Typography */
  --font: 'Inter', ui-sans-serif, system-ui, sans-serif;

  /* Dimensions */
  --dock-w:    68px;
  --nav-w:     220px;
  --viewer-w:  580px;
  --viewer-w-expanded: 100%;
}

.dark {
  --c-bg:           #03050C;
  --c-surface:      #0C0F1A;
  --c-surface-2:    #111520;
  --c-border:       rgba(255, 255, 255, 0.07);

  --c-text-main:    #F9FAFB;
  --c-text-sub:     #D1D5DB;
  --c-text-muted:   #6B7280;
  --c-text-faint:   #4B5563;

  --c-accent-soft:  rgba(59, 130, 246, 0.12);
  --c-warning-soft: rgba(245, 158, 11, 0.12);
  --c-danger-soft:  rgba(239, 68, 68, 0.12);

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg:  0 12px 32px rgba(0,0,0,0.6);
}


/* ============================================================
   BASE
   ============================================================ */

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text-main);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#app { height: 100vh; overflow: hidden; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--c-text-faint); }


/* ============================================================
   ZONE LAYOUT
   4 zones: dock | nav-panel | workspace | viewer
   Zones separate via background color, not borders.
   Lines only appear where content demands it (e.g. inside viewer).
   ============================================================ */

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--c-bg);
}

/* ── Zone 1: Dock ─────────────────────────────────────── */
/* Always dark — immune to light/dark theme */
.dock {
  width: var(--dock-w);
  flex-shrink: 0;
  height: 100vh;
  background: var(--c-dock);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0 20px;
  z-index: 30;
  position: relative;
  overflow: visible; /* tooltips extend to the right */
}

.dock-logo {
  width: 36px;
  height: 36px;
  background: var(--c-accent);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-bottom: 24px;
  flex-shrink: 0;
  transition: background 0.15s;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.dock-logo:hover { background: var(--c-accent-hover); }
.dock-logo span { color: #fff; font-weight: 700; font-size: 17px; line-height: 1; }

.dock-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  padding: 0 10px;
  overflow: visible; /* allow tooltips to extend past dock edge */
}

.dock-item {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-dock-icon);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.dock-item:hover { background: var(--c-dock-hover); color: #fff; }
.dock-item.active { color: var(--c-dock-active); }
/* Active indicator: vertical pill on the left edge of the dock */
.dock-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: #fff;
  border-radius: 0 3px 3px 0;
}
.dock-item.soon { color: #777; cursor: default; }
.dock-item.soon:hover { background: transparent; color: #777; }
.dock-item i { font-size: 20px; }

.dock-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 0 10px;
}

/* ── Dock item tooltip (desktop) + label (mobile) ─────── */
/* Single element, two visual modes controlled by responsive CSS */
.dock-item-label {
  position: absolute;
  left: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%) translateX(-5px);
  background: #141414;
  color: #e5e7eb;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  padding: 5px 11px;
  border-radius: var(--r-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  font-family: var(--font);
  z-index: 200;
  user-select: none;
}
/* Left-pointing caret */
.dock-item-label::before {
  content: '';
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: #141414;
}
.dock-item:hover .dock-item-label,
.dock-item:focus-visible .dock-item-label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
/* Skip tooltip on active item — context is already clear */
.dock-item.active .dock-item-label { display: none; }

/* ── Zone 2: Nav Panel ────────────────────────────────── */
/* Slightly gray — separates from white workspace via color alone */
.nav-panel {
  width: var(--nav-w);
  flex-shrink: 0;
  height: 100vh;
  background: var(--c-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Collapsed state: icon-only width ─────────────────── */
/* .hover-expanded is toggled by JS on mouseenter/mouseleave,
   so clicking collapse works even while the mouse is still over the panel. */
.nav-panel.collapsed:not(.hover-expanded) { width: 52px; }

/* Remove text from flow when truly collapsed */
.nav-panel.collapsed:not(.hover-expanded) .nav-account-info,
.nav-panel.collapsed:not(.hover-expanded) .nav-account-caret,
.nav-panel.collapsed:not(.hover-expanded) .nav-compose-label,
.nav-panel.collapsed:not(.hover-expanded) .nav-section,
.nav-panel.collapsed:not(.hover-expanded) .folder-item-label,
.nav-panel.collapsed:not(.hover-expanded) .folder-item-count {
  display: none;
}

/* Center the remaining icons */
.nav-panel.collapsed:not(.hover-expanded) .nav-panel-head { padding: 20px 0 12px; }
.nav-panel.collapsed:not(.hover-expanded) .nav-account    { justify-content: center; padding: 6px; margin-bottom: 14px; }
.nav-panel.collapsed:not(.hover-expanded) .folder-item    { justify-content: center; padding: 9px 0; }

/* Compose button → squircle icon */
.nav-panel.collapsed:not(.hover-expanded) .nav-compose {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px; /* squircle */
  margin: 0 auto;
  justify-content: center;
  box-shadow: none;
}

/* ── Nav panel footer (collapse toggle row) ─────────── */
/* The full row is a hover dead-zone — no expansion triggers here */
.nav-panel-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 10px;
  height: 44px;
}
.nav-panel.collapsed:not(.hover-expanded) .nav-panel-footer {
  justify-content: center;
}

/* ── Collapse toggle button ──────────────────────────── */
.nav-collapse-btn {
  width: 26px;
  height: 26px;
  border-radius: 8px; /* squircle */
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-border);
  border: 1px solid transparent;
  color: var(--c-text-muted);
  cursor: pointer;
  font-size: 12px;
  transition: background 0.12s, color 0.12s, opacity 0.15s;
  opacity: 0.55;
  flex-shrink: 0;
}
.nav-collapse-btn:hover {
  background: var(--c-text-faint);
  color: var(--c-surface);
  opacity: 1;
}
.nav-panel:hover .nav-collapse-btn { opacity: 1; }

.nav-panel-head {
  padding: 20px 16px 12px;
  flex-shrink: 0;
}

/* Account display */
.nav-account {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 4px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 0.1s;
  margin-bottom: 16px;
}
.nav-account:hover { background: var(--c-surface); }

.nav-account-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-account-info { min-width: 0; flex: 1; }
.nav-account-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.nav-account-email {
  font-size: 11px;
  color: var(--c-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-account-caret { color: var(--c-text-faint); font-size: 14px; flex-shrink: 0; }

/* Compose button — primary action, prominent */
.nav-compose {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 32px);
  margin: 12px 16px 8px;
  padding: 9px 14px;
  background: var(--c-accent);
  color: #fff;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  border: none;
  font-family: var(--font);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}
.nav-compose:hover {
  background: var(--c-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}
.nav-compose:active { transform: translateY(0); }
.nav-compose i { font-size: 16px; }

/* Nav section label */
.nav-section {
  padding: 16px 16px 4px;
  flex-shrink: 0;
}
.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--c-text-faint);
}

/* Folder items — text-weight and color shift on active, no bg fill */
.nav-scroll { flex: 1; overflow-y: auto; padding-bottom: 20px; }

.folder-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.1s, color 0.1s;
  user-select: none;
}
.folder-item:hover { background: var(--c-surface); }
.folder-item.active {
  background: var(--c-surface);
}

.folder-item-icon {
  font-size: 15px;
  color: var(--c-text-faint);
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  transition: color 0.1s;
}
.folder-item.active .folder-item-icon { color: var(--c-accent); }

.folder-item-label {
  flex: 1;
  font-size: 13.5px;
  color: var(--c-text-muted);
  font-weight: 400;
  transition: color 0.1s, font-weight 0.1s;
}
.folder-item.active .folder-item-label {
  color: var(--c-text-main);
  font-weight: 500;
}

/* Unread count — a plain number, no badge chrome */
.folder-item-count {
  font-size: 11.5px;
  color: var(--c-text-faint);
  font-variant-numeric: tabular-nums;
}
.folder-item.active .folder-item-count {
  color: var(--c-accent);
  font-weight: 500;
}

/* ── Zone 3: Workspace ────────────────────────────────── */
/* White (or dark navy in dark mode) — the primary reading surface */
.workspace {
  flex: 1;
  min-width: 0;
  height: 100vh;
  background: var(--c-surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative; /* compose sheet anchors here */
  transition: flex-grow 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  border-top-right-radius: var(--r-xl);
}

/* Toolbar: search bar sits at the top of Zone 3 */
.workspace-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  flex-shrink: 0;
}

.search-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  background: var(--c-bg);
  border-radius: var(--r-full);
  padding: 0 14px;
  transition: box-shadow 0.15s, background 0.15s;
}
.search-bar:focus-within {
  background: var(--c-surface);
  box-shadow: 0 0 0 2px var(--c-accent), var(--shadow-sm);
}
.search-bar i { font-size: 16px; color: var(--c-text-faint); flex-shrink: 0; }
.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13.5px;
  color: var(--c-text-main);
}
.search-bar input::placeholder { color: var(--c-text-faint); }

.toolbar-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-muted);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  flex-shrink: 0;
}
.toolbar-btn:hover { background: var(--c-bg); color: var(--c-text-main); }
.toolbar-btn i { font-size: 18px; }

/* Inbox tab strip — pill tabs in a recessed cavity */
.inbox-tabs {
  display: flex;
  align-self: flex-start;
  max-width: calc(100% - 32px);
  padding: 3px;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--c-surface-2);
  border-radius: var(--r-full);
  margin: 16px 16px 8px;
  gap: 2px;
  border: 1px solid var(--c-border);
}
.inbox-tabs::-webkit-scrollbar { display: none; }

.inbox-tab {
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-faint);
  border: none;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font);
  border-radius: var(--r-full);
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.inbox-tab:hover {
  color: var(--c-text-muted);
}
.inbox-tab.active {
  color: var(--c-text-main);
  font-weight: 600;
  background: var(--c-surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.10), 0 0 0 0.5px rgba(0,0,0,0.04);
}
.dark .inbox-tab.active {
  box-shadow: 0 1px 4px rgba(0,0,0,0.5), 0 0 0 0.5px rgba(255,255,255,0.06);
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 5px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  border-radius: var(--r-full);
  background: var(--c-accent-soft);
  color: var(--c-accent);
  vertical-align: middle;
}
.inbox-tab.active .tab-count {
  background: var(--c-accent);
  color: #fff;
}

/* ── Control bar (select-all + pagination) ──────────────────────────────── */
.inbox-control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 14px;
  height: 36px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--c-border);
}

.select-left {
  display: flex;
  align-items: center;
  gap: 1px;
  position: relative;
}
.select-all-wrap {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 4px 5px;
  border-radius: var(--r-sm);
}
.select-all-wrap:hover { background: var(--c-surface-2); }
.select-all-check {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--c-accent);
}
.select-dropdown-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 24px;
  border-radius: var(--r-sm);
  color: var(--c-text-muted);
  font-size: 11px;
  transition: background 0.12s, color 0.12s;
}
.select-dropdown-btn:hover { background: var(--c-surface-2); color: var(--c-text-main); }

.select-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 130px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  padding: 4px;
  z-index: 100;
}
.select-dropdown-menu.open { display: flex; flex-direction: column; }
.select-dropdown-item {
  padding: 7px 12px;
  font-size: 13px;
  text-align: left;
  color: var(--c-text-sub);
  border-radius: var(--r-sm);
  transition: background 0.1s, color 0.1s;
}
.select-dropdown-item:hover { background: var(--c-surface-2); color: var(--c-text-main); }

.inbox-pager {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pager-new {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-accent);
  background: var(--c-accent-soft);
  padding: 2px 8px;
  border-radius: var(--r-full);
}
.pager-range {
  font-size: 12px;
  color: var(--c-text-muted);
  white-space: nowrap;
}
.pager-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  color: var(--c-text-muted);
  transition: background 0.12s, color 0.12s;
}
.pager-btn:hover:not(:disabled) { background: var(--c-surface-2); color: var(--c-text-main); }
.pager-btn:disabled { opacity: 0.3; cursor: default; }

.bulk-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text-muted);
  margin-right: 4px;
  white-space: nowrap;
}
.bulk-action-btn {
  font-size: 15px;
  color: var(--c-text-muted);
}
.bulk-action-btn:hover { background: var(--c-surface-2); color: var(--c-text-main); }

/* ── Mail list (inside Zone 3) ───────────────────────── */
.mail-list {
  flex: 1;
  overflow-y: auto;
}

/* Date group header — pure typography, no line */
.mail-date-group {
  padding: 16px 24px 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-text-faint);
  user-select: none;
}

@keyframes mail-ripple {
  to { transform: scale(1); opacity: 0; }
}
@keyframes mail-row-stripe {
  0%   { transform: scaleY(0); opacity: 0; }
  65%  { transform: scaleY(1.15); opacity: 1; }
  100% { transform: scaleY(1); opacity: 1; }
}

/* Email row */
.mail-row {
  display: grid;
  grid-template-columns: 20px 34px 1fr;
  column-gap: 11px;
  align-items: start;
  padding: 11px 24px;
  cursor: pointer;
  position: relative;
  overflow: hidden; /* clips the selection wave to row bounds */
  transition: background 0.2s ease;
}
.mail-row:hover { background: var(--c-surface-2); }
/* Long-press ripple: scale down slightly while finger is held */
@media (pointer: coarse) {
  .mail-row:active { transform: scale(0.985); transition: transform 0.1s ease, background 0.1s; }
}

/* Selected: wave travels left → right, stripe springs in */
.mail-row.selected,
.mail-row.bulk-selected { background: var(--c-accent-soft); }

/* Ripple element (injected by JS on pointerdown) */
.mail-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.35);
  transform: scale(0);
  pointer-events: none;
  animation: mail-ripple 0.55s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Left accent stripe springs in */
.mail-row.selected::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px; bottom: 10px;
  width: 3px;
  background: var(--c-accent);
  border-radius: 0 3px 3px 0;
  transform-origin: center;
  animation: mail-row-stripe 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s forwards;
  transform: scaleY(0);
  opacity: 0;
}

/* Col 1: unread dot + checkbox in one wrapper */
.row-check-wrap {
  position: relative;
  width: 20px;
  height: 20px;
  margin-top: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.unread-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-accent);
  flex-shrink: 0;
  transition: opacity 0.1s;
}
.unread-dot.hidden-dot { visibility: hidden; }

.row-check {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--c-accent);
  opacity: 0;
  transition: opacity 0.1s;
}
/* Show checkbox, hide dot on hover */
.mail-row:hover .row-check        { opacity: 1; }
.mail-row:hover .unread-dot       { opacity: 0; }
/* When any row is selected, all rows permanently show checkboxes */
.mail-list.has-selection .row-check   { opacity: 1; }
.mail-list.has-selection .unread-dot  { opacity: 0; }
/* Checked row */
.mail-row.bulk-selected .row-check  { opacity: 1; }
.mail-row.bulk-selected .unread-dot { opacity: 0; }

/* Avatar */
.avatar-circle {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  user-select: none;
}

/* Row content */
.mail-row-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mail-row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.mail-sender {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--c-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
/* Read email: sender drops to regular weight, muted color */
.mail-row:not(.unread) .mail-sender {
  font-weight: 400;
  color: var(--c-text-sub);
}

.mail-time {
  font-size: 11.5px;
  color: var(--c-text-faint);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
/* Unread: time gets accent-adjacent styling */
.mail-row.unread .mail-time {
  color: var(--c-text-muted);
  font-weight: 500;
}

.mail-subject {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mail-row:not(.unread) .mail-subject {
  font-weight: 400;
  color: var(--c-text-muted);
}

.mail-preview {
  font-size: 12.5px;
  color: var(--c-text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Meta row: badges, attachment icon */
.mail-row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

/* Security badges — appear only when needed */
.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: var(--r-full);
}
.security-badge.suspicious {
  background: var(--c-warning-soft);
  color: var(--c-warning);
}
.security-badge.fail {
  background: var(--c-danger-soft);
  color: var(--c-danger);
}

.attachment-icon, .flag-icon {
  font-size: 13px;
  color: var(--c-text-faint);
}
.flag-icon { color: var(--c-warning); }

/* Hover actions — invisible until hovered, slide in from right */
.mail-row-actions {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
  background: var(--c-surface-2);
  border-radius: var(--r-md);
  padding: 2px;
}
.mail-row:hover .mail-row-actions {
  opacity: 1;
  pointer-events: auto;
}
.mail-row:hover .mail-time { opacity: 0; }

.mail-action-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-muted);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  font-size: 17px;
  border: none;
  background: transparent;
}
.mail-action-btn:hover { background: var(--c-border); color: var(--c-text-main); }
.mail-star-btn.starred { color: #FBBF24; }
.mail-star-btn.starred:hover { color: #F59E0B; }

/* Avatar in mail rows: small top nudge to align optically with sender text */
.mail-row > .avatar-circle { margin-top: 3px; }

/* ── Zone 4: Viewer ──────────────────────────────────── */
/* Hidden by default — width: 0, overflow: hidden.
   Opens by adding .open class (width animates to --viewer-w).
   .expanded makes it cover Zone 3 (full-width takeover). */
.viewer {
  width: 0;
  flex-grow: 0;
  flex-shrink: 0;
  height: 100vh;
  background: var(--c-surface);
  overflow: hidden;
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              flex-grow 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  position: relative;
}
/* Subtle left edge — 1px shadow instead of a border */
.viewer.open {
  width: var(--viewer-w);
  box-shadow: -1px 0 0 var(--c-border);
}
.viewer.expanded {
  flex-grow: 1;
  width: 0; /* overrides --viewer-w; flex-grow determines actual width */
  z-index: 20;
  box-shadow: -1px 0 0 var(--c-border);
}

/* When viewer is expanded, collapse workspace so viewer fills exactly Zone 3 */
.app-shell:has(.viewer.expanded) .workspace {
  flex-grow: 0;
  overflow: hidden;
}

/* ── Universal viewer header ──────────────────────────── */
.viewer-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface);
  flex-shrink: 0;
  min-height: 52px;
}

.viewer-header-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.viewer-header-right {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.viewer-header-sep {
  width: 1px;
  height: 16px;
  background: var(--c-border);
  margin: 0 4px;
  flex-shrink: 0;
}

.viewer-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.thread-icon-btn:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

/* ── Thread view ─────────────────────────────────────── */

/* thread-view is the scroll container in both Zone 3 (tab) and Zone 4 (viewer) */
.thread-view {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ── Thread header (Zone 3 tab only — sticky within thread-view scroll) ── */
.thread-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--c-surface);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--c-border);
}

.thread-header-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.thread-subject {
  font-size: 16px;
  font-weight: 700;
  color: var(--c-text-main);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-participants-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.thread-participants {
  display: flex;
  align-items: center;
}
.thread-participants > * {
  margin-right: -6px;
  border: 2px solid var(--c-surface);
  border-radius: 50%;
}
.thread-participants > *:last-child { margin-right: 0; }

.thread-count-badge {
  font-size: 11.5px;
  color: var(--c-text-faint);
  margin-left: 10px;
  white-space: nowrap;
}

.thread-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.thread-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-muted);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  font-size: 16px;
  flex-shrink: 0;
}
.thread-icon-btn:hover { background: var(--c-bg); color: var(--c-text-main); }

/* ── Messages list ── */
.thread-messages {
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

/* Thin vertical connector line behind the avatar column */
.thread-messages::before {
  content: '';
  position: absolute;
  left: calc(16px + 14px); /* padding-left + half of 28px avatar */
  top: 32px;
  bottom: 24px;
  width: 1px;
  background: var(--c-border);
  pointer-events: none;
}

/* ── Toggle wrapper ── */
.tmsg-wrap { position: relative; }

/* ── Base message card ── */
.tmsg { transition: box-shadow 0.15s; }

/* ── Collapsed card ── */
.tmsg-collapsed {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 10px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  position: relative;
  z-index: 1;
  transition: background 0.1s, border-color 0.1s;
}
.dark .tmsg-collapsed { background: var(--c-surface-2); }
.tmsg-collapsed:hover { background: var(--c-surface-2); border-color: var(--c-accent-soft); }
.dark .tmsg-collapsed:hover { background: rgba(255,255,255,0.04); }

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

.tmsg-collapsed-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.tmsg-collapsed-sender {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.tmsg-date-short {
  font-size: 11.5px;
  color: var(--c-text-faint);
  white-space: nowrap;
  flex-shrink: 0;
}

.tmsg-collapsed-preview {
  font-size: 12.5px;
  color: var(--c-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tmsg-collapsed-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.tmsg-attach-icon {
  font-size: 13px;
  color: var(--c-text-faint);
}

/* ── Expanded card ── */
.tmsg-expanded {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  position: relative;
  z-index: 1;
}
.dark .tmsg-expanded { box-shadow: 0 4px 16px rgba(0,0,0,0.4); }

/* ── Message header ── */
.tmsg-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 14px 12px 16px;
}

/* Collapsible: clicking the header collapses the message */
.tmsg-header--collapsible {
  cursor: pointer;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  transition: background 0.1s;
}
.tmsg-header--collapsible:hover { background: var(--c-surface-2); }

.tmsg-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 1px;
}

.tmsg-sender-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.tmsg-sender {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text-main);
}

.tmsg-sender-email {
  font-size: 12px;
  color: var(--c-text-muted);
}

/* Detail toggle: "to me · cc 2 ▾" */
.tmsg-detail-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: var(--c-text-muted);
  padding: 1px 0;
  cursor: pointer;
  background: transparent;
  border: none;
  transition: color 0.1s;
  text-align: left;
}
.tmsg-detail-toggle:hover { color: var(--c-text-sub); }
.tmsg-detail-caret { font-size: 10px; opacity: 0.6; }

/* Detail panel: full recipients */
.tmsg-detail-panel {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  margin: 4px 0 2px;
  background: var(--c-bg);
  border-radius: var(--r-md);
}
.dark .tmsg-detail-panel { background: var(--c-surface-2); }
.tmsg-detail-panel.open { display: flex; }

.tmsg-detail-row {
  display: flex;
  gap: 10px;
  font-size: 12px;
  line-height: 1.6;
}
.tmsg-detail-label {
  color: var(--c-text-faint);
  min-width: 38px;
  flex-shrink: 0;
  text-align: right;
  padding-top: 1px;
}
.tmsg-detail-value {
  color: var(--c-text-sub);
  word-break: break-word;
  flex: 1;
}

/* Header right column: date + actions stacked */
.tmsg-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.tmsg-date-full {
  font-size: 11.5px;
  color: var(--c-text-faint);
  white-space: nowrap;
}

/* Per-message action buttons */
.tmsg-msg-actions {
  display: flex;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
  position: relative;
}

/* More dropdown menu */
.tmsg-more-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  min-width: 168px;
  padding: 4px 0;
  display: none;
}
.tmsg-more-menu.open { display: block; }

.tmsg-more-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--c-text-sub);
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.tmsg-more-item:hover { background: var(--c-bg); color: var(--c-text-main); }
.tmsg-more-item i { font-size: 15px; color: var(--c-text-muted); flex-shrink: 0; }

/* Email body iframe */
.tmsg-body-wrap {
  padding: 0 16px 4px;
}

.thread-email-iframe {
  width: 100%;
  border: none;
  min-height: 80px;
  display: block;
}

/* Attachments bar */
.tmsg-attachments {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--c-border);
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tmsg-att-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--c-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tmsg-att-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tmsg-att-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  min-width: 0;
  max-width: 220px;
}
.dark .tmsg-att-chip { background: var(--c-surface-2); }

.tmsg-att-icon { font-size: 20px; color: var(--c-accent); flex-shrink: 0; }
.tmsg-att-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tmsg-att-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--c-text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.tmsg-att-size { font-size: 11px; color: var(--c-text-faint); }
.tmsg-att-dl {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--c-text-muted);
  flex-shrink: 0;
  transition: background 0.1s, color 0.1s;
  font-size: 15px;
}
.tmsg-att-dl:hover { background: var(--c-border); color: var(--c-text-main); }

/* ── Reply bar ── */
.thread-reply-bar {
  margin-top: auto;
  padding: 12px 16px 20px;
  border-top: 1px solid var(--c-border);
  display: flex;
  gap: 8px;
}

.thread-reply-input {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  padding: 11px 16px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  font-size: 13.5px;
  color: var(--c-text-muted);
  cursor: text;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: var(--font);
}
.thread-reply-input:hover {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-soft);
  color: var(--c-text-main);
}

.thread-reply-all-btn,
.thread-forward-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  font-size: 13px;
  color: var(--c-text-sub);
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  white-space: nowrap;
}
.thread-reply-all-btn:hover,
.thread-forward-btn:hover {
  background: var(--c-surface-2);
  border-color: var(--c-accent);
  color: var(--c-text-main);
}

/* ── Compose sheet (inside Zone 3) ───────────────────── */
/* Slides up from the bottom of Zone 3 */
.compose-sheet {
  position: absolute;
  bottom: 0; left: auto; right: 0;
  width: 50%;
  min-width: 400px;
  background: var(--c-surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: 0 -4px 32px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 20;
  height: 70%;
  max-height: 100%;
  border: 1px solid var(--c-border);
  border-bottom: none;
}
.compose-sheet.open { transform: translateY(0); }

/* Dimmer over the mail list when compose is open */
.workspace-dimmer {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.06);
  z-index: 19;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.dark .workspace-dimmer { background: rgba(0,0,0,0.3); }
.workspace-dimmer.active { opacity: 1; pointer-events: auto; }

.compose-handle {
  width: 100%;
  height: 24px;
  flex-shrink: 0;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
}
.compose-sheet[style*="height: auto"] .compose-handle {
  cursor: default;
}
.compose-sheet[style*="height: auto"] .compose-handle::before {
  opacity: 0.3;
}
.compose-handle::before {
  content: '';
  width: 48px;
  height: 4px;
  background: var(--c-border);
  border-radius: var(--r-full);
  transition: background 0.15s;
}
.compose-handle:hover::before { background: var(--c-text-muted); }

.compose-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 8px;
  flex-shrink: 0;
}
.compose-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text-main);
}
.compose-header-actions { display: flex; gap: 4px; }
.compose-icon-btn {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--c-text-muted);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  font-size: 15px;
}
.compose-icon-btn:hover { background: var(--c-bg); color: var(--c-text-main); }

/* ── Shared composer body wrap ───────────────────────────── */
.compose-body-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Fields (To / Cc / Bcc / Subject) */
.compose-fields {
  flex-shrink: 0;
  border-bottom: 1px solid var(--c-border);
}
.compose-field-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--c-border);
  position: relative;
}
.compose-field-row:last-child { border-bottom: none; }
.compose-field-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--c-text-faint);
  padding-top: 4px;
  width: 52px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Recipient tag container */
.compose-tags {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  min-height: 28px;
  border-radius: var(--r-sm);
  transition: outline 0.15s;
}
.compose-tags.error { outline: 1.5px solid var(--c-danger); border-radius: var(--r-sm); }

.compose-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--c-accent-soft);
  color: var(--c-accent);
  border-radius: var(--r-full);
  padding: 2px 6px 2px 10px;
  font-size: 12.5px;
  font-weight: 500;
}
.compose-tag-remove {
  font-size: 13px;
  color: var(--c-accent);
  cursor: pointer;
  line-height: 1;
  opacity: 0.65;
  padding: 0 2px;
  border: none;
  background: transparent;
  transition: opacity 0.1s;
}
.compose-tag-remove:hover { opacity: 1; }

.compose-tag-input {
  flex: 1;
  min-width: 80px;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13.5px;
  color: var(--c-text-main);
  font-family: var(--font);
  padding: 2px 0;
}
.compose-tag-input::placeholder { color: var(--c-text-faint); }

/* Cc / Bcc toggle buttons */
.compose-cc-bcc-btns {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  align-self: flex-start;
  padding-top: 4px;
}
.compose-cc-bcc-btn {
  font-size: 12px;
  font-weight: 500;
  color: var(--c-text-faint);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  transition: background 0.1s, color 0.1s;
  font-family: var(--font);
}
.compose-cc-bcc-btn:hover { background: var(--c-bg); color: var(--c-text-muted); }

/* Subject input */
.compose-subject-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13.5px;
  color: var(--c-text-main);
  font-family: var(--font);
  padding: 2px 0;
  font-weight: 500;
}
.compose-subject-input::placeholder { color: var(--c-text-faint); font-weight: 400; }

/* ── Rich text editor ────────────────────────────────────── */
.compose-editor-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Toolbar */
.compose-toolbar {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 4px 16px;
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.compose-toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--c-text-muted);
  cursor: pointer;
  font-size: 15px;
  transition: background 0.1s, color 0.1s;
}
.compose-toolbar-btn:hover  { background: var(--c-bg); color: var(--c-text-main); }
.compose-toolbar-btn.active { background: var(--c-accent-soft); color: var(--c-accent); }
.compose-toolbar-sep {
  width: 1px;
  height: 18px;
  background: var(--c-border);
  margin: 0 4px;
  flex-shrink: 0;
}

/* Body */
.compose-body {
  flex: 1;
  min-height: 120px;
  padding: 14px 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--c-text-main);
  outline: none;
  overflow-y: auto;
  font-family: var(--font);
}
.compose-body:empty::before {
  content: attr(data-placeholder);
  color: var(--c-text-faint);
  pointer-events: none;
}
.compose-body h1 { font-size: 1.5em; font-weight: 700; margin: 0.5em 0; }
.compose-body h2 { font-size: 1.25em; font-weight: 600; margin: 0.5em 0; }
.compose-body blockquote {
  border-left: 3px solid var(--c-border);
  margin: 8px 0;
  padding: 4px 12px;
  color: var(--c-text-muted);
}
.compose-body ul, .compose-body ol { padding-left: 1.5em; margin: 0.4em 0; }
.compose-body a { color: var(--c-accent); text-decoration: underline; }

/* Quoted reply block */
.compose-quoted {
  margin: 8px 20px 0;
  padding: 10px 14px;
  background: var(--c-bg);
  border-radius: var(--r-md);
  border-left: 3px solid var(--c-border);
  font-size: 13px;
  color: var(--c-text-muted);
  line-height: 1.6;
  flex-shrink: 0;
}
.compose-quoted-meta { font-size: 11.5px; color: var(--c-text-faint); margin-bottom: 6px; }
.compose-quoted-body { white-space: pre-wrap; }

/* ── Attachments ─────────────────────────────────────────── */
.compose-attachments {
  flex-shrink: 0;
  padding: 8px 16px;
  gap: 6px;
  flex-wrap: wrap;
  border-top: 1px solid var(--c-border);
}
.compose-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 4px 8px 4px 10px;
  font-size: 12.5px;
  color: var(--c-text-main);
}
.compose-attachment-chip i { font-size: 13px; color: var(--c-text-faint); }
.compose-attachment-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compose-attachment-size { color: var(--c-text-faint); font-size: 11.5px; }
.compose-attachment-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  border: none;
  background: transparent;
  color: var(--c-text-faint);
  cursor: pointer;
  border-radius: 3px;
  font-size: 11px;
  transition: background 0.1s, color 0.1s;
}
.compose-attachment-remove:hover { background: var(--c-surface-2); color: var(--c-text-main); }

/* ── Footer ──────────────────────────────────────────────── */
.compose-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px 14px;
  flex-shrink: 0;
  border-top: 1px solid var(--c-border);
}

.btn-send {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  background: var(--c-accent);
  color: #fff;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  font-family: var(--font);
  border: none;
}
.btn-send:hover { background: var(--c-accent-hover); transform: translateY(-1px); }
.btn-send:disabled { opacity: 0.6; transform: none; cursor: not-allowed; }
.btn-send i { font-size: 15px; }

.compose-attach-btn, .btn-discard {
  width: 34px; height: 34px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--c-text-muted);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  font-size: 17px;
  border: none;
  background: transparent;
}
.compose-attach-btn:hover { background: var(--c-bg); color: var(--c-text-main); }

.btn-discard { margin-left: auto; }
.btn-discard:hover { background: var(--c-bg); color: var(--c-danger); }

/* lx-input kept for backwards compat */
.lx-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 13.5px;
  color: var(--c-text-main);
  padding: 2px 0;
  font-family: var(--font);
  min-width: 80px;
}
.lx-input::placeholder { color: var(--c-text-faint); }

/* ── Security banners ────────────────────────────────── */
.security-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.5;
}
.security-banner.suspicious {
  background: var(--c-warning-soft);
  color: #92400E;
}
.dark .security-banner.suspicious { color: #FCD34D; }
.security-banner.fail {
  background: var(--c-danger-soft);
  color: #991B1B;
}
.dark .security-banner.fail { color: #FCA5A5; }
.security-banner i { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.security-banner-text { flex: 1; }
.security-banner-title { font-weight: 600; margin-bottom: 2px; }
.security-banner-close {
  cursor: pointer;
  color: inherit;
  opacity: 0.5;
  font-size: 16px;
  padding: 2px;
  flex-shrink: 0;
}
.security-banner-close:hover { opacity: 1; }


/* ── Empty / error states ────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 24px;
  text-align: center;
  color: var(--c-text-muted);
}
.empty-state i { font-size: 36px; opacity: 0.4; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--c-text-main); }
.empty-state p { font-size: 13px; color: var(--c-text-muted); max-width: 260px; line-height: 1.5; }


/* ── Skeleton loading ────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--c-border) 25%, var(--c-bg) 50%, var(--c-border) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: var(--r-sm);
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
}
.skeleton-circle {
  width: 34px; height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
}
.skeleton-text { height: 13px; border-radius: var(--r-sm); }


/* ── Toasts ──────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 500;
  pointer-events: auto;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
}
.toast.success { background: #111827; color: #fff; }
.toast.error { background: var(--c-danger); color: #fff; }
.toast.info { background: var(--c-accent); color: #fff; }
.toast i { font-size: 16px; }


/* ── Mobile compose FAB ──────────────────────────────── */
.compose-fab {
  display: none; /* hidden on desktop */
}

/* ── Workspace tab bar (Zone 3 top) ─────────────────────── */
.workspace-tab-bar {
  display: flex;
  align-items: stretch;
  height: 50px;
  flex-shrink: 0;
  background: var(--c-bg);
  gap: 0;
  padding: 8px 0 0;
  position: relative;
  z-index: 10;
}

/* strip-wrap contains the scrollable strip + the picker popover */
.wtab-strip-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

.wtab-strip {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
  min-width: 0;
  padding: 0;
}
.wtab-strip::-webkit-scrollbar { display: none; }

.wtab-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  margin: 5px 2px 5px 0;
  border-radius: var(--r-md);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--c-text-faint);
  background: transparent;
  border: none;
  transition: background 0.12s, color 0.12s;
  position: relative;
  user-select: none;
  height: calc(100% - 10px);
}
.wtab-chip:hover {
  background: var(--c-surface);
  color: var(--c-text-muted);
}
.wtab-chip.active {
  background: var(--c-surface);
  color: var(--c-text-main);
  font-weight: 500;
  margin-bottom: 0;
  height: calc(100% - 5px);
  border-radius: var(--r-md) var(--r-md) 0 0;
}

.wtab-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.wtab-label {
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wtab-dirty-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-accent);
  flex-shrink: 0;
  margin-left: 2px;
}

.wtab-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: transparent;
  border: none;
  color: var(--c-text-faint);
  cursor: pointer;
  padding: 0;
  margin-left: 2px;
  opacity: 0;
  transition: opacity 0.1s, background 0.1s;
  flex-shrink: 0;
}
.wtab-close i { font-size: 11px; }
.wtab-chip:hover .wtab-close,
.wtab-chip.active .wtab-close { opacity: 1; }
.wtab-close:hover { background: var(--c-surface-3); color: var(--c-text-main); }

.wtab-new-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 30px;
  margin: 5px 2px;
  border-radius: var(--r-md);
  background: transparent;
  border: none;
  color: var(--c-text-faint);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.wtab-new-btn:hover { background: var(--c-surface); color: var(--c-text-muted); }
.wtab-new-btn i { font-size: 13px; }

/* New-tab picker popover */
.wtab-picker {
  position: absolute;
  top: calc(100% + 4px);
  left: 4px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 4px;
  z-index: 200;
  min-width: 140px;
  display: none;
}
.wtab-picker.open { display: block; }

.wtab-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--r-md);
  background: transparent;
  border: none;
  color: var(--c-text-main);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
}
.wtab-picker-item:hover { background: var(--c-surface-2); }
.wtab-picker-item i { font-size: 14px; color: var(--c-text-muted); }

/* Mobile hamburger — shown only on mobile */
.wtab-mobile-menu {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 100%;
  flex-shrink: 0;
  border: none;
  border-right: 1px solid var(--c-border);
  background: transparent;
  color: var(--c-text-muted);
  cursor: pointer;
}

/* Right side: global search + actions */
.wtab-global {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-left: 12px;
  flex-shrink: 0;
  padding-right: 10px;
}

.wtab-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  background: var(--c-surface);
  border-radius: var(--r-full);
  padding: 0 16px;
  border: 1.5px solid var(--c-border);
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: text;
}
.wtab-search-wrap:focus-within {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.wtab-search-icon {
  font-size: 15px;
  color: var(--c-text-muted);
  flex-shrink: 0;
}

.wtab-search-module {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--c-text-faint);
  flex-shrink: 0;
  pointer-events: none;
  user-select: none;
  letter-spacing: 0.02em;
}

.wtab-search-divider {
  width: 1px;
  height: 12px;
  background: var(--c-border);
  flex-shrink: 0;
  opacity: 0.6;
}

.wtab-search-input {
  border: none;
  background: transparent;
  font-size: 13px;
  font-family: var(--font);
  color: var(--c-text-main);
  outline: none;
  width: 180px;
}
.wtab-search-input::placeholder { color: var(--c-text-faint); }

.wtab-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: transparent;
  border: none;
  color: var(--c-text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}
.wtab-icon-btn:hover { background: var(--c-surface-2); color: var(--c-text-main); }
.wtab-icon-btn i { font-size: 15px; }

/* Tab content area — fills remaining workspace height */
.tab-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ── Compose-in-tab full page ────────────────────────── */
/* Tab page is a constrained centered column; the shared composer fills it */
.compose-tab-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

.compose-tab-header {
  padding: 20px 20px 12px;
  flex-shrink: 0;
}

.compose-tab-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text-main);
}

/* In tab view, fields have a top border to separate from the title */
.compose-tab-page .compose-fields {
  border-top: 1px solid var(--c-border);
}

/* ── Frontend preview banner ─────────────────────────── */
.preview-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: #1c1917;
  color: #a8a29e;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  z-index: 9998;
  padding: 0 12px;
  font-family: var(--font);
  letter-spacing: 0.01em;
}
.preview-banner i { font-size: 13px; color: #78716c; }
.preview-banner-close {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: #78716c;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.preview-banner-close:hover { color: #d6d3d1; }
/* Push dock above the banner on mobile */
@media (max-width: 768px) {
  .preview-banner { display: none; } /* too cramped on mobile, skip it */
}

/* ── Mobile overlay (sidebar toggle) ────────────────── */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 25;
}
.mobile-overlay.active { display: block; }


/* ── Mobile dock panel (more menu) ──────────────────────── */
/* Slides up above the bottom bar — only rendered on mobile */
.dock-mobile-panel {
  display: none; /* shown only on mobile via media query */
}

/* Desktop-only elements */
.dock-mobile-nav-btn,
.dock-mobile-more-btn {
  display: none;
}


/* ============================================================
   MOBILE — ≤ 768px
   Zone 1 moves to bottom bar. Zone 2 overlays from left.
   Zone 4 covers full screen.
   ============================================================ */

@media (max-width: 768px) {
  .app-shell {
    flex-direction: column;
  }

  /* ── Bottom dock bar ──────────────────────── */
  .dock {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    height: 64px;
    flex-direction: row;
    align-items: stretch;
    padding: 0;
    z-index: 50;
    border-radius: 16px 16px 0 0;
    overflow: visible;
    border-top: 1px solid rgba(255,255,255,0.07);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .dock.dock-hidden {
    transform: translateY(100%);
  }

  /* Smooth bottom transitions for all dock-aware fixed elements */
  .workspace,
  .viewer.open,
  .compose-sheet,
  .workspace-dimmer.active {
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  /* Collapse gap when dock slides away */
  html.dock-hidden .workspace               { bottom: 0; }
  html.dock-hidden .viewer.open             { bottom: 0; }
  html.dock-hidden .compose-sheet           { bottom: 0; }
  html.dock-hidden .workspace-dimmer.active { bottom: 0; }
  /* FAB falls to bottom edge and collapses to icon when dock hides */
  html.dock-hidden .compose-fab {
    bottom: 16px;
    gap: 0;
  }
  html.dock-hidden .compose-fab .fab-label {
    max-width: 0;
    opacity: 0;
  }

  /* Logo + desktop bottom group hidden on mobile */
  .dock-logo { display: none; }
  .dock-desktop-bottom { display: none; }

  /* App nav row + more button fill the full bar equally */
  .dock-nav {
    flex-direction: row;
    flex: 1;
    justify-content: stretch;
    align-items: stretch;
    padding: 0;
    gap: 0;
  }

  /* Each nav item: equal share, column layout, generous tap target */
  .dock-nav .dock-item {
    flex: 1;
    width: auto;
    height: auto;
    flex-direction: column;
    gap: 3px;
    padding: 8px 4px 6px;
    border-radius: 0;
    color: #6b7280;
    transition: color 0.15s, background 0.15s;
  }
  .dock-nav .dock-item:hover { background: rgba(255,255,255,0.05); color: #9ca3af; }
  .dock-nav .dock-item i { font-size: 20px; }

  /* Labels: readable, always visible */
  .dock-nav .dock-item .dock-item-label {
    position: static;
    transform: none;
    background: transparent;
    color: inherit;
    font-size: 10px;
    font-weight: 500;
    padding: 0;
    border: none;
    border-radius: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    opacity: 1;
    box-shadow: none;
    filter: none;
    display: block;
    text-align: center;
    line-height: 1;
    letter-spacing: 0.02em;
    white-space: nowrap;
  }
  .dock-nav .dock-item .dock-item-label::before { display: none; }
  .dock-nav .dock-item:hover .dock-item-label { transform: none; opacity: 1; }

  /* Active item: white icon + white label */
  .dock-item.active::before { display: none; }
  .dock-item.active { color: var(--c-dock-active); }
  .dock-nav .dock-item.active .dock-item-label { color: #fff; }

  /* More button — inside dock-nav, inherits all .dock-nav .dock-item styles */
  .dock-mobile-more-btn { display: flex; }

  /* Mobile more panel — absolute, pops up above bottom bar */
  .dock-mobile-panel {
    display: flex;
    flex-direction: column;
    position: absolute;
    bottom: calc(100% + 8px);
    right: 8px;
    width: 220px;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    opacity: 0;
    transform: translateY(8px) scale(0.96);
    transform-origin: bottom right;
    transition: opacity 0.18s, transform 0.18s;
    pointer-events: none;
    z-index: 60;
  }
  .dock-mobile-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
  }

  .dock-mobile-panel-account {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .dock-mobile-panel-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600; color: #fff;
    flex-shrink: 0;
  }
  .dock-mobile-panel-info { min-width: 0; }
  .dock-mobile-panel-name {
    font-size: 13px; font-weight: 600; color: #f9fafb;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .dock-mobile-panel-email {
    font-size: 11px; color: #6b7280;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .dock-mobile-panel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    font-size: 13.5px;
    color: #d1d5db;
    font-family: var(--font);
    text-align: left;
    transition: background 0.1s, color 0.1s;
  }
  .dock-mobile-panel-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
  .dock-mobile-panel-item i { font-size: 17px; color: #6b7280; }

  /* ── Zone 2: Nav panel slides in from left ──────────── */
  .nav-panel {
    position: fixed;
    top: 0; left: 0; bottom: 60px;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-xl);
    height: auto; /* override 100vh */
  }
  .nav-panel.open { transform: translateX(0); }

/* ── Zone 3: Workspace ──────────────────────────────── */
  /* Fixed to fill viewport above the bottom dock bar */
  .workspace {
    position: fixed;
    top: 0; left: 0; right: 0;
    bottom: 60px;
    height: auto; /* override 100vh */
    overflow: hidden;
  }

  /* ── Zone 4: Viewer covers full screen ──────────────── */
  .viewer.open {
    position: fixed;
    inset: 0;
    bottom: 60px;
    width: 100%;
    height: auto; /* override base height:100vh so top+bottom:60px controls the size */
    z-index: 35;
    box-shadow: none;
  }

  /* Compose sheet: break out of workspace stacking context on mobile.
     Fixed to viewport, above viewer (35) and nav-panel (40), below dock (50). */
  .compose-sheet {
    position: fixed;
    bottom: 60px; /* sits directly above the bottom dock bar */
    left: 0;
    right: 0;
    max-height: calc(90vh - 60px);
    z-index: 45;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
  }

  /* Dimmer covers full screen on mobile (behind compose, above viewer) */
  .workspace-dimmer.active {
    position: fixed;
    inset: 0;
    bottom: 60px;
    z-index: 44;
  }

  /* Compose button removed from Zone 2 on mobile — FAB used instead */
  .nav-compose { display: none; }

  /* Collapse footer not needed on mobile */
  .nav-panel-footer { display: none; }

  /* Mobile compose FAB — fixed above the bottom dock bar */
  .compose-fab {
    display: flex;
    position: fixed;
    bottom: 76px;
    right: 16px;
    height: 46px;
    padding: 0 18px 0 14px;
    gap: 7px;
    border-radius: 14px; /* squircle */
    background: var(--c-accent);
    color: #fff;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(59, 130, 246, 0.4);
    z-index: 42;
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                gap 0.25s ease,
                transform 0.12s ease,
                box-shadow 0.12s;
  }
  .fab-label {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    max-width: 120px;
    opacity: 1;
    transition: max-width 0.25s ease,
                opacity 0.18s ease;
  }
  .compose-fab.collapsed {
    padding: 0;
    width: 46px;
    gap: 0;
  }
  .compose-fab.collapsed .fab-label {
    max-width: 0;
    opacity: 0;
  }
  .compose-fab:active {
    transform: scale(0.93);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
  }
  .compose-fab.fab-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8) translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
  }

  /* Toast clears bottom bar */
  .toast-container { bottom: 76px; }

  /* Tab bar on mobile: show hamburger, collapse search to icon, compress tabs */
  .wtab-mobile-menu { display: flex; }
  .wtab-label { max-width: 72px; }
  .wtab-global { padding-left: 4px; }

  /* Search: icon-only button on mobile */
  .wtab-search-wrap {
    width: 34px;
    min-width: 34px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    background: transparent;
    border-color: transparent;
  }
  .wtab-search-wrap .wtab-search-icon { font-size: 20px; }
  .wtab-search-module,
  .wtab-search-divider,
  .wtab-search-input { display: none; }
  .compose-tab-header { padding: 12px 16px 8px; }

  /* ── Mobile mail rows ────────────────────────────────── */
  /* Remove left column (dot/checkbox) by default — restored in selection mode */
  .mail-row {
    grid-template-columns: 34px 1fr;
    column-gap: 10px;
    padding: 13px 12px 13px 14px;
    align-items: start;
  }
  /* Avatar top-aligned with sender text line */
  .mail-row > .avatar-circle { margin-top: 2px; }
  .row-check-wrap { display: none; }

  /* Unread: blue date + dot beside it */
  .mail-row.unread .mail-time {
    color: var(--c-accent);
    font-weight: 600;
  }
  .mail-row.unread .mail-time::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--c-accent);
    margin-right: 5px;
    vertical-align: middle;
    position: relative;
    top: -1px;
  }

  /* Selection mode: restore checkbox column */
  .mail-list.has-selection .mail-row {
    grid-template-columns: 20px 34px 1fr;
  }
  .mail-list.has-selection .row-check-wrap { display: flex; }

  /* Actions: hide all hover buttons, but keep star always visible */
  .mail-row-actions {
    background: transparent;
    padding: 0;
    opacity: 1 !important;
    pointer-events: auto !important;
    right: 10px;
  }
  .mail-action-btn:not(.mail-star-btn) { display: none; }
  .mail-star-btn {
    width: 36px;
    height: 36px;
    font-size: 20px;
    opacity: 1;
  }
  /* Prevent content from sliding under the star button */
  .mail-row-content { padding-right: 38px; }

  /* Stack subject + preview on separate lines */
  .mail-subject-line {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 1px !important;
  }
  .mail-subject {
    max-width: 100% !important;
    font-size: 14px;
  }
  .mail-preview {
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden !important;
    white-space: normal !important;
    flex: unset !important;
    font-size: 12.5px;
    color: var(--c-text-muted);
  }
  .mail-sender { font-size: 14.5px; }
  .mail-row-content { gap: 3px; }
}
