:root {
  --bg: #0a0a0a;
  --bg-card: #121212;
  --bg-elev: #1a1a1a;
  --border: #232323;
  --fg: #ededed;
  --fg-dim: #888;
  --fg-faint: #555;
  --accent: #ededed;
  --accent-dim: #888;
  --danger: #ededed;
  --good: #ededed;
  --pad: 16px;
  --radius: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-size: 16px;
  line-height: 1.4;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

body {
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  padding-bottom: var(--safe-bot);
}

.app-header {
  padding: calc(var(--safe-top) + var(--pad)) var(--pad) 8px;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  /* Always visible — date + live indicator stick to the top while the day
     content scrolls underneath. Higher z-index than the day-viewport but
     lower than dialogs/back-today FAB. */
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--pad);
}

.date-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.date {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.date-relative {
  font-size: 12px;
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
}
.date-relative:empty {
  display: none;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.refresh-btn {
  background: transparent;
  border: 0;
  color: var(--fg-dim);
  padding: 4px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
}
.refresh-btn:hover,
.refresh-btn:focus-visible {
  color: var(--fg);
  outline: none;
}
.refresh-btn.spinning .icon {
  animation: refresh-spin 0.8s linear infinite;
}
@keyframes refresh-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.status {
  font-size: 12px;
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
  /* Reserve space so the header doesn't shift when text appears/disappears. */
  min-width: 32px;
  text-align: right;
}

.status.ok,
.status.warn,
.status.err {
  color: var(--fg-faint);
}

/* Day carousel — iOS-Calendar-style horizontal pagination.
   The viewport is the visible window. The track holds three day-pages
   side-by-side; JS sets translateX so the middle page is centered. */
.day-viewport {
  position: relative;
  overflow: hidden;
  /* pan-y so vertical scroll inside the page still works; horizontal pans
     are intercepted by our pointer handler. */
  touch-action: pan-y;
}
.day-track {
  display: flex;
  width: 300%;
  /* Initial transform is set by JS once the page width is known. */
  will-change: transform;
}
.day-track.snap {
  transition: transform 280ms cubic-bezier(0.2, 0, 0, 1);
}
.day-page {
  flex: 0 0 33.3333%;
  width: 33.3333%;
  /* Each day-page contains its own .cards column. */
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 var(--pad) 20vh;
  max-width: 720px;
  margin: 0 auto;
}

.card {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}
.card:not(:last-child) {
  padding-bottom: var(--pad);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin: 16px 0 8px 0;
  font-weight: 600;
}
.card-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--fg-faint);
  opacity: 0.25;
}

.card-meta {
  font-size: 12px;
  color: var(--fg-faint);
  margin-bottom: 8px;
}

/* Lists */
.event-list,
.task-list,
.backlog-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Events */
.card-compact {
  background: transparent;
  border-color: transparent;
  padding: 0;
}
.event-list li {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 5px 0;
  min-height: 28px;
}
.event-time {
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  line-height: 1.2;
  min-width: 88px;
}
.event-title {
  font-size: 13px;
  color: var(--fg);
  line-height: 1.2;
}
.event-list li.past .event-time,
.event-list li.past .event-title {
  color: var(--fg-faint);
}
.event-empty {
  color: var(--fg-faint);
  font-size: 13px;
  padding: 5px 0;
}
.event-list li.event-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-faint);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 0 2px;
  min-height: 0;
}
.event-list li.event-group-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--fg-faint);
  opacity: 0.25;
}
.event-list li.event-group-header:first-child {
  padding-top: 0;
}

/* Tasks */
/* Lucide icons inherit currentColor; default to a 1em stroke that matches text */
.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  stroke-width: 2;
  flex-shrink: 0;
  vertical-align: -0.15em;
}

.task-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 5px 0;
  min-height: 28px;
}

::view-transition-group(*) {
  animation-duration: 280ms;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Day swipe: slide the entire viewport horizontally, direction-aware. */
html[data-day-swipe] ::view-transition-old(root),
html[data-day-swipe] ::view-transition-new(root) {
  animation-duration: 220ms;
  animation-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
html[data-day-swipe="next"] ::view-transition-old(root) {
  animation-name: day-slide-out-left;
}
html[data-day-swipe="next"] ::view-transition-new(root) {
  animation-name: day-slide-in-right;
}
html[data-day-swipe="prev"] ::view-transition-old(root) {
  animation-name: day-slide-out-right;
}
html[data-day-swipe="prev"] ::view-transition-new(root) {
  animation-name: day-slide-in-left;
}
@keyframes day-slide-out-left {
  to { transform: translateX(-22%); opacity: 0; }
}
@keyframes day-slide-out-right {
  to { transform: translateX(22%); opacity: 0; }
}
@keyframes day-slide-in-right {
  from { transform: translateX(22%); opacity: 0; }
}
@keyframes day-slide-in-left {
  from { transform: translateX(-22%); opacity: 0; }
}

.task-check {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 1.5px solid var(--fg-faint);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: transparent;
  transition: background 0.15s, border-color 0.15s;
  padding: 0;
  font-size: 11px;
}
/* Done state: only visual changes (opacity, strikethrough, hidden meta).
   Padding, min-height, and font-size stay identical to the open row so
   checking a task off doesn't make the list jump. */
.task-item.done {
  opacity: 0.55;
}
.task-item.done .task-check {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}
.task-item.done .task-check::before {
  content: "✓";
}
.task-item.done .task-text {
  color: var(--fg-faint);
  text-decoration: line-through;
}
.task-item.done .task-meta {
  display: none;
}

.task-body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.task-text {
  font-size: 13px;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.meta {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--fg-dim);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.meta.overdue {
  color: var(--fg);
  font-weight: 600;
}
.meta.rollover {
  color: var(--fg-dim);
}
.meta.recurring {
  color: var(--fg-dim);
}
.meta.waiting {
  color: var(--fg-dim);
  font-style: italic;
}

.task-empty {
  color: var(--fg-faint);
  font-size: 14px;
  padding: 8px 0;
}

/* Capture */
.capture {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.capture input[type="text"] {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-size: 15px;
  padding: 10px 12px;
  width: 100%;
  min-height: 44px;
}
.capture input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-dim);
}
.capture-target {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--fg-dim);
}
.capture-target label {
  display: flex;
  align-items: center;
  gap: 4px;
}
.capture-target input[type="radio"] {
  accent-color: var(--accent);
}

.backlog-chip {
  margin-top: 8px;
  background: transparent;
  border: 0;
  color: var(--fg-dim);
  font-size: 12px;
  padding: 4px 0;
  display: block;
  margin-left: auto;
  text-align: right;
  cursor: pointer;
}
.backlog-chip:hover {
  color: var(--fg);
}

/* Habit panel — list of rows with checkbox-style indicators */
.habit-panel {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow: hidden;
}
.habit-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  cursor: pointer;
  user-select: none;
}
.habit-box {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 4px;
  border: 1.5px solid var(--fg-faint);
  display: grid;
  place-items: center;
  font-size: 11px;
  color: transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.habit-row.s-done .habit-box {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}
.habit-row.s-done .habit-box::before {
  content: "✓";
}
.habit-row.s-done .habit-name {
  color: var(--fg-dim);
}
/* Skipped (❌) habits are explicitly "did not do" — dim to indicate that.
   Rest (—) is just "neutral / not-tracked-today" and should stay readable
   like an unchecked pending habit, so the row doesn't visually disappear. */
.habit-row.s-skipped .habit-name {
  color: var(--fg-faint);
}
.habit-name {
  flex: 1;
  font-size: 13px;
  line-height: 1.2;
}
.habit-trailing {
  font-size: 12px;
  color: var(--fg-faint);
}
.habit-inline-trail {
  font-style: italic;
  color: var(--fg-faint);
}
.habit-empty {
  font-size: 12px;
  color: var(--fg-faint);
  padding: 8px 0;
  text-align: center;
}

/* Dialogs — full-screen, monochrome, same design tokens as the rest of the app */
dialog {
  border: 0;
  background: var(--bg);
  color: var(--fg);
  padding: 0;
  margin: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
}
dialog::backdrop {
  background: var(--bg);
}
dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + var(--pad)) var(--pad) var(--pad);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
}
dialog header h3 {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-faint);
  font-weight: 500;
}
dialog .close {
  background: transparent;
  border: 0;
  color: var(--fg-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
}
.backlog-list {
  padding: 8px var(--pad) calc(var(--safe-bot) + 20vh);
  overflow-y: auto;
  list-style: none;
  margin: 0;
}
.backlog-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  min-height: 28px;
}
.backlog-title {
  flex: 1;
  font-size: 13px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.backlog-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.backlog-actions button {
  background: transparent;
  border: 0;
  color: var(--fg-dim);
  font-size: 16px;
  padding: 6px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.backlog-actions button:hover {
  color: var(--fg);
}
.schedule-body {
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.schedule-body p {
  margin: 0;
  font-size: 13px;
  color: var(--fg-dim);
}
.schedule-body input[type="date"] {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--fg);
  padding: 10px;
  font-size: 13px;
  color-scheme: dark;
}
#schedule-confirm {
  background: var(--fg);
  border: none;
  color: var(--bg);
  padding: 10px;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 36px;
}

/* Login dialog — shown when /api/today returns 401 and no auth cookie. */
.login-body {
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-body p {
  margin: 0;
  font-size: 13px;
  color: var(--fg-dim);
}
.login-body input[type="password"] {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-size: 15px;
  padding: 12px 14px;
  width: 100%;
  min-height: 44px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0;
}
.login-body input[type="password"]:focus {
  outline: none;
  border-color: var(--accent-dim);
}
.login-error {
  color: var(--fg);
  font-size: 12px !important;
}
#login-submit {
  background: var(--fg);
  border: none;
  color: var(--bg);
  padding: 12px;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 44px;
  border-radius: 8px;
}

/* Back-to-today FAB — appears when viewing a non-today day */
.back-today {
  position: fixed;
  right: calc(var(--pad) + var(--safe-right));
  bottom: calc(var(--pad) + var(--safe-bot));
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--fg);
  color: var(--bg);
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  min-height: 40px;
}
.back-today[hidden] {
  display: none;
}

/* ---- Skeleton placeholders (LinkedIn-style shimmer) ----
   Used on first paint when there's no cached data yet. The UI structure is
   already visible (card titles, layout, header) — only the row contents are
   shimmering boxes. A page is also marked .stale while we're showing cached
   data and a fresh fetch is in flight; this currently has no visible effect
   but is wired up so we can tweak (e.g. a faint top bar) later. */
.skel-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  min-height: 28px;
}
.skel-box {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    var(--bg-elev) 0%,
    #222 50%,
    var(--bg-elev) 100%
  );
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
}
.skel-line {
  flex: 1;
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    var(--bg-elev) 0%,
    #222 50%,
    var(--bg-elev) 100%
  );
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
  animation-delay: 0.1s;
}
.skel-line-long { max-width: 100%; }
.skel-line-med { max-width: 70%; }
.skel-line-short { max-width: 45%; }
/* Events use a wider "time" column — skeleton mimics it. */
.skel-row.skel-event .skel-box {
  width: 56px;
  height: 12px;
}
@keyframes skel-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
/* Respect reduced-motion — show a static dim row instead of shimmer. */
@media (prefers-reduced-motion: reduce) {
  .skel-box,
  .skel-line {
    animation: none;
    background: var(--bg-elev);
  }
}

/* Read-only view (past/future day) — dim everything actionable */
body.read-only .task-item,
body.read-only .habit-row,
body.read-only .backlog-chip {
  cursor: default;
  opacity: 0.85;
}
body.read-only .task-check,
body.read-only .habit-box {
  opacity: 0.6;
}

/* Push notifications enable banner — one-time, sits below the header. */
.push-banner {
  margin: 0 var(--pad) 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.push-banner[hidden] {
  display: none;
}
.push-banner-text {
  color: var(--fg);
  font-size: 14px;
}
.push-banner-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.push-banner-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--fg);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}
.push-banner-btn-ghost {
  background: transparent;
  color: var(--fg-dim);
}
.push-banner-error {
  margin: 0;
  font-size: 12px;
  color: var(--fg-dim);
}

/* --- Today's Vitals card (training-readiness + sleep / hrv / battery / recovery) ----
   Placed at the top of every day-page. Hidden when no readiness/sleep data
   is available (e.g. watch wasn't worn). Color is the only deliberate splash
   in the otherwise monochrome UI — it IS the signal. */
.card-vitals[hidden] {
  display: none;
}
.card-vitals {
  padding-top: 8px;
  padding-bottom: 18px;
}
.vitals-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 10px;
}
.vitals-score {
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
  color: var(--fg);
}
.vitals-feedback {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-dim);
  flex: 1;
}
.vitals-meter {
  height: 3px;
  background: var(--bg-elev);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
}
.vitals-meter-fill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width 0.4s ease, background 0.4s ease;
  background: var(--fg-faint);
}
.vitals-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.vitals-stats li {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-feature-settings: "tnum";
}
.vitals-stat-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.vitals-stat-value {
  font-size: 14px;
  color: var(--fg);
}

/* Zone colors — drive both the score and the meter. */
.card-vitals[data-zone="poor"] .vitals-score { color: #ef4444; }
.card-vitals[data-zone="poor"] .vitals-meter-fill { background: #ef4444; }
.card-vitals[data-zone="low"] .vitals-score { color: #f59e0b; }
.card-vitals[data-zone="low"] .vitals-meter-fill { background: #f59e0b; }
.card-vitals[data-zone="moderate"] .vitals-score { color: #eab308; }
.card-vitals[data-zone="moderate"] .vitals-meter-fill { background: #eab308; }
.card-vitals[data-zone="good"] .vitals-score { color: #84cc16; }
.card-vitals[data-zone="good"] .vitals-meter-fill { background: #84cc16; }
.card-vitals[data-zone="excellent"] .vitals-score { color: #22c55e; }
.card-vitals[data-zone="excellent"] .vitals-meter-fill { background: #22c55e; }

/* --- Mail indicator pill (in header, between date and refresh) -------------
   Hidden until /api/mail/status returns the first count. Inline-flex so it
   sits naturally between the left-side date and the right-side header-actions.
   The two pills (emails + triage) share styling; icons distinguish them. */
.header-mail {
  display: inline-flex;
  gap: 8px;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--fg-faint);
  font-family: inherit;
  align-items: baseline;
  -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
}
.header-mail[hidden] {
  display: none;
}
.header-mail:hover {
  color: var(--fg);
}
.header-mail:active {
  transform: scale(0.97);
}
.mail-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-feature-settings: "tnum";
  line-height: 1;
}
/* Icon and digit share the same vertical center within the pill. */
.mail-pill .icon {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
}
.mail-count {
  font-weight: 500;
}
.header-mail.queued {
  opacity: 0.5;
  animation: mail-queued-pulse 1.6s ease-in-out infinite;
}
@keyframes mail-queued-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.75; }
}

/* --- Mail activity dialog (mirrors #backlog-dialog) ------------------------ */
/* Hide the dialog scrollbar — content is the source of truth, the scrollbar
   is visual noise. Matches the html/body convention used app-wide. */
#mail-activity-dialog {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#mail-activity-dialog::-webkit-scrollbar {
  width: 0;
  display: none;
}

.mail-activity-body {
  padding: 14px 20px calc(var(--safe-bot) + 14px);
}

/* Stats: 4 big numbers + uppercase mini-labels */
.mail-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0 0 14px;
}
.mail-stat-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.mail-stat-value {
  font-size: 22px;
  font-weight: 300;
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
  color: var(--fg);
  line-height: 1;
}
.mail-stat-label {
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

/* Run mail now — sits between stats and destinations */
.mail-activity-run-row {
  margin: 4px 0 18px;
}
.mail-run-btn {
  display: block;
  width: 100%;
  padding: 11px;
  font-size: 13px;
  font-weight: 500;
  background: var(--fg);
  color: var(--bg);
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}
.mail-run-btn:disabled {
  opacity: 0.5;
  cursor: progress;
}

/* Section titles — same visual rhythm as `.card-title` (Habits / Tasks rows) */
.mail-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin: 16px 0 8px;
  font-weight: 600;
}
.mail-section-title > span:first-child {
  /* the folder label; let the divider line stretch after it */
}
.mail-section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--fg-faint);
  opacity: 0.25;
}
.mail-folder-count {
  font-feature-settings: "tnum";
  color: var(--fg-dim);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

/* Destinations summary list */
.mail-destinations {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.mail-destinations li {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-feature-settings: "tnum";
}
.mail-destinations .dest-folder {
  color: var(--fg);
}
.mail-destinations .dest-count {
  color: var(--fg-dim);
}

/* Folder-grouped mail log (one section per destination) */
.mail-folder-section {
  margin: 0;
}
.mail-folder-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.mail-folder-item {
  display: flex;
  gap: 8px;
  padding: 4px 0;
  font-size: 11px;
  line-height: 1.3;
  border-bottom: 1px solid var(--border);
}
.mail-folder-item:last-child {
  border-bottom: 0;
}
.mail-entry-time {
  font-size: 10px;
  font-feature-settings: "tnum";
  color: var(--fg-faint);
  min-width: 34px;
  padding-top: 1px;
}
.mail-entry-subject {
  flex: 1;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-activity-empty {
  padding: 20px 0;
  text-align: center;
  color: var(--fg-faint);
  font-size: 12px;
}

/* --- Habit-trail spacing fix (item #1 of the plan) ------------------------- */
.habit-inline-trail {
  margin-left: 6px;
}
