/* ============================================================
   SiteOps polish layer — additive over app.css
   ============================================================
   What this file does:
     - Extends the existing token system (no token name changes)
     - Replaces card border with shadow-based surfaces
     - Adds a real type scale + Inter font
     - Adds 150ms transitions to interactive surfaces
     - Tightens focus-visible outlines
     - Adds tabular-nums for numeric content
     - Polishes button states + cleans up the topbar
   What it does NOT do:
     - Remove or rename any existing token / class
     - Touch dark-mode styles (operator runs light-only)
     - Restructure HTML (additive only)
   Load order: base.html links polish.css AFTER app.css.
============================================================ */

/* ---------------------------------------------------------- */
/* 1. Inter — self-hosted via Google Fonts CDN with display:swap */
/* ---------------------------------------------------------- */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  /* Override the existing --font-sans to put Inter first.
     Falls back to the same system stack if Inter fails to load. */
  --font-sans:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;

  /* Uniform type scale — one sans (Inter) at a calm, confident size. */
  --fs-display: 1.8rem;    /* ~29px */
  --fs-h1:      1.45rem;   /* ~23px */
  --fs-h2:      1.22rem;   /* ~20px */
  --fs-label:   0.6875rem; /* 11px */
  --fs-body:    0.94rem;   /* ~15px */
  --fs-meta:    0.75rem;   /* 12px */

  --fw-label:   600;
  --fw-h:       700;
  --fw-body:    400;

  /* Spacing rhythm: 8px scale (4, 8, 12, 16, 24, 32, 48) */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-12: 3rem;

  /* Warm shadow scale — ink-on-paper depth (brown-tinted, not cold slate)
     so it stays cohesive with the warm editorial canvas. */
  --shadow-xs:  0 1px 2px rgba(31, 41, 71, .05);
  --shadow-sm:  0 1px 3px rgba(31, 41, 71, .06), 0 1px 2px rgba(31, 41, 71, .04);
  --shadow-md:  0 4px 14px rgba(31, 41, 71, .07), 0 2px 4px rgba(31, 41, 71, .05);
  --shadow-lg:  0 16px 40px rgba(31, 41, 71, .12), 0 4px 10px rgba(31, 41, 71, .06);
  --shadow-hover: 0 10px 28px rgba(31, 41, 71, .12);

  --ring-focus: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}

/* ---------------------------------------------------------- */
/* 2. Body/page baseline                                       */
/* ---------------------------------------------------------- */
body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: var(--fw-body);
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Numeric content uses tabular-nums so columns align cleanly */
.tabular,
.kpi-num,
table td,
table th,
.badge,
.metric-value,
.metric-label,
[data-numeric] {
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------- */
/* 3. Surfaces: remove card border, use shadow                 */
/* ---------------------------------------------------------- */
.card {
  border: 0 !important;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  background: var(--surface);
  transition:
    box-shadow var(--transition),
    transform var(--transition);
}

/* Card header is just a strong line at the top of body, not a tinted strip */
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-soft);
  font-weight: var(--fw-h);
  letter-spacing: -0.005em;
  padding: var(--sp-4) var(--sp-6) var(--sp-3);
}
.card-header strong { font-weight: var(--fw-h); }

.card-body { padding: var(--sp-6); }
.card-body.p-2 { padding: var(--sp-3); }   /* tighter when explicit */
.card-body.p-3 { padding: var(--sp-4); }

.card-footer {
  background: transparent;
  border-top: 1px solid var(--border-soft);
  padding: var(--sp-3) var(--sp-6);
}

/* Hover lift for cards that are themselves a primary action surface */
.sox-article-card {
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}
.sox-article-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--border-strong);
}
/* Taller, richer cover image with a subtle zoom on hover. */
.sox-article-card .card-img-top {
  height: 116px !important;
  transition: transform .35s cubic-bezier(.4,0,.2,1);
}
.sox-article-card:hover .card-img-top { transform: scale(1.04); }
/* Make the primary action read as the focal point on hover. */
.sox-article-card .sox-pick-article {
  border-radius: 8px;
  font-weight: 600;
}
/* Round the floating overlay controls a touch. */
.sox-article-card .sox-preview-btn,
.sox-article-card .card .btn { border-radius: 7px; }

/* ---------------------------------------------------------- */
/* 4. Buttons — tighter, with motion + better hover            */
/* ---------------------------------------------------------- */
.btn {
  font-weight: 500;
  letter-spacing: -0.005em;
  border-radius: 8px;
  transition:
    background-color var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.btn-primary {
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

/* Outline buttons: visible hover */
.btn-outline-secondary:hover {
  background: var(--surface-alt);
  border-color: var(--border-strong);
  color: var(--text);
}

/* btn-warning is used 5 places in the app for PRIMARY actions.
   Repaint it as a primary-amber variant so it still POPS but doesn't
   look like a warning. Real warnings use .btn-warning.alert-style. */
.btn-warning:not(.alert-style) {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-on-pri);
}
.btn-warning:not(.alert-style):hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--text-on-pri);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

/* ---------------------------------------------------------- */
/* 5. Type scale + heading rhythm (single sans, uniform)       */
/* ---------------------------------------------------------- */
h1, .h1, h2, .h2, h3, .h3 {
  font-family: var(--font-sans);
}
h1, .h1 { font-size: var(--fs-display); font-weight: var(--fw-h); letter-spacing: -0.018em; line-height: 1.14; }
h2, .h2 { font-size: var(--fs-h1);      font-weight: var(--fw-h); letter-spacing: -0.015em; line-height: 1.2; }
h3, .h3 { font-size: var(--fs-h2);      font-weight: var(--fw-h); letter-spacing: -0.012em; line-height: 1.28; }
h4, .h4 { font-size: var(--fs-h2);      font-weight: var(--fw-h); line-height: 1.35; }
h5, .h5 { font-size: var(--fs-h2);      font-weight: var(--fw-h); line-height: 1.4;  }
h6, .h6 { font-size: var(--fs-body);    font-weight: var(--fw-h); line-height: 1.4;  }

/* Eyebrow / section labels (the "PORTFOLIO STATUS" / "QUICK ACTIONS" allcaps) */
.text-uppercase,
.section-label,
.eyebrow {
  font-size: var(--fs-label) !important;
  font-weight: var(--fw-label) !important;
  letter-spacing: 0.05em !important;
  color: var(--text-muted);
}

/* Improve readability of muted text */
.text-muted { color: var(--text-muted) !important; }

/* ---------------------------------------------------------- */
/* 6. Focus-visible: real outlines, not just Bootstrap glow    */
/* ---------------------------------------------------------- */
:focus-visible {
  outline: none;
  box-shadow: var(--ring-focus);
  border-radius: 6px;
}
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible {
  box-shadow: var(--ring-focus) !important;
  border-color: var(--primary) !important;
  outline: none;
}
a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  text-decoration: underline;
}

/* Form fields: better focus glow */
.form-control:focus,
.form-select:focus {
  box-shadow: var(--ring-focus);
  border-color: var(--primary);
}

/* ---------------------------------------------------------- */
/* 7. Site-context banner: shrink from giant to one-line       */
/* ---------------------------------------------------------- */
.site-context-banner {
  padding: var(--sp-2) var(--sp-4) !important;
  background: var(--primary-soft) !important;
  border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent) !important;
  border-radius: 8px !important;
  font-size: var(--fs-meta);
  gap: var(--sp-3) !important;
  margin-bottom: var(--sp-4) !important;
}
.site-context-banner .scb-left { font-size: var(--fs-meta); gap: var(--sp-2); }
.site-context-banner .scb-left strong {
  font-size: var(--fs-body);
  font-weight: 600;
}
.site-context-banner .scb-domain {
  font-size: var(--fs-meta);
  /* solid AA color instead of opacity-dimmed grey (a11y theme pass). */
  color: var(--primary-on-soft);
}
.site-context-banner .scb-clear {
  background: transparent !important;
  border: 1px solid color-mix(in srgb, var(--primary) 40%, transparent) !important;
  color: var(--primary-on-soft) !important;
  padding: var(--sp-1) var(--sp-3) !important;
  font-size: var(--fs-meta) !important;
  font-weight: 500;
}
.site-context-banner .scb-clear:hover {
  background: var(--primary) !important;
  color: var(--text-on-pri) !important;
}

/* ---------------------------------------------------------- */
/* 8. Topbar: subtle shadow + presence                         */
/* ---------------------------------------------------------- */
.topbar {
  box-shadow: var(--shadow-xs);
  border-bottom: 1px solid var(--border-soft);
}
.topbar .page-title {
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ---------------------------------------------------------- */
/* 9. Sidebar nav: clearer active state, hover                 */
/* ---------------------------------------------------------- */
.sidebar .nav-link {
  border-radius: 8px;
  margin: 1px 8px;
  padding: 0.45rem 0.75rem;
  transition: background var(--transition), color var(--transition);
}
.sidebar .nav-link:hover {
  background: var(--surface-alt);
  color: var(--text);
}
.sidebar .nav-link.active {
  background: var(--primary-soft);
  color: var(--primary-on-soft);
  font-weight: 500;
  position: relative;
}
.sidebar .nav-link.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

/* ---------------------------------------------------------- */
/* 10. Tables: row hover + tighter cells                       */
/* ---------------------------------------------------------- */
.table tbody tr {
  transition: background var(--transition);
}
.table tbody tr:hover {
  background: var(--surface-alt);
}
.table th {
  font-weight: var(--fw-label);
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom-color: var(--border-soft) !important;
}

/* ---------------------------------------------------------- */
/* 11. Forms: tighter, modern                                  */
/* ---------------------------------------------------------- */
.form-control,
.form-select {
  border-radius: 8px;
  border-color: var(--border);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:hover,
.form-select:hover {
  border-color: var(--border-strong);
}
.form-label {
  font-weight: 500;
  font-size: var(--fs-meta);
  color: var(--text);
  margin-bottom: var(--sp-2);
}

/* ---------------------------------------------------------- */
/* 12. Tab pills (per-site tabs + filter chips)                */
/* ---------------------------------------------------------- */
.nav-pills .nav-link {
  border-radius: 8px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.nav-pills .nav-link:not(.active):hover {
  background: var(--surface-alt);
}
.tab-pills a, .site-tabs a {
  transition: background var(--transition), color var(--transition);
}

/* ---------------------------------------------------------- */
/* 13. Accordion polish                                        */
/* ---------------------------------------------------------- */
.accordion-button {
  font-weight: 500;
  transition: background var(--transition);
}
.accordion-button:not(.collapsed) {
  background: var(--surface-alt);
  color: var(--text);
  box-shadow: none;
}
.accordion-collapse {
  transition: height 200ms ease;
}

/* ---------------------------------------------------------- */
/* 14. Modal: softer surface                                    */
/* ---------------------------------------------------------- */
.modal-content {
  border: 0;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  border-bottom-color: var(--border-soft);
  padding: var(--sp-4) var(--sp-6);
}
.modal-footer {
  border-top-color: var(--border-soft);
  padding: var(--sp-3) var(--sp-6);
}
.modal-body { padding: var(--sp-6); }

/* ---------------------------------------------------------- */
/* 15. Badges: tighter + tabular nums                          */
/* ---------------------------------------------------------- */
.badge {
  font-weight: 500;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
}

/* ---------------------------------------------------------- */
/* 16. Selection                                                */
/* ---------------------------------------------------------- */
::selection {
  background: color-mix(in srgb, var(--primary) 25%, transparent);
  color: var(--text);
}

/* ---------------------------------------------------------- */
/* 17. Scrollbar: thinner, branded                              */
/* ---------------------------------------------------------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 10px;
  border: 2px solid var(--bg);
}
*::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }

/* ---------------------------------------------------------- */
/* 18. Sidebar brand — editorial wordmark (see app.css for the         */
/*     serif lockup + coral icon tile; nothing to override here).      */
/* ------------------------------------------------------------------- */

/* ============================================================ */
/* Phase 2 — Visual identity                                    */
/* ============================================================ */

/* Sidebar group labels (small uppercase muted dividers) */
.sidebar .nav-group-label {
  padding: var(--sp-4) var(--sp-4) var(--sp-2);
  font-size: var(--fs-label);
  font-weight: var(--fw-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: var(--sp-2);
}

/* Topbar status dot */
.sox-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: var(--sp-2);
  position: relative;
  cursor: help;
}
.sox-status-dot.is-ok {
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 20%, transparent);
}
.sox-status-dot.is-warn {
  background: var(--warning);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning) 20%, transparent);
}
.sox-status-dot.is-err {
  background: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent);
}

/* Avatar button */
.sox-avatar-btn {
  background: transparent;
  border: 0;
  padding: 2px;
  border-radius: 50%;
  cursor: pointer;
  transition: box-shadow var(--transition);
}
.sox-avatar-btn:hover {
  box-shadow: 0 0 0 2px var(--surface-alt);
}
.sox-avatar-btn[aria-expanded="true"] {
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.sox-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 70%, var(--success) 30%) 100%);
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: -0.02em;
}
.sox-account-menu {
  min-width: 240px;
  border: 0;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: var(--sp-2);
}
.sox-account-menu .dropdown-item {
  border-radius: 6px;
  padding: var(--sp-2) var(--sp-3);
  font-weight: 500;
}
.sox-account-menu .dropdown-item:hover {
  background: var(--surface-alt);
}

/* KPI card: when content has .kpi-* classes, the number pops */
.kpi {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.kpi-label {
  font-size: var(--fs-label);
  font-weight: var(--fw-label);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.kpi-num {
  font-size: 2.25rem;       /* 36px */
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.kpi-delta {
  font-size: var(--fs-meta);
  font-weight: 500;
}
.kpi-delta.is-up   { color: var(--success); }
.kpi-delta.is-down { color: var(--danger); }
.kpi-delta.is-flat { color: var(--text-muted); }

/* Auto-upgrade existing KPI patterns without template churn:
   on per-site Overview + GSC pages, the cards use this structure:
     <div class="text-uppercase small text-muted">CLICKS (28D)</div>
     <div class="display-6">28</div>
   We just bump the display-6/4 sizing + tabular-nums.
*/
.card .display-4,
.card .display-5,
.card .display-6 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

/* EmptyState component */
.empty-state {
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
  color: var(--text-muted);
}
.empty-state .empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--text-faint);
  font-size: 1.75rem;
  margin-bottom: var(--sp-4);
}
.empty-state .empty-title {
  font-size: var(--fs-h2);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--sp-2);
}
.empty-state .empty-subtitle {
  font-size: var(--fs-body);
  max-width: 360px;
  margin: 0 auto var(--sp-4);
}

/* Skeleton loader */
@keyframes sox-skeleton-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}
.skeleton {
  display: block;
  background: linear-gradient(90deg, var(--surface-alt) 0%, var(--surface-2) 50%, var(--surface-alt) 100%);
  background-size: 200% 100%;
  border-radius: 6px;
  height: 1em;
  animation: sox-skeleton-pulse 1.4s ease-in-out infinite;
}
.skeleton-row     { margin-bottom: var(--sp-2); width: 100%; }
.skeleton-row.sm  { width: 40%; }
.skeleton-row.md  { width: 70%; }
.skeleton-row.lg  { width: 90%; }
.skeleton-block   { height: 200px; width: 100%; border-radius: 10px; }

/* Logout dropdown form sits inside .dropdown-item — kill default button styles */
.sox-account-menu form button.dropdown-item {
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
}

/* ============================================================ */
/* Phase 3 — Component consistency                              */
/* ============================================================ */

/* Standardize badges: single set of color variants, no opacity gimmicks */
.badge.bg-success,
.badge.bg-success-subtle {
  background: var(--success-soft) !important;
  color: var(--success) !important;
  border: 0;
}
.badge.bg-warning,
.badge.bg-warning-subtle {
  background: var(--warning-soft) !important;
  color: var(--warning) !important;
  border: 0;
}
.badge.bg-danger,
.badge.bg-danger-subtle {
  background: var(--danger-soft) !important;
  color: var(--danger) !important;
  border: 0;
}
.badge.bg-info,
.badge.bg-info-subtle,
.badge.bg-primary,
.badge.bg-primary-subtle {
  background: var(--primary-soft) !important;
  color: var(--primary-on-soft) !important;
  border: 0;
}
.badge.bg-secondary,
.badge.bg-light {
  background: var(--surface-alt) !important;
  color: var(--text-muted) !important;
  border: 0;
}
/* But solid filled status badges (the ones used in /my-posts cards over images)
   need to stay punchy — preserve them when they wear .badge-solid */
.badge.badge-solid.bg-success { background: var(--success) !important; color: #fff !important; }
.badge.badge-solid.bg-warning { background: var(--warning) !important; color: #fff !important; }
.badge.badge-solid.bg-danger  { background: var(--danger)  !important; color: #fff !important; }

/* Tab pill polish: same look across per-site tabs, filter chips, settings tabs */
.tab-pills,
.site-tabs,
.nav-pills {
  gap: 4px;
  padding: 4px;
  background: transparent;
  border-radius: 10px;
}
.tab-pills > a,
.site-tabs > a,
.nav-pills .nav-link {
  border-radius: 8px;
  padding: 6px 12px;
  font-size: var(--fs-body);
  font-weight: 500;
  color: var(--text-muted);
  border: 0;
}
.tab-pills > a.active,
.site-tabs > a.active,
.nav-pills .nav-link.active {
  background: var(--primary-soft);
  color: var(--primary-on-soft);
  font-weight: 600;
}
.tab-pills > a:hover:not(.active),
.site-tabs > a:hover:not(.active),
.nav-pills .nav-link:not(.active):hover {
  background: var(--surface-alt);
  color: var(--text);
}

/* Btn-group time chips (the 24h/7d/30d/90d/My posts in Outreach) — match the
   tab look so they don't feel like a separate component language */
.btn-group .btn-outline-secondary,
.btn-group .btn-outline-primary {
  border-color: var(--border) !important;
  color: var(--text-muted);
  font-weight: 500;
  background: transparent;
}
.btn-group .btn-outline-secondary.active,
.btn-group .btn-outline-primary.active,
.btn-group .btn-outline-secondary:not(.active):hover,
.btn-group .btn-outline-primary:not(.active):hover {
  background: var(--primary-soft) !important;
  color: var(--primary-on-soft) !important;
  border-color: color-mix(in srgb, var(--primary) 25%, var(--border)) !important;
}

/* Card header strips on per-site Overview/Rankings: drop the white-on-gray
   double-strip pattern from Bootstrap, just be transparent + hairline */
.card > .card-header.bg-white,
.card > .card-header.bg-light {
  background: transparent !important;
}

/* ============================================================ */
/* Phase 5 — Mobile + responsive fixes                          */
/* ============================================================ */

/* Topbar overlap fix (the real bug at 768px): the user-email span was getting
   absolutely positioned over the site picker. Two changes:
     1. Below 992px, hide the user-email span entirely (avatar dropdown holds it)
     2. Below 992px, the date-range chip collapses to icon-only with a tight label
     3. Below 768px, site-picker label truncates to a fixed max-width
*/
@media (max-width: 991.98px) {
  /* user-email span (already display:none below sm) — make sure inline
     never wins back at md */
  .topbar-actions > span.text-muted { display: none !important; }
}

/* Date-range chip + sync-pill: shrink on smaller widths */
@media (max-width: 767.98px) {
  .site-picker .site-picker-label {
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Topbar: stack title + action row on narrow screens to avoid the
     overlap that the audit caught. Keep flex but allow wrap. */
  .topbar {
    flex-wrap: wrap;
    row-gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
  }
  .topbar-left { width: 100%; order: 1; }
  .topbar-actions { width: auto; order: 2; margin-left: auto; }
  .topbar .page-title { font-size: 1.125rem; }

  /* Per-site context-bar tabs should always show icons (keep them on for
     clarity on mobile). Covers the renamed .site-ctxbar (June 2026). */
  .site-ctxbar .bi, .site-tabs .bi { display: inline-block !important; }
}

/* Touch-target audit: ensure 44px min on small screens for primary actions */
@media (max-width: 575.98px) {
  .btn-sm { padding: 0.5rem 0.9rem; font-size: 0.875rem; }
  .nav-pills .nav-link { padding: 0.5rem 0.875rem; }
  .form-control, .form-select { padding: 0.55rem 0.75rem; }

  /* Phone: let topbar-left wrap so the page title sits on its OWN line above
     the site + time-range filters instead of all three crowding one row and
     colliding with the right-side avatar/status (mobile audit, June 2026). */
  .topbar-left { flex-wrap: wrap; row-gap: var(--sp-1, .4rem); }
  .topbar-left .page-title { width: 100%; }
}

/* ============================================================ */
/* Phase 4 — Trust + microcopy + Cmd-K (partial: visual surface)*/
/* ============================================================ */

/* Toast position + soft motion */
.toast-container {
  pointer-events: none;
  z-index: 1090;
}
.toast {
  border: 0;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
}
@keyframes sox-toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.toast.showing,
.toast.show {
  animation: sox-toast-in 200ms ease-out;
}

/* Cmd-K palette (visual surface; JS goes in base.html) */
.cmdk-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1080;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.cmdk-overlay.is-open { display: flex; }
.cmdk-panel {
  width: min(560px, 90vw);
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: sox-toast-in 200ms ease-out;
}
.cmdk-input {
  width: 100%;
  border: 0;
  background: transparent;
  padding: var(--sp-4) var(--sp-6);
  font-size: 1.0625rem;
  outline: none;
  border-bottom: 1px solid var(--border-soft);
}
.cmdk-list {
  list-style: none;
  margin: 0;
  padding: var(--sp-2);
  max-height: 50vh;
  overflow-y: auto;
}
.cmdk-list li > a {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: var(--fs-body);
}
.cmdk-list li > a:hover,
.cmdk-list li > a.is-selected {
  background: var(--primary-soft);
  color: var(--primary-on-soft);
}
.cmdk-list li > a .cmdk-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--surface-alt);
  flex-shrink: 0;
}
.cmdk-list li > a .cmdk-meta {
  margin-left: auto;
  font-size: var(--fs-meta);
  color: var(--text-muted);
}
.cmdk-footer {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-4);
  border-top: 1px solid var(--border-soft);
  font-size: var(--fs-meta);
  color: var(--text-muted);
}
.cmdk-footer kbd {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: ui-monospace, monospace;
  font-size: 0.7rem;
  color: var(--text);
}

/* ===== Inline per-site switcher (sits above site-tabs) =================
   On per-site URLs (/sites/{id}/outreach etc.) this gives an obvious,
   in-context way to switch which site the page is for. Switching here
   POSTs to /_filter/site which rewrites the embedded site_id and lands
   you on the SAME tab for the NEW site. */
.site-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface-alt, #f6f8fa);
  border: 1px solid var(--border, #d0d7de);
  border-radius: 8px;
  font-size: 0.875rem;
}
.site-switcher-label {
  font-weight: 500;
  letter-spacing: 0.01em;
}
.site-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--border, #d0d7de);
  border-radius: 6px;
  padding: 4px 10px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.site-switcher-btn:hover,
.site-switcher-btn:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 18%, transparent);
}
.site-switcher-menu {
  min-width: 280px;
  max-height: 420px;
  overflow-y: auto;
  padding-top: 8px;
  /* Self-sufficient styling so the menu is always opaque + on top, even if
     Bootstrap's .dropdown-menu defaults don't apply (load-order / override).
     Without these it rendered transparent and BEHIND the page content. */
  background: #fff;
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
  z-index: 2000;            /* above tabs/sticky headers */
}
.site-switcher-row { background: #fff; }
.site-switcher-menu .dropdown-item {
  padding: 6px 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.site-switcher-search {
  font-size: 0.825rem;
}
.site-switcher-exit {
  text-decoration: none;
  white-space: nowrap;
}
.site-switcher-exit:hover {
  color: var(--primary) !important;
}

/* ============================================================
   POLISH-1 — Micro-interactions (modern, Linear-style motion)
   All motion is gated behind prefers-reduced-motion so it stays
   accessible. Driven by the existing token system.
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {

  /* Page content gently fades + rises on load — feels intentional, not janky.
     Scoped to the main content area so it never fights modals/dropdowns. */
  .content > * { animation: sox-rise-in .32s cubic-bezier(.4,0,.2,1) both; }
  @keyframes sox-rise-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* Modal: scale + fade in (Bootstrap toggles .show on .modal.fade .modal-dialog). */
  .modal.fade .modal-dialog {
    transform: scale(.97) translateY(8px);
    transition: transform .22s cubic-bezier(.34,1.3,.64,1), opacity .22s ease;
    opacity: 0;
  }
  .modal.show .modal-dialog { transform: none; opacity: 1; }

  /* Dropdowns: subtle fade + slide when shown. */
  .dropdown-menu.show {
    animation: sox-pop-in .14s cubic-bezier(.4,0,.2,1);
    transform-origin: top center;
  }
  @keyframes sox-pop-in {
    from { opacity: 0; transform: translateY(-4px) scale(.985); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }
}

/* Blurred, softer modal backdrop (cheap, no motion needed). */
.modal-backdrop.show { opacity: .42; }
.modal { backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }

/* Smoother active/hover transitions on nav + interactive rows everywhere. */
.sidebar .nav-link,
.dropdown-item,
.list-group-item,
.nav-pills .nav-link,
.nav-tabs .nav-link {
  transition: background var(--transition), color var(--transition),
              border-color var(--transition);
}

/* Refined scrollbar — slimmer track, rounded, theme-aware (overrides app.css). */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); background-clip: padding-box; }

/* Selection colour picks up the indigo accent. */
::selection { background: color-mix(in srgb, var(--primary) 24%, transparent); }

/* Icon buttons / link buttons get a gentle pressable feel. */
.btn-link:active { transform: translateY(.5px); }

/* ============================================================
   POLISH-3 — Tables, forms, buttons, badges (final consistency)
   ============================================================ */

/* ---- Tables: a card-wrapped table gets a clean rounded container,
        crisper header, calmer row hover. Works with the common pattern
        <div class="card"><table class="table">…</table></div>. ---- */
.card > .table-responsive,
.card > .table { margin-bottom: 0; }
.card > .table-responsive:first-child,
.card > .table:first-child { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); overflow: hidden; }
.table thead th {
  position: relative;
  background: var(--surface-2, var(--surface));
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}
.table tbody tr { transition: background var(--transition); }
.table tbody tr:last-child td { border-bottom: 0; }
/* Opt-in sticky header for tall scrollable tables: add .table-sticky. */
.table-sticky thead th { position: sticky; top: 0; z-index: 2; }
/* Numeric cells align right + tabular by convention (.num-cell already used). */
.num-cell, td.num, .table .text-end { font-variant-numeric: tabular-nums; }

/* ---- Forms: a touch more height, consistent radius, clearer focus.
        (Base styles already token-driven; this refines feel.) ---- */
.form-control, .form-select { padding: 0.45rem 0.7rem; }
.form-control-sm, .form-select-sm { padding: 0.3rem 0.55rem; }
.input-group-text {
  background: var(--surface-alt);
  border-color: var(--border-strong);
  color: var(--text-muted);
}
/* Switches: bigger, smoother, indigo when on. */
.form-switch .form-check-input {
  height: 1.15rem; width: 2.1rem;
  background-color: var(--surface-alt);
  border-color: var(--border-strong);
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition);
}
.form-switch .form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}
.form-check-input { cursor: pointer; }

/* ---- Buttons: unified sizing rhythm + clearer disabled state. ---- */
.btn { padding: 0.42rem 0.85rem; }
.btn-sm { padding: 0.3rem 0.65rem; }
.btn-lg { padding: 0.6rem 1.15rem; font-size: 0.95rem; }
.btn:disabled, .btn.disabled { opacity: 0.5; cursor: not-allowed; }
.btn .bi { vertical-align: -0.08em; }
/* Soft/subtle button variant for secondary actions (modern app feel). */
.btn-soft {
  background: var(--primary-soft);
  color: var(--primary-on-soft);
  border: 1px solid transparent;
}
.btn-soft:hover { background: color-mix(in srgb, var(--primary) 18%, var(--surface)); color: var(--primary-on-soft); }

/* ---- Badges: status badges get a faint ring so they read as pills,
        soft-tinted to match the palette. ---- */
.badge { line-height: 1.1; }
.badge.bg-success-subtle, .badge.bg-success { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--success) 22%, transparent); }
.badge.bg-danger-subtle,  .badge.bg-danger  { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 22%, transparent); }
.badge.bg-warning-subtle, .badge.bg-warning { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warning) 28%, transparent); }
.badge.bg-info, .badge.bg-primary-subtle    { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 22%, transparent); }

/* ============================================================
   MOBILE-QA — site-wide hardening from the 375px audit.
   Goal: zero horizontal page scroll + comfortable touch targets.
   Loaded last so it overrides component + inline defaults.
   ============================================================ */

/* Global guard: nothing should push the page wider than the viewport. */
html, body { max-width: 100%; overflow-x: hidden; }

@media (max-width: 767.98px) {
  /* --- Tables: any table inside a card scrolls horizontally instead of
     blowing out the page. Inline min-width columns are capped so the
     scroll area stays reasonable. Covers connections matrices, sites,
     settings, integration/social tables — none had .table-responsive. --- */
  .card .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .card .table thead, .card .table tbody, .card .table tr { } /* keep table semantics */
  .table-responsive { -webkit-overflow-scrolling: touch; }
  /* Neutralise oversized fixed column widths that force overflow. */
  th[style*="min-width"], td[style*="min-width"] { min-width: 0 !important; }

  /* --- Hub grids/tiles: shrink so two never demand >viewport. --- */
  .hub-grid { grid-template-columns: 1fr !important; }
  .hub-totals { grid-template-columns: repeat(2, 1fr) !important; }
  .hub-table .url-cell { max-width: 52vw !important; }
  .hub-table td { word-break: break-word; overflow-wrap: anywhere; }

  /* --- Fixed-width inputs/search boxes → full width. --- */
  input[style*="width:240px"], input[style*="width: 240px"],
  .recentSearch, #recentSearch { width: 100% !important; max-width: 100% !important; }

  /* --- Social preview cards stack full-width (no 240px min). --- */
  .sp-card { min-width: 100% !important; max-width: 100% !important; flex-basis: 100% !important; }

  /* --- Hero totals stack under the greeting instead of squeezing. --- */
  .hero-totals { min-width: 0 !important; border-left: 0 !important; padding-left: 0 !important; margin-top: .75rem; }

  /* --- Filter-chip / toolbar rows wrap tightly instead of overflowing. --- */
  .filter-chips, .alerts-toolbar { gap: .3rem !important; }
  .filter-chips .chip { font-size: .72rem; padding: .25rem .55rem; }

  /* --- Topbar: keep the site label from eating the row. --- */
  .site-picker .site-picker-label { max-width: 84px !important; }
}

/* --- Touch targets: comfortable taps on small screens (audit caught
   several 24–38px controls). Applies a bit wider so phablets benefit. --- */
@media (max-width: 575.98px) {
  /* Card grid columns: stack 1-up where they were 2-up (col-sm-6) so
     tiles/metrics aren't cramped. */
  .row > [class*="col-sm-6"]:not([class*="col-md"]) { flex: 0 0 100%; max-width: 100%; }

  /* Hamburger + icon-only buttons → 40px min hit area. */
  .sidebar-toggle { width: 44px; height: 44px; display: inline-flex !important;
    align-items: center; justify-content: center; padding: 0; }

  /* Tiny inline icon buttons (≤28px) get a larger tap area via padding
     without changing visual size much. */
  .btn.p-0[style*="width:24px"], .btn.p-0[style*="width: 24px"] {
    width: 32px !important; height: 32px !important;
  }
}

/* ============================================================
   THEME-2 — Premium chrome polish (Linear-grade finishing).
   Whole-app surfaces only; no template changes. Loads last so
   it refines the base rules in app.css.
   ============================================================ */

/* Brand mark + active-nav accent now live in app.css (editorial theme:
   coral logo tile + teal left-accent bar). Intentionally left here as a
   no-op note so the THEME-2 ordering comment below still reads. */

/* ---- Sidebar nav: tactile active feel ---------------------- */
.sidebar .nav-link {
  position: relative;
}
/* Slightly snappier hover translate for a tactile feel. */
@media (prefers-reduced-motion: no-preference) {
  .sidebar .nav-link { transition: background var(--transition), color var(--transition), transform .12s ease; }
  .sidebar .nav-link:active { transform: translateX(1px); }
}
/* Section labels read as quieter, finer kickers. */
.sidebar .nav-section,
.sidebar .nav-group-label {
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  /* --text-muted (not --text-faint) so this small uppercase label clears WCAG
     AA 4.5:1 on the white sidebar (a11y audit, June 2026). */
  color: var(--text-muted);
}

/* ---- Topbar: stronger frosted depth + hairline gradient ----- */
.topbar {
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(90deg,
      var(--border) 0%, var(--border-strong) 50%, var(--border) 100%) 1;
}

/* ---- Cards: a touch more lift + cleaner hover ---------------- */
.card { box-shadow: var(--shadow-sm); }
@media (prefers-reduced-motion: no-preference) {
  .card:hover { box-shadow: var(--shadow); }
}

/* ---- Numbers everywhere: tabular + tighter tracking --------- */
.metric .value, .kpi-value, .hero-totals b, .wow-card .v,
.stat-value, td.num, .text-end.num, .tabular {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ---- Primary button: subtle vertical gradient + crisp ring -- */
.btn-primary {
  background: linear-gradient(180deg, #6466f2 0%, var(--primary) 100%);
  border-color: var(--primary-hover);
  box-shadow: 0 1px 2px rgba(31, 41, 71,.14), inset 0 1px 0 rgba(255,255,255,.16);
}
.btn-primary:hover,
.btn-primary:focus-visible {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-hover) 100%);
  border-color: var(--primary-hover);
}
.btn-primary:active { background: var(--primary-hover); }

/* ---- Soft/secondary buttons: cohesive low-emphasis style ----- */
.btn-soft {
  background: var(--primary-soft);
  color: var(--primary-on-soft);
  border: 1px solid transparent;
}
.btn-soft:hover {
  background: color-mix(in srgb, var(--primary) 18%, var(--surface));
  color: var(--primary-on-soft);
}

/* ---- Badges: consistent soft pill with hairline ring -------- */
.badge {
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: var(--radius-pill);
}

/* ---- Inputs: refined focus ring (indigo halo) -------------- */
.form-control:focus, .form-select:focus, .btn:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ---- Tables: quieter header, roomier rows ------------------- */
.card .table > thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.card .table > tbody td { vertical-align: middle; }
.card .table > tbody tr { transition: background var(--transition); }
.card .table.table-hover > tbody tr:hover { background: var(--surface-2); }

/* ---- Dropdown menus: softer, more elevated ------------------ */
.dropdown-menu {
  /* Opaque background with a hard #fff fallback — this rule used to omit
     `background`, so if --surface didn't resolve the menu rendered transparent
     and content bled through. Keep it self-sufficient. */
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius);
  padding: 0.3rem;
}
.dropdown-item { border-radius: var(--radius-sm); padding: 0.4rem 0.6rem; }

/* ============================================================
   THEME-3 — Form ergonomics (labels, help text, sections).
   Applies app-wide to .card forms; no per-template CSS.
   ============================================================ */

/* Section heading inside a form — a quiet kicker that groups fields. */
.form-section-head {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--text-faint);
  margin: 0.35rem 0 0.1rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-soft);
}
.form-section-head:first-child { border-top: 0; padding-top: 0; }

/* Labels: consistent weight + a touch more space below. */
.card .form-label {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.3rem;
}
.card .form-label.small { font-size: 0.78rem; }

/* Help text: quieter, with comfortable line-height for readability. */
.card .form-text {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 0.3rem;
  line-height: 1.4;
}
.card .form-text code {
  background: var(--code-bg);
  padding: 0.05em 0.35em;
  border-radius: 4px;
  font-size: 0.92em;
}

/* Inputs: slightly softer border + comfy padding; placeholder calmer. */
.card .form-control,
.card .form-select {
  border-color: var(--border-strong);
}
.card .form-control::placeholder { color: var(--text-faint); }

/* Required asterisk: subtle, not shouty. */
.card .form-label .text-danger { font-weight: 700; opacity: 0.85; }

/* Card footers in forms: align the canvas tint so actions read as a tray. */
.card > .card-footer {
  background: var(--surface-2);
  border-top: 1px solid var(--border-soft);
}

/* ============================================================ */
/* My tasks — slim personal strip on Home                       */
/* Compact, beautiful, hides when empty (rendered conditionally) */
/* ============================================================ */
.mytasks-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 0.6rem 0.9rem 0.7rem;
}
.mytasks-head {
  display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.mytasks-title {
  font-weight: 700; font-size: 0.92rem; color: var(--text);
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.mytasks-title i { color: var(--primary); }
.mytasks-count {
  font-size: 0.72rem; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--primary-soft); color: var(--primary-on-soft);
  border-radius: var(--radius-pill); padding: 0.05rem 0.5rem; line-height: 1.5;
}
.mytasks-spacer { flex: 1; }
.mytasks-new {
  font-size: 0.78rem; font-weight: 600; white-space: nowrap;
  color: var(--primary); text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.2rem;
  padding: 0.12rem 0.55rem; border-radius: var(--radius-pill);
  background: var(--primary-soft); margin-right: 0.5rem;
  transition: background var(--transition), color var(--transition);
}
.mytasks-new:hover { background: var(--primary); color: #fff; text-decoration: none; }
.mytasks-all { font-size: 0.8rem; color: var(--text-muted); text-decoration: none; white-space: nowrap; }
.mytasks-all:hover { color: var(--primary); text-decoration: none; }
.mytasks-empty {
  font-size: 0.86rem; color: var(--text-muted);
  display: flex; align-items: center; gap: 0.4rem; padding: 0.15rem 0.1rem 0.2rem;
}
.mytasks-empty-link { color: var(--primary); text-decoration: none; }
.mytasks-empty-link:hover { text-decoration: underline; }

.mytasks-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.mytask {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.4rem 0.15rem;
  border-top: 1px solid var(--border-soft);
}
.mytask:first-child { border-top: 0; }

/* The complete control: an outline circle that becomes a filled check
   on hover — tactile, obvious, and satisfying to click. */
.mytask-check-form { margin: 0; display: flex; }
.mytask-check {
  position: relative; width: 20px; height: 20px; flex: 0 0 20px;
  border: 0; background: transparent; padding: 0; cursor: pointer;
  color: var(--text-faint); line-height: 0;
}
.mytask-check i { position: absolute; inset: 0; font-size: 1.05rem; transition: opacity var(--transition); }
.mytask-check .bi-check-circle-fill { opacity: 0; color: var(--success); }
.mytask-check:hover .bi-circle { opacity: 0; }
.mytask-check:hover .bi-check-circle-fill { opacity: 1; }

.mytask-cat {
  width: 22px; height: 22px; flex: 0 0 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; font-size: 0.75rem;
}
.mytask-cat.cat-primary { background: var(--primary-soft); color: var(--primary-on-soft); }
.mytask-cat.cat-accent  { background: var(--accent-soft);  color: var(--accent-on-soft); }
.mytask-cat.cat-success { background: var(--success-soft); color: var(--success); }
.mytask-cat.cat-warning { background: var(--warning-soft); color: var(--warning); }
.mytask-cat.cat-muted   { background: var(--surface-alt);  color: var(--text-muted); }

.mytask-title {
  flex: 1; min-width: 0; color: var(--text); font-size: 0.9rem; font-weight: 500;
  text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mytask-title:hover { color: var(--primary); text-decoration: none; }
.mytask-due {
  font-size: 0.72rem; color: var(--text-muted); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.mytask-due.is-overdue { color: var(--danger); font-weight: 600; }
.mytask-overdue .mytask-title { color: var(--text); }

/* Task cards on /tasks — category chip + assignee avatar */
.task-card { scroll-margin-top: 80px; }   /* so #task-N anchor isn't hidden under the sticky topbar */
.task-card:target { animation: task-flash 1.6s ease; }
@keyframes task-flash {
  0%, 30% { background: var(--primary-soft); }
  100% { background: transparent; }
}
.task-cat-chip {
  display: inline-flex; align-items: center; gap: 0.28rem;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.01em;
  padding: 0.1rem 0.45rem; border-radius: var(--radius-pill);
  text-transform: uppercase;
}
.task-cat-chip.cat-primary { background: var(--primary-soft); color: var(--primary-on-soft); }
.task-cat-chip.cat-accent  { background: var(--accent-soft);  color: var(--accent-on-soft); }
.task-cat-chip.cat-success { background: var(--success-soft); color: var(--success); }
.task-cat-chip.cat-warning { background: var(--warning-soft); color: var(--warning); }
.task-cat-chip.cat-muted   { background: var(--surface-alt);  color: var(--text-muted); }
.task-assignee { display: inline-flex; align-items: center; gap: 0.35rem; }
.task-avatar {
  width: 20px; height: 20px; flex: 0 0 20px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 0.62rem; font-weight: 700;
  background: linear-gradient(140deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
}
.text-faint { color: var(--text-faint) !important; }

/* AdSense payout card on Home */
.payout-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.payout-card.payout-ready { border-color: var(--success); }
.payout-main { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem 0.9rem; }
.payout-icon {
  width: 44px; height: 44px; flex: 0 0 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px; font-size: 1.35rem; color: #fff;
  background: linear-gradient(140deg, var(--success) 0%, color-mix(in srgb, var(--success) 60%, var(--primary)) 100%);
}
.payout-figures { flex: 1; min-width: 0; }
.payout-label {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted);
}
.payout-amount {
  font-size: 2rem; font-weight: 700; line-height: 1.05; color: var(--text);
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 0.1rem;
}
.payout-sub { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.15rem; }
.payout-link {
  font-size: 0.82rem; font-weight: 600; white-space: nowrap; color: var(--primary);
  text-decoration: none; flex: 0 0 auto;
}
.payout-link:hover { text-decoration: none; color: var(--primary-hover); }
.payout-bar { height: 8px; background: var(--surface-alt); }
.payout-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--success) 0%, color-mix(in srgb, var(--success) 55%, var(--primary)) 100%);
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.payout-ready .payout-fill { background: var(--success); }

/* CTR rewrite helper on SEO tasks */
.ctr-open-link { padding-left: 0.4rem; }
.ctr-results { border-top: 1px dashed var(--border); padding-top: 0.6rem; }
.ctr-now { font-weight: 600; color: var(--text-muted); }
.ctr-sugg {
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); padding: 0.55rem 0.7rem; margin-bottom: 0.5rem;
}
.ctr-sugg-title, .ctr-sugg-meta {
  display: flex; align-items: flex-start; gap: 0.5rem; justify-content: space-between;
  font-size: 0.86rem;
}
.ctr-sugg-title { font-weight: 600; color: var(--text); }
.ctr-sugg-meta { color: var(--text-muted); margin-top: 0.3rem; }
.ctr-sugg-why { font-size: 0.72rem; color: var(--primary-on-soft); margin-top: 0.35rem; font-style: italic; }
.ctr-copy { flex: 0 0 auto; white-space: nowrap; --bs-btn-padding-y: 0.1rem; --bs-btn-padding-x: 0.45rem; font-size: 0.72rem; }
