/* SweepBox Pro app — brand tokens copied from the marketing site so the two
   surfaces read as one product. */
:root {
  --bg: #fafafa;
  --bg-elevated: #ffffff;
  --bg-sunken: #f4f4f5;
  --bg-deep: #0a0a0b;

  --border: #e4e4e7;
  --border-strong: #d4d4d8;

  --text-primary: #18181b;
  --text-secondary: #52525b;
  --text-tertiary: #71717a;

  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-bg: rgba(124, 58, 237, 0.08);
  --accent-grad: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);

  --success: #059669;
  --danger: #dc2626;

  --container: 960px;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Always reserve room for the vertical scrollbar so the centered layout
   doesn't jump sideways when content grows/shrinks past one screenful
   (e.g. filtering the sender list, switching tabs). */
html {
  scrollbar-gutter: stable;
  overflow-y: scroll;
}

/* The app toggles views via the hidden attribute; without this, any
   element that also has a display rule (flex/grid) ignores hidden. */
[hidden] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }

/* Top bar --------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 250, 0.82);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  gap: 16px;
}

.nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent-grad);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(124, 58, 237, 0.32);
  flex-shrink: 0;
}
.brand-mark svg { width: 19px; height: 19px; }

.pro-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--accent);
  vertical-align: super;
}

.topbar-right { display: flex; align-items: center; gap: 12px; }
.account-email { font-size: 13px; color: var(--text-secondary); }

.plan-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 100px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  color: var(--text-tertiary);
}
.plan-chip .live-dot { width: 7px; height: 7px; }
.plan-chip-active {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}

/* Buttons --------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  border: none;
  transition: transform 120ms ease, box-shadow 200ms ease, background 200ms ease;
}
.btn:disabled { opacity: 0.55; cursor: default; }
.btn svg { width: 16px; height: 16px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn:not(.btn-sm):not(.btn-lg) { padding: 10px 18px; font-size: 14px; }

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); }

.btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--accent); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { transform: translateY(-1px); }

.btn-success { background: var(--success); color: #fff; box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3); }
.btn-success:hover:not(:disabled) { transform: translateY(-1px); }

.btn-info { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3); }
.btn-info:hover:not(:disabled) { transform: translateY(-1px); }

/* Views ----------------------------------------------------------------- */

.view { flex: 1; width: 100%; max-width: var(--container); margin: 0 auto; padding: 24px; }
.view-center { display: flex; align-items: center; justify-content: center; }

.signin-card {
  max-width: 460px;
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 40px;
  box-shadow: 0 14px 40px rgba(124, 58, 237, 0.10);
}
.signin-card h1 { font-size: 28px; letter-spacing: -0.02em; margin-bottom: 12px; }
.signin-card p { color: var(--text-secondary); margin-bottom: 24px; }
.signin-note { font-size: 12px !important; color: var(--text-tertiary) !important; margin: 16px 0 0 !important; }

/* Paywall --------------------------------------------------------------- */

.paywall {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, var(--bg-elevated) 0%, rgba(124, 58, 237, 0.05) 100%);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
}
.paywall-text { font-size: 14px; color: var(--text-secondary); }
.paywall-text strong { color: var(--accent); }

/* Active-subscription banner: title + green Active tag + renewal, one line. */
.pro-banner-sub { color: var(--text-secondary); }
.active-tag {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin: 0 6px 0 5px;
  padding: 3px 10px;
  border-radius: 100px;
  background: rgba(5, 150, 105, 0.12);
  color: var(--success);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.3);
  animation: live-pulse 2.8s ease-out infinite;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.3); }
  70% { box-shadow: 0 0 0 4px rgba(5, 150, 105, 0); }
  100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.paywall-actions { display: flex; gap: 10px; }

/* Stats ----------------------------------------------------------------- */

/* Stats row and the Dashboard's getting-started guide share this grid — and
   a fixed row height, so switching tabs never shifts the tabs beneath. */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
/* Fixed row height, not min-height: the two headers hold different content,
   and only an exact height keeps the tabs from shifting between tabs. */
.stats { grid-auto-rows: 88px; }
.stat { justify-content: center; }
.stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}
.stat strong { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.stat span { font-size: 12px; color: var(--text-tertiary); }
.stat-cap { display: inline-flex; align-items: center; gap: 6px; }

/* The Dashboard's figures are lifetime tallies — the caption explains what
   counts, so mark it as hoverable. */
.stat span[data-tip] {
  cursor: help;
  text-decoration: underline dotted var(--border-strong);
  text-underline-offset: 3px;
}

/* Tabs ------------------------------------------------------------------ */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-tertiary);
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.panel-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.panel-hint { font-size: 13px; color: var(--text-tertiary); margin-bottom: 14px; }
.progress { font-size: 13px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* Rows ------------------------------------------------------------------ */

.list-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.select-all { margin-right: 12px; } /* extra breathing room before the filter */
/* Trash toolbar: count on the left, search pushed to the right. */
#trash-count-label { margin-right: auto; font-weight: 600; color: var(--text-secondary); }
.toolbar-select {
  font-family: inherit;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px 34px 8px 10px; /* room for the custom arrow + breathing space */
  cursor: pointer;
  max-width: 220px;
  /* Replace the native arrow (which hugs the border) with a chevron set in
     from the right edge. */
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%2371717a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 4.5 L6 8 L9.5 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 11px;
}
/* "Sort by" label sits outside, left of the dropdown; the group is pinned to
   the far-right of the toolbar. */
.sort-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
/* "Sort by ↓" — bare inline label + arrow, no box/border; whole thing toggles
   the sort direction. */
.sort-label-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
}
.sort-label-btn:hover { color: var(--accent); }
.sort-label-btn svg { width: 15px; height: 15px; transition: transform 150ms ease; }
.sort-label-btn.asc svg { transform: rotate(180deg); } /* flip arrow up for ascending */
.toolbar-select:hover { border-color: var(--accent); }
.toolbar-select:focus { outline: 2px solid var(--accent-bg); border-color: var(--accent); }
.select-all {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.select-all.all-selected { color: var(--accent); }
.select-all-count {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}
.select-all.all-selected .select-all-count { color: var(--accent); }

/* Custom beveled checkbox — brand-filled with a white check when on.
   Shared by the Select-all control and the row selection checkboxes. */
.sb-check {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 5px;
  border: 2px solid var(--border-strong);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
  background-repeat: no-repeat;
  background-position: center;
  /* Fill the whole box (under the border too) so the brand colour reaches
     the rounded edge instead of leaving a frame. */
  background-origin: border-box;
  background-clip: border-box;
}
.sb-check:hover { border-color: var(--accent); }
.sb-check:checked,
.sb-check:indeterminate {
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.sb-check:checked {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E"),
    linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  background-size: 62%, cover;
}
/* Gmail-style tick: the box springs in and the check grows with it. Driven
   by a one-shot .sb-pop class added on a real user toggle (not on list
   re-renders), so selected boxes don't re-pop while filtering. */
.sb-check.sb-pop:checked {
  animation: sb-check-pop 240ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes sb-check-pop {
  0% { transform: scale(0.5); background-size: 0%, cover; }
  55% { transform: scale(1.14); }
  100% { transform: scale(1); background-size: 62%, cover; }
}
@media (prefers-reduced-motion: reduce) {
  .sb-check.sb-pop:checked { animation: none; }
  .bulkbar { transition: opacity 120ms ease; }
}
.sb-check:indeterminate {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='5' y='11' width='14' height='2.6' rx='1.3' fill='white'/%3E%3C/svg%3E"),
    linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  background-size: 62%, cover;
}
.filter-input {
  flex: 0 1 240px;
  min-width: 0;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 9px 12px;
}
.filter-input:focus { outline: 2px solid var(--accent-bg); border-color: var(--accent); }
.sender-list { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; }

/* Free-preview teaser: blurred, non-interactive sender rows + unlock CTA. */
.row.locked {
  filter: blur(5px);
  pointer-events: none;
  user-select: none;
  opacity: 0.9;
}
.free-lock-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 22px 20px;
  border: 1px solid var(--accent);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--bg-elevated) 0%, rgba(124, 58, 237, 0.05) 100%);
}
/* Overlay variant: JS centers it vertically over the blurred rows. */
.free-lock-cta.overlay {
  position: absolute;
  left: 0;
  right: 0;
  margin: 0;
  z-index: 3;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}
.free-lock-ic {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--accent-bg);
}
.free-lock-title { font-size: 15px; font-weight: 700; }
.free-lock-text { font-size: 13px; color: var(--text-secondary); max-width: 380px; line-height: 1.5; }
.free-lock-cta .btn { margin-top: 4px; }
/* Reserve space at the bottom so the fixed bulk bar never covers the last
   rows or the pager. */
#panel-senders { padding-bottom: 90px; }
.list-empty { padding: 24px 4px; font-size: 14px; color: var(--text-tertiary); text-align: center; }

/* Pagination -------------------------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}
.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.page-btn.current {
  background: var(--accent-grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.32);
}
.page-btn:disabled { opacity: 0.4; cursor: default; }
.page-ellipsis { color: var(--text-tertiary); padding: 0 2px; font-size: 14px; }
.page-size {
  margin-left: 8px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 6px 32px 6px 10px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%2371717a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 4.5 L6 8 L9.5 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 11px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}
.row.selected { border-color: var(--accent); background: var(--accent-bg); }
.row-clickable { cursor: pointer; user-select: none; }
.row-clickable:hover { border-color: var(--border-strong); }
.row-clickable.selected:hover { border-color: var(--accent); }
.row .sb-check { margin: 0; }

.row-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  border: 1px solid var(--border);
}
.row-avatar img { width: 100%; height: 100%; object-fit: contain; }

.row-meta { flex: 1; min-width: 0; }
.row-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 12px; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.row-badges { display: flex; gap: 6px; flex-shrink: 0; }
.badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 100px;
}
.badge-good { background: rgba(5, 150, 105, 0.1); color: var(--success); }
.badge-ok { background: var(--accent-bg); color: var(--accent); }
/* Organizational label tags (Reading list / filed → label) — light blue. */
.badge-label { background: rgba(14, 165, 233, 0.12); color: #0284c7; }
.badge-dim { background: var(--bg-sunken); color: var(--text-tertiary); }
.badge-danger { background: rgba(220, 38, 38, 0.1); color: var(--danger); }
/* Unsubscribed pill — matches the Chrome extension: green check, title case,
   soft green fill with a thin green outline. */
.badge-unsub {
  background: rgba(5, 150, 105, 0.1);
  color: var(--success);
  border: 1px solid rgba(5, 150, 105, 0.3);
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  padding: 3px 10px;
}
/* Storage value reads a touch larger than the status tags. */
.badge-size { font-size: 12px; padding: 3px 10px; }
/* Relative age of a sender's most recent email — lowercase so "3d ago"
   reads as a duration rather than shouting like the status badges. Teal keeps
   it from blurring into the grey storage pill on one side and the purple
   count pill on the other. */
.badge-last {
  font-size: 12px;
  padding: 3px 10px;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  background: rgba(13, 148, 136, 0.12);
  color: #0f766e;
}

.row-count { font-weight: 700; font-size: 14px; color: var(--accent); flex-shrink: 0; font-variant-numeric: tabular-nums; }
/* Sender email-count as a soft pill (scoped so other .row-count uses stay plain). */
.count-pill {
  font-size: 13px;
  background: var(--accent-bg);
  border: 1px solid rgba(124, 58, 237, 0.22);
  border-radius: 100px;
  padding: 3px 12px;
}

/* Bulk bar -------------------------------------------------------------- */

.bulkbar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  width: min(880px, calc(100% - 40px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg-deep);
  color: #fff;
  border-radius: 14px;
  padding: 12px 18px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  font-size: 14px;
  z-index: 40;
  /* Hidden resting state: parked below the viewport, faded, non-interactive.
     Toggling .visible slides it up. Kept in the DOM (not display:none) so the
     transform can transition. */
  transform: translate(-50%, calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
  transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1), opacity 200ms ease;
}
.bulkbar.visible {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}
.bulkbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bulkbar .btn-ghost { color: rgba(255, 255, 255, 0.7); }
.bulkbar .btn-ghost:hover { color: #fff; }

/* Scan options ----------------------------------------------------------- */
.scan-options { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.scan-opt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.scan-opt .sb-check { width: 18px; height: 18px; }
.scan-opt-group { display: inline-flex; align-items: center; gap: 6px; }
.help-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  user-select: none;
  flex-shrink: 0;
}
.help-ic:hover { border-color: var(--accent); color: var(--accent); }

/* First-run empty state ------------------------------------------------- */

/* First-run prompt — the whole screen until a scan lands, so it sits centred
   in the panel instead of hanging off the top. */
.scan-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  max-width: 520px;
  min-height: min(56vh, 460px);
  margin: 0 auto;
  padding: 0 20px;
}
.scan-empty-ic {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-bg);
  color: var(--accent);
}
.scan-empty-ic svg { width: 34px; height: 34px; }
.scan-empty-title { font-size: 22px; font-weight: 700; letter-spacing: -0.015em; }
/* Two classes deep so it outweighs .btn:not(.btn-sm):not(.btn-lg). */
.scan-empty .btn.btn-primary { font-size: 15px; padding: 12px 26px; border-radius: 11px; }
/* Only used by the background-scan note now; empty on the first-run prompt. */
.scan-empty-text { font-size: 14px; color: var(--text-secondary); line-height: 1.6; margin: 0; }
.scan-empty-text:empty { display: none; }

/* Visual scan progress --------------------------------------------------- */

.scan-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: min(56vh, 460px);
  padding: 20px;
}
.scan-ring-wrap {
  position: relative;
  width: 236px;
  height: 236px;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Soft pulsing purple halo behind the ring. */
.scan-ring-wrap::before {
  content: '';
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.14) 0%, rgba(124, 58, 237, 0.05) 55%, transparent 75%);
  filter: blur(8px);
  animation: scan-halo 3.2s ease-in-out infinite;
}
@keyframes scan-halo {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

.scan-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.scan-track { fill: none; stroke: var(--border); stroke-width: 6; }
.scan-arc {
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
  /* Circumference for r=52 ≈ 326.7. Indeterminate spin by default. */
  stroke-dasharray: 80 327;
  transform-origin: 60px 60px;
  animation: scan-spin 1.3s linear infinite;
}
@keyframes scan-spin { to { transform: rotate(360deg); } }
/* Determinate: JS sets stroke-dasharray to (p×C  C); smooth chase between ticks. */
.scan-ring.determinate .scan-arc {
  animation: none;
  transition: stroke-dasharray 260ms linear;
}
.scan-ring.success .scan-arc {
  animation: none;
  stroke: var(--success);
  stroke-dasharray: 327 327;
  transition: stroke 300ms ease, stroke-dasharray 400ms ease;
}
.scan-ring-wrap.success::before {
  background: radial-gradient(circle, rgba(5, 150, 105, 0.16) 0%, rgba(5, 150, 105, 0.05) 55%, transparent 75%);
}

.scan-center {
  position: relative;
  z-index: 1;
  text-align: center;
}
.scan-count {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.scan-phase {
  margin-top: 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.scan-sub { font-size: 13px; color: var(--text-secondary); font-variant-numeric: tabular-nums; min-height: 16px; }

/* Dismissible panels ---------------------------------------------------- */

/* Highlighted, dismissible panel above the sender list — used by the
   "New senders" block. */
.recs {
  position: relative;
  background: linear-gradient(180deg, var(--bg-elevated) 0%, rgba(124, 58, 237, 0.04) 100%);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.recs-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.recs-hint { font-size: 12px; color: var(--text-tertiary); }
.rec-list { display: flex; flex-direction: column; gap: 6px; }

.recs-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--text-tertiary);
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.recs-close:hover { background: var(--bg-sunken); color: var(--text-secondary); }

.badge-warn { background: rgba(245, 158, 11, 0.14); color: #b45309; }

/* Cleanup run view ------------------------------------------------------- */

.cleanup-run {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 28px 20px 8px;
}

/* The steps of a cleanup, in order, each lighting up as it runs. */
.run-steps {
  list-style: none;
  width: min(460px, 100%);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.run-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  color: var(--text-tertiary);
  transition: background 200ms ease, color 200ms ease;
}
.run-step-mark {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid var(--border-strong);
  position: relative;
}
.run-step-name { flex: 1; min-width: 0; }
.run-step-detail { font-size: 12px; color: var(--text-tertiary); white-space: nowrap; }

/* Active: tinted row, pulsing marker. */
.run-step.active {
  background: var(--accent-bg);
  color: var(--text-primary);
  font-weight: 600;
}
.run-step.active .run-step-mark {
  border-color: var(--accent);
  animation: run-pulse 1.1s ease-in-out infinite;
}
@keyframes run-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(124, 58, 237, 0); }
}

/* Done: green check in place of the ring. */
.run-step.done { color: var(--text-primary); }
.run-step.done .run-step-mark {
  border-color: var(--success);
  background: var(--success);
}
.run-step.done .run-step-mark::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.run-step.skipped { opacity: 0.55; }
.run-step.skipped .run-step-mark { border-style: dashed; }

/* Results, once the run finishes. */
.run-summary {
  width: min(460px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-top: 4px;
  animation: wiz-pop 260ms cubic-bezier(0.34, 1.4, 0.64, 1);
}
.run-summary-total { text-align: center; }
.run-summary-total strong {
  display: block;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.run-summary-total span { font-size: 13px; color: var(--text-tertiary); }
.run-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}
.run-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 10px;
}
.run-tile strong { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
.run-tile span { font-size: 11px; color: var(--text-tertiary); line-height: 1.35; }
.run-summary-lines {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-sunken);
  border-radius: 12px;
  padding: 12px 14px;
}
.run-line { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }

/* Dashboard -------------------------------------------------------------- */

.routine-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(180deg, var(--bg-elevated) 0%, rgba(124, 58, 237, 0.04) 100%);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
}

.enforce-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 12px;
}

.run-results {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.run-results { position: relative; padding-right: 40px; }
.run-results strong { color: var(--text-primary); }
.run-results-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}
.run-results-when { font-size: 12px; color: var(--text-tertiary); }

/* Cleanup hero ---------------------------------------------------------- */
.cleanup-hero {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.10) 0%, rgba(124, 58, 237, 0.03) 60%);
  border: 1px solid var(--accent);
  border-radius: 18px;
  padding: 20px 22px;
  margin-bottom: 16px;
}
.cleanup-hero-top { display: flex; align-items: center; gap: 16px; }
.cleanup-hero-ic {
  width: 54px;
  height: 54px;
  border-radius: 15px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 27px;
  background: var(--bg-elevated);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.22);
}
.cleanup-hero-main { flex: 1; min-width: 0; }
.cleanup-hero-title { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.cleanup-hero-sub { font-size: 13px; color: var(--text-secondary); margin-top: 3px; line-height: 1.5; }
/* The three steps a cleanup runs, in order. Each is a button into whatever
   configures it, so the hero doubles as the map of the feature. */
/* Shared track sizing: the hero's three steps and the three columns under
   them line up, and the rules column gets the extra width it needs. */
.cleanup-plan,
.cleanup-cols {
  display: grid;
  grid-template-columns: 1fr 1fr 1.35fr;
  gap: 12px;
}
.cleanup-plan {
  list-style: none;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(124, 58, 237, 0.16);
}
.cstep {
  position: relative; /* anchors the corner help icon */
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 13px;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease;
}
/* Top-right corner of the step box. The state tag below it gets bottom-
   aligned so the two never crowd each other. */
.cstep-help { position: absolute; top: 7px; right: 8px; }
.cstep-state { align-self: flex-end; }
.cstep:hover { border-color: var(--accent); transform: translateY(-1px); }
.cstep:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* A step with nothing to do reads as inactive but stays clickable — that's
   exactly the click that turns it on. */
.cstep.off { background: var(--bg-sunken); border-style: dashed; }
.cstep.off .cstep-ic { filter: grayscale(1); opacity: 0.5; }
.cstep-ic { font-size: 19px; line-height: 1; flex-shrink: 0; }
.cstep-meta { flex: 1; min-width: 0; }
.cstep-name { font-size: 13px; font-weight: 700; }
.cstep-detail {
  font-size: 11.5px;
  color: var(--text-tertiary);
  line-height: 1.35;
  margin-top: 1px;
}
.cstep-state {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--success);
  flex-shrink: 0;
}
.cstep.off .cstep-state { color: var(--text-tertiary); }

/* Three columns, one per cleanup step, lined up under the step boxes in the
   hero above (hence the 23px inset — the hero's 1px border + 22px padding). */
.cleanup-cols {
  align-items: start;
  padding: 4px 23px 0;
}
.cleanup-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* Each column names its step, numbered in the order a cleanup runs them. */
.col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 14px 2px 2px;
}
.col-num {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
/* Sub-heading inside a column (Starter rules / Your own rules). */
.col-sub {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: 8px 2px 0;
}
.col-sub-split { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.col-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
}
.col-empty-text { font-size: 12.5px; color: var(--text-tertiary); line-height: 1.5; }
/* Column 2's two list shapes share one compact row: icon, name over its
   destination label, then controls — switch last. */
.filed-row,
.vault-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 12px;
}
.filed-row .row-meta,
.vault-row .row-meta { flex: 1; min-width: 0; }
.filed-row .row-name,
.vault-row .row-name { font-size: 13px; font-weight: 700; }
.filed-row .row-sub,
.vault-row .row-sub { font-size: 11.5px; color: var(--accent); }
/* One line per row, whatever the name's length — the column rule that lets
   text wrap would otherwise push these to two. */
.cleanup-col .filed-row .row-name,
.cleanup-col .filed-row .row-sub,
.cleanup-col .vault-row .row-name,
.cleanup-col .vault-row .row-sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Paused rows read as inactive without losing their controls. */
.filed-row.off,
.vault-row.off { background: var(--bg-sunken); }
.filed-row.off .row-name,
.vault-row.off .row-name { color: var(--text-secondary); }
.filed-row.off .row-sub,
.vault-row.off .row-sub { color: var(--text-tertiary); }
.filed-row.off .avatar,
.vault-row.off .rule-ic { filter: grayscale(1); opacity: 0.6; }
/* The card wraps its button onto a second line — centre it there. */
#enforce-edit { margin: 2px auto 0; }

/* The vault icon and Edit shrink so the row survives a narrow column. */
.vault-row .rule-ic { width: 30px; height: 30px; font-size: 15px; border-radius: 9px; flex-shrink: 0; }
.vault-row .btn-sm { padding: 6px 11px; flex-shrink: 0; }
.col-foot-btn { align-self: flex-start; }
.col-more { font-size: 12px; color: var(--text-tertiary); padding: 2px 4px; }

/* A third of the width is tight — cards stack their controls under the text
   rather than squeezing it, and nothing truncates to an ellipsis. */
.cleanup-col .preset-head,
.cleanup-col .rule-card,
.cleanup-col .step-card,
.cleanup-col .watch-row { flex-wrap: wrap; gap: 10px; }
/* These two lead with an icon/avatar — keep it beside the text and let the
   badge and control wrap underneath instead. */
.cleanup-col .step-card .row-meta,
.cleanup-col .watch-row .row-meta { flex: 1 1 120px; }
.cleanup-col .row-name,
.cleanup-col .row-sub {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
.cleanup-col .rule-actions { margin-left: auto; }
.cleanup-col .preset-card,
.cleanup-col .rule-card,
.cleanup-col .step-card,
.cleanup-col .col-empty { padding: 12px 14px; }
.cleanup-col .row-name { font-size: 13.5px; line-height: 1.35; }
.cleanup-col .row-sub { font-size: 12px; line-height: 1.45; }
.cleanup-col .preset-head { gap: 8px; }
.cleanup-col .preset-results { margin-top: 10px; padding-top: 10px; }
/* Text on its own line, controls in a row beneath it. */
.cleanup-col .preset-head .row-meta,
.cleanup-col .rule-card .row-meta { flex: 1 1 100%; order: -1; }
.cleanup-col .preset-card.starter .preset-head { flex-wrap: nowrap; }
.cleanup-col .preset-head .switch,
.cleanup-col .rule-card .switch { margin-right: 2px; }
.cleanup-col .rule-card .row-meta .badge { align-self: flex-start; margin-top: 5px; }
.cleanup-col .rule-card .row-meta { display: flex; flex-direction: column; }
.cleanup-col .step-card { align-items: center; }
/* The expand chevron belongs at the end of the control row, not floating. */
.cleanup-col .section-hint { margin: 0 2px 2px; }

@media (max-width: 900px) {
  .cleanup-cols { grid-template-columns: 1fr; padding: 4px 0 0; }
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: 20px 2px 9px;
}
.section-label-split { display: flex; align-items: center; justify-content: space-between; }

.step-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
}
.step-ic {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.step-ic-shield { background: rgba(5, 150, 105, 0.12); }

#watch-pages { margin-top: 10px; }
/* Search + sort above the watched list, same controls as the sender list. */
.watch-toolbar { margin: 14px 0 0; gap: 10px; }
.watch-toolbar .filter-input { flex: 1; min-width: 0; }
/* The unsubscribe date gets its own line so it can't be clipped by the badge
   and Remove button beside it. */
.watch-when { font-size: 11.5px; color: var(--text-tertiary); margin-top: 2px; }

/* Watched senders, inside their dialog — scrolls once the list is long,
   with the pagination pinned under it by the dialog's own layout. */
.watch-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 14px 0 4px;
  max-height: min(52vh, 440px);
  overflow-y: auto;
}
.watch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
}
.watch-row .row-count { margin-left: auto; }
.watch-pagination { margin: 10px 0 2px -12px; }


/* Organize tab ---------------------------------------------------------- */
.organize-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.10) 0%, rgba(124, 58, 237, 0.03) 60%);
  border: 1px solid var(--accent);
  border-radius: 18px;
  padding: 18px 20px;
  margin-bottom: 4px;
}
.organize-hero-ic {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: var(--bg-elevated);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.2);
}
.organize-hero-title { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.organize-hero-sub { font-size: 13px; color: var(--text-secondary); margin-top: 3px; line-height: 1.5; }

.step-ic-receipts { background: rgba(245, 158, 11, 0.14); }
.step-ic-travel { background: rgba(2, 132, 199, 0.14); }
.step-ic-shipping { background: rgba(5, 150, 105, 0.14); }
.step-ic-finance { background: rgba(124, 58, 237, 0.14); }
.vaults-list { display: flex; flex-direction: column; gap: 8px; }
.org-head { display: flex; align-items: center; gap: 8px; }

.organized-list { display: flex; flex-direction: column; gap: 8px; }
.org-card {
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px 16px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.org-card:hover { border-color: var(--border-strong); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04); }
.org-card .row-meta { flex: 1; min-width: 0; }
.org-filed { font-size: 12px; color: var(--text-tertiary); white-space: nowrap; flex-shrink: 0; }

/* Empty state reads as one compact row — icon, then title over hint — so an
   unused section costs a few lines, not half a screen. */
.org-empty {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  flex-wrap: wrap;
}
.org-empty-ic {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  background: var(--bg-sunken);
}
/* Title and hint share the remaining width, stacked tight. */
.org-empty-title { font-size: 14px; font-weight: 700; }
.org-empty-text { font-size: 12.5px; color: var(--text-tertiary); line-height: 1.45; }
.org-empty-copy { min-width: 220px; flex: 1; }

/* Short explainer under a section label. */
.section-hint {
  font-size: 12.5px;
  color: var(--text-tertiary);
  line-height: 1.5;
  max-width: 640px;
  margin: -4px 2px 10px;
}

@media (max-width: 560px) {
  .cleanup-plan { grid-template-columns: 1fr; }
  .cleanup-hero-top { flex-wrap: wrap; }
  .cleanup-hero-top .btn { width: 100%; }
}

.panel-head-split { justify-content: space-between; margin-top: 8px; }
.panel-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.rule-list { display: flex; flex-direction: column; gap: 8px; }

.rule-card {
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.rule-card:hover { border-color: var(--border-strong); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04); }
.rule-card.disabled { background: var(--bg-sunken); }
.rule-card.disabled .row-meta,
.rule-card.disabled .rule-ic { opacity: 0.4; }
.rule-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.rule-ic {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.rule-ic-archive { background: rgba(2, 132, 199, 0.12); }
.rule-ic-trash { background: rgba(220, 38, 38, 0.10); }
.rule-ic-markRead { background: rgba(107, 114, 128, 0.14); }
.rule-ic-label { background: var(--accent-bg); }

/* iOS-style toggle for enabling rules */
.switch { position: relative; width: 34px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; cursor: pointer; margin: 0; }
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 100px;
  background: var(--border-strong);
  transition: background 150ms ease;
  pointer-events: none;
}
.switch span::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 150ms ease;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(14px); }

.rule-form {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rule-form input[type='text'],
.rule-form input[type='number'],
.rule-form select {
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
}
.rule-form input:focus, .rule-form select:focus {
  outline: 2px solid var(--accent-bg);
  border-color: var(--accent);
}
.rule-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 14px;
}
.rule-form label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rule-form .rf-check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding-top: 18px;
}
.rule-form .rf-check input { accent-color: var(--accent); width: 15px; height: 15px; }
.rule-form .rf-check-group { display: flex; align-items: center; gap: 6px; padding-top: 18px; }
.rule-form .rf-check-group .rf-check { padding-top: 0; }
.rule-form .rf-span { grid-column: 1 / -1; }
.rule-form-actions { display: flex; gap: 8px; }

/* Per-row policy buttons (Senders tab) */
.policy-btns { display: flex; gap: 6px; flex-shrink: 0; }
.policy-btn {
  position: relative;
  height: 30px;
  padding: 0 8px;
  border-radius: 9px;
  /* Inactive: white box, dark outline, coloured icon, no label. */
  border: 1.5px solid var(--text-secondary);
  background: var(--bg-elevated);
  cursor: help; /* signals the hover tooltip explaining the action */
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.policy-ic { display: inline-flex; }
.policy-ic svg { width: 15px; height: 15px; display: block; }
.policy-label { display: none; } /* shown only when active */
.pb-block { color: var(--danger); }
.policy-btn:hover:not(.on) { background: var(--bg-sunken); }

/* Confirmation dialog ---------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 10, 11, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: wiz-fade 160ms ease;
}
.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elevated);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
  animation: wiz-pop 200ms cubic-bezier(0.34, 1.4, 0.64, 1);
}
/* The rule builder needs two columns of fields, so it gets a wider card that
   scrolls rather than overflowing a short window. */
.modal-card-wide { max-width: 560px; max-height: 86vh; overflow-y: auto; }
/* Inside the dialog the form is the dialog — drop its own card chrome. */
#rule-modal .rule-form {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  margin-bottom: 0;
}
#rule-modal .rule-form-actions { justify-content: flex-end; margin-top: 4px; }

.modal-title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 8px; }
.modal-message { font-size: 14px; color: var(--text-secondary); line-height: 1.55; white-space: pre-line; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
/* Optional follow-up inside a confirmation (e.g. "also trash their mail"). */
.modal-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--bg-sunken);
  border-radius: 12px;
  font-size: 13.5px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.modal-check:hover { color: var(--text-primary); }

/* Label picker (File under…) */
#label-modal .filter-input { width: 100%; margin-top: 14px; }
.label-list {
  margin-top: 10px;
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
}
.label-row:hover { border-color: var(--accent); background: var(--accent-bg); }
.label-create { color: var(--accent); font-weight: 600; }
.label-ic { font-size: 13px; flex-shrink: 0; }
.label-empty { font-size: 13px; color: var(--text-tertiary); padding: 10px 4px; }
.label-row-wrap { display: flex; align-items: stretch; gap: 4px; }
.label-row-wrap .label-row { flex: 1; width: auto; }
.label-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-tertiary);
  cursor: pointer;
}
.label-del:hover { border-color: var(--danger); color: var(--danger); background: rgba(220, 38, 38, 0.06); }

/* Manage account page */
.account-card { max-width: 520px; position: relative; }
.acct-section { margin-top: 20px; }
.acct-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}
.acct-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
}
.acct-row-meta { flex: 1; min-width: 0; }
.acct-row-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-row-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.acct-plan {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: linear-gradient(180deg, var(--bg-elevated) 0%, rgba(124, 58, 237, 0.04) 100%);
}
.acct-plan-head { display: flex; align-items: center; gap: 10px; }
.acct-plan-name { font-size: 15px; }
.acct-plan-name strong { color: var(--accent); }
.acct-plan-detail { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
.acct-plan-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.acct-note { font-size: 13px; color: var(--text-secondary); line-height: 1.55; margin: 0 0 12px; }
.acct-footer {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 22px;
  font-size: 12px;
  color: var(--text-tertiary);
}
.acct-footer a { color: var(--text-secondary); text-decoration: none; }
.acct-footer a:hover { color: var(--accent); }

/* Pricing / Pro plans modal */
.pricing-card { max-width: 560px; position: relative; }
.pricing-head { text-align: center; margin-bottom: 18px; }
.pricing-title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.pricing-title span { color: var(--accent); }
.pricing-sub { font-size: 13px; color: var(--text-secondary); line-height: 1.55; margin-top: 6px; max-width: 420px; margin-left: auto; margin-right: auto; }
.pricing-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plan {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-elevated);
}
.plan-best {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--bg-elevated) 0%, rgba(124, 58, 237, 0.06) 100%);
}
.plan-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: var(--accent-grad, var(--accent));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 100px;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35);
}
.plan-name { font-size: 13px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.plan-price { display: flex; align-items: baseline; gap: 4px; }
.plan-price strong { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; }
.plan-price span { font-size: 13px; color: var(--text-tertiary); }
.plan-note { font-size: 12px; color: var(--text-tertiary); min-height: 30px; }
.plan .btn { margin-top: 6px; }

.pricing-features { margin-top: 20px; }
.pricing-features-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-tertiary); margin-bottom: 10px; }
.feature-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.feature-list li {
  position: relative;
  padding-left: 26px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.feature-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 1px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: rgba(5, 150, 105, 0.14) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23059669' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M5 13l4 4L19 7'/></svg>") center / 11px no-repeat;
}
.pricing-foot { text-align: center; font-size: 12px; color: var(--text-tertiary); margin-top: 18px; }

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

/* First-run walkthrough ------------------------------------------------- */

.tour { position: fixed; inset: 0; z-index: 130; }
/* The spotlight is an empty box; its enormous shadow dims everything else,
   so the highlighted element stays at full contrast inside the cut-out. */
.tour-spot {
  position: fixed;
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(10, 10, 11, 0.55);
  border: 2px solid var(--accent);
  transition: top 220ms ease, left 220ms ease, width 220ms ease, height 220ms ease;
  pointer-events: none;
}
.tour-box {
  position: fixed;
  width: min(360px, calc(100vw - 24px));
  background: var(--bg-elevated);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
  animation: wiz-pop 200ms cubic-bezier(0.34, 1.4, 0.64, 1);
  transition: top 220ms ease, left 220ms ease;
}
.tour-count {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
}
.tour-title { font-size: 17px; font-weight: 800; letter-spacing: -0.015em; margin-top: 4px; }
.tour-text { font-size: 13px; color: var(--text-secondary); line-height: 1.55; margin-top: 6px; }
.tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}
.tour-nav { display: flex; gap: 8px; }

/* Cursor-following tooltip (JS-positioned; see initCursorTips). */
.cursor-tip {
  position: fixed;
  z-index: 200;
  background: var(--bg-deep);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  max-width: 320px;
  white-space: pre-line; /* honour \n in multi-line tips (e.g. address lists) */
  opacity: 0;
  transition: opacity 90ms ease;
}
.cursor-tip.show { opacity: 1; }

/* Active: solid colour fill, white icon + "Protected"/"Blocked" label. */
.policy-btn.on { border-color: transparent; padding: 0 11px 0 9px; color: #fff; }
.policy-btn.on .policy-label { display: inline; }
.pb-block.on { background: var(--danger); box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3); }

.more-emails { text-decoration: underline dotted; text-underline-offset: 2px; cursor: help; }


/* Presets --------------------------------------------------------------- */

.preset-list { display: flex; flex-direction: column; gap: 10px; }
.preset-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.preset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.preset-head .row-meta { flex: 1; min-width: 0; }
/* A starter that's switched on is a live rule — mark it like one. */
.preset-card.on { border-color: var(--accent); }
/* Starter rows are one line: the name (which opens the review) and the
   switch that decides whether it runs. Nothing else earns the space. */
.preset-card.starter { padding: 9px 12px; }
.preset-card.starter .preset-head { gap: 10px; align-items: center; }
.starter-name {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}
.starter-name:hover { color: var(--accent); }
.starter-name:disabled { cursor: default; opacity: 0.6; }
.starter-status { font-size: 11.5px; color: var(--text-tertiary); white-space: nowrap; }
.starter-state {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}
.starter-state.off { color: var(--text-tertiary); }

/* Preset review panel */
.preset-results {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.preset-loading, .preset-empty { font-size: 13px; color: var(--text-tertiary); padding: 4px 2px; }
.preset-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.preset-summary { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.preset-bar-actions { display: flex; gap: 8px; }
.preset-more { font-size: 12px; color: var(--text-tertiary); margin-top: 10px; }

.preset-groups { display: flex; flex-direction: column; gap: 6px; }
.pg-sender {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.pg-sender.open { border-color: var(--border-strong); }
.pg-toggle {
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 11px;
  width: 18px;
  flex-shrink: 0;
  padding: 0;
}
.pg-sender .row-count { margin-left: auto; }
.pg-emails {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 6px 30px;
  padding-left: 12px;
  border-left: 2px solid var(--border);
}
.pg-email {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
}
.pg-email:hover { background: var(--bg-sunken); }
.pg-email-body { flex: 1; min-width: 0; }
.pg-subject { font-size: 13px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-date { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }
.pg-trash {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  border-radius: 6px;
  color: var(--text-tertiary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pg-trash:hover { background: rgba(220, 38, 38, 0.1); color: var(--danger); }

/* Account switcher ------------------------------------------------------ */

.account-switcher { position: relative; }

.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 10px 4px 4px;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.account-btn:hover { border-color: var(--border-strong); }
.account-btn[aria-expanded='true'] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.account-glyph {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-grad);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}
/* Sizes to the email; only very long addresses clip. */
.account-btn-email { white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.account-caret { width: 12px; height: 12px; flex-shrink: 0; transition: transform 150ms ease; opacity: 0.7; }
.account-btn[aria-expanded='true'] .account-caret { transform: rotate(180deg); }

.account-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
  padding: 6px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: account-menu-in 120ms ease;
}
@keyframes account-menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.account-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  background: none;
  border: none;
  font-family: inherit;
  text-align: left;
  width: 100%;
}
.account-item:hover { background: var(--bg-sunken); }
.account-item .account-glyph { width: 26px; height: 26px; }
.account-item-email { flex: 1; }
.account-item-check { color: var(--accent); font-weight: 700; }
.account-item-current { font-weight: 600; }

/* Row wrapping a switch button + its remove (✕). The ✕ only appears on hover. */
.account-item-row { display: flex; align-items: center; }
.account-item-row .account-item { flex: 1; min-width: 0; }
.account-item-remove {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  margin-right: 4px;
  border: none;
  background: none;
  border-radius: 6px;
  color: var(--text-tertiary);
  font-size: 12px;
  cursor: pointer;
  opacity: 0.55;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.account-item-row:hover .account-item-remove { opacity: 1; }
.account-item-remove:hover { background: rgba(220, 38, 38, 0.1); color: var(--danger); }
.account-item-lock {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  margin-right: 4px;
  font-size: 11px;
  opacity: 0.5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.account-menu-divider { height: 1px; background: var(--border); margin: 4px 6px; }
.account-item-add {
  color: var(--text-secondary);
  font-weight: 600;
}
.account-item-add .account-glyph {
  background: var(--bg-sunken);
  color: var(--text-tertiary);
  font-size: 16px;
  font-weight: 500;
}

/* Insights chart -------------------------------------------------------- */

.chart-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 12px;
  margin-bottom: 16px;
}
.chart-title { font-size: 13px; font-weight: 700; margin-bottom: 14px; }

.chart {
  display: flex;
  align-items: flex-end;
  gap: 2px; /* surface gap between adjacent bars */
  height: 120px;
  border-bottom: 1px solid var(--border); /* recessive baseline */
  padding-bottom: 0;
}
.bar-col {
  flex: 1;
  max-width: 48px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  position: relative;
}
.bar {
  width: 100%;
  max-width: 28px;
  background: var(--accent);
  border-radius: 4px 4px 0 0; /* rounded data-end, flat at baseline */
  min-height: 2px;
}
.bar-val {
  font-size: 11px;
  color: var(--text-secondary); /* text tokens, not series color */
  font-variant-numeric: tabular-nums;
  margin-bottom: 3px;
}
.bar-tip {
  display: none;
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-deep);
  color: #fff;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 10;
}
.bar-col:hover .bar-tip { display: block; }
.bar-col:hover .bar { background: var(--accent-hover); }
.chart-x {
  display: flex;
  gap: 2px;
  margin-top: 6px;
}
.chart-x span {
  flex: 1;
  max-width: 48px;
  text-align: center;
  font-size: 10px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
}

/* Footer / toast -------------------------------------------------------- */

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  max-width: var(--container);
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px;
  font-size: 12px;
  color: var(--text-tertiary);
}
.app-footer a:hover { color: var(--accent); }

/* Guided unsubscribe wizard ---------------------------------------------- */

.wizard-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 10, 11, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: wiz-fade 160ms ease;
}
@keyframes wiz-fade { from { opacity: 0; } to { opacity: 1; } }

.wizard-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--bg-elevated);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
  animation: wiz-pop 200ms cubic-bezier(0.34, 1.4, 0.64, 1);
}
@keyframes wiz-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.wizard-progress {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 18px;
}
.wizard-progress .wiz-cur { color: var(--accent); }
.wizard-progress .wiz-of { color: var(--text-tertiary); font-weight: 600; text-transform: uppercase; font-size: 13px; margin: 0 4px; }
#wiz-total { color: var(--text-secondary); }

.wizard-sender {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}
.wizard-sender .row-avatar { width: 40px; height: 40px; border-radius: 10px; }
.wiz-meta { min-width: 0; }
.wiz-name { font-weight: 700; font-size: 16px; }
.wiz-email { font-size: 13px; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.wizard-text { font-size: 15px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 20px; }
.btn-block { width: 100%; padding: 13px; font-size: 15px; }
.wizard-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }

/* Success overlay + animated tick */
.wizard-success {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.wizard-check svg { width: 84px; height: 84px; }
.wizard-check circle {
  fill: none;
  stroke: var(--success);
  stroke-width: 3;
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  animation: wiz-circle 400ms ease forwards;
}
.wizard-check path {
  fill: none;
  stroke: var(--success);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: wiz-tick 300ms 360ms ease forwards;
}
@keyframes wiz-circle { to { stroke-dashoffset: 0; } }
@keyframes wiz-tick { to { stroke-dashoffset: 0; } }
.wizard-success-text { font-weight: 600; color: var(--success); }

.toast {
  position: fixed;
  /* Anchored in the bottom-right corner; lifts above the bulk bar only when
     one is showing (.above-bar), so it isn't left floating otherwise. */
  bottom: 20px;
  right: 20px;
  max-width: 340px;
  background: var(--accent-grad);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(124, 58, 237, 0.4),
              inset 0 1px 0 rgba(255, 255, 255, 0.18);
  z-index: 60;
}
.toast.above-bar { bottom: 84px; } /* clear the bulk action bar when it's up */

/* Responsive ------------------------------------------------------------ */

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .account-email { display: none; }
  .paywall { flex-direction: column; align-items: flex-start; }
}
