* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
        --primary: #6366f1;
        --primary-dark: #4f46e5;
        --primary-darker: #4338ca;
        --primary-light: #eef2ff;
        --primary-glow: rgba(99,102,241,0.32);

        --bg: #f6f7f9;
        --bg-subtle: #f1f3f5;
        --surface: #ffffff;
        --card: #ffffff;

        --text: #0b1220;
        --text-soft: #334155;
        --muted: #6b7280;
        --faint: #9aa3af;

        --border: #e8eaed;
        --border-strong: #dde0e4;
        --ring: rgba(99,102,241,0.16);
        --input-bg: #fcfcfd;

        --high: #ef4444;
        --medium: #f59e0b;
        --low: #22c55e;
        --inprogress: #3b82f6;
        --done: #16a34a;
        --danger: #ef4444;
        --success: #10b981;

        --shadow-xs: 0 1px 2px rgba(16,24,40,0.05);
        --shadow-sm: 0 1px 3px rgba(16,24,40,0.06), 0 1px 2px rgba(16,24,40,0.04);
        --shadow-md: 0 4px 14px rgba(16,24,40,0.08), 0 2px 6px rgba(16,24,40,0.04);
        --shadow-lg: 0 12px 32px rgba(16,24,40,0.12), 0 4px 10px rgba(16,24,40,0.06);
        --shadow-xl: 0 24px 60px rgba(16,24,40,0.18);

        --radius-sm: 8px;
        --radius: 12px;
        --radius-lg: 16px;
        --radius-xl: 22px;

        --sidebar-w: 248px;
        --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

html { -webkit-text-size-adjust: 100%; }
body {
        font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
        background: var(--bg);
        color: var(--text);
        min-height: 100vh;
        line-height: 1.5;
        /* Always reserve the scrollbar's space so locking scroll when a modal
           opens doesn't shift the layout (most visible on Windows). */
        scrollbar-gutter: stable;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        letter-spacing: -0.011em;
}
::selection { background: var(--primary-light); color: var(--primary-darker); }
* { scrollbar-width: thin; scrollbar-color: #cdd2d9 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #d3d8df; border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #b9c0c9; background-clip: content-box; }

/* ═══════════ SCREENS ═══════════ */
.screen { display: none; }
.screen.active { display: block; }

/* ═══════════ APP SHELL (sidebar + main) ═══════════ */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
        width: var(--sidebar-w); flex-shrink: 0; position: fixed; top: 0; left: 0; bottom: 0;
        background: linear-gradient(180deg, #0f1117 0%, #15131f 100%);
        color: #cbd2e0; display: flex; flex-direction: column; z-index: 100;
        border-right: 1px solid rgba(255,255,255,0.06); padding: 18px 14px;
        transition: transform 0.28s var(--ease);
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 8px 10px 18px; }
.sidebar-brand .logo-tile {
        width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
        font-size: 1.05rem; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
        box-shadow: 0 6px 16px var(--primary-glow); flex-shrink: 0;
}
.sidebar-brand .brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sidebar-brand .brand-text b { color: #fff; font-size: 0.98rem; font-weight: 800; letter-spacing: -0.02em; }
.sidebar-brand .brand-text small { color: #7e879c; font-size: 0.72rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-section-label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.09em; color: #5f6880; font-weight: 700; padding: 14px 12px 7px; }
.nav-item {
        display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px; border-radius: 10px;
        color: #b6bdcf; font-size: 0.88rem; font-weight: 500; cursor: pointer; border: none; background: none;
        text-align: left; transition: all 0.16s var(--ease); margin-bottom: 2px; font-family: inherit; position: relative;
}
.nav-item .nav-ico { font-size: 1.02rem; width: 20px; text-align: center; flex-shrink: 0; }
/* Nav items are <a href> so the browser offers "Open in new tab", Ctrl/Cmd +
   click and middle-click. These two rules keep them looking exactly like the
   buttons they replaced — anchors bring an underline and inherit link colour. */
a.nav-item { text-decoration: none; box-sizing: border-box; }
a.nav-item:hover { text-decoration: none; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: linear-gradient(135deg, rgba(99,102,241,0.22), rgba(99,102,241,0.10)); color: #fff; box-shadow: inset 0 0 0 1px rgba(99,102,241,0.3); }
.nav-item.active::before { content: ''; position: absolute; left: -14px; top: 50%; transform: translateY(-50%); width: 3px; height: 20px; background: var(--primary); border-radius: 0 3px 3px 0; }
.nav-item .nav-badge { margin-left: auto; background: var(--primary); color: #fff; font-size: 0.66rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; }

.sidebar-nav-scroll {
        flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
        scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent;
        -webkit-overflow-scrolling: touch;   /* momentum scrolling on iOS */
        /* Breathing room so the last item never sits sliced flush against the
           footer divider — a half-cut row reads as "the menu is broken" rather
           than "there is more below", which is what people were reporting. */
        padding-bottom: 10px;
        /* Fade the bottom edge while there IS more to scroll to. Mobile has no
           visible scrollbar, so without this the list looks truncated. */
        mask-image: linear-gradient(to bottom, #000 calc(100% - 22px), transparent 100%);
        -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 22px), transparent 100%);
}
/* Once scrolled to the end there's nothing more to hint at, so drop the fade. */
.sidebar-nav-scroll.at-end { mask-image: none; -webkit-mask-image: none; }
.sidebar-nav-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-nav-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 999px; }
/* Settings / Notifications: pinned below the scrollable list, above the
   user footer. flex-shrink:0 keeps it from scrolling away — no matter
   how many role-specific items load above it. */
.sidebar-fixed-nav { flex-shrink: 0; padding-top: 8px; margin-top: 4px; border-top: 1px solid rgba(255,255,255,0.07); }
.sidebar-foot { flex-shrink: 0; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.07); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; margin-bottom: 6px; }
.sidebar-user .su-avatar { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--primary), var(--primary-darker)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.82rem; flex-shrink: 0; }
.sidebar-user .su-info { min-width: 0; }
.sidebar-user .su-name { color: #fff; font-size: 0.84rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .su-role { color: #7e879c; font-size: 0.72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .logout-btn {
        width: 100%; justify-content: center; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
        color: #cbd2e0; padding: 9px; border-radius: 10px; cursor: pointer; font-size: 0.84rem; font-weight: 600;
        transition: all 0.18s var(--ease); display: flex; align-items: center; gap: 7px;
}
.sidebar .logout-btn:hover { background: rgba(239,68,68,0.16); border-color: rgba(239,68,68,0.3); color: #fda4af; }

.main-area { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; background: var(--bg); background-image: radial-gradient(var(--border-strong) 1.1px, transparent 1.1px); background-size: 20px 20px; }

/* Topbar inside main */
.topbar {
        position: sticky; top: 0; z-index: 40; background: var(--bg); backdrop-filter: blur(12px) saturate(160%);
        -webkit-backdrop-filter: blur(12px) saturate(160%); border-bottom: 1px solid var(--border);
        padding: 15px 28px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar-title { font-size: 1.18rem; font-weight: 800; letter-spacing: -0.025em; display: flex; align-items: center; gap: 9px; }
.topbar-sub { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.hamburger { display: none; background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: 10px; width: 40px; height: 40px; cursor: pointer; font-size: 1.1rem; align-items: center; justify-content: center; }

/* ═══════════ VIEW SWITCHING ═══════════ */
.view { display: none; animation: viewIn 0.32s var(--ease); }
.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Per-card view filtering (member screen uses data-view tags on cards) */
.dashboard[data-active-view] > .card[data-view] { display: none; }
.dashboard[data-active-view="dashboard"] > .card[data-view="dashboard"],
.dashboard[data-active-view="campaigns"] > .card[data-view="campaigns"],
.dashboard[data-active-view="clients"] > .card[data-view="clients"],
.dashboard[data-active-view="settings"] > .card[data-view="settings"],
.dashboard[data-active-view="cscampaigns"] > .card[data-view="cscampaigns"],
.dashboard[data-active-view="health"] > .card[data-view="health"],
.dashboard[data-active-view="escalations"] > .card[data-view="escalations"],
.dashboard[data-active-view="renewals"] > .card[data-view="renewals"],
.dashboard[data-active-view="csfeedback"] > .card[data-view="csfeedback"],
.dashboard[data-active-view="csfollowups"] > .card[data-view="csfollowups"],
.dashboard[data-active-view="queue"] > .card[data-view="queue"],
.dashboard[data-active-view="discrepancies"] > .card[data-view="discrepancies"],
.dashboard[data-active-view="live"] > .card[data-view="live"],
.dashboard[data-active-view="chklists"] > .card[data-view="chklists"],
.dashboard[data-active-view="pids"] > .card[data-view="pids"],
.dashboard[data-active-view="pmpayouts"] > .card[data-view="pmpayouts"],
.dashboard[data-active-view="pmstats"] > .card[data-view="pmstats"],
.dashboard[data-active-view="pubvalidation"] > .card[data-view="pubvalidation"],
.dashboard[data-active-view="advrevenue"] > .card[data-view="advrevenue"],
.dashboard[data-active-view="pmpidsummary"] > .card[data-view="pmpidsummary"],
.dashboard[data-active-view="pmcampfb"] > .card[data-view="pmcampfb"],
.dashboard[data-active-view="pmalerts"] > .card[data-view="pmalerts"],
.dashboard[data-active-view="approvals"] > .card[data-view="approvals"],
.dashboard[data-active-view="inbox"] > .card[data-view="inbox"],
.dashboard[data-active-view="onboarding"] > .card[data-view="onboarding"],
.dashboard[data-active-view="amfeedback"] > .card[data-view="amfeedback"],
.dashboard[data-active-view="teamtasks"] > .card[data-view="teamtasks"],
.dashboard[data-active-view="owntasks"] > .card[data-view="owntasks"],
.dashboard[data-active-view="meetings"] > .card[data-view="meetings"],
.dashboard[data-active-view="eventmeetings"] > .card[data-view="eventmeetings"],
.dashboard[data-active-view="dailytracker"] > .card[data-view="dailytracker"],
.dashboard[data-active-view="clientsummary"] > .card[data-view="clientsummary"],
.dashboard[data-active-view="notifhistory"] > .card[data-view="notifhistory"],
.dashboard[data-active-view="finrevenue"] > .card[data-view="finrevenue"],
.dashboard[data-active-view="finpl"] > .card[data-view="finpl"],
.dashboard[data-active-view="invoices"] > .card[data-view="invoices"],
.dashboard[data-active-view="finpayouts"] > .card[data-view="finpayouts"],
.dashboard[data-active-view="pipeline"] > .card[data-view="pipeline"],
.dashboard[data-active-view="smfollowups"] > .card[data-view="smfollowups"],
.dashboard[data-active-view="smrevenue"] > .card[data-view="smrevenue"],
.dashboard[data-active-view="targets"] > .card[data-view="targets"],
.dashboard[data-active-view="clientcamps"] > .card[data-view="clientcamps"],
.dashboard[data-active-view="advconfirmation"] > .card[data-view="advconfirmation"] { display: block; }
.dashboard[data-active-view="admintimeline"] > .view[data-view="admintimeline"] { display: block; }
/* On non-dashboard views, hide untagged direct-child cards and stats rows */
.dashboard[data-active-view]:not([data-active-view="dashboard"]) > .card:not([data-view]),
.dashboard[data-active-view]:not([data-active-view="dashboard"]) > .stats-row { display: none !important; }
/* defaultMemberDashboard: show tagged children per view */
.dashboard[data-active-view]:not([data-active-view="dashboard"]) > #defaultMemberDashboard > .card[data-view] { display: none; }
.dashboard[data-active-view="campaigns"] > #defaultMemberDashboard > .card[data-view="campaigns"],
.dashboard[data-active-view="clients"] > #defaultMemberDashboard > .card[data-view="clients"],
.dashboard[data-active-view="onboarding"] > #defaultMemberDashboard > .card[data-view="onboarding"] { display: block; }
.dashboard[data-active-view]:not([data-active-view="dashboard"]) > #defaultMemberDashboard > .card:not([data-view]) { display: none; }
.dashboard[data-active-view="dashboard"] > #defaultMemberDashboard > .card[data-view="campaigns"],
.dashboard[data-active-view="dashboard"] > #defaultMemberDashboard > .card[data-view="clients"] { display: none; }
/* salesMgrDashboard: filter by data-view */
.dashboard[data-active-view] > #salesMgrDashboard > .card[data-view] { display: none; }
.dashboard[data-active-view="dashboard"] > #salesMgrDashboard > .card[data-view="dashboard"],
.dashboard[data-active-view="pipeline"] > #salesMgrDashboard > .card[data-view="pipeline"],
.dashboard[data-active-view="clients"] > #salesMgrDashboard > .card[data-view="clients"] { display: block; }
/* pubMgrDashboard: filter by data-view */
.dashboard[data-active-view] > #pubMgrDashboard > .card[data-view] { display: none; }
.dashboard[data-active-view="dashboard"] > #pubMgrDashboard > .card[data-view="dashboard"],
.dashboard[data-active-view="campaigns"] > #pubMgrDashboard > .card[data-view="campaigns"],
.dashboard[data-active-view="clients"] > #pubMgrDashboard > .card[data-view="clients"] { display: block; }
/* financeDashboard: filter by data-view */
.dashboard[data-active-view] > #financeDashboard > .card[data-view] { display: none; }
.dashboard[data-active-view="dashboard"] > #financeDashboard > .card[data-view="dashboard"],
.dashboard[data-active-view="campaigns"] > #financeDashboard > .card[data-view="campaigns"],
.dashboard[data-active-view="clients"] > #financeDashboard > .card[data-view="clients"] { display: block; }
/* untagged cards inside role dashboards hidden on non-dashboard views */
.dashboard[data-active-view]:not([data-active-view="dashboard"]) > #pubMgrDashboard > .card:not([data-view]),
.dashboard[data-active-view]:not([data-active-view="dashboard"]) > #financeDashboard > .card:not([data-view]),
.dashboard[data-active-view]:not([data-active-view="dashboard"]) > #salesMgrDashboard > .card:not([data-view]) { display: none !important; }


/* ═══════════ MY TEAM VIEW ═══════════ */
.dashboard[data-active-view="team"] > .card[data-view="team"] { display: block; }
.dashboard[data-active-view="team"] > .stats-row { display: none !important; }
.dashboard[data-active-view="team"] > .card:not([data-view="team"]) { display: none !important; }
.dashboard[data-active-view="team"] > #defaultMemberDashboard,
.dashboard[data-active-view="team"] > #pubMgrDashboard,
.dashboard[data-active-view="team"] > #salesMgrDashboard,
.dashboard[data-active-view="team"] > #financeDashboard { display: none !important; }
/* Team Availability view (TL read-only) — mirrors the team view pattern */
.dashboard[data-active-view="availability"] > .card[data-view="availability"] { display: block; }
.dashboard[data-active-view="availability"] > .stats-row { display: none !important; }
.dashboard[data-active-view="availability"] > .card:not([data-view="availability"]) { display: none !important; }
.dashboard[data-active-view="availability"] > #defaultMemberDashboard,
.dashboard[data-active-view="availability"] > #pubMgrDashboard,
.dashboard[data-active-view="availability"] > #salesMgrDashboard,
.dashboard[data-active-view="availability"] > #financeDashboard { display: none !important; }

/* ═══════════ CS MANAGER & ADOPS ROLE VIEWS ═══════════ */
/* Show the correct card for each new view */
.dashboard[data-active-view="escalations"] > #defaultMemberDashboard > .card[data-view="escalations"],
.dashboard[data-active-view="renewals"]     > #defaultMemberDashboard > .card[data-view="renewals"],
.dashboard[data-active-view="queue"]        > #defaultMemberDashboard > .card[data-view="queue"],
.dashboard[data-active-view="discrepancies"]> #defaultMemberDashboard > .card[data-view="discrepancies"] { display: block; }
/* CS/AdOps Pub Validation (restricted view) lives in defaultMemberDashboard.
   !important is needed here because the generic hide rule above uses
   :not(), which raises its specificity above a plain show rule. */
.dashboard[data-active-view="pubvalidation"] > #defaultMemberDashboard > .card[data-view="pubvalidationcs"] { display: block !important; }
/* Hide everything else inside defaultMemberDashboard on these views */
.dashboard[data-active-view="escalations"]  > #defaultMemberDashboard > .card:not([data-view="escalations"]),
.dashboard[data-active-view="renewals"]     > #defaultMemberDashboard > .card:not([data-view="renewals"]),
.dashboard[data-active-view="queue"]        > #defaultMemberDashboard > .card:not([data-view="queue"]),
.dashboard[data-active-view="discrepancies"]> #defaultMemberDashboard > .card:not([data-view="discrepancies"]) { display: none !important; }
/* Hide stats rows on new views */
.dashboard[data-active-view="escalations"]  > .stats-row,
.dashboard[data-active-view="renewals"]     > .stats-row,
.dashboard[data-active-view="queue"]        > .stats-row,
.dashboard[data-active-view="discrepancies"]> .stats-row { display: none !important; }

/* ═══════════ ADVERTISER MANAGER ROLE VIEWS ═══════════ */
.dashboard[data-active-view="inbox"]      > #defaultMemberDashboard > .card[data-view="inbox"],
.dashboard[data-active-view="approvals"]  > #defaultMemberDashboard > .card[data-view="approvals"],
.dashboard[data-active-view="amfeedback"] > #defaultMemberDashboard > .card[data-view="amfeedback"] { display: block; }
.dashboard[data-active-view="inbox"]      > #defaultMemberDashboard > .card:not([data-view="inbox"]),
.dashboard[data-active-view="approvals"]  > #defaultMemberDashboard > .card:not([data-view="approvals"]),
.dashboard[data-active-view="amfeedback"] > #defaultMemberDashboard > .card:not([data-view="amfeedback"]) { display: none !important; }
.dashboard[data-active-view="inbox"] > .stats-row,
.dashboard[data-active-view="approvals"] > .stats-row,
.dashboard[data-active-view="amfeedback"] > .stats-row { display: none !important; }

/* ═══════════ PUBLISHER MANAGER ROLE VIEWS ═══════════ */
.dashboard[data-active-view="pids"]          > #pubMgrDashboard > .card[data-view="pids"],
.dashboard[data-active-view="pmpayouts"]     > #pubMgrDashboard > .card[data-view="pmpayouts"],
.dashboard[data-active-view="pmstats"]       > #pubMgrDashboard > .card[data-view="pmstats"],
.dashboard[data-active-view="pubvalidation"] > #pubMgrDashboard > .card[data-view="pubvalidation"] { display: block; }
/* pids view aliases campaigns view cards */
.dashboard[data-active-view="pids"] > #pubMgrDashboard > .card[data-view="campaigns"] { display: block; }
.dashboard[data-active-view="pids"]          > #pubMgrDashboard > .card:not([data-view="campaigns"]):not([data-view="pids"]),
.dashboard[data-active-view="pmpayouts"]     > #pubMgrDashboard > .card:not([data-view="pmpayouts"]),
.dashboard[data-active-view="pmstats"]       > #pubMgrDashboard > .card:not([data-view="pmstats"]),
.dashboard[data-active-view="pubvalidation"] > #pubMgrDashboard > .card:not([data-view="pubvalidation"]) { display: none !important; }
.dashboard[data-active-view="pids"] > .stats-row,
.dashboard[data-active-view="pmpayouts"] > .stats-row,
.dashboard[data-active-view="pmstats"] > .stats-row,
.dashboard[data-active-view="pubvalidation"] > .stats-row { display: none !important; }
/* ── Advertiser Revenue view ── */
.dashboard[data-active-view="advrevenue"] > .card[data-view="advrevenue"] { display: block; }
.dashboard[data-active-view="advrevenue"] > .card:not([data-view="advrevenue"]),
.dashboard[data-active-view="advrevenue"] > #pubMgrDashboard { display: none !important; }
.dashboard[data-active-view="advrevenue"] > .stats-row { display: none !important; }
/* ── PM Summary views ── */
.dashboard[data-active-view="pmpidsummary"] > .card[data-view="pmpidsummary"] { display: block; }
.dashboard[data-active-view="pmpidsummary"] > .card:not([data-view="pmpidsummary"]),
.dashboard[data-active-view="pmpidsummary"] > #pubMgrDashboard { display: none !important; }
.dashboard[data-active-view="pmpidsummary"] > .stats-row { display: none !important; }
.dashboard[data-active-view="pmcampfb"] > .card[data-view="pmcampfb"] { display: block; }
.dashboard[data-active-view="pmcampfb"] > .card:not([data-view="pmcampfb"]),
.dashboard[data-active-view="pmcampfb"] > #pubMgrDashboard { display: none !important; }
.dashboard[data-active-view="pmcampfb"] > .stats-row { display: none !important; }

/* PM query inbox — #pm-query-card is a direct .dashboard child (see the
   comment on it in index.html). On this view the PM's own dashboard
   wrapper must collapse, exactly as it does for pmcampfb; otherwise the
   whole PM dashboard renders underneath the inbox. #defaultMemberDashboard
   is left alone here — it carries the AM's #am-query-card, and the rules
   further down already scope that correctly. */
.dashboard[data-active-view="inbox"] > #pubMgrDashboard,
.dashboard[data-active-view="inbox"] > #salesMgrDashboard,
.dashboard[data-active-view="inbox"] > #financeDashboard { display: none !important; }
.dashboard[data-active-view="inbox"] > .card:not([data-view="inbox"]) { display: none !important; }
.dashboard[data-active-view="pmalerts"] > .card[data-view="pmalerts"] { display: block; }
.dashboard[data-active-view="pmalerts"] > .card:not([data-view="pmalerts"]),
.dashboard[data-active-view="pmalerts"] > #pubMgrDashboard { display: none !important; }
.dashboard[data-active-view="pmalerts"] > .stats-row { display: none !important; }
/* ── My Campaigns (Publisher Manager) ──
   NOTE: this card is NOT a direct child of .dashboard — it lives
   INSIDE #pubMgrDashboard (.dashboard > #pubMgrDashboard > .card).
   #pubMgrDashboard must stay visible (its own display:none would hide
   the card regardless of the card's own display value); instead we
   hide #pubMgrDashboard's OTHER children so only this card shows. */
.dashboard[data-active-view="pmmycampaigns"] > #pubMgrDashboard { display: block !important; }
.dashboard[data-active-view="pmmycampaigns"] > #pubMgrDashboard > .card[data-view="pmmycampaigns"] { display: block !important; }
.dashboard[data-active-view="pmmycampaigns"] > #pubMgrDashboard > .card:not([data-view="pmmycampaigns"]),
.dashboard[data-active-view="pmmycampaigns"] > .card:not([data-view="pmmycampaigns"]) { display: none !important; }
.dashboard[data-active-view="pmmycampaigns"] > .stats-row { display: none !important; }
/* ── Agency Credentials (member: AM / CS / AdOps / PM) ──
   Same nesting issue: this card ALSO lives inside #pubMgrDashboard,
   regardless of the viewer's role (the HTML position doesn't change
   per-role — only #pubMgrDashboard's own visibility does). Keep the
   wrapper visible and hide its other children the same way. */
.dashboard[data-active-view="agencycreds"] > #pubMgrDashboard { display: block !important; }
.dashboard[data-active-view="agencycreds"] > #pubMgrDashboard > .card[data-view="agencycreds"] { display: block !important; }
.dashboard[data-active-view="agencycreds"] > #pubMgrDashboard > .card:not([data-view="agencycreds"]),
.dashboard[data-active-view="agencycreds"] > .card:not([data-view="agencycreds"]),
.dashboard[data-active-view="agencycreds"] > #salesMgrDashboard,
.dashboard[data-active-view="agencycreds"] > #financeDashboard,
.dashboard[data-active-view="agencycreds"] > #defaultMemberDashboard { display: none !important; }
.dashboard[data-active-view="agencycreds"] > .stats-row { display: none !important; }

/* ── Advertiser Confirmation ── */
.dashboard[data-active-view="advconfirmation"] > .card[data-view="advconfirmation"] { display: block; }
.dashboard[data-active-view="advconfirmation"] > .card:not([data-view="advconfirmation"]),
.dashboard[data-active-view="advconfirmation"] > #pubMgrDashboard,
.dashboard[data-active-view="advconfirmation"] > #salesMgrDashboard,
.dashboard[data-active-view="advconfirmation"] > #financeDashboard,
.dashboard[data-active-view="advconfirmation"] > #defaultMemberDashboard { display: none !important; }
.dashboard[data-active-view="advconfirmation"] > .stats-row { display: none !important; }
/* ── Admin Meetings view ── */
.dashboard[data-active-view="adminmeetings"] > .view[data-view="adminmeetings"] { display: block; }
/* ── Meetings view ── */
.dashboard[data-active-view="meetings"] > .card[data-view="meetings"] { display: block; }
.dashboard[data-active-view="meetings"] > .card:not([data-view="meetings"]),
.dashboard[data-active-view="meetings"] > #pubMgrDashboard,
.dashboard[data-active-view="meetings"] > #salesMgrDashboard,
.dashboard[data-active-view="meetings"] > #financeDashboard,
.dashboard[data-active-view="meetings"] > #defaultMemberDashboard { display: none !important; }
.dashboard[data-active-view="meetings"] > .stats-row { display: none !important; }
/* ── Meeting cards ── */
.mtg-card { background:var(--card); border:1.5px solid var(--border); border-radius:14px; padding:18px 20px; margin-bottom:14px; transition:box-shadow .2s; }
.mtg-card:hover { box-shadow:0 4px 16px rgba(0,0,0,.07); }
.mtg-kp-list { list-style:none; padding:0; margin:8px 0 0; }
.mtg-kp-list li { display:flex; align-items:flex-start; gap:7px; padding:4px 0; font-size:0.82rem; color:var(--text); border-bottom:1px solid var(--border); }
.mtg-kp-list li:last-child { border-bottom:none; }
.mtg-kp-dot { width:7px; height:7px; border-radius:50%; background:var(--primary); flex-shrink:0; margin-top:5px; }
.mtg-ai-row { display:flex; align-items:center; gap:8px; padding:5px 0; font-size:0.8rem; border-bottom:1px solid var(--border); }
.mtg-ai-row:last-child { border-bottom:none; }
.mtg-type-badge { display:inline-block; font-size:0.68rem; font-weight:700; border-radius:20px; padding:2px 9px; }
/* ── Pub Validation table ── */
.pv-table { width:100%; border-collapse:collapse; font-size:0.82rem; }
.pv-table th { background:var(--bg2); color:var(--muted); font-weight:600; padding:7px 10px; text-align:left; border-bottom:1.5px solid var(--border); white-space:nowrap; position:sticky; top:0; z-index:1; }
.pv-table td { padding:7px 10px; border-bottom:1px solid var(--border); vertical-align:middle; }
.pv-table tr:hover td { background:var(--bg2); }
.pv-pub-header { background:var(--bg2); font-weight:700; font-size:0.83rem; color:var(--primary); padding:8px 10px; border-bottom:1px solid var(--border); }
.pv-stat-cards { display:flex; gap:12px; flex-wrap:wrap; margin-bottom:16px; }
.pv-stat-card { background:var(--bg2); border-radius:10px; padding:12px 16px; min-width:130px; flex:1; }
.pv-stat-card .pv-sc-label { font-size:0.72rem; color:var(--muted); font-weight:600; text-transform:uppercase; letter-spacing:.04em; margin-bottom:4px; }
.pv-stat-card .pv-sc-val { font-size:1.35rem; font-weight:700; color:var(--text); }
.pv-status-pill { font-size:0.7rem; font-weight:700; padding:2px 8px; border-radius:99px; }
.pv-status-closed  { background:#dcfce7; color:#166534; }
.pv-status-open    { background:#fef9c3; color:#92400e; }
.pv-status-pending { background:#e0e7ff; color:#3730a3; }
.pv-profit-pos { color:#16a34a; font-weight:700; }
.pv-profit-neg { color:#dc2626; font-weight:700; }
.pv-profit-low { color:#d97706; font-weight:700; }

/* ═══════════ SALES MANAGER ROLE VIEWS ═══════════ */
/* pipeline view shows pipeline-tagged SM cards */
.dashboard[data-active-view="pipeline"]     > #salesMgrDashboard > .card[data-view="pipeline"]     { display: block; }
/* client campaigns view */
.dashboard[data-active-view="clientcamps"]  > #salesMgrDashboard > .card[data-view="clientcamps"]  { display: block; }
/* smrevenue + smfollowups: show dashboard-tagged cards that carry dual membership via id */
.dashboard[data-active-view="smrevenue"]   > #salesMgrDashboard > .card[data-view="smrevenue"],
.dashboard[data-active-view="smfollowups"] > #salesMgrDashboard > .card[data-view="smfollowups"],
.dashboard[data-active-view="targets"]     > #salesMgrDashboard > .card[data-view="targets"] { display: block; }
/* also show smrevenue and smfollowups cards on dashboard view */
.dashboard[data-active-view="dashboard"]   > #salesMgrDashboard > .card[data-view="smrevenue"],
.dashboard[data-active-view="dashboard"]   > #salesMgrDashboard > .card[data-view="smfollowups"] { display: block; }
.dashboard[data-active-view="pipeline"]    > #salesMgrDashboard > .card:not([data-view="pipeline"]),
.dashboard[data-active-view="clientcamps"] > #salesMgrDashboard > .card:not([data-view="clientcamps"]),
.dashboard[data-active-view="smrevenue"]   > #salesMgrDashboard > .card:not([data-view="smrevenue"]),
.dashboard[data-active-view="smfollowups"] > #salesMgrDashboard > .card:not([data-view="smfollowups"]),
.dashboard[data-active-view="targets"]     > #salesMgrDashboard > .card:not([data-view="targets"]) { display: none !important; }
.dashboard[data-active-view="pipeline"]    > .stats-row,
.dashboard[data-active-view="clientcamps"] > .stats-row,
.dashboard[data-active-view="smrevenue"]   > .stats-row,
.dashboard[data-active-view="smfollowups"] > .stats-row,
.dashboard[data-active-view="targets"]     > .stats-row { display: none !important; }

/* ═══════════ CS MANAGER EXTRA VIEWS ═══════════ */
.dashboard[data-active-view="health"]      > #defaultMemberDashboard > .card[data-view="health"],
.dashboard[data-active-view="csfeedback"]  > #defaultMemberDashboard > .card[data-view="csfeedback"],
.dashboard[data-active-view="csfollowups"] > #defaultMemberDashboard > .card[data-view="csfollowups"] { display: block; }
.dashboard[data-active-view="health"]      > #defaultMemberDashboard > .card:not([data-view="health"]),
.dashboard[data-active-view="csfeedback"]  > #defaultMemberDashboard > .card:not([data-view="csfeedback"]),
.dashboard[data-active-view="csfollowups"] > #defaultMemberDashboard > .card:not([data-view="csfollowups"]) { display: none !important; }
.dashboard[data-active-view="health"] > .stats-row,
.dashboard[data-active-view="csfeedback"] > .stats-row,
.dashboard[data-active-view="csfollowups"] > .stats-row { display: none !important; }

/* ═══════════ CS/ADOPS CAMPAIGNS VIEW ═══════════ */
.dashboard[data-active-view="cscampaigns"] > #defaultMemberDashboard > .card[data-view="cscampaigns"] { display: block; }
.dashboard[data-active-view="cscampaigns"] > #defaultMemberDashboard > .card:not([data-view="cscampaigns"]) { display: none !important; }
.dashboard[data-active-view="cscampaigns"] > .stats-row { display: none !important; }

/* ═══════════ AD OPERATIONS EXTRA VIEWS ═══════════ */
.dashboard[data-active-view="live"]     > #defaultMemberDashboard > .card[data-view="live"],
.dashboard[data-active-view="chklists"] > #defaultMemberDashboard > .card[data-view="chklists"] { display: block; }
.dashboard[data-active-view="live"]     > #defaultMemberDashboard > .card:not([data-view="live"]),
.dashboard[data-active-view="chklists"] > #defaultMemberDashboard > .card:not([data-view="chklists"]) { display: none !important; }
.dashboard[data-active-view="live"] > .stats-row,
.dashboard[data-active-view="chklists"] > .stats-row { display: none !important; }

/* ═══════════ FINANCE ROLE VIEWS ═══════════ */
.dashboard[data-active-view="finrevenue"] > #financeDashboard > .card[data-view="finrevenue"],
.dashboard[data-active-view="finpl"]      > #financeDashboard > .card[data-view="finpl"],
.dashboard[data-active-view="invoices"]   > #financeDashboard > .card[data-view="invoices"],
.dashboard[data-active-view="finpayouts"] > #financeDashboard > .card[data-view="finpayouts"] { display: block; }
/* Finance also owns Pub Validation (read-only), Advertiser Revenue and
   Advertiser Confirmation — their cards live inside #financeDashboard and
   carry distinct data-views, so map them here or they stay hidden.
   !important guards against any specificity edge case with the generic
   hide rule above. */
.dashboard[data-active-view="pubvalidation"] > #financeDashboard > .card[data-view="pubvalidationfin"],
.dashboard[data-active-view="advrevenue"]    > #financeDashboard > .card[data-view="advrevenue"],
.dashboard[data-active-view="advconfirmation"] > #financeDashboard > .card[data-view="advconfirmation"] { display: block !important; }
.dashboard[data-active-view="finrevenue"] > #financeDashboard > .card:not([data-view="finrevenue"]),
.dashboard[data-active-view="finpl"]      > #financeDashboard > .card:not([data-view="finpl"]),
.dashboard[data-active-view="invoices"]   > #financeDashboard > .card:not([data-view="invoices"]),
.dashboard[data-active-view="finpayouts"] > #financeDashboard > .card:not([data-view="finpayouts"]) { display: none !important; }
.dashboard[data-active-view="finrevenue"] > .stats-row,
.dashboard[data-active-view="finpl"] > .stats-row,
.dashboard[data-active-view="invoices"] > .stats-row,
.dashboard[data-active-view="finpayouts"] > .stats-row { display: none !important; }
/* also hide role dashboards on finance-specific views */
.dashboard[data-active-view="finrevenue"] > #defaultMemberDashboard,
.dashboard[data-active-view="finpl"]      > #defaultMemberDashboard,
.dashboard[data-active-view="invoices"]   > #defaultMemberDashboard,
.dashboard[data-active-view="finpayouts"] > #defaultMemberDashboard { display: none !important; }

/* ═══════════ TEAM TASKS VIEW ═══════════ */
.dashboard[data-active-view="teamtasks"] > .card[data-view="teamtasks"] { display: block; }
.dashboard[data-active-view="teamtasks"] > .card:not([data-view="teamtasks"]) { display: none !important; }
.dashboard[data-active-view="teamtasks"] > .stats-row { display: none !important; }
.dashboard[data-active-view="teamtasks"] > #defaultMemberDashboard,
.dashboard[data-active-view="teamtasks"] > #pubMgrDashboard,
.dashboard[data-active-view="teamtasks"] > #salesMgrDashboard,
.dashboard[data-active-view="teamtasks"] > #financeDashboard { display: none !important; }
/* Admin team tasks view */
.dashboard[data-active-view="adminteamtasks"] > .view[data-view="adminteamtasks"] { display: block; }
/* Admin availability view */
.dashboard[data-active-view="adminavailability"] > .view[data-view="adminavailability"] { display: block; }
/* Daily Sales Tracker view (admin) */
.dashboard[data-active-view="admindailytracker"] > .view[data-view="admindailytracker"] { display: block; }
/* Admin Accounts view */
.dashboard[data-active-view="adminaccounts"] > .view[data-view="adminaccounts"] { display: block; }
/* Admin Client Summary view */
.dashboard[data-active-view="adminclientsummary"] > .view[data-view="adminclientsummary"] { display: block; }
/* Member Client Summary view */
.dashboard[data-active-view="clientsummary"] > .card[data-view="clientsummary"] { display: block; }
.dashboard[data-active-view="clientsummary"] > .card:not([data-view="clientsummary"]) { display: none !important; }
.dashboard[data-active-view="clientsummary"] > .stats-row { display: none !important; }
.dashboard[data-active-view="clientsummary"] > #defaultMemberDashboard,
.dashboard[data-active-view="clientsummary"] > #pubMgrDashboard,
.dashboard[data-active-view="clientsummary"] > #salesMgrDashboard,
.dashboard[data-active-view="clientsummary"] > #financeDashboard { display: none !important; }

.dashboard[data-active-view="notifhistory"] > .card[data-view="notifhistory"] { display: block; }
.dashboard[data-active-view="notifhistory"] > .card:not([data-view="notifhistory"]) { display: none !important; }
.dashboard[data-active-view="notifhistory"] > .stats-row { display: none !important; }
.dashboard[data-active-view="notifhistory"] > #defaultMemberDashboard,
.dashboard[data-active-view="notifhistory"] > #pubMgrDashboard,
.dashboard[data-active-view="notifhistory"] > #salesMgrDashboard,
.dashboard[data-active-view="notifhistory"] > #financeDashboard { display: none !important; }
/* Daily Sales Tracker view (member) */
.dashboard[data-active-view="dailytracker"] > .card[data-view="dailytracker"] { display: block; }
.dashboard[data-active-view="dailytracker"] > .card:not([data-view="dailytracker"]) { display: none !important; }
.dashboard[data-active-view="dailytracker"] > .stats-row { display: none !important; }
.dashboard[data-active-view="dailytracker"] > #defaultMemberDashboard,
.dashboard[data-active-view="dailytracker"] > #pubMgrDashboard,
.dashboard[data-active-view="dailytracker"] > #salesMgrDashboard,
.dashboard[data-active-view="dailytracker"] > #financeDashboard { display: none !important; }
/* My Tasks view (member) */
.dashboard[data-active-view="owntasks"] > .card[data-view="owntasks"] { display: block; }
.dashboard[data-active-view="owntasks"] > .card:not([data-view="owntasks"]) { display: none !important; }
.dashboard[data-active-view="owntasks"] > .stats-row { display: none !important; }
.dashboard[data-active-view="owntasks"] > #defaultMemberDashboard,
.dashboard[data-active-view="owntasks"] > #pubMgrDashboard,
.dashboard[data-active-view="owntasks"] > #salesMgrDashboard,
.dashboard[data-active-view="owntasks"] > #financeDashboard { display: none !important; }

/* ── Team Task Cards ── */
/* ── Member Status Pills ── */
.ms-pill { display:inline-flex;align-items:center;gap:4px;font-size:0.7rem;font-weight:700;padding:2px 10px;border-radius:999px;cursor:default;white-space:nowrap; }
.ms-active { background:#f0fdf4;color:#15803d;border:1px solid #86efac; }
.ms-away   { background:#fffbeb;color:#92400e;border:1px solid #fcd34d; }
.ms-ooo    { background:#fef2f2;color:#991b1b;border:1px solid #fca5a5; }
.ms-never  { background:var(--bg-subtle);color:#64748b;border:1px solid #e2e8f0; }
.ms-setter-btn { font-size:0.68rem;padding:3px 10px;border-radius:999px;border:1px solid var(--border);background:var(--surface);color:var(--muted);cursor:pointer;font-weight:600; }
.ms-setter-btn:hover { border-color:var(--primary);color:var(--primary); }
.ms-setter-panel { background:var(--card);border:1.5px solid var(--border);border-radius:12px;padding:14px 16px;margin-bottom:12px;display:none; }
.ms-setter-panel.open { display:block; }
/* ── Client / Publisher Summary Page ── */
.cs-wrap { padding:0 2px; }
.cs-topbar { display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;margin-bottom:18px; }
.cs-view-toggle { display:flex;gap:6px; }
.cs-toggle-btn { padding:6px 16px;border-radius:999px;border:1.5px solid var(--border);background:var(--surface);color:var(--muted);cursor:pointer;font-size:0.82rem;font-weight:600; }
.cs-toggle-btn.active { background:var(--primary);color:#fff;border-color:var(--primary); }
.cs-adv-block { margin-bottom:14px;border-radius:14px;border:1.5px solid var(--border);overflow:hidden; }
.cs-adv-hd { display:flex;align-items:center;gap:12px;padding:12px 16px;background:var(--surface);cursor:pointer;user-select:none; }
.cs-adv-hd:hover { filter:brightness(0.97); }
.cs-adv-avatar { width:36px;height:36px;border-radius:50%;background:#e8eaf6;color:#3949ab;display:flex;align-items:center;justify-content:center;font-size:0.8rem;font-weight:700;flex-shrink:0; }
.cs-adv-name { font-size:1rem;font-weight:700;flex:1; }
.cs-adv-meta { font-size:0.75rem;color:var(--muted); }
.cs-chevron { font-size:0.72rem;color:var(--muted);transition:transform 0.2s; }
.cs-chevron.open { transform:rotate(180deg); }
.cs-camp-list { padding:0 12px 12px; }
.cs-camp-block { border:1px solid var(--border);border-radius:10px;margin-top:10px;overflow:hidden; }
.cs-camp-hd { display:flex;align-items:center;gap:8px;padding:9px 12px;background:var(--card);cursor:pointer; }
.cs-camp-hd:hover { background:var(--surface); }
.cs-camp-name { flex:1;font-size:0.88rem;font-weight:600; }
.cs-camp-body { display:none; }
.cs-camp-body.open { display:block; }
.cs-pid-table { width:100%;border-collapse:collapse;font-size:0.8rem; }
.cs-pid-table th { background:var(--surface);padding:6px 12px;text-align:left;color:var(--muted);font-weight:600;font-size:0.72rem;text-transform:uppercase;letter-spacing:0.03em;border-bottom:1px solid var(--border); }
.cs-pid-table td { padding:8px 12px;border-bottom:1px solid var(--border);vertical-align:middle; }
.cs-pid-table tr:last-child td { border-bottom:none; }
.cs-no-pids { padding:10px 14px;color:var(--muted);font-size:0.8rem;font-style:italic; }
.cs-fb-good   { background:#f0fdf4;color:#15803d;border:1px solid #86efac;padding:2px 8px;border-radius:999px;font-size:0.72rem;font-weight:700; }
.cs-fb-decent { background:#fffbeb;color:#92400e;border:1px solid #fcd34d;padding:2px 8px;border-radius:999px;font-size:0.72rem;font-weight:700; }
.cs-fb-bad    { background:#fef2f2;color:#991b1b;border:1px solid #fca5a5;padding:2px 8px;border-radius:999px;font-size:0.72rem;font-weight:700; }
.cs-fb-urgent { background:#fff7ed;color:#9a3412;border:1px solid #fdba74;padding:2px 8px;border-radius:999px;font-size:0.72rem;font-weight:700; }
.cs-empty { text-align:center;padding:40px 20px;color:var(--muted); }
.cs-filter-row { display:flex;gap:10px;flex-wrap:wrap;margin-bottom:14px;align-items:center; }
.cs-filter-row select { font-size:0.82rem;padding:6px 12px;border:1.5px solid var(--border);border-radius:8px;background:var(--card);color:var(--text); }
/* The search inputs sit in the same row as the selects above and must match
 * them exactly. They previously carried hard-coded inline styles with a
 * different padding (10px vs 12px), radius (7px vs 8px) and background
 * (--input-bg vs --card), so they rendered visibly out of line. Styling both
 * from one place here keeps them in step; the inline styles were removed from
 * _csRenderTable in index.js. */
.cs-filter-row input[type="text"] { font-size:0.82rem;padding:6px 12px;border:1.5px solid var(--border);border-radius:8px;background:var(--card);color:var(--text);min-width:190px;font-family:inherit;line-height:normal;box-sizing:border-box; }
.cs-flat-table { width:100%;border-collapse:collapse;font-size:0.8rem; }
.cs-flat-table th { background:var(--surface);padding:8px 10px;text-align:left;color:var(--muted);font-weight:600;font-size:0.72rem;text-transform:uppercase;letter-spacing:0.03em;border-bottom:1.5px solid var(--border); }
.cs-flat-table td { padding:8px 10px;border-bottom:1px solid var(--border);vertical-align:middle; }
.cs-flat-table tr:hover td { background:var(--surface); }
.cs-stat-chips { display:flex;gap:10px;flex-wrap:wrap;margin-bottom:16px; }
.cs-stat-chip { background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:8px 14px;font-size:0.8rem; }
.cs-stat-chip strong { display:block;font-size:1.1rem;font-weight:700;color:var(--primary); }
/* ── Reassign Members ── */
.dashboard[data-active-view="adminreassign"] > .view[data-view="adminreassign"] { display: block; }
.rp-tabbar { display:flex;gap:6px;flex-wrap:wrap;margin-bottom:20px; }
.rp-tab { padding:8px 16px;border-radius:8px;border:1px solid var(--border);font-size:0.82rem;cursor:pointer;background:var(--bg);color:var(--text);transition:background .15s; }
.rp-tab.active { background:var(--primary);color:#fff;border-color:var(--primary);font-weight:700; }
.rp-grid { display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:16px; }
.rp-label { font-size:0.82rem;font-weight:600;display:block;margin-bottom:6px;color:var(--text); }
.rp-select { width:100%;border:1px solid var(--border);border-radius:8px;padding:8px 10px;font-size:0.85rem;background:var(--bg);color:var(--text); }
.rp-items { max-height:340px;overflow-y:auto;border:1px solid var(--border);border-radius:8px;padding:10px;min-height:80px; }
.rp-item { display:flex;align-items:flex-start;gap:8px;padding:8px 10px;border:1px solid var(--border);border-radius:8px;margin-bottom:6px;transition:background .15s; }
.rp-item:hover { background:var(--surface); }
.rp-item input[type=checkbox] { margin-top:3px;width:15px;height:15px;cursor:pointer; }
/* Reassign confirm modal */
.rcm-overlay { display:none;position:fixed;inset:0;background:rgba(0,0,0,0.45);z-index:9999;align-items:center;justify-content:center; }
.rcm-box { background:var(--bg);border-radius:12px;padding:24px;max-width:480px;width:90%;border:1px solid var(--border); }
.rcm-arrow { display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;font-size:1.4rem;color:var(--muted); }
.rcm-party { text-align:center;padding:10px 16px;background:var(--surface);border-radius:8px;flex:1; }
/* ── Admin Glossary Manager ── */
.dashboard[data-active-view="adminglossary"] > .view[data-view="adminglossary"] { display: block; }
.gl-wrap { max-width:900px; }
.gl-topbar { display:flex;align-items:center;gap:12px;margin-bottom:16px;flex-wrap:wrap; }
.gl-search { flex:1;min-width:200px;padding:8px 12px;border:1.5px solid var(--border);border-radius:8px;font-size:0.85rem;background:var(--surface);color:var(--text); }
.gl-search:focus { outline:none;border-color:var(--primary); }
.gl-table { width:100%;border-collapse:collapse;font-size:0.82rem; }
.gl-table th { text-align:left;padding:8px 12px;background:var(--surface);border-bottom:2px solid var(--border);font-size:0.72rem;text-transform:uppercase;letter-spacing:0.05em;color:var(--muted);white-space:nowrap; }
.gl-table td { padding:10px 12px;border-bottom:1px solid var(--border);vertical-align:top; }
.gl-table tbody tr:last-child td { border-bottom:none; }
.gl-table tbody tr:hover td { background:var(--surface); }
.gl-key { font-family:monospace;font-size:0.78rem;background:var(--surface);padding:2px 7px;border-radius:4px;border:1px solid var(--border);color:#3949ab; }
.gl-cat { font-size:0.68rem;font-weight:700;padding:2px 8px;border-radius:999px;text-transform:uppercase;letter-spacing:0.04em;white-space:nowrap; }
.gl-cat-tracking  { background:#eff6ff;color:#1e40af;border:1px solid #bfdbfe; }
.gl-cat-finance   { background:#f0fdf4;color:#15803d;border:1px solid #86efac; }
.gl-cat-campaign  { background:#f5f3ff;color:#5b21b6;border:1px solid #ddd6fe; }
.gl-cat-publisher { background:#fff7ed;color:#c2410c;border:1px solid #fed7aa; }
.gl-cat-status    { background:#fffbeb;color:#92400e;border:1px solid #fde68a; }
.gl-cat-roles     { background:#fdf4ff;color:#7e22ce;border:1px solid #e9d5ff; }
.gl-custom-badge  { font-size:0.65rem;font-weight:700;padding:1px 6px;border-radius:4px;background:#dcfce7;color:#15803d;border:1px solid #86efac;margin-left:5px; }
.gl-builtin-badge { font-size:0.65rem;font-weight:700;padding:1px 6px;border-radius:4px;background:var(--bg-subtle);color:#64748b;border:1px solid #e2e8f0;margin-left:5px; }
.gl-def-preview { font-size:0.78rem;color:var(--muted);max-width:280px; }
.gl-form-card { background:var(--card);border:2px solid #c5cae9;border-radius:12px;padding:18px 20px;margin-bottom:16px; }
.gl-form-grid { display:grid;grid-template-columns:1fr 1fr;gap:12px; }
.gl-form-full { grid-column:1 / -1; }
.gl-stat-row { display:flex;gap:10px;margin-bottom:16px;flex-wrap:wrap; }
.gl-stat { background:var(--surface);border:1.5px solid var(--border);border-radius:10px;padding:10px 16px;font-size:0.8rem; }
.gl-stat strong { font-size:1.1rem;color:var(--primary);display:block; }
.gl-stat.gl-stat-custom { background:var(--tint-green-bg);color:var(--tint-green-fg);border-color:#86efac; }
.gl-stat.gl-stat-custom strong { color:#15803d; }
/* ── Glossary Tip Icons ── */
.g-tip-btn { display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;border-radius:50%;background:#e8eaf6;color:#3949ab;font-size:9px;font-weight:700;cursor:pointer;margin-left:5px;vertical-align:middle;border:1.5px solid #c5cae9;flex-shrink:0;line-height:1;user-select:none;font-style:normal; }
.g-tip-btn:hover { background:#c5cae9;transform:scale(1.15); }
.ms-opt-row { display:flex;gap:8px;margin-bottom:10px;flex-wrap:wrap; }
.ms-opt { display:inline-flex;align-items:center;gap:5px;font-size:0.75rem;padding:5px 13px;border-radius:999px;border:1px solid var(--border);background:var(--surface);cursor:pointer;font-weight:600;color:var(--muted);transition:all .15s; }
.ms-opt.sel-active { background:#f0fdf4;color:#15803d;border-color:#86efac; }
.ms-opt.sel-away   { background:#fffbeb;color:#92400e;border-color:#fcd34d; }
.ms-opt.sel-ooo    { background:#fef2f2;color:#991b1b;border-color:#fca5a5; }
/* ── Admin Availability Page ── */
.avail-section { background:var(--card);border:1.5px solid var(--border);border-radius:14px;padding:18px 20px;margin-bottom:16px; }
.avail-section h4 { margin:0 0 14px;font-size:0.9rem;font-weight:700;color:var(--text); }
.avail-global-grid { display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-bottom:12px; }
.avail-member-table { width:100%;border-collapse:collapse;font-size:0.82rem; }
.avail-member-table th { font-size:0.72rem;color:var(--muted);font-weight:700;padding:0 10px 8px;text-align:left;border-bottom:1.5px solid var(--border); }
.avail-member-table td { padding:9px 10px;border-bottom:1px solid var(--border);vertical-align:middle; }
.avail-member-table tr:last-child td { border-bottom:none; }
.avail-member-table tr:hover td { background:var(--surface); }
.avail-inline-edit { background:var(--tint-violet-bg);color:var(--tint-violet-fg);border:1.5px solid #c4b5fd;border-radius:10px;padding:12px 14px;margin:4px 0 8px;display:none; }
.avail-inline-edit.open { display:block; }
.avail-ie-grid { display:grid;grid-template-columns:1fr 1fr auto;gap:8px;align-items:end; }
.avail-tag { font-size:0.68rem;padding:2px 8px;border-radius:999px;font-weight:700; }
.avail-tag-custom  { background:#ede9fe;color:#7c3aed;border:1px solid #c4b5fd; }
.avail-tag-default { background:var(--surface);color:var(--muted);border:1px solid var(--border); }
/* ── Agency Credentials entity filter pills ── */
.ac-filter-btn { font-size:0.78rem;padding:6px 13px;border:1.5px solid var(--border);border-radius:20px;background:var(--bg);cursor:pointer;font-weight:600;color:var(--text);transition:background .12s,color .12s,border-color .12s; }
.ac-filter-btn.active { background:var(--primary);color:#fff;border-color:var(--primary); }
/* ── My Tasks (Own Tasks) ── */
.ot-card { background:var(--card);border:1.5px solid var(--border);border-radius:12px;margin-bottom:8px;overflow:hidden;transition:box-shadow 0.15s; }
.ot-card:hover { box-shadow:var(--shadow-sm); }
.ot-card.ot-done { opacity:0.6; }
.ot-main { display:flex;align-items:flex-start;gap:10px;padding:12px 14px; }
.ot-chk { width:17px;height:17px;border-radius:5px;border:1.5px solid var(--border);background:var(--surface);cursor:pointer;flex-shrink:0;margin-top:2px;display:flex;align-items:center;justify-content:center;font-size:10px;transition:all .15s; }
.ot-chk.checked { background:#22c55e;border-color:#22c55e;color:#fff; }
.ot-body { flex:1;min-width:0; }
.ot-name { font-size:0.85rem;font-weight:600;color:var(--text);margin-bottom:3px; }
.ot-done .ot-name { text-decoration:line-through;color:var(--muted); }
.ot-note { font-size:0.75rem;color:var(--muted);margin-bottom:4px; }
.ot-meta { display:flex;align-items:center;gap:6px;flex-wrap:wrap; }
.ot-pri { font-size:0.68rem;padding:2px 7px;border-radius:999px;font-weight:700; }
.ot-pri-high { background:#fef2f2;color:#991b1b;border:1px solid #fca5a5; }
.ot-pri-med  { background:#fffbeb;color:#92400e;border:1px solid #fcd34d; }
.ot-pri-low  { background:#f0fdf4;color:#15803d;border:1px solid #86efac; }
.ot-due { font-size:0.72rem;color:var(--muted); }
.ot-due.overdue { color:#dc2626;font-weight:700; }
.ot-snooze-tag { font-size:0.68rem;padding:2px 7px;border-radius:999px;background:#fffbeb;color:#92400e;border:1px solid #fcd34d;font-weight:600; }
.ot-followup-tag { font-size:0.68rem;padding:2px 7px;border-radius:999px;background:#eff6ff;color:#1d4ed8;border:1px solid #93c5fd;font-weight:600; }
.ot-actions { display:flex;gap:4px;flex-shrink:0;align-items:flex-start;margin-top:1px; }
.ot-act-btn { font-size:0.7rem;padding:3px 9px;border-radius:999px;border:1px solid var(--border);background:var(--surface);color:var(--muted);cursor:pointer;font-weight:600;white-space:nowrap;transition:all .12s; }
.ot-act-btn:hover { border-color:var(--primary);color:var(--primary); }
.ot-act-btn.snooze-on { background:#fffbeb;color:#92400e;border-color:#fcd34d; }
.ot-act-btn.followup-on { background:#eff6ff;color:#1d4ed8;border-color:#93c5fd; }
.ot-act-del { font-size:0.78rem;padding:3px 6px;border-radius:999px;border:none;background:transparent;color:var(--muted);cursor:pointer;transition:color .12s; }
.ot-act-del:hover { color:#dc2626; }
.ot-sub-panel { border-top:1px solid var(--border);padding:10px 14px;background:var(--surface);display:none; }
.ot-sub-panel.open { display:block; }
.ot-sub-title { font-size:0.72rem;font-weight:700;color:var(--muted);margin-bottom:7px; }
.ot-chip-row { display:flex;gap:6px;flex-wrap:wrap;margin-bottom:7px; }
.ot-chip { font-size:0.7rem;padding:3px 10px;border-radius:999px;border:1px solid var(--border);background:var(--card);color:var(--muted);cursor:pointer;font-weight:600;transition:all .1s; }
.ot-chip.sel-snooze  { background:#fffbeb;color:#92400e;border-color:#fcd34d; }
.ot-chip.sel-followup{ background:#eff6ff;color:#1d4ed8;border-color:#93c5fd; }
.ot-sub-custom { display:flex;align-items:center;gap:6px;flex-wrap:wrap; }
.ot-attn-banner { border-radius:10px;padding:10px 13px;margin-bottom:10px;border:1px solid; }
.ot-attn-banner.attn-followup { background:var(--tint-blue-bg);color:var(--tint-blue-fg);border-color:#93c5fd; }
.ot-attn-banner.attn-snooze   { background:var(--tint-green-bg);color:var(--tint-green-fg);border-color:#86efac; }
.ot-attn-title { font-size:0.75rem;font-weight:700;margin-bottom:6px; }
.ot-attn-row { display:flex;align-items:center;justify-content:space-between;padding:4px 0;border-bottom:1px solid rgba(0,0,0,.06);gap:8px; }
.ot-attn-row:last-child { border-bottom:none; }
.ot-attn-name { font-size:0.8rem;color:var(--text);flex:1;min-width:0; }
.ot-attn-lbl { font-size:0.68rem;padding:2px 7px;border-radius:999px;font-weight:700;white-space:nowrap; }
.ot-lbl-today   { background:#eff6ff;color:#1d4ed8;border:1px solid #93c5fd; }
.ot-lbl-overdue { background:#fef2f2;color:#991b1b;border:1px solid #fca5a5; }
.ot-lbl-back    { background:#f0fdf4;color:#15803d;border:1px solid #86efac; }
.ot-filter-row { display:flex;gap:6px;flex-wrap:wrap;margin-bottom:12px; }
.ot-filter { font-size:0.72rem;padding:4px 12px;border-radius:999px;border:1px solid var(--border);background:var(--surface);color:var(--muted);cursor:pointer;font-weight:600;transition:all .12s; }
.ot-filter.active { background:var(--primary);color:#fff;border-color:var(--primary); }
.ot-add-form { background:var(--card);border:1.5px solid var(--border);border-radius:12px;padding:14px 16px;margin-bottom:14px; }
.ot-form-grid { display:grid;grid-template-columns:1fr auto auto;gap:8px;align-items:end;margin-bottom:8px; }
.ot-form-row2 { display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:8px; }
.ot-section-head { font-size:0.72rem;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:0.05em;margin:14px 0 8px; }
.ot-empty { text-align:center;padding:32px 16px;color:var(--muted);font-size:0.82rem; }
/* ── Daily Sales Tracker ────────────────────── */
.dt-wrap { font-family:inherit; }
.dt-month-tabs { display:flex;gap:6px;flex-wrap:wrap;margin-bottom:16px; }
.dt-tab { padding:5px 14px;border-radius:20px;border:1.5px solid var(--border);background:var(--surface);font-size:0.78rem;font-weight:600;cursor:pointer;color:var(--muted);transition:all 0.15s; }
.dt-tab.active { background:#6366f1;color:#fff;border-color:#6366f1; }
.dt-stats { display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:18px; }
.dt-stat { background:var(--card);border:1.5px solid var(--border);border-radius:10px;padding:12px 14px; }
.dt-stat-n { font-size:1.35rem;font-weight:800;color:var(--text); }
.dt-stat-l { font-size:0.72rem;color:var(--muted);font-weight:600;text-transform:uppercase;letter-spacing:0.04em;margin-top:2px; }
.dt-filter-row { display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-bottom:14px; }
.dt-filter-row select { font-size:0.8rem;padding:5px 10px;border:1.5px solid var(--border);border-radius:8px;background:var(--surface); }
/* Search inputs in the tracker filter row. Matched to the select rule above
 * (same font-size, padding, radius, border and background) so the row reads as
 * one control strip rather than two mismatched kinds — the same alignment
 * defect that was reported on the Publisher Summary filter row. */
.dt-filter-row input.dt-filter-input { font-size:0.8rem;padding:5px 10px;border:1.5px solid var(--border);border-radius:8px;background:var(--surface);color:var(--text);font-family:inherit;min-width:170px;box-sizing:border-box;line-height:normal; }
.dt-export-btn { margin-left:auto;padding:5px 14px;border-radius:8px;border:1.5px solid #6366f1;background:#ede9fe;color:#4f46e5;font-size:0.78rem;font-weight:700;cursor:pointer; }
.dt-grid-scroll { overflow-x:auto;border-radius:12px;border:1.5px solid var(--border);background:var(--card); }
.dt-table { border-collapse:collapse;min-width:100%;font-size:0.78rem; }
.dt-table th { background:var(--bg);padding:7px 8px;text-align:center;border-bottom:1.5px solid var(--border);border-right:1px solid var(--border);font-weight:700;font-size:0.72rem;color:var(--muted);white-space:nowrap;position:sticky;top:0;z-index:2; }
.dt-table th.dt-th-campaign { text-align:left;min-width:200px;max-width:220px;position:sticky;left:0;z-index:3;background:var(--bg); }
.dt-table td { padding:6px 8px;text-align:center;border-bottom:1px solid var(--border);border-right:1px solid var(--border);vertical-align:middle; }
.dt-table td.dt-td-campaign { text-align:left;background:var(--card);position:sticky;left:0;z-index:1;min-width:200px;max-width:220px;padding:6px 10px; }
.dt-table tr:last-child td { border-bottom:none; }
.dt-table td:last-child, .dt-table th:last-child { border-right:none; }
.dt-day-cell { width:36px;min-width:36px; }
.dt-day-today { background:var(--tint-violet-bg);color:var(--tint-violet-fg) !important; }
.dt-day-input { width:34px;text-align:center;border:1px solid #c4b5fd;border-radius:5px;padding:2px 3px;font-size:0.77rem;background:var(--surface);outline:none; }
.dt-day-input:focus { border-color:#6366f1;box-shadow:0 0 0 2px #ede9fe; }
.dt-cell-readonly { color:var(--muted);font-size:0.77rem; }
.dt-summary-cell { background:var(--tint-blue-bg);color:var(--tint-blue-fg);font-weight:700; }
.dt-summary-input { width:70px;text-align:center;border:1px solid #c4b5fd;border-radius:5px;padding:3px 5px;font-size:0.77rem;background:var(--surface);outline:none; }
.dt-summary-input:focus { border-color:#6366f1;box-shadow:0 0 0 2px #ede9fe; }
.dt-total-col { background:#faf5ff;font-weight:700;color:#6d28d9; }
.dt-campaign-name { font-weight:600;color:var(--text);font-size:0.8rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:180px; }
.dt-campaign-meta { font-size:0.68rem;color:var(--muted); }
.dt-empty { text-align:center;padding:40px 20px;color:var(--muted);font-size:0.85rem; }
.dt-visibility-grid { display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:10px; }
.dt-vis-card { background:var(--card);border:1.5px solid var(--border);border-radius:10px;padding:12px 14px; }
.dt-vis-card h4 { margin:0 0 8px;font-size:0.85rem;color:var(--text); }
.dt-vis-item { display:flex;align-items:center;gap:8px;padding:4px 0;font-size:0.8rem; }
.ttask-card { background:var(--card);border:1.5px solid var(--border);border-radius:12px;padding:14px 16px;margin-bottom:10px;transition:box-shadow 0.15s; }
.ttask-card:hover { box-shadow:var(--shadow-sm); }
.ttask-card.ttask-pending  { border-left:4px solid #f59e0b; }
.ttask-card.ttask-active   { border-left:4px solid #6366f1; }
.ttask-card.ttask-completed{ border-left:4px solid #22c55e;opacity:0.78; }
.ttask-card.ttask-declined { border-left:4px solid #ef4444;opacity:0.72; }
.ttask-badge { display:inline-flex;align-items:center;gap:3px;font-size:0.68rem;font-weight:700;border-radius:20px;padding:2px 9px;border:1.5px solid; }
.ttask-b-pending  { background:#fef3c7;color:#92400e;border-color:#fde68a; }
.ttask-b-active   { background:#ede9fe;color:#5b21b6;border-color:#c4b5fd; }
.ttask-b-completed{ background:#dcfce7;color:#15803d;border-color:#bbf7d0; }
.ttask-b-declined { background:#fee2e2;color:#dc2626;border-color:#fecaca; }
.ttask-pri-High   { background:#fee2e2;color:#dc2626;border-color:#fecaca; }
.ttask-pri-Medium { background:#fef3c7;color:#92400e;border-color:#fde68a; }
.ttask-pri-Low    { background:#f0fdf4;color:#15803d;border-color:#bbf7d0; }
.ttask-subtab { display:flex;gap:6px;flex-wrap:wrap;margin-bottom:16px; }
.ttask-subtab-btn { font-size:0.8rem;font-weight:700;padding:6px 16px;border-radius:20px;border:1.5px solid var(--border);background:var(--bg);color:var(--muted);cursor:pointer;transition:all 0.15s; }
.ttask-subtab-btn.active { background:var(--primary);color:#fff;border-color:var(--primary); }
.ttask-subtab-btn .badge { background:rgba(255,255,255,0.25);color:inherit;font-size:0.68rem;padding:1px 6px;border-radius:99px;margin-left:4px; }
.ttask-subtab-btn:not(.active) .badge { background:var(--primary-light);color:var(--primary); }

/* ── Notification System ── */
.notif-bell-btn { position:relative;background:none;border:1.5px solid var(--border);border-radius:10px;padding:6px 10px;cursor:pointer;font-size:1.05rem;color:var(--text);transition:all 0.15s;display:flex;align-items:center;gap:5px; }
.notif-bell-btn:hover { background:var(--primary-light);border-color:var(--primary);color:var(--primary); }
.notif-bell-count { position:absolute;top:-6px;right:-6px;background:#ef4444;color:#fff;font-size:0.62rem;font-weight:800;border-radius:99px;padding:1px 5px;min-width:16px;text-align:center;border:2px solid #fff;line-height:1.4; }
.notif-panel { position:fixed;top:0;right:-380px;width:370px;height:100vh;background:var(--card);border-left:1.5px solid var(--border);box-shadow:-6px 0 24px rgba(0,0,0,0.13);z-index:1100;transition:right 0.28s cubic-bezier(.4,0,.2,1);display:flex;flex-direction:column; }
.notif-panel.open { right:0; }
.notif-panel-head { padding:16px 18px;border-bottom:1.5px solid var(--border);display:flex;align-items:center;justify-content:space-between;flex-shrink:0; }
.notif-panel-head h3 { font-size:0.95rem;font-weight:800;margin:0; }
.notif-panel-body { flex:1;overflow-y:auto;padding:12px; }
.notif-card { background:var(--bg);border:1.5px solid var(--border);border-radius:12px;padding:12px 14px;margin-bottom:9px;transition:box-shadow 0.15s, opacity 0.25s; }
.notif-card.unread { border-left:4px solid var(--primary);background:var(--primary-light); }
.notif-card.snoozed { opacity:0.6; }
.notif-card-title { font-size:0.84rem;font-weight:700;color:var(--text);margin-bottom:3px; }
.notif-card-body  { font-size:0.78rem;color:var(--muted);margin-bottom:8px;line-height:1.45; }
.notif-card-time  { font-size:0.7rem;color:var(--muted);margin-bottom:8px; }
.notif-card-actions { display:flex;gap:5px;flex-wrap:wrap; }
/* A notification that can navigate: the whole card is a target, and the
   destination is named above the buttons so a click is never a surprise. */
.notif-card.linkable { cursor:pointer; }
.notif-card.linkable:hover { box-shadow:0 0 0 3px rgba(99,102,241,.12); border-color:var(--primary); }
.notif-dest { font-size:0.7rem;color:var(--muted);margin-bottom:7px; }
.notif-dest b { color:var(--text-soft);font-weight:700; }
.notif-act-btn.go-btn { border-color:var(--primary);color:#fff;background:var(--primary); }
.notif-act-btn.go-btn:hover { background:var(--primary-darker);color:#fff; }
.notif-act-btn { font-size:0.72rem;font-weight:700;padding:3px 10px;border-radius:20px;border:1.5px solid var(--border);background:var(--card);color:var(--text);cursor:pointer;transition:all 0.12s; }
.notif-act-btn:hover { border-color:var(--primary);color:var(--primary); }
.notif-act-btn.read-btn  { border-color:#22c55e;color:#15803d;background:#f0fdf4; }
.notif-act-btn.read-btn:hover { background:#dcfce7; }
.notif-act-btn.snooze-btn{ border-color:#f59e0b;color:#92400e;background:#fffbeb; }
.notif-act-btn.followup-btn{ border-color:#6366f1;color:#4338ca;background:#ede9fe; }
.notif-panel-backdrop { position:fixed;inset:0;background:rgba(0,0,0,0.18);z-index:1099;display:none; }
.notif-panel-backdrop.open { display:block; }
/* Snooze/followup time picker popup */
.notif-time-picker { position:fixed;inset:0;display:flex;align-items:center;justify-content:center;z-index:1200;background:rgba(0,0,0,0.35); }
.notif-time-picker-box { background:var(--card);border-radius:16px;padding:22px 24px;min-width:300px;box-shadow:var(--shadow); }
.notif-time-picker-box h4 { font-size:0.9rem;font-weight:800;margin:0 0 14px; }
.notif-time-opt { display:flex;gap:8px;flex-wrap:wrap;margin-bottom:14px; }
.notif-time-opt button { font-size:0.8rem;font-weight:700;padding:6px 14px;border-radius:20px;border:1.5px solid var(--border);background:var(--bg);color:var(--text);cursor:pointer;transition:all 0.12s; }
.notif-time-opt button:hover { border-color:var(--primary);color:var(--primary);background:var(--primary-light); }
.notif-custom-row { display:flex;gap:8px;align-items:center;margin-bottom:14px; }
.notif-custom-row input[type="datetime-local"] { flex:1;padding:6px 10px;border:1.5px solid var(--border);border-radius:8px;font-size:0.8rem; }

/* ── Analytics Charts ── */
.ana-section { margin-bottom:28px; }
.ana-section-title { font-size:0.78rem;font-weight:800;text-transform:uppercase;letter-spacing:0.06em;color:var(--muted);margin-bottom:12px;padding-bottom:7px;border-bottom:1.5px solid var(--border); }
.ana-range-toggle { display:flex;gap:4px; }
.ana-range-btn { border:1.5px solid var(--border);background:var(--bg);color:var(--muted);border-radius:8px;padding:5px 14px;font-size:0.78rem;font-weight:700;cursor:pointer;transition:all 0.15s; }
.ana-range-btn.active { background:var(--primary);color:#fff;border-color:var(--primary); }
.ana-range-btn:hover:not(.active) { border-color:var(--primary);color:var(--primary); }
.ana-chart-wrap { overflow-x:auto; }
.ana-legend { display:flex;flex-wrap:wrap;gap:8px;margin-top:10px; }
.ana-legend-item { display:flex;align-items:center;gap:5px;font-size:0.74rem;color:var(--text);font-weight:600; }
.ana-legend-dot { width:10px;height:10px;border-radius:3px;flex-shrink:0; }
.ana-empty { padding:40px 20px;text-align:center;color:var(--muted);font-size:0.85rem;line-height:1.7; }
.ana-tab-btn { font-size:0.8rem;font-weight:700;padding:5px 14px;border:1.5px solid var(--border);border-radius:8px;background:var(--bg);color:var(--muted);cursor:pointer;transition:all 0.15s; }
.ana-tab-btn.active { background:var(--primary);color:#fff;border-color:var(--primary); }
.ana-tab-btn:hover:not(.active) { border-color:var(--primary);color:var(--primary); }

/* ═══════════ CAMPAIGN FORM TWO-COLUMN ═══════════ */
#assignModal .modal { max-width: 860px; }
.assign-modal-inner { display: flex; gap: 0; }
.assign-form-left { flex: 1; min-width: 0; padding-right: 24px; border-right: 1.5px solid var(--border); }
.assign-form-right { width: 240px; flex-shrink: 0; padding-left: 24px; }
.assign-preview-panel { position: sticky; top: 0; }

/* ═══════════ FIXED-SHELL CAMPAIGN MODAL ═══════════
   Fixed header + footer + preview; only the left form column scrolls. */
.modal.campaign-modal-shell {
        padding: 0; overflow: hidden; max-height: 90vh;
        display: flex; flex-direction: column;
}
.campaign-modal-shell .cm-header {
        flex-shrink: 0; padding: 22px 30px 16px;
        border-bottom: 1.5px solid var(--border);
        display: flex; align-items: center; justify-content: space-between;
        background: var(--surface);
}
.campaign-modal-shell .cm-header h3 { margin: 0; }
/* Fixed step-indicator bar, directly below the header. */
.campaign-modal-shell .cm-steps {
        flex-shrink: 0; padding: 14px 30px 0;
        border-bottom: 1.5px solid var(--border);
        background: var(--surface);
}
.campaign-modal-shell .cm-steps .tw-steps { margin-bottom: 14px; }
/* The middle region flexes to fill and manages the scroll internally. */
.campaign-modal-shell .assign-modal-inner {
        flex: 1; min-height: 0; padding: 0 30px;
        overflow: hidden; align-items: stretch;
}
/* Only the left form column scrolls. */
.campaign-modal-shell .assign-form-left {
        overflow-y: auto; overflow-x: hidden; padding: 20px 24px 20px 0;
}
/* Preview column is fixed (does not scroll with the form). */
.campaign-modal-shell .assign-form-right {
        overflow: hidden; padding: 20px 0 20px 24px;
}
.campaign-modal-shell .assign-preview-panel { position: static; }
.campaign-modal-shell .cm-footer {
        flex-shrink: 0; padding: 16px 30px; margin: 0;
        border-top: 1.5px solid var(--border);
        display: flex; gap: 10px; align-items: center;
        background: var(--surface);
}
@media (max-width: 720px) {
        .campaign-modal-shell .assign-modal-inner { flex-direction: column; overflow-y: auto; }
        .campaign-modal-shell .assign-form-left { overflow: visible; border-right: none; }
        .campaign-modal-shell .assign-form-right { overflow: visible; }
}
.assign-preview-title { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1.5px solid var(--border); }
.assign-preview-card { background: var(--bg); border: 1.5px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.assign-preview-name { font-size: 0.95rem; font-weight: 800; color: var(--text); margin-bottom: 6px; min-height: 1.2em; word-break: break-word; line-height: 1.35; }
.assign-preview-sub { font-size: 0.78rem; color: var(--muted); margin-bottom: 2px; }
.assign-preview-sub strong { color: var(--text); font-weight: 600; }
.assign-preview-badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.assign-preview-sep { height: 1px; background: var(--border); margin: 10px 0; }
.assign-preview-empty { font-size: 0.8rem; color: var(--faint); font-style: italic; text-align: center; padding: 28px 10px; line-height: 1.6; }
.assign-preview-members { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.assign-preview-member-chip { font-size: 0.72rem; font-weight: 600; background: var(--primary-light); color: var(--primary); border-radius: 6px; padding: 2px 8px; }
@media (max-width: 720px) {
        #assignModal .modal { max-width: 100%; }
        .assign-modal-inner { flex-direction: column; }
        .assign-form-left { padding-right: 0; border-right: none; border-bottom: 1.5px solid var(--border); padding-bottom: 18px; margin-bottom: 16px; }
        .assign-form-right { width: 100%; padding-left: 0; }
}

/* ── Client Health Badges ── */
.health-badge { display:inline-flex;align-items:center;gap:3px;font-size:0.7rem;font-weight:700;border-radius:20px;padding:2px 9px;border:1.5px solid; }
.health-green { background:#dcfce7;color:#15803d;border-color:#bbf7d0; }
.health-risk  { background:#fef9c3;color:#92400e;border-color:#fde68a; }
.health-red   { background:#fee2e2;color:#dc2626;border-color:#fecaca; }
.health-none  { background:#f3f4f6;color:#6b7280;border-color:#e5e7eb; }
.health-btn   { font-size:0.68rem;padding:2px 8px;border:1.5px solid var(--border);border-radius:12px;cursor:pointer;background:var(--bg);color:var(--muted);font-weight:600;transition:all 0.15s; }
.health-btn:hover { border-color:var(--primary);color:var(--primary); }
.health-btn.active-green { background:#dcfce7;color:#15803d;border-color:#bbf7d0; }
.health-btn.active-risk  { background:#fef9c3;color:#92400e;border-color:#fde68a; }
.health-btn.active-red   { background:#fee2e2;color:#dc2626;border-color:#fecaca; }

/* ── Escalation Cards ── */
.esc-card { background:var(--card);border:1.5px solid var(--border);border-radius:12px;padding:14px 16px;margin-bottom:10px;transition:box-shadow 0.15s; }
.esc-card:hover { box-shadow:var(--shadow-sm); }
.esc-card.esc-open       { border-left:4px solid #ef4444; }
.esc-card.esc-inprogress { border-left:4px solid #f59e0b; }
.esc-card.esc-resolved   { border-left:4px solid #22c55e;opacity:0.72; }
.esc-pill { border-radius:8px;font-size:0.68rem;font-weight:700;padding:2px 8px;border:1.5px solid; }
.esc-p-high { background:#fee2e2;color:#dc2626;border-color:#fecaca; }
.esc-p-med  { background:#fef3c7;color:#92400e;border-color:#fde68a; }
.esc-p-low  { background:#f0fdf4;color:#15803d;border-color:#bbf7d0; }
.esc-s-open { background:#fee2e2;color:#dc2626;border-color:#fecaca; }
.esc-s-inp  { background:#fef3c7;color:#92400e;border-color:#fde68a; }
.esc-s-res  { background:#f0fdf4;color:#15803d;border-color:#bbf7d0; }

/* ── Renewal Tracker Cards ── */
.renewal-card { background:var(--card);border:1.5px solid var(--border);border-radius:12px;padding:14px 16px;margin-bottom:10px; }
.renewal-stage-row { display:flex;gap:5px;flex-wrap:wrap;margin-top:8px; }
.rsb { font-size:0.7rem;padding:3px 10px;border:1.5px solid var(--border);border-radius:20px;cursor:pointer;background:var(--bg);color:var(--text);font-weight:600;transition:all 0.15s; }
.rsb:hover { border-color:var(--primary);color:var(--primary); }
.rsb.rsb-active { background:var(--primary);color:#fff;border-color:var(--primary); }
.rsb.rsb-renewed { background:#dcfce7;color:#15803d;border-color:#bbf7d0; }
.rsb.rsb-churned { background:#fee2e2;color:#dc2626;border-color:#fecaca; }

/* ── AdOps Discrepancy Cards ── */
.disc-card { background:var(--card);border:1.5px solid var(--border);border-radius:12px;padding:14px 16px;margin-bottom:10px; }
.disc-card.disc-open     { border-left:4px solid #ef4444; }
.disc-card.disc-resolved { border-left:4px solid #22c55e;opacity:0.72; }
.gap-high { color:#dc2626;font-weight:700; }
.gap-med  { color:#f59e0b;font-weight:700; }
.gap-low  { color:#22c55e;font-weight:700; }

/* ── AdOps Campaign Queue ── */
.ao-queue-card { background:var(--card);border:1.5px solid var(--border);border-radius:12px;padding:14px 16px;margin-bottom:10px;display:flex;align-items:flex-start;gap:12px; }
.ao-queue-card:hover { box-shadow:var(--shadow-sm); }
.ao-cl-progress { height:5px;border-radius:3px;background:var(--border);overflow:hidden;margin-top:5px;min-width:80px; }
.ao-cl-bar { height:100%;border-radius:3px;background:var(--primary);transition:width 0.3s; }

/* ── Trafficking Checklist (modal) ── */
.cl-row { display:flex;align-items:center;gap:10px;padding:9px 0;border-bottom:1px solid var(--border); }
.cl-row:last-child { border-bottom:none; }
.cl-cb { width:17px;height:17px;accent-color:var(--primary);cursor:pointer;flex-shrink:0; }
.cl-lbl { font-size:0.87rem;flex:1; }
.cl-lbl.done { text-decoration:line-through;color:var(--muted); }

/* Team member roster cards */
.tm-card { background:var(--card); border:1.5px solid var(--border); border-radius:14px; padding:16px 18px; margin-bottom:10px; display:flex; align-items:center; gap:14px; cursor:pointer; transition:all 0.18s var(--ease); }
.tm-card:hover { border-color:var(--primary); box-shadow:var(--shadow-md); transform:translateY(-1px); }
.tm-card.active { border-color:var(--primary); background:var(--primary-light); }
.tm-avatar { width:44px; height:44px; border-radius:50%; background:linear-gradient(135deg,var(--primary),#818cf8); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:1rem; flex-shrink:0; }
.tm-info { flex:1; min-width:0; }
.tm-name { font-weight:700; font-size:0.92rem; color:var(--text); }
.tm-role { font-size:0.72rem; color:var(--muted); margin-top:2px; }
.tm-chips { display:flex; gap:6px; flex-wrap:wrap; margin-left:auto; }
.tm-chip { font-size:0.7rem; font-weight:700; padding:3px 10px; border-radius:999px; border:1px solid transparent; white-space:nowrap; }
.tm-chip-blue  { background:#eff6ff; color:#1d4ed8; border-color:#bfdbfe; }
.tm-chip-green { background:#f0fdf4; color:#15803d; border-color:#bbf7d0; }
.tm-chip-red   { background:#fff1f2; color:#dc2626; border-color:#fecaca; }
.tm-chip-amber { background:#fffbeb; color:#92400e; border-color:#fde68a; }
.tm-chip-purple{ background:#faf5ff; color:#7c3aed; border-color:#ddd6fe; }

/* ── Hierarchy tree (org-chart style — Concept 1: Classic Connected
   Lines, chosen after reviewing 3 concepts) ─────────────────────────
   Signature element: real tree connectors (elbow + vertical spine) so
   parent -> child is legible at a glance, not just implied by padding.
   Uses a continuous border-left spine (robust at any nesting depth)
   rather than trying to trim the line exactly at the last child, which
   is fragile with recursive markup and prone to rendering gaps.
   Everything else reuses the app's existing tokens/tm-card language so
   it reads as native, not a bolted-on component.

   Tuned for 50+ members / 4-5 levels deep (today's org is 15-20, but
   built to scale):
     - Indentation tightened (was 37px/level, now 32px/level) so deep
       chains eat less horizontal space.
     - Per-node collapse/expand + Expand-all/Collapse-all so a large,
       fully-expanded tree doesn't force a lot of vertical scrolling —
       branches below depth 1 auto-collapse once the org passes 25
       members (see defaultCollapsedFor in renderHierarchyTree); today's
       15-20-person tree is unaffected and stays fully expanded.
     - Cards flex-wrap and names truncate with a title tooltip, so a
       long name + full badge set never forces HORIZONTAL scrolling
       even at depth 5 on a narrower screen — the row wraps instead. */
.hier-node { position:relative; }
.hier-children {
        position:relative; margin-left:14px; padding-left:18px;
        border-left:1.5px solid var(--border-strong);
}
/* Elbow + junction dot connecting the spine to each child card. Scoped
   to `.hier-children > .hier-node` (i.e. NOT bare top-level roots) —
   roots aren't nested inside a `.hier-children` spine, so giving them
   the same pseudo-elements would draw a disconnected stub line with
   nothing to its left. Only non-root nodes get it. 32px aligns with
   the (now-32px) avatar's vertical center: 6px card margin + 1.5px
   border + 9px padding + half of 32px avatar. */
.hier-children > .hier-node::before {
        content:''; position:absolute; left:-18px; top:32px; width:18px; height:1.5px;
        background:var(--border-strong);
}
.hier-children > .hier-node::after {
        content:''; position:absolute; left:-21px; top:28px; width:7px; height:7px;
        border-radius:50%; background:var(--primary); border:2px solid #fff;
        box-shadow:0 0 0 1px var(--border-strong);
}
.hier-children > .hier-node.is-senior-node::after { background:#7c3aed; }
.hier-card {
        display:flex; align-items:center; gap:9px; background:var(--card);
        border:1.5px solid var(--border); border-radius:var(--radius);
        padding:9px 13px; margin:6px 0; transition:all 0.16s var(--ease);
        flex-wrap:wrap; row-gap:8px;
}
.hier-card:hover { border-color:var(--primary); box-shadow:var(--shadow-sm); }
.hier-card.is-senior { border-color:#ddd6fe; background:linear-gradient(135deg,#fff,#fdfaff); }
.hier-card.is-root { border-color:var(--border-strong); }
/* Collapse/expand toggle — only present on nodes with children (a
   spacer of the same width keeps every card's content left-aligned
   whether or not it has one, so the tree doesn't zig-zag). */
.hier-toggle {
        width:18px; height:18px; flex-shrink:0; border:1px solid var(--border-strong);
        border-radius:5px; background:var(--bg-subtle); color:var(--muted);
        font-size:0.6rem; line-height:1; cursor:pointer; display:flex;
        align-items:center; justify-content:center; padding:0; transition:all 0.12s;
}
.hier-toggle:hover { background:var(--primary-light); border-color:var(--primary); color:var(--primary); }
.hier-toggle-spacer { width:18px; flex-shrink:0; }
.hier-avatar {
        width:32px; height:32px; border-radius:50%; flex-shrink:0;
        display:flex; align-items:center; justify-content:center;
        font-weight:800; font-size:0.74rem; color:#fff;
        background:linear-gradient(135deg,var(--primary),#818cf8);
}
.hier-card.is-senior .hier-avatar { background:linear-gradient(135deg,#7c3aed,#c026d3); }
.hier-body { display:flex; flex-direction:column; gap:3px; min-width:0; flex:1 1 160px; }
.hier-name {
        font-weight:700; font-size:0.86rem; color:var(--text); line-height:1.2;
        white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:flex; align-items:center; gap:6px;
}
.hier-kidcount {
        font-size:0.62rem; font-weight:700; color:var(--muted); background:var(--bg-subtle);
        border-radius:999px; padding:0px 6px; flex-shrink:0;
}
.hier-badges { display:flex; gap:5px; flex-wrap:wrap; }
.hier-badge {
        font-size:0.64rem; font-weight:800; letter-spacing:0.02em; text-transform:uppercase;
        padding:2px 8px; border-radius:999px; border:1px solid transparent; white-space:nowrap;
}
.hier-badge-senior { background:#faf5ff; color:#7c3aed; border-color:#ddd6fe; }
.hier-badge-role   { background:var(--bg-subtle); color:var(--text-soft); border-color:var(--border); }
/* Team Lead add-on — a distinct amber/gold tone (leadership STATUS, not
   a role) so it reads apart from both the purple senior badges and the
   gray operational-role badges at a glance. */
.hier-badge-tl { background:#fffbeb; color:#b45309; border-color:#fde68a; }
.hier-select-wrap { margin-left:auto; display:flex; align-items:center; gap:6px; flex-shrink:0; }
.hier-select-label { font-size:0.66rem; color:var(--faint); text-transform:uppercase; letter-spacing:0.03em; white-space:nowrap; }
.hier-select {
        font-size:0.76rem; padding:5px 9px; border:1.5px solid var(--border); border-radius:8px;
        background:var(--surface); color:var(--text); max-width:170px; transition:border-color 0.15s;
}
.hier-select:hover { border-color:var(--border-strong); }
.hier-select:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 3px var(--ring); }
/* Locked "Top of tree" indicator — replaces the editable dropdown for
   Senior/Leadership members (nothing to select: they structurally don't
   report to anyone). Same footprint as .hier-select so the row layout
   doesn't jump between senior and non-senior cards. */
.hier-locked {
        display:flex; align-items:center; gap:6px; font-size:0.72rem; font-weight:700;
        color:var(--faint); background:var(--bg-subtle); border:1.5px dashed var(--border-strong);
        border-radius:8px; padding:5px 11px; white-space:nowrap; cursor:default;
}
.hier-lock-ico { font-size:0.72rem; opacity:0.7; }

/* Dedicated full-page Hierarchy view header */
.hier-page-head {
        display:flex; align-items:flex-start; justify-content:space-between; gap:20px;
        flex-wrap:wrap; margin-bottom:20px; padding-bottom:16px; border-bottom:1px solid var(--border);
}
.hier-page-title { font-size:1.15rem; font-weight:800; color:var(--text); }
.hier-page-sub { font-size:0.82rem; color:var(--muted); margin-top:4px; max-width:520px; }
.hier-page-stats { display:flex; gap:18px; flex-shrink:0; }
.hier-page-stats span { font-size:0.78rem; color:var(--muted); }
.hier-page-stats b { font-size:1rem; color:var(--text); font-weight:800; margin-right:3px; }
.hier-bulk-btn {
        font-size:0.72rem; font-weight:700; color:var(--primary); background:var(--primary-light);
        border:1px solid var(--primary); border-radius:7px; padding:5px 11px; cursor:pointer;
        transition:opacity 0.12s;
}
.hier-bulk-btn:hover { opacity:0.85; }
/* Collapsed branch — hidden, not removed, so state round-trips cleanly
   on the next toggle without re-fetching anything. */
.hier-children.is-collapsed { display:none; }
/* Safety net only (not the primary strategy — that's the tightened
   indentation + flex-wrap cards above): if an unusually deep chain on a
   narrow screen still can't fit, the PANEL scrolls horizontally instead
   of breaking the page layout or clipping content silently. */
#adminHierarchyPanel, #hierarchyTreePanel { overflow-x:auto; }

/* Per-member detail panel */
.tmd-header { display:flex; align-items:center; gap:14px; padding:18px 20px; border-bottom:1px solid var(--border); background:linear-gradient(180deg,#fcfcfd,#fafbfc); }
.tmd-back { background:none; border:1.5px solid var(--border); border-radius:8px; padding:6px 14px; cursor:pointer; font-size:0.82rem; font-weight:700; color:var(--muted); transition:all 0.15s; }
.tmd-back:hover { border-color:var(--primary); color:var(--primary); }
.tmd-stats-row { display:grid; grid-template-columns:repeat(auto-fit,minmax(120px,1fr)); gap:10px; padding:16px 20px; border-bottom:1px solid var(--border); background:var(--bg); }
.tmd-stat { background:var(--card); border:1px solid var(--border); border-radius:10px; padding:12px 14px; text-align:center; }
.tmd-stat-n { font-size:1.5rem; font-weight:800; color:var(--primary); line-height:1; }
.tmd-stat-l { font-size:0.68rem; color:var(--muted); font-weight:600; text-transform:uppercase; letter-spacing:0.04em; margin-top:5px; }
.tmd-section { padding:14px 20px; border-bottom:1px solid var(--border); }
.tmd-section-title { font-size:0.82rem; font-weight:800; color:var(--text); margin-bottom:10px; display:flex; align-items:center; gap:6px; }
.tmd-campaign { border:1.5px solid var(--border); border-radius:10px; margin-bottom:8px; overflow:hidden; }
.tmd-camp-head { display:flex; align-items:center; gap:10px; padding:10px 13px; background:var(--bg); cursor:pointer; }
.tmd-camp-body { padding:12px 14px; border-top:1px solid var(--border); background:var(--card); display:none; }
.tmd-camp-body.open { display:block; }
.tmd-pid-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; padding:5px 0; border-bottom:1px solid var(--border); }
.tmd-pid-row:last-child { border-bottom:none; }
.tmd-publisher-pill { font-size:0.72rem; background:#f0fdf4; color:#15803d; border:1px solid #bbf7d0; border-radius:999px; padding:2px 10px; font-weight:700; }
.tmd-empty { color:var(--muted); font-size:0.82rem; font-style:italic; padding:6px 0; }
.tl-perm-label { display:flex; align-items:center; gap:8px; padding:8px 10px; background:var(--card); border:1.5px solid var(--border); border-radius:8px; cursor:pointer; transition:border-color 0.15s; }
.tl-perm-label:hover { border-color:var(--primary); }

/* legacy header inside screens hidden when in shell */
.app-shell .main-area > header { display: none; }

/* ═══════════ LOGIN ═══════════ */
.login-wrap {
        min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
        background:var(--tint-neutral-bg);color:var(--tint-neutral-fg);
        background-image: radial-gradient(#c8d0de 1.2px, transparent 1.2px);
        background-size: 22px 22px;
}
.login-card {
        background:var(--surface); border: 1px solid #dde3ec; border-radius: var(--radius-xl); padding: 40px 38px; width: 100%; max-width: 420px;
        box-shadow: 0 4px 24px rgba(30,40,80,0.10), 0 1.5px 4px rgba(30,40,80,0.06); position: relative; z-index: 1; animation: cardIn 0.45s var(--ease);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(0.988); } to { opacity: 1; transform: none; } }
.login-logo { font-size: 1.7rem; width: 58px; height: 58px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); border-radius: 16px; box-shadow: 0 6px 18px var(--primary-glow); margin: 0 auto 14px; }
.login-card h2 { font-size: 1.55rem; font-weight: 800; margin-bottom: 4px; letter-spacing: -0.03em; text-align: center; }
.login-card > .login-subtitle { color: var(--muted); font-size: 0.88rem; margin-bottom: 22px; text-align: center; }
.login-tab-row { display: flex; background: var(--bg); border: 1.5px solid var(--border); border-radius: 10px; padding: 3px; margin-bottom: 22px; }
.login-tab { flex: 1; padding: 8px 10px; border: none; background: none; border-radius: 7px; font-size: 0.84rem; font-weight: 700; color: var(--muted); cursor: pointer; transition: all 0.18s var(--ease); }
.login-tab.active { background:var(--surface); color: var(--primary); box-shadow: 0 1px 4px rgba(99,102,241,0.13); }

/* ═══════════ FORMS ═══════════ */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 0.72rem; font-weight: 700; margin-bottom: 7px; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.06em; }
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], input[type=time], input[type=url], input[type=search], input[type=tel], select, textarea {
        width: 100%; padding: 11px 14px; border: 1.5px solid var(--border-strong); border-radius: var(--radius);
        font-size: 0.92rem; font-family: inherit; font-weight: 500; line-height: 1.4;
        transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease);
        /* Was hardcoded #fcfcfd. Paired with color:var(--text) that gave light
           text on a near-white field in dark mode — every form input in every
           modal was unreadable. --input-bg flips with the theme. */
        background: var(--input-bg); color: var(--text); -webkit-appearance: none; appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--faint); font-weight: 400; }
input[type=text]:hover, input[type=password]:hover, input[type=email]:hover, input[type=number]:hover,
input[type=date]:hover, input[type=time]:hover, input[type=url]:hover, input[type=search]:hover, input[type=tel]:hover, select:hover, textarea:hover { border-color: #c7ccd3; background:var(--surface); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); background:var(--surface); box-shadow: 0 0 0 4px var(--ring); }
/* The native <select> inside a searchable-dropdown wrap (.ss-wrap) is
   display:none — its own custom "display" button (.ss-display) is what's
   actually visible. It should never show any visual focus/hover effect of
   its own (box-shadow, border, background shift) under any circumstance. */
.ss-wrap select:focus, .ss-wrap select:hover { box-shadow:none; border-color:var(--border); background:transparent; }
select { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
input[type=file] { font-size: 0.85rem; }

/* ═══════════ BUTTONS ═══════════ */
.btn { padding: 10px 18px; border-radius: var(--radius); border: 1px solid transparent; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all 0.18s var(--ease); display: inline-flex; align-items: center; gap: 7px; font-family: inherit; letter-spacing: -0.01em; white-space: nowrap; }
.btn:active { transform: translateY(0.5px) scale(0.99); }
.btn-primary { background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; box-shadow: 0 1px 2px rgba(79,70,229,0.4), 0 4px 12px rgba(99,102,241,0.25); }
.btn-primary:hover { box-shadow: 0 2px 4px rgba(79,70,229,0.45), 0 8px 22px rgba(99,102,241,0.38); transform: translateY(-1px); filter: brightness(1.04); }
.btn-block { width: 100%; justify-content: center; padding: 13px; font-size: 0.95rem; }
.btn-sm { padding: 4px 12px; font-size: 0.75rem; border-radius: 6px; }
.btn-outline { background: var(--surface); color: var(--text-soft); border: 1.5px solid var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); transform: translateY(-1px); }
.btn-ghost-red { background: #fef2f2; color: var(--danger); border: 1.5px solid #fecaca; padding: 7px 11px; font-size: 0.78rem; }
.btn-ghost-red:hover { background:var(--tint-red-bg);color:var(--tint-red-fg); transform: translateY(-1px); }
.logout-btn { background: var(--surface); border: 1.5px solid var(--border-strong); color: var(--text-soft); padding: 8px 16px; border-radius: 10px; cursor: pointer; font-size: 0.85rem; font-weight: 600; transition: all 0.2s; }
.logout-btn:hover { background: var(--bg-subtle); }

.divider { text-align: center; color: var(--faint); font-size: 0.8rem; margin: 22px 0; position: relative; font-weight: 500; }
.divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--border); }
.divider span { padding: 0 14px; position: relative; background: transparent; }

/* ═══════════ DASHBOARD wrapper ═══════════ */
.dashboard { padding: 26px 28px; max-width: 1180px; margin: 0 auto; width: 100%; }

/* ═══════════ STATS ═══════════ */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { background: var(--card); border-radius: var(--radius-lg); padding: 20px 22px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); position: relative; overflow: hidden; transition: all 0.2s var(--ease); }
.stat::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--primary); }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat.stat-static { cursor: default; pointer-events: none; }
.stat.stat-static:hover { transform: none; box-shadow: var(--shadow-sm); }
.stat.s-blue::before { background: var(--inprogress); }
.stat.s-green::before { background: var(--done); }
.stat.s-red::before { background: var(--danger); }
.stat-n { font-size: 2rem; font-weight: 800; color: var(--primary); line-height: 1; letter-spacing: -0.03em; }
.stat.s-blue .stat-n { color: var(--inprogress); }
.stat.s-green .stat-n { color: var(--done); }
.stat.s-red .stat-n { color: var(--danger); }
.stat-l { font-size: 0.74rem; color: var(--muted); margin-top: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

/* ═══════════ CARD ═══════════ */
.card { background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); margin-bottom: 20px; overflow: hidden; border: 1px solid var(--border); transition: box-shadow 0.2s var(--ease); }
.card:hover { box-shadow: var(--shadow-md); }
.card-head { padding: 17px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; background: linear-gradient(180deg, #fcfcfd, #fafbfc); }
.card-head h3 { font-size: 0.98rem; font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 22px; }

/* ═══════════ FILTERS ═══════════ */
.filters { display: inline-flex; gap: 4px; flex-wrap: wrap; padding: 4px; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 14px; }
.filter-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-label { font-size: 0.68rem; font-weight: 700; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.7; flex-shrink: 0; }
.filter-groups { display: flex; gap: 16px 24px; flex-wrap: wrap; align-items: center; width: 100%; }
.filter-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
@media (max-width: 640px) {
        .filter-groups { gap: 12px; }
        .filter-group { width: 100%; align-items: flex-start; }
        .filter-group .filters { width: 100%; }
        .filter-group .f-btn { flex: 1 1 auto; justify-content: center; }
}
.pri-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.btn-show-more { width: 100%; padding: 9px 14px; border-radius: 10px; border: 1px dashed var(--border-strong); background: var(--bg-subtle); color: var(--text-soft); font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease); font-family: inherit; }
.btn-show-more:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.f-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 15px; border-radius: 10px; border: 1px solid transparent; background: transparent; font-size: 0.8rem; cursor: pointer; font-weight: 600; letter-spacing: -0.01em; transition: background 0.18s var(--ease), color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.12s var(--ease); color: var(--text-soft); line-height: 1; white-space: nowrap; }
.f-btn:hover:not(.active) { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(16,24,40,0.06); }
.f-btn:active { transform: translateY(0.5px); }
.f-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 2px 8px var(--primary-glow), inset 0 1px 0 rgba(255,255,255,0.18); }
.f-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── PID Manager section navigator ─────────────────────────────────────
   Ten sections, one visible at a time.

   The bar used to spill onto three cramped rows, and the cause was not the
   count of tabs — it was the counts themselves. Each tab mirrors its panel's
   badge, and two of those badges are sentences written for a card header:
   "30 requests · showing 28 on page 1 · 21 active here". One tab was as wide
   as four. So the tab now shows the MAGNITUDE only, in a fixed-width well, and
   the full sentence moves to title/aria-label where it is still readable on
   hover and to a screen reader. Width variance collapses to label length,
   which is short and even, and the wells line up into a scoreboard.

   Second move is subtractive: the grey tray is gone. Once each tab has its own
   surface and hairline, ten targets read as ten targets; the tray was only
   boxing in the mess, and in dark it was invisible anyway (--bg-subtle and
   --surface are both #1b1e26). A single bottom rule carries the structure, and
   a short last row on a rule reads as normal rather than as overflow.

   .f-btn stays on the element so this remains the same control language as the
   campaign filters. Every rule below is scoped to .pidmgr-tabs, so no other
   .f-btn in the app moves.

   Type and space (was 0.8rem / 7px 15px / gap 4px):
     label 0.875rem 600 · count 0.75rem 700 tabular · tab min-height 38px
     padding 9px 12px 9px 14px · inner gap 8px · tab gap 6px · radius 10px */
.pidmgr-tabs {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 6px;
    margin: 0 0 18px;
    padding: 0 0 14px;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
}

.pidmgr-tabs .pidmgr-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    max-width: 100%;
    padding: 9px 12px 9px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background-color: var(--surface);
    color: var(--text-soft);
    /* Buttons do not inherit the page face on their own, and app.css has no
       global button font rule — without this the tabs render in the UA font
       beside the app's own headings, which is most of the "bolted on" feeling. */
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.16s var(--ease), color 0.16s var(--ease),
                border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

/* min-width:0 is what actually lets a flex child truncate. Without it the
   label refuses to shrink and the ellipsis never appears. */
.pidmgr-tabs .pidmgr-tab-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Not the inherited .f-btn hover: that sets background:var(--surface), which is
   now the RESTING colour, so it would read as no hover at all. */
.pidmgr-tabs .pidmgr-tab:hover:not(.active) {
    background-color: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: none;
}

/* Exactly one section shows at a time, so the selected tab should be
   unambiguous rather than subtle. Ink stays #fff to match .f-btn.active
   everywhere else in the app — including the two filter pills inside this
   screen's own Change Requests panel, which would otherwise sit next to a
   differently-inked selected tab. */
.pidmgr-tabs .pidmgr-tab.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 1px 2px var(--primary-glow);
}
.pidmgr-tabs .pidmgr-tab.active:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

.pidmgr-tabs .pidmgr-tab:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--ring);
}

/* ── The count well ────────────────────────────────────────────────────
   Fixed min-width + tabular-nums is the point: "0", "14" and "100" occupy the
   same space, so the wells align down the bar instead of ragging.

   max-width is a safety net, not decoration. If a badge ever arrives without a
   leading digit the raw text lands here, and the cap keeps the damage to ~9ch
   instead of letting one tab run 400px wide again.

   Rectangular, not a pill: pill badges elsewhere in this app mean STATUS.
   These are quantities, and the different shape stops them being read as one
   more status chip. */
.pidmgr-tabs .pidmgr-tab-count {
    display: inline-block;
    flex: none;
    min-width: 2.25rem;
    max-width: 9ch;
    height: 20px;
    padding: 0 6px;
    border-radius: 6px;
    background-color: var(--tint-neutral-bg);
    color: var(--tint-neutral-fg);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Reserved, not removed. Three of these tabs fetch on first open and two write
   an empty badge at zero, so wells arrive at different moments; hiding them
   with [hidden] would resize their tab and re-wrap the whole bar mid-session.
   visibility keeps the space and draws nothing. */
.pidmgr-tabs .pidmgr-tab-count[data-empty="1"] { visibility: hidden; }

/* A queue with work waiting should not look like an inventory total. Only the
   tabs that need a decision get this, and only when the number is above zero —
   so "1 awaiting" reads louder than "100 in database", which is the whole
   point of putting counts on a navigator. */
.pidmgr-tabs .pidmgr-tab-count[data-attention="1"] {
    background-color: var(--tint-amber-bg);
    color: var(--tint-amber-fg);
    box-shadow: inset 0 0 0 1px var(--tint-amber-bd);
}
.pidmgr-tabs .pidmgr-tab.active .pidmgr-tab-count {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
    .pidmgr-tabs .pidmgr-tab { transition: none; }
}

.tt-pidtab-off { display: none !important; }

/* ═══════════ TASK FORM ═══════════ */
.task-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.task-grid .full { grid-column: 1 / -1; }
@media(max-width:580px) { .task-grid { grid-template-columns: 1fr; } .task-grid .full { grid-column: 1; } }

/* ═══════════ TASK ITEMS ═══════════ */
.task-item { display: flex; align-items: flex-start; gap: 13px; padding: 15px 16px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 11px; transition: all 0.18s var(--ease); background: var(--card); }
.task-item:hover { border-color: #c7d0fb; box-shadow: 0 4px 14px rgba(99,102,241,0.1); transform: translateY(-1px); }
.task-item.is-done { opacity: 0.6; }
.task-item.is-done:hover { opacity: 0.85; }

/* ── Campaign card — Approach 3: Left-accent Rail ──────────────────
   Scoped class (does NOT touch the shared .task-item used elsewhere).
   A 4px status-colored spine + generous bottom spacing so a tall,
   expanded card (PIDs + links + brief) can never bleed into the next. */

/* The campaign list sits in a .card-body inside a bordered .card panel,
   which makes all the cards look enclosed in one outer box. Adopt the
   Admin pattern: the list container is borderless/transparent so each
   campaign-card is its own isolated unit. Scoped to ONLY the My
   Campaigns panel (the .card that contains #memberTaskList) via :has(),
   so the Publisher Manager's Requested/Approved/Rejected panels — which
   share data-view="campaigns" — keep their own borders. */
#memberTaskList {
        background: transparent !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
}
.card[data-view="campaigns"]:has(> #memberTaskList) {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        overflow: visible !important;
        padding: 0 !important;
}
/* Give this list's filter header back a self-contained surface so it
   doesn't look like a floating strip once the panel border is gone. */
.card[data-view="campaigns"]:has(> #memberTaskList) > .card-head {
        border: 1px solid var(--border) !important;
        border-radius: var(--radius-lg);
        margin-bottom: 16px;
}

.campaign-card {
        position: relative;
        border: 1px solid var(--border);
        border-left: 4px solid var(--primary);   /* default = active (indigo) */
        border-radius: 10px;
        background: var(--card);
        padding: 14px 16px 14px 18px;
        margin-bottom: 18px;                       /* robust separation */
        transition: box-shadow 0.18s var(--ease), border-color 0.18s var(--ease);
}
/* Higher-specificity guarantee: the cards also carry .task-item, whose
   own margin-bottom:11px could win by source order. This compound
   selector + !important ensures the 18px gap always applies so cards
   never touch. */
.task-item.campaign-card { margin-bottom: 18px !important; }
.campaign-card:last-child { margin-bottom: 0 !important; }
.campaign-card:hover { box-shadow: 0 6px 20px rgba(99,102,241,0.12); }
.campaign-card.cc-paused { border-left-color: #fca5a5; }
.campaign-card.cc-done   { border-left-color: #22c55e; opacity: 0.72; }
.campaign-card.cc-done:hover { opacity: 0.9; }

/* Campaign Brief toggle — hidden by default, exactly ONE flip arrow.
   We suppress the browser's native disclosure triangle and draw our own
   ::before caret that rotates 90° when the <details> is open. */
.camp-brief { margin-top: 8px; }
.camp-brief > summary {
        list-style: none;                          /* kill native marker (FF/std) */
        cursor: pointer;
        user-select: none;
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 0.78rem;
        color: var(--muted);
        font-weight: 600;
}
.camp-brief > summary::-webkit-details-marker { display: none; }  /* kill native (WebKit) */
.camp-brief > summary::before {
        content: '▸';
        display: inline-block;
        font-size: 0.72rem;
        line-height: 1;
        transition: transform 0.15s var(--ease);
}
.camp-brief[open] > summary::before { transform: rotate(90deg); }
.chk { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); flex-shrink: 0; cursor: pointer; margin-top: 1px; display: flex; align-items: center; justify-content: center; transition: all 0.18s var(--ease); }
/* Circular completion checkbox removed from campaign cards per request.
   Status is still changeable via the Edit modal. */
.chk { display: none !important; }
.chk:hover { border-color: var(--primary); transform: scale(1.08); box-shadow: 0 0 0 4px var(--ring); }
.chk.checked { background: var(--done); border-color: var(--done); }
.chk.checked::after { content: '✓'; color: white; font-size: 0.7rem; font-weight: 800; }
.task-content { flex: 1; min-width: 0; }
.task-name {
        font-weight: 600; font-size: 0.95rem; letter-spacing: -0.01em;
        /* overflow-wrap, NOT word-break. word-break:break-word lets the browser
           shrink this element's min-content width to a single character, so in a
           flex row next to non-shrinking action buttons the title collapses into a
           vertical column of letters on narrow screens. overflow-wrap only breaks a
           word when it genuinely cannot fit, leaving min-content at the longest
           word — which is what keeps the title readable on a phone. */
        overflow-wrap: break-word;
        word-break: normal;
}

/* The title column must keep a usable floor, and the header must be allowed to
   wrap so the action buttons drop to their own line rather than crushing it. */
.task-content { min-width: 0; }
.task-head-row { flex-wrap: wrap; }
.task-head-row > .task-content { flex: 1 1 200px; }
@media (max-width: 620px) {
        .task-head-row > .task-actions { width: 100%; justify-content: flex-start; }
}
.task-meta { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; align-items: center; }

/* ═══════════ BADGES ═══════════ */
.badge { padding: 3px 10px; border-radius: 999px; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; display: inline-flex; align-items: center; gap: 3px; border: 1px solid transparent; }
.b-high { background: #fef2f2; color: #b91c1c; border-color: #fecdd3; }
.b-medium { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.b-low { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.b-pending { background:var(--bg-subtle); color: var(--muted); border-color: #e2e8f0; }
.b-inprogress { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.b-done { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.b-overdue { background: #fef2f2; color: #b91c1c; border-color: #fecdd3; }
.b-date { background:var(--bg-subtle); color: var(--muted); font-weight: 600; border: 1px solid var(--border); }

/* ═══════════ META TAGS (quiet, non-semantic descriptors) ═══════════
   For campaign metadata that describes WHAT something is (an ID, an
   integration type, a jump type, a tracker flag) rather than its
   STATE (priority/status/overdue, which stay on .badge/.b-* above).
   One restrained treatment, differentiated by icon and text rather
   than a different color per tag, so real status signals aren't
   competing with decorative color for attention. */
.meta-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 0.68rem; font-weight: 600; color: var(--text-soft); background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; line-height: 1.5; white-space: nowrap; }
.meta-tag-mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: -0.01em; color: var(--muted); }
.meta-tag-accent { color: var(--primary-darker); background: var(--primary-light); border-color: #dbe0fb; }

/* Restrained money figures — muted pill, color lives in the number/icon
   only, not a saturated fill, so it doesn't visually shout next to the
   real status badges. */
.money-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 0.76rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--bg-subtle); border: 1px solid var(--border); color: var(--text-soft); }
.money-pill .money-val { color: var(--text); }
.money-pill.is-revenue .money-val { color: #059669; }
.money-pill.is-payout .money-val { color: #4338ca; }

/* ═══════════ MEMBER SECTION (admin) ═══════════ */
.member-block { margin-bottom: 26px; }
.member-head { display: flex; align-items: center; gap: 13px; padding: 13px 16px; background: linear-gradient(180deg, #f8f9fb, #f3f5f8); border-radius: var(--radius); margin-bottom: 12px; border: 1px solid var(--border); }
.avatar { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--primary), var(--primary-darker)); color: white; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.9rem; flex-shrink: 0; box-shadow: 0 4px 10px var(--primary-glow); }
.member-info .m-name { font-weight: 700; font-size: 0.96rem; letter-spacing: -0.01em; }
.member-info .m-sub { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

/* ═══════════ MODAL (scroll-fixed) ═══════════ */
.overlay { display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.4); z-index: 200; align-items: flex-start; justify-content: center; padding: 20px; overflow-y: auto; overflow-x: hidden; backdrop-filter: blur(8px) saturate(120%); -webkit-backdrop-filter: blur(8px) saturate(120%); }
/* Center the modal vertically when it fits, but allow the overlay to
   scroll (from anywhere, incl. the backdrop) when the modal is taller
   than the viewport. Auto margins center without the flex-center
   top-clipping quirk. */
.overlay > .modal { margin: auto; }
.overlay.open { display: flex; animation: overlayIn 0.25s var(--ease); }
/* Lock background scroll whenever any modal overlay is open (covers both
   the .open class and inline display:flex ways overlays are shown). Only
   the modal's own content scrolls. */
body:has(.overlay.open),
body:has(.overlay[style*="display:flex"]),
body:has(.overlay[style*="display: flex"]) { overflow: hidden; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
        background: var(--surface); border-radius: var(--radius-xl); padding: 30px; width: 100%; max-width: 440px;
        box-shadow: var(--shadow-xl); border: 1px solid var(--border); position: relative;
        animation: modalIn 0.32s var(--ease);
        max-height: 85vh; overflow-y: auto; overflow-x: hidden;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(0.96); } to { opacity: 1; transform: none; } }
.modal h3 { font-size: 1.15rem; font-weight: 800; margin-bottom: 20px; letter-spacing: -0.02em; }
.modal::-webkit-scrollbar { width: 8px; }

/* ═══════════ ALERTS ═══════════ */
.alert { padding: 12px 15px; border-radius: var(--radius); font-size: 0.86rem; margin-bottom: 14px; font-weight: 500; border: 1px solid transparent; }
.alert-err { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-info { background: #fffbeb; color: #92400e; border-color: #fde68a; }

/* ═══════════ SETUP GUIDE ═══════════ */
.setup-guide ol { padding-left: 20px; }
.setup-guide li { margin-bottom: 10px; line-height: 1.65; font-size: 0.88rem; color: var(--muted); }
.setup-guide li strong { color: var(--text); font-weight: 600; }
.setup-guide code { background: var(--bg-subtle); padding: 2px 7px; border-radius: 6px; font-size: 0.82rem; border: 1px solid var(--border); font-family: ui-monospace, Menlo, monospace; }
.setup-guide a { color: var(--primary); text-decoration: none; font-weight: 600; }
.setup-guide a:hover { text-decoration: underline; }

.empty { text-align: center; padding: 46px 20px; }
.empty .e-icon { font-size: 2.6rem; margin-bottom: 12px; opacity: 0.85; }
.empty p { color: var(--faint); font-size: 0.9rem; font-weight: 500; }
/* Second line of an empty state: what to DO about it. An empty screen that
   doesn't name the next action reads as broken rather than as empty — which is
   exactly what a new user or a senior leader hits on their first login. */
.empty .e-hint { color: var(--muted); font-size: 0.8rem; font-weight: 400; margin-top: 7px; line-height: 1.5; max-width: 380px; margin-left: auto; margin-right: auto; }
.empty .e-hint b { color: var(--text-soft); font-weight: 700; }

/* ═══════════ REUSABLE VIEW STATES (loading / error) ═══════════ */
/* Used by withViewState() — one place for all 3-state view flows. */
.tt-state { text-align: center; padding: 46px 20px; }
.tt-state p { color: var(--faint); font-size: 0.9rem; font-weight: 500; margin: 10px 0 0; }
@keyframes tt-spin { to { transform: rotate(360deg); } }
.tt-spinner {
        width: 34px; height: 34px; margin: 0 auto; border-radius: 50%;
        border: 3px solid var(--border, #e5e7eb);
        border-top-color: var(--primary, #6366f1);
        animation: tt-spin 0.7s linear infinite;
}
.tt-state-error .tt-err-icon { font-size: 2.2rem; margin-bottom: 10px; opacity: 0.9; }
.tt-state-error p { color: #b91c1c; }
.tt-retry-btn {
        margin-top: 14px; padding: 7px 16px; font-size: 0.82rem; font-weight: 700;
        color: #fff; background: var(--primary, #6366f1); border: none; border-radius: 8px;
        cursor: pointer; transition: opacity 0.15s;
}
.tt-retry-btn:hover { opacity: 0.88; }
/* Skeleton shimmer rows (optional richer loading state). */
@keyframes tt-shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.tt-skel-row {
        height: 54px; border-radius: 10px; margin-bottom: 10px;
        background: linear-gradient(90deg, var(--bg, #f6f7f9) 25%, rgba(0,0,0,0.05) 37%, var(--bg, #f6f7f9) 63%);
        background-size: 800px 100%; animation: tt-shimmer 1.3s ease-in-out infinite;
}

/* ═══════════ CONFIG BANNER ═══════════ */
.banner { background: linear-gradient(180deg, #fffdf5, #fffbeb); border: 1px solid #fde68a; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 22px; font-size: 0.86rem; color: #92400e; box-shadow: var(--shadow-xs); }
.banner strong { display: block; margin-bottom: 3px; font-size: 0.9rem; font-weight: 700; }

/* ═══════════ MEMBER CHIPS ═══════════ */
.member-chip { display:inline-flex; align-items:center; gap:7px; background:var(--primary-light); color:var(--primary-darker); border-radius:999px; padding:6px 13px; font-size:0.82rem; font-weight:600; border: 1px solid #dfe3ff; }
.member-chip button { background:none; border:none; cursor:pointer; color:var(--primary-darker); font-size:0.9rem; line-height:1; padding:0; opacity:0.55; transition: opacity 0.15s; }
.member-chip button:hover { opacity:1; }

/* ═══════════ ROLE BADGE ═══════════ */
.role-badge { display:inline-block; padding:3px 10px; border-radius:999px; font-size:0.68rem; font-weight:700; text-transform:uppercase; letter-spacing:0.04em; border: 1px solid transparent; }
.role-adv { background:#f3f0ff; color:#6d28d9; border-color:#e4ddff; }
.role-pub { background:#eef4ff; color:#1d4ed8; border-color:#dbe6fe; }
.role-ops { background:#fff7ed; color:#b45309; border-color:#fed7aa; }
.role-sales { background:#f0fdf4; color:#15803d; border-color:#bbf7d0; }
.role-cs { background:#fdf2f8; color:#be185d; border-color:#fbcfe8; }
.role-tl { background:#ecfdf5; color:#065f46; border-color:#6ee7b7; }

/* ═══════════ ROLE PERMISSIONS PANEL ═══════════ */
.role-perm-row { display:flex; align-items:center; justify-content:space-between; padding:14px 0; border-bottom:1px solid var(--border); gap: 16px; flex-wrap: wrap; }
.role-perm-row:last-child { border-bottom:none; }
.perm-toggles { display:flex; gap:14px; flex-wrap: wrap; }
.perm-toggle { display:flex; align-items:center; gap:7px; font-size:0.82rem; font-weight:600; cursor:pointer; color: var(--text-soft); }
.toggle-switch { width:38px; height:22px; border-radius:999px; background:var(--border-strong); position:relative; transition:background 0.22s var(--ease); flex-shrink:0; cursor:pointer; }
.toggle-switch.on { background:var(--primary); box-shadow: 0 2px 6px var(--primary-glow); }
.toggle-switch::after { content:''; position:absolute; width:16px; height:16px; border-radius:50%; background:var(--surface); top:3px; left:3px; transition:left 0.22s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.toggle-switch.on::after { left:19px; }

/* Login-access switch in the admin members table. Same control as above, but
   RED = blocked and GREEN = allowed, because here 'off' is not merely a
   setting being off - it is a person who cannot sign in. --primary reads as
   'on' and says nothing about whether that is good or bad; red/green does. */
/* Sized DOWN from the stock 38x22. The stock switch is taller than the
   .btn-edit-sm buttons beside it (5px 10px padding, ~0.75rem), so at full
   size it stretches every row of the members table. */
.toggle-switch.tt-access { width:32px; height:18px; background:#dc2626; border:0; padding:0; }
.toggle-switch.tt-access::after { width:13px; height:13px; top:2.5px; left:2.5px; }
.toggle-switch.tt-access.on::after { left:16.5px; }
.toggle-switch.tt-access.on { background:#16a34a; box-shadow:0 2px 6px rgba(22,163,74,0.35); }
.toggle-switch.tt-access:disabled { opacity:0.5; cursor:progress; }


/* ═══════════ FOLLOW-UPS ═══════════ */
.followup-section { padding-left:35px; margin-top:4px; }
.followup-toggle { background:none; border:none; color:var(--primary); font-size:0.8rem; font-weight:700; cursor:pointer; padding:0; display:flex; align-items:center; gap:5px; transition: opacity 0.15s; }
.followup-toggle:hover { opacity: 0.75; }
.followup-list { margin-top:9px; display:flex; flex-direction:column; gap:6px; }
.followup-item { display:flex; align-items:center; gap:9px; padding:8px 11px; background:var(--bg-subtle); border-radius:var(--radius-sm); border:1px solid var(--border); transition: border-color 0.15s; }
.followup-item:hover { border-color: var(--border-strong); }
.fu-chk { width:17px; height:17px; border-radius:50%; border:2px solid var(--border-strong); flex-shrink:0; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:all 0.15s var(--ease); }
.fu-chk:hover { border-color:var(--primary); transform: scale(1.1); }
.fu-chk.done { background:var(--done); border-color:var(--done); }
.fu-chk.done::after { content:'✓'; color:white; font-size:0.6rem; font-weight:800; }
.fu-text { flex:1; font-size:0.83rem; color:var(--text); font-weight: 500; }
.fu-text.done-text { text-decoration:line-through; color:var(--faint); }
.fu-date { font-size:0.72rem; color:var(--muted); white-space:nowrap; font-weight: 600; }
.fu-del { background:none; border:none; cursor:pointer; color:var(--faint); font-size:0.8rem; padding:0; transition: color 0.15s; }
.fu-del:hover { color:var(--danger); }
.followup-add { display:flex; gap:7px; margin-top:9px; flex-wrap: wrap; }
.followup-add input[type=text] { flex:1; min-width:140px; font-size:0.82rem; padding:8px 11px; border-radius:var(--radius-sm); }
.followup-add input[type=date] { font-size:0.8rem; padding:8px 10px; border-radius:var(--radius-sm); width:140px; }
.followup-add input[type=time] { font-size:0.8rem; padding:8px 10px; border-radius:var(--radius-sm); width:110px; }
.followup-add button { padding:8px 14px; font-size:0.8rem; border-radius:var(--radius-sm); border:none; background:var(--primary); color:white; font-weight:700; cursor:pointer; white-space:nowrap; transition: all 0.16s var(--ease); }
.followup-add button:hover { background:var(--primary-dark); transform: translateY(-1px); }

/* ═══════════ SNOOZE / FOLLOW-UP MINI-PANELS ═══════════ */
.snooze-mini { background:var(--surface);border:1.5px solid var(--border);border-radius:var(--radius);padding:9px 12px;margin-top:6px;box-shadow:var(--shadow-md); }
.snooze-mini-label { font-size:0.71rem;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.03em;margin-bottom:6px; }
.snooze-presets { display:flex;gap:5px;flex-wrap:wrap;margin-bottom:6px; }
.sz-btn { padding:4px 11px;font-size:0.73rem;border-radius:999px;border:1.5px solid var(--border-strong);background:var(--bg);cursor:pointer;font-weight:600;transition:all 0.14s; }
.sz-btn:hover { background:var(--primary);color:white;border-color:var(--primary); }
.sz-custom { display:flex;gap:5px;align-items:center; }
.sz-custom input[type=date] { font-size:0.75rem;padding:5px 8px;border:1.5px solid var(--border-strong);border-radius:8px;background:var(--bg);color:var(--text); }
.sz-custom button { padding:5px 12px;font-size:0.73rem;border:none;border-radius:8px;background:var(--primary);color:white;font-weight:700;cursor:pointer; }
.fu-mini { background:var(--surface);border:1.5px solid var(--border);border-radius:var(--radius);padding:9px 12px;margin-top:6px;box-shadow:var(--shadow-md); }
.fu-mini-row { display:flex;gap:6px;align-items:center; }
.fu-mini-row input[type=date] { font-size:0.75rem;padding:5px 8px;border:1.5px solid var(--border-strong);border-radius:8px;background:var(--bg);color:var(--text); }
.fu-mini-row button { padding:5px 12px;font-size:0.73rem;border:none;border-radius:8px;background:#7c3aed;color:white;font-weight:700;cursor:pointer; }
.fu-mini-row .clear-fu { background:none;border:1.5px solid var(--border-strong);color:var(--muted);font-size:0.72rem;padding:4px 9px;border-radius:8px;cursor:pointer; }
.snoozed-badge { background:#fef3c7;color:#92400e;border:1px solid #fde68a;border-radius:999px;font-size:0.71rem;font-weight:700;padding:2px 8px;display:inline-flex;align-items:center;gap:3px; }
.fu-due-badge { background:#fef2f2;color:#dc2626;border:1px solid #fecaca;border-radius:999px;font-size:0.71rem;font-weight:700;padding:2px 8px;display:inline-flex;align-items:center;gap:3px; }
.fu-badge { background:#f5f3ff;color:#7c3aed;border:1px solid #ddd6fe;border-radius:999px;font-size:0.71rem;font-weight:700;padding:2px 8px;display:inline-flex;align-items:center;gap:3px; }
.mini-action-row { display:flex;gap:6px;flex-wrap:wrap;margin-top:6px;align-items:center; }
.mini-action-btn { padding:4px 11px;font-size:0.73rem;border-radius:999px;border:1.5px solid var(--border-strong);background:var(--bg);cursor:pointer;font-weight:600;color:var(--muted);transition:all 0.14s; }
.mini-action-btn:hover { border-color:var(--primary);color:var(--primary); }

/* ═══════════ DYNAMIC MULTI-ENTRY LISTS ═══════════ */
.dyn-list-row { display:flex;gap:10px;align-items:center; }
.dyn-list-row input, .dyn-list-row select { flex:1 1 0;width:50%;min-width:0;box-sizing:border-box;font-size:0.83rem;padding:8px 11px;border:1.5px solid var(--border-strong);border-radius:8px;background:var(--input-bg);color:var(--text); }
.dyn-list-row select.portal-name { cursor:pointer; }
.dyn-rm-btn { width:28px;height:28px;border-radius:8px;border:1.5px solid #fecaca;background:#fef2f2;color:#dc2626;cursor:pointer;font-size:0.85rem;font-weight:700;flex-shrink:0;line-height:1;display:flex;align-items:center;justify-content:center;transition:all 0.12s; }
.dyn-rm-btn:hover { background:#dc2626;color:white; }
.dyn-add-btn { font-size:0.78rem;padding:6px 13px;border-radius:999px;border:1.5px solid var(--primary);color:var(--primary);background:transparent;cursor:pointer;font-weight:600;transition:all 0.12s; }
.dyn-add-btn:hover { background:var(--primary);color:white; }

/* ═══════════ ADMIN DELETE / EDIT BTN ═══════════ */
.btn-ghost-red-sm { background: #fef2f2; color: var(--danger); border: 1.5px solid #fecaca; padding: 5px 10px; font-size: 0.72rem; border-radius: var(--radius-sm); cursor: pointer; font-weight: 700; transition: all 0.15s var(--ease); }
.btn-ghost-red-sm:hover { background:var(--tint-red-bg);color:var(--tint-red-fg); transform: translateY(-1px); }
.btn-edit-sm { background:#eef4ff; color:#1d4ed8; border:1.5px solid #dbe6fe; padding:5px 11px; font-size:0.75rem; border-radius:var(--radius-sm); cursor:pointer; font-weight:700; transition: all 0.15s var(--ease); }
.btn-edit-sm:hover { background:#dbe6fe; transform: translateY(-1px); }

/* ═══════════ DECLINE BANNER ═══════════ */
.decline-banner { background:#fef2f2;border:1px solid #fecaca;border-radius:var(--radius-sm);padding:9px 13px;font-size:0.82rem;color:#b91c1c;margin-top:4px;display:flex;align-items:flex-start;gap:8px;font-weight:500; }
.decline-banner strong { white-space:nowrap;font-weight:700; }

/* ═══════════ PID SECTION ═══════════ */
.pid-section { padding-left:35px;margin-top:6px; }
.pid-toggle { width:100%;background:none;border:none;color:var(--muted);font-size:0.76rem;font-weight:700;cursor:pointer;padding:4px 0;display:flex;align-items:center;gap:6px;text-transform:uppercase;letter-spacing:0.05em;transition:color 0.15s; }
.pid-toggle:hover { color:var(--primary); }
.pid-list { display:flex;flex-wrap:wrap;gap:6px;margin:7px 0; }
.pid-chip { background:var(--primary-light);color:var(--primary-darker);border:1px solid #dfe3ff;border-radius:999px;padding:4px 11px;font-size:0.78rem;font-weight:700;display:flex;align-items:center;gap:5px; }
/* ── Tracking Type chips ── */
.tt-type-chip { display:inline-flex;align-items:center;padding:2px 9px;border-radius:99px;font-size:0.7rem;font-weight:700;letter-spacing:.02em; }
.tt-type-CTA     { background:#eff6ff;color:#1d4ed8;border:1px solid #bfdbfe; }
.tt-type-VTA     { background:#f5f3ff;color:#6d28d9;border:1px solid #ddd6fe; }
.tt-type-Onelink { background:#ecfdf5;color:#059669;border:1px solid #a7f3d0; }
.tt-type-RT      { background:#fffbeb;color:#d97706;border:1px solid #fde68a; }
.tt-type-CTV     { background:#fff1f2;color:#be123c;border:1px solid #fecdd3; }
/* VTA variants of the three families above.
 *
 * These were MISSING, which is the "RT VTA alignment" bug: renderTrackingChips()
 * emits class "tt-type-RT_VTA" (the stored key), and with no rule to match it the
 * chip fell back to .tt-type-chip alone — padding and font weight, but NO
 * background, colour or border. A transparent, borderless chip next to bordered
 * ones reads as sitting at the wrong height, so it was reported as alignment.
 * Onelink VTA and CTV VTA were broken identically, just less used.
 *
 * Colours mirror the values already declared for these keys in
 * TRACKING_LINK_TYPES (index.js) so the chip, the link-box header and the
 * approval UI agree. Each VTA fill is deliberately a step DEEPER than its CTA
 * sibling — RT CTA and RT VTA would otherwise differ only in border shade and be
 * near-indistinguishable in a row of chips. */
.tt-type-Onelink_VTA { background:#d1fae5;color:#065f46;border:1px solid #6ee7b7; }
.tt-type-RT_VTA      { background:#fef3c7;color:#92400e;border:1px solid #fcd34d; }
.tt-type-CTV_VTA     { background:#ffe4e6;color:#9f1239;border:1px solid #fda4af; }
.tt-type-label-form { display:flex;align-items:center;gap:5px;cursor:pointer;font-size:0.82rem;font-weight:600;padding:6px 13px;border-radius:99px;border:1.5px solid var(--border);background:var(--bg);color:var(--muted);transition:all .15s;user-select:none; }
.tt-type-label-form input { display:none; }
.tt-type-label-form:has(input:checked) { border-color:var(--primary);background:var(--primary-light);color:var(--primary); }
.pid-chip button { background:none;border:none;color:var(--faint);cursor:pointer;font-size:0.75rem;padding:0;line-height:1;transition:color 0.15s; }
.pid-chip button:hover { color:#ef4444; }
.pid-add { display:flex;gap:7px;align-items:center;margin-top:5px; }
.pid-add input { flex:1;font-size:0.82rem;padding:7px 11px;border:1.5px solid var(--border-strong);border-radius:var(--radius-sm);font-family:inherit; }
.pid-add button { background:var(--primary);color:#fff;border:none;border-radius:var(--radius-sm);padding:7px 14px;font-size:0.8rem;font-weight:700;cursor:pointer;transition:all 0.16s var(--ease); }
.pid-add button:hover { background:var(--primary-dark);transform:translateY(-1px); }

/* ═══════════ CLIENT CARDS ═══════════ */
.client-card { border:1px solid var(--border); border-radius:var(--radius); padding:16px 18px; margin-bottom:11px; transition:all 0.18s var(--ease); background:var(--card); }
.client-card:hover { border-color:#c7d0fb; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.client-card-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; gap:10px; flex-wrap:wrap; }
.client-name { font-weight:700; font-size:0.96rem; letter-spacing:-0.01em; }
.client-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px 18px; }
.client-field .cf-label { font-size:0.68rem; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:0.05em; margin-bottom:3px; }
.client-field .cf-val { font-size:0.86rem; color:var(--text); word-break:break-word; font-weight:500; }
.client-actions { display:flex; gap:6px; }

/* ═══════════ REVENUE TABLE ═══════════ */
.rev-table { width:100%; border-collapse:collapse; font-size:0.88rem; }
.rev-table th { text-align:left; padding:10px 14px; font-size:0.72rem; text-transform:uppercase; letter-spacing:0.05em; color:var(--muted); border-bottom:1.5px solid var(--border-strong); font-weight:700; }
.rev-table td { padding:12px 14px; border-bottom:1px solid var(--border); font-weight:500; }
.rev-table tr:last-child td { border-bottom:none; font-weight:800; background:var(--bg-subtle); }
.rev-table tbody tr { transition: background 0.12s; }
.rev-table tbody tr:hover:not(:last-child) { background:var(--tint-neutral-bg);color:var(--tint-neutral-fg); }
.rev-table .rev-amt { color:var(--success); font-weight:800; }

/* ═══════════ FEEDBACK CARD ═══════════ */
.fb-card { border:1px solid var(--border); border-radius:var(--radius); padding:16px 18px; margin-bottom:11px; background:var(--card); transition: box-shadow 0.18s var(--ease); }
.fb-card:hover { box-shadow: var(--shadow-sm); }
.fb-card-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; gap:10px; }
.fb-member { font-weight:700; font-size:0.92rem; }
.fb-task { font-size:0.8rem; color:var(--muted); margin-top:2px; }
.fb-stars { color:#f59e0b; font-size:1rem; letter-spacing:1px; }
.fb-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:8px; }
.fb-label { font-size:0.7rem; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:0.04em; margin-bottom:3px; }
.fb-val { font-size:0.86rem; color:var(--text-soft); font-weight:500; }

/* ═══════════ MOBILE BACKDROP ═══════════ */
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.45); z-index: 99; backdrop-filter: blur(2px); }
.sidebar-backdrop.show { display: block; }

/* ═══════════ RESPONSIVE ═══════════ */
@media(max-width: 980px) {
        :root { --sidebar-w: 0px; }
        .sidebar { transform: translateX(-100%); width: 256px; box-shadow: var(--shadow-xl); }
        .sidebar.open { transform: translateX(0); }
        .main-area { margin-left: 0; }
        .hamburger { display: flex; }
}
@media(max-width:640px) {
        .dashboard { padding: 16px; }
        .topbar { padding: 12px 16px; }
        .fb-row { grid-template-columns:1fr; }
        .client-grid { grid-template-columns: 1fr; }
        .login-card { padding: 34px 26px; }
        .modal { padding: 24px 20px; max-height: 88vh; }
}

/* ══════════ GLOBAL MOBILE PASS (phones ≤ 680px) ══════════
   One focused layer for the highest-impact patterns app-wide:
   stat tiles → single column, tables → horizontal scroll, modals →
   near-full-width, cards → tighter padding. The sidebar collapse +
   hamburger already live in the 980px block above. */
@media (max-width: 680px) {
        /* Stat tiles: stack 1-across (full width) on phones. Covers both the
           base .stats-row grid AND the inline repeat(4,1fr)/repeat(3,1fr) grids
           used by the dashboard tile rows — inline grid-template-columns can't
           be overridden, so we flip those specific containers to flex-column. */
        .stats-row { grid-template-columns: 1fr !important; gap: 12px; margin-bottom: 18px; }
        .stat { padding: 16px 18px; }
        .stat-n { font-size: 1.7rem; }

        /* Any inline 2–4 col grid inside a dashboard view collapses to 1 col.
           Scoped to [data-view] cards/rows so we don't disturb intentional
           side-by-side UI elsewhere. */
        [data-view="dashboard"] [style*="grid-template-columns:repeat(4"],
        [data-view="dashboard"] [style*="grid-template-columns:repeat(3"],
        [data-view="dashboard"] [style*="grid-template-columns: repeat(4"],
        [data-view="dashboard"] [style*="grid-template-columns: repeat(3"] {
                grid-template-columns: 1fr !important;
        }

        /* Tables: wrap overflow so wide Finance/PID tables scroll sideways
           instead of blowing out the layout. .table-wrap is an optional
           explicit wrapper; the bare-table rule is the safety net. */
        .table-wrap, .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
        .card-body > table, .card > table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }

        /* Modals: use almost the full screen, scroll inside. */
        .overlay { padding: 10px !important; }
        .modal, .modal-shell, .campaign-modal-shell { max-width: 100% !important; width: 100% !important; max-height: 92vh; overflow-y: auto; }

        /* Cards: tighten padding so content isn't cramped by big margins. */
        .card { border-radius: 12px; }
        .card-head { padding: 12px 14px; flex-wrap: wrap; gap: 6px; }
        .card-body { padding: 12px 14px; }

        /* Dashboard outer padding a touch tighter than the 640px rule. */
        .dashboard { padding: 12px; }
}

/* ══════════ SALES MANAGER DASHBOARD ══════════ */
.pipeline-board { display:flex; gap:12px; overflow-x:auto; padding-bottom:10px; align-items:flex-start; }
.pipeline-col { flex:0 0 210px; background:var(--bg); border:1.5px solid var(--border); border-radius:12px; padding:10px; min-height:120px; }
.pipeline-col-header { font-size:0.72rem; font-weight:800; color:var(--muted); text-transform:uppercase; letter-spacing:0.06em; margin-bottom:9px; display:flex; align-items:center; justify-content:space-between; }
.pipeline-col-header .col-count { background:var(--border); color:var(--muted); border-radius:999px; font-size:0.68rem; padding:1px 7px; font-weight:700; }
.pipeline-col-header .col-val { font-size:0.7rem; color:var(--primary); font-weight:700; }
.deal-card { background:var(--surface); border:1.5px solid var(--border); border-radius:10px; padding:10px 12px; margin-bottom:7px; cursor:pointer; transition:box-shadow 0.15s var(--ease), border-color 0.15s; position:relative; }
.deal-card:hover { box-shadow:var(--shadow-sm); border-color:rgba(99,102,241,0.35); }
.deal-card-name { font-size:0.84rem; font-weight:700; color:var(--text); margin-bottom:4px; line-height:1.3; }
.deal-card-adv  { font-size:0.72rem; color:var(--muted); margin-bottom:5px; }
.deal-card-val  { font-size:0.9rem; font-weight:800; color:var(--primary); }
.deal-card-fu   { font-size:0.68rem; color:#dc2626; font-weight:600; margin-top:4px; }
.deal-card-actions { position:absolute; top:7px; right:7px; display:flex; gap:4px; opacity:0; transition:opacity 0.15s; }
.deal-card:hover .deal-card-actions { opacity:1; }
.stage-pill { display:inline-flex; align-items:center; font-size:0.63rem; font-weight:700; border-radius:999px; padding:2px 8px; white-space:nowrap; }
.sp-prospect    { background:#f0f9ff; color:#0369a1; border:1px solid #bae6fd; }
.sp-proposal    { background:#fef3c7; color:#92400e; border:1px solid #fde68a; }
.sp-negotiation { background:#f3e8ff; color:#7c3aed; border:1px solid #ddd6fe; }
.sp-won         { background:#dcfce7; color:#15803d; border:1px solid #bbf7d0; }
.sp-lost        { background:#fef2f2; color:#b91c1c; border:1px solid #fecdd3; }
.revenue-bar-wrap { background:var(--tint-neutral-bg);color:var(--tint-neutral-fg); border-radius:999px; height:10px; overflow:hidden; margin:6px 0 3px; }
.revenue-bar-fill { height:100%; border-radius:999px; transition:width 0.6s var(--ease); background:linear-gradient(90deg,var(--primary),#10b981); }
.sm-stat { background:var(--surface); border:1.5px solid var(--border); border-radius:var(--radius); padding:14px 18px; display:flex; flex-direction:column; gap:4px; cursor:pointer; transition:all 0.18s var(--ease); }
.sm-stat-n { font-size:1.6rem; font-weight:800; color:var(--primary); line-height:1; }
.sm-stat-l { font-size:0.72rem; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:0.05em; }
.sm-stats-row { display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:10px; margin-bottom:14px; }
.lead-fu-item { display:flex; align-items:center; gap:10px; padding:9px 12px; border:1.5px solid var(--border); border-radius:10px; margin-bottom:6px; }
.lead-fu-item.overdue { border-color:#fecdd3; background:var(--tint-red-bg);color:var(--tint-red-fg); }
.lead-fu-item.today   { border-color:#fde68a; background:var(--tint-amber-bg);color:var(--tint-amber-fg); }
.commission-row { display:grid; grid-template-columns:1fr 1fr 1fr auto; gap:8px; align-items:center; padding:8px 12px; border:1.5px solid var(--border); border-radius:10px; margin-bottom:6px; font-size:0.84rem; }
.sales-client-card { background:var(--surface); border:1.5px solid var(--border); border-radius:var(--radius); padding:14px 16px; display:flex; flex-direction:column; gap:6px; position:relative; transition:box-shadow 0.15s; }
.sales-client-card:hover { box-shadow:var(--shadow-sm); }
.sales-client-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:10px; }
.deal-stage-btn { font-size:0.72rem; padding:4px 10px; border-radius:6px; border:1.5px solid var(--border); background:var(--bg); cursor:pointer; font-weight:600; color:var(--muted); transition:all 0.13s; }
.deal-stage-btn.active { background:var(--primary); color:#fff; border-color:var(--primary); }
@media(max-width:640px) { .pipeline-board { flex-direction:column; } .pipeline-col { flex:none; width:100%; } }

/* ── Deal Modal Sections ── */
.deal-section { border:1.5px solid var(--border); border-radius:12px; padding:13px 15px; margin-bottom:10px; background:var(--surface); }
.deal-section-hdr { font-size:0.72rem; font-weight:800; color:var(--muted); text-transform:uppercase; letter-spacing:0.06em; margin-bottom:11px; display:flex; align-items:center; justify-content:space-between; }
.deal-section-hdr span { font-size:0.72rem; font-weight:700; color:var(--primary); background:var(--primary-light); border-radius:999px; padding:1px 8px; }

/* ── Reminder Items ── */
.rem-item { display:flex; align-items:flex-start; gap:8px; padding:9px 11px; background:var(--bg); border:1.5px solid var(--border); border-radius:10px; margin-bottom:6px; transition:border-color 0.15s; }
.rem-item.overdue  { border-color:#fecdd3; background:var(--tint-red-bg);color:var(--tint-red-fg); }
.rem-item.due-today{ border-color:#fde68a; background:var(--tint-amber-bg);color:var(--tint-amber-fg); }
.rem-item.snoozed  { opacity:0.65; }
.rem-item.done     { opacity:0.45; }
.rem-type-pill { font-size:0.65rem; font-weight:800; border-radius:6px; padding:2px 8px; white-space:nowrap; flex-shrink:0; }
.rtp-followup  { background:#f0fdf4; color:#15803d; border:1px solid #86efac; }
.rtp-email     { background:#eff6ff; color:#1d4ed8; border:1px solid #93c5fd; }
.rtp-call      { background:#fdf4ff; color:#7c3aed; border:1px solid #d8b4fe; }
.rtp-note      { background:#fefce8; color:#92400e; border:1px solid #fde68a; }

/* ── Snooze Panel ── */
.snooze-panel { border:1.5px solid #fde68a; border-radius:10px; padding:10px 12px; margin-top:6px; background:var(--tint-amber-bg);color:var(--tint-amber-fg); }
.snooze-opts  { display:flex; gap:5px; flex-wrap:wrap; margin-bottom:7px; }
.snooze-btn   { font-size:0.72rem; padding:4px 11px; border:1.5px solid #fde68a; border-radius:6px; background:var(--surface); cursor:pointer; font-weight:700; color:#92400e; transition:all 0.12s; }
.snooze-btn:hover { background:var(--primary); color:#fff; border-color:var(--primary); }
.snooze-custom { display:flex; gap:6px; align-items:center; }
.snooze-custom input { flex:1; font-size:0.78rem; padding:4px 8px; border:1.5px solid #fde68a; border-radius:7px; font-family:inherit; }
.snooze-custom button { font-size:0.72rem; padding:4px 10px; border:1.5px solid var(--primary); border-radius:6px; background:var(--primary); color:#fff; cursor:pointer; font-weight:700; white-space:nowrap; }

/* ── Email/Call Status on Deal Cards ── */
.deal-indicator { display:flex; gap:4px; flex-wrap:wrap; margin-top:5px; }
.deal-ind-chip { font-size:0.62rem; font-weight:700; border-radius:5px; padding:2px 6px; }
.dic-email-sent  { background:#dcfce7; color:#15803d; border:1px solid #86efac; }
.dic-email-nosnt { background:#fef2f2; color:#dc2626; border:1px solid #fca5a5; }
.dic-call-sched  { background:#f3e8ff; color:#7c3aed; border:1px solid #c4b5fd; }
.dic-call-done   { background:#ecfdf5; color:#059669; border:1px solid #6ee7b7; }
.dic-call-missed { background:#fef2f2; color:#b91c1c; border:1px solid #fca5a5; }

/* ── In-modal reminder list ── */
.modal-rem-item { display:flex; align-items:center; gap:7px; padding:7px 10px; background:var(--bg); border:1.5px solid var(--border); border-radius:8px; margin-bottom:5px; font-size:0.82rem; }
.modal-rem-item.done-rem { opacity:0.5; text-decoration:line-through; }
.add-rem-row { display:grid; grid-template-columns:120px 1fr 1fr auto; gap:6px; align-items:center; margin-top:8px; }
@media(max-width:600px) { .add-rem-row { grid-template-columns:1fr 1fr; } }

/* ── Snoozed items section in inbox ── */
.snoozed-section-hdr { font-size:0.72rem; font-weight:800; color:var(--muted); text-transform:uppercase; letter-spacing:0.05em; margin:14px 0 7px; display:flex; align-items:center; gap:8px; }
.snoozed-section-hdr::before, .snoozed-section-hdr::after { content:''; flex:1; height:1px; background:var(--border); }

/* ═══════════ DAILY REMINDER POPUP ═══════════ */
.daily-popup-overlay {
        display: none; position: fixed; inset: 0;
        background: rgba(15,23,42,0.55); z-index: 350;
        align-items: center; justify-content: center;
        padding: 20px; backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
}
.daily-popup-overlay.open { display: flex; animation: overlayIn 0.28s var(--ease); }
.daily-popup {
        background: var(--surface); border-radius: 18px;
        box-shadow: 0 24px 60px rgba(15,23,42,0.22);
        width: 100%; max-width: 520px;
        max-height: 88vh; display: flex; flex-direction: column;
        border: 1.5px solid var(--border);
}
.daily-popup-head {
        padding: 18px 20px 14px; border-bottom: 1.5px solid var(--border);
        display: flex; align-items: flex-start; gap: 10px; flex-shrink: 0;
}
.daily-popup-head h3 { font-size: 1rem; font-weight: 800; }
.daily-popup-head-sub { font-size: 0.75rem; color: var(--muted); font-weight: 500; margin-top: 2px; }
.daily-popup-badge {
        font-size: 0.72rem; font-weight: 800; border-radius: 999px;
        padding: 3px 10px; background: #fef2f2; color: #dc2626;
        border: 1px solid #fca5a5; white-space: nowrap; flex-shrink: 0;
}
.daily-popup-body { padding: 14px 18px; overflow-y: auto; flex: 1; }
.dpsec-hdr {
        font-size: 0.68rem; font-weight: 800; text-transform: uppercase;
        letter-spacing: 0.07em; margin: 10px 0 7px; display: flex;
        align-items: center; gap: 7px;
}
.dpsec-hdr::after { content:''; flex:1; height:1px; background:var(--border); }
.dpr-item {
        display: flex; align-items: flex-start; gap: 9px;
        padding: 10px 12px; border-radius: 10px;
        border: 1.5px solid var(--border); background: var(--bg);
        margin-bottom: 7px; transition: opacity 0.25s;
}
.dpr-item.dpr-overdue { border-color: #fca5a5; background:var(--tint-red-bg);color:var(--tint-red-fg); }
.dpr-item.dpr-today   { border-color: #fde68a; background:var(--tint-amber-bg);color:var(--tint-amber-fg); }
.dpr-item.dpr-fading  { opacity: 0.25; pointer-events: none; }
.dpr-body  { flex: 1; min-width: 0; }
.dpr-deal  { font-size: 0.7rem; font-weight: 800; color: var(--muted); margin-bottom: 2px; }
.dpr-note  { font-size: 0.82rem; color: var(--text); line-height: 1.4; margin-bottom: 5px; }
.dpr-meta  { font-size: 0.68rem; color: var(--muted); margin-bottom: 6px; }
.dpr-acts  { display: flex; gap: 5px; flex-wrap: wrap; }
.dpr-btn-done {
        font-size: 0.7rem; font-weight: 700; padding: 3px 10px;
        border-radius: 6px; border: 1.5px solid #86efac;
        background: #f0fdf4; color: #15803d; cursor: pointer;
}
.dpr-btn-done:hover { background: #16a34a; color: #fff; border-color: #16a34a; }
.dpr-btn-snooze {
        font-size: 0.7rem; font-weight: 700; padding: 3px 10px;
        border-radius: 6px; border: 1.5px solid var(--border);
        background: var(--surface); color: var(--muted); cursor: pointer;
}
.dpr-btn-snooze:hover { border-color: #fde68a; color: #92400e; }
.dpr-snooze-row { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.dpr-sz-btn {
        font-size: 0.67rem; font-weight: 700; padding: 3px 8px;
        border-radius: 5px; border: 1.5px solid #fde68a;
        background:var(--surface); color: #92400e; cursor: pointer;
}
.dpr-sz-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.daily-popup-foot {
        padding: 12px 18px 16px; border-top: 1.5px solid var(--border);
        display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap;
}
.dp-btn-dismiss {
        font-size: 0.78rem; font-weight: 700; padding: 8px 15px;
        border-radius: 8px; border: 1.5px solid var(--border);
        background: var(--surface); color: var(--muted); cursor: pointer;
}
.dp-btn-dismiss:hover { border-color: var(--primary); color: var(--primary); }
.dp-btn-inbox {
        font-size: 0.78rem; font-weight: 700; padding: 8px 15px;
        border-radius: 8px; background: var(--primary); color: #fff;
        border: none; cursor: pointer; margin-left: auto;
}
.dp-btn-inbox:hover { opacity: 0.88; }
.dp-empty { text-align: center; padding: 28px 16px; color: var(--muted); font-size: 0.86rem; }

/* ===== Dashboard slimming + dedicated-page fix (authoritative) ===== */
/* DASHBOARD home: hide dedicated working-list cards (keep untagged overview, data-view=dashboard, onboarding) */
.dashboard[data-active-view="dashboard"] > #defaultMemberDashboard > .card[data-view]:not([data-view="dashboard"]):not([data-view="onboarding"]) { display: none !important; }
/* Each dedicated view: force-show its own card (fixes specificity bug that hid these pages) */
.dashboard[data-active-view="campaigns"] > #defaultMemberDashboard > .card[data-view="campaigns"],
.dashboard[data-active-view="clients"] > #defaultMemberDashboard > .card[data-view="clients"],
.dashboard[data-active-view="onboarding"] > #defaultMemberDashboard > .card[data-view="onboarding"],
.dashboard[data-active-view="cscampaigns"] > #defaultMemberDashboard > .card[data-view="cscampaigns"],
.dashboard[data-active-view="approvals"] > #defaultMemberDashboard > .card[data-view="approvals"],
.dashboard[data-active-view="inbox"] > #defaultMemberDashboard > .card[data-view="inbox"],
.dashboard[data-active-view="escalations"] > #defaultMemberDashboard > .card[data-view="escalations"],
.dashboard[data-active-view="renewals"] > #defaultMemberDashboard > .card[data-view="renewals"],
.dashboard[data-active-view="queue"] > #defaultMemberDashboard > .card[data-view="queue"],
.dashboard[data-active-view="discrepancies"] > #defaultMemberDashboard > .card[data-view="discrepancies"],
.dashboard[data-active-view="amfeedback"] > #defaultMemberDashboard > .card[data-view="amfeedback"],
.dashboard[data-active-view="campaignreport"] > #defaultMemberDashboard > .card[data-view="campaignreport"],
.dashboard[data-active-view="health"] > #defaultMemberDashboard > .card[data-view="health"],
.dashboard[data-active-view="csfeedback"] > #defaultMemberDashboard > .card[data-view="csfeedback"],
.dashboard[data-active-view="csfollowups"] > #defaultMemberDashboard > .card[data-view="csfollowups"],
.dashboard[data-active-view="live"] > #defaultMemberDashboard > .card[data-view="live"],
.dashboard[data-active-view="chklists"] > #defaultMemberDashboard > .card[data-view="chklists"] { display: block !important; }

/* Campaign Report — robust fallback using descendant combinators (not >),
   so the card shows regardless of exact wrapper nesting. Scoped to the
   active view + the single campaignreport card, so it can't over-match. */
.dashboard[data-active-view="campaignreport"] .card[data-view="campaignreport"] { display: block !important; }
.dashboard[data-active-view="campaignreport"] #defaultMemberDashboard { display: block !important; }

/* Client Directory card-grid hover */
.cd-card:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(99,102,241,0.12); transform: translateY(-2px); }

/* ── Campaign Wizard (AM create form) ── */
.tw-steps{display:flex;gap:0;margin-bottom:22px}
.tw-step{flex:1;text-align:center;position:relative;font-size:0.76rem;color:var(--muted);font-weight:600}
.tw-step .tw-dot{width:30px;height:30px;border-radius:50%;background:var(--surface);border:2px solid var(--border);display:flex;align-items:center;justify-content:center;margin:0 auto 6px;font-weight:700;position:relative;z-index:1;transition:.2s}
.tw-step.active .tw-dot{background:var(--primary);border-color:var(--primary);color:#fff}
.tw-step.done .tw-dot{background:#dcfce7;border-color:#22c55e;color:#15803d}
.tw-step.active{color:var(--primary-dark)}
.tw-step::after{content:'';position:absolute;top:15px;left:50%;width:100%;height:2px;background:var(--border);z-index:0}
.tw-step.done::after{background:#22c55e}
.tw-step:last-child::after{display:none}
.tw-nav{display:flex;justify-content:space-between;margin-top:20px;gap:10px}
.tw-dual{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.tw-dual-col{background:var(--bg);border:1.5px solid var(--border);border-radius:10px;padding:12px}
.tw-dual-col.selected{background:var(--tint-violet-bg);color:var(--tint-violet-fg);border-color:#c4b5fd}
.tw-dual-hdr{font-size:0.72rem;text-transform:uppercase;letter-spacing:.03em;color:var(--muted);margin-bottom:10px;display:flex;justify-content:space-between;font-weight:700}
.tw-dual-item{display:flex;align-items:center;gap:9px;padding:8px 10px;border-radius:8px;cursor:pointer;font-size:0.85rem;margin-bottom:4px;background:var(--surface);border:1px solid var(--border);transition:.12s}
.tw-dual-item:hover{border-color:var(--primary)}
.tw-dual-av{width:26px;height:26px;border-radius:7px;background:linear-gradient(135deg,#6366f1,#8b5cf6);color:#fff;display:flex;align-items:center;justify-content:center;font-size:0.7rem;font-weight:700;flex-shrink:0}
.tw-dual-item .tw-move{margin-left:auto;font-weight:700;color:var(--muted)}
.tw-dual-col.selected .tw-dual-item .tw-move{color:#a78bfa}
@media(max-width:600px){.tw-dual{grid-template-columns:1fr}}

/* ── SweetAlert2 modals — compact, app-matched sizing ──────────────────
   Default Swal popups render quite large (wide popup, oversized title &
   icon). These overrides make every error / warning / confirm / success
   dialog a tidy, consistent size that matches the rest of the app.
   NOTE: the fixed width is scoped with :not(.swal2-toast) so it never
   applies to corner toasts — a toast forced to 26em wrapped/cut its text. */
.swal2-popup:not(.swal2-toast) {
        width: 26em !important;
        max-width: calc(100vw - 32px) !important;
        padding: 22px 22px 20px !important;
        border-radius: 16px !important;
        box-shadow: 0 24px 60px rgba(16,24,40,0.18) !important;
        font-size: 15px !important;
}
.swal2-popup:not(.swal2-toast) .swal2-title {
        font-size: 1.12rem !important;
        font-weight: 800 !important;
        color: var(--text) !important;
        padding: 0 !important;
        margin: 4px 0 0 !important;
        line-height: 1.35 !important;
}
.swal2-html-container {
        font-size: 0.9rem !important;
        color: var(--text-soft) !important;
        margin: 10px 4px 0 !important;
        line-height: 1.5 !important;
}
.swal2-icon {
        width: 3.4em !important;
        height: 3.4em !important;
        margin: 6px auto 4px !important;
        border-width: 3px !important;
}
.swal2-icon .swal2-icon-content { font-size: 2.2em !important; }
.swal2-actions { margin: 18px 0 2px !important; gap: 10px !important; }
.swal2-styled {
        font-size: 0.88rem !important;
        font-weight: 700 !important;
        padding: 9px 20px !important;
        border-radius: 9px !important;
        box-shadow: none !important;
        margin: 0 !important;
}
.swal2-styled:focus { box-shadow: none !important; }
/* Toasts (ttToast) — small, unobtrusive, natural width (never the 26em above) */
.swal2-toast { width: auto !important; max-width: 360px !important; padding: 12px 16px !important; box-shadow: 0 8px 24px rgba(16,24,40,0.16) !important; }
.swal2-toast .swal2-title { font-size: 0.86rem !important; font-weight: 700 !important; margin: 0 !important; padding: 0 !important; text-align: left !important; }
.swal2-toast .swal2-icon { width: 1.8em !important; height: 1.8em !important; margin: 0 8px 0 0 !important; }
@media (max-width: 600px) {
        .swal2-popup { width: calc(100vw - 28px) !important; padding: 18px !important; }
        .swal2-title { font-size: 1.02rem !important; }
}

/* ── SweetAlert2 — popup SURFACE and INPUT controls ─────────────────────
   The block above styles the popup CHROME (width, title, icon, actions,
   buttons) but never its surface or its inputs, and it predates the dark
   theme. Two consequences, both of which land on the Team Tasks
   "Complete task" dialog — the app's only Swal that carries inputs:

   1. The popup kept SweetAlert's default WHITE background while
      .swal2-title was forced to var(--text). In dark mode that resolves to
      #e8eaf0 on #ffffff — near-white text on white. .swal2-html-container
      (var(--text-soft), #c3c8d4) went exactly the same way, which is why
      "Both fields are required." reads as a ghost.

   2. .swal2-select / .swal2-input / .swal2-textarea were never styled at
      all, so they fell through to the CDN defaults — a white control with
      its own border, height and font sitting inside an otherwise
      app-styled dialog.

   Fixed through the theme TOKENS rather than a dark-only override, so
   light mode is unchanged (--card is #ffffff there, precisely what Swal
   already painted) and dark mode simply follows the tokens. This also
   repairs toasts, which were white-on-dark for the same reason. */
.swal2-popup {
        background: var(--card) !important;
        color: var(--text) !important;
}
.swal2-select,
.swal2-input,
.swal2-textarea,
.swal2-file {
        background: var(--bg) !important;
        color: var(--text) !important;
        border: 1.5px solid var(--border) !important;
        border-radius: 9px !important;
        box-shadow: none !important;
        font-size: 0.88rem !important;
        font-family: inherit !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin: 12px 0 0 !important;
        padding: 9px 12px !important;
}
.swal2-textarea { min-height: 92px !important; resize: vertical !important; }
.swal2-select:focus,
.swal2-input:focus,
.swal2-textarea:focus {
        border-color: var(--primary) !important;
        outline: none !important;
}
/* Swal's own default here is a light grey bar with dark text — unreadable
   once the popup behind it is dark. */
.swal2-validation-message {
        background: var(--bg-subtle) !important;
        color: var(--text) !important;
        font-size: 0.82rem !important;
        border-radius: 8px !important;
}

/* ── PID Approval tracking-links: hide the ✕ on the FIRST (default) row of each
   link category (CTA/VTA/Onelink/…), while keeping it on rows added via
   "+ Add link". Rows live in #tl-rows-{apid}-{key}; the first default row is
   always :first-child, and _tlAddRow appends further rows after it. Pure CSS —
   no JS, listeners, or payloads touched (the button stays in the DOM, just
   hidden, so nothing that queries it by class/onclick is affected). */
[id^="tl-rows-"] > div:first-child > button {
        display: none !important;
}


/* ── Shared modal close (X) ──────────────────────────────────────────────
   One class so every modal gets an identical, discoverable close affordance.
   .modal is position:relative already, so this pins to its top-right corner.
   Add as the FIRST child of .modal — no header restructuring needed, and it
   works whether or not the modal has an <h3>. */
.modal-x {
        position: absolute; top: 12px; right: 12px;
        width: 30px; height: 30px; padding: 0; z-index: 2;
        display: flex; align-items: center; justify-content: center;
        background: none; border: none; border-radius: 8px;
        color: var(--muted); font-size: 1.25rem; line-height: 1; cursor: pointer;
        transition: background .15s, color .15s;
}
.modal-x:hover { background: var(--bg-subtle); color: var(--text); }
.modal-x:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* ── My PIDs "task left" pending badge — gentle pulse to draw the eye to
   campaigns that still have PIDs needing a publisher name + payout. ── */
@keyframes pmPidPendingPulse {
        0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55); }
        50%      { box-shadow: 0 0 0 4px rgba(245, 158, 11, 0); }
}
.pm-pid-pending-dot { animation: pmPidPendingPulse 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
        .pm-pid-pending-dot { animation: none; }
}

/* ── KEYBOARD FOCUS ────────────────────────────────────────────────────────
   Only two elements had a focus-visible ring, so tabbing through the app —
   or filling the Daily Tracker grid from the keyboard, which is how you'd
   actually do it fast — left no indication of where you were.

   :focus-visible (not :focus) means mouse users see nothing change; the ring
   appears only for keyboard navigation. Applied broadly so new markup inherits
   it instead of each control needing to remember. */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible,
.nav-item:focus-visible,
.notif-act-btn:focus-visible,
.mini-action-btn:focus-visible,
.pid-chip:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: 2px;
        border-radius: 6px;
}
/* Inputs that deliberately drop the outline still need a keyboard cue — give
   them the ring back on keyboard focus only. */
.dt-day-input:focus-visible,
.dt-summary-input:focus-visible,
.gl-search:focus-visible,
.hier-select:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: 1px;
}
/* Skip straight to the main content — the sidebar is ~20 links to tab past on
   every page. Hidden until focused. */
.tt-skip-link {
        position: absolute; left: 8px; top: -60px; z-index: 9999;
        background: var(--primary); color: #fff; font-size: 0.85rem; font-weight: 700;
        padding: 9px 16px; border-radius: 0 0 8px 8px; text-decoration: none;
        transition: top 0.15s;
}
.tt-skip-link:focus { top: 0; }

/* ══════════════════════════════════════════════════════════════════════════
   PAGER  (.tt-pager)
   Numbered page strip for card grids. Written as a generic component rather
   than inline styles on one screen, because the same control is wanted on
   every long card list; the Client Directory is just the first adopter.

   Replaces an IntersectionObserver infinite scroll that could not work on wide
   screens: one batch of cards never filled a desktop viewport, so the sentinel
   stayed permanently on-screen, never re-crossed the threshold, and the
   observer never fired a second time. A pager has no viewport dependency at
   all, which is why it is the fix rather than a bigger batch size.

   Colour comes entirely from the theme tokens, so dark mode needs no override
   block of its own.
   ══════════════════════════════════════════════════════════════════════════ */
.tt-pager {
        display: flex; align-items: center; justify-content: center;
        gap: 6px; flex-wrap: wrap;
        margin-top: 16px; padding: 10px;
        background: var(--bg); border: 1px solid var(--border); border-radius: 14px;
}
.tt-pager-btn {
        min-width: 36px; height: 36px; padding: 0 11px;
        display: inline-flex; align-items: center; justify-content: center; gap: 6px;
        border: 1.5px solid var(--border-strong); border-radius: 10px;
        background: var(--card); color: var(--text-soft);
        font-family: inherit; font-size: 0.82rem; font-weight: 700;
        cursor: pointer; user-select: none;
        transition: background .15s, color .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.tt-pager-btn:hover:not(:disabled):not(.is-active) {
        border-color: var(--primary); color: var(--primary-dark);
        background: var(--primary-light); transform: translateY(-1px);
}
.tt-pager-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tt-pager-btn:disabled { opacity: .42; cursor: not-allowed; }
/* Current page — same gradient/glow language as .btn-primary so the pager
   reads as part of the app's button system, not a bolted-on widget. */
.tt-pager-btn.is-active {
        background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
        border-color: var(--primary-dark); color: #fff; cursor: default;
        box-shadow: 0 1px 2px rgba(79,70,229,.4), 0 4px 12px var(--primary-glow);
}
.tt-pager-gap {
        min-width: 22px; text-align: center; color: var(--muted);
        font-size: 0.82rem; font-weight: 700; user-select: none;
}
.tt-pager-edge { font-size: 0.76rem; }          /* « First / Last » */
.tt-pager-sep { width: 1px; height: 22px; background: var(--border-strong); margin: 0 4px; }
.tt-pager.is-busy { opacity: .55; pointer-events: none; }

/* The strip degrades in two steps rather than wrapping. A wrapped pager
   orphans a single button on a second row, which reads as broken layout.

   Step 1 (tablets, and any narrow card this component is reused in): drop
   First/Last. They are the widest controls at ~58px each and the most
   redundant — Prev/Next plus the numbered buttons reach the same pages. The
   full strip needs ~520px; without them ~400px, which clears the tightest
   real column (~570px at the 640px breakpoint, where the sidebar is already
   collapsed) with room for 3-digit page numbers. */
@media (max-width: 900px) {
        .tt-pager-edge { display: none; }
}
/* Step 2 (phones): numbers go too, replaced by a compact "3 / 12" counter
   between the arrows. */
.tt-pager-count { display: none; font-size: 0.8rem; font-weight: 700; color: var(--text-soft); padding: 0 4px; }
@media (max-width: 640px) {
        .tt-pager { gap: 5px; padding: 8px; }
        .tt-pager-sep, .tt-pager-num, .tt-pager-gap { display: none; }
        .tt-pager-count { display: inline-flex; align-items: center; }
        .tt-pager-btn { min-width: 34px; height: 34px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   PM MY-CAMPAIGNS FILTER PILLS  (.pm-filter-btn)
   All / Requested / Approved / Rejected above the PM campaign list.

   These used to carry their background and border as INLINE styles, so the
   .active class the click handler adds could never show — an inline
   declaration outranks any class rule, and the selected filter looked
   identical to the other three. Styling lives here now and the markup carries
   only the class, which is what lets .active win.

   Same visual language as .cs-toggle-btn so the two filter strips in this app
   read as the same control.
   ══════════════════════════════════════════════════════════════════════════ */
.pm-filter-btn {
        font-size: 0.78rem; padding: 6px 14px;
        border: 1.5px solid var(--border); border-radius: 999px;
        background: var(--surface); color: var(--muted);
        font-family: inherit; font-weight: 600; cursor: pointer;
        transition: background .15s, color .15s, border-color .15s;
}
.pm-filter-btn:hover:not(.active) { border-color: var(--primary); color: var(--primary-dark); }
.pm-filter-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.pm-filter-btn.active {
        background: var(--primary); color: #fff; border-color: var(--primary);
        box-shadow: 0 1px 2px rgba(79,70,229,.35);
}
@media (prefers-reduced-motion: reduce) { .pm-filter-btn { transition: none; } }

/* ══════════════════════════════════════════════════════════════════════════
   BUSY OVERLAY  (.tt-load-*)
   A "Please wait" loader that sits ON TOP of content already on screen —
   unlike .tt-state / ttLoadingHtml(), which REPLACE a view's contents. Used
   over the Client Directory's skeleton cards and over the My Clients / My
   Publishers list while their data is in flight.

   Shown on a DELAY by ttBusyOverlay(): a page flip that answers in 80ms must
   not flash a loader, because a one-frame blink reads as jank rather than as
   feedback. It appears only once a fetch is genuinely slow, which is the
   whole point of the control.
   ══════════════════════════════════════════════════════════════════════════ */
:root                   { --scrim: rgba(246,247,249,0.74); }
html[data-theme="dark"] { --scrim: rgba(20,22,28,0.74); }

.tt-load-host { position: relative; }
.tt-load-overlay {
        position: absolute; inset: 0; z-index: 6;
        display: flex; align-items: flex-start; justify-content: center;
        padding-top: 30px;
        background: var(--scrim);
        -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
        border-radius: 12px;
        animation: ttLoadIn .18s ease-out;
}
@keyframes ttLoadIn { from { opacity: 0; } to { opacity: 1; } }
.tt-load-card {
        display: flex; flex-direction: column; align-items: center; gap: 9px;
        background: var(--card); border: 1px solid var(--border);
        border-radius: 14px; padding: 18px 26px;
        box-shadow: 0 10px 30px rgba(16,24,40,.13);
}
/* Three concentric arcs at different speeds, the middle one counter-rotating.
   Reuses the app's existing tt-spin keyframes rather than declaring a second
   rotation that does exactly the same thing. */
.tt-load-rings { position: relative; width: 44px; height: 44px; }
.tt-load-rings span {
        position: absolute; border-radius: 50%;
        border: 3px solid transparent;
        animation: tt-spin 1s linear infinite;
}
.tt-load-rings span:nth-child(1) { inset: 0;    border-top-color: var(--primary); }
.tt-load-rings span:nth-child(2) { inset: 7px;  border-top-color: #8b5cf6;
                                   animation-duration: 1.5s; animation-direction: reverse; }
.tt-load-rings span:nth-child(3) { inset: 14px; border-top-color: var(--primary-dark);
                                   animation-duration: .75s; }

.tt-load-title { margin: 0; font-size: 0.9rem; font-weight: 700; color: var(--text);
                 display: flex; align-items: baseline; gap: 3px; }
.tt-load-sub   { margin: 0; font-size: 0.76rem; color: var(--muted); font-weight: 500; }
.tt-load-dots  { display: inline-flex; gap: 3px; }
.tt-load-dots i {
        width: 4px; height: 4px; border-radius: 50%; background: var(--primary);
        animation: ttLoadDot 1s ease-in-out infinite;
}
.tt-load-dots i:nth-child(2) { animation-delay: .16s; }
.tt-load-dots i:nth-child(3) { animation-delay: .32s; }
@keyframes ttLoadDot { 0%,100% { opacity: .25; transform: translateY(0); }
                       50%     { opacity: 1;   transform: translateY(-3px); } }

@media (prefers-reduced-motion: reduce) {
        .tt-pager-btn { transition: none; }
        .tt-load-overlay { animation: none; }
        .tt-load-rings span { animation-duration: 2.4s; }
        .tt-load-dots i { animation: none; opacity: .7; }
}

/* ══════════════════════════════════════════════════════════════════════════
   DARK THEME
   Opt-in via <html data-theme="dark">, set by the toggle in Settings and
   remembered per browser. Not tied to prefers-color-scheme, because the OS
   preference and "I want the work app dark" are different questions.

   Only the neutral palette flips. The semantic tints (badges, status pills,
   the amber fill-in block) keep their own colours because each of those sets
   BOTH its background and its text — they stay legible on a dark card, and
   recolouring them would mean re-deriving hundreds of pairs by hand and
   getting some of them wrong.

   Surfaces are deliberately not pure black: #14161c / #1b1e26 keeps the
   elevation difference between page, card and input readable, which pure
   black destroys.
   ══════════════════════════════════════════════════════════════════════════ */
/* ── SEMANTIC TINT TOKENS ──────────────────────────────────────────────────
   Pale panels (the amber "add publisher + payout" block, green PID rows, red
   warnings…) used hardcoded fills and let their text inherit. That's fine in
   light mode and breaks in dark: the fill stays pale while the inherited text
   flips light, giving light-on-white.

   Each family gets a background AND a foreground token, so a panel is always
   self-contained. Light values are exactly the previous hardcoded colours, so
   nothing changes visually in light mode. */
:root {
        --tint-amber-bg:   #fffbeb;  --tint-amber-fg:   #92400e;  --tint-amber-bd:   #fde68a;
        --tint-green-bg:   #f0fdf4;  --tint-green-fg:   #166534;  --tint-green-bd:   #bbf7d0;
        --tint-teal-bg:    #f0fdfa;  --tint-teal-fg:    #0f766e;  --tint-teal-bd:    #99f6e4;
        --tint-red-bg:     #fef2f2;  --tint-red-fg:     #991b1b;  --tint-red-bd:     #fecaca;
        --tint-blue-bg:    #eff6ff;  --tint-blue-fg:    #1d4ed8;  --tint-blue-bd:    #bfdbfe;
        --tint-indigo-bg:  #eef2ff;  --tint-indigo-fg:  #4338ca;  --tint-indigo-bd:  #c7d2fe;
        --tint-violet-bg:  #f5f3ff;  --tint-violet-fg:  #6d28d9;  --tint-violet-bd:  #ddd6fe;
        --tint-neutral-bg: #f3f4f6;  --tint-neutral-fg: #374151;  --tint-neutral-bd: #e5e7eb;
}
/* Dark: deep, low-saturation fills with light text of the same hue. Contrast
   checked — every pair below is at least 7:1. */
html[data-theme="dark"] {
        --tint-amber-bg:   #2e2410;  --tint-amber-fg:   #fcd34d;  --tint-amber-bd:   #4a3a1a;
        --tint-green-bg:   #10241a;  --tint-green-fg:   #86efac;  --tint-green-bd:   #1d3d2c;
        --tint-teal-bg:    #0f2523;  --tint-teal-fg:    #5eead4;  --tint-teal-bd:    #1b3d39;
        --tint-red-bg:     #2c1517;  --tint-red-fg:     #fca5a5;  --tint-red-bd:     #4a2226;
        --tint-blue-bg:    #14203a;  --tint-blue-fg:    #93c5fd;  --tint-blue-bd:    #21335c;
        --tint-indigo-bg:  #1a1e3d;  --tint-indigo-fg:  #a5b4fc;  --tint-indigo-bd:  #2b3163;
        --tint-violet-bg:  #221a3a;  --tint-violet-fg:  #c4b5fd;  --tint-violet-bd:  #362a5c;
        --tint-neutral-bg: #23262e;  --tint-neutral-fg: #c3c8d4;  --tint-neutral-bd: #333743;
}

html[data-theme="dark"] {
        --bg:            #14161c;
        --bg-subtle:     #1b1e26;
        --surface:       #1b1e26;
        --card:          #1b1e26;

        --text:          #e8eaf0;
        --text-soft:     #c3c8d4;
        --muted:         #98a0b0;
        --faint:         #868da0;   /* 5.0:1 on --surface — #6f7688 was 3.7:1, below AA */

        --border:        #2b2f3a;
        --border-strong: #3a3f4d;
        --ring:          rgba(129,140,248,0.28);
        /* Slightly lighter than --surface so a field reads as inset on a dark card. */
        --input-bg:      #23262e;

        --primary:       #818cf8;
        --primary-dark:  #6366f1;
        --primary-darker:#a5b4fc;
        --primary-light: #232840;
        --primary-glow:  rgba(129,140,248,0.36);

        /* Shadows barely register on dark surfaces; borders carry elevation
           instead, so these are deepened rather than removed. */
        --shadow-xs: 0 1px 2px rgba(0,0,0,0.40);
        --shadow-sm: 0 1px 3px rgba(0,0,0,0.45), 0 1px 2px rgba(0,0,0,0.30);
        --shadow-md: 0 4px 14px rgba(0,0,0,0.50), 0 2px 6px rgba(0,0,0,0.30);
        --shadow-lg: 0 12px 32px rgba(0,0,0,0.55), 0 4px 10px rgba(0,0,0,0.35);
        --shadow-xl: 0 24px 60px rgba(0,0,0,0.65);

        color-scheme: dark;   /* native scrollbars, date pickers and form controls */
}

/* Semantic tints (badges, status pills) are intentionally left ALONE.
   Each sets both its own background and its own text — a pale fill with dark
   text — so they stay perfectly legible sitting on a dark card. They read as
   bright accents rather than muted ones, which is the correct behaviour for a
   status indicator anyway.

   A brightness() filter was tried here and removed: it darkens the text along
   with the fill, producing dark-on-dark. Any future attempt to tone these down
   has to recolour the fill only, leaving the text untouched. */

/* Images and screenshots shouldn't be dimmed by the theme. */
html[data-theme="dark"] img { filter: none; }

/* Appearance selector: Light / Auto / Dark. A segmented control rather than a
   single toggle, because with three states a toggle can't show which is active
   — and "Auto" in particular needs to be visibly a state, not a one-off action. */
.tt-theme-seg { display:inline-flex; border:1.5px solid var(--border-strong); border-radius:10px; overflow:hidden; }
.tt-theme-opt {
        font-size:0.82rem; font-weight:700; padding:7px 14px; border:none; cursor:pointer;
        background:var(--surface); color:var(--muted); font-family:inherit; transition:background .14s,color .14s;
}
.tt-theme-opt + .tt-theme-opt { border-left:1px solid var(--border); }
.tt-theme-opt:hover { color:var(--text); }
.tt-theme-opt.on { background:var(--primary); color:#fff; }
.tt-theme-opt:focus-visible { outline:2px solid var(--primary); outline-offset:-2px; }

/* ── DARK: structural surfaces built from GRADIENTS ────────────────────────
   These were missed by the first pass, which only matched `background: #hex`.
   A gradient between two near-whites is still a white surface, and because
   these set no colour of their own the text inherited --text and flipped light
   — giving the near-invisible page title and card headings.

   Chrome (topbar, card headers, inputs) is remapped to the neutral tokens; the
   one tinted banner keeps its meaning via the amber tint tokens. */
html[data-theme="dark"] .member-head,
html[data-theme="dark"] .tmd-header,
html[data-theme="dark"] .card-head {
        background: linear-gradient(180deg, var(--bg-subtle), var(--surface));
        color: var(--text);
        border-color: var(--border);
}
html[data-theme="dark"] .card-head h3,
html[data-theme="dark"] .member-head h1,
html[data-theme="dark"] .member-head h2,
html[data-theme="dark"] .tmd-header h3 { color: var(--text); }

html[data-theme="dark"] .hier-card.is-senior {
        background: linear-gradient(135deg, var(--surface), var(--tint-violet-bg));
        color: var(--text);
}
html[data-theme="dark"] .banner {
        background: linear-gradient(180deg, var(--tint-amber-bg), var(--tint-amber-bg));
        color: var(--tint-amber-fg);
        border-color: var(--tint-amber-bd);
}

/* Form controls: a near-white field with inherited (now light) text is
   unreadable and also looks wrong against dark cards. */
html[data-theme="dark"] input[type=date],
html[data-theme="dark"] input[type=time],
html[data-theme="dark"] input[type=month],
html[data-theme="dark"] input[type=datetime-local],
html[data-theme="dark"] .dyn-list-row input,
html[data-theme="dark"] .dyn-list-row select {
        background: var(--surface);
        color: var(--text);
        border-color: var(--border);
}

/* The page background behind the cards. */
html[data-theme="dark"] .main-area { background: var(--bg); color: var(--text); }